Tracers

class sacc.tracers.BaseTracer(name, **kwargs)[source]

A class representing some kind of tracer of astronomical objects.

Generically, SACC data points correspond to some combination of tracers for example, tomographic two-point data has two tracers for each data point, indicating the n(z) for the corresponding tomographic bin.

All Tracer objects have at least a name attribute. Different subclassses have other requirements. For example, n(z) tracers require z and n(z) arrays.

In general you don’t need to create tracer objects yourself - the Sacc.add_tracer method will construct them for you.

Methods

from_tables(table_list)

Convert a list of astropy tables into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of tracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert a list of astropy tables into a dictionary of tracers

This is used when loading data from a file.

This class method takes a list of tracers, such as those read from a file, and converts them into a list of instances.

It is not quite the inverse of the to_tables method, since it returns a dict instead of a list.

Subclasses overrides of this method do the actual work, but should NOT call this parent base method.

Parameters:
table_list: list

List of astropy tables

Returns:
tracers: dict

Dict mapping string names to tracer objects.

classmethod make(tracer_type, name, *args, **kwargs)[source]

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

Parameters:
tracer_type: str

Must correspond to the tracer_type of a subclass

name: str

The name for this specific tracer.

Returns:
instance: Tracer object

An instance of a Tracer subclass

classmethod to_tables(instance_list)[source]

Convert a list of tracers to a list of astropy tables

This is used when saving data to a file.

This class method converts a list of tracers, each of which can instances of any subclass of BaseTracer, and turns them into a list of astropy tables, ready to be saved to disk.

Some tracers generate a single table for all of the different instances, and others generate one table per instance.

Parameters:
instance_list: list

List of tracer instances

Returns:
tables: list

List of astropy tables

class sacc.tracers.BinLogMTracer(name: str, lower: float, upper: float, **kwargs)[source]

A tracer for a single log-mass bin. The tracer shall be used for binned data where we want a desired quantity per interval of log(mass), such that we only need the data for a given interval instead of at individual masses.

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of BinLogMTracers to a single astropy table

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. One tracer object is created for each “row” in each table.

Parameters:

table_list – List of astropy tables

Returns:

Dictionary of tracers

classmethod to_tables(instance_list)[source]

Convert a list of BinLogMTracers to a single astropy table

This is used when saving data to a file. One table is generated with the information for all the tracers.

Parameters:

instance_list – List of tracer instances

Returns:

List with a single astropy table

class sacc.tracers.BinRadiusTracer(name: str, lower: float, upper: float, center: float, **kwargs)[source]

A tracer for a single radial bin, e.g. when dealing with cluster shear profiles. It gives the bin edges and the value of the bin “center”. The latter would typically be returned by CLMM and correspond to the average radius of the galaxies in that radial bin.

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of BinRadiusTracers to a single astropy table

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. One tracer object is created for each “row” in each table.

Parameters:

table_list – List of astropy tables

Returns:

Dictionary of tracers

classmethod to_tables(instance_list)[source]

Convert a list of BinRadiusTracers to a single astropy table

This is used when saving data to a file. One table is generated with the information for all the tracers.

Parameters:

instance_list – List of tracer instances

Returns:

List with a single astropy table

class sacc.tracers.BinRichnessTracer(name: str, lower: float, upper: float, **kwargs)[source]

A tracer for a single richness bin. The tracer shall be used for binned data where we want a desired quantity per interval of log(richness), such that we only need the data for a given interval instead of at individual richness.

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of BinZTracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. One tracer object is created for each “row” in each table.

Parameters:

table_list – List of astropy tables

Returns:

Dictionary of tracers

classmethod to_tables(instance_list)[source]

Convert a list of BinZTracers to a list of astropy tables

This is used when saving data to a file. One table is generated with the information for all the tracers.

Parameters:

instance_list – List of tracer instances

Returns:

List with a single astropy table

class sacc.tracers.BinZTracer(name: str, lower: float, upper: float, **kwargs)[source]

