magpy.results module¶

class
magpy.results.
EnsembleResults
(results)[source]¶ Bases:
object
Results from a simulation of an ensemble of particle clusters
The EnsembleResults object holds the resulting magpy.Results objects for an ensemble of simulated particle clusters. It provides a userfriendly alternative to handling a large collection of magpy.Results instances and implemetns methods for computing ensemblewide properties.
Parameters: results (list[magpy.Results]) – results for each particle cluster in the ensemble 
time
¶ (np.ndarray): 1d array of length M. Time in seconds for each sample in the ensemble results.

field
¶ (np.ndarray): 1d array of length M. Field amplitude at each point in time. Field is always applied along the zaxis.

energy_dissipated
(start_time=None, end_time=None)[source]¶ Total energy dissipated by the ensemble.
A simulation with a constant or zero applied field will dissipate no energy. The energy dissipated by an ensemble of magnetic particle clusters subjected to an alternating field is the area of the hysteresis loop (magnetisationfield plane).
The energy dissipated may be computed for the entire simulation or within a specific time window, defined by start_time and end_time
Parameters:  start_time (double, optional) – the start of the time window for computing energy dissipated. Default value None uses the start of the simulation.
 end_time (double, optional) – the end of the time window for computing energy dissipated. Default value None uses the end of the simulation.
Returns: total energy dissipated by the ensemble during the time window
Return type: double

ensemble_magnetisation
(direction='z')[source]¶ Total magnetisation of entire ensemble
The total magnetisation of an ensemble of particle clusters. The ensemble magnetisation is the average value of the magnetisation of each particle particle cluster in the ensemble at each point in time. The component (x,`y`,`z`) along which the magnetisation may be specified. The default value is z, which is the same direction as the applied magnetic field.
Parameters: direction (str, optional) – direction of magnetisation x, y or z. Default value is z. Returns:  1d array of length M containing the ensemble magnetisation
 for each point in self.time
Return type: np.ndarray

final_cycle_energy_dissipated
(field_frequency)[source]¶ Energy dissipated by the final cycle of the magnetic field.
A simulation with a constant or zero applied field will dissipate no energy. The energy dissipated by an ensemble of magnetic particle clusters subjected to an alternating field is the area of the hysteresis loop (magnetisationfield plane).
Use this function to compute the energy dissipated by the final cycle (i.e. period) of the applied alternating magnetic field if the total simulation time contains multiple cycles of the field (i.e. is longer than the period of the applied field). A common use case for this is to simulate a large number field cycles to reach equilibrium and then compute the energy dissipated during a single cycle of the field in equilibrium.
Parameters: field_frequency (double) – the frequency of the applied magnetic field Returns: energy dissipated during the last cycle of the applied magnetic field. Return type: double

final_state
()[source]¶ State of each ensemble member at the end of the simulation.
The final state of each particle cluster in the ensemble at the end of the simulation time. The state of each particle cluster is the value of magnetisation vector of every particle in the cluster.
Returns: a list of nested dictionaries like {‘x’: {0: m_x, …, N1: m_x}, ‘y’: …}. The dictionaries contain the final value of the magnetisation vector for each of the N particles in the cluster. Return type: list[dict]

magnetisation
(direction='z')[source]¶ Total magnetisation of each member of the ensemble
The total magnetisation of cluster is computed by summing the components of the magnetisation vector for each particle in the cluster. The component (x,`y`,`z`) along which the magnetisation may be specified. The default value is z, which is the same direction as the applied magnetic field.
Parameters: direction (str, optional) – direction of magnetisation x, y or z. Default value is z. Returns: list containing a length M 1d array containing the total magnetisation of each particle cluster in the ensemble. Return type: list[np.ndarray]


class
magpy.results.
Results
(time, field, x, y, z, N)[source]¶ Bases:
object
Results of a simulation of a single particle cluster
The results contain the timevarying magnetisation and field resulting from stochastic simulation of a particle cluster consisting of N particles.
Parameters:  time (np.ndarray) – 1d array of length M. Time in seconds for each sample in the results
 field (np.ndarray) – 1d array of length M. Field amplitude at each point in time. Field is always applied along the zaxis.
 x (dict) – {0: np.ndarray, …, N1: np.ndarray} key, value pair is an interger particle id and a corresponding 1d array of length M for each of the N particles in the cluster. 1d array is the xcoordinate of the particle magnetisation vector at each point in time.
 y (dict) – {0: np.ndarray, …, N1: np.ndarray} key, value pair is an interger particle id and a corresponding 1d array of length M for each of the N particles in the cluster. 1d array is the ycoordinate of the particle magnetisation vector at each point in time.
 z (dict) – {0: np.ndarray, …, N1: np.ndarray} key, value pair is an interger particle id and a corresponding 1d array of length M for each of the N particles in the cluster. 1d array is the zcoordinate of the particle magnetisation vector at each point in time.
 N (int) – number of particles in the ensemble

final_state
()[source]¶ The state of the cluster at the end of the simulation.
Returns the state of the particle cluster at the end of the simulation time.
Returns:  a nested dictionary {‘x’: {0: m_x, …, N1: m_x}, ‘y’: …}
 containing the final value of the magnetisation vector for each of the N particles in the cluster.
Return type: dict

magnetisation
(direction='z')[source]¶ Computes the total magnetisation of the cluster
Computes the total timevarying magnetisation of the cluster in a desired direction. The total magnetisation is simply the sum of the individual magnetisation vector components in the specified direction (x,y, or z).
Parameters: direction (str, optional) – the direction of magnetisation x, y or z. Default value is z. Returns:  1d array of length M the total magnetisation at each point
 in self.time.
Return type: np.ndarray