sasdata.dataloader.data_info module

Module that contains classes to hold information read from reduced data files.

A good description of the data members can be found in the CanSAS 1D XML data format:

http://www.smallangles.net/wgwiki/index.php/cansas1d_documentation

class sasdata.dataloader.data_info.Aperture

Bases: object

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', 'name': None, 'type': None, 'size_name': None, 'size': None, 'size_unit': 'mm', 'distance': None, 'distance_unit': 'mm', '__init__': <function Aperture.__init__>, '__dict__': <attribute '__dict__' of 'Aperture' objects>, '__weakref__': <attribute '__weakref__' of 'Aperture' objects>, '__doc__': None, '__annotations__': {}})
__doc__ = None
__init__()
__module__ = 'sasdata.dataloader.data_info'
__weakref__

list of weak references to the object

distance = None
distance_unit = 'mm'
name = None
size = None
size_name = None
size_unit = 'mm'
type = None
class sasdata.dataloader.data_info.Collimation

Bases: object

Class to hold collimation information

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class to hold collimation information\n    ', 'name': None, 'length': None, 'length_unit': 'mm', 'aperture': None, '__init__': <function Collimation.__init__>, '__str__': <function Collimation.__str__>, '__dict__': <attribute '__dict__' of 'Collimation' objects>, '__weakref__': <attribute '__weakref__' of 'Collimation' objects>, '__annotations__': {}})
__doc__ = '\n    Class to hold collimation information\n    '
__init__()
__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

aperture = None
length = None
length_unit = 'mm'
name = None
class sasdata.dataloader.data_info.Data1D(x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False)

Bases: plottable_1D, DataInfo

1D data class

__doc__ = '\n    1D data class\n    '
__init__(x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False)

Initialization

__module__ = 'sasdata.dataloader.data_info'
__str__()

Nice printout

_perform_operation(other, operation)
_perform_union(other)
_validity_check(other)

Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.

Parameters:

other – other data set for operation

Returns:

dy for self, dy for other [numpy arrays]

Raises:

ValueError – when lengths are not compatible

_validity_check_union(other)

Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.

Parameters:

other – other data set for operation

Returns:

bool

Raises:

ValueError – when data types are not compatible

clone_without_data(length=0, clone=None)

Clone the current object, without copying the data (which will be filled out by a subsequent operation). The data arrays will be initialized to zero.

Parameters:
  • length – length of the data array to be initialized

  • clone – if provided, the data will be copied to clone

copy_from_datainfo(data1d)

copy values of Data1D of type DataLaoder.Data_info

is_slit_smeared()

Check whether the data has slit smearing information :return: True is slit smearing info is present, False otherwise

class sasdata.dataloader.data_info.Data2D(data=None, err_data=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)

Bases: plottable_2D, DataInfo

2D data class

I_unit = '1/cm'
Q_unit = '1/A'
__annotations__ = {}
__doc__ = '\n    2D data class\n    '
__init__(data=None, err_data=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)

Initialization

__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

_perform_operation(other, operation)

Perform 2D operations between data sets

Parameters:
  • other – other data set

  • operation – function defining the operation

_perform_union(other)

Perform 2D operations between data sets

Parameters:
  • other – other data set

  • operation – function defining the operation

_validity_check(other)

Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.

Parameters:

other – other data set for operation

Returns:

dy for self, dy for other [numpy arrays]

Raises:

ValueError – when lengths are not compatible

static _validity_check_union(self, other)

Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.

Parameters:

other – other data set for operation

Returns:

bool

Raises:

ValueError – when data types are not compatible

clone_without_data(length=0, clone=None)

Clone the current object, without copying the data (which will be filled out by a subsequent operation). The data arrays will be initialized to zero.

Parameters:
  • length – length of the data array to be initialized

  • clone – if provided, the data will be copied to clone

copy_from_datainfo(data2d)

copy value of Data2D of type DataLoader.data_info

isSesans = False
class sasdata.dataloader.data_info.DataInfo

Bases: object

Class to hold the data read from a file. It includes four blocks of data for the instrument description, the sample description, the data itself and any other meta data.

__add__(other)

Add two data sets

Parameters:

