Changeset 899 in Sophya
- Timestamp:
- Apr 13, 2000, 9:44:30 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PMixer/skymixer.cc
r886 r899 103 103 try { 104 104 string dcard = arg[1]; 105 cout << " Decoding parameters from file " << dcard << endl;105 if(printlev > 1) cout << " Decoding parameters from file " << dcard << endl; 106 106 dc.ReadFile(dcard); 107 107 … … 134 134 ifnm[255] = '\0'; 135 135 cout << " Reading output HealPix map from FITS file " << (string)ifnm << endl; 136 FITS_SphereHEALPix<float> fios(ifnm); 137 outgs = (SphereHEALPix<float>)fios; 138 cout << " Output HealPIx Map read - NbPixels= " << outgs.NbPixels() << endl; 136 { 137 FITS_SphereHEALPix<float> fios(ifnm); 138 outgs = (SphereHEALPix<float>)fios; 139 } 140 if(printlev>0) 141 cout << " Output HealPIx Map read - NbPixels= " << 142 outgs.NbPixels() << endl; 139 143 if (printlev > 0) { 140 144 MeanSig(outgs.DataBlock(), moy, sig ); 141 cout << " MeanSig for outpout map - Mean= " << moy << " Sigma= " << sig << endl; 145 cout << " MeanSig for outpout map - Mean= " << 146 moy << " Sigma= " << sig << endl; 142 147 } 143 148 } 144 149 else { 145 cout << " Output HealPix Map created - NbPixels= " << outgs.NbPixels() << endl; 150 if(printlev>0) 151 cout << " Output HealPix Map created - NbPixels= " << 152 outgs.NbPixels() << endl; 146 153 outgs.SetPixels(0.); 147 154 } … … 160 167 int sk; 161 168 for(sk = 0; sk<nskycomp; sk++) { 169 cout << "------------------------------------" << endl; 162 170 cout << " Processing sky component No " << sk+1 << endl; 163 171 … … 168 176 K = dc.DParam(key, 1, 1.); 169 177 170 bool mapDependentOfFreq = false;171 key = (string)"BETAFITSFILE"+ buff;172 if(dc.HasKey(key))173 {174 mapDependentOfFreq = true;175 }176 cout << "the map has a mapDependentOfFreq = " <<177 mapDependentOfFreq << endl;178 178 179 179 cout << " Reading Input FITS map " << (string)flnm << endl; 180 FITS_SphereHEALPix<float> fiosIn(flnm); 181 SphereHEALPix<float> ings = (SphereHEALPix<float>)fiosIn; 182 180 SphereHEALPix<float> ings(hp_nside); 181 { 182 FITS_SphereHEALPix<float> fiosIn(flnm); 183 ings = (SphereHEALPix<float>)fiosIn; 184 } 183 185 if (debuglev > 4) { // Writing the input map to the outppf 184 186 FIO_SphereHEALPix<float> fiog(ings); … … 189 191 cout << " MeanSig for input map - Mean= " << moy << " Sigma= " << sig << endl; 190 192 } 193 bool mapDependentOfFreq = false; 194 key = (string)"BETAFITSFILE"+ buff; 195 if(dc.HasKey(key)) 196 { 197 mapDependentOfFreq = true; 198 } 199 191 200 // getting Emission spectra 192 201 if(!mapDependentOfFreq) … … 206 215 if (printlev > 4) cout << "....BetaFits... NSide for Integration map = " << nSideForInt << endl; 207 216 cout << "....BetaFits... Reading Beta FITS map " << (string)flnm << endl; 208 209 FITS_SphereHEALPix<float> fiosBM(flnm); 210 SphereHEALPix<float> betaMap = (SphereHEALPix<float>)fiosBM; 211 217 SphereHEALPix<float> betaMap(hp_nside); 218 { 219 FITS_SphereHEALPix<float> fiosBM(flnm); 220 betaMap = (SphereHEALPix<float>)fiosBM; 221 } 222 if (debuglev > 4) { // Writing the input map to the outppf 223 FIO_SphereHEALPix<float> fiogs(betaMap); 224 fiogs.Write(*so, key); 225 } 226 212 227 if(nSideForInt<0) nSideForInt = sqrt((double)betaMap.NbPixels()/12); 213 214 228 bool bydefault = true; 215 229 if(!bydefault) … … 220 234 SphereHEALPix<float> intBetaMap(nSideForInt); 221 235 integratedMap(*sr, betaMap, normFreq, intBetaMap); 236 if (debuglev > 4) { // Writing the input map to the outppf 237 FIO_SphereHEALPix<float> fiogs2(intBetaMap); 238 fiogs2.Write(*so, "INTBETAMAP"); 239 } 240 222 241 betaMap.Resize(8); 223 242 MeanSig(intBetaMap.DataBlock(), moy, sig ); … … 226 245 addComponentBeta(outgs,ings,intBetaMap, K); 227 246 } 228 MeanSig(outgs.DataBlock(), moy, sig );229 cout << " MeanSig for Sum map - Mean= " << moy << " Sigma= " << sig << endl;230 247 } 231 248 232 if (printlev > 1) {233 MeanSig(outgs.DataBlock(), moy, sig );234 cout << " MeanSig for Sum map - Mean= " << moy << " Sigma= " << sig<< endl;235 }236 sprintf(buff, "End of Proc . Comp.%d ", sk+1);249 MeanSig(outgs.DataBlock(), moy, sig ); 250 cout << " MeanSig for Sum map - Mean= " << moy << " Sigma= " << sig << endl; 251 cout << "-------------------------------------------------" << endl; 252 253 sprintf(buff, "End of Processing Component %d ", sk+1); 237 254 PrtTim(buff); 238 255 } … … 250 267 cout << "Output Map (SphereHEALPix<float>) written to FITS file " 251 268 << (string)(arg[2]) << endl; 252 FITS_SphereHEALPix<float> fios2(outgs); 253 fios2.Write(arg[2]); 269 { 270 FITS_SphereHEALPix<float> fios2(outgs); 271 fios2.Write(arg[2]); 272 } 254 273 PrtTim("End of WriteFITS "); 255 274 // Saving the output map in PPF format … … 417 436 } 418 437 if (filt == NULL) throw ParmError("datacard error ! No detection filter"); 419 cout << " Filter decoded - Created " << endl; 420 cout << *filt << endl; 421 422 // for debug 438 if(printlev>0) 439 { 440 cout << endl; 441 cout << " Filter decoded - Created " << endl; 442 cout << *filt << endl; 443 } 444 // for debug 423 445 if (debuglev > 1) SpectralResponse2Nt(*filt, *so, ppfname); 424 446 return(filt); … … 542 564 SphereHEALPix<T>& intBetaMap) 543 565 { 544 // int nbpix = intBetaMap.NbPixels(); 545 // SphereHEALPix<T> newMap(sqrt((double)nbpix/12)); 546 Sph2Sph(betaMap,intBetaMap); 547 for(int i=0; i<intBetaMap.NbPixels(); i++) 548 { 549 RadSpectra* rs = new PowerLawSpectra 550 (1.,-intBetaMap(i), 0., normFreq); 551 double coeff = rs->filteredIntegratedFlux(sr); 552 intBetaMap(i) = coeff; 566 PowerLawSpectra rs(1.,-2., 0., normFreq); 567 568 if(betaMap.NbPixels()!=intBetaMap.NbPixels()) 569 { 570 Sph2Sph(betaMap,intBetaMap); 571 for(int i=0; i<intBetaMap.NbPixels(); i++) 572 { 573 rs.setExp(-intBetaMap(i)); 574 double coeff = rs.filteredIntegratedFlux(sr); 575 intBetaMap(i) = coeff; 576 } 577 } 578 else 579 { 580 for(int i=0; i<intBetaMap.NbPixels(); i++) 581 { 582 rs.setExp(-betaMap(i)); 583 double coeff = rs.filteredIntegratedFlux(sr); 584 intBetaMap(i) = coeff; 585 } 553 586 } 554 587 } … … 575 608 if(nbpix != intBetaMap.NbPixels()) 576 609 { 577 cout << "nbpix != intBetaMap.NbPixels()" << endl;578 SphereHEALPix<T> bigBetaMap(sqrt((double)nbpix/12));579 cout << "new map with size corresponding to mapToAdd" << sqrt((double)nbpix/12) << endl;580 Sph2Sph(intBetaMap,bigBetaMap);581 610 for(int i=0; i<finalMap.NbPixels();i++) 582 611 { 583 finalMap(i) += coeff*mapToAdd(i)*bigBetaMap(i); 612 double teta,phi,val; 613 finalMap.PixThetaPhi(i, teta, phi); 614 int pixel = intBetaMap.PixIndexSph(teta,phi); 615 val = intBetaMap.PixVal(pixel); 616 finalMap(i) += coeff*mapToAdd(i)*val; 584 617 } 585 618 } … … 638 671 delete[] cnt; 639 672 640 printf("Sph2Sph_Info NbPix In= %d Out= %d CntMoy,Sig= %g %g\n", 641 in.NbPixels(), out.NbPixels(), moy, sig); 642 PrtTim("End of Sph2Sph() "); 673 if(printlev>2) 674 { 675 printf("Sph2Sph_Info NbPix In= %d Out= %d CntMoy,Sig= %g %g\n", 676 in.NbPixels(), out.NbPixels(), moy, sig); 677 PrtTim("End of Sph2Sph() "); 678 } 643 679 } 644 680
Note:
See TracChangeset
for help on using the changeset viewer.