firefly.data_reader.SimpleReader

class firefly.data_reader.SimpleReader(path_to_data, field_names=None, write_to_disk=True, extension='.hdf5', loud=True, csv_sep=',', **kwargs)[source]

Bases: firefly.data_reader.reader.ArrayReader

A wrapper to firefly.data_reader.ArrayReader that attempts to flexibily open generically formatetd data with minimal interaction from the user.

__init__(path_to_data, field_names=None, write_to_disk=True, extension='.hdf5', loud=True, csv_sep=',', **kwargs)[source]

A simple reader that will take as minimal input the path to a (set of) .hdf5 file(s) and extract each top level group’s ‘Coordinates’ or ‘x’,’y’,’z’ values. Coordinate data must saved either as an (N,3) array or in 3 separate (N,) arrays indexed by x,y, and z.

Keyword arguments are passed to the parent Reader.

Parameters
  • path_to_data (str) – path to .hdf5/csv file(s; can be a directory)

  • field_names (list of strs) – strings to try and extract from .hdf5 file. If file format is .csv then there must be a header row

  • extension (str, optional) – file extension to attempt to open. Accepts only '.hdf5' or '.csv', defaults to ‘.hdf5’

  • loud (bool, optional) – flag to print status information to the console, defaults to False

  • csv_sep (str, optional) – separator between values in the csv, defaults to ‘,’

Raises
  • ValueError – if path_to_data is not a directory or doesn’t contain extension

  • ValueError – if extension is passed anything either than '.hdf5' or '.csv'

  • ValueError – if particle_groups is not None, extension = .csv, and len(particle_groups) != len(detected filenames in path_to_data)