Galaxy Cluster Catalogs

The main object for galaxy cluster catalogs is ClCatalog, it has same properties of astropy tables, with additional functionality.

Table of Contents

  • 1  ClCatalog attributes

  • 2  Creating a catalog

    • 2.1  From columns

    • 2.2  From data table

    • 2.3  Create a catalog from fits files

  • 3  ClCatalog necessary columns

    • 3.1  Important inputs of ClCatalog

    • 3.2  Reserved keyword arguments

    • 3.3  Catalog lables

    • 3.4  Catalog mt_input

  • 4  Saving catalogs

  • 5  Accessing catalog data

  • 6  Inbuilt function of catalogs

  • 7  Adding members to cluster catalogs

    • 7.1  Read members from fits files

    • 7.2  Important inputs of members catalog

    • 7.3  Reserved keyword arguments

    • 7.4  Saving members

    • 7.5  Memory consuption

%load_ext autoreload
%autoreload 2
from IPython.display import HTML

ClCatalog attributes

The ClCatalog has the following internal attributes: - name: ClCatalog name - data: Table with main catalog data (ex: id, ra, dec, z) and matching data (mt_self, mt_other, mt_cross, mt_multi_self, mt_multi_other) - tags: Dictionary that tells which are the default columns to be used - mt_input: Table containing the necessary inputs for the match (added by Match objects) - size: Number of objects in the catalog - id_dict: Dictionary of indicies given the object id - labels: Labels of data columns for plots - members: Members of clusters (optional) - leftover_members: Galaxies in the input members not hosted by the cluster catalog (optional)

Creating a catalog

The catalog can be created by passing individual columns or a whole data table. Below we show how each case can be used.

from clevar import ClCatalog

From columns

To create a catalog fom columns, you have to pass the name as the initial argument and the data columns for the table as keyword arguments:

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

You can also pass a tags dictionary as input if you want your catalog to have names that are not default for ClEvaR use:

cat = ClCatalog('cluster', ID_CLUSTER=['c1', 'c2'], M200=[1e13, 1e14],
                tags={'id':'ID_CLUSTER', 'mass':'M200'})
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

Almost all keyword arguments will become columns of the catalog (see exeptions in Important inputs of ``ClCatalog` <#clcat_input>`__):

cat = ClCatalog('test name', id=['c1', 'c2'], test_column=[1, 2],
                other=[True, False], third=[None, []])
cat
test name
tags: id(id)
Radius unit: None
ClData length=2
idtest_columnotherthirdmt_selfmt_othermt_multi_selfmt_multi_other
str2int64boolobjectobjectobjectobjectobject
c11TrueNoneNoneNone[][]
c22False[]NoneNone[][]

From data table

You can also create a ClCatalog passing directly a full data table:

from astropy.table import Table
ap_table = Table([['c1', 'c2'],[1e13, 1e14]], names=['id', 'mass'])
cat = ClCatalog('cluster', data=ap_table)
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

You can also pass a tags dictionary as input if you want your catalog to have names that are not default for ClEvaR use:

from astropy.table import Table
ap_table = Table([['c1', 'c2'],[1e13, 1e14]], names=['ID_CLUSTER', 'M200'])
cat = ClCatalog('cluster', data=ap_table, tags={'id':'ID_CLUSTER', 'mass':'M200'})
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

You can also pass a dictionary or a numpy array with names:

cat = ClCatalog('cluster', data={'id':['c1', 'c2'], 'mass':[1e13, 1e14]})
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]
import numpy as np
np_table = np.array([('c1', 1e13),('c2', 1e14)],
                    dtype=[('id', 'U10'), ('mass', 'f4')])
cat = ClCatalog('cluster', data=np_table)
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str10float32objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

Create a catalog from fits files

The catalogs objects can also be read directly from file, by passing the fits file as the first argument, the catalog name as the second, and the tag argument listing the main columns to be read:

cat = ClCatalog.read('../demo/cat1.fits', 'my cluster',
                     tags={'id':'ID', 'mass':'MASS'})
