#include "machdefs.h" #include #include #include #include #include #include #include "timing.h" #include "sambainit.h" #include "pexceptions.h" #include "datacards.h" #include "fitsioserver.h" #include "spheregorski.h" #include "radspecvector.h" #include "blackbody.h" #include "nupower.h" #include "squarefilt.h" #include "trianglefilt.h" #include "specrespvector.h" #include "gaussfilt.h" // ------ Function declaration void addComponent(SpectralResponse& sr, PixelMap& finalMap, PixelMap& mapToAdd, RadSpectra& rs, double K=1.); void addComponent(SpectralResponse& sr, PixelMap& finalMap, PixelMap& mapToAdd, RadSpectra& rs, double K=1.); // ------------------------------------------------------------------------- // main program // ------------------------------------------------------------------------- int main(int narg, char * arg[]) { if ((narg < 2) || (strcmp(arg[1], "-h") == 0) ) { cout << " skymixer / Error args \n Usage: skymixer parameterFile " << endl; exit(0); } InitTim(); string msg; int rc = 0; try { string dcard = arg[1]; cout << " Decoding parameters from file " << dcard << endl; DataCards dc(dcard); // Cheking datacards if ( (!dc.HasKey("SKYMIX")) || (!dc.HasKey("FILTER")) ) { rc = 71; msg = "Invalid parameters - NO @SKYMIX or @FILTER card "; goto problem; } // Decoding number of component and pixelisation parameter int mg = 32; int ncomp = 0; ncomp = dc.IParam("SKYMIX", 0, 0); mg = dc.IParam("SKYMIX", 1, 32); if (ncomp < 1) { msg = "Invalid parameters - Check datacards @SKYMIX "; rc = 72; goto problem; } int kc; string key; char buff[256]; bool pb = false; for(kc=0; kc Rc= " << rc << endl; cerr << " Msg= " << msg << endl; return(rc); } // template void addComponent(SpectralResponse& sr, PixelMap& finalMap, PixelMap& mapToAdd, RadSpectra& rs, double K) { // finalMap = finalMap + coeff* mapToAdd // coeff = convolution of sr and rs // compute the coefficient corresponding to mapToAdd if (finalMap.NbPixels() != mapToAdd.NbPixels()) throw SzMismatchError("addComponent()/Error: Unequal number of Input/Output map pixels"); double coeff = rs.filteredIntegratedFlux(sr) * K; for(int i=0; i& finalMap, PixelMap& mapToAdd, RadSpectra& rs, double K) { // finalMap = finalMap + coeff* mapToAdd // coeff = convolution of sr and rs // compute the coefficient corresponding to mapToAdd if (finalMap.NbPixels() != mapToAdd.NbPixels()) throw SzMismatchError("addComponent()/Error: Unequal number of Input/Output map pixels"); double coeff = rs.filteredIntegratedFlux(sr) * K; for(int i=0; i