labcore.measurement.record#
Module Attributes
shorter notation for constructing DataSpec objects |
|
The type for creating a ds from a tuple (i.e., what can be passed to the constructor of |
|
The type for creating a ds from a dict (i.e., what can be passed to the constructor of |
|
The type from which we can create a DataSpec. |
Functions
|
Create a tuple of DataSpecs from the inputs. |
|
Create a readable label for multiple data specs. |
|
Create a the spec for a dependent parameter. |
|
Create a the spec for a dependent parameter. |
|
|
|
Create a the spec for an independent parameter. |
|
Create a the spec for an independent parameter. |
|
Instantiate a DataSpec object. |
|
Create a tuple of DataSpec instances. |
|
Check if obj is annotated to generate records. |
|
Annotate produced data as records. |
|
Returns a decorator that allows adding data parameter specs to a function. |
Classes
|
Specification for data parameters to be recorded. |
|
Valid options for data types used in |
|
A wrapper that converts a function return to a record. |
|
A wrapper that converts the iteration values to records. |
shorter notation for constructing DataSpec objects |
- class labcore.measurement.record.DataSpec(name: str, depends_on: None | List[str] | Tuple[str] = None, type: str | DataType = 'scalar', unit: str = '')[source]#
Bases:
objectSpecification for data parameters to be recorded.
- labcore.measurement.record.DataSpecCreationType#
The type from which we can create a DataSpec.
alias of
str|Tuple[str,None|List[str] |Tuple[str],str,str] |Dict[str,str|None|List[str] |Tuple[str]] |DataSpec
- labcore.measurement.record.DataSpecFromDictType#
The type for creating a ds from a dict (i.e., what can be passed to the constructor of
DataSpecas keywords)
- labcore.measurement.record.DataSpecFromTupleType#
The type for creating a ds from a tuple (i.e., what can be passed to the constructor of
DataSpec)alias of
Tuple[str,None|List[str] |Tuple[str],str,str]
- class labcore.measurement.record.DataType(value)[source]#
Bases:
EnumValid options for data types used in
DataSpec- array = 'array'#
multi-valued data. typically numpy-arrays.
- scalar = 'scalar'#
scalar (single-valued) data. typically numeric, but also bool, etc.
- class labcore.measurement.record.FunctionToRecords(func, *data_specs)[source]#
Bases:
objectA wrapper that converts a function return to a record.
- using(*args, **kwargs) FunctionToRecords[source]#
Set the default positional and keyword arguments that will be used when the function is called.
- Returns:
a copy of the object. This is to allow setting different defaults to multiple uses of the function.
- class labcore.measurement.record.IteratorToRecords(iterable: Iterable, *data_specs: str | Tuple[str, None | List[str] | Tuple[str], str, str] | Dict[str, str | None | List[str] | Tuple[str]] | DataSpec)[source]#
Bases:
objectA wrapper that converts the iteration values to records.
- labcore.measurement.record.combine_data_specs(*specs: DataSpec) Tuple[DataSpec, ...][source]#
Create a tuple of DataSpecs from the inputs. Removes duplicates.
- labcore.measurement.record.data_specs_label(*dspecs: DataSpec) str[source]#
Create a readable label for multiple data specs.
- Format:
{data_name_1 (dep_1, dep_2), data_name_2 (dep_3), etc.}
- Parameters:
dspecs – data specs as positional arguments.
- Returns:
label as string.
- labcore.measurement.record.dep(name: str, depends_on: List[str] = [], unit: str = '', type: str = 'scalar')#
Create a the spec for a dependent parameter. All arguments are forwarded to the
DataSpecconstructor.depends_onmay not be set toNone.
- labcore.measurement.record.dependent(name: str, depends_on: List[str] = [], unit: str = '', type: str = 'scalar')[source]#
Create a the spec for a dependent parameter. All arguments are forwarded to the
DataSpecconstructor.depends_onmay not be set toNone.
- labcore.measurement.record.ds#
shorter notation for constructing DataSpec objects
- labcore.measurement.record.indep(name: str, unit: str = '', type: str = 'scalar') DataSpec#
Create a the spec for an independent parameter. All arguments are forwarded to the
DataSpecconstructor.depends_onis set toNone.
- labcore.measurement.record.independent(name: str, unit: str = '', type: str = 'scalar') DataSpec[source]#
Create a the spec for an independent parameter. All arguments are forwarded to the
DataSpecconstructor.depends_onis set toNone.
- labcore.measurement.record.make_data_spec(value: str | Tuple[str, None | List[str] | Tuple[str], str, str] | Dict[str, str | None | List[str] | Tuple[str]] | DataSpec) DataSpec[source]#
Instantiate a DataSpec object.
- Parameters:
value –
May be one of the following with the following behavior:
- labcore.measurement.record.make_data_specs(*specs: str | Tuple[str, None | List[str] | Tuple[str], str, str] | Dict[str, str | None | List[str] | Tuple[str]] | DataSpec) Tuple[DataSpec, ...][source]#
Create a tuple of DataSpec instances.
- Parameters:
specs – will be passed individually to
make_data_spec()
- labcore.measurement.record.produces_record(obj: Any) bool[source]#
Check if obj is annotated to generate records.
- labcore.measurement.record.record_as(obj: Callable | Iterable | Iterator, *specs: str | Tuple[str, None | List[str] | Tuple[str], str, str] | Dict[str, str | None | List[str] | Tuple[str]] | DataSpec)[source]#
Annotate produced data as records.
- Parameters:
obj – a function that returns data or an iterable/iterator that produces data at each iteration step
specs – specs for the data produced (see
make_data_specs())