sas.sascalc.dataloader.readers package
Submodules
sas.sascalc.dataloader.readers.abs_reader module
IGOR 1D data reader
-
class
sas.sascalc.dataloader.readers.abs_reader.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Class to load IGOR reduced .ABS files
-
ext
= ['.abs', '.cor']
-
get_file_contents
()[source] Get the contents of the file
Raises: - RuntimeError – when the file can’t be opened
- ValueError – when the length of the data vectors are inconsistent
-
type
= ['IGOR 1D files (*.abs)|*.abs', 'IGOR 1D USANS files (*.cor)|*.cor']
-
type_name
= 'IGOR 1D'
-
sas.sascalc.dataloader.readers.anton_paar_saxs_reader module
CanSAS 2D data reader for reading HDF5 formatted CanSAS files.
-
class
sas.sascalc.dataloader.readers.anton_paar_saxs_reader.
Reader
(xml=None, schema=None)[source] Bases:
sas.sascalc.dataloader.readers.xml_reader.XMLreader
A class for reading in Anton Paar .pdh files
-
allow_all
= False
-
errors
= None
-
ext
= ['.pdh', '.PDH']
-
get_file_contents
()[source] This is the general read method that all SasView data_loaders must have.
Parameters: filename – A path for an XML formatted Anton Paar SAXSess data file. Returns: List of Data1D objects or a list of errors.
-
logging
= None
-
parent_list
= None
-
raw_data
= None
-
read_data
()[source]
-
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
-
type
= ['Anton Paar SAXSess Files (*.pdh)|*.pdh']
-
type_name
= 'Anton Paar SAXSess'
-
sas.sascalc.dataloader.readers.ascii_reader module
Generic multi-column ASCII data reader
-
class
sas.sascalc.dataloader.readers.ascii_reader.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Class to load ascii files (2, 3 or 4 columns).
-
allow_all
= True
-
ext
= ['.txt', '.dat', '.abs', '.csv']
-
get_file_contents
()[source] Get the contents of the file
-
min_data_pts
= 5
-
type
= ['ASCII files (*.txt)|*.txt', 'ASCII files (*.dat)|*.dat', 'ASCII files (*.abs)|*.abs', 'CSV files (*.csv)|*.csv']
-
type_name
= 'ASCII'
-
sas.sascalc.dataloader.readers.associations module
Module to associate default readers to file extensions. The module reads an xml file to get the readers for each file extension. The readers are tried in order they appear when reading a file.
-
sas.sascalc.dataloader.readers.associations.
get_generic_readers
(settings={'.h5': 'cansas_reader_HDF5', '.txt': 'ascii_reader', '.xml': 'cansas_reader'})[source] Find and load the default loaders used by the program :param settings: path to the json settings file [string] :return: list of default loaders every file can potentially try to use
-
sas.sascalc.dataloader.readers.associations.
read_associations
(loader, settings={'.abs': 'abs_reader', '.cor': 'abs_reader', '.dat': 'red2d_reader', '.h5': 'cansas_reader_HDF5', '.hdf': 'cansas_reader_HDF5', '.nxs': 'cansas_reader_HDF5', '.pdh': 'anton_paar_saxs_reader', '.sans': 'danse_reader', '.ses': 'sesans_reader', '.txt': 'ascii_reader', '.xml': 'cansas_reader'})[source] Read the specified settings file to associate default readers to file extension. :param loader: Loader object :param settings: path to the json settings file [string]
sas.sascalc.dataloader.readers.cansas_constants module
Information relating to the CanSAS data format. These constants are used in the cansas_reader.py file to read in any version of the cansas format.
-
class
sas.sascalc.dataloader.readers.cansas_constants.
CansasConstants
[source] Bases:
object
The base class to define where all of the data is to be saved by cansas_reader.py.
-
ANY
= {'storeas': 'content'}
-
CANSAS_FORMAT
= {'SASentry': {'attributes': {'name': {}}, 'children': {'<any>': {'storeas': 'content'}, 'Run': {'attributes': {'name': {}}}, 'SASdata': {'attributes': {'name': {}}, 'children': {'<any>': {'storeas': 'content'}, 'Idata': {'attributes': {'name': {}, 'timestamp': {'storeas': 'timestamp'}}, 'children': {'<any>': {'storeas': 'content'}, 'I': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Idev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Q': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qmean': {'attributes': {'unit': {}}, 'unit': 'x_unit'}, 'Shadowfactor': {}, 'dQl': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'dQw': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}}}, 'Sesans': {'storeas': 'content'}, 'yacceptance': {'storeas': 'float'}, 'zacceptance': {'storeas': 'float'}}, 'variable': None}, 'SASinstrument': {'children': {'SAScollimation': {'attributes': {'name': {}}, 'children': {'aperture': {'attributes': {'name': {}, 'type': {}}, 'children': {'distance': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'size': {'attributes': {'unit': {}}, 'children': {'storeas': 'float', 'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}}}}}, 'length': {'attributes': {'storeas': 'content', 'unit': {}}, 'storeas': 'float', 'unit': 'length_unit'}}}, 'SASdetector': {'attributes': {'name': {'storeas': 'content'}}, 'children': {'SDD': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'beam_center': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}}}, 'name': {'storeas': 'content'}, 'offset': {'children': {'x': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'y': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'z': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}}}, 'orientation': {'children': {'pitch': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}}}, 'pixel_size': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}}}, 'slit_length': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'slit_length_unit'}}}, 'SASsource': {'attributes': {'name': {}}, 'children': {'beam_shape': {}, 'beam_size': {'attributes': {'name': {}}, 'children': {'x': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'y': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'z': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}}}, 'radiation': {}, 'wavelength': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'wavelength_max': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_max_unit'}, 'wavelength_min': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_min_unit'}, 'wavelength_spread': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_spread_unit'}}}, 'name': {}}}, 'SASnote': {}, 'SASprocess': {'children': {'<any>': {'storeas': 'content'}, 'SASprocessnote': {'children': {'<any>': {'storeas': 'content'}}}, 'date': {}, 'description': {}, 'name': {}, 'term': {'attributes': {'name': {}, 'unit': {}}}}}, 'SASsample': {'attributes': {'name': {}}, 'children': {'<any>': {'storeas': 'content'}, 'ID': {}, 'details': {}, 'orientation': {'children': {'pitch': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}}}, 'position': {'children': {'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}}}, 'temperature': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'temperature_unit'}, 'thickness': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'thickness_unit'}, 'transmission': {'storeas': 'float'}}}, 'SAStransmission_spectrum': {'attributes': {'name': {}, 'timestamp': {}}, 'children': {'<any>': {'storeas': 'content'}, 'Tdata': {'children': {'<any>': {'storeas': 'content'}, 'Lambda': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'T': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_unit'}, 'Tdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_deviation_unit'}}}}}, 'Title': {}}, 'storeas': 'content', 'units_optional': True}}
-
CANSAS_NS
= {'1.0': {'ns': 'cansas1d/1.0', 'schema': 'cansas1d_v1_0.xsd'}, '1.1': {'ns': 'urn:cansas1d:1.1', 'schema': 'cansas1d_v1_1.xsd'}}
-
RUN
= {'attributes': {'name': {}}}
-
SASDATA
= {'attributes': {'name': {}}, 'children': {'<any>': {'storeas': 'content'}, 'Idata': {'attributes': {'name': {}, 'timestamp': {'storeas': 'timestamp'}}, 'children': {'<any>': {'storeas': 'content'}, 'I': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Idev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Q': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qmean': {'attributes': {'unit': {}}, 'unit': 'x_unit'}, 'Shadowfactor': {}, 'dQl': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'dQw': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}}}, 'Sesans': {'storeas': 'content'}, 'yacceptance': {'storeas': 'float'}, 'zacceptance': {'storeas': 'float'}}, 'variable': None}
-
SASDATA_IDATA
= {'attributes': {'name': {}, 'timestamp': {'storeas': 'timestamp'}}, 'children': {'<any>': {'storeas': 'content'}, 'I': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Idev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}, 'Q': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'Qmean': {'attributes': {'unit': {}}, 'unit': 'x_unit'}, 'Shadowfactor': {}, 'dQl': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}, 'dQw': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}}}
-
SASDATA_IDATA_DQL
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}
-
SASDATA_IDATA_DQW
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}
-
SASDATA_IDATA_I
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}
-
SASDATA_IDATA_IDEV
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'y_unit', 'units_optional': False}
-
SASDATA_IDATA_Q
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}
-
SASDATA_IDATA_QDEV
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'x_unit', 'units_optional': False}
-
SASDATA_IDATA_QMEAN
= {'attributes': {'unit': {}}, 'unit': 'x_unit'}
-
SASDATA_IDATA_SHADOWFACTOR
= {}
-
SASINSTR
= {'children': {'SAScollimation': {'attributes': {'name': {}}, 'children': {'aperture': {'attributes': {'name': {}, 'type': {}}, 'children': {'distance': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'size': {'attributes': {'unit': {}}, 'children': {'storeas': 'float', 'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}}}}}, 'length': {'attributes': {'storeas': 'content', 'unit': {}}, 'storeas': 'float', 'unit': 'length_unit'}}}, 'SASdetector': {'attributes': {'name': {'storeas': 'content'}}, 'children': {'SDD': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'beam_center': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}}}, 'name': {'storeas': 'content'}, 'offset': {'children': {'x': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'y': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'z': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}}}, 'orientation': {'children': {'pitch': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}}}, 'pixel_size': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}}}, 'slit_length': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'slit_length_unit'}}}, 'SASsource': {'attributes': {'name': {}}, 'children': {'beam_shape': {}, 'beam_size': {'attributes': {'name': {}}, 'children': {'x': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'y': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'z': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}}}, 'radiation': {}, 'wavelength': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'wavelength_max': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_max_unit'}, 'wavelength_min': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_min_unit'}, 'wavelength_spread': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_spread_unit'}}}, 'name': {}}}
-
SASINSTR_COLL
= {'attributes': {'name': {}}, 'children': {'aperture': {'attributes': {'name': {}, 'type': {}}, 'children': {'distance': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'size': {'attributes': {'unit': {}}, 'children': {'storeas': 'float', 'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}}}}}, 'length': {'attributes': {'storeas': 'content', 'unit': {}}, 'storeas': 'float', 'unit': 'length_unit'}}}
-
SASINSTR_COLL_APER
= {'attributes': {'name': {}, 'type': {}}, 'children': {'distance': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'size': {'attributes': {'unit': {}}, 'children': {'storeas': 'float', 'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}}}}}
-
SASINSTR_COLL_APER_ATTR
= {'unit': {}}
-
SASINSTR_COLL_APER_DIST
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}
-
SASINSTR_COLL_APER_SIZE
= {'attributes': {'unit': {}}, 'children': {'storeas': 'float', 'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}}}
-
SASINSTR_COLL_APER_X
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}
-
SASINSTR_COLL_APER_Y
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}
-
SASINSTR_COLL_APER_Z
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'size_unit'}
-
SASINSTR_DET
= {'attributes': {'name': {'storeas': 'content'}}, 'children': {'SDD': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}, 'beam_center': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}}}, 'name': {'storeas': 'content'}, 'offset': {'children': {'x': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'y': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'z': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}}}, 'orientation': {'children': {'pitch': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}}}, 'pixel_size': {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}}}, 'slit_length': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'slit_length_unit'}}}
-
SASINSTR_DET_BC
= {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}}}
-
SASINSTR_DET_BC_X
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}
-
SASINSTR_DET_BC_Y
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}
-
SASINSTR_DET_BC_Z
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'beam_center_unit'}
-
SASINSTR_DET_OFF
= {'children': {'x': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'y': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}, 'z': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}}}
-
SASINSTR_DET_OFF_ATTR
= {'unit': {'storeas': 'content'}}
-
SASINSTR_DET_OFF_X
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}
-
SASINSTR_DET_OFF_Y
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}
-
SASINSTR_DET_OFF_Z
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'offset_unit'}
-
SASINSTR_DET_OR
= {'children': {'pitch': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}}}
-
SASINSTR_DET_OR_ATTR
= {}
-
SASINSTR_DET_OR_PITCH
= {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASINSTR_DET_OR_ROLL
= {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASINSTR_DET_OR_YAW
= {'attributes': {}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASINSTR_DET_PIXEL
= {'children': {'x': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'y': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}, 'z': {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}}}
-
SASINSTR_DET_PIXEL_X
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}
-
SASINSTR_DET_PIXEL_Y
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}
-
SASINSTR_DET_PIXEL_Z
= {'attributes': {'storeas': 'content'}, 'storeas': 'float', 'unit': 'pixel_size_unit'}
-
SASINSTR_DET_SDD
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'distance_unit'}
-
SASINSTR_DET_SLIT
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'slit_length_unit'}
-
SASINSTR_SRC
= {'attributes': {'name': {}}, 'children': {'beam_shape': {}, 'beam_size': {'attributes': {'name': {}}, 'children': {'x': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'y': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'z': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}}}, 'radiation': {}, 'wavelength': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'wavelength_max': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_max_unit'}, 'wavelength_min': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_min_unit'}, 'wavelength_spread': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_spread_unit'}}}
-
SASINSTR_SRC_BEAMSIZE
= {'attributes': {'name': {}}, 'children': {'x': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'y': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}, 'z': {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}}}
-
SASINSTR_SRC_BEAMSIZE_ATTR
= {'unit': ''}
-
SASINSTR_SRC_BEAMSIZE_X
= {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}
-
SASINSTR_SRC_BEAMSIZE_Y
= {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}
-
SASINSTR_SRC_BEAMSIZE_Z
= {'attributes': {'unit': ''}, 'storeas': 'float', 'unit': 'beam_size_unit'}
-
SASINSTR_SRC_WL
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'wavelength_unit'}
-
SASINSTR_SRC_WL_MAX
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_max_unit'}
-
SASINSTR_SRC_WL_MIN
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_min_unit'}
-
SASINSTR_SRC_WL_SPR
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_spread_unit'}
-
SASNOTE
= {}
-
SASPROCESS
= {'children': {'<any>': {'storeas': 'content'}, 'SASprocessnote': {'children': {'<any>': {'storeas': 'content'}}}, 'date': {}, 'description': {}, 'name': {}, 'term': {'attributes': {'name': {}, 'unit': {}}}}}
-
SASPROCESS_SASPROCESSNOTE
= {'children': {'<any>': {'storeas': 'content'}}}
-
SASPROCESS_TERM
= {'attributes': {'name': {}, 'unit': {}}}
-
SASSAMPLE
= {'attributes': {'name': {}}, 'children': {'<any>': {'storeas': 'content'}, 'ID': {}, 'details': {}, 'orientation': {'children': {'pitch': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}}}, 'position': {'children': {'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}}}, 'temperature': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'temperature_unit'}, 'thickness': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'thickness_unit'}, 'transmission': {'storeas': 'float'}}}
-
SASSAMPLE_ORIENT
= {'children': {'pitch': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'roll': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}, 'yaw': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}}}
-
SASSAMPLE_ORIENT_ATTR
= {'unit': {}}
-
SASSAMPLE_ORIENT_PITCH
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASSAMPLE_ORIENT_ROLL
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASSAMPLE_ORIENT_YAW
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'orientation_unit'}
-
SASSAMPLE_POS
= {'children': {'x': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'y': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}, 'z': {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}}}
-
SASSAMPLE_POS_ATTR
= {'unit': {}}
-
SASSAMPLE_POS_X
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}
-
SASSAMPLE_POS_Y
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}
-
SASSAMPLE_POS_Z
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'position_unit'}
-
SASSAMPLE_TEMP
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'temperature_unit'}
-
SASSAMPLE_THICK
= {'attributes': {'unit': {}}, 'storeas': 'float', 'unit': 'thickness_unit'}
-
SASSAMPLE_TRANS
= {'storeas': 'float'}
-
SASTRANSSPEC
= {'attributes': {'name': {}, 'timestamp': {}}, 'children': {'<any>': {'storeas': 'content'}, 'Tdata': {'children': {'<any>': {'storeas': 'content'}, 'Lambda': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'T': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_unit'}, 'Tdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_deviation_unit'}}}}}
-
SASTRANSSPEC_TDATA
= {'children': {'<any>': {'storeas': 'content'}, 'Lambda': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_unit'}, 'T': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_unit'}, 'Tdev': {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_deviation_unit'}}}
-
SASTRANSSPEC_TDATA_LAMDBA
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'wavelength_unit'}
-
SASTRANSSPEC_TDATA_T
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_unit'}
-
SASTRANSSPEC_TDATA_TDEV
= {'attributes': {'unit': {'storeas': 'content'}}, 'storeas': 'float', 'unit': 'transmission_deviation_unit'}
-
TITLE
= {}
-
format
= ''
-
get_namespace_map
()[source] Helper method to get the names namespace list
-
iterate_namespace
(namespace)[source] Method to iterate through a cansas constants tree based on a list of names
Parameters: namespace – A list of names that match the tree structure of cansas_constants
-
names
= ''
-
-
class
sas.sascalc.dataloader.readers.cansas_constants.
CurrentLevel
[source] Bases:
object
A helper class to hold information on where you are in the constants tree
-
current_level
= ''
-
get_current_level
()[source] Helper method to get the current_level map
-
get_data_type
()[source] Helper method to get the ns_datatype label
-
get_variable
()[source] Helper method to get the ns_variable label
-
ns_datatype
= ''
-
ns_optional
= True
-
sas.sascalc.dataloader.readers.cansas_reader module
-
class
sas.sascalc.dataloader.readers.cansas_reader.
Reader
(xml=None, schema=None)[source] Bases:
sas.sascalc.dataloader.readers.xml_reader.XMLreader
-
allow_all
= True
-
base_ns
= '{cansas1d/1.1}'
-
cansas_defaults
= None
-
cansas_version
= '1.1'
-
current_data1d
= None
-
data
= None
-
errors
= {}
-
ext
= ['.xml', '.svs']
-
frm
= ''
-
get_file_contents
()[source] Reader specific class to access the contents of the file All reader classes that inherit from FileReader must implement
-
invalid
= True
-
is_cansas
(ext='xml')[source] Checks to see if the XML file is a CanSAS file
Parameters: ext – The file extension of the data file Raises: FileContentsException – Raised if XML file isn’t valid CanSAS
-
load_file_and_schema
(xml_file, schema_path='')[source]
-
logging
= None
-
names
= None
-
ns_list
= None
-
process_1d_data_object
(tagname, data_point, unit, attr)[source] Assign a 1D data variable to the appropriate plottable value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :param attr: Extra attributes :return: None
-
process_2d_data_object
(tagname, data_point, unit)[source] Assign a 2D data variable to the appropriate plottable value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
process_collimation_data_object
(tagname, data_point, unit)[source] Assign a collimation variable to the appropriate Collimation value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
process_detector_data_object
(tagname, data_point, unit)[source] Assign a detector variable to the appropriate Detector value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
process_meta_data
(tagname, data_point)[source] Any unrecognized tag should still be loaded - add to meta_data :param tagname: Name of the XML tag :param data_point: Data to be assigned :return: None
-
process_process_data_object
(tagname, data_point, attr)[source] Assign a process variable to the appropriate Process value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param attr: XML attributes :return: None
-
process_sample_data_object
(tagname, data_point, unit)[source] Assign a sample data variable to the appropriate Sample value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
process_source_data_object
(tagname, data_point, unit)[source] Assign a source variable to the appropriate Source value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
process_trans_spec_data_object
(tagname, data_point, unit)[source] Assign a transmission spectrum data variable to the appropriate datainfo value :param tagname: Name of the XML tag :param data_point: Data to be assigned :param unit: Unit of the data_point :return: None
-
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
-
set_default_schema
()[source]
-
type
= ['XML files (*.xml)|*.xml', 'SasView Save Files (*.svs)|*.svs']
-
type_name
= 'canSAS'
-
write
(filename, datainfo)[source] Write the content of a Data1D as a CanSAS XML file
Parameters: - filename – name of the file to write
- datainfo – Data1D object
-
write_node
(parent, name, value, attr=None)[source] Parameters: - doc – document DOM
- parent – parent node
- name – tag of the element
- value – value of the child text node
- attr – attribute dictionary
Returns: True if something was appended, otherwise False
-
-
sas.sascalc.dataloader.readers.cansas_reader.
get_content
(location, node)[source] Get the first instance of the content of a xpath location.
Parameters: - location – xpath location
- node – node to start at
Returns: Element, or None
-
sas.sascalc.dataloader.readers.cansas_reader.
getattrchain
(obj, chain, default=None)[source] Like getattr, but the attr may contain multiple parts separated by ‘.’
-
sas.sascalc.dataloader.readers.cansas_reader.
setattrchain
(obj, chain, value)[source] Like setattr, but the attr may contain multiple parts separated by ‘.’
-
sas.sascalc.dataloader.readers.cansas_reader.
write_node
(doc, parent, name, value, attr=None)[source] Parameters: - doc – document DOM
- parent – parent node
- name – tag of the element
- value – value of the child text node
- attr – attribute dictionary
Returns: True if something was appended, otherwise False
sas.sascalc.dataloader.readers.cansas_reader_HDF5 module
NXcanSAS data reader for reading HDF5 formatted CanSAS files.
-
class
sas.sascalc.dataloader.readers.cansas_reader_HDF5.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
A class for reading in NXcanSAS data files. The current implementation has been tested to load data generated by multiple facilities, all of which are known to produce NXcanSAS standards compliant data. Any number of data sets may be present within the file and any dimensionality of data may be used. Currently 1D and 2D SAS data sets are supported, but should be immediately extensible to SESANS data.
Any number of SASdata groups may be present in a SASentry and the data within each SASdata group can be a single 1D I(Q), multi-framed 1D I(Q), 2D I(Qx, Qy) or multi-framed 2D I(Qx, Qy).
Dependencies: The NXcanSAS HDF5 reader requires h5py => v2.5.0 or later. -
add_data_set
(key='')[source] Adds the current_dataset to the list of outputs after preforming final processing on the data and then calls a private method to generate a new data set.
Parameters: key – NeXus group name for current tree level
-
add_intermediate
()[source] This method stores any intermediate objects within the final data set after fully reading the set.
Parameters: parent – The NXclass name for the h5py Group object that just finished being processed
-
allow_all
= True
-
static
as_list_or_array
(iterable)[source] Return value as a list if not already a list or array. :param iterable: :return:
-
cansas_version
= 2.0
-
ext
= ['.h5', '.H5']
-
final_data_cleanup
()[source] Does some final cleanup and formatting on self.current_datainfo and all data1D and data2D objects and then combines the data and info into Data1D and Data2D objects
-
get_file_contents
()[source] This is the general read method that all SasView data_loaders must have.
Parameters: filename – A path for an HDF5 formatted CanSAS 2D data file. Returns: List of Data1D/2D objects and/or a list of errors.
-
process_1d_data_object
(data_set, key, unit)[source] SASdata processor method for 1d data items :param data_set: data from HDF5 file :param key: canSAS_class attribute :param unit: unit attribute
-
process_2d_data_object
(data_set, key, unit)[source]
-
process_aperture
(data_point, key)[source] SASaperture processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from
-
process_collimation
(data_point, key, unit)[source] SAScollimation processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from :param unit: unit attribute from data set
-
process_detector
(data_point, key, unit)[source] SASdetector processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from :param unit: unit attribute from data set
-
process_process
(data_point, key)[source] SASprocess processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from
-
process_sample
(data_point, key)[source] SASsample processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from
-
process_source
(data_point, key, unit)[source] SASsource processor :param data_point: Single point from an HDF5 data file :param key: class name data_point was taken from :param unit: unit attribute from data set
-
process_trans_spectrum
(data_set, key)[source] SAStransmission_spectrum processor :param data_set: data from HDF5 file :param key: canSAS_class attribute
-
read_children
(data, parent_list)[source] A recursive method for stepping through the hierarchical data file.
Parameters: - data – h5py Group object of any kind
- parent – h5py Group parent name
-
reset_state
()[source] Create the reader object and define initial states for class variables
-
type
= ['NXcanSAS HDF5 Files (*.h5)|*.h5|']
-
type_name
= 'NXcanSAS'
-
-
sas.sascalc.dataloader.readers.cansas_reader_HDF5.
h5attr
(node, key, default=None)[source]
sas.sascalc.dataloader.readers.danse_reader module
DANSE/SANS file reader
-
class
sas.sascalc.dataloader.readers.danse_reader.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Example data manipulation
-
ext
= ['.sans', '.SANS']
-
get_file_contents
()[source] Reader specific class to access the contents of the file All reader classes that inherit from FileReader must implement
-
type
= ['DANSE files (*.sans)|*.sans']
-
type_name
= 'DANSE'
-
sas.sascalc.dataloader.readers.red2d_reader module
TXT/IGOR 2D Q Map file reader
-
class
sas.sascalc.dataloader.readers.red2d_reader.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Simple data reader for Igor data files
-
ext
= ['.DAT', '.dat']
-
get_file_contents
()[source] Reader specific class to access the contents of the file All reader classes that inherit from FileReader must implement
-
type
= ['IGOR/DAT 2D file in Q_map (*.dat)|*.DAT']
-
type_name
= 'IGOR/DAT 2D Q_map'
-
write
(filename, data)[source] Write to .dat
Parameters: - filename – file name to write
- data – data2D
-
-
sas.sascalc.dataloader.readers.red2d_reader.
check_point
(x_point)[source] check point validity
sas.sascalc.dataloader.readers.sesans_reader module
SESANS reader (based on ASCII reader)
Reader for .ses or .sesans file format
Jurrian Bakker
-
class
sas.sascalc.dataloader.readers.sesans_reader.
Reader
[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Class to load sesans files (6 columns).
-
allow_all
= True
-
ext
= ['.ses', '.SES', '.sesans', '.SESANS']
-
get_file_contents
()[source] Reader specific class to access the contents of the file All reader classes that inherit from FileReader must implement
-
type
= ['SESANS files (*.ses)|*.ses', 'SESANS files (*..sesans)|*.sesans']
-
type_name
= 'SESANS'
-
sas.sascalc.dataloader.readers.tiff_reader module
Image reader. Untested.
-
class
sas.sascalc.dataloader.readers.tiff_reader.
Reader
[source] Bases:
object
Example data manipulation
-
ext
= ['.tif', '.tiff']
-
read
(filename=None)[source] Open and read the data in a file
Parameters: file – path of the file
-
type
= ['TIF files (*.tif)|*.tif', 'TIFF files (*.tiff)|*.tiff']
-
type_name
= 'TIF'
-
sas.sascalc.dataloader.readers.xml_reader module
Generic XML read and write utility
Usage: Either extend xml_reader or add as a class variable.
-
class
sas.sascalc.dataloader.readers.xml_reader.
XMLreader
(xml=None, schema=None)[source] Bases:
sas.sascalc.dataloader.file_reader_base_class.FileReader
Generic XML read and write class. Mostly helper functions. Makes reading/writing XML a bit easier than calling lxml libraries directly.
Dependencies: This class requires lxml 2.3 or higher. -
append
(element, tree)[source] Append an etree Element to an ElementTree.
Parameters: - element – etree Element to append
- tree – ElementTree object to append to
-
break_processing_instructions
(string, dic)[source] Method to break a processing instruction string apart and add to a dict
Parameters: - string – A processing instruction as a string
- dic – The dictionary to save the PIs to
-
create_element
(name, attrib=None, nsmap=None)[source] Create an XML element for writing to file
Parameters: name – The name of the element to be created
-
create_element_from_string
(xml_string)[source] Create an element from an XML string
Parameters: xml_string – A string of xml
-
create_tree
(root)[source] Create an element tree for processing from an etree element
Parameters: root – etree Element(s)
-
ebuilder
(parent, elementname, text=None, attrib=None)[source] Use lxml E builder class with arbitrary inputs.
Parameters: - parnet – The parent element to append a child to
- elementname – The name of the child in string form
- text – The element text
- attrib – A dictionary of attribute names to attribute values
-
encoding
= None
-
find_invalid_xml
()[source] Finds the first offending element that should not be present in XML file
-
parse_schema_and_doc
()[source] Creates a dictionary of the parsed schema and xml files.
-
processing_instructions
= None
-
reader
()[source] Read in an XML file into memory and return an lxml dictionary
-
return_processing_instructions
()[source] Get all processing instructions saved when loading the document
Parameters: tree – etree.ElementTree object to write PIs to
-
schema
= None
-
schemadoc
= None
-
set_encoding
(attr_str)[source] Find the encoding in the xml declaration and save it as a string
Parameters: attr_str – All attributes as a string e.g. “foo1=”bar1” foo2=”bar2” foo3=”bar3” … foo_n=”bar_n”“
-
set_processing_instructions
()[source] Take out all processing instructions and create a dictionary from them If there is a default encoding, the value is also saved
-
set_schema
(schema)[source] Set the schema file and parse
-
set_xml_file
(xml)[source] Set the XML file and parse
-
set_xml_string
(tag_soup)[source] Set an XML string as the working XML.
Parameters: tag_soup – XML formatted string
-
to_string
(elem, pretty_print=False, encoding=None)[source] Converts an etree element into a string
-
validate_xml
()[source] Checks to see if the XML file meets the schema
-
write_attribute
(elem, attr_name, attr_value)[source] Write attributes to an Element
Parameters: - elem – etree.Element object
- attr_name – attribute name to write
- attr_value – attribute value to set
-
write_text
(elem, text)[source] Write text to an etree Element
Parameters: - elem – etree.Element object
- text – text to write to the element
-
xml
= None
-
xmldoc
= None
-
xmlroot
= None
-