Model¶
Data containers: experiment metadata, per-run arrays and results, and von Hamos crystal geometry.
XSpect.model.experiment
¶
experiment
¶
Source code in XSpect/model/experiment.py
__init__(lcls_run, hutch, experiment_id, smalldata_dir=None)
¶
Initializes an experiment instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcls_run
|
str
|
LCLS run identifier. The LCLS run not the scan/run. Example: 21 |
required |
hutch
|
str
|
Hutch name. Example: xcs |
required |
experiment_id
|
str
|
Experiment identifier. Example: xcsl1004021 |
required |
smalldata_dir
|
str
|
Explicit path to the directory holding the {exp}_Run{run:04d}.h5 smalldata files. If provided, this overrides the default location search (useful for locally reprocessed data). Example: /sdf/data/lcls/ds/mfx/mfx101592326/results/lbgee/hdf5/smalldata |
None
|
Source code in XSpect/model/experiment.py
get_experiment_directory()
¶
Determines and returns the directory of the experiment based on the hutch and experiment ID. It attempts the various paths LCLS has had over the years with recent S3DF paths being the first attempt.
If smalldata_dir was provided at construction, it takes priority over
the default location search.
Returns:
| Type | Description |
|---|---|
str
|
The directory of the experiment. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the directory cannot be found. |
Source code in XSpect/model/experiment.py
spectroscopy_experiment
¶
Bases: experiment
A class to represent a spectroscopy experiment.
Source code in XSpect/model/experiment.py
XSpect.model.run
¶
spectroscopy_run
¶
A class to represent a run within a spectroscopy experiment. Not an LCLS run.
Source code in XSpect/model/run.py
7 8 9 10 11 12 13 14 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 92 93 94 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 120 121 122 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 189 190 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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
__init__(spec_experiment, run, verbose=False, end_index=-1, start_index=0)
¶
Initializes a spectroscopy run instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_experiment
|
spectroscopy_experiment
|
The parent spectroscopy experiment. |
required |
run
|
int
|
The run number. |
required |
verbose
|
bool
|
Flag for verbose output. Defaults to False. |
False
|
end_index
|
int
|
Index to stop processing data. Defaults to -1. |
-1
|
start_index
|
int
|
Index to start processing data. Defaults to 0. |
0
|
Source code in XSpect/model/run.py
get_run_shot_properties()
¶
Retrieves shot properties from the run file.
Source code in XSpect/model/run.py
load_run_key_delayed(keys, friendly_names, transpose=False, rois=None, combine=True, row_range=None)
¶
Loads specified keys from the run file without immediate conversion to numpy arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list
|
List of keys to load. |
required |
friendly_names
|
list
|
Corresponding list of friendly names for the keys. |
required |
transpose
|
bool
|
Flag to transpose the loaded data. Defaults to False. |
False
|
rois
|
list of lists
|
List of ROIs as pixel ranges along one dimension (default is None). |
None
|
combine
|
bool
|
Whether to combine ROIs into a single mask. Defaults to True. |
True
|
Source code in XSpect/model/run.py
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 189 190 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 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
load_run_keys(keys, friendly_names)
¶
Loads specified keys from the run file into memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list
|
List of keys to load from the hdf5 file |
required |
friendly_names
|
list
|
Corresponding list of friendly names for the keys. |
required |
Source code in XSpect/model/run.py
update_status(update)
¶
Updates the status log for the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update
|
str
|
The status update message. |
required |