other – data set to add to the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class to hold the data read from a file.\n    It includes four blocks of data for the\n    instrument description, the sample description,\n    the data itself and any other meta data.\n    ', 'title': '', 'run': None, 'run_name': None, 'filename': '', 'notes': None, 'process': None, 'instrument': '', 'detector': None, 'sample': None, 'source': None, 'collimation': None, 'trans_spectrum': None, 'meta_data': None, 'errors': None, 'isSesans': None, '__init__': <function DataInfo.__init__>, 'append_empty_process': <function DataInfo.append_empty_process>, 'add_notes': <function DataInfo.add_notes>, '__str__': <function DataInfo.__str__>, '_perform_operation': <function DataInfo._perform_operation>, '_perform_union': <function DataInfo._perform_union>, '__add__': <function DataInfo.__add__>, '__radd__': <function DataInfo.__radd__>, '__sub__': <function DataInfo.__sub__>, '__rsub__': <function DataInfo.__rsub__>, '__mul__': <function DataInfo.__mul__>, '__rmul__': <function DataInfo.__rmul__>, '__truediv__': <function DataInfo.__truediv__>, '__div__': <function DataInfo.__truediv__>, '__rtruediv__': <function DataInfo.__rtruediv__>, '__rdiv__': <function DataInfo.__rtruediv__>, '__or__': <function DataInfo.__or__>, '__ror__': <function DataInfo.__ror__>, '__dict__': <attribute '__dict__' of 'DataInfo' objects>, '__weakref__': <attribute '__weakref__' of 'DataInfo' objects>, '__annotations__': {}})
__div__(other)

Divided a data set by another

Parameters:

other – data set that the current one is divided by

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__doc__ = '\n    Class to hold the data read from a file.\n    It includes four blocks of data for the\n    instrument description, the sample description,\n    the data itself and any other meta data.\n    '
__init__()

Initialization

__module__ = 'sasdata.dataloader.data_info'
__mul__(other)

Multiply two data sets

Parameters:

other – data set to subtract from the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__or__(other)

Union a data set with another

Parameters:

other – data set to be unified

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__radd__(other)

Add two data sets

Parameters:

other – data set to add to the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__rdiv__(other)

Divided a data set by another

Parameters:

other – data set that the current one is divided by

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__rmul__(other)

Multiply two data sets

Parameters:

other – data set to subtract from the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__ror__(other)

Union a data set with another

Parameters:

other – data set to be unified

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__rsub__(other)

Subtract two data sets

Parameters:

other – data set to subtract from the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__rtruediv__(other)

Divided a data set by another

Parameters:

other – data set that the current one is divided by

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__str__()

Nice printout

__sub__(other)

Subtract two data sets

Parameters:

other – data set to subtract from the current one

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__truediv__(other)

Divided a data set by another

Parameters:

other – data set that the current one is divided by

Returns:

new data set

Raises:

ValueError – raised when two data sets are incompatible

__weakref__

list of weak references to the object

_perform_operation(other, operation)

Private method to perform operation. Not implemented for DataInfo, but should be implemented for each data class inherited from DataInfo that holds actual data (ex.: Data1D)

_perform_union(other)

Private method to perform union operation. Not implemented for DataInfo, but should be implemented for each data class inherited from DataInfo that holds actual data (ex.: Data1D)

add_notes(message='')

Add notes to datainfo

append_empty_process()
collimation = None
detector = None
errors = None
filename = ''
instrument = ''
isSesans = None
meta_data = None
notes = None
process = None
run = None
run_name = None
sample = None
source = None
title = ''
trans_spectrum = None
class sasdata.dataloader.data_info.Detector

Bases: object

Class to hold detector information

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class to hold detector information\n    ', 'name': None, 'distance': None, 'distance_unit': 'mm', 'offset': None, 'offset_unit': 'm', 'orientation': None, 'orientation_unit': 'degree', 'beam_center': None, 'beam_center_unit': 'mm', 'pixel_size': None, 'pixel_size_unit': 'mm', 'slit_length': None, 'slit_length_unit': 'mm', '__init__': <function Detector.__init__>, '__str__': <function Detector.__str__>, '__dict__': <attribute '__dict__' of 'Detector' objects>, '__weakref__': <attribute '__weakref__' of 'Detector' objects>, '__annotations__': {}})
__doc__ = '\n    Class to hold detector information\n    '
__init__()

Initialize class attribute that are objects…

__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

beam_center = None
beam_center_unit = 'mm'
distance = None
distance_unit = 'mm'
name = None
offset = None
offset_unit = 'm'
orientation = None
orientation_unit = 'degree'
pixel_size = None
pixel_size_unit = 'mm'
slit_length = None
slit_length_unit = 'mm'
class sasdata.dataloader.data_info.Process

