MicromagneticAnalysisTools.Read

Tools for reading in simulation files.

MicromagneticAnalysisTools.Read.fileTime(file)

Reads the total simulation time given the name of a .ovf file.

Parameters:

file (str) – The ovf file for which the simulation time should be obtained. Full path required.

Returns:

The time of the file.

MicromagneticAnalysisTools.Read.getFilesToScan(directory, startFile=None, endFile=None)

Outputs a sorted list of .ovf files which are to be parsed.

Parameters:
  • directory (str) – The directory in which the simulation data is stored.

  • startFile (str, optional) – The starting file for which the helicity should be calculated.

  • endFile (str, optional) – The ending file for which the helicity should be calculated.

Returns:

Sorted list of ovf files to be processed.

MicromagneticAnalysisTools.Read.getInitialFile(directory)

Get the name of the intial file of the simulation (as I call them different things: Relaxed.ovf, and m000000.ovf).

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

The path to the initial file of the simulation.

MicromagneticAnalysisTools.Read.initialFileArray(directory)

Get the initial .ovf file of the simulation as a NumPy array.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

Initial file as (Nx, Ny, 3) NumPy array.

MicromagneticAnalysisTools.Read.sampleDiscretisation(directory)

Get descretization size of cells in m.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

Cell discretization dx, dy, dz.

MicromagneticAnalysisTools.Read.sampleExtent(directory)

Get the sample extent in nm.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

Sample extent Lx, Ly in nm.

MicromagneticAnalysisTools.Read.simulationCurrentArray(directory, component)

Reads the current of a simulation and outputs an array. Component can be x, y, z.

Parameters:
  • directory (str) – The directory in which the simulation data is stored.

  • component (str) – The component of the current to be read. Must be “x”, “y”, or “z”.

Returns:

Array of currents in the specified direction during the simulation, in A/m^2.

MicromagneticAnalysisTools.Read.simulationEnergyArray(directory)

Read the energy of a simulation and outputs an array.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

Array of (total) energy during the simulation in J.

MicromagneticAnalysisTools.Read.simulationTimeArray(directory, loadMethod='table', startFile=None, endFile=None)

Reads the time of a simulation and outputs an array. We can either do this by loading the table output by the MuMax, or we can obtain the timestamp of each file in the simulation.

Parameters:
  • directory (str) – The directory in which the simulation data is stored.

  • loadMethod (str) – The method by which the time data is loaded; must be either “files”, which reads the timestamps of the simulation files (slower) or “table”, which reads table.txt.

  • startFile (str, optional) – The starting file for which the helicity should be calculated.

  • endFile (str, optional) – The ending file for which the helicity should be calculated.

Returns: The array of times in the simulation in seconds.