Skip to content

particula.instruments.instrument

Read measurements from an instrument with a declared import profile.

Classes

NameDescription
InstrumentRead delimited exports that share one profile.

Instrumentclassdataclass#

class Instrument(profile: ProfileSource, *, deployment: Deployment | None = None, registry: OperationRegistry = OperationRegistry(), reader: str = 'delimited')

Read delimited exports that share one profile.

Parameters

NameTypeDefaultDescription
profileProfileSourcerequiredBuilt-in profile ID, JSON or YAML file path, or profile mapping. Construction validates and stores a copy of the profile.
deploymentDeployment | NoneNoneInstance, inlet, volume basis and calibration records.
registryOperationRegistryOperationRegistry()Trusted operations and reader implementations.
readerstr'delimited'Registered reader name, defaulting to delimited text.

Raises

ProfileError
The profile cannot be loaded or fails validation.

_productsattributeclass attributeinstance attribute#

_products: dict[str, Measurement] = field(default_factory=dict, init=False, repr=False)

deploymentattributeclass attributeinstance attribute#

deployment: Deployment | None = field(default=None, kw_only=True)

profileattributeinstance attribute#

profile: ProfileSource

readerattributeclass attributeinstance attribute#

reader: str = field(default='delimited', kw_only=True)

registryattributeclass attributeinstance attribute#

registry: OperationRegistry = field(default_factory=OperationRegistry, kw_only=True)

__init__method#

def __init__(profile: ProfileSource, *, deployment: Deployment | None = None, registry: OperationRegistry = OperationRegistry(), reader: str = 'delimited') -> None

__post_init__method#

def __post_init__() -> None

Resolve the supplied profile before reading any sources.

available_operationsmethod#

def available_operations(as_product: str) -> dict[str, dict]

Describe registered operations compatible with a bound product.

compatible_productmethod#

def compatible_product(contract: FieldContract) -> Measurement

Choose a unique product that can fill a physical input role.

processmethod#

def process(operation: str, version: str) -> MeasurementProcess

Look up a named measurement operation for explicit execution.

productmethod#

def product(name: str) -> Measurement

Return the named product previously read for this instrument.

readmethod#

def read(source: str | PathLike[str], *, as_product: str | None = None, **limits: int) -> Measurement

Read one export into memory using this instrument’s profile.

Parameters

NameTypeDefaultDescription
sourcestr | PathLike[str]requiredPath to the delimited instrument export.
as_productstr | NoneNoneOptional unique name for later role binding.
**limitsint{}Optional chunk, record and batch limits accepted by MeasurementReader.

Returns

Measurement
Measurement with scans in the profile’s output units, source
Measurement
diagnostics and the import manifest.

register_processmethod#

def register_process(process: MeasurementProcess) -> None

Expose a trusted versioned process on this instrument’s registry.