Bases: object

Class that holds information about the processes performed on the data.

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class that holds information about the processes\n    performed on the data.\n    ', 'name': '', 'date': '', 'description': '', 'term': None, 'notes': None, '__init__': <function Process.__init__>, 'is_empty': <function Process.is_empty>, 'single_line_desc': <function Process.single_line_desc>, '__str__': <function Process.__str__>, '__dict__': <attribute '__dict__' of 'Process' objects>, '__weakref__': <attribute '__weakref__' of 'Process' objects>, '__annotations__': {}})
__doc__ = '\n    Class that holds information about the processes\n    performed on the data.\n    '
__init__()
__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

date = ''
description = ''
is_empty()

Return True if the object is empty

name = ''
notes = None
single_line_desc()

Return a single line string representing the process

term = None
class sasdata.dataloader.data_info.Sample

Bases: object

Class to hold the sample description

ID = ''
__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class to hold the sample description\n    ', 'name': '', 'ID': '', 'thickness': None, 'thickness_unit': 'mm', 'transmission': None, 'temperature': None, 'temperature_unit': None, 'position': None, 'position_unit': 'mm', 'orientation': None, 'orientation_unit': 'degree', 'details': None, 'zacceptance': (0, ''), 'yacceptance': (0, ''), '__init__': <function Sample.__init__>, '__str__': <function Sample.__str__>, '__dict__': <attribute '__dict__' of 'Sample' objects>, '__weakref__': <attribute '__weakref__' of 'Sample' objects>, '__annotations__': {}})
__doc__ = '\n    Class to hold the sample description\n    '
__init__()
__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

details = None
name = ''
orientation = None
orientation_unit = 'degree'
position = None
position_unit = 'mm'
temperature = None
temperature_unit = None
thickness = None
thickness_unit = 'mm'
transmission = None
yacceptance = (0, '')
zacceptance = (0, '')
class sasdata.dataloader.data_info.Source

Bases: object

Class to hold source information

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class to hold source information\n    ', 'name': None, 'radiation': None, 'type': None, 'probe': None, 'beam_size_name': None, 'beam_size': None, 'beam_size_unit': 'mm', 'beam_shape': None, 'wavelength': None, 'wavelength_unit': 'A', 'wavelength_min': None, 'wavelength_min_unit': 'nm', 'wavelength_max': None, 'wavelength_max_unit': 'nm', 'wavelength_spread': None, 'wavelength_spread_unit': 'percent', '__init__': <function Source.__init__>, '__str__': <function Source.__str__>, '__dict__': <attribute '__dict__' of 'Source' objects>, '__weakref__': <attribute '__weakref__' of 'Source' objects>, '__annotations__': {}})
__doc__ = '\n    Class to hold source information\n    '
__init__()
__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

beam_shape = None
beam_size = None
beam_size_name = None
beam_size_unit = 'mm'
name = None
probe = None
radiation = None
type = None
wavelength = None
wavelength_max = None
wavelength_max_unit = 'nm'
wavelength_min = None
wavelength_min_unit = 'nm'
wavelength_spread = None
wavelength_spread_unit = 'percent'
wavelength_unit = 'A'
class sasdata.dataloader.data_info.TransmissionSpectrum

Bases: object

Class that holds information about transmission spectrum for white beams and spallation sources.

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Class that holds information about transmission spectrum\n    for white beams and spallation sources.\n    ', 'name': '', 'timestamp': '', 'wavelength': None, 'wavelength_unit': 'A', 'transmission': None, 'transmission_unit': '', 'transmission_deviation': None, 'transmission_deviation_unit': '', '__init__': <function TransmissionSpectrum.__init__>, '__str__': <function TransmissionSpectrum.__str__>, '__dict__': <attribute '__dict__' of 'TransmissionSpectrum' objects>, '__weakref__': <attribute '__weakref__' of 'TransmissionSpectrum' objects>, '__annotations__': {}})
__doc__ = '\n    Class that holds information about transmission spectrum\n    for white beams and spallation sources.\n    '
__init__()
__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

name = ''
timestamp = ''
transmission = None
transmission_deviation = None
transmission_deviation_unit = ''
transmission_unit = ''
wavelength = None
wavelength_unit = 'A'
class sasdata.dataloader.data_info.Vector(x=None, y=None, z=None)

Bases: object

Vector class to hold multi-dimensional objects

__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Vector class to hold multi-dimensional objects\n    ', 'x': None, 'y': None, 'z': None, '__init__': <function Vector.__init__>, '__str__': <function Vector.__str__>, '__dict__': <attribute '__dict__' of 'Vector' objects>, '__weakref__': <attribute '__weakref__' of 'Vector' objects>, '__annotations__': {}})
__doc__ = '\n    Vector class to hold multi-dimensional objects\n    '
__init__(x=None, y=None, z=None)

Initialization. Components that are not set a set to None by default.

Parameters:
  • x – x component

  • y – y component

  • z – z component

__module__ = 'sasdata.dataloader.data_info'
__str__()

Return str(self).

__weakref__

list of weak references to the object

x = None
y = None
z = None
sasdata.dataloader.data_info.combine_data_info_with_plottable(data, datainfo)

A function that combines the DataInfo data in self.current_datainto with a plottable_1D or 2D data object.

Parameters:
  • data – A plottable_1D or plottable_2D data object

  • datainfo – A DataInfo object to be combined with the plottable

Returns:

A fully specified Data1D or Data2D object

class sasdata.dataloader.data_info.plottable_1D(x, y, dx=None, dy=None, dxl=None, dxw=None, lam=None, dlam=None)

Bases: object

Data1D is a place holder for 1D plottables.

__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Data1D is a place holder for 1D plottables.\n    ', 'x': None, 'y': None, 'dx': None, 'dy': None, 'dxl': None, 'dxw': None, 'lam': None, 'dlam': None, '_xaxis': '', '_xunit': '', '_yaxis': '', '_yunit': '', '__init__': <function plottable_1D.__init__>, 'xaxis': <function plottable_1D.xaxis>, 'yaxis': <function plottable_1D.yaxis>, '__dict__': <attribute '__dict__' of 'plottable_1D' objects>, '__weakref__': <attribute '__weakref__' of 'plottable_1D' objects>, '__annotations__': {}})
__doc__ = '\n    Data1D is a place holder for 1D plottables.\n    '
__init__(x, y, dx=None, dy=None, dxl=None, dxw=None, lam=None, dlam=None)
__module__ = 'sasdata.dataloader.data_info'
__weakref__

list of weak references to the object

_xaxis = ''
_xunit = ''
_yaxis = ''
_yunit = ''
dlam = None
dx = None
dxl = None
dxw = None
dy = None
lam = None
x = None
xaxis(label, unit)

set the x axis label and unit

y = None
yaxis(label, unit)

set the y axis label and unit

class sasdata.dataloader.data_info.plottable_2D(data=None, err_data=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, x_bins=None, y_bins=None)

Bases: object

Data2D is a place holder for 2D plottables.

__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'sasdata.dataloader.data_info', '__doc__': '\n    Data2D is a place holder for 2D plottables.\n    ', 'xmin': None, 'xmax': None, 'ymin': None, 'ymax': None, 'data': None, 'qx_data': None, 'qy_data': None, 'q_data': None, 'err_data': None, 'dqx_data': None, 'dqy_data': None, 'mask': None, 'x_bins': None, 'y_bins': None, '_xaxis': '', '_xunit': '', '_yaxis': '', '_yunit': '', '_zaxis': '', '_zunit': '', '__init__': <function plottable_2D.__init__>, 'xaxis': <function plottable_2D.xaxis>, 'yaxis': <function plottable_2D.yaxis>, 'zaxis': <function plottable_2D.zaxis>, '__dict__': <attribute '__dict__' of 'plottable_2D' objects>, '__weakref__': <attribute '__weakref__' of 'plottable_2D' objects>, '__annotations__': {}})
__doc__ = '\n    Data2D is a place holder for 2D plottables.\n    '
__init__(data=None, err_data=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, x_bins=None, y_bins=None)
__module__ = 'sasdata.dataloader.data_info'
__weakref__

list of weak references to the object

_xaxis = ''
_xunit = ''
_yaxis = ''
_yunit = ''
_zaxis = ''
_zunit = ''
data = None
dqx_data = None
dqy_data = None
err_data = None
mask = None
q_data = None
qx_data = None
qy_data = None
x_bins = None
xaxis(label, unit)

set the x axis label and unit

xmax = None
xmin = None
y_bins = None
yaxis(label, unit)

set the y axis label and unit

ymax = None
ymin = None
zaxis(label, unit)

set the z axis label and unit