Changeset 1252 in Sophya
- Timestamp:
- Oct 24, 2000, 11:12:33 AM (25 years ago)
- Location:
- trunk/SophyaProg/PMixer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PMixer/skymixer.cc
r1239 r1252 29 29 SpectralResponse * getSpectralResponse(DataCards & dc); 30 30 RadSpectra * getEmissionSpectra(DataCards & dc, int nc); 31 void SKM_MergeFITSKeywords(char * flnm); 31 32 void RadSpec2Nt(RadSpectra & rs, POutPersist & so, string name); 32 33 void SpectralResponse2Nt(SpectralResponse& sr, POutPersist & so, string name); 33 34 34 35 // to add different sky components and corresponding tools 35 36 //---------------------------------------------------------- … … 68 69 static int debuglev = 0; // Debug Level 69 70 static int printlev = 0; // Print Level 70 static POutPersist * so = NULL; // Debug PPFOut file 71 static POutPersist * so = NULL; // Debug PPFOut file 72 static DVList * dvl_fitskw = NULL; // Global DVList for all FITS Keywords 73 74 // --------- SkyMixer Version -------------- 75 static double skm_version = 1.4; 71 76 72 77 // ------------------------------------------------------------------------- … … 90 95 DataCards dc; 91 96 so = NULL; 97 // DVList for merging all FITS keywords 98 dvl_fitskw = new DVList; 92 99 93 100 try { … … 127 134 FITS_SphereHEALPix<float> fios(&outgs); 128 135 fios.Read(ifnm,2); 136 // Getting FITS keywords in primary header 137 SKM_MergeFITSKeywords(ifnm); 129 138 } 130 139 if(printlev>0) … … 190 199 FITS_SphereHEALPix<float> fiosIn(&ings); 191 200 fiosIn.Read(flnm,2); 201 // Getting FITS keywords in primary header 202 SKM_MergeFITSKeywords(flnm); 192 203 } 193 204 if (debuglev > 4) { // Writing the input map to the outppf … … 227 238 FITS_SphereHEALPix<float> fiosBM(&betaMap); 228 239 fiosBM.Read(flnm,2); 240 // Getting FITS keywords in primary header 241 SKM_MergeFITSKeywords(flnm); 229 242 } 230 243 if (printlev > 2) { … … 288 301 FitsOutFile fios(arg[2]); 289 302 fios.firstImageOnPrimaryHeader(false); // Use secondary header 303 DVList& dvl = (*dvl_fitskw); 304 dvl["PDMTYPE"] = "COMPMAP"; 305 dvl.SetComment("PDMTYPE", "Planck Data Model Type"); 306 dvl["SOPHYVER"] = SophyaVersion(); 307 dvl.SetComment("SOPHYVER", "Sophya Version number"); 308 dvl["SKYMVER"] = skm_version; 309 dvl.SetComment("SKYMVER", "skymixer Version number"); 310 fios.DVListIntoPrimaryHeader(dvl); 290 311 fios << outgs ; 291 312 } … … 450 471 fiis.firstImageOnPrimaryHeader(false); // Use secondary header HDU=2 451 472 fiis >> mtx ; 473 // Getting FITS keywords in primary header 474 SKM_MergeFITSKeywords(ifnm); 452 475 double numin = dc.DParam(key, 2, 1.); 453 476 double numax = dc.DParam(key, 3, 9999.); … … 502 525 fiis.firstImageOnPrimaryHeader(false); // Use secondary header HDU=2 503 526 fiis >> mtx ; 527 // Getting FITS keywords in primary header 528 SKM_MergeFITSKeywords(ifnm); 504 529 double numin = dc.DParam(key, 2, 1.); 505 530 double numax = dc.DParam(key, 3, 9999.); … … 702 727 703 728 /* Nouvelle-Fonction */ 729 void SKM_MergeFITSKeywords(char * flnm) 730 { 731 DVList dvl; 732 FitsFile::FitsExtensionType typeOfExtension; 733 int naxis; 734 vector<int> naxisn; 735 FitsFile::FitsDataType dataType; 736 FitsInFile::GetBlockType(flnm, 1, typeOfExtension, naxis, naxisn, dataType, dvl); 737 // Cleaning the keywords 738 #define SZexlst 21 739 char *exlst[SZexlst]= 740 {"SIMPLE","BITPIX" ,"NAXIS" ,"NAXIS#" ,"PCOUNT","GCOUNT", 741 "EXTEND","ORIGIN" ,"DATE*" ,"TFIELDS","TTYPE#","TFORM#", 742 "TUNIT#","EXTNAME","CTYPE#","CRVAL#" ,"CRPIX#","CDELT#", 743 "XTENSION","INSTRUME","TELESCOP"}; 744 char kwex[32]; 745 int i,l; 746 for (i=0; i<SZexlst; i++) { 747 strncpy(kwex, exlst[i], 32); 748 l = strlen(kwex)-1; 749 if ((kwex[l] != '*') && (kwex[l] != '#')) { 750 dvl.DeleteKey(kwex); 751 } 752 else { 753 bool fgd = (kwex[l] == '#') ? true : false; 754 list<string> lstsup; 755 kwex[l] = '\0'; 756 DVList::ValList::const_iterator it; 757 for (it = dvl.Begin(); it != dvl.End(); it++) { 758 if ((*it).first.substr(0,l) != kwex) continue; 759 if (fgd && !isdigit((*it).first[l])) continue; 760 lstsup.push_back((*it).first); 761 } 762 list<string>::iterator it2; 763 for (it2 = lstsup.begin(); it2 != lstsup.end(); it2++) 764 dvl.DeleteKey(*it2); 765 } 766 } 767 dvl_fitskw->Merge(dvl); 768 } 704 769 705 770 /* Nouvelle-Fonction */ -
trunk/SophyaProg/PMixer/tgrsr.cc
r1239 r1252 135 135 FitsOutFile fios(arg[4]); 136 136 fios.firstImageOnPrimaryHeader(false); // use secondary header 137 DVList dvl; 138 if (typ == 0) 139 dvl["PDMTYPE"] = "FGRSPEC"; 140 dvl.SetComment("PDMTYPE", "Planck Data Model Type"); 141 dvl["SOPHYVER"] = SophyaVersion(); 142 dvl.SetComment("SOPHYVER", "Sophya Version"); 143 dvl["TGRSRKW"] = "Test Keyword from tgrsr.cc"; 144 fios.DVListIntoPrimaryHeader(dvl); 137 145 fios << mtx ; 138 146 PrtTim("End of Matrix->FITS "); -
trunk/SophyaProg/PMixer/tgsky.cc
r1239 r1252 114 114 dvl["PDMTYPE"] = "COMPMAP"; 115 115 dvl.SetComment("PDMTYPE", "Planck Data Model Type"); 116 dvl["SVERSIO"] = SophyaVersion(); 117 dvl.SetComment("SVERSIO", "Sophya Version"); 118 // fios.DVListIntoPrimaryHeader(dvl); $CHECK - RZ - GLM 18/10/2000 $ 116 dvl["SOPHYVER"] = SophyaVersion(); 117 dvl.SetComment("SOPHYVER", "Sophya Version"); 118 dvl["TGSKYKW"] = "Test Keyword from tgsky.cc"; 119 fios.DVListIntoPrimaryHeader(dvl); 119 120 fios << sph; 120 121 cout << "SphereHEALPix<float> written to FITS file " << (string)(arg[4]) << endl;
Note:
See TracChangeset
for help on using the changeset viewer.