pixie16.read.settings package¶
pixie16.read.settings.field_classes module¶
Classes for each field inside a setings file.
These contain helper functions to, for example, combine the HI and LO values of timestamps.
- class pixie16.read.settings.field_classes.ABField¶
Bases:
SettingsFieldBase
A SettingsField to derives fields separated into hi lo 32 bit register subfields. Referred to as ‘AB’ classes because such fields are named ‘FastPeaksA’ and ‘FastPeaksB’ for example.
- derive_field_value(instance, *storage_values)¶
An abstract method that should implement the logic to derive the value of this field from the raw settings file values.
- property storage_names: tuple[str]¶
Name of the raw settings file field(s) used to store the value of this derived field. Default is set to the name of this field.
- class pixie16.read.settings.field_classes.BinaryField¶
Bases:
SettingsFieldBase
A SettingsField to derive values that are meant to be interpreted as binary digits but are stored as ints
- derive_field_value(instance, *storage_values)¶
An abstract method that should implement the logic to derive the value of this field from the raw settings file values.
- class pixie16.read.settings.field_classes.Entity¶
Bases:
object
Entity with settings fields
- class pixie16.read.settings.field_classes.EntityMeta(name, bases, attr_dict)¶
Bases:
type
Metaclass for settings class. Assigns the name of the variable that holds the instances of SettingsFieldBase, call one such instance s, to s.name. E.g. if apple = SettingFieldSubclass() were defined in an EntityMeta class then apple.name would be ‘apple’. Adapted from the Fluent Python book
- class pixie16.read.settings.field_classes.NotImplementedAttr(err_msg)¶
Bases:
object
An ‘abstract attribute’ class that allows for initialization for an owner instance but not access to this attribute
- class pixie16.read.settings.field_classes.OffsetVoltageField¶
Bases:
SettingsFieldBase
A SettingsField to derive offset voltage
- derive_field_value(instance, *storage_values)¶
An abstract method that should implement the logic to derive the value of this field from the raw settings file values.
- storage_names = ('OffsetDAC',)¶
- class pixie16.read.settings.field_classes.SettingsFieldBase¶
Bases:
ABC
A descriptor base class that will get derived settings values according to some logic. Said logic should be defined in a subclass’s implementation of derive_field_value
- abstract derive_field_value(instance, *storage_values)¶
An abstract method that should implement the logic to derive the value of this field from the raw settings file values.
- get_storage_values(instance)¶
Utility function to grab the values of the storage fields zipped together.
- name¶
An ‘abstract attribute’ class that allows for initialization for an owner instance but not access to this attribute
- property storage_names: tuple[str]¶
Name of the raw settings file field(s) used to store the value of this derived field. Default is set to the name of this field.
- class pixie16.read.settings.field_classes.TraceDelayField¶
Bases:
SettingsFieldBase
A SettingsField to derive trace delay
- derive_field_value(instance, *storage_values)¶
An abstract method that should implement the logic to derive the value of this field from the raw settings file values.
- storage_names = ('PAFlength', 'TriggerDelay')¶
- pixie16.read.settings.field_classes.calc_offset_voltage(offset_dac)¶
- pixie16.read.settings.field_classes.calc_trace_delay(paf_length, trigger_delay)¶
- pixie16.read.settings.field_classes.combine_hi_lo_registers(hi, lo)¶
- pixie16.read.settings.field_classes.int_to_bits(i, bits_length)¶
Converts int values to binary (in the form of a tuple of 0’s and 1’s)
pixie16.read.settings.file_format module¶
This file defines the binary layout of a setting file.
pixie16.read.settings.settings_class module¶
The main implementation of the Settings class.
- class pixie16.read.settings.settings_class.CrateSettings(input=None)¶
Bases:
UserList
- class pixie16.read.settings.settings_class.Settings(*args, **kwargs)¶
Bases:
SettingsBase
- class pixie16.read.settings.settings_class.SettingsBase(*args, **kwargs)¶
Bases:
UserDict
A 1:1 mapping of the settings file to a dictionary.
We also provide some helper methods to more easily access the values.
- create_index(d: dict = None, level: list = None)¶
Create an index.
We use the index later to be able to look up
self[“channel”][“input”][“VetoStretch”] by just using self.get_by_name(“VetoStretch”)
At the same time, we keep track of duplicate keys, so that we can raise a KeyError for those.
- classmethod from_dict(data: dict)¶
Creates a Settings object from a file.
- classmethod from_file(file: Path | str, module: int = 0)¶
Creates a Settings object from a file.
- get_by_name(name: str)¶
Alternative way to access keys in the dictionary.
The advantage of using get is that it will look at all levels inside the setting dict and return the value. This only works if the key is unique. Otherwise, we raise an exception.
- set_by_name(name: str, value) None ¶
Alternative way to access keys in the dictionary.
The advantage of using set is that it will look at all levels inside the setting dict and set the correct value. This only works if the key is unique. Otherwise, we raise an exception.
- class pixie16.read.settings.settings_class.Stats(*args, **kwargs)¶
Bases:
SettingsBase
- to_pandas()¶
- pixie16.read.settings.settings_class.load_settings(file, module=0)¶
Takes the name of a settings file and the index of the module of interest. Returns a Settings object.
- pixie16.read.settings.settings_class.load_stats(file, module=0)¶
Takes the name of a settings file and the index of the module of interest. Returns a Settings object.
pixie16.read.settings.units module¶
This file defines the default units for each element in the setting class.