libera_utils.l1a.l1a_packet_configs.SampleGroup#

class libera_utils.l1a.l1a_packet_configs.SampleGroup(*, name: str, sample_count: int, data_field_patterns: list[str], time_source: SampleTimeSource, time_field_patterns: TimeFieldMapping | None = None, epoch_time_fields: TimeFieldMapping | None = None, sample_period: timedelta | None = None)#

Bases: BaseModel

Configuration for a group of samples within a packet.

This class defines how to parse a specific group of related samples that share timing characteristics within a packet.

Variables:
  • name (str) – Name of the sample group (e.g., “AXIS_SAMPLE”, “RAD_SAMPLE”, “ADGPS”). This is used to name coordinates and dimensions.

  • time_field_patterns (TimeFieldMapping | None) – Mapping of time field patterns to their units for explicit per-sample timestamps. Use %i as placeholder for sample index in the field names.

  • epoch_time_fields (TimeFieldMapping | None) – Mapping of time fields to units for a single epoch timestamp. Used with sample_period to calculate sample times.

  • sample_period (datetime.timedelta | None) – Fixed time period between samples, used with epoch_time_fields.

  • data_field_patterns (list[str]) – List of data field name patterns. Use %i for sample index if multiple samples.

  • sample_count (int) – Number of samples per packet for this sample group.

  • time_source (SampleTimeSource) – The source system for timestamps (e.g. ICIE, FPE, or SC).

__init__(**data: Any) → None#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

sample_data_fields

Return the data field patterns with any %i placeholders removed.

sample_time_dimension

Get the dimension name for this sample group.

classmethod _convert_sample_period(v: Any) → timedelta | None#

Convert sample_period from microseconds (int) to timedelta.

classmethod _convert_time_source(v: Any) → SampleTimeSource#

Convert time_source from string to SampleTimeSource enum.

_validate_sample_group() → SampleGroup#

Validate SampleGroup constraints after all fields are set.

model_computed_fields = {}#
model_config = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property model_extra: Dict[str, Any] | None#

Get extra fields set during validation.

Returns:

A dictionary of extra fields, or None if config.extra is not set to “allow”.

model_fields = {'data_field_patterns': FieldInfo(annotation=list[str], required=True), 'epoch_time_fields': FieldInfo(annotation=Union[TimeFieldMapping, NoneType], required=False, default=None), 'name': FieldInfo(annotation=str, required=True), 'sample_count': FieldInfo(annotation=int, required=True), 'sample_period': FieldInfo(annotation=Union[timedelta, NoneType], required=False, default=None), 'time_field_patterns': FieldInfo(annotation=Union[TimeFieldMapping, NoneType], required=False, default=None), 'time_source': FieldInfo(annotation=SampleTimeSource, required=True)}#
property model_fields_set: set[str]#

Returns the set of fields that have been explicitly set on this model instance.

Returns:

A set of strings representing the fields that have been set,

i.e. that were not filled from defaults.

property sample_data_fields: list[str]#

Return the data field patterns with any %i placeholders removed.

Any trailing underscores are also removed to ensure consistent naming when the index is at the end of the field name.

For example: ICIE__AXIS_EL_FILT%i becomes ICIE__AXIS_EL_FILT ICIE__CAL_SAMPLE_%i becomes ICIE__CAL_SAMPLE ICIE__RAD_SAMPLE%i_0 remains ICIE__RAD_SAMPLE_0

property sample_time_dimension: str#

Get the dimension name for this sample group.

Returns:

The dimension name, e.g. “AXIS_SAMPLE_ICIE_TIME”

Return type:

str