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(self, subset)

Assign a pre-existing subset to this data object.

broadcast(self, attribute)

Send a DataUpdateMessage to the hub

find_component_id(self, label)

Find a component ID by name.

get_kind(self, cid)

Get the kind of data for a given component.

new_subset(self[, subset, color, label])

Create a new subset, and attach to self.

register_to_hub(self, hub)

Connect to a hub.

Attributes Documentation

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 Documentation

add_subset(self, subset)[source]

Assign a pre-existing subset to this data object.

Parameters

subset – A Subset or SubsetState object

If input is a SubsetState, it will be wrapped in a new Subset automatically

Note

The preferred way for creating subsets is via new_subset_group(). Manually-instantiated subsets will not be represented properly by the UI

broadcast(self, attribute)[source]

Send a DataUpdateMessage to the hub

Parameters

attribute (str) – Name of an attribute that has changed (or None)

find_component_id(self, label)[source]

Find a component ID by name.

This returns the associated ComponentID if label is found and unique, and None otherwise.

get_kind(self, 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.

new_subset(self, subset=None, color=None, label=None, **kwargs)[source]

Create a new subset, and attach to self.

Note

The preferred way for creating subsets is via new_subset_group(). Manually-instantiated subsets will not be represented properly by the UI

Parameters

subset – optional, reference subset or subset state. If provided, the new subset will copy the logic of this subset.

Returns

The new subset object

register_to_hub(self, hub)[source]

Connect to a hub.

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