sasdata.file_converter.bsl_loader module

class sasdata.file_converter.bsl_loader.BSLLoader(filename)

Bases: object

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.

__annotate_func__ = None
__annotations_cache__ = {}
__dict__ = mappingproxy({'__module__': 'sasdata.file_converter.bsl_loader', '__firstlineno__': 12, '__doc__': '\nLoads 2D SAS data from a BSL file.\nCLoader is a C extension (found in c_ext/bsl_loader.c)\n\nSee http://www.diamond.ac.uk/Beamlines/Soft-Condensed-Matter/small-angle/SAXS-Software/CCP13/BSL.html\nfor more info on the BSL file format.\n', '__init__': <function BSLLoader.__init__>, '_parse_header': <function BSLLoader._parse_header>, 'filename': <property object>, 'n_frames': <property object>, 'n_pixels': <property object>, 'n_rasters': <property object>, 'swap_bytes': <property object>, 'load_frames': <function BSLLoader.load_frames>, 'load_data': <function BSLLoader.load_data>, '__str__': <function BSLLoader.__str__>, '__static_attributes__': ('_filename', '_n_frames', '_n_pixels', '_n_rasters', '_swap_bytes', 'filename', 'n_frames', 'n_pixels', 'n_rasters', 'swap_bytes'), '__dict__': <attribute '__dict__' of 'BSLLoader' objects>, '__weakref__': <attribute '__weakref__' of 'BSLLoader' objects>, '__annotations_cache__': {}})
__doc__ = '\nLoads 2D SAS data from a BSL file.\nCLoader is a C extension (found in c_ext/bsl_loader.c)\n\nSee http://www.diamond.ac.uk/Beamlines/Soft-Condensed-Matter/small-angle/SAXS-Software/CCP13/BSL.html\nfor more info on the BSL file format.\n'
__firstlineno__ = 12
__init__(filename)

Parses the BSL header file and sets instance variables apropriately

Parameters:

filename – Path to the BSL header file

__module__ = 'sasdata.file_converter.bsl_loader'
__static_attributes__ = ('_filename', '_n_frames', '_n_pixels', '_n_rasters', '_swap_bytes', 'filename', 'n_frames', 'n_pixels', 'n_rasters', 'swap_bytes')
__str__()

Print the objects params.

Returns:

string description of object parameters.

__weakref__

list of weak references to the object

_parse_header(header_file, filename, sasdata_filename, folder)

Method that parses the header file and returns the metadata in data_info

Parameters:

header_file – header file object.

Returns:

metadata of header file.

property filename

File to load.

load_data(frame)

Loads the file named in filename in 4 byte float, in either little or big Endian depending on self.swap_bytes.

Parameters:

frame – The frame to load.

Returns:

np array of loaded floats.

load_frames(frames)

Loads all frames of the BSl file into a Data2D object.

Parameters:

frames – Number of frames.

Returns:

Data2D frame_data.

property n_frames

Number of frames in the file.

property n_pixels

Number of pixels in the file.

property n_rasters

Number of rasters in the file.

property swap_bytes

Whether or not the bytes are in reverse order.

exception sasdata.file_converter.bsl_loader.BSLParsingError

Bases: Exception

__doc__ = None
__firstlineno__ = 8
__module__ = 'sasdata.file_converter.bsl_loader'
__static_attributes__ = ()
__weakref__

list of weak references to the object