ATK.Models.DataSet#
- class ATK.Models.DataSet[source]#
Bases:
objectAttributes
If
True, no data containers are being stored.If
True, something unexpected occurred during data retrieval.Kind of data container that is being stored.
Targets for which data is stored.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
DataSetfor a given target.merge(dataset[, inplace])Merges this
DataSetwith another.open([path])Opens the figure from the
figureattribute in the default browser.plot(**kwargs)Plots all stored data containers in a grid.
save(path, **kwargs)Saves the figure from the
figureattribute to local files.show([show_types, show_all])Prints structure to stdout in a human-readable format.
split(targets[, radius, inplace])Generates a
DataSetwhich only contains data from specified targets.store(path)Saves
DataSetto a local FITS file.Attribute Descriptions
- empty#
If
True, no data containers are being stored.
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
DataSetis empty).
- 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
kindof 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 currentDataSetinplace. IfFalse, 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:
SelfDataSetwith modified data containers. Returnsselfifinplace=True, otherwise returns a new instance.
- classmethod from_target(target: Target | int | SkyCoord) Self[source]#
Initialises an empty
DataSetfor a given target.
- merge(dataset: DataSet, inplace: bool = True) DataSet[source]#
Merges this
DataSetwith another.- Parameters:
- Returns:
SelfThe merged
DataSet. Returnsselfifinplace=True, otherwise returns a new instance.
- open(path: Path | str | None = None, **kwargs) Self[source]#
Opens the figure from the
figureattribute in the default browser.If a figure has not yet been generated when
ATK.Models.DataSet.open()is called, one will be generated withplot().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_figuresdirectory.- **kwargs
If a plot needs to be generated (see above), additional keyword arguments are passed to
plot().Accepted keyword arguments depend on the
kindof 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
figureattribute.- Parameters:
- **kwargs
Accepted keyword arguments depend on the
kindof 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
figureattribute to local files.If a figure has not yet been generated when
ATK.Models.DataSet.open()is called, one will be generated withplot().- 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
kindof 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
DataSetwhich 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 toDataSetTargets (this form of matching is not exact).Only relevant if one ore more input
targetsis aSkyCoord.- inplacebool, optional
If
True, modify the currentDataSetinplace. IfFalse, operate on and return a copy - leaving the original unchanged.
- Returns:
SelfThe split
DataSet. Returnsselfifinplace=True, otherwise returns a new instance.