Analysis steps¶
Registered pipeline steps and reductions. Each is a stateless function reached by name through the registry.
XSpect.analysis.registry
¶
Step and reduction registry for the XSpect pipeline.
Steps are stateless functions with signature: step(run, kwargs) -> None Reductions receive all runs: reduction(runs, kwargs) -> dict
ReductionNotFoundError
¶
StepNotFoundError
¶
clear_registry()
¶
get_reduction(name)
¶
Look up a registered reduction by name.
Source code in XSpect/analysis/registry.py
get_step(name)
¶
Look up a registered step by name.
list_reductions()
¶
list_steps()
¶
register_reduction(name)
¶
Decorator that registers a function as a reduction step.
Source code in XSpect/analysis/registry.py
register_step(name)
¶
Decorator that registers a function as a pipeline step.
Source code in XSpect/analysis/registry.py
XSpect.analysis.spectroscopy
¶
Core spectroscopy pipeline steps.
Each function is registered via @register_step and follows the contract: step(run, **kwargs) -> None All results written to run.results[key].
apply_roi(run, **kwargs)
¶
Extract ROI without spatial reduction (keep spatial dimension).
Parameters from YAML: on: detector key rois: list of [start, end] pixel ranges combine_rois: bool (default True)
Source code in XSpect/analysis/spectroscopy.py
bin_uniques(run, **kwargs)
¶
Bin unique scan variable values for scan-based analysis.
Parameters from YAML: on: key with scan variable values
Source code in XSpect/analysis/spectroscopy.py
combine_runs(runs, **kwargs)
¶
Aggregate time-binned data across multiple runs.
Sums the time-binned detector data and bin counts from all runs. Returns normalized difference (laser_on - laser_off) / laser_off.
Parameters from YAML: detector_key: base detector key (e.g., "epix_ROI_1") laser_on_suffix: suffix for laser-on data (default "_simultaneous_laser_time_binned") laser_off_suffix: suffix for laser-off data (default "_xray_not_laser_time_binned")
Source code in XSpect/analysis/spectroscopy.py
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | |
common_mode_correction(run, **kwargs)
¶
Subtract per-row, per-column, or per-bank common-mode offsets.
Detector electronics add a slowly varying baseline that is shared across all pixels in a readout unit (a row, a column, or an ePix100 bank). The offset is estimated from a reference region that carries no signal (a dark band) and subtracted from the whole unit. Runs on 3D detector data (shots x rows x cols) before shot reduction and preserves the input shape.
Parameters from YAML: on: detector key (3D: shots x rows x cols, or 2D: rows x cols) axis: "row" (default), "column", or "bank". "row" removes a per-row offset (shared across columns), "column" a per-column offset, "bank" a per-bank offset across fixed-width column blocks. method: "median" (default, robust to outliers) or "mean". reference: [start, end] pixel range of the signal-free band used to estimate the offset. Indexed along the axis orthogonal to the correction: for axis="row" it is a column range, for axis="column" (and "bank") it is a row range. Default: full extent. bank_size: int, column width of an ePix100 bank (default 128). Only used when axis="bank".
Source code in XSpect/analysis/spectroscopy.py
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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
filter_detector_adu(run, **kwargs)
¶
Zero out detector pixels below ADU threshold.
Parameters from YAML: on: detector key adu_threshold: float or [min, max] (default 3.0)
Source code in XSpect/analysis/spectroscopy.py
filter_detector_variance(run, **kwargs)
¶
Zero out low-variance detector pixels using sklearn VarianceThreshold.
Data-driven alternative to filter_detector_adu: instead of a hand-tuned intensity cutoff, pixels whose value barely changes across shots (dead pixels, static hot pixels, constant background) are dropped. Signal-bearing pixels vary shot to shot and are retained.
Parameters from YAML: on: detector key variance_threshold: float (default 0.0). Pixels with variance <= this across shots are zeroed. 0.0 removes only constant pixels.
Detector data is treated as (shots, features): a 3D array
(shots x rows x cols) is flattened per shot, filtered, then reshaped back.
Writes the filtered array back to detector_key and stores the retained
boolean mask as
Source code in XSpect/analysis/spectroscopy.py
filter_shots(run, **kwargs)
¶
Filter a shot mask by thresholding on another key.
Parameters from YAML: on: shot mask key (e.g., "xray", "simultaneous") filter_key: key to threshold on (e.g., "ipm") threshold: float or [min, max]
Source code in XSpect/analysis/spectroscopy.py
find_rotation_angle(run, **kwargs)
¶
Auto-detect the tilt angle of a dispersed spectral signal.
Delegates to XSpectDetectorProcessor which uses: 1. Canny edge detection on the 8-bit normalised sum image 2. DBSCAN clustering to isolate distinct signal streaks 3. PCA per cluster to find each streak's orientation 4. Mean angle across clusters, clamped to [-90, 90]
The result (degrees) is stored as run.<angle_key> for use by
rotate_detector.
Parameters from YAML:
on: detector key (3D shots x rows x cols, or 2D rows x cols)
low_threshold: Canny lower hysteresis threshold (default 30)
high_threshold: Canny upper hysteresis threshold (default 100)
angle_key: attribute name to store the result (default:
Source code in XSpect/analysis/spectroscopy.py
get_run_shot_properties(run, **kwargs)
¶
Load xray/laser/simultaneous boolean masks from lightStatus.
hitfinding(run, **kwargs)
¶
Filter shots by total signal intensity (hit detection).
Keeps shots whose per-shot detector sum exceeds a threshold. Two modes (applied after any ADU filtering upstream):
min_sum (preferred for sparse/XES data): Keep shots where sum(detector) > min_sum. Use min_sum=1.0 to reject shots that are completely zero after the ADU threshold — i.e. true dark shots with no photons.
cutoff_multiplier (legacy, relative threshold): threshold = median(sums) - cutoff_multiplier * std(sums) Works well when signal shots are the majority; breaks down when most shots are dark (median ≈ 0 → threshold is negative).
If both are supplied, min_sum takes precedence.
Parameters from YAML: on: detector key (3D: shots × rows × cols) min_sum: absolute ADU floor per shot (default None) cutoff_multiplier: std multiplier for relative threshold (default 1.0)
Source code in XSpect/analysis/spectroscopy.py
load_detector(run, **kwargs)
¶
Load 3D detector data (shots x rows x cols) with optional ROI and transpose.
Parameters from YAML: keys: list of HDF5 paths friendly_names: list of attribute names transpose: bool (default False) rois: list of [start, end] pixel ranges (default None) combine_rois: bool (default True)
Source code in XSpect/analysis/spectroscopy.py
load_run_keys(run, **kwargs)
¶
Load scalar/1D keys from HDF5 into run attributes.
Reads the keys defined in the pipeline's data section. Expects run to have run_file, start_index, end_index set.
Source code in XSpect/analysis/spectroscopy.py
make_eventcode_mask(run, **kwargs)
¶
Build a per-shot boolean mask from an EVR/timing event-code column.
The smalldata timing group stores a per-shot event-code table (shape n_shots x n_codes, e.g. timing/eventcodes with 288 columns). This step extracts one code's column as a boolean shot mask, so it can be used by union_shots / filter_shots like any other mask.
Typical use: beam is delivered at 30 Hz inside a 120 Hz DAQ, tagged by
event code 198. Gate the analysis on code 198 to drop the 90 Hz of empty
frames (the smalldata xray flag does NOT distinguish these).
Parameters from YAML:
code: event-code index (column) to extract, e.g. 198
eventcodes: attribute holding the 2D code table (default "eventcodes")
new_key: output mask attribute name (default: "ec")
Source code in XSpect/analysis/spectroscopy.py
purge_keys(run, **kwargs)
¶
Delete specified attributes from run to free memory.
Parameters from YAML: keys: list of attribute names to purge
Source code in XSpect/analysis/spectroscopy.py
reduce_detector_shots(run, **kwargs)
¶
Collapse the shot dimension using sum/mean.
Parameters from YAML: on: detector key reduction: "sum" or "mean" (default "sum") purge: bool (default True)
Source code in XSpect/analysis/spectroscopy.py
reduce_detector_spatial(run, **kwargs)
¶
Reduce spatial dimension of detector using ROIs.
For 3D data (shots x rows x cols), the ROI selects along one spatial axis (default: axis 1 = cross-dispersion) and reduces by summing/averaging, producing (shots x remaining_spatial).
Parameters from YAML: on: detector key rois: list of [start, end] pixel ranges combine_rois: bool (default True) reduction: "sum" or "mean" (default "sum") axis: which spatial axis to apply ROI on (default 1 for 3D, -1 for 2D) purge: bool (default True) - delete original after reduction
Source code in XSpect/analysis/spectroscopy.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | |
reduce_detector_temporal(run, **kwargs)
¶
Bin detector data along time dimension using timing indices.
Parameters from YAML: on: detector key (2D: shots x pixels) timing_bin_key: attribute name for bin indices (default "timing_bin_indices") average: bool (default False) - if True, divide by bin count
Source code in XSpect/analysis/spectroscopy.py
rotate_detector(run, **kwargs)
¶
Rotate detector images by a fixed or auto-detected angle (scipy.ndimage.rotate).
Applied per-shot. For 3D data (shots x rows x cols), rotates in the (rows, cols) plane. For 2D data (rows x cols), rotates directly. Skipped when the resolved angle is 0.
Parameters from YAML: on: detector key angle: rotation in degrees (positive = CCW). Mutually exclusive with angle_key. angle_key: name of a run attribute holding the angle (set by find_rotation_angle). Takes precedence over angle if both are provided. axes: rotation plane as [ax1, ax2] (default [1, 2] for 3D, [0, 1] for 2D) reshape: bool (default False) — keep original array shape after rotation
Source code in XSpect/analysis/spectroscopy.py
separate_shots(run, **kwargs)
¶
Extract shots matching first mask but NOT second (A and not B).
Parameters from YAML: on: detector/data key filter_keys: [include_mask, exclude_mask] new_key: optional output key name
Source code in XSpect/analysis/spectroscopy.py
subtract_polynomial_background(run, **kwargs)
¶
Subtract a polynomial baseline fit along the spatial axis.
Fits a low-order polynomial to signal-free regions along one axis and
subtracts it, removing smooth scattering/fluorescence background while
preserving peak area. The peak region is excluded from the fit either by
naming the background regions explicitly (background) or by masking
the peak (peak_mask). Non-destructive: writes <on>_bkgsub.
Works on a 1D spectrum or a 2D array (bins x pixels). The fit reuses the vectorized weighted-polynomial projection from patch_pixels: the offset vector depends only on the sample positions and weights, so it is built once and applied to every row with a single matrix multiply.
Parameters from YAML:
on: spectrum key (1D pixels, or 2D bins x pixels).
axis: spatial axis to fit along (default: last axis).
order: polynomial degree (default 2).
background: list of [start, end] pixel ranges to fit (signal-free).
If given, only these ranges anchor the fit.
peak_mask: pixel range(s) to EXCLUDE from the fit (the emission peaks).
Accepts a single [start, end] or a list of [start, end] ranges, so
several dispersed lines (e.g. Kalpha and Kbeta on one detector) can
all be masked at once. Used when naming the peaks is easier than the
background. Ignored if background is given.
Source code in XSpect/analysis/spectroscopy.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
subtract_spatial_background(run, **kwargs)
¶
Subtract a per-line background estimated from flanking regions.
Designed for a dispersed spectral streak sitting on a smooth, spatially slowly-varying background (e.g. isotropic fluorescence under a Von Hamos emission line). For each line along the dispersion axis, the background level is estimated from one or two "side band" regions flanking the signal (on the cross-dispersion axis) and subtracted from the whole line.
Works on a 2D image (rows x cols). bkg_axis is the CROSS-DISPERSION
axis, i.e. the axis along which the side bands are taken and which is
reduced away by the subsequent reduce_detector_spatial step. The background
per line is: mean over the side-band pixels, scaled to the number of pixels
in the signal band, then subtracted from the signal band; side-band columns
themselves are zeroed so they do not contribute downstream.
Parameters from YAML:
on: detector key (2D rows x cols)
signal: [start, end] of the signal band on bkg_axis
sidebands: list of [start, end] flanking regions on bkg_axis used to
estimate the background (1 or 2 regions typical)
bkg_axis: cross-dispersion axis (default 1 = columns)
new_key: output key (default: "
Source code in XSpect/analysis/spectroscopy.py
time_binning(run, **kwargs)
¶
Create time delay bins from laser timing data.
Parameters from YAML: bins: "auto", list, or [min, max, num_points] lxt_key: str or null (default "lxt_ttc"; null means use encoder directly) fast_delay_key: str (default "encoder") tt_correction_key: str (default "time_tool_correction") resolution: bin width for auto mode (default 50e-15, i.e. 50 fs)
Source code in XSpect/analysis/spectroscopy.py
union_shots(run, **kwargs)
¶
Combine shots matching multiple boolean masks (logical AND).
Parameters from YAML: on: detector/data key to filter filter_keys: list of mask attribute names to AND together new_key: optional output key name (default: auto-generated)
Source code in XSpect/analysis/spectroscopy.py
XSpect.analysis.xes
¶
XES (X-ray Emission Spectroscopy) specific pipeline steps.
calibrate_energy(run, **kwargs)
¶
Calibrate the vonHamos crystal_detector_distance (A) against a known line.
The energy axis (make_energy_axis) is
ll = pixel*mm_per_pixel/2 - (max(gl)-min(gl))/4
E(p) = hc / (2 d sin(arctan(R / (ll(p) + A))))
Everything except A is fixed by the spectrometer. Given a foil emission line
of known energy E0 whose peak falls at pixel p0 in a measured spectrum, A is
solved in closed form:
s = hc / (2 d E0)
A = R * sqrt(1 - s^2) / s - ll(p0)
This step finds p0 as the argmax of the spectrum (optionally within a pixel
window), solves A, and rebuilds {name}_energy so the line sits exactly at
E0. The fitted A is stored as {name}_calibrated_A (and returned in the
result dict via run.results) so it can be reused for subsequent, non-foil
measurements on the same spectrometer.
Parameters from YAML
on : spectrum key to locate the peak in (e.g. epix_reduced_ROI_1)
element : element symbol for the foil, e.g. "Mn" (uses EMISSION_LINES)
line : which line, "Ka1" (default), "Ka2", or "Kb1"
energy : explicit line energy in eV (overrides element/line lookup)
crystal_radius, d_spacing, mm_per_pixel : geometry (same as make_energy_axis)
n_pixels : pixel count (defaults to len of the on spectrum)
peak_window : optional [lo, hi] pixel range to search for the peak
name : output prefix (default "xes"); writes {name}_energy and
{name}_calibrated_A
Source code in XSpect/analysis/xes.py
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 | |
make_energy_axis(run, **kwargs)
¶
Generate energy axis from vonHamos spectrometer geometry.
Uses the same formula as XSpect_Visualization.make_energy_axis: gl = pixel_indices * mm_per_pixel ll = gl/2 - (max(gl) - min(gl))/4 energy = 12398.42 / (2 * d * sin(arctan(R / (ll + A)))) energy = energy[::-1]
Parameters from YAML: detector_key: key to get pixel count from (or use n_pixels directly) n_pixels: number of pixels (overrides detector_key shape) crystal_detector_distance: A (mm) crystal_radius: R (mm) d_spacing: d (Angstrom) mm_per_pixel: pixel pitch (default 0.05 mm for ePix) name: output attribute name prefix (default: "xes")
Source code in XSpect/analysis/xes.py
normalize_xes(run, **kwargs)
¶
Normalize XES spectra by row sum over a pixel range.
Divides each time bin's spectrum by its total intensity over the specified pixel range, producing area-normalized spectra.
Parameters from YAML: on: detector key (time_binned data, shape: bins x pixels) pixel_range: [start, end] pixels for normalization (default: full range)
Source code in XSpect/analysis/xes.py
patch_pixels(run, **kwargs)
¶
Repair bad pixels using polynomial fitting from neighbors.
Replicates XSpect_Analysis.patch_pixel with mode='polynomial': fits a weighted polynomial to surrounding pixels (excluding the bad pixel region) and evaluates at the bad pixel location.
Supports automatic detection of ASIC panel-gap spikes via
auto_detect: true. Uses a two-method approach:
Method 1 — Global ratio: the column profile (sum over shots and
rows) is compared to a median-filtered baseline. Columns with
ratio > threshold (bright spike) or ratio < 1/threshold (dead
gap within signal region) are flagged. Catches extreme outliers.
Method 2 — Z-score + width filter: computes a robust z-score
(residual / MAD-based local sigma) for each column. Bright and dark
outliers (|z| > nsigma) are separately filtered to keep only
narrow clusters (≤ max_gap_width columns). This catches subtle
ASIC gap columns (partially reduced intensity) that the ratio method
misses — the ASIC gap pattern is a dark stripe (the actual gap)
flanked by bright charge-sharing neighbors. Filtering bright and
dark separately avoids merging them into one wide cluster.
The final set is the union of both methods, merged with any manually
specified pixels.
Parameters from YAML: on: detector key pixels: list of pixel indices to patch (merged with auto if both given) auto_detect: bool (default False) — auto-find spike/dead-gap columns threshold: float (default 5.0) — ratio threshold for Method 1 (spike: ratio > threshold; dead: ratio < 1/threshold) nsigma: float (default 5.0) — z-score threshold for Method 2 max_gap_width: int (default 4) — maximum cluster width to keep in Method 2; wider clusters are rejected as signal gradients smooth_window: int (default 31) — median-filter window for baseline; must be >= the width of the widest expected spike mode: "polynomial", "interpolate", or "zero" (default "polynomial") axis: which axis the pixel indices refer to (default: 0 for 2D, last axis for 3D) patch_range: pixels on each side of bad pixel to exclude (default 4) poly_range: additional pixels beyond patch_range for fitting (default 6) deg: polynomial degree (default 1)
Source code in XSpect/analysis/xes.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
XSpect.analysis.xas
¶
XAS (X-ray Absorption Spectroscopy) specific pipeline steps.
ccm_binning(run, **kwargs)
¶
Digitize CCM data into energy bin indices.
Parameters from YAML: ccm_key: attribute with CCM energy values (default "ccm") ccm_bins_key: attribute with bin edges (default "ccm_bins")
Source code in XSpect/analysis/xas.py
make_ccm_axis(run, **kwargs)
¶
Generate CCM (Channel Cut Monochromator) energy bins.
Parameters from YAML: energies: "auto", explicit list, or [min, max, num_points] ccm_key: attribute with CCM values (for auto mode, default "ccm") resolution: rounding resolution in same units as ccm data (for auto mode, default 0.001)
Source code in XSpect/analysis/xas.py
reduce_detector_ccm(run, **kwargs)
¶
Bin detector data along energy (CCM) dimension.
Parameters from YAML: on: detector key (1D or 2D) ccm_bin_key: bin indices attribute (default "ccm_bin_indices") average: bool (default False)
Source code in XSpect/analysis/xas.py
reduce_detector_ccm_temporal(run, **kwargs)
¶
2D binning: both time AND energy (CCM) dimensions.
Produces a 3D array: (time_bins x energy_bins x pixels) or 2D: (time_bins x energy_bins) for scalar detectors.
Parameters from YAML: on: detector key timing_bin_key: time bin indices (default "timing_bin_indices") ccm_bin_key: CCM bin indices (default "ccm_bin_indices") average: bool (default False)
Source code in XSpect/analysis/xas.py
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 | |
XSpect.analysis.droplet
¶
Droplet-to-photon reconstruction pipeline step.
Reads per-shot sparse photon coordinates from the fixed-length or variable-length droplet2photon arrays stored in smalldata HDF5 files and scatters them back onto dense 2D images, producing a (N_shots, rows, cols) stack for downstream steps.
Supported HDF5 layouts
Fixed-length (e.g. epix100_0):
Variable-length (e.g. epix100_1):
Batch awareness
When the pipeline batches a run, the batch manager injects abs_start_index
and abs_end_index onto each batch run so the step knows which HDF5 rows to
read. In the non-batched path these attributes are absent and the step falls
back to run.start_index / run.end_index.
ROI-direct scattering
When a roi is given, photons are filtered to the ROI window and scattered
straight into the small cropped image (_scatter_roi) — the full 704x768
panel is never allocated. This is bit-identical to scattering onto the full
panel and cropping, but uses ~30x less memory and runs ~2x faster for the
typical (60, 300) XES window.
droplet_reconstruction(run, **kwargs)
¶
Reconstruct per-shot 2D images from droplet2photon sparse data.
Reads sparse photon-position arrays directly from the source smalldata HDF5
file and scatters them onto dense images. The resulting (N_shots, rows, cols)
array is stored on the run object under new_key and is compatible with
all downstream steps (filter_detector_adu, patch_pixels,
rotate_detector, reduce_detector_spatial, etc.).
The step reads from run.run_file. In batch mode the batch manager
injects abs_start_index and abs_end_index onto the batch run so
the correct HDF5 rows are read; in the non-batched path these attributes
are absent and the step derives the range from run.start_index /
run.end_index.
Parameters from YAML
det : str — detector group in the HDF5, e.g. "epix100_0" new_key : str — attribute name to store the reconstructed stack roi : list — [row0, row1, col0, col1] crop region (omit for full panel) panel_shape : list — [rows, cols] of the full panel (default [704, 768])
Example YAML step
- step: droplet_reconstruction det: epix100_0 new_key: epix_spec roi: [270, 330, 400, 700] # -> (60, 300) output matching ROI_area
Source code in XSpect/analysis/droplet.py
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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |