firefly.data_reader.FIREreader

class firefly.data_reader.FIREreader(snapdir, snapnum, ptypes=None, UInames=None, decimation_factors=None, fields=None, filterFlags=None, colormapFlags=None, radiusFlags=None, logFlags=None, **kwargs)[source]

Bases: firefly.data_reader.reader.Reader

This is an example of a “custom” Reader that has been tuned to open data from the FIRE galaxy formation collaboration.

__init__(snapdir, snapnum, ptypes=None, UInames=None, decimation_factors=None, fields=None, filterFlags=None, colormapFlags=None, radiusFlags=None, logFlags=None, **kwargs)[source]
Base initialization method for FIREreader instances.

A FIREreader will conveniently read FIRE collaboration data and produce firefly compatible .json files.

Parameters
  • snapdir (str) – directory that contains all the hdf5 data files

  • snapnum (int) – which snapshot to open

  • ptypes (list of int, optional) – which particle types to extract (e.g. 'PartType%d'), defaults to []

  • UInames (list of str, optional) – what should the particle groups be called in the webapp UI, defaults to ['PartType%d for in in ptypes]

  • decimation_factors (list of int, optional) – factor by which to reduce the data randomly i.e. data=data[::decimation_factor], defaults to [1 for i in ptypes]

  • fields (list of str, optional) – names of fields to open from snapshot data (e.g. Temperature, AgeGyr, Density). Shared between particle types but if a particle type does not have a field (e.g. PartType4 does not have Temperature, PartType0 does not have AgeGyr) then that field is skipped for that particle type. defaults to []

  • filterFlags (list of bool, optional) – flags to signal whether field should be in filter dropdown, defaults to [True for i in fields]

  • colormapFlags (list of bool, optional) – flags to signal whether field should be in colormap dropdown, defaults to [True for i in fields]

  • radiusFlags (list of bool, optional) – flags to signal whether field should be in radius dropdown, defaults to [False for i in fields]

  • logFlags (list of bool, optional) – flags to signal whether the log of the field should be taken, defaults to [False for i in fields]

Raises
  • ValueError – if the length of ptypes, UInames, and decimation factors does not match.

  • ValueError – if the length of fields, filterFlags, colormapFlags, radiusFlags, and logFlags does not match.

  • FileNotFoundError – if snapdir cannot be found

loadData(com=None, vcom=None)[source]

Loads FIRE snapshot data using Alex Gurvich’s firefly.data_reader.snapshot_utils.openSnapshot(). (reproduced from https://github.com/agurvich/abg_python) and binds it to a corresponding firefly.data_reader.ParticleGroup instance.

Parameters

com (np.ndarray, optional) – position to offset all coordinates by if None, will calculate the CoM, defaults to None