spec2nexus.writer#

This is an internal library of the spec2nexus software. It is not expected that users of this package will need to call the writer module directly.

source code documentation#

(internal library) Parses SPEC data using spec2nexus.eznx API (only requires h5py).

Writer(spec_data)

writes out scans from SPEC data file to NeXus HDF5 file

class spec2nexus.writer.Writer(spec_data)[source]#

writes out scans from SPEC data file to NeXus HDF5 file

Parameters

spec_data (obj) – instance of SpecDataFile

mca_spectra(nxdata, scan, primary_axis_label)

internal: parse for optional 2-D MCA spectra

mesh(nxdata, scan)

internal: data parser for 2-D mesh and hklmesh

oneD(nxdata, scan)

internal: generic data parser for 1-D column data, returns signal and axis

root_attributes()

internal: returns the attributes to be written to the root element as a dict

save(hdf_file[, scan_list])

save the information in this SPEC data file to a NeXus HDF5 file

save_data(nxdata, scan)

internal: store the scan data

save_dict(group, data)

internal: store a dictionary

save_scan(nxentry, scan)

internal: save the data from each SPEC scan to its own NXentry group

write_ds(group, label, data, **attr)

internal: writes a dataset to the HDF5 file, records the SPEC name as an attribute

mca_spectra(nxdata, scan, primary_axis_label)[source]#

internal: parse for optional 2-D MCA spectra

mesh(nxdata, scan)[source]#

internal: data parser for 2-D mesh and hklmesh

oneD(nxdata, scan)[source]#

internal: generic data parser for 1-D column data, returns signal and axis

root_attributes()[source]#

internal: returns the attributes to be written to the root element as a dict

save(hdf_file, scan_list=None)[source]#

save the information in this SPEC data file to a NeXus HDF5 file

Each scan in scan_list will be converted to a NXentry group.

Parameters
  • hdf_file (str) – name of NeXus HDF5 file to be written

  • scanlist ([int]) – list of scan numbers to be read

save_data(nxdata, scan)[source]#

internal: store the scan data

save_dict(group, data)[source]#

internal: store a dictionary

save_scan(nxentry, scan)[source]#

internal: save the data from each SPEC scan to its own NXentry group

write_ds(group, label, data, **attr)[source]#

internal: writes a dataset to the HDF5 file, records the SPEC name as an attribute