Class Mapping
- Known Subclasses:
-
XafsFluorescenceMapping
,
XafsMapping
,
XafsTransmissionMapping
Mapping objects are used to remap the column names of xdp.Data objects.
They allow user-specific column names to be abstracted from
application-specific ones and subsequently simplify software which must
support arbitrary column names.
Mapping objects are applied to xdp.Data objects using Python's
function-call operator. In other words, call the mapping object as though
it were a function which takes one argument, an xdp.Data object.
Example:
RemapXafsTransmission = Mapping(Energy='Energy', Io='mcs3', It='mcs4')
transData = RemapXafsTransmission(userData)
Mapping may be inherited in order to provide application-specific mappings.
When an inherited mapping is applied to an xdp.Data object, any methods
the child class define which have names in the form of 'make_<COLUMN>' will
be be called to generate the vector for the column '<COLUMN>'. Such
methods may return None, in order to supress the addition of the column.
See XafsTransmissionMapping for an example.
Method Summary |
|
__init__ (self,
**kwds)
Create a new mapping from the keyword arguments. |
|
__call__ (self,
data)
Apply this mapping to the xdp.Data object 'data'. |
|
finish (self,
data)
Virtual method which is called to finalize the xdp.Data object 'data'
before it is returned. |
__init__(self,
**kwds)
(Constructor)
Create a new mapping from the keyword arguments.
The keyword arguments contain all of the mapping this object will
perform, in the form destination=source.
-
|
__call__(self,
data)
(Call operator)
Apply this mapping to the xdp.Data object 'data'.
An xdp.ColumnNameError exception is raised if any of the source
column names are invalid.
-
|
finish(self,
data)
Virtual method which is called to finalize the xdp.Data object
'data' before it is returned.
-
|