Triumvirate C++ API 0.5.0.post1.dev301+g026f21751
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
parameters.hpp
Go to the documentation of this file.
1// Triumvirate: Three-Point Clustering Measurements in LSS
2//
3// Copyright (C) 2023 Mike S Wang & Naonori S Sugiyama [GPL-3.0-or-later]
4//
5// This file is part of the Triumvirate program. See the COPYRIGHT
6// and LICENCE files at the top-level directory of this distribution
7// for details of copyright and licensing.
8//
9// This program is free software: you can redistribute it and/or modify it
10// under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// This program is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17// See the GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with this program. If not, see <https://www.gnu.org/licenses/>.
21
31
32#ifndef TRIUMVIRATE_INCLUDE_PARAMETERS_HPP_INCLUDED_
33#define TRIUMVIRATE_INCLUDE_PARAMETERS_HPP_INCLUDED_
34
35#include <sys/stat.h>
36
37#include <fftw3.h>
38
39#include <algorithm>
40#include <cmath>
41#include <cstdio>
42#include <cstdlib>
43#include <cstring>
44#include <fstream>
45#include <string>
46
47#include "monitor.hpp"
48
49namespace trv {
50
59 public:
60 // ---------------------------------------------------------------------
61 // I/O
62 // ---------------------------------------------------------------------
63
65 std::string catalogue_dir;
67 std::string measurement_dir;
74 std::string catalogue_columns;
76 std::string catalogue_dataset;
78 std::string output_tag;
79
80 // ---------------------------------------------------------------------
81 // Mesh sampling
82 // ---------------------------------------------------------------------
83
84 // Mesh properties.
86 double boxsize[3] = {0., 0., 0.};
88 int ngrid[3] = {0, 0, 0};
90 double expand = 1.;
92 double cutoff_nyq = 0.;
93
94 // Mesh alignment.
96 std::string alignment = "centre";
98 std::string padscale = "box";
100 double padfactor = 0.;
101
102 // Mesh assignment.
104 std::string assignment = "tsc";
106 std::string interlace = "false";
107
108 // Derived mesh quantities.
109 double volume = 0.;
110 long long nmesh;
111
113
114 // ---------------------------------------------------------------------
115 // Measurement
116 // ---------------------------------------------------------------------
117
118 // Measurement type.
120 std::string catalogue_type;
123 std::string statistic_type;
124
125 // Derived measurement type.
126 std::string npoint;
127 std::string space;
128
129 // Measurement indexing.
131 int ell1 = 0;
133 int ell2 = 0;
135 int ELL = 0;
136
137 int i_wa = 0;
138 int j_wa = 0;
139
140 // Measurement choices.
144 std::string form = "diag";
145
148 std::string norm_convention = "particle";
149
150 // Derived measurement choices.
153 std::string shape = "diag";
154
155 // Measurement parameters.
158 std::string binning = "lin";
159
160 double bin_min = 0.;
161 double bin_max = 0.;
162
164 int num_bins = 0;
166 int idx_bin = 0;
167
168 // ---------------------------------------------------------------------
169 // Misc
170 // ---------------------------------------------------------------------
171
173 std::string fftw_scheme = "measure";
174
176 unsigned fftw_planner_flag = FFTW_MEASURE;
177
179 std::string use_fftw_wisdom = "false";
180
182 std::string fftw_wisdom_file_f;
183 std::string fftw_wisdom_file_b;
184
188 std::string save_binned_vectors = "false";
189
192 int verbose = 20;
193
195 std::string progbar = "false";
196
200 ParameterSet() = default;
201
206 ~ParameterSet() = default;
207
213 ParameterSet(const ParameterSet& other);
214
221 int read_from_file(char* parameter_filepath);
222
233 int validate(bool init = false);
234
242 int print_to_file(char* out_parameter_filepath);
243
252 int print_to_file();
253
254 private:
256 std::vector<std::string> data_catalogue_files;
257 std::vector<std::string> rand_catalogue_files;
258};
259
269
277 const double* spans, trv::ParameterSet& params
278);
279
287
288} // namespace trv
289
290#endif // !TRIUMVIRATE_INCLUDE_PARAMETERS_HPP_INCLUDED_
Parameter set.
std::string alignment
box alignment: {"centre" (default), "pad"}
std::string shape
std::string catalogue_columns
long long nmesh
number of mesh grid cells
double bin_min
measurement range minimum (in Mpc/h or h/Mpc)
std::string output_tag
output tag
std::string catalogue_dataset
catalogue dataset name/path (HDF5 catalogue files only)
double cutoff_nyq
Nyquist cutoff wavenumber or separation (in Mpc/h or h/Mpc)
std::string assignment
mesh assignment scheme: {"ngp", "cic", "tsc" (default), "pcs"}
std::string save_binned_vectors
int ELL
spherical degree associated with the line of sight
unsigned fftw_planner_flag
derived FFTW planner flag
int i_wa
first order of the wide-angle correction term
int print_to_file()
Print out extracted parameters to the default file path in the output measurement directory.
std::string catalogue_dir
catalogue directory
double padfactor
padding factor
ParameterSet()=default
Construct a parameter set.
std::string fftw_scheme
FFTW scheme: {"estimate", "measure" (default), "patient"}.
double volume
box volume (in Mpc^3/h^3)
~ParameterSet()=default
Destroy the parameter set.
int read_from_file(char *parameter_filepath)
Read parameters from a file.
std::string norm_convention
std::string statistic_type
std::string measurement_dir
measurement/output directory
std::string space
coordinate space: {"fourier", "config"}
std::string catalogue_type
catalogue type: {"survey", "random", "sim", "none"}
int ell1
spherical degree associated with the first wavevector
std::string fftw_wisdom_file_b
backward-transform wisdom file path
int num_bins
number of measurement bins
std::string padscale
padding scale (if alignment is "pad"): {"box" (default), "grid"}
std::string interlace
interlacing switch: {"true"/"on", "false"/"off" (default)}
double expand
box expansion factor (if boxsize is not given)
int assignment_order
order of the assignment scheme
std::string binning
std::string fftw_wisdom_file_f
derived FFTW wisdom file paths
int ell2
spherical degree associated with the second wavevector
int ngrid[3]
grid cell number in each dimension
std::string progbar
display a progress bar: {"true", "false" (default), <int-%-point>}
std::string data_catalogue_file
data catalogue file
std::string npoint
N-point case: {"2pt", "3pt", "none"}
int validate(bool init=false)
Validate parameters.
std::string rand_catalogue_file
random catalogue file
int idx_bin
fixed bin index in "off-fiag"/"row" form three-point measurements
int j_wa
second order of the wide-angle correction term
double boxsize[3]
box size (in Mpc/h) in each dimension
std::string use_fftw_wisdom
use FFTW wisdom: {"false" (default), <path-to-dir>}
double bin_max
measurement range maximum (in Mpc/h or h/Mpc)
Provide tracking of program resources and exceptions.
void set_ngrid_from_cutoff(trv::ParameterSet &params)
Set the grid cell numbers from the box size and the Nyquist cutoff.
void set_boxsize_from_expand(const double *spans, trv::ParameterSet &params)
Set the box size parameters from the box expansion factor.
void override_paramset_by_envvars(trv::ParameterSet &params)
Override parameter set by environment variables.