A tracer for a single redshift bin. The tracer shall be used for binned data where we want a desired quantity per interval of redshift, such that we only need the data for a given interval instead of at individual redshifts.

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of BinZTracers to a single astropy table

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. One tracer object is created for each “row” in each table.

Parameters:

table_list – List of astropy tables

Returns:

Dictionary of tracers

classmethod to_tables(instance_list)[source]

Convert a list of BinZTracers to a single astropy table

This is used when saving data to a file. One table is generated with the information for all the tracers.

Parameters:

instance_list – List of tracer instances

Returns:

List with a single astropy table

class sacc.tracers.MapTracer(name, spin, ell, beam, beam_extra=None, map_unit='none', **kwargs)[source]

A Tracer type for a sky map.

Takes at least two arguments, defining the map beam.

Parameters:
name: str

The name for this specific tracer object.

ell: array

Array of multipole values at which the beam is defined.

beam: array

Beam multipoles at each value of ell.

beam_extra: array

Other beam-related arrays (e.g. uncertainties, principal components, alternative measurements, whatever).

map_unit: str

Map units (e.g. ‘uK_CMB’). ‘none’ by default.

Methods

from_tables(table_list)

Convert a list of astropy tables into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of tracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert a list of astropy tables into a dictionary of tracers

This is used when loading data from a file.

This class method takes a list of tracers, such as those read from a file, and converts them into a list of instances.

It is not quite the inverse of the to_tables method, since it returns a dict instead of a list.

Subclasses overrides of this method do the actual work, but should NOT call this parent base method.

Parameters:
table_list: list

List of astropy tables

Returns:
tracers: dict

Dict mapping string names to tracer objects.

classmethod to_tables(instance_list)[source]

Convert a list of tracers to a list of astropy tables

This is used when saving data to a file.

This class method converts a list of tracers, each of which can instances of any subclass of BaseTracer, and turns them into a list of astropy tables, ready to be saved to disk.

Some tracers generate a single table for all of the different instances, and others generate one table per instance.

Parameters:
instance_list: list

List of tracer instances

Returns:
tables: list

List of astropy tables

class sacc.tracers.MiscTracer(name, **kwargs)[source]

A Tracer type for miscellaneous other data points.

MiscTracers do not have any attributes except for their name, so can be used for tagging external data, for example.

Parameters:
name: str

The name of the tracer

Methods

from_tables(table_list)

Convert a list of astropy table into a dictionary of MiscTracer instances.

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of MiscTracer instances to a astropy tables.

classmethod from_tables(table_list)[source]

Convert a list of astropy table into a dictionary of MiscTracer instances.

In general table_list should have a single element in, since all the MiscTracers are stored in a single table during to_tables

Parameters:
table_list: List[astropy.table.Table]
Returns:
tracers: Dict[str: MiscTracer]
classmethod to_tables(instance_list)[source]

Convert a list of MiscTracer instances to a astropy tables.

This is used when saving data to file.

All the instances are converted to a single table, which is returned in a list with one element so that it can be used in combination with the parent.

You can use the parent class to_tables class method to convert a mixed list of different tracer types.

You shouldn’t generally need to call this method directly.

Parameters:
instance_list: list

list of MiscTracer objects

Returns:
tables: list

List containing one astropy table

class sacc.tracers.NZTracer(name, z, nz, extra_columns=None, **kwargs)[source]

A Tracer type for tomographic n(z) data.

Takes two arguments arrays of z and n(z)

Parameters:
name: str

The name for this specific tracer, e.g. a tomographic bin identifier.

z: array

Redshift sample values

nz: array

Number density n(z) at redshift sample points.

extra_columns: dict[str: array] or dict[int: array]

Additional estimates of the same n(z), by name

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of NZTracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. A single tracer object is read from the table.

Parameters:
table_list: list[astropy.table.Table]

Must contain the appropriate data, for example as saved by to_table.

Returns:
tracers: dict

Dict mapping string names to tracer objects. Only contains one key/value pair for the one tracer.

classmethod to_tables(instance_list)[source]

Convert a list of NZTracers to a list of astropy tables

