BaseData#
- class glue.core.data.BaseData#
Bases:
objectBase 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
ComponentIDgiving all available components in the dataA list of
ComponentIDgiving all coordinate components in the dataThe name of the dataset
A list of
ComponentIDgiving all pixel coordinate components in the dataTuple of subsets attached to this dataset.
A list of
ComponentIDgiving 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
DataUpdateMessageto 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#
A list of
ComponentIDgiving all available components in the data
- coordinate_components#
A list of
ComponentIDgiving all coordinate components in the data
- data#
- derived_components#
- label#
The name of the dataset
- main_components#
- pixel_component_ids#
A list of
ComponentIDgiving all pixel coordinate components in the data
- subsets#
Tuple of subsets attached to this dataset.
- world_component_ids#
A list of
ComponentIDgiving all world coordinate components in the data
Methods Documentation
- add_subset(subset, label=None)#
Assign a pre-existing subset to this data object.
- Parameters:
- subset
SubsetorSubsetState 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)#
Send a
DataUpdateMessageto the hub- Parameters:
- attributestr
Name of an attribute that has changed (or None).
- find_component_id(label)#
Find a component ID by name.
This returns the associated ComponentID if label is found and unique, and None otherwise.
- abstract get_kind(cid)#
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)#
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)#
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)#
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)#
Create a new subset, and attach to self.
- Parameters:
- subset
SubsetorSubsetState, 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.
- register_to_hub(hub)#
Connect to a hub.
This method usually doesn’t have to be called directly, as DataCollections manage the registration of data objects