smif.convert.register module¶
Register, ResolutionSet abstract classes to contain metadata and generate conversion coefficients.
NDimensionalRegister is used in smif.convert.interval.IntervalAdaptor
and
smif.convert.region.RegionAdaptor
.
Summary¶
Data:
LogMixin |
|
NDimensionalRegister |
Abstract class which holds N-Dimensional ResolutionSets |
Register |
Abstract class which holds the ResolutionSets |
ResolutionSet |
Abstract class which holds the Resolution definitions |
Reference¶
-
class
smif.convert.register.
ResolutionSet
[source]¶ Bases:
object
Abstract class which holds the Resolution definitions
-
get_entry_names
()[source]¶ Get the names of the entries in the ResolutionSet
Returns: The set of names which identify each entry in the ResolutionSet Return type: set
-
get_proportion
(entry_a, entry_b)[source]¶ Calculate the proportion of entry_a and entry_b
Parameters: - entry_a (string) – Name of an entry in ResolutionSet
- entry_b (string) – Name of an entry in ResolutionSet
Returns: The proportion of entry_a and entry_b
Return type:
-
coverage
¶
-
-
class
smif.convert.register.
Register
(axis=None)[source]¶ Bases:
smif.convert.register.LogMixin
Abstract class which holds the ResolutionSets
Parameters: axis (int, default=None) – The axis over which operations on the data array are performed -
store
= None¶
-
names
¶
-
convert
(data: <MagicMock id='139764765201024'>, from_set_name: str, to_set_name: str) → <MagicMock id='139764765241696'>[source]¶ Convert a list of data points for a given set to another set
Parameters: - data (numpy.ndarray) –
- from_set_name (str) –
- to_set_name (str) –
Returns: Return type:
-
static
convert_with_coefficients
(data, coefficients: <MagicMock id='139764765257680'>, axis=None) → <MagicMock id='139764765302400'>[source]¶ Convert an array of data using given coefficients, along a given axis
Parameters: - data (numpy.ndarray) –
- coefficients (numpy.ndarray) –
- axis (integer, optional) –
Returns: Return type:
-
-
class
smif.convert.register.
NDimensionalRegister
(axis=None)[source]¶ Bases:
smif.convert.register.Register
Abstract class which holds N-Dimensional ResolutionSets
Parameters: axis (int, default=None) – The axis over which operations on the data array are performed -
register
(resolution_set: smif.convert.register.ResolutionSet)[source]¶ Add a ResolutionSet to the register
Parameters: resolution_set ( smif.convert.ResolutionSet
) –Raises: ValueError
– If a ResolutionSet of the same name already exists in the register
-
get_entry
(name: str) → smif.convert.register.ResolutionSet[source]¶ Returns the ResolutionSet of name
Parameters: name (str) – The unique identifier of a ResolutionSet in the register Returns: Return type: smif.convert.ResolutionSet
-
get_coefficients
(source: str, destination: str) → <MagicMock id='139764765346928'>[source]¶ Get coefficients representing intersection of sets
Parameters: - source (string) – The name of the source set
- destination (string) – The name of the destination set
Returns: Return type:
-
generate_coefficients
(from_set: smif.convert.register.ResolutionSet, to_set: smif.convert.register.ResolutionSet) → <MagicMock id='139764765358880'>[source]¶ Generate coefficients for converting between two :class:`ResolutionSet`s
Coefficients for converting a single dimension will always be 2D, of shape (len(from_set), len(to_set)).
Parameters: - from_set (ResolutionSet) –
- to_set (ResolutionSet) –
Returns: Return type:
-