Triumvirate C++ API 0.5.0
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
dataobjs.hpp
Go to the documentation of this file.
1// Copyright (C) [GPLv3 Licence]
2//
3// This file is part of the Triumvirate program. See the COPYRIGHT
4// and LICENCE files at the top-level directory of this distribution
5// for details of copyright and licensing.
6//
7// This program is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15// See the GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <https://www.gnu.org/licenses/>.
19
32#ifndef TRIUMVIRATE_INCLUDE_DATAOBJS_HPP_INCLUDED_
33#define TRIUMVIRATE_INCLUDE_DATAOBJS_HPP_INCLUDED_
34
35#include <algorithm>
36#include <cmath>
37#include <complex>
38#include <vector>
39
40#include "monitor.hpp"
41#include "parameters.hpp"
42
43namespace trv {
44
45// ***********************************************************************
46// Binning schemes
47// ***********************************************************************
48
56class Binning {
57 public:
58 std::string space;
59 std::string scheme;
60 double bin_min;
61 double bin_max;
63 std::vector<double> bin_edges;
64 std::vector<double> bin_centres;
65 std::vector<double> bin_widths;
66
74 explicit Binning(std::string space, std::string scheme);
75
83 explicit Binning(trv::ParameterSet& params);
84
102 void set_bins(double coord_min, double coord_max, int nbin);
103
112 void set_bins();
113
129 void set_bins(double boxsize_max, int ngrid_min);
130
138 void set_bins(std::vector<double> bin_edges);
139
140 private:
141 // CAVEAT: Discretionary choices.
142 int nbin_pad = 5;
143 double dbin_pad_fourier = 1.e-3;
144 double dbin_pad_config = 10.;
145
152 void compute_binning();
153};
154
155
156// ***********************************************************************
157// Mesh grids
158// ***********************************************************************
159
165 int count = 0;
166 int num_bins = 0;
167 std::vector<int> indices;
168 std::vector<double> lower_edges;
169 std::vector<double> upper_edges;
170 std::vector<double> vecx;
171 std::vector<double> vecy;
172 std::vector<double> vecz;
173};
174
175
176// ***********************************************************************
177// Line of sight
178// ***********************************************************************
179
185 double pos[3];
186};
187
188// ***********************************************************************
189// Clustering statistics
190// ***********************************************************************
191
192// -----------------------------------------------------------------------
193// Two-point statistics
194// -----------------------------------------------------------------------
195
201 int dim = 0;
202 std::vector<double> kbin;
203 std::vector<double> keff;
204 std::vector<int> nmodes;
206 std::vector< std::complex<double> > pk_raw;
208 std::vector< std::complex<double> > pk_shot;
209};
210
216 int dim = 0;
217 std::vector<double> rbin;
218 std::vector<double> reff;
219 std::vector<int> npairs;
221 std::vector< std::complex<double> > xi;
222};
223
229 int dim = 0;
230 std::vector<double> rbin;
231 std::vector<double> reff;
232 std::vector<int> npairs;
235 std::vector< std::complex<double> > xi;
236};
237
238
239// -----------------------------------------------------------------------
240// Three-point statistics
241// -----------------------------------------------------------------------
242
248 int dim = 0;
249 std::vector<double> k1_bin;
250 std::vector<double> k2_bin;
251 std::vector<double> k1_eff;
252 std::vector<double> k2_eff;
253 std::vector<int> nmodes_1;
254 std::vector<int> nmodes_2;
256 std::vector< std::complex<double> > bk_raw;
258 std::vector< std::complex<double> > bk_shot;
259};
260
266 int dim = 0;
267 std::vector<double> r1_bin;
268 std::vector<double> r2_bin;
269 std::vector<double> r1_eff;
270 std::vector<double> r2_eff;
272 std::vector<int> npairs_1;
274 std::vector<int> npairs_2;
277 std::vector< std::complex<double> > zeta_raw;
279 std::vector< std::complex<double> > zeta_shot;
280};
281
287 int dim = 0;
288 std::vector<double> r1_bin;
289 std::vector<double> r2_bin;
290 std::vector<double> r1_eff;
291 std::vector<double> r2_eff;
293 std::vector<int> npairs_1;
295 std::vector<int> npairs_2;
298 std::vector< std::complex<double> > zeta_raw;
300 std::vector< std::complex<double> > zeta_shot;
301};
302
303} // namespace trv
304
305#endif // !TRIUMVIRATE_INCLUDE_DATAOBJS_HPP_INCLUDED_
Isotropic coordinate binning.
Definition dataobjs.hpp:56
std::vector< double > bin_widths
bin widths
Definition dataobjs.hpp:65
std::vector< double > bin_edges
bin edges
Definition dataobjs.hpp:63
Binning(std::string space, std::string scheme)
Construct binnng from bin specification.
Definition dataobjs.cpp:37
std::vector< double > bin_centres
bin centres
Definition dataobjs.hpp:64
std::string scheme
binning scheme
Definition dataobjs.hpp:59
double bin_min
lowest bin edge
Definition dataobjs.hpp:60
std::string space
coordinate space
Definition dataobjs.hpp:58
double bin_max
highest bin edge
Definition dataobjs.hpp:61
void set_bins()
Set bins.
Definition dataobjs.cpp:75
int num_bins
number of bins
Definition dataobjs.hpp:62
Parameter set.
Provide tracking of program resources and exceptions.
Program parameter configuration.
Binned vectors.
Definition dataobjs.hpp:164
std::vector< double > vecy
y-components
Definition dataobjs.hpp:171
std::vector< double > vecz
z-components
Definition dataobjs.hpp:172
int count
number of vectors
Definition dataobjs.hpp:165
int num_bins
number of bins
Definition dataobjs.hpp:166
std::vector< double > upper_edges
upper bin edges
Definition dataobjs.hpp:169
std::vector< double > lower_edges
lower bin edges
Definition dataobjs.hpp:168
std::vector< double > vecx
x-components
Definition dataobjs.hpp:170
std::vector< int > indices
bin indices
Definition dataobjs.hpp:167
Bispectrum measurements.
Definition dataobjs.hpp:247
std::vector< std::complex< double > > bk_raw
bispectrum raw measurements (with normalisation and shot noise)
Definition dataobjs.hpp:256
std::vector< double > k2_eff
second effective wavenumber in bins
Definition dataobjs.hpp:252
std::vector< int > nmodes_2
Definition dataobjs.hpp:254
std::vector< std::complex< double > > bk_shot
bispectrum shot noise
Definition dataobjs.hpp:258
std::vector< double > k1_bin
first central wavenumber in bins
Definition dataobjs.hpp:249
std::vector< double > k1_eff
first effective wavenumber in bins
Definition dataobjs.hpp:251
std::vector< double > k2_bin
second central wavenumber in bins
Definition dataobjs.hpp:250
int dim
dimension of data vector
Definition dataobjs.hpp:248
std::vector< int > nmodes_1
number of first wavevectors in bins
Definition dataobjs.hpp:253
Line-of-sight vector.
Definition dataobjs.hpp:184
double pos[3]
3-d position vector
Definition dataobjs.hpp:185
Power spectrum measurements.
Definition dataobjs.hpp:200
int dim
dimension of data vector
Definition dataobjs.hpp:201
std::vector< double > kbin
central wavenumber in bins
Definition dataobjs.hpp:202
std::vector< int > nmodes
Definition dataobjs.hpp:204
std::vector< std::complex< double > > pk_shot
power spectrum shot noise
Definition dataobjs.hpp:208
std::vector< double > keff
effective wavenumber in bins
Definition dataobjs.hpp:203
std::vector< std::complex< double > > pk_raw
power spectrum raw measurements (with normalisation and shot noise)
Definition dataobjs.hpp:206
Three-point correlation function measurements.
Definition dataobjs.hpp:265
std::vector< double > r2_bin
second central separation in bins
Definition dataobjs.hpp:268
std::vector< int > npairs_1
number of first separation vectors in bins
Definition dataobjs.hpp:272
std::vector< double > r1_bin
first central separation in bins
Definition dataobjs.hpp:267
std::vector< std::complex< double > > zeta_shot
three-point correlation function shot noise
Definition dataobjs.hpp:279
std::vector< double > r2_eff
Definition dataobjs.hpp:270
std::vector< std::complex< double > > zeta_raw
Definition dataobjs.hpp:277
std::vector< double > r1_eff
first effective separation in bins
Definition dataobjs.hpp:269
std::vector< int > npairs_2
number of second separation vectors in bins
Definition dataobjs.hpp:274
int dim
dimension of data vector
Definition dataobjs.hpp:266
Three-point correlation function window measurements.
Definition dataobjs.hpp:286
std::vector< std::complex< double > > zeta_shot
three-point correlation function window shot noise
Definition dataobjs.hpp:300
std::vector< int > npairs_2
number of second separation vectors in bins
Definition dataobjs.hpp:295
std::vector< int > npairs_1
number of first separation vectors in bins
Definition dataobjs.hpp:293
std::vector< double > r1_eff
first effective separation in bins
Definition dataobjs.hpp:290
std::vector< double > r2_eff
Definition dataobjs.hpp:291
int dim
dimension of data vector
Definition dataobjs.hpp:287
std::vector< double > r2_bin
second central separation in bins
Definition dataobjs.hpp:289
std::vector< double > r1_bin
first central separation in bins
Definition dataobjs.hpp:288
std::vector< std::complex< double > > zeta_raw
Definition dataobjs.hpp:298
Two-point correlation function measurements.
Definition dataobjs.hpp:215
std::vector< double > rbin
central separation in bins
Definition dataobjs.hpp:217
std::vector< int > npairs
Definition dataobjs.hpp:219
int dim
dimension of data vector
Definition dataobjs.hpp:216
std::vector< std::complex< double > > xi
two-point correlation function measurements (with normalisation)
Definition dataobjs.hpp:221
std::vector< double > reff
effective separation in bins
Definition dataobjs.hpp:218
Two-point correlation function window measurements.
Definition dataobjs.hpp:228
std::vector< std::complex< double > > xi
Definition dataobjs.hpp:235
int dim
dimension of data vector
Definition dataobjs.hpp:229
std::vector< double > reff
effective separation in bins
Definition dataobjs.hpp:231
std::vector< double > rbin
central separation in bins
Definition dataobjs.hpp:230
std::vector< int > npairs
Definition dataobjs.hpp:232