ts_ids_components.xrd.datacube_raw module#
Raw two-theta scan datacube preservation for XRD IDSs.
TwoThetaScanDatacube
stores parsed, structured per-point data – but converting a raw string to a
float is lossy by construction: float("40.0000") == 40.0, silently
dropping trailing zeros that reflect the instrument’s actual reported
precision, not incidental formatting. RawTwoThetaScanDatacube is
an exact structural replica of TwoThetaScanDatacube – the same one
two_theta dimension plus per-vendor named measures – built from
RawXrdDimension/RawXrdMeasure instead of
Dimension/
XrdMeasure: every
scale/value entry is the exact original raw string (not a parsed
float), and every unit is the exact original raw unit string (not the
canonicalized unit name used on the parsed side), so the original can always
be recovered independent of parser correctness, point-for-point and
axis-for-axis.
Like TwoThetaScanDatacube, each entry also carries its own fk_method/
fk_run/fk_system/fk_sample rather than relying on matching list
order with datacubes, since matching by list order is fragile the
moment a file has more than one scan. On top of that,
RawTwoThetaScanDatacube carries an fk_datacube pointing
directly at the TwoThetaScanDatacube it was parsed from, so translating
between a parsed datacube and its raw counterpart is a direct lookup rather
than a join on the shared (fk_method, fk_run) pair – the same reasoning
that motivates bundling a raw string directly alongside its parsed value on
RawValueUnit. Consuming IDSs
declare datacubes_raw: List[RawTwoThetaScanDatacube] as a top-level
array; each vendor’s own subclass restates measures with the same total
fixed_length as its corresponding TwoThetaScanDatacube subclass.
- Model RawXrdDimension[source]#
Bases:
IdsElementA dimension of a
RawTwoThetaScanDatacube. Structurally identical toDimension(name, unit, scale), except scale holds the exact original raw strings a datacube’s dimension was parsed from (not parsed floats), and unit holds the exact original raw unit string (not the canonicalized unit name used on TwoThetaScanDatacube <ts_ids_components.xrd.datacube.TwoThetaScanDatacube>’s own dimension).Show JSON schema
{ "description": "A dimension of a :py:class:`RawTwoThetaScanDatacube`. Structurally identical to\n:py:class:`Dimension <ts_ids_core.schema.dimension.Dimension>` (name,\nunit, scale), except `scale` holds the exact original raw strings a\ndatacube's dimension was parsed from (not parsed floats), and `unit`\nholds the exact original raw unit string (not the canonicalized unit\nname used on `TwoThetaScanDatacube <ts_ids_components.xrd.datacube.TwoThetaScanDatacube>`'s\nown dimension).", "type": "object", "properties": { "name": { "description": "Name of the dimension, matching the corresponding `TwoThetaScanDatacube` dimension by name (e.g. 'two_theta').", "type": [ "string", "null" ] }, "unit": { "description": "Unit exactly as it appears in the raw file, unconverted.", "type": [ "string", "null" ] }, "scale": { "description": "Dimension scale values exactly as they appear in the raw file, unconverted.", "items": { "type": [ "string", "null" ] }, "type": "array" } }, "additionalProperties": false, "required": [ "name", "unit", "scale" ] }
- Validators:
- field name: str | None#
Name of the dimension, matching the corresponding TwoThetaScanDatacube dimension by name (e.g. ‘two_theta’).
- Model RawXrdMeasure[source]#
Bases:
IdsElementA measure of a
RawTwoThetaScanDatacube. Structurally identical toXrdMeasure(name, unit, value), except value holds the exact original raw strings a measure was parsed from (not parsed floats), and unit holds the exact original raw unit string (not the canonicalized unit name used on XrdMeasure).Show JSON schema
{ "description": "A measure of a :py:class:`RawTwoThetaScanDatacube`. Structurally identical to\n:py:class:`XrdMeasure <ts_ids_components.xrd.datacube.XrdMeasure>` (name,\nunit, value), except `value` holds the exact original raw strings a\nmeasure was parsed from (not parsed floats), and `unit` holds the exact\noriginal raw unit string (not the canonicalized unit name used on\n`XrdMeasure`).", "type": "object", "properties": { "name": { "description": "Name of the measure, matching the corresponding `XrdMeasure` by name (e.g. 'intensity').", "type": [ "string", "null" ] }, "unit": { "description": "Unit exactly as it appears in the raw file, unconverted.", "type": [ "string", "null" ] }, "value": { "description": "Per-point measure values exactly as they appear in the raw file, unconverted.", "items": { "type": [ "string", "null" ] }, "type": "array" } }, "additionalProperties": false, "required": [ "name", "unit", "value" ] }
- Validators:
- Model RawTwoThetaScanDatacube[source]#
Bases:
IdsElementAn exact structural replica of TwoThetaScanDatacube <ts_ids_components.xrd.datacube.TwoThetaScanDatacube> – the same one two_theta dimension plus per-vendor named measures – built from
RawXrdDimension/RawXrdMeasureinstead ofDimension/ XrdMeasure, so every scale/value entry is the exact original raw string (not a parsed float) and every unit is the exact original raw unit string (not the canonicalized unit name). See the module docstring above for why this exists. Linked to its source scan/run/system/sample by fk_method/fk_run/fk_system/fk_sample (rather than by matching list order with datacubes), and directly to its parsed counterpart by fk_datacube.Show JSON schema
{ "description": "An exact structural replica of `TwoThetaScanDatacube\n<ts_ids_components.xrd.datacube.TwoThetaScanDatacube>` -- the same one\n`two_theta` dimension plus per-vendor named measures -- built from\n:py:class:`RawXrdDimension`/:py:class:`RawXrdMeasure` instead of\n:py:class:`Dimension <ts_ids_core.schema.dimension.Dimension>`/\n`XrdMeasure`, so every `scale`/`value` entry is the exact original raw\nstring (not a parsed float) and every `unit` is the exact original raw\nunit string (not the canonicalized unit name). See the module docstring\nabove for why this exists. Linked to its source scan/run/system/sample\nby `fk_method`/`fk_run`/`fk_system`/`fk_sample` (rather than by matching\nlist order with `datacubes`), and directly to its parsed counterpart by\n`fk_datacube`.", "type": "object", "properties": { "fk_method": { "@foreign_key": "/properties/methods/items/properties/pk", "description": "Foreign key to the scan (in `methods`) this raw data was parsed from.", "type": "string" }, "fk_run": { "@foreign_key": "/properties/runs/items/properties/pk", "description": "Foreign key to the run (in `runs`) this raw data was parsed from.", "type": "string" }, "fk_system": { "@foreign_key": "/properties/systems/items/properties/pk", "description": "Foreign key to the system (in `systems`) this raw data was parsed from.", "type": "string" }, "fk_sample": { "@foreign_key": "/properties/samples/items/properties/pk", "description": "Foreign key to the sample (in `samples`) this raw data was measured on.", "type": "string" }, "fk_datacube": { "@foreign_key": "/properties/datacubes/items/properties/pk", "description": "Foreign key to the parsed datacube (in `datacubes`) this raw data was parsed from.", "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "dimensions": { "items": { "$ref": "#/definitions/RawXrdDimension" }, "maxItems": 1, "minItems": 1, "type": "array" }, "measures": { "items": { "$ref": "#/definitions/RawXrdMeasure" }, "maxItems": 1, "minItems": 1, "type": "array" } }, "additionalProperties": false, "required": [ "fk_method", "fk_run", "fk_system", "fk_sample", "fk_datacube", "name", "dimensions", "measures" ], "definitions": { "RawXrdDimension": { "additionalProperties": false, "description": "A dimension of a :py:class:`RawTwoThetaScanDatacube`. Structurally identical to\n:py:class:`Dimension <ts_ids_core.schema.dimension.Dimension>` (name,\nunit, scale), except `scale` holds the exact original raw strings a\ndatacube's dimension was parsed from (not parsed floats), and `unit`\nholds the exact original raw unit string (not the canonicalized unit\nname used on `TwoThetaScanDatacube <ts_ids_components.xrd.datacube.TwoThetaScanDatacube>`'s\nown dimension).", "properties": { "name": { "description": "Name of the dimension, matching the corresponding `TwoThetaScanDatacube` dimension by name (e.g. 'two_theta').", "type": [ "string", "null" ] }, "unit": { "description": "Unit exactly as it appears in the raw file, unconverted.", "type": [ "string", "null" ] }, "scale": { "description": "Dimension scale values exactly as they appear in the raw file, unconverted.", "items": { "type": [ "string", "null" ] }, "type": "array" } }, "required": [ "name", "unit", "scale" ], "type": "object" }, "RawXrdMeasure": { "additionalProperties": false, "description": "A measure of a :py:class:`RawTwoThetaScanDatacube`. Structurally identical to\n:py:class:`XrdMeasure <ts_ids_components.xrd.datacube.XrdMeasure>` (name,\nunit, value), except `value` holds the exact original raw strings a\nmeasure was parsed from (not parsed floats), and `unit` holds the exact\noriginal raw unit string (not the canonicalized unit name used on\n`XrdMeasure`).", "properties": { "name": { "description": "Name of the measure, matching the corresponding `XrdMeasure` by name (e.g. 'intensity').", "type": [ "string", "null" ] }, "unit": { "description": "Unit exactly as it appears in the raw file, unconverted.", "type": [ "string", "null" ] }, "value": { "description": "Per-point measure values exactly as they appear in the raw file, unconverted.", "items": { "type": [ "string", "null" ] }, "type": "array" } }, "required": [ "name", "unit", "value" ], "type": "object" } } }
- Validators:
consistent_scale_and_value_lengths»all fieldstwo_theta_dimension_and_intensity_measure_present»all fields
- field dimensions: List[RawXrdDimension]#
- Constraints:
min_length = 1
max_length = 1
- field fk_datacube: str#
Foreign key to the parsed datacube (in datacubes) this raw data was parsed from.
- Constraints:
func = <function validate_uuid at 0x7f1493ac61f0>
json_schema_input_type = PydanticUndefined
ids_field_arg = primary_key
pk_reference_field = @foreign_key
- field fk_method: str#
Foreign key to the scan (in methods) this raw data was parsed from.
- Constraints:
func = <function validate_uuid at 0x7f1493ac61f0>
json_schema_input_type = PydanticUndefined
ids_field_arg = primary_key
pk_reference_field = @foreign_key
- field fk_run: str#
Foreign key to the run (in runs) this raw data was parsed from.
- Constraints:
func = <function validate_uuid at 0x7f1493ac61f0>
json_schema_input_type = PydanticUndefined
ids_field_arg = primary_key
pk_reference_field = @foreign_key
- field fk_sample: str#
Foreign key to the sample (in samples) this raw data was measured on.
- Constraints:
func = <function validate_uuid at 0x7f1493ac61f0>
json_schema_input_type = PydanticUndefined
ids_field_arg = primary_key
pk_reference_field = @foreign_key
- field fk_system: str#
Foreign key to the system (in systems) this raw data was parsed from.
- Constraints:
func = <function validate_uuid at 0x7f1493ac61f0>
json_schema_input_type = PydanticUndefined
ids_field_arg = primary_key
pk_reference_field = @foreign_key
- field measures: List[RawXrdMeasure]#
- Constraints:
min_length = 1
max_length = 1
- validator consistent_scale_and_value_lengths » all fields[source]#
Mirrors ts_ids_core.schema.DataCube.consistent_number_of_dimensions, which RawTwoThetaScanDatacube doesn’t inherit (it isn’t a DataCube subclass, since its fields are string-typed rather than float-typed): every measure’s value must have as many entries as the dimension’s scale, so a raw parser bug producing a truncated or misaligned per-point array is caught at validation time rather than silently stored as valid IDS data.
- Validates:
all fields