cat['mass'].info.format = '.2e' # Format for nice display
cat
my cluster
tags: ID(id), MASS(mass)
Radius unit: None
ClData length=5
ID (id)MASS (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str3float64objectobjectobjectobject
CL03.16e+13NoneNone[][]
CL12.51e+13NoneNone[][]
CL22.00e+13NoneNone[][]
CL36.31e+13NoneNone[][]
CL41.00e+14NoneNone[][]

If you want to read all columns in the .fits file, set the argument full=True.

cat = ClCatalog.read('../demo/cat1.fits', 'my cluster', full=True,
                     tags={'id':'ID', 'mass':'MASS'})
cat['mass'].info.format = '.2e' # Format for nice display
cat
my cluster
tags: ID(id), MASS(mass), RA(ra), DEC(dec), Z(z)
Radius unit: None
ClData length=5
ID (id)RA (ra)DEC (dec)Z (z)MASS (mass)RADIUS_ARCMINmt_selfmt_othermt_multi_selfmt_multi_other
str3float64float64float64float64float64objectobjectobjectobject
CL00.00.00.23.16e+131.0NoneNone[][]
CL10.00010.00.32.51e+131.0NoneNone[][]
CL20.000110.00.252.00e+131.0NoneNone[][]
CL325.00.00.46.31e+131.0NoneNone[][]
CL420.00.00.351.00e+141.0NoneNone[][]

ClCatalog necessary columns

There are a few columns that will aways be present on ClCatalog objects, and are added when not provided. For instance, the matching columns (with prefix mt_):

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display
cat
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

All catalogs have an id column. If it is not included in the input, one will be created:

cat = ClCatalog('cluster', mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display
cat
/home/aguena/.local/lib/python3.9/site-packages/clevar-0.13.2-py3.9.egg/clevar/catalog.py:267: UserWarning: id column missing, additional one is being created.
  warnings.warn(
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str1float64objectobjectobjectobject
01.00e+13NoneNone[][]
11.00e+14NoneNone[][]

Each cluster must have an unique id. Repetitions will have an suffix _r# added:

cat = ClCatalog('cluster', id=['cluster', 'cluster'])
cat
/home/aguena/.local/lib/python3.9/site-packages/clevar-0.13.2-py3.9.egg/clevar/catalog.py:501: UserWarning: Repeated ID's in id column, adding suffix _r# to them.
  warnings.warn(
cluster
tags: id(id)
Radius unit: None
ClData length=2
idmt_selfmt_othermt_multi_selfmt_multi_other
objectobjectobjectobjectobject
cluster_r1NoneNone[][]
cluster_r2NoneNone[][]

Important inputs of ClCatalog

As shown above, ClCatalog can have any column in its main data table. There are a few key columns that must exist (or be tagged) to be used for matching:

  • id - necessary in membership matching (must correspond to id_cluster in the cluster member catalog).

  • ra (in degrees) - necessary for proxity matching.

  • dec (in degrees) - necessary for proxity matching.

  • z - necessary for proxity matching if used as matching criteria (or for angular to physical convertion).

  • mass (or mass proxy) - necessary for proxity matching if shared_member_fraction used as preference criteria for unique matches (default use in membership matching).

  • radius - necessary for proxity matching if used as a criteria of matching (also requires radius_unit to be passed)

Reserved keyword arguments

There is some keyword arguments that have a fixed meaning and do not become columns in the cluster data table:

  • radius_unit: can be in angular units (radians, degrees, arcmin, arcsec) or physical units (Mpc, kpc, pc) or can enven be given by mass overdensity units (m200b, m500c) and are case insensitive. In the proximity matching the radius is converted to angular distances (degrees).

  • data: Data table to be added to the catalog.

  • tags: Dictionary that tags the important columns in the catalog.

  • labels: Dictionary with labels of data columns to be used in plots.

  • members: Members of clusters, see cluster members section for details.

  • members_warning: Warn if the members catalog contains galaxies not hosted by the cluster catalog.

  • mt_input: Table containing the necessary inputs for the match. This attribute is usually added during the matching process, but it can be passed in the ClCatalog construction.

Catalog lables

The catalogs have a label attribute that is used for plots. If it is not provided as argument, a default value is assigned:

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat.labels
{'id': 'id_{cluster}', 'mass': 'mass_{cluster}'}
cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14],
                labels={'id':'cluster ID', 'mass':'cluster M_200'})
cat.labels
{'id': 'cluster ID', 'mass': 'cluster M_200'}

Catalog mt_input

Here are some examples of information being added to mt_input after the catalog creation. In the proximity matching, it will add an angular distance and min/max redshift when delta_z is not None:

from clevar.match import ProximityMatch
mt = ProximityMatch()
cat = ClCatalog('Cat',id=['c1', 'c2'],  radius=[0.01, 0.02], radius_unit='radians')
mt.prep_cat_for_match(cat, delta_z=None, match_radius='cat')
cat.mt_input['ang']
## Prep mt_cols
* zmin|zmax set to -1|10
* ang radius from cat
<Column name='ang' dtype='float64' length=2>
0.5729577951308232
1.1459155902616465

This information is also show directly when displaing the catalog:

cat = ClCatalog('Cat',id=['c1', 'c2'],  radius=[0.01, 0.02], radius_unit='degrees')
mt.prep_cat_for_match(cat, delta_z=None, match_radius='cat')
cat
## Prep mt_cols
* zmin|zmax set to -1|10
* ang radius from cat
Cat
tags: id(id), radius(radius)
Radius unit: degrees
ClData length=2
mt_input
idradiusmt_selfmt_othermt_multi_selfmt_multi_otherzminzmaxang
str2float64objectobjectobjectobjectfloat64float64float64
c10.01NoneNone[][]-1.010.00.01
c20.02NoneNone[][]-1.010.00.02

Using physical units (requires a cosmology):

from clevar.cosmology import AstroPyCosmology
cosmo = AstroPyCosmology()

display(HTML('<h3>Radius in Mpc</h3>'))
cat = ClCatalog('Cat',id=['c1', 'c2'],  radius=[1, 1.5], z=[.4, .5], radius_unit='mpc')
mt.prep_cat_for_match(cat, delta_z=None, match_radius='cat', cosmo=cosmo)
display(cat)

display(HTML('<h3>Radius from M200c</h3>'))
cat = ClCatalog('Cat', id=['c1', 'c2'], mass=[1e13, 1e14], z=[.4, .5],
                tags={'radius':'mass'}, radius_unit='m200c')
mt.prep_cat_for_match(cat, delta_z=None, match_radius='cat', cosmo=cosmo)
cat['mass'].info.format = '.2e' # Format for nice display
display(cat)

Radius in Mpc

## Prep mt_cols
* zmin|zmax set to -1|10
* ang radius from cat
Cat
tags: id(id), radius(radius), z(z)
Radius unit: mpc
ClData length=2
mt_input
idradiuszmt_selfmt_othermt_multi_selfmt_multi_otherzminzmaxang
str2float64float64objectobjectobjectobjectfloat64float64float64
c11.00.4NoneNone[][]-1.010.00.05169945411341919
c21.50.5NoneNone[][]-1.010.00.06825890628285289

Radius from M200c

## Prep mt_cols
* zmin|zmax set to -1|10
* ang radius from cat
    * Converting mass (m200c) ->radius
Cat
tags: id(id), mass(radius), mass(mass), z(z)
Radius unit: m200c
ClData length=2
mt_input
idmass (radius)zmt_selfmt_othermt_multi_selfmt_multi_otherzminzmaxang
str2float64float64objectobjectobjectobjectfloat64float64float64
c11.00e+130.4NoneNone[][]-1.010.00.01996895400735947
c21.00e+140.5NoneNone[][]-1.010.00.036417730336072186

Saving catalogs

The ClCatalog object has a write inbuilt function to save them to .fits files. This function also take the argument add_header that add the name and labels informations to those files. If the file was saved with this argument, it can be read without the requirement of a name argument:

cat = ClCatalog('cluster', ID_CLUSTER=['c1', 'c2'], M200=[1e13, 1e14],
                tags={'id':'ID_CLUSTER', 'mass':'M200'},
                labels={'id':'cluster ID', 'mass':'cluster M_200'},
               )
cat.write('cat1_with_info.fits', overwrite=True)
cat_temp = cat.read_full('cat1_with_info.fits')
cat_temp['mass'].info.format = '.2e' # Format for nice display
cat_temp
<< ClEvar used in matching: 0.13.2 >>
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

Accessing catalog data

The main data table of the catalog can be accessed with [] operations in the same way as astropy tables. The output is a new ClCatalog object, exept when only 1 row or column is required, then the row/column is returned:

cat = ClCatalog('cluster', ID_CLUSTER=['c1', 'c2'], M200=[1e13, 1e14],
                tags={'id':'ID_CLUSTER', 'mass':'M200'},
                labels={'id':'cluster ID', 'mass':'cluster M_200'},
               )
cat['mass'].info.format = '.2e' # Format for nice display
cat['ID_CLUSTER']
<Column name='ID_CLUSTER' dtype='str2' length=2>
c1
c2
cat['ID_CLUSTER', 'M200']
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]
cat[[1, 0]]
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c21.00e+14NoneNone[][]
c11.00e+13NoneNone[][]
cat[[True, False]]
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=1
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
cat[:1]
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=1
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
cat[0]
Row index=0
ID_CLUSTERM200mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]

