measurement
DataSet1D
Bases: SerializerComponent
Source code in src/easyreflectometry/data/data_store.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
model
property
writable
Model function.
is_experiment
property
Is experiment.
is_simulation
property
Is simulation.
__init__(name='Series', x=None, y=None, ye=None, xe=None, model=None, x_label='x', y_label='y', auto_background=True)
Init function.
Source code in src/easyreflectometry/data/data_store.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
data_points()
Data points.
Source code in src/easyreflectometry/data/data_store.py
85 86 87 | |
__repr__()
Repr function.
Source code in src/easyreflectometry/data/data_store.py
89 90 91 | |
is_orso_file(fname)
Whether fname is an ORSO file: text with the ORSO banner line, or HDF5 (.orb).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
str
|
Path to the file. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the file starts with the ORSO banner or the HDF5 magic bytes. |
Source code in src/easyreflectometry/orso_utils.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
load_data_from_orso_file(fname)
Load data from an ORSO file (.ort text or .orb binary).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
str
|
Path to the file. |
required |
Returns:
| Type | Description |
|---|---|
sc.DataGroup
|
A scipp DataGroup with data, coords, and attrs. |
Raises:
| Type | Description |
|---|---|
ValueError :
|
If the file cannot be parsed as ORSO. Parse failures are not swallowed here; falling back to plain-text loading is the caller's decision and only valid when the file carries no ORSO banner. |
Source code in src/easyreflectometry/orso_utils.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
load(fname)
Load data from an ORSO file (.ort/.orb) or a plain text file.
The discriminator is the ORSO banner line (or the HDF5 magic for binary files), not the file extension: a file carrying the banner that fails to parse raises instead of being silently re-read as plain text (which would drop the entire header, including polarization).
For a plain text file the columns are read by position in the ORSO order
Qz, R, sR, sQz -- further numeric columns are ignored -- and the error
columns must hold standard deviations, not variances. See
:func:_load_txt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
Union[TextIO, str]
|
The file to be read. |
required |
Returns:
| Type | Description |
|---|---|
sc.DataGroup
|
The loaded data. |
Source code in src/easyreflectometry/data/measurement.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
dataset_from_datagroup(data_group, data_key=None)
Build a DataSet1D from one dataset of a loaded DataGroup.
The ORSO header (when present) is attached to the returned dataset as the
orso_header attribute (a plain dict), so exporters can reuse the
original data_source/reduction provenance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_group
|
sc.DataGroup
|
A DataGroup as returned by :func: |
required |
data_key
|
Optional[str]
|
The data entry to use (e.g. |
None
|
Returns:
| Type | Description |
|---|---|
DataSet1D
|
The dataset. |
Source code in src/easyreflectometry/data/measurement.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
load_as_dataset(fname, data_group=None)
Load data from an ORSO .ort file as a DataSet1D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
Union[TextIO, str]
|
The file to be read. |
required |
data_group
|
Optional[sc.DataGroup]
|
Pre-loaded DataGroup for fname (avoids re-parsing the file). By default, None. |
None
|
Returns:
| Type | Description |
|---|---|
DataSet1D
|
The (first) dataset in the file. |
Source code in src/easyreflectometry/data/measurement.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
extract_orso_title(data_group, data_name)
Extract orso title.
Source code in src/easyreflectometry/data/measurement.py
110 111 112 113 114 115 116 117 118 119 120 | |
_load_txt(fname)
Load data from a simple txt file.
Columns are read by position, following the ORSO order: Qz, R, sR, sQz. Any further numeric columns (e.g. wavelength) are ignored -- the whole file is still parsed as numbers before the leading columns are taken, so a trailing text column, or rows of differing width, remain an error.
The error columns are taken to be standard deviations (sigma), matching
the ORSO default, and are squared to obtain the stored variances; a file
carrying variances instead would be mis-scaled. Plain text carries no
convention marker, so this is a requirement on the caller and not something
the loader can check -- unlike an ORSO file, which declares value_is and
whose FWHM errors are converted to sigma on load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
Union[TextIO, str]
|
The path for the file to be read. |
required |
Source code in src/easyreflectometry/data/measurement.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
merge_datagroups(*data_groups)
Merge multiple DataGroups into a single DataGroup.
Source code in src/easyreflectometry/data/measurement.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |