sas.sascalc.dataloader package¶
Subpackages¶
- sas.sascalc.dataloader.readers package
- Submodules
- sas.sascalc.dataloader.readers.abs_reader module
- sas.sascalc.dataloader.readers.anton_paar_saxs_reader module
- sas.sascalc.dataloader.readers.ascii_reader module
- sas.sascalc.dataloader.readers.associations module
- sas.sascalc.dataloader.readers.cansas_constants module
CansasConstants
CansasConstants.ANY
CansasConstants.CANSAS_FORMAT
CansasConstants.CANSAS_NS
CansasConstants.RUN
CansasConstants.SASDATA
CansasConstants.SASDATA_IDATA
CansasConstants.SASDATA_IDATA_DQL
CansasConstants.SASDATA_IDATA_DQW
CansasConstants.SASDATA_IDATA_I
CansasConstants.SASDATA_IDATA_IDEV
CansasConstants.SASDATA_IDATA_Q
CansasConstants.SASDATA_IDATA_QDEV
CansasConstants.SASDATA_IDATA_QMEAN
CansasConstants.SASDATA_IDATA_SHADOWFACTOR
CansasConstants.SASINSTR
CansasConstants.SASINSTR_COLL
CansasConstants.SASINSTR_COLL_APER
CansasConstants.SASINSTR_COLL_APER_ATTR
CansasConstants.SASINSTR_COLL_APER_DIST
CansasConstants.SASINSTR_COLL_APER_SIZE
CansasConstants.SASINSTR_COLL_APER_X
CansasConstants.SASINSTR_COLL_APER_Y
CansasConstants.SASINSTR_COLL_APER_Z
CansasConstants.SASINSTR_DET
CansasConstants.SASINSTR_DET_BC
CansasConstants.SASINSTR_DET_BC_X
CansasConstants.SASINSTR_DET_BC_Y
CansasConstants.SASINSTR_DET_BC_Z
CansasConstants.SASINSTR_DET_OFF
CansasConstants.SASINSTR_DET_OFF_ATTR
CansasConstants.SASINSTR_DET_OFF_X
CansasConstants.SASINSTR_DET_OFF_Y
CansasConstants.SASINSTR_DET_OFF_Z
CansasConstants.SASINSTR_DET_OR
CansasConstants.SASINSTR_DET_OR_ATTR
CansasConstants.SASINSTR_DET_OR_PITCH
CansasConstants.SASINSTR_DET_OR_ROLL
CansasConstants.SASINSTR_DET_OR_YAW
CansasConstants.SASINSTR_DET_PIXEL
CansasConstants.SASINSTR_DET_PIXEL_X
CansasConstants.SASINSTR_DET_PIXEL_Y
CansasConstants.SASINSTR_DET_PIXEL_Z
CansasConstants.SASINSTR_DET_SDD
CansasConstants.SASINSTR_DET_SLIT
CansasConstants.SASINSTR_SRC
CansasConstants.SASINSTR_SRC_BEAMSIZE
CansasConstants.SASINSTR_SRC_BEAMSIZE_ATTR
CansasConstants.SASINSTR_SRC_BEAMSIZE_X
CansasConstants.SASINSTR_SRC_BEAMSIZE_Y
CansasConstants.SASINSTR_SRC_BEAMSIZE_Z
CansasConstants.SASINSTR_SRC_WL
CansasConstants.SASINSTR_SRC_WL_MAX
CansasConstants.SASINSTR_SRC_WL_MIN
CansasConstants.SASINSTR_SRC_WL_SPR
CansasConstants.SASNOTE
CansasConstants.SASPROCESS
CansasConstants.SASPROCESS_SASPROCESSNOTE
CansasConstants.SASPROCESS_TERM
CansasConstants.SASSAMPLE
CansasConstants.SASSAMPLE_ORIENT
CansasConstants.SASSAMPLE_ORIENT_ATTR
CansasConstants.SASSAMPLE_ORIENT_PITCH
CansasConstants.SASSAMPLE_ORIENT_ROLL
CansasConstants.SASSAMPLE_ORIENT_YAW
CansasConstants.SASSAMPLE_POS
CansasConstants.SASSAMPLE_POS_ATTR
CansasConstants.SASSAMPLE_POS_X
CansasConstants.SASSAMPLE_POS_Y
CansasConstants.SASSAMPLE_POS_Z
CansasConstants.SASSAMPLE_TEMP
CansasConstants.SASSAMPLE_THICK
CansasConstants.SASSAMPLE_TRANS
CansasConstants.SASTRANSSPEC
CansasConstants.SASTRANSSPEC_TDATA
CansasConstants.SASTRANSSPEC_TDATA_LAMDBA
CansasConstants.SASTRANSSPEC_TDATA_T
CansasConstants.SASTRANSSPEC_TDATA_TDEV
CansasConstants.TITLE
CansasConstants.__dict__
CansasConstants.__doc__
CansasConstants.__init__()
CansasConstants.__module__
CansasConstants.__weakref__
CansasConstants.format
CansasConstants.get_namespace_map()
CansasConstants.iterate_namespace()
CansasConstants.names
CurrentLevel
- sas.sascalc.dataloader.readers.cansas_reader module
Reader
Reader.__doc__
Reader.__module__
Reader._add_intermediate()
Reader._check_origin()
Reader._create_main_node()
Reader._get_node_value()
Reader._get_pi_string()
Reader._initialize_new_data_set()
Reader._is_call_local()
Reader._parse_entry()
Reader._store_content()
Reader._store_float()
Reader._to_xml_doc()
Reader._unit_conversion()
Reader._write_collimation()
Reader._write_data()
Reader._write_data_2d()
Reader._write_detectors()
Reader._write_instrument()
Reader._write_notes()
Reader._write_process_notes()
Reader._write_run_names()
Reader._write_sample_info()
Reader._write_source()
Reader._write_trans_spectrum()
Reader.allow_all
Reader.base_ns
Reader.cansas_defaults
Reader.cansas_version
Reader.current_data1d
Reader.data
Reader.errors
Reader.ext
Reader.frm
Reader.get_file_contents()
Reader.invalid
Reader.is_cansas()
Reader.load_file_and_schema()
Reader.logging
Reader.names
Reader.ns_list
Reader.process_1d_data_object()
Reader.process_2d_data_object()
Reader.process_collimation_data_object()
Reader.process_detector_data_object()
Reader.process_meta_data()
Reader.process_process_data_object()
Reader.process_sample_data_object()
Reader.process_source_data_object()
Reader.process_trans_spec_data_object()
Reader.reset_state()
Reader.set_default_schema()
Reader.type
Reader.type_name
Reader.write()
Reader.write_node()
get_content()
getattrchain()
setattrchain()
write_node()
- sas.sascalc.dataloader.readers.cansas_reader_HDF5 module
Reader
Reader.__doc__
Reader.__module__
Reader._create_unique_key()
Reader._find_data_attributes()
Reader._get_unit()
Reader._initialize_new_data_set()
Reader._is_2d_not_multi_frame()
Reader.add_data_set()
Reader.add_intermediate()
Reader.allow_all
Reader.as_list_or_array()
Reader.cansas_version
Reader.ext
Reader.final_data_cleanup()
Reader.get_file_contents()
Reader.process_1d_data_object()
Reader.process_2d_data_object()
Reader.process_aperture()
Reader.process_collimation()
Reader.process_detector()
Reader.process_process()
Reader.process_sample()
Reader.process_source()
Reader.process_trans_spectrum()
Reader.read_children()
Reader.reset_state()
Reader.type
Reader.type_name
Reader.write()
h5attr()
- sas.sascalc.dataloader.readers.csv_reader module
- sas.sascalc.dataloader.readers.danse_reader module
- sas.sascalc.dataloader.readers.red2d_reader module
- sas.sascalc.dataloader.readers.sesans_reader module
- sas.sascalc.dataloader.readers.tiff_reader module
- sas.sascalc.dataloader.readers.xml_reader module
XMLreader
XMLreader.__doc__
XMLreader.__init__()
XMLreader.__module__
XMLreader._create_unique_key()
XMLreader.append()
XMLreader.break_processing_instructions()
XMLreader.create_element()
XMLreader.create_element_from_string()
XMLreader.create_tree()
XMLreader.ebuilder()
XMLreader.encoding
XMLreader.find_invalid_xml()
XMLreader.parse_schema_and_doc()
XMLreader.processing_instructions
XMLreader.reader()
XMLreader.return_processing_instructions()
XMLreader.schema
XMLreader.schemadoc
XMLreader.set_encoding()
XMLreader.set_processing_instructions()
XMLreader.set_schema()
XMLreader.set_xml_file()
XMLreader.set_xml_string()
XMLreader.to_string()
XMLreader.validate_xml()
XMLreader.write_attribute()
XMLreader.write_text()
XMLreader.xml
XMLreader.xmldoc
XMLreader.xmlroot
- Module contents
Submodules¶
sas.sascalc.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 sas.sascalc.dataloader.data_info.Aperture[source]¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- distance = None¶
- distance_unit = 'mm'¶
- name = None¶
- size = None¶
- size_name = None¶
- size_unit = 'mm'¶
- type = None¶
- class sas.sascalc.dataloader.data_info.Collimation[source]¶
Bases:
object
Class to hold collimation information
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- aperture = None¶
- length = None¶
- length_unit = 'mm'¶
- name = None¶
- class sas.sascalc.dataloader.data_info.Data1D(x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False)[source]¶
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)[source]¶
Initialization
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- _validity_check(other)[source]¶
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)[source]¶
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)[source]¶
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
- class sas.sascalc.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)[source]¶
Bases:
plottable_2D
,DataInfo
2D data class
- I_unit = '1/cm'¶
- Q_unit = '1/A'¶
- __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)[source]¶
Initialization
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- _perform_operation(other, operation)[source]¶
Perform 2D operations between data sets
- Parameters:
other – other data set
operation – function defining the operation
- _perform_union(other)[source]¶
Perform 2D operations between data sets
- Parameters:
other – other data set
operation – function defining the operation
- _validity_check(other)[source]¶
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)[source]¶
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)[source]¶
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
- isSesans = False¶
- class sas.sascalc.dataloader.data_info.DataInfo[source]¶
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)[source]¶
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
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __mul__(other)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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
- __sub__(other)[source]¶
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)[source]¶
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 (if defined)
- _perform_operation(other, operation)[source]¶
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)[source]¶
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)
- 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 sas.sascalc.dataloader.data_info.Detector[source]¶
Bases:
object
Class to hold detector information
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- 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 sas.sascalc.dataloader.data_info.Process[source]¶
Bases:
object
Class that holds information about the processes performed on the data.
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- date = ''¶
- description = ''¶
- name = ''¶
- notes = None¶
- term = None¶
- class sas.sascalc.dataloader.data_info.Sample[source]¶
Bases:
object
Class to hold the sample description
- ID = ''¶
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- 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 sas.sascalc.dataloader.data_info.Source[source]¶
Bases:
object
Class to hold source information
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- 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 sas.sascalc.dataloader.data_info.TransmissionSpectrum[source]¶
Bases:
object
Class that holds information about transmission spectrum for white beams and spallation sources.
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- name = ''¶
- timestamp = ''¶
- transmission = None¶
- transmission_deviation = None¶
- transmission_deviation_unit = ''¶
- transmission_unit = ''¶
- wavelength = None¶
- wavelength_unit = 'A'¶
- class sas.sascalc.dataloader.data_info.Vector(x=None, y=None, z=None)[source]¶
Bases:
object
Vector class to hold multi-dimensional objects
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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)[source]¶
Initialization. Components that are not set a set to None by default.
- Parameters:
x – x component
y – y component
z – z component
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- x = None¶
- y = None¶
- z = None¶
- sas.sascalc.dataloader.data_info.combine_data_info_with_plottable(data, datainfo)[source]¶
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 sas.sascalc.dataloader.data_info.plottable_1D(x, y, dx=None, dy=None, dxl=None, dxw=None, lam=None, dlam=None)[source]¶
Bases:
object
Data1D is a place holder for 1D plottables.
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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 '¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- _xaxis = ''¶
- _xunit = ''¶
- _yaxis = ''¶
- _yunit = ''¶
- dlam = None¶
- dx = None¶
- dxl = None¶
- dxw = None¶
- dy = None¶
- lam = None¶
- x = None¶
- y = None¶
- class sas.sascalc.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)[source]¶
Bases:
object
Data2D is a place holder for 2D plottables.
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.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)[source]¶
- __module__ = 'sas.sascalc.dataloader.data_info'¶
- __weakref__¶
list of weak references to the object (if defined)
- _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¶
- xmax = None¶
- xmin = None¶
- y_bins = None¶
- ymax = None¶
- ymin = None¶
sas.sascalc.dataloader.file_reader_base_class module¶
This is the base file reader class most file readers should inherit from. All generic functionality required for a file loader/reader is built into this class
- class sas.sascalc.dataloader.file_reader_base_class.FileReader[source]¶
Bases:
object
- _ZERO = 1e-16¶
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.file_reader_base_class', 'type_name': 'ASCII', 'type': ['Text files (*.txt|*.TXT)'], 'ext': ['.txt'], 'deprecated_extensions': ['.asc'], 'allow_all': False, 'has_converter': True, '_ZERO': 1e-16, '__init__': <function FileReader.__init__>, 'read': <function FileReader.read>, 'reset_state': <function FileReader.reset_state>, 'nextline': <function FileReader.nextline>, 'nextlines': <function FileReader.nextlines>, 'readall': <function FileReader.readall>, 'handle_error_message': <function FileReader.handle_error_message>, 'send_to_output': <function FileReader.send_to_output>, 'sort_data': <function FileReader.sort_data>, '_reorder_1d_array': <staticmethod object>, '_remove_nans_in_data': <staticmethod object>, 'set_default_1d_units': <staticmethod object>, 'set_default_2d_units': <staticmethod object>, 'convert_data_units': <function FileReader.convert_data_units>, 'format_unit': <function FileReader.format_unit>, 'set_all_to_none': <function FileReader.set_all_to_none>, 'data_cleanup': <function FileReader.data_cleanup>, 'remove_empty_q_values': <function FileReader.remove_empty_q_values>, 'reset_data_list': <function FileReader.reset_data_list>, 'splitline': <staticmethod object>, 'get_file_contents': <function FileReader.get_file_contents>, '__dict__': <attribute '__dict__' of 'FileReader' objects>, '__weakref__': <attribute '__weakref__' of 'FileReader' objects>, '__doc__': None, '__annotations__': {}})¶
- __doc__ = None¶
- __module__ = 'sas.sascalc.dataloader.file_reader_base_class'¶
- __weakref__¶
list of weak references to the object (if defined)
- static _remove_nans_in_data(data)[source]¶
Remove data points where nan is loaded :param data: 1D or 2D data object :return: data with nan points removed
- static _reorder_1d_array(array, ind)[source]¶
Reorders a 1D array based on the indices passed as ind :param array: Array to be reordered :param ind: Indices used to reorder array :return: reordered array
- allow_all = False¶
- convert_data_units(default_q_unit='1/A')[source]¶
Converts al; data to the sasview default of units of A^{-1} for Q and cm^{-1} for I. :param default_q_unit: The default Q unit used by Sasview
- deprecated_extensions = ['.asc']¶
- ext = ['.txt']¶
- abstract get_file_contents()[source]¶
Reader specific class to access the contents of the file All reader classes that inherit from FileReader must implement
- handle_error_message(msg)[source]¶
Generic error handler to add an error to the current datainfo to propagate the error up the error chain. :param msg: Error message
- has_converter = True¶
- read(filepath)[source]¶
Basic file reader
- Parameters:
filepath – The full or relative path to a file to be loaded
- reset_state()[source]¶
Resets the class state to a base case when loading a new data file so previous data files do not appear a second time
- send_to_output()[source]¶
Helper that automatically combines the info and set and then appends it to output
- static set_default_1d_units(data)[source]¶
Set the x and y axes to the default 1D units :param data: 1D data set :return:
- static set_default_2d_units(data)[source]¶
Set the x and y axes to the default 2D units :param data: 2D data set :return:
- static splitline(line)[source]¶
Splits a line into pieces based on common delimiters :param line: A single line of text :return: list of values
- type = ['Text files (*.txt|*.TXT)']¶
- type_name = 'ASCII'¶
sas.sascalc.dataloader.loader module¶
File handler to support different file extensions. Uses reflectometer registry utility. The default readers are found in the ‘readers’ sub-module and registered by default at initialization time. To add a new default reader, one must register it in the register_readers method found in readers/__init__.py. A utility method (find_plugins) is available to inspect a directory (for instance, a user plug-in directory) and look for new readers/writers.
- class sas.sascalc.dataloader.loader.Loader[source]¶
Bases:
object
Utility class to use the Registry as a singleton.
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.loader', '__doc__': '\n Utility class to use the Registry as a singleton.\n ', '_Loader__registry': <sas.sascalc.dataloader.loader.Registry object>, 'associate_file_type': <function Loader.associate_file_type>, 'associate_file_reader': <function Loader.associate_file_reader>, 'load': <function Loader.load>, 'save': <function Loader.save>, '_get_registry_creation_time': <function Loader._get_registry_creation_time>, 'find_plugins': <function Loader.find_plugins>, 'get_wildcards': <function Loader.get_wildcards>, '__dict__': <attribute '__dict__' of 'Loader' objects>, '__weakref__': <attribute '__weakref__' of 'Loader' objects>, '__annotations__': {}})¶
- __doc__ = '\n Utility class to use the Registry as a singleton.\n '¶
- __module__ = 'sas.sascalc.dataloader.loader'¶
- __registry = <sas.sascalc.dataloader.loader.Registry object>¶
- __weakref__¶
list of weak references to the object (if defined)
- _get_registry_creation_time()[source]¶
Internal method used to test the uniqueness of the registry object
- associate_file_reader(ext, loader)[source]¶
Append a reader object to readers :param ext: file extension [string] :param module: reader object
- associate_file_type(ext, module)[source]¶
Look into a module to find whether it contains a Reader class. If so, append it to readers and (potentially) to the list of writers for the given extension :param ext: file extension [string] :param module: module object
- find_plugins(directory)[source]¶
Find plugins in a given directory :param dir: directory to look into to find new readers/writers
- class sas.sascalc.dataloader.loader.Registry[source]¶
Bases:
ExtensionRegistry
Registry class for file format extensions. Readers and writers are supported.
- __doc__ = '\n Registry class for file format extensions.\n Readers and writers are supported.\n '¶
- __module__ = 'sas.sascalc.dataloader.loader'¶
- _identify_plugin(module)[source]¶
Look into a module to find whether it contains a Reader class. If so, add it to readers and (potentially) to the list of writers. :param module: module object
- associate_file_reader(ext, loader)[source]¶
Append a reader object to readers :param ext: file extension [string] :param module: reader object
- associate_file_type(ext, module)[source]¶
Look into a module to find whether it contains a Reader class. If so, APPEND it to readers and (potentially) to the list of writers for the given extension :param ext: file extension [string] :param module: module object
- find_plugins(dir)[source]¶
Find readers in a given directory. This method can be used to inspect user plug-in directories to find new readers/writers. :param dir: directory to search into :return: number of readers found
- load(path, format=None, debug=False, use_defaults=True)[source]¶
Call the loader for the file type of path.
- Parameters:
path – file path
format – explicit extension, to force the use of a particular reader
debug – when True, print the traceback for each loader that fails
use_defaults – Flag to use the default readers as a backup if the main reader fails or no reader exists
Defaults to the ascii (multi-column), cansas XML, and cansas NeXuS readers if no reader was registered for the file’s extension.
- load_using_generic_loaders(path)[source]¶
If the expected reader cannot load the file or no known loader exists, attempt to load the file using a few defaults readers :param path: file path :return: List of Data1D and Data2D objects
sas.sascalc.dataloader.loader_exceptions module¶
Exceptions specific to loading data.
- exception sas.sascalc.dataloader.loader_exceptions.DataReaderException(e=None)[source]¶
Bases:
Exception
Exception for files that were able to mostly load, but had minor issues along the way. Any exceptions of this type should be put into the datainfo.errors
- __doc__ = '\n Exception for files that were able to mostly load, but had minor issues\n along the way.\n Any exceptions of this type should be put into the datainfo.errors\n '¶
- __module__ = 'sas.sascalc.dataloader.loader_exceptions'¶
- __weakref__¶
list of weak references to the object (if defined)
- exception sas.sascalc.dataloader.loader_exceptions.DefaultReaderException(e=None)[source]¶
Bases:
Exception
Exception for files with no associated reader. This should be thrown by default readers only to tell Loader to try the next reader.
- __doc__ = '\n Exception for files with no associated reader. This should be thrown by\n default readers only to tell Loader to try the next reader.\n '¶
- __module__ = 'sas.sascalc.dataloader.loader_exceptions'¶
- __weakref__¶
list of weak references to the object (if defined)
- exception sas.sascalc.dataloader.loader_exceptions.FileContentsException(e=None)[source]¶
Bases:
Exception
Exception for files with an associated reader, but with no loadable data. This is useful for catching loader or file format issues.
- __doc__ = '\n Exception for files with an associated reader, but with no loadable data.\n This is useful for catching loader or file format issues.\n '¶
- __module__ = 'sas.sascalc.dataloader.loader_exceptions'¶
- __weakref__¶
list of weak references to the object (if defined)
- exception sas.sascalc.dataloader.loader_exceptions.NoKnownLoaderException(e=None)[source]¶
Bases:
Exception
Exception for files with no associated reader based on the file extension of the loaded file. This exception should only be thrown by loader.py.
- __doc__ = '\n Exception for files with no associated reader based on the file\n extension of the loaded file. This exception should only be thrown by\n loader.py.\n '¶
- __module__ = 'sas.sascalc.dataloader.loader_exceptions'¶
- __weakref__¶
list of weak references to the object (if defined)
sas.sascalc.dataloader.manipulations module¶
- class sas.sascalc.dataloader.manipulations.Binning(min_value, max_value, n_bins, base=None)[source]¶
Bases:
object
This class just creates a binning object either linear or log
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n This class just creates a binning object\n either linear or log\n ', '__init__': <function Binning.__init__>, 'get_bin_index': <function Binning.get_bin_index>, '__dict__': <attribute '__dict__' of 'Binning' objects>, '__weakref__': <attribute '__weakref__' of 'Binning' objects>, '__annotations__': {}})¶
- __doc__ = '\n This class just creates a binning object\n either linear or log\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.Boxavg(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)[source]¶
Bases:
Boxsum
Perform the average of counts in a 2D region of interest.
- __call__(data2D)[source]¶
Perform the sum in the region of interest
- Parameters:
data2D – Data2D object
- Returns:
average counts, error on average counts
- __doc__ = '\n Perform the average of counts in a 2D region of interest.\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- class sas.sascalc.dataloader.manipulations.Boxcut(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)[source]¶
Bases:
object
Find a rectangular 2D region of interest.
- __call__(data2D)[source]¶
Find a rectangular 2D region of interest.
- Parameters:
data2D – Data2D object
- Returns:
mask, 1d array (len = len(data)) with Trues where the data points are inside ROI, otherwise False
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Find a rectangular 2D region of interest.\n ', '__init__': <function Boxcut.__init__>, '__call__': <function Boxcut.__call__>, '_find': <function Boxcut._find>, '__dict__': <attribute '__dict__' of 'Boxcut' objects>, '__weakref__': <attribute '__weakref__' of 'Boxcut' objects>, '__annotations__': {}})¶
- __doc__ = '\n Find a rectangular 2D region of interest.\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.Boxsum(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)[source]¶
Bases:
object
Perform the sum of counts in a 2D region of interest.
- __call__(data2D)[source]¶
Perform the sum in the region of interest
- Parameters:
data2D – Data2D object
- Returns:
number of counts, error on number of counts, number of points summed
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Perform the sum of counts in a 2D region of interest.\n ', '__init__': <function Boxsum.__init__>, '__call__': <function Boxsum.__call__>, '_sum': <function Boxsum._sum>, '__dict__': <attribute '__dict__' of 'Boxsum' objects>, '__weakref__': <attribute '__weakref__' of 'Boxsum' objects>, '__annotations__': {}})¶
- __doc__ = '\n Perform the sum of counts in a 2D region of interest.\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.CircularAverage(r_min=0.0, r_max=0.0, bin_width=0.0005)[source]¶
Bases:
object
Perform circular averaging on 2D data
The data returned is the distribution of counts as a function of Q
- __call__(data2D, ismask=False)[source]¶
Perform circular averaging on the data
- Parameters:
data2D – Data2D object
- Returns:
Data1D object
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Perform circular averaging on 2D data\n\n The data returned is the distribution of counts\n as a function of Q\n ', '__init__': <function CircularAverage.__init__>, '__call__': <function CircularAverage.__call__>, '__dict__': <attribute '__dict__' of 'CircularAverage' objects>, '__weakref__': <attribute '__weakref__' of 'CircularAverage' objects>, '__annotations__': {}})¶
- __doc__ = '\n Perform circular averaging on 2D data\n\n The data returned is the distribution of counts\n as a function of Q\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.Ring(r_min=0, r_max=0, center_x=0, center_y=0, nbins=36)[source]¶
Bases:
object
Defines a ring on a 2D data set. The ring is defined by r_min, r_max, and the position of the center of the ring.
The data returned is the distribution of counts around the ring as a function of phi.
Phi_min and phi_max should be defined between 0 and 2*pi in anti-clockwise starting from the x- axis on the left-hand side
- __call__(data2D)[source]¶
Apply the ring to the data set. Returns the angular distribution for a given q range
- Parameters:
data2D – Data2D object
- Returns:
Data1D object
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Defines a ring on a 2D data set.\n The ring is defined by r_min, r_max, and\n the position of the center of the ring.\n\n The data returned is the distribution of counts\n around the ring as a function of phi.\n\n Phi_min and phi_max should be defined between 0 and 2*pi\n in anti-clockwise starting from the x- axis on the left-hand side\n ', '__init__': <function Ring.__init__>, '__call__': <function Ring.__call__>, '__dict__': <attribute '__dict__' of 'Ring' objects>, '__weakref__': <attribute '__weakref__' of 'Ring' objects>, '__annotations__': {}})¶
- __doc__ = '\n Defines a ring on a 2D data set.\n The ring is defined by r_min, r_max, and\n the position of the center of the ring.\n\n The data returned is the distribution of counts\n around the ring as a function of phi.\n\n Phi_min and phi_max should be defined between 0 and 2*pi\n in anti-clockwise starting from the x- axis on the left-hand side\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.Ringcut(r_min=0, r_max=0, center_x=0, center_y=0)[source]¶
Bases:
object
Defines a ring on a 2D data set. The ring is defined by r_min, r_max, and the position of the center of the ring.
The data returned is the region inside the ring
Phi_min and phi_max should be defined between 0 and 2*pi in anti-clockwise starting from the x- axis on the left-hand side
- __call__(data2D)[source]¶
Apply the ring to the data set. Returns the angular distribution for a given q range
- Parameters:
data2D – Data2D object
- Returns:
index array in the range
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Defines a ring on a 2D data set.\n The ring is defined by r_min, r_max, and\n the position of the center of the ring.\n\n The data returned is the region inside the ring\n\n Phi_min and phi_max should be defined between 0 and 2*pi\n in anti-clockwise starting from the x- axis on the left-hand side\n ', '__init__': <function Ringcut.__init__>, '__call__': <function Ringcut.__call__>, '__dict__': <attribute '__dict__' of 'Ringcut' objects>, '__weakref__': <attribute '__weakref__' of 'Ringcut' objects>, '__annotations__': {}})¶
- __doc__ = '\n Defines a ring on a 2D data set.\n The ring is defined by r_min, r_max, and\n the position of the center of the ring.\n\n The data returned is the region inside the ring\n\n Phi_min and phi_max should be defined between 0 and 2*pi\n in anti-clockwise starting from the x- axis on the left-hand side\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.SectorPhi(r_min, r_max, phi_min=0, phi_max=6.283185307179586, nbins=20, base=None)[source]¶
Bases:
_Sector
Sector average as a function of phi. I(phi) is return and the data is averaged over Q.
A sector is defined by r_min, r_max, phi_min, phi_max. The number of bin in phi also has to be defined.
- __call__(data2D)[source]¶
Perform sector average and return I(phi).
- Parameters:
data2D – Data2D object
- Returns:
Data1D object
- __doc__ = '\n Sector average as a function of phi.\n I(phi) is return and the data is averaged over Q.\n\n A sector is defined by r_min, r_max, phi_min, phi_max.\n The number of bin in phi also has to be defined.\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- class sas.sascalc.dataloader.manipulations.SectorQ(r_min, r_max, phi_min=0, phi_max=6.283185307179586, nbins=20, base=None)[source]¶
Bases:
_Sector
Sector average as a function of Q for both symatric wings. I(Q) is return and the data is averaged over phi.
A sector is defined by r_min, r_max, phi_min, phi_max. r_min, r_max, phi_min, phi_max >0. The number of bin in Q also has to be defined.
- __call__(data2D)[source]¶
Perform sector average and return I(Q).
- Parameters:
data2D – Data2D object
- Returns:
Data1D object
- __doc__ = '\n Sector average as a function of Q for both symatric wings.\n I(Q) is return and the data is averaged over phi.\n\n A sector is defined by r_min, r_max, phi_min, phi_max.\n r_min, r_max, phi_min, phi_max >0.\n The number of bin in Q also has to be defined.\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- class sas.sascalc.dataloader.manipulations.Sectorcut(phi_min=0, phi_max=3.141592653589793)[source]¶
Bases:
object
Defines a sector (major + minor) region on a 2D data set. The sector is defined by phi_min, phi_max, where phi_min and phi_max are defined by the right and left lines wrt central line.
Phi_min and phi_max are given in units of radian and (phi_max-phi_min) should not be larger than pi
- __call__(data2D)[source]¶
Find a rectangular 2D region of interest.
- Parameters:
data2D – Data2D object
- Returns:
mask, 1d array (len = len(data))
with Trues where the data points are inside ROI, otherwise False
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Defines a sector (major + minor) region on a 2D data set.\n The sector is defined by phi_min, phi_max,\n where phi_min and phi_max are defined by the right\n and left lines wrt central line.\n\n Phi_min and phi_max are given in units of radian\n and (phi_max-phi_min) should not be larger than pi\n ', '__init__': <function Sectorcut.__init__>, '__call__': <function Sectorcut.__call__>, '_find': <function Sectorcut._find>, '__dict__': <attribute '__dict__' of 'Sectorcut' objects>, '__weakref__': <attribute '__weakref__' of 'Sectorcut' objects>, '__annotations__': {}})¶
- __doc__ = '\n Defines a sector (major + minor) region on a 2D data set.\n The sector is defined by phi_min, phi_max,\n where phi_min and phi_max are defined by the right\n and left lines wrt central line.\n\n Phi_min and phi_max are given in units of radian\n and (phi_max-phi_min) should not be larger than pi\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations.SlabX(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, bin_width=0.001, fold=False)[source]¶
Bases:
_Slab
Compute average I(Qx) for a region of interest
- __call__(data2D)[source]¶
Compute average I(Qx) for a region of interest :param data2D: Data2D object :return: Data1D object
- __doc__ = '\n Compute average I(Qx) for a region of interest\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- class sas.sascalc.dataloader.manipulations.SlabY(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, bin_width=0.001, fold=False)[source]¶
Bases:
_Slab
Compute average I(Qy) for a region of interest
- __call__(data2D)[source]¶
Compute average I(Qy) for a region of interest
- Parameters:
data2D – Data2D object
- Returns:
Data1D object
- __doc__ = '\n Compute average I(Qy) for a region of interest\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- class sas.sascalc.dataloader.manipulations._Sector(r_min, r_max, phi_min=0, phi_max=6.283185307179586, nbins=20, base=None)[source]¶
Bases:
object
Defines a sector region on a 2D data set. The sector is defined by r_min, r_max, phi_min, phi_max, and the position of the center of the ring where phi_min and phi_max are defined by the right and left lines wrt central line and phi_max could be less than phi_min.
Phi is defined between 0 and 2*pi in anti-clockwise starting from the x- axis on the left-hand side
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Defines a sector region on a 2D data set.\n The sector is defined by r_min, r_max, phi_min, phi_max,\n and the position of the center of the ring\n where phi_min and phi_max are defined by the right\n and left lines wrt central line\n and phi_max could be less than phi_min.\n\n Phi is defined between 0 and 2*pi in anti-clockwise\n starting from the x- axis on the left-hand side\n ', '__init__': <function _Sector.__init__>, '_agv': <function _Sector._agv>, '__dict__': <attribute '__dict__' of '_Sector' objects>, '__weakref__': <attribute '__weakref__' of '_Sector' objects>, '__annotations__': {}})¶
- __doc__ = '\n Defines a sector region on a 2D data set.\n The sector is defined by r_min, r_max, phi_min, phi_max,\n and the position of the center of the ring\n where phi_min and phi_max are defined by the right\n and left lines wrt central line\n and phi_max could be less than phi_min.\n\n Phi is defined between 0 and 2*pi in anti-clockwise\n starting from the x- axis on the left-hand side\n '¶
- __init__(r_min, r_max, phi_min=0, phi_max=6.283185307179586, nbins=20, base=None)[source]¶
- Parameters:
base – must be a valid base for an algorithm, i.e.,
a positive number
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.sascalc.dataloader.manipulations._Slab(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, bin_width=0.001, fold=False)[source]¶
Bases:
object
Compute average I(Q) for a region of interest
- __dict__ = mappingproxy({'__module__': 'sas.sascalc.dataloader.manipulations', '__doc__': '\n Compute average I(Q) for a region of interest\n ', '__init__': <function _Slab.__init__>, '__call__': <function _Slab.__call__>, '_avg': <function _Slab._avg>, '__dict__': <attribute '__dict__' of '_Slab' objects>, '__weakref__': <attribute '__weakref__' of '_Slab' objects>, '__annotations__': {}})¶
- __doc__ = '\n Compute average I(Q) for a region of interest\n '¶
- __module__ = 'sas.sascalc.dataloader.manipulations'¶
- __weakref__¶
list of weak references to the object (if defined)
- sas.sascalc.dataloader.manipulations.flip_phi(phi)[source]¶
Correct phi to within the 0 <= to <= 2pi range
- Returns:
phi in >=0 and <=2Pi
- sas.sascalc.dataloader.manipulations.get_dq_data(data2D)[source]¶
Get the dq for resolution averaging The pinholes and det. pix contribution present in both direction of the 2D which must be subtracted when converting to 1D: dq_overlap should calculated ideally at q = 0. Note This method works on only pinhole geometry. Extrapolate dqx(r) and dqy(phi) at q = 0, and take an average.
- sas.sascalc.dataloader.manipulations.get_intercept(q, q_0, q_1)[source]¶
Returns the fraction of the side at which the q-value intercept the pixel, None otherwise. The values returned is the fraction ON THE SIDE OF THE LOWEST Q.
A B +-----------+--------+ <--- pixel size 0 1 Q_0 -------- Q ----- Q_1 <--- equivalent Q range if Q_1 > Q_0, A is returned if Q_1 < Q_0, B is returned if Q is outside the range of [Q_0, Q_1], None is returned
- sas.sascalc.dataloader.manipulations.get_pixel_fraction(qmax, q_00, q_01, q_10, q_11)[source]¶
Returns the fraction of the pixel defined by the four corners (q_00, q_01, q_10, q_11) that has q < qmax.:
q_01 q_11 y=1 +--------------+ | | | | | | y=0 +--------------+ q_00 q_10 x=0 x=1
- sas.sascalc.dataloader.manipulations.get_pixel_fraction_square(x, xmin, xmax)[source]¶
Return the fraction of the length from xmin to x.:
A B +-----------+---------+ xmin x xmax
- Parameters:
x – x-value
xmin – minimum x for the length considered
xmax – minimum x for the length considered
- Returns:
(x-xmin)/(xmax-xmin) when xmin < x < xmax
- sas.sascalc.dataloader.manipulations.get_q(dx, dy, det_dist, wavelength)[source]¶
- Parameters:
dx – x-distance from beam center [mm]
dy – y-distance from beam center [mm]
- Returns:
q-value at the given position