You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- ``"s_mu"``: compute covariance of the correlation function in s, µ bins. Only linear µ binning between 0 and 1 supported.
62
-
- ``"legendre_projected"``: compute covariance of the correlation function Legendre multipoles in separation (s) bins projected from µ bins (only linear µ binning supported between 0 and 1). Procedure matches ``pycorr``. Works with jackknives, may be less efficient in periodic geometry.
63
-
- ``"legendre_accumulated"``: compute covariance of the correlation function Legendre multipoles in separation (s) bins accumulated directly, without first doing µ-binned counts. Incompatible with jackknives.
61
+
- ``"s_mu"``: compute covariance of the correlation function in separation (s), and angular (:math:`\mu`) bins. Only linear :math:`\mu` binning between 0 and 1 supported.
62
+
- ``"legendre_projected"``: compute covariance of the correlation function Legendre multipoles in separation (s) bins projected from :math:`\mu` bins (only linear :math:`\mu` binning supported between 0 and 1). Procedure matches ``pycorr``. Works with jackknives, may be less efficient in periodic geometry.
63
+
- ``"legendre_accumulated"``: compute covariance of the correlation function Legendre multipoles in separation (s) bins accumulated directly, without first doing :math:`\mu`-binned counts. Incompatible with jackknives.
64
64
65
65
max_l : integer
66
66
Max Legendre multipole index (required in both Legendre ``mode``\s).
If given and not None, enables the multi-tracer functionality (full two-tracer covariance estimation).
95
95
96
96
randoms_weights2 : None or array of floats of length N_randoms2
97
-
(Optional) weights of random points for the second tracer (required for multi-tracer functionality).
97
+
(Only for for multi-tracer functionality) weights of random points for the second tracer.
98
98
99
99
randoms_samples2 : None or array of integers of length N_randoms2
100
-
(Optional) jackknife region numbers for the second tracer (required for multi-tracer + jackknife functionality, although this combination has not been used yet).
100
+
(Only for multi-tracer + jackknife functionality, although this combination has not been used yet) jackknife region numbers for the second tracer.
101
101
The jackknife assignment must match the jackknife counts in ``pycorr_allcounts_12`` and ``pycorr_allcounts_22``.
:class:`pycorr.TwoPointEstimator` with auto-counts for the first tracer.
105
105
Must be rebinned and/or cut to the separation (s) bins desired for the covariance.
106
106
Note that more bins result in slower convergence. A typical configuration has been 4 Mpc/h wide bins between 20 and 200 Mpc/h.
107
-
The counts will be wrapped to positive µ, so if the µ range in them is from -1 to 1, the number of µ bins must be even.
108
-
Providing unwrapped counts (µ from -1 to 1) is preferrable, because some issues can be fixed by assuming symmetry.
107
+
The counts will be wrapped to positive :math:`\mu`, so if the :math:`\mu` range in them is from -1 to 1, the number of :math:`\mu` bins must be even.
108
+
Providing unwrapped counts (:math:`\mu` from -1 to 1) is preferrable, because some issues can be fixed by assuming symmetry.
109
109
110
-
- In "s_mu" ``mode``, the covariance will be done for the given number of µ bins (after wrapping).
111
-
- In "legendre_projected" ``mode``, it will be assumed that Legendre multipoles are projected from the same number of µ bins as present in these counts. One might consider rebinning more coarsely for faster performance but less guaranteed accuracy (neither effect has been tested yet).
112
-
- In "legendre_accumulated" ``mode``, all the present µ bins (after wrapping) will be used to fit the survey correction functions.
110
+
- In "s_mu" ``mode``, the covariance will be done for the given number of :math:`\mu` bins (after wrapping).
111
+
- In "legendre_projected" ``mode``, it will be assumed that Legendre multipoles are projected from the same number of :math:`\mu` bins as present in these counts. One might consider rebinning more coarsely for faster performance but less guaranteed accuracy (neither effect has been tested yet).
112
+
- In "legendre_accumulated" ``mode``, all the present :math:`\mu` bins (after wrapping) will be used to fit the survey correction functions.
113
113
114
114
For jackknife functionality, ``pycorr_allcounts_11`` must contain jackknife RR counts and correlation function. The jackknife assigment must match ``randoms_samples1``.
(Only for the multi-tracer functionality) :class:`pycorr.TwoPointEstimator` with cross-counts between the two tracers (order does not matter, because absolute value of :math:`\mu` will be taken).
118
120
Must have the same bin configuration as ``pycorr_allcounts_11``.
119
121
For jackknife functionality, must contain jackknife RR counts and correlation function. The jackknife assigment must match ``randoms_samples1`` and ``randoms_samples2``.
122
+
123
+
If both ``pycorr_allcounts_11.D1D2.size1`` and ``pycorr_allcounts_12.D1D2.size1`` are set to zeros, you need to provide ``no_data_galaxies1``.
(Optional) number of second tracer data (not random!) points for the covariance rescaling.
138
145
If None (default), the code will attempt to obtain it from ``pycorr_allcounts_22``.
139
146
140
-
xi_table_11 : ``pycorr.TwoPointEstimator``, or sequence (tuple or list) of 3 elements: (s_values, mu_values, xi_values), or sequence (tuple or list) of 4 elements: (s_values, mu_values, xi_values, s_edges)
141
-
Table of first tracer auto-correlation function in separation (s) and µ bins.
147
+
xi_table_11 : :class:`pycorr.TwoPointEstimator`, or sequence (tuple or list) of 3 elements: ``(s_values, mu_values, xi_values)``, or sequence (tuple or list) of 4 elements: ``(s_values, mu_values, xi_values, s_edges)``
148
+
Table of first tracer auto-correlation function in separation (s) and :math:`\mu` bins.
142
149
The code will use it for interpolation in the covariance matrix integrals.
143
-
Important: if the given correlation function is an average in s, µ bins, the separation bin edges need to be provided (and the µ bins are assumed to be linear) for rescaling procedure which ensures that the interpolation results averaged over s, µ bins returns the given correlation function. In case of ``pycorr.TwoPointEstimator``, the edges will be recovered automatically. Unwrapped estimators (µ from -1 to 1) are preferred, because symmetry allows to fix some issues.
150
+
Important: if the given correlation function is an average in :math:`(s, \mu)` bins, the separation bin edges need to be provided (and the :math:`\mu` bins are assumed to be linear) for rescaling procedure which ensures that the interpolation results averaged over :math:`(s, \mu)` bins returns the given correlation function. In case of ``pycorr.TwoPointEstimator``, the edges will be recovered automatically. Unwrapped estimators (:math:`\mu` from -1 to 1) are preferred, because symmetry allows to fix some issues.
144
151
In the sequence format:
145
152
146
-
- s_values must be a 1D array of reference separation (s) values for the table, of length N;
147
-
- mu_values must be a 1D array of reference µ values (covering the range from 0 to 1) for the table, of length M;
148
-
- xi_values must be an array of correlation function values at those s, µ values of shape (N, M);
149
-
- s_edges, if given, must be a 1D array of separation bin edges of length N+1. The bins must come close to zero separation (say start at ``s <= 0.01``).
153
+
- ``s_values`` must be a 1D array of reference separation (s) values for the table, of length N;
154
+
- ``mu_values`` must be a 1D array of reference :math:`\mu` values (covering the range from 0 to 1) for the table, of length M;
155
+
- ``xi_values`` must be an array of correlation function values at those :math:`(s, \mu)` values of shape (N, M);
156
+
- ``s_edges``, if given, must be a 1D array of separation bin edges of length N+1. The bins must come close to zero separation (say start at ``s <= 0.01``).
150
157
151
158
The sequence containing 3 elements should be used for theoretical models evaluated at a grid of s, mu values.
152
-
The 4-element format should be used for bin-averaged estimates.
159
+
The 4-element format should be used for bin-averaged estimates (unless they are in a :class:`pycorr.TwoPointEstimator`).
153
160
154
161
xi_table_12 : None or the same format as ``xi_table_11``
155
-
Table of the two tracer's cross-correlation function in separation (s) and µ bins.
162
+
Table of the two tracer's cross-correlation function in separation (s) and :math:`\mu` bins.
156
163
The code will use it for interpolation in the covariance matrix integrals.
157
164
Required for multi-tracer functionality.
158
165
159
166
xi_table_22 : None or the same format as ``xi_table_11``
160
-
Table of second tracer auto-correlation function in separation (s) and µ bins.
167
+
Table of second tracer auto-correlation function in separation (s) and :math:`\mu` bins.
161
168
The code will use it for interpolation in the covariance matrix integrals.
For optimal balancing and minimal idle time, should be a few times (at least twice) ``nthread`` and exactly divisible by it.
193
200
The runtime roughly scales as the number of quads per the number of threads, :math:`\mathcal{O}`\(``N_randoms * N2 * N3 * N4 * n_loops / nthread``).
194
-
For reference, on NERSC Perlmutter CPU half-node the code processed about 27 millions (2.7e7) quads per second per thread (using 64 threads on half a node) as of December 2024. (In Legendre projected mode, which is probably the slowest, with ``N2 = 5``, ``N3 = 10``, ``N4 = 20``.)
201
+
For reference, on NERSC Perlmutter CPU half-node the code processed about 27 millions (``2.7e7``) quads per second per thread (using 64 threads on half a node) as of December 2024. (In Legendre projected mode, which is probably the slowest, with ``N2 = 5``, ``N3 = 10``, ``N4 = 20``.)
195
202
In single-tracer mode, the number of quads is ``N_randoms * N2 * N3 * N4 * n_loops``.
196
203
In two-tracer mode, the number of quads is ``(5 * N_randoms1 + 2 * N_randoms2) * N2 * N3 * N4 * n_loops``.
Post-processing results as a dictionary with string keys and Numpy array values. All this information is also saved in a ``Rescaled_Covariance_Matrices*.npz`` file in the output directory.
250
257
Selected common keys are: ``"full_theory_covariance"`` for the final covariance matrix and ``"shot_noise_rescaling"`` for the shot-noise rescaling value(s).
251
-
There will also be a ``Raw_Covariance_Matices*.npz`` file in the output directory (as long as the C++ code has run without errors), which can be post-processed separately in a different way.
258
+
There will also be a ``Raw_Covariance_Matices*.npz`` file in the output directory (as long as the C++ code has run without errors), which can be post-processed separately in a different way using e.g. :func:`RascalC.post_process_auto`.
252
259
"""
253
260
254
261
ifmodenotin ("s_mu", "legendre_accumulated", "legendre_projected"): raiseValueError("Given mode not supported")
ifcandnotnp.allclose(pycorr_allcounts.edges[0], pycorr_allcounts_11.edges[0]): raiseValueError(f"pycorr_allcounts_{indices_corr[c]} separation/radial binning is not consistent with pycorr_allcounts_11")
369
376
ifpycorr_allcounts.edges[1][0] <0: # try to fix and wrap
print_and_log(f"Wrapping pycorr_allcounts_{indices_corr[c]} to µ>=0")
378
+
print_and_log(f"Wrapping pycorr_allcounts_{indices_corr[c]} to mu>=0")
372
379
pycorr_allcounts=pycorr_allcounts.wrap()
373
-
iflen(pycorr_allcounts.edges[1]) !=n_mu_bins+1: raiseValueError(f"The number of angular/µ bins in pycorr_allcounts_{indices_corr[c]} is not consistent with the number determined from pycorr_allcounts_11")
374
-
ifnotnp.allclose(pycorr_allcounts.edges[1], np.linspace(0, 1, n_mu_bins+1)): raiseValueError(f"pycorr_allcounts_{indices_corr[c]} mu/µ binning is not consistent with linear between 0 and 1 (after wrapping)")
380
+
iflen(pycorr_allcounts.edges[1]) !=n_mu_bins+1: raiseValueError(f"The number of angular/mu bins in pycorr_allcounts_{indices_corr[c]} is not consistent with the number determined from pycorr_allcounts_11")
381
+
ifnotnp.allclose(pycorr_allcounts.edges[1], np.linspace(0, 1, n_mu_bins+1)): raiseValueError(f"pycorr_allcounts_{indices_corr[c]} mu binning is not consistent with linear between 0 and 1 (after wrapping)")
print_and_log(f"Wrapping xi_table_{indices_corr[c]} to µ>=0")
413
+
print_and_log(f"Wrapping xi_table_{indices_corr[c]} to mu>=0")
407
414
xi=xi.wrap()
408
415
ifc==0:
409
416
xi_n_mu_bins=xi.shape[1]
410
417
xi_s_edges=xi.edges[0]
411
418
elifnotnp.allclose(xi_s_edges, xi.edges[0]): raiseValueError("Different binning for different correlation functions not supported")
412
-
ifnotnp.allclose(xi.edges[1], np.linspace(0, 1, xi_n_mu_bins+1)): raiseValueError(f"xi_table_{indices_corr[c]}µ binning is not consistent with linear between 0 and 1 (after wrapping)")
419
+
ifnotnp.allclose(xi.edges[1], np.linspace(0, 1, xi_n_mu_bins+1)): raiseValueError(f"xi_table_{indices_corr[c]}mu binning is not consistent with linear between 0 and 1 (after wrapping)")
(Optional) number of higher multipoles to skip (from the end).
44
+
(Optional) number of higher multipoles to skip (from the end and counting only even multipoles).
45
45
46
46
tracer : 1 or 2
47
47
(Optional) if the RascalC output directory contains two-tracer results, ``tracer = 2`` together with ``two_tracers = False`` allows to select the second tracer for single-tracer post-processing.
0 commit comments