io#

Reading and writing other programs’ formats, e.g. ImageD11 parameters, TensorMaps, sparse and DataSet files.

Functions

beam_from_pars(pars[, k_in_lab])

Beam from ImageD11 parameters: wavelength (angstrom), and a direction.

detector_from_pars(pars)

Detector geometry from ImageD11 parameters, for mapping between detector pixels and the lab frame.

entries_from_tensormap(tmap[, phase_id, z_layer])

Map entries for one phase of a 2D ImageD11 TensorMap, at sample-frame positions.

geom_from_pars(pars, y0, sig_wavelength, ...)

Build the geometry dict for anri.fwd.render_row() from ImageD11 parameters.

gonio_from_pars(pars, y0)

Goniometer geometry from ImageD11 parameters.

motor_grid(omega_range, ostep, dty_range, ystep)

Regular (dty row, frame) grid of motor positions for a phantom scan.

prefetch(chunks[, depth])

Read ahead: produce the items of an iterable in a background thread, up to depth ahead of the consumer.

read_dataset(dsfile)

Read the scan layout of an ImageD11 DataSet file, without ImageD11.

read_frame_dty(ds[, sparsefile])

Each frame's dty: the DataSet's (corrected) dty of its row, plus the motion of dty within the row.

read_monitor(sparsefile, groups, name[, ...])

Read a counter (e.g. "fpico6") for each scan group, frame by frame, as ImageD11's DataSet.get_monitor.

read_par(path)

Read an ImageD11 .par file of key value lines (numbers as floats, other values as strings).

read_pars_json(parfile[, phase])

Read the geometry and one phase from an ImageD11 pars.json.

read_spatial(ds)

Read a DataSet's detector distortion maps, as ImageD11 corrects its peaks with them.

simulate_sparse(path, entries, hkls, F2, ...)

Render every dty row of a scan and write the sparse pixels file, one row at a time.

stream_sparse(sparsefile, ybinedges, ...[, ...])

Read sparse pixels a chunk at a time, with each frame's dty row.

tensormap_from_recon(maps, ...)

Build a single-phase 2D ImageD11 TensorMap from maps in reconstruction order.

write_dataset(sparse_path, analysisroot, ...)

Write an ImageD11 DataSet file for a sparse pixels file, ready for the S3DXRD pipeline.

write_par(path, pars)

Write ImageD11 parameters as a .par file of key value lines.

write_pars(folder, geometry, phases)

Write ImageD11 parameter files: geometry.par, one <phase>.par per phase, and pars.json.

write_peaks_table(dsfile[, nproc, ...])

Label the sparse pixels into ImageD11's peaks table: the last step of a simulation.

write_scan(hout, scan, frame, pixel, value, ...)

Write one dty row of sparse pixels as an ImageD11 scan group.

write_zero_distortion(folder, det_shape)

Write e2dx.edf and e2dy.edf spatial distortion files that are zero everywhere.