firefly.data_reader.ArrayReader
- class firefly.data_reader.ArrayReader(coordinates, velocities=None, UInames=None, fields=None, field_names=None, decimation_factor=1, write_to_disk=True, loud=True, **kwargs)[source]
Bases:
firefly.data_reader.reader.Reader
A wrapper to
firefly.data_reader.Reader
that stores raw numpy array data without opening anything from disk.- __init__(coordinates, velocities=None, UInames=None, fields=None, field_names=None, decimation_factor=1, write_to_disk=True, loud=True, **kwargs)[source]
- Takes a list of opened numpy arrays and creates a
firefly.data_reader.Reader
instance with their data. Takes
firefly.data_reader.Reader
passthrough kwargs.
- Parameters
coordinates (list, optional) – raw coordinate data, ignores path_to_data if passed. Can either pass N,3 np.array which is interpreted as a single particle group’s coordinates or a jagged (M,N_m,3) list of np.arrays which is interpreted as M many particle groups with each having N_m particles
velocities (list, optional) – raw velocity data, Can either pass N,3 np.array which is interpreted as a single particle group’s velocities or a jagged (M,N_m,3) list of np.arrays which is interpreted as M many particle groups with each having N_m particles
UInames (list of str) – list of particle group UInames
fields (list of shape (M,N_f,N_m)) – list of field arrays corresponding to each point of the coordinate data, Can pass: length N np.array which is interpreted as a single particle group’s field, (N_m,N_f) list which is interpreted as a single particle group’s fields, or a jagged (M,N_m,N_f) list of np.arrays which is interpreted as M many particle groups with each having N_m particles with N_f fields, defaults to []
field_names (list of strs) – strings to name fields by, defaults to [‘field%d’ for field in fields]
decimation_factor (int, optional) – factor by which to reduce the data randomly i.e.
data=data[::decimation_factor]
, defaults to 1write_to_disk (bool, optional) – flag that controls whether data is saved to disk (
True
) or only converted to a string and stored inself.JSON
(False
), defaults to Trueloud (bool, optional) – flag to print status information to the console, defaults to False
- Raises
np.AxisError – if the coordinate data cannot be interpreted
ValueError – if the number of particle groups does not match the number of coordinate arrays
np.AxisError – if the field data cannot be interpreted
np.AxisError – if the field names cannot be interpreted
- Takes a list of opened numpy arrays and creates a