VVCorrelation: Vector-vector correlations
- class treecorr.VVCorrelation(config=None, *, logger=None, **kwargs)[source]
Bases:
BaseZZCorrelationThis class handles the calculation and storage of a 2-point vector-vector correlation function.
See the docstring of
Corr2for a description of how the pairs are binned along with the attributes related to the different binning options.In addition to the attributes common to all
Corr2subclasses, objects of this class hold the following attributes:- Attributes:
xip – The correlation function, \(\xi_+(r)\).
xim – The correlation function, \(\xi_-(r)\).
xip_im – The imaginary part of \(\xi_+(r)\).
xim_im – The imaginary part of \(\xi_-(r)\).
varxip – An estimate of the variance of \(\xi_+(r)\)
varxim – An estimate of the variance of \(\xi_-(r)\)
cov – An estimate of the full covariance matrix for the data vector with \(\xi_+\) first and then \(\xi_-\).
Note
The default method for estimating the variance and covariance attributes (
varxip,varxim, andcov) is ‘shot’, which only includes the shape noise propagated into the final correlation. This does not include sample variance, so it is always an underestimate of the actual variance. To get better estimates, you need to setvar_methodto something else and use patches in the input catalog(s). cf. Covariance Estimates.The typical usage pattern is as follows:
>>> vv = treecorr.VVCorrelation(config) >>> vv.process(cat) # Compute the auto-correlation. >>> # vv.process(cat1, cat2) # ... or the cross-correlation. >>> vv.write(file_name) # Write out to a file. >>> xip, xim = vv.xip, vv.xim # Or access the correlation functions directly.
See also:
NVCorrelation,KVCorrelation,GGCorrelation.- Parameters:
config (dict) – A configuration dict that can be used to pass in kwargs if desired. This dict is allowed to have additional entries besides those listed in
Corr2, which are ignored here. (default: None)logger (
logging.Logger) – If desired, aLoggerobject 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
Corr2for the list of allowed keyword arguments, which may be passed either directly or in the config dict.
- finalize(varv1, varv2)[source]
Finalize the calculation of the correlation function.
The
Corr2.process_autoandCorr2.process_crosscommands accumulate values in each bin, so they can be called multiple times if appropriate. Afterwards, this command finishes the calculation by dividing each column by the total weight.