hysteron package

Submodules

hysteron.hysteron module

Event-based simulation of hysterons (hysteretic 2-state subsystems).

exception hysteron.hysteron.DegeneracyError[source]

Bases: RuntimeError

Raised if multiple hysterons are equally unstable.

exception hysteron.hysteron.StabilityError[source]

Bases: RuntimeError

Raised if system cannot be made stable.

hysteron.hysteron.amplitude_sweep(interactions, Hon, Hoff, possible_states)[source]

Find the minimum amplitude that causes period > 1.

Returns the observed period and the amplitude.

If the returned period is 1, no period > 1 was found.

hysteron.hysteron.compute_possible_states(N)[source]

Return all possible states of N hysterons.

Returns a 2^N x N array.

hysteron.hysteron.evolve_event(state, H_target, rising, interactions, Hon, Hoff, recorder, debug=False, find_next_flip=False)[source]

Portion of an event-based simulation that changes field to H_target.

If this results in a hysteron flip, “state” will be modified in-place, unless “find_next_flip” is true.

“rising” should be 0 or 1, depending on the direction of field change.

“interactions” is the J_ij matrix, dimensions N x N where N is the number of hysterons. The effective local value of the field at each hysteron is computed as state * interactions + H, where H is the external field.

“Hon” and “Hoff” are vectors of length N, with Hon >= Hoff, that specify the local value of field at which each hysteron changes state.

“recorder” is a Recorder object. Each row in the recorded data relfects the system state and other conditions before a spin is flipped.

If “debug”, lots of pontentially useful information junk will be spewed to stdout.

If “find_next_flip”, return the value of H that will cause the next spin to flip. Use with “H_target” = +/-inf.

hysteron.hysteron.possible_amplitudes(interactions, Hon, Hoff, possible_states)[source]

Return the set of distinctive field amplitudes for a system.

These can be used to generate all possible trajectories of the system under symmetric driving (excluing the one with no hysteron flips at all).

“possible_states” is an MxN array containing all M possible states of N hysterons. It can be found with compute_possible_states()

This finds the midpoints halfway between the absolute values of field at which hysterons can switch.

hysteron.hysteron.run_event_extended(state, interactions, Hon, Hoff, amplitude, recorder=None, H_init=- inf, debug=False, terminate_on_repeat=True)[source]

Simulate system under oscillatory driving.

“state” is the initial state. “H_init” is the initial field value.

“interactions” is the J_ij matrix, dimensions N x N where N is the number of hysterons. The effective local value of the field at each hysteron is computed as state * interactions + H, where H is the external field.

“Hon” and “Hoff” are vectors of length N, with Hon >= Hoff.

“amplitude” is the amplitude of cyclic driving in H. The simulation begins by ramping the field from “H_init” to +amplitude.

“recorder” is a Recorder object, if recording of data is desired.

“debug” gets evolve_event() to print lots of information.

If “terminate_on_repeat”, stop the simulation as soon as a previous state is revisited. Otherwise, run for 2**N + 1 cycles.

Returns the observed period of the limit cycle.

hysteron.hysteron.run_event_extended_fast(state, interactions, Hon, Hoff, amplitude, recorder=None, H_init=- inf, debug=False, terminate_on_repeat=True)[source]

Stripped-down, numba-only version of run_event_extended().

Call this directly in performance-critical code. For best performance, specify all optional arguments explicitly (reason unknown).

hysteron.hysteron.stabilize_event(state, H, interactions, Hon, Hoff, recorder)[source]

Find a stable state, holding magnetic field fixed.

hysteron.hysteron.states_from_traces(traces, N, shorten=True)[source]

Returns a list of state vectors.

If ‘shorten’, remove consecutive duplicates.

hysteron.hysteron.try_params(interactions, Hon, Hoff, amplitude=1.0, debug=False)[source]

Wrapper around run_event_extended() to check for interesting behavior.

Returns the period of the limit cycle, or -1 if an error was encountered.

hysteron.hysteron.uniform(a, b, N=1)[source]

N numbers in a uniform distribution between a and b.

hysteron.hysteron.uniform1(a, b)[source]

One number in a uniform distribution between a and b.

Module contents

Top-level package for Interacting Hysteron Simulation.