ATK.Models.DataSet#

class ATK.Models.DataSet[source]#

Bases: object



Attributes

empty

If True, no data containers are being stored.

exception

If True, something unexpected occurred during data retrieval.

figure

Bokeh figure, generated by plot() or open().

kind

Kind of data container that is being stored.

targets

Targets for which data is stored.

data

Stored data as a list of containers.

Methods

add(data)

Adds a data container to a DataSet.

apply(method, *args[, inplace])

Applies a data method to all stored containers.

from_target(target)

Initialises an empty DataSet for a given target.

merge(dataset[, inplace])

Merges this DataSet with another.

open([path])

Opens the figure from the figure attribute in the default browser.

plot(**kwargs)

Plots all stored data containers in a grid.

save(path, **kwargs)

Saves the figure from the figure attribute to local files.

show([show_types, show_all])

Prints structure to stdout in a human-readable format.

split(targets[, radius, inplace])

Generates a DataSet which only contains data from specified targets.

store(path)

Saves DataSet to a local FITS file.



Attribute Descriptions

empty#

If True, no data containers are being stored.

exception: bool | None = False#

If True, something unexpected occurred during data retrieval.

figure: figure | None = None#

Bokeh figure, generated by plot() or open().

kind: str | None = None#

Kind of data container that is being stored.

targets: list[Target] | None#

Targets for which data is stored.

data: list#

Stored data as a list of containers.


Method Descriptions

add(data: Container) Self[source]#

Adds a data container to a DataSet.

The container must be of the same type as the currently stored data (unless the DataSet is empty).

Parameters:
data: :class:`~ATK.base.Container`

Container to append to the DataSet

Returns:
Self

DataSet with an additional data container.

apply(method: str, *args, inplace=True, **kwargs) Self[source]#

Applies a data method to all stored containers.

The set of available data methods depends on the kind of data that is stored. See the documentation of the stored data container for more information.

Parameters:
method: str

Name of data method that should be applied.

inplacebool, optional

If True, modify the current DataSet inplace. If False, operate on and return a copy - leaving the original unchanged.

**kwargs

Accepted keyword arguments depend on the chosen data method. See the documentation of the data method for more information.

Returns:
Self

DataSet with modified data containers. Returns self if inplace=True, otherwise returns a new instance.

classmethod from_target(target: Target | int | SkyCoord) Self[source]#

Initialises an empty DataSet for a given target.

Parameters:
target: Target, int or :class:`~astropy.coordinates.SkyCoord`

Target for which a DataSet should be initialised.

Returns:
Self

DataSet with data = [].

merge(dataset: DataSet, inplace: bool = True) DataSet[source]#

Merges this DataSet with another.

Parameters:
dataset: :class:`~ATK.Models.DataSet`

The DataSet to be merged into this one.

Both DataSets must store the same kind of data.

inplacebool, optional

If True, modify the current DataSet inplace. If False, operate on and return a copy - leaving the original unchanged.

Returns:
Self

The merged DataSet. Returns self if inplace=True, otherwise returns a new instance.

open(path: Path | str | None = None, **kwargs) Self[source]#

Opens the figure from the figure attribute in the default browser.

If a figure has not yet been generated when ATK.Models.DataSet.open() is called, one will be generated with plot().

Optionally, the figure can also be saved to local files.

Parameters:
path: Path | str, optional

Path to which the figure should be saved.

If not provided, figures are saved to the ~/.AstroToolkit/cached_figures directory.

**kwargs

If a plot needs to be generated (see above), additional keyword arguments are passed to plot().

Accepted keyword arguments depend on the kind of data being plotted. See the documentation of the data container that is being plotted for more information.

Returns:
self
plot(**kwargs) Self[source]#

Plots all stored data containers in a grid.

The resulting figure is stored in the figure attribute.

Parameters:
**kwargs

Accepted keyword arguments depend on the kind of data being plotted.

See the documentation of the data container that is being plotted for more information.

Returns:
self
save(path: Path | str, **kwargs) Self[source]#

Saves the figure from the figure attribute to local files.

If a figure has not yet been generated when ATK.Models.DataSet.open() is called, one will be generated with plot().

Parameters:
path: Path | str, optional

Path to which the figure should be saved.

**kwargs

If a plot needs to be generated (see above), additional keyword arguments are passed to plot().

Accepted keyword arguments depend on the kind of data being plotted. See the documentation of the data container that is being plotted for more information.

Returns:
self
show(show_types=False, show_all=False)[source]#

Prints structure to stdout in a human-readable format.

Parameters:
show_typesbool, optional

If True, print data types of structure attributes.

Default is False

show_allbool, optional

If True, do not truncate printing of large iterables.

Default is False.

Returns:
self
split(targets: int | SkyCoord | Target | list[int | SkyCoord | Target], radius: Quantity | float = 3 * u.arcsec, inplace: bool = True) DataSet[source]#

Generates a DataSet which only contains data from specified targets.

Parameters:
targets: int, :class:`~astropy.coordinates.SkyCoord`, :class:`~ATK.Models.Target`, or iterable of these

Targets that should be included in the returned DataSet.

radius: :class:`~astropy.units.Quantity`, optional

Sets the radius that is used when matching input SkyCoords to DataSet Targets (this form of matching is not exact).

Only relevant if one ore more input targets is a SkyCoord.

inplacebool, optional

If True, modify the current DataSet inplace. If False, operate on and return a copy - leaving the original unchanged.

Returns:
Self

The split DataSet. Returns self if inplace=True, otherwise returns a new instance.

store(path: Path | str) Self[source]#

Saves DataSet to a local FITS file.

Parameters:
path: Path | str

Path to which local FITS file should be saved.

The resulting local FITS file can be used to recreate the original structure with read().

Returns:
self