Module helperfuncs#

A set of helper functions for identifying and filling out fields in the data dictionary produced by phconvert.loader.loadfile_bh() and phconvert.loader.loadfile_ptu() functions.

phconvert.helperfuncs.fill_alex_periods(data, *args)#

Add excitation periods to /photon_data/measurement_specs/ sub-dictionary of a dictionary to be converted into a photon-HDF5 file

Parameters:
  • data (dict) – Data dictionary.

  • *args (np.ndarray) – One array per excitation period, each array must be even number of elements specifiying the star and stop time(s) for the given period.

phconvert.helperfuncs.fill_measurement_type(data, measurement_type)#

Iterate over all photon_dataX groups and set the field /photon_dataX/measurement_spces/measurement_type to measuremnt_type

Parameters:
phconvert.helperfuncs.fill_setup(data)#

Fill setup dictioanry based on detectors_specs dictionary

Parameters:

data (dict) – The data dictionary, will infer setup field from detectors_specs fields

phconvert.helperfuncs.get_num_polarization(detectors_specs)#

Determine number of spectral detection types in a detectors_specs dictionary. Used to fill out field of /setup/num_polarization_ch automatically

Parameters:

detectors_specs (dict) – Dictionary to be converted into /photon_data/measurement_specs/detectors_specs.

Returns:

Integer value that should be placed in /setup/num_polarization_ch assuming no further changes to the input.

Return type:

int

phconvert.helperfuncs.get_num_spectral(detectors_specs)#

Determine number of spectral detection types in a detectors_specs dictionary. Used to fill out field of /setup/num_spectral_ch automatically

Parameters:

detectors_specs (dict) – Dictionary to be converted into /photon_data/measurement_specs/detectors_specs.

Returns:

Integer value that should be placed in /setup/num_spectral_ch assuming no further changes to the input.

Return type:

int

phconvert.helperfuncs.get_num_split(detectors_specs)#

Determine number of spectral detection types in a detectors_specs dictionary. Used to fill out field of /setup/num_split_ch automatically

Parameters:

detectors_specs (dict) – Dictionary to be converted into /photon_data/measurement_specs/detectors_specs.

Returns:

Integer value that should be placed in /setup/num_split_ch assuming no further changes to the input.

Return type:

int

phconvert.helperfuncs.pop_nones(data)#

Remove keys with None values in a dictionary from loader.loadfile_ function. Function should be called only after all other applicable None values have been set appropriately.

Use report_nones() to identify all None values in data dictionary. Call this and fill out all relevant fields before calling pop_nones

Parameters:

data (dict) – Dictionary from loader.loadfile_ to be converted to photon-HDF5

phconvert.helperfuncs.report_nones(data, root='')#

Identify the fields that must be either removed or specified from a dictionary returned by the loader.loadfile_ function

Parameters:
  • data (dict) – Dictionary or subdictionary of dictionary returned from a loader.loadfile_ function.

  • root (str, optional) – Name to print beforoe each key with a None value. The default is ‘’.