BaseData#
- class glue.core.data.BaseData[source]#
Bases:
object
Base class for any glue data object which indicates which methods should be provided at a minimum.
For now, subclasses of BaseData are not guaranteed to work in glue, and you should instead subclass BaseCartesianData.
Attributes Summary
A list of
ComponentID
giving all available components in the dataA list of
ComponentID
giving all coordinate components in the dataThe name of the dataset
A list of
ComponentID
giving all pixel coordinate components in the dataTuple of subsets attached to this dataset.
A list of
ComponentID
giving all world coordinate components in the dataMethods Summary
add_subset
(subset[, label])Assign a pre-existing subset to this data object.
broadcast
(attribute)Send a
DataUpdateMessage
to the hubfind_component_id
(label)Find a component ID by name.
get_kind
(cid)Get the kind of data for a given component.
get_object
([cls])Get the dataset represented as a non-glue object, using the translation infrastructure.
get_selection_definition
([subset_id, format])Get subset state represented as a non-glue object, using the translation infrastructure.
get_subset_object
([subset_id, cls])Get a subset represented as a non-glue object, using the translation infrastructure.
new_subset
([subset])Create a new subset, and attach to self.
register_to_hub
(hub)Connect to a hub.
Attributes Documentation
- components[source]#
A list of
ComponentID
giving all available components in the data
- coordinate_components[source]#
A list of
ComponentID
giving all coordinate components in the data
- pixel_component_ids[source]#
A list of
ComponentID
giving all pixel coordinate components in the data
- world_component_ids[source]#
A list of
ComponentID
giving all world coordinate components in the data
Methods Documentation
- add_subset(subset, label=None)[source]#
Assign a pre-existing subset to this data object.
- Parameters:
- subset
Subset
orSubsetState
The subset to be assigned. If this is a ~glue.core.subset.SubsetState, it will be wrapped in a new Subset automatically
- subset
Notes
The preferred way for creating subsets is via
new_subset_group()
. Manually-instantiated subsets will not be represented properly by the UI.
- broadcast(attribute)[source]#
Send a
DataUpdateMessage
to the hub- Parameters:
- attributestr
Name of an attribute that has changed (or None).
- find_component_id(label)[source]#
Find a component ID by name.
This returns the associated ComponentID if label is found and unique, and None otherwise.
- abstract get_kind(cid)[source]#
Get the kind of data for a given component.
- Parameters:
- cid
ComponentID
The component ID to get the data kind for
- cid
- Returns:
- kind{‘numerical’, ‘categorical’, ‘datetime’}
The kind of data for the given component ID.
- get_object(cls=None, **kwargs)[source]#
Get the dataset represented as a non-glue object, using the translation infrastructure.
- Parameters:
- clstype, optional
The class to use for representing the data object. If a non-glue data object was added to the glue data collection, it should automatically be returned using the same class as it was provided in, and this argument shouldn’t be needed.
- get_selection_definition(subset_id=None, format=None, **kwargs)[source]#
Get subset state represented as a non-glue object, using the translation infrastructure.
- Parameters:
- subset_idstr or int, optional
The name or index of the subset to retrieve.
- formatstr, optional
The format to translate the subset state to.
- get_subset_object(subset_id=None, cls=None, **kwargs)[source]#
Get a subset represented as a non-glue object, using the translation infrastructure.
- Parameters:
- subset_idstr or int, optional
The name or index of the subset to retrieve.
- clstype, optional
The class to use for representing the data object. If a non-glue data object was added to the data collection, the subset should automatically be returned using the same class as it was provided in, and this argument shouldn’t be needed.
- new_subset(subset=None, **kwargs)[source]#
Create a new subset, and attach to self.
- Parameters:
- subset
Subset
orSubsetState
, optional Reference subset or subset state. If provided, the new subset will copy the logic of this subset.
- subset
- Returns:
- The new subset object
Notes
The preferred way for creating subsets is via
new_subset_group()
. Manually-instantiated subsets will not be represented properly by the UI.