This is used when saving data to a file. One table is generated per tracer.

Parameters:
instance_list: list

List of tracer instances

Returns:
tables: list

List of astropy tables

class sacc.tracers.NuMapTracer(name, spin, nu, bandpass, ell, beam, bandpass_extra=None, beam_extra=None, nu_unit='GHz', map_unit='none', **kwargs)[source]

A Tracer type for a sky map at a given frequency.

Takes at least four arguments, defining the bandpass and beam.

Parameters:
name: str

The name for this specific tracer, e.g. a frequency band identifier.

spin: int

Spin for this observable. Either 0 (e.g. intensity) or 2 (e.g. polarization).

nu: array

Array of frequencies.

bandpass: array

Bandpass transmission.

bandpass_extra: array

Other bandpass-related arrays (e.g. uncertainties, principal components, alternative measurements, whatever).

ell: array

Array of multipole values at which the beam is defined.

beam: array

Beam.

beam_extra: array

Other beam-related arrays (e.g. uncertainties, principal components, alternative measurements, whatever).

nu_unit: str

Frequency units (‘GHz’ by default).

map_unit: str

Map units (e.g. ‘uK_CMB’). ‘none’ by default.

Methods

from_tables(table_list)

Convert a list of astropy tables into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of tracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert a list of astropy tables into a dictionary of tracers

This is used when loading data from a file.

This class method takes a list of tracers, such as those read from a file, and converts them into a list of instances.

It is not quite the inverse of the to_tables method, since it returns a dict instead of a list.

Subclasses overrides of this method do the actual work, but should NOT call this parent base method.

Parameters:
table_list: list

List of astropy tables

Returns:
tracers: dict

Dict mapping string names to tracer objects.

classmethod to_tables(instance_list)[source]

Convert a list of tracers to a list of astropy tables

This is used when saving data to a file.

This class method converts a list of tracers, each of which can instances of any subclass of BaseTracer, and turns them into a list of astropy tables, ready to be saved to disk.

Some tracers generate a single table for all of the different instances, and others generate one table per instance.

Parameters:
instance_list: list

List of tracer instances

Returns:
tables: list

List of astropy tables

class sacc.tracers.QPNZTracer(name, ens, **kwargs)[source]

A Tracer type for tomographic n(z) data preresented as a qp.Ensemble

Takes a qp.Ensemble

Parameters:
name: str

The name for this specific tracer, e.g. a tomographic bin identifier.

ensemble: qp.Ensemble

The qp.ensemble in questions

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of NZTracers to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. A single tracer object is read from the table.

Parameters:
table_list: list[astropy.table.Table]

Must contain the appropriate data, for example as saved by to_table.

Returns:
tracers: dict

Dict mapping string names to tracer objects. Only contains one key/value pair for the one tracer.

classmethod to_tables(instance_list)[source]

Convert a list of NZTracers to a list of astropy tables

This is used when saving data to a file. Two or three tables are generated per tracer.

Parameters:
instance_list: list

List of tracer instances

Returns:
tables: list

List of astropy tables

class sacc.tracers.SurveyTracer(name: str, sky_area: float, **kwargs)[source]

A tracer for the survey definition. It shall be used to filter data related to a given survey and to provide the survey sky-area of analysis.

Methods

from_tables(table_list)

Convert an astropy table into a dictionary of tracers

make(tracer_type, name, *args, **kwargs)

Select a Tracer subclass based on tracer_type and instantiate in instance of it with the remaining arguments.

to_tables(instance_list)

Convert a list of SurveyTracer to a list of astropy tables

classmethod from_tables(table_list)[source]

Convert an astropy table into a dictionary of tracers

This is used when loading data from a file. One tracer object is created for each “row” in each table.

Parameters:

table_list – List of astropy tables

Returns:

Dictionary of tracers

classmethod to_tables(instance_list)[source]

Convert a list of SurveyTracer to a list of astropy tables

This is used when saving data to a file. One table is generated with the information for all the tracers.

Parameters:

instance_list – List of tracer instances

Returns:

List of astropy tables with one table