An important detail is that when the catalog has tags, passing a string that is tagged will return the tagged column:

cat['id']
<Column name='ID_CLUSTER' dtype='str2' length=2>
c1
c2
cat['id_cluster', 'M200']
cluster
tags: ID_CLUSTER(id), M200(mass)
Radius unit: None
ClData length=2
ID_CLUSTER (id)M200 (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

Inbuilt function of catalogs

The ClCatalog object has some inbuilt functionality to facilitate the matching. ids2inds returns the indicies of objects given an id list. Other functions are related to footprint computations, see footprint.ipynb for information on those.

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display

display(HTML('<h3>Catalog</h3>'))
display(cat)

display(HTML('<h3>Catalog sorted by id list</h3>'))
inds = cat.ids2inds(['c2', 'c1'])
display(cat[inds])

Catalog

cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]

Catalog sorted by id list

cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c21.00e+14NoneNone[][]
c11.00e+13NoneNone[][]

Adding members to cluster catalogs

The members are used as an internal table like object of ClCatalog, accessed by .members. This object have the following attributes: - name: ClCatalog name - data: Table with main catalog data (ex: id, id_cluster, ra, dec, z) - size: Number of objects in the catalog - id_dict: Dictionary of indicies given the object id - labels: Labels of data columns for plots - id_dict_list: Dictionary of indicies given the object id, retiruning lists to account members with repeated id.

