40 using namespace catalogue;
41 using namespace chainmesh;
43 using namespace pairs;
44 using namespace measure;
45 using namespace twopt;
55 if (!m_data->isSetVar(Var::_RA_) || !m_data->isSetVar(Var::_Dec_) || !m_data->isSetVar(Var::_Dc_))
56 m_data->computePolarCoordinates();
58 if (!m_data2->isSetVar(Var::_RA_) || !m_data2->isSetVar(Var::_Dec_) || !m_data2->isSetVar(Var::_Dc_))
59 m_data2->computePolarCoordinates();
61 if (!m_random->isSetVar(Var::_RA_) || !m_random->isSetVar(Var::_Dec_) || !m_random->isSetVar(Var::_Dc_))
62 m_random->computePolarCoordinates();
64 if (type==TwoPType::_angular_) {
65 m_data->normalizeComovingCoordinates();
66 m_data2->normalizeComovingCoordinates();
67 m_random->normalizeComovingCoordinates();
73 if (estimator==Estimator::_natural_ && m_random_dilution_fraction!=1.) {
74 m_random_dilution_fraction = 1.;
75 WarningMsgCBL(
"m_random_dilution_fraction = 1, since the random catalogue is not diluted when using the natural estimator!",
"count_allPairs",
"TwoPointCorrelation.cpp");
78 auto random_dil = make_shared<catalogue::Catalogue>(
catalogue::Catalogue(move(m_random->diluted_catalogue(m_random_dilution_fraction))));
86 if (type==TwoPType::_monopole_ || type==TwoPType::_filtered_ || type==TwoPType::_multipoles_direct_) {
87 rMAX = m_d1d2->sMax();
88 rMIN = m_d1d2->sMin();
91 else if (type==TwoPType::_angular_) {
94 rMAX = sqrt(xx*xx+zz*zz);
96 rMIN = sqrt(xx*xx+zz*zz);
99 else if (type==TwoPType::_2D_polar_ || type==TwoPType::_multipoles_integrated_ || type ==TwoPType::_wedges_) {
100 rMAX = m_d1d2->sMax_D1();
101 rMIN = m_d1d2->sMin_D1();
104 else if (type==TwoPType::_2D_Cartesian_ || type==TwoPType::_projected_ || type==TwoPType::_deprojected_) {
105 rMAX = max(m_d1d2->sMax_D1(), m_d1d2->sMax_D2())*sqrt(2.);
106 rMIN = max(m_d1d2->sMin_D1(), m_d1d2->sMin_D2())*sqrt(2.);
110 ErrorCBL(
"the chosen two-point correlation function type is uknown!",
"count_allPairs",
"TwoPointCorrelationCross.cpp");
112 double cell_size = fact*rMAX;
117 ChM_data1data2.
set_par(cell_size, m_data2, rMAX, rMIN);
120 ChM_random_dil.
set_par(cell_size, random_dil, rMAX, rMIN);
123 ChM_data1random.
set_par(cell_size, m_random, rMAX, rMIN);
126 ChM_data2random.
set_par(cell_size, m_random, rMAX, rMIN);
137 count_pairs(m_data, ChM_data1data2, m_d1d2,
true, tcount);
138 if (dir_output_pairs!=
par::defaultString) write_pairs(m_d1d2, dir_output_pairs, file);
140 else read_pairs(m_d1d2, dir_input_pairs, file);
147 count_pairs(random_dil, ChM_random_dil, m_rr,
false, tcount);
150 else read_pairs(m_rr, dir_input_pairs, file);
157 count_pairs(m_data, ChM_data1random, m_d1r,
true, tcount);
160 else read_pairs(m_d1r, dir_input_pairs, file);
167 count_pairs(m_data2, ChM_data2random, m_d2r,
true, tcount);
170 else read_pairs(m_d2r, dir_input_pairs, file);
176 if (count_rr || count_d1r || count_d2r)
179 if (type==TwoPType::_angular_) {
180 m_data->restoreComovingCoordinates();
181 m_data2->restoreComovingCoordinates();
182 m_random->restoreComovingCoordinates();
191 double TwoPointCorrelationCross::PoissonError (
const Estimator estimator,
const double d1d2,
const double rr,
const double d1r,
const double d2r,
const int nData1,
const int nData2,
const int nRandom)
const
193 (void)estimator; (void)d1d2; (void)rr; (void)d1r; (void)d2r; (void)nData1; (void)nData2; (void)nRandom;
195 WarningMsgCBL(
"the PoissonError has still to be implemented for the cross-correlation function",
"PoissonError",
"TwoPointCorrelation.cpp");
#define coutCBL
CBL print message.
The class TwoPointCorrelationCross.
The class ChainMesh_Catalogue.
void set_par(const double cell_size, std::shared_ptr< catalogue::Catalogue > cat, const double rmax, const double rmin=-1.)
function that set parameters for the chain-mesh
void count_allPairs(const TwoPType type, const std::string dir_output_pairs=par::defaultString, const std::vector< std::string > dir_input_pairs={}, const bool count_d1d2=true, const bool count_rr=true, const bool count_d1r=true, const bool count_d2r=true, const bool tcount=true, const Estimator estimator=Estimator::_SzapudiSzalay_, const double fact=0.1)
count the data-data, random-random and data-random pairs, used to construct the estimator of the two-...
static const std::string col_green
green colour (used when printing something on the screen)
static const std::string col_default
default colour (used when printing something on the screen)
static const std::string defaultString
default std::string value
Estimator
the two-point correlation estimator
TwoPType
the two-point correlation function type
The global namespace of the CosmoBolognaLib
void cartesian_coord(const double ra, const double dec, const double dd, double &XX, double &YY, double &ZZ)
conversion from polar coordinates to Cartesian coordinates
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
double radians(const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_degrees_)
conversion to radians
void WarningMsgCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL)
internal CBL warning message