Data Points

class sacc.data_types.DataPoint(data_type, tracers, value, ignore_missing_tags=False, **tags)[source]

A class for a single data point (one scalar value).

Data points have a type, zero or more tracers, a value, and any arbitrary tags that are stored in a dictionary, and can be used to describe angular scales, window functions, or any arbitrary information to be attached to the data.

Data points can be automatically created and added to a Sacc object, so you don’t normally nee to manually create them.

Attributes:
data_type: str

A string, indicating the type of data point

tracers: tuple

Tuple of strings with the names of tracers to use

value: float

Mean value of this statistics

tags: dict

Dictionary of further data point metadata, such as binning info, angles, etc.

Methods

from_table(table[, lookups]) Convert a table back into a list of data points.
get_tag(self, tag[, default]) Get the value of the the named tag, or None if not found.
to_table(data[, lookups]) Convert a list of data points to a single homogenous table
classmethod from_table(table, lookups={})[source]

Convert a table back into a list of data points.

This method removes null values from the tags.

Parameters:
table: astropy.table.Table

A table of data containing the tracers, values, and tags

lookups: dict

A dictionary of tags->dict showing replacements to make in the tags. Default is empty.

Returns:
data: list

list of DataPoint objects

get_tag(self, tag, default=None)[source]

Get the value of the the named tag, or None if not found.

Parameters:
tag: str

Tag to find on the data point

default: any

Value to return if the tag is not found

Returns:
value: any

Value of the tag in this data point

classmethod to_table(data, lookups={})[source]

Convert a list of data points to a single homogenous table

Since data points can have varying tags, this method uses null values to represent non-present tags.

Parameters:
data: list

A list of DataPoint objects

lookups: dict

A dictionary of tags->dict showing replacements to make in the tags. Default is empty.

Returns:
table: astropy.table.Table

table object containing data points