sasdata.file_converter.nxcansas_writer module

NXcanSAS 1/2D data reader for writing HDF5 formatted NXcanSAS files.

class sasdata.file_converter.nxcansas_writer.NXcanSASWriter

Bases: object

A class for writing in NXcanSAS data files. Any number of data sets may be written to the file. Currently 1D and 2D SAS data sets are supported

NXcanSAS spec: http://download.nexusformat.org/sphinx/classes/contributed_definitions/NXcanSAS.html

Dependencies:

The NXcanSAS writer requires h5py => v2.5.0 or later.

__dict__ = mappingproxy({'__module__': 'sasdata.file_converter.nxcansas_writer', '__doc__': '\n    A class for writing in NXcanSAS data files. Any number of data sets may be\n    written to the file. Currently 1D and 2D SAS data sets are supported\n\n    NXcanSAS spec: http://download.nexusformat.org/sphinx/classes/contributed_definitions/NXcanSAS.html\n\n    :Dependencies:\n        The NXcanSAS writer requires h5py => v2.5.0 or later.\n    ', 'write': <function NXcanSASWriter.write>, '_write_1d_data': <function NXcanSASWriter._write_1d_data>, '_write_2d_data': <function NXcanSASWriter._write_2d_data>, '__dict__': <attribute '__dict__' of 'NXcanSASWriter' objects>, '__weakref__': <attribute '__weakref__' of 'NXcanSASWriter' objects>, '__annotations__': {}})
__doc__ = '\n    A class for writing in NXcanSAS data files. Any number of data sets may be\n    written to the file. Currently 1D and 2D SAS data sets are supported\n\n    NXcanSAS spec: http://download.nexusformat.org/sphinx/classes/contributed_definitions/NXcanSAS.html\n\n    :Dependencies:\n        The NXcanSAS writer requires h5py => v2.5.0 or later.\n    '
__module__ = 'sasdata.file_converter.nxcansas_writer'
__weakref__

list of weak references to the object

_write_1d_data(data_obj, data_entry)

Writes the contents of a Data1D object to a SASdata h5py Group

Parameters:
  • data_obj – A Data1D object to write to the file

  • data_entry – A h5py Group object representing the SASdata

_write_2d_data(data, data_entry)

Writes the contents of a Data2D object to a SASdata h5py Group

Parameters:
  • data – A Data2D object to write to the file

  • data_entry – A h5py Group object representing the SASdata

write(dataset, filename)

Write an array of Data1d or Data2D objects to an NXcanSAS file, as one SASEntry with multiple SASData elements. The metadata of the first elememt in the array will be written as the SASentry metadata (detector, instrument, sample, etc).

Parameters:
  • dataset – A list of Data1D or Data2D objects to write

  • filename – Where to write the NXcanSAS file