The members can be added to the cluster object using the add_members function. It has a similar instanciating format of a ClCatalog object, where the columns are added by keyword arguments (the key id_cluster is always necessary and must correspond to id in the main cluster catalog):

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display
cat.add_members(id=['m1', 'm2', 'm3'], id_cluster=['c1', 'c2', 'c1'])
display(cat)
display(cat.members)
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]
members
tags: id(id), id_cluster(id_cluster)
ClData length=3
idid_clusterind_cl
str2str2int64
m1c10
m2c21
m3c10

The same can be done using tags:

cat = ClCatalog('cluster', id=['c1', 'c2'], mass=[1e13, 1e14])
cat['mass'].info.format = '.2e' # Format for nice display
cat.add_members(
    ID=['m1', 'm2', 'm3'], IDCL=['c1', 'c2', 'c1'],
    tags={'id':'ID', 'id_cluster':'IDCL'})
display(cat)
display(cat.members)
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=2
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
c21.00e+14NoneNone[][]
members
tags: ID(id), IDCL(id_cluster)
ClData length=3
ID (id)IDCL (id_cluster)ind_cl
str2str2int64
m1c10
m2c21
m3c10

Read members from fits files

The catalogs objects can also be read directly from file, by passing the fits file as the first argument, the catalog name as the second, and the names of the columns in the fits files as keyword arguments:

cat = ClCatalog.read(
    '../demo/cat1.fits', 'my cluster',
    tags={'id':'ID', 'mass':'MASS'})
cat.read_members(
    '../demo/cat1_mem.fits',
    tags={'id':'ID', 'id_cluster':'ID_CLUSTER'})
cat['mass'].info.format = '.2e' # Format for nice display
display(cat)
display(cat.members)
my cluster
tags: ID(id), MASS(mass)
Radius unit: None
ClData length=5
ID (id)MASS (mass)mt_selfmt_othermt_multi_selfmt_multi_other
str3float64objectobjectobjectobject
CL03.16e+13NoneNone[][]
CL12.51e+13NoneNone[][]
CL22.00e+13NoneNone[][]
CL36.31e+13NoneNone[][]
CL41.00e+14NoneNone[][]
members
tags: ID(id), ID_CLUSTER(id_cluster)
ClData length=15
ID (id)ID_CLUSTER (id_cluster)ind_cl
str5str3int64
MEM0CL00
MEM1CL00
MEM2CL00
MEM3CL00
MEM4CL00
MEM5CL11
MEM6CL11
MEM7CL11
MEM8CL11
MEM9CL22
MEM10CL22
MEM11CL22
MEM12CL33
MEM13CL33
MEM14CL44

Again, passing full=True will read all columns in the file:

cat = ClCatalog.read(
    '../demo/cat1.fits', 'my cluster',
    tags={'id':'ID', 'mass':'MASS'}, full=True)
cat.read_members(
    '../demo/cat1_mem.fits',
    tags={'id':'ID', 'id_cluster':'ID_CLUSTER'}, full=True)
