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.
- Parameters:
- 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
(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=None)[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(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=None)[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
- sacc.data_types.build_data_type_name(sources, properties, statistic, subtype=None)[source]¶
- Parameters:
- sources: str or list[str]
type(s) of astrophysical sources to which this applies
- properties: str or list[str]
feature(s)/characterisic(s) of those sources/fields to which the statistic applies
- statistic_type: str
mathematical type of the statistic
- statistic_subtype: str or None
optional additional specifier. Default is None
- Returns:
- name: str
- Type name of the form:
{sources}_{properties}_{statistic_type}[_{statistic_subtype}]
- sacc.data_types.parse_data_type_name(name)[source]¶
Parse a verbose data type name into its component parts Verbose data type names take the form: {sources}_{properties}_{statistic_type}[_{statistic_subtype}] where sources and properties are camel-case if there is more than one of them
- Parameters:
- name: str
A data type name
- Returns:
- sources: list[str]
type(s) of astrophysical sources to which this applies
- properties: list[str]
feature(s)/characterisic(s) of those sources/fields to which the statistic applies
- statistic_type: str
mathematical type of the statistic
- statistic_subtype: str or None
optional additional specifier
- class sacc.data_types.parsedDataTypeName(sources, properties, statistic, subtype)¶
- Attributes:
- properties
Alias for field number 1
- sources
Alias for field number 0
- statistic
Alias for field number 2
- subtype
Alias for field number 3
Methods
count
(value, /)Return number of occurrences of value.
index
(value[, start, stop])Return first index of value.
- properties¶
Alias for field number 1
- sources¶
Alias for field number 0
- statistic¶
Alias for field number 2
- subtype¶
Alias for field number 3