KKGCorrelation: Scalar-scalar-shear correlations
- class treecorr.KKGCorrelation(config=None, *, logger=None, **kwargs)[source]
Bases:
Corr3
This class handles the calculation and storage of a 3-point scalar-scalar-shear correlation function.
See the doc string of
Corr3
for a description of how the triangles are binned.With this class, point 3 of the triangle (i.e. the vertex opposite d3) is the one with the shear value. Use
KGKCorrelation
andGKKCorrelation
for classes with the shear in the other two positions.See the doc string of
Corr3
for a description of how the triangles are binned along with the attributes related to the different binning options.In addition to the attributes common to all
Corr3
subclasses, objects of this class hold the following attributes:- Attributes:
zeta – The correlation function, \(\zeta\).
varzeta – The variance estimate, only including the shot noise propagated into the final correlation.
The typical usage pattern is as follows:
>>> kkg = treecorr.KKGCorrelation(config) >>> kkg.process(cat1, cat2) # Compute cross-correlation of two fields. >>> kkg.process(cat1, cat2, cat3) # Compute cross-correlation of three fields. >>> kkg.write(file_name) # Write out to a file. >>> zeta = kkg.zeta # Access correlation function. >>> zetar = kkg.zetar # Or access real and imag parts separately. >>> zetai = kkg.zetai
- Parameters:
config (dict) – A configuration dict that can be used to pass in kwargs if desired. This dict is allowed to have addition entries besides those listed in
Corr3
, which are ignored here. (default: None)logger – If desired, a logger object for logging. (default: None, in which case one will be built according to the config dict’s verbose level.)
- Keyword Arguments:
**kwargs – See the documentation for
Corr3
for the list of allowed keyword arguments, which may be passed either directly or in the config dict.
- finalize(vark1, vark2, varg)[source]
Finalize the calculation of the correlation function.
- Parameters:
vark1 (float) – The variance of the first scalar field.
vark2 (float) – The variance of the second scalar field.
varg (float) – The variance per component of the shear field.
- write(file_name, *, file_type=None, precision=None, write_patch_results=False, write_cov=False)[source]
Write the correlation function to the file, file_name.
For bin_type = LogRUV, the output file will include the following columns:
Column
Description
r_nom
The nominal center of the bin in r = d2 where d1 > d2 > d3
u_nom
The nominal center of the bin in u = d3/d2
v_nom
The nominal center of the bin in v = +-(d1-d2)/d3
meanu
The mean value \(\langle u\rangle\) of triangles that fell into each bin
meanv
The mean value \(\langle v\rangle\) of triangles that fell into each bin
For bin_type = LogSAS, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
phi_nom
The nominal center of the bin in phi, the opening angle between d2 and d3 in the counter-clockwise direction
meanphi
The mean value \(\langle phi\rangle\) of triangles that fell into each bin
For bin_type = LogMultipole, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
n
The multipole index n
In addition, all bin types include the following columns:
Column
Description
meand1
The mean value \(\langle d1\rangle\) of triangles that fell into each bin
meanlogd1
The mean value \(\langle \log(d1)\rangle\) of triangles that fell into each bin
meand2
The mean value \(\langle d2\rangle\) of triangles that fell into each bin
meanlogd2
The mean value \(\langle \log(d2)\rangle\) of triangles that fell into each bin
meand3
The mean value \(\langle d3\rangle\) of triangles that fell into each bin
meanlogd3
The mean value \(\langle \log(d3)\rangle\) of triangles that fell into each bin
zetar
The real part of the estimator of \(\zeta\)
zetai
The imag part of the estimator of \(\zeta\)
sigma_zeta
The sqrt of the variance estimate of \(\zeta\)
weight
The total weight of triangles contributing to each bin. (For LogMultipole, this is split into real and imaginary parts, weightr and weighti.)
ntri
The number of triangles contributing to each bin
If
sep_units
was given at construction, then the distances will all be in these units. Otherwise, they will be in either the same units as x,y,z (for flat or 3d coordinates) or radians (for spherical coordinates).- Parameters:
file_name (str) – The name of the file to write to.
file_type (str) – The type of file to write (‘ASCII’ or ‘FITS’). (default: determine the type automatically from the extension of file_name.)
precision (int) – For ASCII output catalogs, the desired precision. (default: 4; this value can also be given in the constructor in the config dict.)
write_patch_results (bool) – Whether to write the patch-based results as well. (default: False)
write_cov (bool) – Whether to write the covariance matrix as well. (default: False)
KGKCorrelation: Scalar-shear-scalar correlations
- class treecorr.KGKCorrelation(config=None, *, logger=None, **kwargs)[source]
Bases:
Corr3
This class handles the calculation and storage of a 3-point scalar-shear-scalar correlation function.
See the doc string of
Corr3
for a description of how the triangles are binned.With this class, point 2 of the triangle (i.e. the vertex opposite d2) is the one with the shear value. Use
KKGCorrelation
andGKKCorrelation
for classes with the shear in the other two positions.See the doc string of
Corr3
for a description of how the triangles are binned along with the attributes related to the different binning options.In addition to the attributes common to all
Corr3
subclasses, objects of this class hold the following attributes:- Attributes:
zeta – The correlation function, \(\zeta\).
varzeta – The variance estimate, only including the shot noise propagated into the final correlation.
The typical usage pattern is as follows:
>>> kgk = treecorr.KGKCorrelation(config) >>> kgk.process(cat1, cat2, cat1) # Compute cross-correlation of two fields. >>> kgk.process(cat1, cat2, cat3) # Compute cross-correlation of three fields. >>> kgk.write(file_name) # Write out to a file. >>> zeta = kgk.zeta # Access correlation function. >>> zetar = kgk.zetar # Or access real and imag parts separately. >>> zetai = kgk.zetai
- Parameters:
config (dict) – A configuration dict that can be used to pass in kwargs if desired. This dict is allowed to have addition entries besides those listed in
Corr3
, which are ignored here. (default: None)logger – If desired, a logger object for logging. (default: None, in which case one will be built according to the config dict’s verbose level.)
- Keyword Arguments:
**kwargs – See the documentation for
Corr3
for the list of allowed keyword arguments, which may be passed either directly or in the config dict.
- finalize(vark1, varg, vark2)[source]
Finalize the calculation of the correlation function.
- Parameters:
vark1 (float) – The variance of the first scalar field.
varg (float) – The variance per component of the shear field.
vark2 (float) – The variance of the second scalar field.
- write(file_name, *, file_type=None, precision=None, write_patch_results=False, write_cov=False)[source]
Write the correlation function to the file, file_name.
For bin_type = LogRUV, the output file will include the following columns:
Column
Description
r_nom
The nominal center of the bin in r = d2 where d1 > d2 > d3
u_nom
The nominal center of the bin in u = d3/d2
v_nom
The nominal center of the bin in v = +-(d1-d2)/d3
meanu
The mean value \(\langle u\rangle\) of triangles that fell into each bin
meanv
The mean value \(\langle v\rangle\) of triangles that fell into each bin
For bin_type = LogSAS, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
phi_nom
The nominal center of the bin in phi, the opening angle between d2 and d3 in the counter-clockwise direction
meanphi
The mean value \(\langle phi\rangle\) of triangles that fell into each bin
For bin_type = LogMultipole, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
n
The multipole index n
In addition, all bin types include the following columns:
Column
Description
meand1
The mean value \(\langle d1\rangle\) of triangles that fell into each bin
meanlogd1
The mean value \(\langle \log(d1)\rangle\) of triangles that fell into each bin
meand2
The mean value \(\langle d2\rangle\) of triangles that fell into each bin
meanlogd2
The mean value \(\langle \log(d2)\rangle\) of triangles that fell into each bin
meand3
The mean value \(\langle d3\rangle\) of triangles that fell into each bin
meanlogd3
The mean value \(\langle \log(d3)\rangle\) of triangles that fell into each bin
zetar
The real part of the estimator of \(\zeta\)
zetai
The imag part of the estimator of \(\zeta\)
sigma_zeta
The sqrt of the variance estimate of \(\zeta\)
weight
The total weight of triangles contributing to each bin. (For LogMultipole, this is split into real and imaginary parts, weightr and weighti.)
ntri
The number of triangles contributing to each bin
If
sep_units
was given at construction, then the distances will all be in these units. Otherwise, they will be in either the same units as x,y,z (for flat or 3d coordinates) or radians (for spherical coordinates).- Parameters:
file_name (str) – The name of the file to write to.
file_type (str) – The type of file to write (‘ASCII’ or ‘FITS’). (default: determine the type automatically from the extension of file_name.)
precision (int) – For ASCII output catalogs, the desired precision. (default: 4; this value can also be given in the constructor in the config dict.)
write_patch_results (bool) – Whether to write the patch-based results as well. (default: False)
write_cov (bool) – Whether to write the covariance matrix as well. (default: False)
GKKCorrelation: Shear-scalar-scalar correlations
- class treecorr.GKKCorrelation(config=None, *, logger=None, **kwargs)[source]
Bases:
Corr3
This class handles the calculation and storage of a 3-point shear-scalar-scalar correlation function.
See the doc string of
Corr3
for a description of how the triangles are binned.With this class, point 1 of the triangle (i.e. the vertex opposite d1) is the one with the shear value. Use
KGKCorrelation
andKKGCorrelation
for classes with the shear in the other two positions.See the doc string of
Corr3
for a description of how the triangles are binned along with the attributes related to the different binning options.In addition to the attributes common to all
Corr3
subclasses, objects of this class hold the following attributes:- Attributes:
zeta – The correlation function, \(\zeta\).
varzeta – The variance estimate, only including the shot noise propagated into the final correlation.
The typical usage pattern is as follows:
>>> gkk = treecorr.GKKCorrelation(config) >>> gkk.process(cat1, cat2) # Compute cross-correlation of two fields. >>> gkk.process(cat1, cat2, cat3) # Compute cross-correlation of three fields. >>> gkk.write(file_name) # Write out to a file. >>> zeta = gkk.zeta # Access correlation function. >>> zetar = gkk.zetar # Or access real and imag parts separately. >>> zetai = gkk.zetai
- Parameters:
config (dict) – A configuration dict that can be used to pass in kwargs if desired. This dict is allowed to have addition entries besides those listed in
Corr3
, which are ignored here. (default: None)logger – If desired, a logger object for logging. (default: None, in which case one will be built according to the config dict’s verbose level.)
- Keyword Arguments:
**kwargs – See the documentation for
Corr3
for the list of allowed keyword arguments, which may be passed either directly or in the config dict.
- finalize(varg, vark1, vark2)[source]
Finalize the calculation of the correlation function.
- Parameters:
varg (float) – The variance per component of the shear field.
vark1 (float) – The variance of the first scalar field.
vark2 (float) – The variance of the second scalar field.
- write(file_name, *, file_type=None, precision=None, write_patch_results=False, write_cov=False)[source]
Write the correlation function to the file, file_name.
For bin_type = LogRUV, the output file will include the following columns:
Column
Description
r_nom
The nominal center of the bin in r = d2 where d1 > d2 > d3
u_nom
The nominal center of the bin in u = d3/d2
v_nom
The nominal center of the bin in v = +-(d1-d2)/d3
meanu
The mean value \(\langle u\rangle\) of triangles that fell into each bin
meanv
The mean value \(\langle v\rangle\) of triangles that fell into each bin
For bin_type = LogSAS, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
phi_nom
The nominal center of the bin in phi, the opening angle between d2 and d3 in the counter-clockwise direction
meanphi
The mean value \(\langle phi\rangle\) of triangles that fell into each bin
For bin_type = LogMultipole, the output file will include the following columns:
Column
Description
d2_nom
The nominal center of the bin in d2
d3_nom
The nominal center of the bin in d3
n
The multipole index n
In addition, all bin types include the following columns:
Column
Description
meand1
The mean value \(\langle d1\rangle\) of triangles that fell into each bin
meanlogd1
The mean value \(\langle \log(d1)\rangle\) of triangles that fell into each bin
meand2
The mean value \(\langle d2\rangle\) of triangles that fell into each bin
meanlogd2
The mean value \(\langle \log(d2)\rangle\) of triangles that fell into each bin
meand3
The mean value \(\langle d3\rangle\) of triangles that fell into each bin
meanlogd3
The mean value \(\langle \log(d3)\rangle\) of triangles that fell into each bin
zetar
The real part of the estimator of \(\zeta\)
zetai
The imag part of the estimator of \(\zeta\)
sigma_zeta
The sqrt of the variance estimate of \(\zeta\)
weight
The total weight of triangles contributing to each bin. (For LogMultipole, this is split into real and imaginary parts, weightr and weighti.)
ntri
The number of triangles contributing to each bin
If
sep_units
was given at construction, then the distances will all be in these units. Otherwise, they will be in either the same units as x,y,z (for flat or 3d coordinates) or radians (for spherical coordinates).- Parameters:
file_name (str) – The name of the file to write to.
file_type (str) – The type of file to write (‘ASCII’ or ‘FITS’). (default: determine the type automatically from the extension of file_name.)
precision (int) – For ASCII output catalogs, the desired precision. (default: 4; this value can also be given in the constructor in the config dict.)
write_patch_results (bool) – Whether to write the patch-based results as well. (default: False)
write_cov (bool) – Whether to write the covariance matrix as well. (default: False)