stream_sparse#
- anri.io.stream_sparse(sparsefile, ybinedges, omega_motor, dty_motor, chunk, groups=None, gridstep=1, dataset_dty=None, scans=None, monitor=None, monitor_ref=None, masterfile=None, dataset_omega=None, spatial=None)[source]#
Read sparse pixels a chunk at a time, with each frame’s dty row.
A frame’s omega and dty are the DataSet’s, where the DataSet has the frame (
dataset_omega,dataset_dty: ImageD11 has binned the scan into rotations by then, e.g. replacing the dty of a fly scan by its mean over each rotation), else the sparse group’s own readings ofomega_motoranddty_motor. Its row is the bin ofybinedgesholding its dty, divided bygridstep(rows summed in groups); frames outside the bins, or that the DataSet slices out, get row -1. With a monitor, intensities are normalised to the flux as ImageD11’sDataSet.set_monitordoes: multiplied bymonitor_ref / monitorframe by frame, so beam decay within a rotation and between the dty rows’ scans does not show in the data.- Parameters:
sparsefile (
str) – ImageD11 sparse pixels file, one group per scanybinedges (
Array|ndarray|bool|number|bool|int|float|complex) – [n_rows + 1] dty bin edgesomega_motor (
str) – Motor names in each group’smeasurementdty_motor (
str) – Motor names in each group’smeasurementchunk (
int) – Pixels per chunk at mostgroups (
list|None, default:None) – Groups to read (default: all)gridstep (
int, default:1) – Rows summed in groups of thisdataset_dty (
ndarray|None, default:None) – [scans, frames] dty and scan names from the DataSet (read_dataset()). A DataSet scan is a sparse group (“1.1”) or a slice of one (“1.1::[0:1440]”: a fly scan split into its rotations)scans (
list|None, default:None) – [scans, frames] dty and scan names from the DataSet (read_dataset()). A DataSet scan is a sparse group (“1.1”) or a slice of one (“1.1::[0:1440]”: a fly scan split into its rotations)monitor (
str|None, default:None) – Name of a counter in each group’smeasurement, e.g. “fpico6”; None (default) for no normalisation. Frames where it is not positive are dropped.monitor_ref (
float|None, default:None) – Reference value; default the counter’s mean over the groups readmasterfile (
str|None, default:None) – Where to find the monitor if the sparse file lacks it, seeread_monitor()dataset_omega (
ndarray|None, default:None) – [scans, frames] omega from the DataSet, asdataset_dtyspatial (
tuple|None, default:None) – (dx, dy) [n_slow, n_fast] detector distortion maps (read_spatial()): each pixel is yielded at (row + dy[row, col], col + dx[row, col]), as ImageD11 corrects its peaks. None: the raw pixel positions
- Yields:
tuple– (slow, fast, omega, row, value): NumPy arrays of at mostchunkpixels