Commit 6d4e2ccd authored by DAVIDZON Iary's avatar DAVIDZON Iary
Browse files

basic implementation

parent 09f46300
......@@ -328,7 +328,7 @@ void onesource::generatePDF(vector<SED*> fulllib,const vector<double> gridz, con
#endif
// Loop over all SEDs
for (vector<SED*>::iterator it=fulllib.begin(); it!=fulllib.end(); ++it){
for (vector<SED*>::iterator it=fulllib.begin(); it<fulllib.end(); ++it){
// Check that the model has a defined probability
......@@ -737,6 +737,25 @@ void onesource::write_pdz(const string pdztype, ofstream & stpdz){
return;
}
// write the PDF(M*)
void onesource::write_pdm(ofstream & stpdz){
// Write the id of the source
stpdz << setw(15) << std::fixed << setprecision(0) << spec << " " ;
// In the case where the PDF should be bayesian
// Write the PDZ done with the bayesian method
// for(int k=0;k<PDFmass.vPDF.size();k++) {stpdz << setw(16) << std::fixed << setprecision(6) << PDFmass.vPDF[k] << " "; }
for(int k=0;k<10;k++) {stpdz << setw(16) << std::fixed << setprecision(6) << PDFmass.vPDF[k] << " "; }
stpdz << endl;
return;
}
/*
INTERPOLATE LINEARILY IN THE LIBRARY
Do it only for GAL
......@@ -1265,7 +1284,7 @@ void onesource::writeSpec(vector<SED*> fulllib, cosmo lcdm,vector<opa> opaAll, v
if(zmin[0]>0)SED_gal.generate_spectra(zmin[0],dmmin[0],opaAll);
// GAL: Loop over the full vector with the two vectors concatenated, put the SED in magnitude
for (vector<oneElLambda>::iterator it=SED_gal.lamb_flux.begin(); it!=SED_gal.lamb_flux.end(); ++it){
for (vector<oneElLambda>::iterator it=SED_gal.lamb_flux.begin(); it<SED_gal.lamb_flux.end(); ++it){
if(it->lamb>minl && it->lamb<maxl){
lG.push_back(it->lamb) ;
if(it->val*pow(it->lamb,2.)>0){
......@@ -1296,7 +1315,7 @@ void onesource::writeSpec(vector<SED*> fulllib, cosmo lcdm,vector<opa> opaAll, v
if(zmin[1]>0)SED_QSO.generate_spectra(zmin[1],dmmin[1],opaAll);
// QSO: Loop over the full vector with the two vectors concatenated, put the SED in magnitude
for (vector<oneElLambda>::iterator it=SED_QSO.lamb_flux.begin(); it!=SED_QSO.lamb_flux.end(); ++it){
for (vector<oneElLambda>::iterator it=SED_QSO.lamb_flux.begin(); it<SED_QSO.lamb_flux.end(); ++it){
if(it->lamb>minl && it->lamb<maxl && (it->val*pow(it->lamb,2.))>0){lQ.push_back(it->lamb) ; mQ.push_back(-2.5*log10(it->val*pow(it->lamb,2.)/c)-48.59 + lcdm.distMod(zmin[1]));
}
}
......@@ -1315,7 +1334,7 @@ void onesource::writeSpec(vector<SED*> fulllib, cosmo lcdm,vector<opa> opaAll, v
SED_Star.generate_spectra(dmmin[2]);
// Loop over the full vector with the two vectors concatenated, put the SED in magnitude
for (vector<oneElLambda>::iterator it=SED_Star.lamb_flux.begin(); it!=SED_Star.lamb_flux.end(); ++it){
for (vector<oneElLambda>::iterator it=SED_Star.lamb_flux.begin(); it<SED_Star.lamb_flux.end(); ++it){
if(it->lamb>minl && it->lamb<maxl && (it->val*pow(it->lamb,2.))>0) {lS.push_back(it->lamb) ; mS.push_back(-2.5*log10(it->val*pow(it->lamb,2.)/c)-48.59);
}
}
......
......@@ -118,13 +118,14 @@ class onesource
void fit(vector<SED*> fulllib,const int imagm,const vector<double> gridz, const string zfix, const double consideredZ, const double lmasi, const double lmass,const double magabsB[2], const double magabsF[2], const double funz0, const int bp[2]);
void write_out(vector<SED*> fulllib, ofstream & stout, vector<string> outkeywords);
void write_pdz(const string pdztype, ofstream & stpdz);
void write_pdm(ofstream & stpdz);
void convertMag();
void keepOri();
void interp(const string zfix, const string zintp);
void uncertaintiesMin();
void uncertaintiesBay();
void secondpeak(vector<SED*> fulllib, const double dz_win,const double min_thres);
void generatePDF(vector<SED*> fulllib,const vector<double> gridz, const vector<int> fltColRF,int fltREF);
void generatePDF(vector<SED*> fulllib,const vector<double> gridz, const vector<int> fltColRF,int fltREF);
void interp_lib(vector<SED*> fulllib,const int imagm, cosmo lcdm);
void adapt_mag(vector<double> a0,vector<double> a1);
void absmag(vector<vector<int>> bestFlt, vector<vector<double>> maxkcolor, cosmo lcdm, vector<double> gridz );
......
......@@ -769,7 +769,10 @@ int main (int argc, char *argv[])
if(outsp[0]=='y' || outsp[0]=='Y')oneObj.writeSpec(fullLib,lcdm,opaOut.opaAll,allFilters);
// write the PDF
if (outpdz.compare(nonestring) != 0)oneObj.write_pdz(pdztype,stpdz);
if (outpdz.compare(nonestring) != 0){
oneObj.write_pdz(pdztype,stpdz);
oneObj.write_pdm(stpdz);
}
/*
// Computes proba in various intervals of z
oneObj.probaz();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment