osirispy module

Module methods

osirispy.read(fname, req_quants=('x1', 'x2'))[source]

Reads an OSIRIS output data file.

Parameters
  • fname (str) – The path to the data file

  • req_quants (tuple of str, optional) – The quantities required when reading RAW or TRACKS files, defaults to (“x1”,”x2”)

Returns

An os_data object

Return type

os_data

Module classes

class osirispy.os_data(datatype)[source]

Bases: object

A class to represent a generic OSIRIS output data object.

Parameters

datatype (str) – The type of OSIRIS data (‘grid’, ‘particles’ our ‘tracks’)

property datatype
class osirispy.grid(fname)[source]

Bases: os_data

A class used to represent a grid data object

Parameters
  • dims (int) – A formatted string to print out what the animal says

  • axis (list of axis) – A list of axis objects containg the spatial limits of the grid

  • data (np.array) – The grid data

  • label (str) – The label of the quantity in the grid

  • time_s (np.float) – The timestamp of the grid file

__init__(fname)[source]

Constructs all the necessary attributes for the grid object.

Parameters

fname (str) – The path to the osiris data file

class osirispy.axis(nx, lims, label)[source]

Bases: object

A class used to represent an axis object

:param nx : The number of points along the axis :type nx: int :param ax_arr : The array containing the axis poins :type ax_arr : np.array :param label: The axis label :type label : str

__init__(nx, lims, label)[source]

Constructs all the necessary attributes for the os_data object.

Parameters
  • nx (int) – The number of points along the axis

  • ax_arr (np.array) – The array containing the axis poins

  • label (str) – The axis label

class osirispy.raw(fname, req_quants)[source]

Bases: os_data

A class used to represent a particles data object

Parameters
  • data (dict of (str,np.arrays)) – a dictionary containing the required quantities

  • label (dict of (str,str)) – a dictionary containing the labels of required quantities

  • time_s (np.float) – the timestamp of the grid file

__init__(fname, req_quants)[source]

Constructs all the necessary attributes for the raw object. Loads the required quantities (if available) into a dictionary of np.arrays whose keys are the requeired quantities.

Parameters
  • fname (str) – The path to the osiris data file

  • req_quants (list of str) – A list containing the required quantities

Raises

KeyError – If a required quantity is not available on the file

class osirispy.track(fname, req_quants)[source]

Bases: os_data

A class used to represent a tracks data object

Parameters
  • data (dict of (str,list of np.arrays)) – a dictionary containing the required quantities for each particle

  • label (dict of (str,str)) – a dictionary containing the labels of required quantities

__init__(fname, req_quants)[source]

Constructs all the necessary attributes for the tracks object. Reads fname and loads the required quantities (if available) into a dictionary of lists np.arrays whose keys are the requeired quantities.

Parameters
  • fname (str) – The path to the osiris data file

  • req_quants (list of str) – A list containing the required quantities

Raises

KeyError – If a required quantity is not available on the file