particula.data.product
Validated materialized measurement products and portable field contracts.
Classes
| Name | Description |
|---|---|
DerivedMeasurement | A scalar product with per-scan quality, parents and calibration links. |
FieldContract | Select a field by quantity, unit and optional coordinate requirements. |
Functions
| Name | Description |
|---|---|
_reference_units | Read physical dimensions from the installed measurement schema. |
product_fields | Describe scalar and array inputs with their coordinate grids. |
DerivedMeasurementclass#
class DerivedMeasurement(scans: pl.LazyFrame, issues: pl.LazyFrame, manifest: dict)Bases: Measurement
A scalar product with per-scan quality, parents and calibration links.
gridsattributeinstance attribute#
grids = {}lazy_frameattributeinstance attribute#
lazy_frame = scans.with_columns(pl.lit(manifest['source_sha256']).alias('source_sha256'))lazy_issuesattributeinstance attribute#
lazy_issues = issuesmanifestattributeinstance attribute#
manifest = manifest__init__method#
def __init__(scans: pl.LazyFrame, issues: pl.LazyFrame, manifest: dict) -> NoneVerify the declared operation, result field and row-level lineage.
Inherited from particula.data.measurement.Measurement
frameproperty#
particula.data.measurement.MeasurementView sourceframe: pl.DataFrameCollect the selected scans in memory, including their source IDs.
issuesproperty#
particula.data.measurement.MeasurementView sourceissues: pl.DataFrameCollect source-located diagnostics.
product_idproperty#
particula.data.measurement.MeasurementView sourceproduct_id: strIdentify the source interpretation, deployment and selected scans.
_delimited_schemamethod#
particula.data.measurement.MeasurementView sourcedef _delimited_schema(manifest)Derive the combined scan schema from the recorded file segments.
_flag_columnmethod#
particula.data.measurement.MeasurementView sourcedef _flag_column() -> str | NoneReturn the name of the scan-level flag column, if present.
available_operationsmethod#
particula.data.measurement.MeasurementView sourcedef available_operations() -> dict[str, tuple[str, ...]]Map compatible operation names to their required input names.
filtermethod#
particula.data.measurement.MeasurementView sourcedef filter(predicate: pl.Expr | pl.Series | str | Iterable[pl.Expr | pl.Series | str] | bool | list[bool] | np.ndarray) -> SelfSelect scans while retaining the original source diagnostics.
Parameters
| Name | Type | Description |
|---|---|---|
predicate | pl.Expr | pl.Series | str | Iterable[pl.Expr | pl.Series | str] | bool | list[bool] | np.ndarray | Boolean expression, column, mask, or predicates accepted by Polars LazyFrame.filter. |
Returns
Self- Measurement of the same type with a lazily filtered scan table.
Self- The manifest and diagnostics still describe the full source.
flag_summarymethod#
particula.data.measurement.MeasurementView sourcedef flag_summary() -> pl.LazyFrameCount each quality condition once per scan.
Returns
pl.LazyFrame- Lazy table of flag labels, affected and total scan counts, and
pl.LazyFrame- the first and last UTC time at which each flag appeared.
Raises
ValueError- The measurement has no declared quality flags.
quality_summarymethod#
particula.data.measurement.MeasurementView sourcedef quality_summary(field: str, *, exclude_flags: str | Iterable[str] = (), exclude_repaired: bool = False) -> pl.LazyFrameSummarize a scalar field after explicit source-quality exclusions.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
field | str | required | Name of a scalar field declared in the profile. |
exclude_flags | str | Iterable[str] | () | Exclude scans carrying these vendor or derived flags. |
exclude_repaired | bool | False | Omit scans reconstructed from logger fragments. |
Returns
pl.LazyFrame- One lazy row with the source, exclusion policy, scan and sample
pl.LazyFrame- counts, and UTC bounds of excluded scans. The mean weights each
pl.LazyFrame- retained, non-null sample equally and uses the field’s output unit.
Raises
ValueError- The field is undeclared or the requested flag exclusions require a missing vendor status field.
FieldContractclassdataclass#
class FieldContract(quantity: str, unit: str, field: str | None = None, axes: tuple[str, ...] = (), basis: str | None = None)Select a field by quantity, unit and optional coordinate requirements.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
quantity | str | required | Measured quantity, e.g. voltage or number_per_log10_diameter. |
unit | str | required | Unit expected by the implementation. |
field | str | None | None | Optional explicit column if several channels match. |
axes | tuple[str, ...] | () | Ordered axis names for an array or spectrum. Empty for a scalar. |
basis | str | None | None | Required diameter convention, e.g. electrical_mobility. |
axesattributeclass attributeinstance attribute#
axes: tuple[str, ...] = ()basisattributeclass attributeinstance attribute#
basis: str | None = Nonefieldattributeclass attributeinstance attribute#
field: str | None = Nonequantityattributeinstance attribute#
quantity: strunitattributeinstance attribute#
unit: str__init__method#
def __init__(quantity: str, unit: str, field: str | None = None, axes: tuple[str, ...] = (), basis: str | None = None) -> None__post_init__method#
def __post_init__() -> NoneRequire enough information to interpret the measured values.
resolvemethod#
def resolve(fields: list[dict]) -> dictSelect exactly one compatible field by quantity and optional name.
_reference_unitsfunctioncached#
def _reference_units() -> dict[str, str]Read physical dimensions from the installed measurement schema.
product_fieldsfunction#
def product_fields(product: Measurement) -> list[dict]Describe scalar and array inputs with their coordinate grids.