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

components

A list of ComponentID giving all available components in the data

coordinate_components

A list of ComponentID giving all coordinate components in the data

data

derived_components

label

The name of the dataset

main_components

pixel_component_ids

A list of ComponentID giving all pixel coordinate components in the data

subsets

Tuple of subsets attached to this dataset.

world_component_ids

A list of ComponentID giving all world coordinate components in the data

Methods Summary

add_subset(subset[, label])

Assign a pre-existing subset to this data object.

broadcast(attribute)

Send a DataUpdateMessage to the hub

find_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

data[source]#
derived_components[source]#
label[source]#

The name of the dataset

main_components[source]#
pixel_component_ids[source]#

A list of ComponentID giving all pixel coordinate components in the data

subsets[source]#

Tuple of subsets attached to this dataset.

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:
subsetSubset or SubsetState

The subset to be assigned. If this is a ~glue.core.subset.SubsetState, it will be wrapped in a new Subset automatically

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:
cidComponentID

The component ID to get the data kind for

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:
subsetSubset or SubsetState, optional

Reference subset or subset state. If provided, the new subset will copy the logic of this 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)[source]#

Connect to a hub.

This method usually doesn’t have to be called directly, as DataCollections manage the registration of data objects