39 if (
pathstr.empty()) {
return false;}
46 if (
strcomp == 0) {
return false;}
69 if (std::filesystem::create_directories(
dir,
ec)) {
77 "Failed to create directory: %s",
dirstr.c_str()
81 "Failed to create directory: %s\n",
dirstr.c_str()
104 double norm_factor_part,
double norm_factor_mesh,
double norm_factor_meshes
108 "%s Data catalogue source: %s\n",
109 comment_delimiter, catalogue_data.
source.c_str()
113 "%s Data catalogue size: ntotal = %d, wtotal = %.3f, wstotal = %.3f\n",
119 "%s Data-source particle extents: "
120 "[(%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f)]\n",
128 "%s Random catalogue source: %s\n",
129 comment_delimiter, catalogue_rand.
source.c_str()
133 "%s Random catalogue size: ntotal = %d, wtotal = %.3f, wstotal = %.3f\n",
139 "%s Random-source particle extents: "
140 "[(%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f)]\n",
149 "%s Box size: [%.3f, %.3f, %.3f]\n",
155 "%s Box alignment: %s\n",
161 "%s Mesh number: [%d, %d, %d]\n",
167 "%s Mesh assignment and interlacing: %s, %s\n",
175 "%s Normalisation factor: %.9e (%s)\n",
182 "%s Normalisation factor: %.9e (%s)\n",
189 "%s Normalisation factor: %.9e (%s)\n",
196 "%s Normalisation factor: %.9e (%s)\n",
203 "%s Normalisation factor alternatives: "
204 "%.9e (particle), %.9e (mesh), %.9e (mesh-mixed)\n",
206 norm_factor_part, norm_factor_mesh, norm_factor_meshes
213 double norm_factor_part,
double norm_factor_mesh,
double norm_factor_meshes
217 "%s Catalogue source: %s\n",
218 comment_delimiter, catalogue.
source.c_str()
222 "%s Catalogue size: ntotal = %d, wtotal = %.3f, wstotal = %.3f\n",
227 "%s Catalogue particle extents: "
228 "[(%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f)]\n",
237 "%s Box size: [%.3f, %.3f, %.3f]\n",
243 "%s Box alignment: %s\n",
249 "%s Mesh number: [%d, %d, %d]\n",
255 "%s Mesh assignment and interlacing: %s, %s\n",
263 "%s Normalisation factor: %.9e (%s)\n",
270 "%s Normalisation factor: %.9e (%s)\n",
277 "%s Normalisation factor: %.9e (%s)\n",
284 "%s Normalisation factor: %.9e (%s)\n",
291 "%s Normalisation factor alternatives: "
292 "%.9e (particle), %.9e (mesh), %.9e (mesh-mixed)\n",
294 norm_factor_part, norm_factor_mesh, norm_factor_meshes
310 "%s Box size: [%.3f, %.3f, %.3f]\n",
316 "%s Mesh number: [%d, %d, %d]\n",
322 "%s Vector count: %d\n", comment_delimiter, binned_vectors.
count
326 "%s Bin number: %d\n", comment_delimiter, binned_vectors.
num_bins
333 "[0] bin_index, [1] bin_lower, [2] bin_upper, "
334 "[3] vec_x, [4] vec_y, [5] vec_z\n",
339 for (
int ivec = 0; ivec < binned_vectors.
count; ivec++) {
342 "%d\t%.9e\t%.9e\t% .9e\t% .9e\t% .9e\n",
346 binned_vectors.
vecx[ivec],
347 binned_vectors.
vecy[ivec],
348 binned_vectors.
vecz[ivec]
366 "[0] k_cen, [1] k_eff, [2] nmodes, "
367 "[3] Re{pk%d_raw}, [4] Im{pk%d_raw}, "
368 "[5] Re{pk%d_shot}, [6] Im{pk%d_shot}\n",
374 for (
int idx_dv = 0; idx_dv < meas_powspec.
dim; idx_dv++) {
377 "%.9e\t%.9e\t%10d\t% .9e\t% .9e\t% .9e\t% .9e\n",
378 meas_powspec.
kbin[idx_dv],
379 meas_powspec.
keff[idx_dv],
380 meas_powspec.
nmodes[idx_dv],
381 meas_powspec.
pk_raw[idx_dv].real(), meas_powspec.
pk_raw[idx_dv].imag(),
382 meas_powspec.
pk_shot[idx_dv].real(), meas_powspec.
pk_shot[idx_dv].imag()
394 "%s [0] r_cen, [1] r_eff, [2] npairs, [3] Re{xi%d}, [4] Im{xi%d}\n",
400 for (
int idx_dv = 0; idx_dv < meas_2pcf.
dim; idx_dv++) {
403 "%.9e\t%.9e\t%10d\t% .9e\t% .9e\n",
404 meas_2pcf.
rbin[idx_dv],
405 meas_2pcf.
reff[idx_dv],
407 meas_2pcf.
xi[idx_dv].real(), meas_2pcf.
xi[idx_dv].imag()
419 "%s [0] r_cen, [1] r_eff, [2] npairs, [3] Re{xi%d}, [4] Im{xi%d}\n",
425 for (
int idx_dv = 0; idx_dv < meas_2pcf_win.
dim; idx_dv++) {
428 "%.9e\t%.9e\t%10d\t% .9e\t% .9e\n",
429 meas_2pcf_win.
rbin[idx_dv],
430 meas_2pcf_win.
reff[idx_dv],
431 meas_2pcf_win.
npairs[idx_dv],
432 meas_2pcf_win.
xi[idx_dv].real(), meas_2pcf_win.
xi[idx_dv].imag()
446 char multipole_str[8];
448 multipole_str,
sizeof(multipole_str),
"%d%d%d",
456 "[0] k1_cen, [1] k1_eff, [2] nmodes_1, "
457 "[3] k2_cen, [4] k2_eff, [5] nmodes_2, "
458 "[6] Re{bk%s_raw}, [7] Im{bk%s_raw}, "
459 "[8] Re{bk%s_shot}, [9] Im{bk%s_shot}\n",
461 multipole_str, multipole_str, multipole_str, multipole_str
465 for (
int idx_dv = 0; idx_dv < meas_bispec.
dim; idx_dv++) {
468 "%.9e\t%.9e\t%10d\t%.9e\t%.9e\t%10d\t% .9e\t% .9e\t% .9e\t% .9e\n",
473 meas_bispec.
bk_raw[idx_dv].real(), meas_bispec.
bk_raw[idx_dv].imag(),
474 meas_bispec.
bk_shot[idx_dv].real(), meas_bispec.
bk_shot[idx_dv].imag()
483 char multipole_str[8];
485 multipole_str,
sizeof(multipole_str),
"%d%d%d",
493 "[0] r1_cen, [1] r1_eff, [2] npairs_1, "
494 "[3] r2_cen, [4] r2_eff, [5] npairs_2, "
495 "[6] Re{zeta%s_raw}, [7] Im{zeta%s_raw}, "
496 "[8] Re{zeta%s_shot}, [9] Im{zeta%s_shot}\n",
498 multipole_str, multipole_str, multipole_str, multipole_str
502 for (
int idx_dv = 0; idx_dv < meas_3pcf.
dim; idx_dv++) {
505 "%.9e\t%.9e\t%10d\t%.9e\t%.9e\t%10d\t% .9e\t% .9e\t% .9e\t% .9e\n",
520 char multipole_str[8];
522 multipole_str,
sizeof(multipole_str),
"%d%d%d",
530 "[0] r1_cen, [1] r1_eff, [2] npairs_1, "
531 "[3] r2_cen, [4] r2_eff, [5] npairs_2, "
532 "[6] Re{zeta%s_raw}, [7] Im{zeta%s_raw}, "
533 "[8] Re{zeta%s_shot}, [9] Im{zeta%s_shot}\n",
535 multipole_str, multipole_str, multipole_str, multipole_str
539 for (
int idx_dv = 0; idx_dv < meas_3pcf_win.
dim; idx_dv++) {
542 "%.9e\t%.9e\t%10d\t%.9e\t%.9e\t%10d\t% .9e\t% .9e\t% .9e\t% .9e\n",
543 meas_3pcf_win.
r1_bin[idx_dv], meas_3pcf_win.
r1_eff[idx_dv],
545 meas_3pcf_win.
r2_bin[idx_dv], meas_3pcf_win.
r2_eff[idx_dv],
547 meas_3pcf_win.
zeta_raw[idx_dv].real(),
548 meas_3pcf_win.
zeta_raw[idx_dv].imag(),
std::string alignment
box alignment: {"centre" (default), "pad"}
std::string assignment
mesh assignment scheme: {"ngp", "cic", "tsc" (default), "pcs"}
int ELL
spherical degree associated with the line of sight
std::string norm_convention
int ell1
spherical degree associated with the first wavevector
std::string interlace
interlacing switch: {"true"/"on", "false"/"off" (default)}
int ell2
spherical degree associated with the second wavevector
int ngrid[3]
grid number in each dimension
double boxsize[3]
box size (in Mpc/h) in each dimension
std::string source
catalogue source
double pos_min[3]
minimum values of particle coordinates
int ntotal
total number of particles
double wtotal
total overall weight of particles
double wstotal
total sample weight of particles
double pos_max[3]
maximum values of particle coordinates
Exception raised when an input/output operation fails.
void info(const char *fmt_string,...)
Emit a information-level message.
void error(const char *fmt_string,...)
Emit a warning-level message.
I/O support including custom exceptions and utility functions.
void print_binned_vectors_to_file(std::FILE *fileptr, trv::ParameterSet ¶ms, trv::BinnedVectors &binned_vectors)
Print binned vectors to a file.
void print_measurement_header_to_file(std::FILE *fileptr, trv::ParameterSet ¶ms, trv::ParticleCatalogue &catalogue_data, trv::ParticleCatalogue &catalogue_rand, double norm_factor_part, double norm_factor_mesh, double norm_factor_meshes)
Print the pre-measurement header to a file including information about the catalogue(s) and mesh grid...
void print_measurement_datatab_to_file(std::FILE *fileptr, trv::ParameterSet ¶ms, trv::PowspecMeasurements &meas_powspec)
Print measurements as a data table to a file.
double size_in_gb(long long num)
Return size in gibibytes.
Logger logger
default logger (at NSET logging level)
void make_write_dir(std::string dirstr)
Make write directory.
bool if_filepath_is_set(const std::string &pathstr)
Check if a file path is set.
std::vector< double > vecy
y-components
std::vector< double > vecz
z-components
int count
number of vectors
int num_bins
number of bins
std::vector< double > upper_edges
upper bin edges
std::vector< double > lower_edges
lower bin edges
std::vector< double > vecx
x-components
std::vector< int > indices
bin indices
std::vector< std::complex< double > > bk_raw
bispectrum raw measurements (with normalisation and shot noise)
std::vector< double > k2_eff
second effective wavenumber in bins
std::vector< int > nmodes_2
std::vector< std::complex< double > > bk_shot
bispectrum shot noise
std::vector< double > k1_bin
first central wavenumber in bins
std::vector< double > k1_eff
first effective wavenumber in bins
std::vector< double > k2_bin
second central wavenumber in bins
int dim
dimension of data vector
std::vector< int > nmodes_1
number of first wavevectors in bins
Power spectrum measurements.
int dim
dimension of data vector
std::vector< double > kbin
central wavenumber in bins
std::vector< int > nmodes
std::vector< std::complex< double > > pk_shot
power spectrum shot noise
std::vector< double > keff
effective wavenumber in bins
std::vector< std::complex< double > > pk_raw
power spectrum raw measurements (with normalisation and shot noise)
Three-point correlation function measurements.
std::vector< double > r2_bin
second central separation in bins
std::vector< int > npairs_1
number of first separation vectors in bins
std::vector< double > r1_bin
first central separation in bins
std::vector< std::complex< double > > zeta_shot
three-point correlation function shot noise
std::vector< double > r2_eff
std::vector< std::complex< double > > zeta_raw
std::vector< double > r1_eff
first effective separation in bins
std::vector< int > npairs_2
number of second separation vectors in bins
int dim
dimension of data vector
Three-point correlation function window measurements.
std::vector< std::complex< double > > zeta_shot
three-point correlation function window shot noise
std::vector< int > npairs_2
number of second separation vectors in bins
std::vector< int > npairs_1
number of first separation vectors in bins
std::vector< double > r1_eff
first effective separation in bins
std::vector< double > r2_eff
int dim
dimension of data vector
std::vector< double > r2_bin
second central separation in bins
std::vector< double > r1_bin
first central separation in bins
std::vector< std::complex< double > > zeta_raw
Two-point correlation function measurements.
std::vector< double > rbin
central separation in bins
std::vector< int > npairs
int dim
dimension of data vector
std::vector< std::complex< double > > xi
two-point correlation function measurements (with normalisation)
std::vector< double > reff
effective separation in bins
Two-point correlation function window measurements.
std::vector< std::complex< double > > xi
int dim
dimension of data vector
std::vector< double > reff
effective separation in bins
std::vector< double > rbin
central separation in bins
std::vector< int > npairs