cat['mass'].info.format = '.2e' # Format for nice display
display(cat)
display(cat.members)
my cluster
tags: ID(id), MASS(mass), RA(ra), DEC(dec), Z(z)
Radius unit: None
ClData length=5
ID (id)RA (ra)DEC (dec)Z (z)MASS (mass)RADIUS_ARCMINmt_selfmt_othermt_multi_selfmt_multi_other
str3float64float64float64float64float64objectobjectobjectobject
CL00.00.00.23.16e+131.0NoneNone[][]
CL10.00010.00.32.51e+131.0NoneNone[][]
CL20.000110.00.252.00e+131.0NoneNone[][]
CL325.00.00.46.31e+131.0NoneNone[][]
CL420.00.00.351.00e+141.0NoneNone[][]
members
tags: ID(id), ID_CLUSTER(id_cluster), RA(ra), DEC(dec), Z(z)
ClData length=15
ID (id)ID_CLUSTER (id_cluster)RA (ra)DEC (dec)Z (z)ind_cl
str5str3float64float64float64int64
MEM0CL00.00.00.20
MEM1CL01e-051e-050.20
MEM2CL02e-052e-050.20
MEM3CL03.0000000000000004e-053.0000000000000004e-050.20
MEM4CL04e-054e-050.20
MEM5CL10.00010.00.31
MEM6CL10.000111e-050.31
MEM7CL10.000122e-050.31
MEM8CL10.000130000000000000023.0000000000000004e-050.31
MEM9CL20.000110.00.252
MEM10CL20.000121e-050.252
MEM11CL20.000130000000000000022e-050.252
MEM12CL325.00.00.43
MEM13CL325.000011e-050.43
MEM14CL420.00.00.354

Important inputs of members catalog

There are a few key columns these catalogs must have to be used for matching:

  • id - necessary in membership matching of members.

  • id_cluster - always necessary and must correspond to id in the main cluster catalog.

  • ra (in degrees) - necessary for proxity matching of members.

  • dec (in degrees) - necessary for proxity matching of members.

  • pmem - Probability of the galaxy being a member, must be [0, 1]. If not provided, it will assing 1 for all members.

Reserved keyword arguments

There are three keyword arguments with specific uses:

  • data: Data table to be added to the catalog.

  • tags: Dictionary that tags the important columns in the catalog.

  • labels: Dictionary with labels of data columns to be used in plots.

  • members_consistency: Require that all input members belong to this cluster catalog.

  • members_warning: Raise warning if members are do not belong to this cluster catalog, and save them in leftover_members attribute.

  • members_catalog: Members catalog if avaliable, mostly for internal use.

When members_consistency=True, only galaxies hosted by the cluster catalog is kept. If members_warning=True, a warning is raised and the clusters not hosted are stored in leftover_members:

cat = ClCatalog('cluster', id=['c1'], mass=[1e13])
cat['mass'].info.format = '.2e' # Format for nice display
cat.add_members(id=['m1', 'm2', 'm3'], id_cluster=['c1', 'c2', 'c1'])
display(cat)
display(cat.members)
display(cat.leftover_members)
/home/aguena/.local/lib/python3.9/site-packages/clevar-0.13.2-py3.9.egg/clevar/catalog.py:1032: UserWarning: Some galaxies were not members of the cluster catalog. They are stored in leftover_members attribute.
  warnings.warn(
cluster
tags: id(id), mass(mass)
Radius unit: None
ClData length=1
idmassmt_selfmt_othermt_multi_selfmt_multi_other
str2float64objectobjectobjectobject
c11.00e+13NoneNone[][]
members
tags: id(id), id_cluster(id_cluster)
ClData length=2
idid_clusterind_cl
str2str2int64
m1c10
m3c10
leftover members
tags: id(id), id_cluster(id_cluster)
ClData length=1
idid_clusterind_cl
str2str2int64
m2c2-1

Saving members

The member object has a write inbuilt function to save them to .fits files. This function also take the argument add_header that add the name and labels informations to those files. If the file was saved with this argument, it can be read without the requirement of a name argument:

cat.members.write('mem1_with_info.fits', overwrite=True)

Memory consuption

IMPORTANT! The member catalogs are usually hundreds of times larger than the cluster catalogs. Therefore it is advised not to add it unless you are using it for a specific goal (ex: membership matching). This catalog also can lead to memory overload and makes the other functions slower.

There are two options to handle this, you can either pass a member free version of the catalog or remove the members altogether. To use the member free version of the catalog, use the raw function:

cat_raw = cat.raw()
print("Original:")
display(cat.members)
print("Raw:")
display(cat.raw().members)
Original:
members
tags: id(id), id_cluster(id_cluster)
ClData length=2
idid_clusterind_cl
str2str2int64
m1c10
m3c10
Raw:
None

To remove the members from the cluster catalog, use the remove_members function:

cat.remove_members()
print(cat.members, cat.leftover_members)
None None