sas.sascalc.file_converter package

Subpackages

Submodules

sas.sascalc.file_converter.bsl_loader module

class sas.sascalc.file_converter.bsl_loader.BSLLoader(filename)[source]

Bases: CLoader

Loads 2D SAS data from a BSL file. CLoader is a C extension (found in c_ext/bsl_loader.c)

See http://www.diamond.ac.uk/Beamlines/Soft-Condensed-Matter/small-angle/SAXS-Software/CCP13/BSL.html for more info on the BSL file format.

load_frames(frames)[source]
exception sas.sascalc.file_converter.bsl_loader.BSLParsingError[source]

Bases: exceptions.Exception

sas.sascalc.file_converter.cansas_writer module

class sas.sascalc.file_converter.cansas_writer.CansasWriter(xml=None, schema=None)[source]

Bases: sas.sascalc.dataloader.readers.cansas_reader.Reader

write(filename, frame_data, sasentry_attrs=None)[source]

Write the content of a Data1D as a CanSAS XML file

Parameters:
  • filename – name of the file to write
  • datainfo – Data1D object

sas.sascalc.file_converter.nxcansas_writer module

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

class sas.sascalc.file_converter.nxcansas_writer.NXcanSASWriter[source]

Bases: sas.sascalc.dataloader.readers.cansas_reader_HDF5.Reader

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.
write(dataset, filename)[source]

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

sas.sascalc.file_converter.otoko_loader module

Here we handle loading of “OTOKO” data (for more info about this format see the comment in load_otoko_data). Given the paths of header and data files, we aim to load the data into numpy arrays for use later.

class sas.sascalc.file_converter.otoko_loader.CStyleStruct(**kwds)[source]

A nice and easy way to get “C-style struct” functionality.

class sas.sascalc.file_converter.otoko_loader.OTOKOData(q_axis, data_axis)[source]
class sas.sascalc.file_converter.otoko_loader.OTOKOLoader(qaxis_path, data_path)[source]

Bases: object

load_otoko_data()[source]

Loads “OTOKO” data, which is a format that stores each axis separately. An axis is represented by a “header” file, which in turn will give details of one or more binary files where the actual data is stored.

Given the paths of two header files, this function will load each axis in turn. If loading is successfull then an instance of the OTOKOData class will be returned, else an exception will be raised.

For more information on the OTOKO file format, please see: http://www.diamond.ac.uk/Home/Beamlines/small-angle/SAXS-Software/CCP13/ XOTOKO.html

exception sas.sascalc.file_converter.otoko_loader.OTOKOParsingError[source]

Bases: exceptions.Exception

sas.sascalc.file_converter.red2d_writer module

class sas.sascalc.file_converter.red2d_writer.Red2DWriter[source]

Bases: sas.sascalc.dataloader.readers.red2d_reader.Reader

write(filename, data, thread)[source]

Write to .dat

Parameters:
  • filename – file name to write
  • data – data2D

Module contents