Changeset 2197 in Sophya for trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
- Timestamp:
- Sep 24, 2002, 4:03:36 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
r2013 r2197 76 76 ownobj_= true; 77 77 } 78 int nbcols, nbentries; 79 nbcols = is.NbColsFromFits(); 80 if (nbcols != 1) 81 { 82 throw IOExc("le fichier fits n'est pas une LocalMap"); 83 } 78 int nbentries; 79 80 // lecture sur bin-table 81 // 82 // if (!is.IsFitsTable()) 83 // { 84 // throw PException("ReadFromFits: the fits file seems not to be a bintable"); 85 // } 86 // int nbcols; 87 // nbcols = is.NbColsFromFits(); 88 // if (nbcols != 1) 89 // { 90 // throw IOExc("le fichier fits n'est pas une LocalMap"); 91 // } 92 // nbentries = is.NentriesFromFits(0); 93 // 94 95 // lecture sur image fits 96 // 97 if (!is.IsFitsImage()) 98 { 99 throw PException("ReadFromFits: the fits file seems not to be an image"); 100 } 101 int dimension = is.nbDimOfImage(); 102 if (dimension != 2 ) 103 { 104 cout << " WARNING::ReadFromFits: the fits image seems not to be a matrix" << endl; 105 } 106 nbentries = is.nbOfImageData(); 107 // 108 84 109 DVList dvl=is.DVListFromFits(); 85 86 nbentries = is.NentriesFromFits(0); 110 87 111 int_4 nSzX = dvl.GetI("NSZX"); 88 112 int_4 nSzY = dvl.GetI("NSZY"); … … 93 117 } 94 118 dobj_->ReSize(nSzX, nSzY); 95 //int_4 localMappingDone = dvl.GetI("LCMP");96 //if (localMappingDone)97 //{119 int_4 localMappingDone = dvl.GetI("LCMP"); 120 if (localMappingDone) 121 { 98 122 int_4 x0 = dvl.GetI("X0"); 99 123 int_4 y0 = dvl.GetI("Y0"); … … 105 129 double angleY = dvl.GetD("ANGLEY"); 106 130 dobj_->SetSize(angleX, angleY); 107 //}131 } 108 132 // On lit les DataBlocks; 133 109 134 dobj_->DataBlock().ReSize(nPix); 110 135 is.GetSingleColumn(dobj_->DataBlock().Data(),nPix); … … 122 147 return; 123 148 } 124 125 DVList dvl( dobj_->Info() ); 126 dvl["NSZX"] = dobj_->Size_x(); 149 int nx, ny; 150 151 DVList dvl( dobj_->Info() ); 152 nx = dobj_->Size_x(); 153 dvl["NSZX"] = nx; 127 154 dvl.SetComment("NSZX", "number of pixels in x direction"); 128 dvl["NSZY"] = dobj_->Size_y(); 155 ny = dobj_->Size_y(); 156 dvl["NSZY"] = ny; 129 157 dvl.SetComment("NSZY", "number of pixels in y direction"); 130 158 dvl["NPIX"] = dobj_->NbPixels(); 131 159 dvl.SetComment("NPIX", "number of pixels in local map"); 132 160 133 //if(dobj_->LocalMap_isDone())134 //{135 //dvl["LCMP"] = (int_4) 1;136 //dvl.SetComment("LCMP", "local mapping 1= done, 0= not done");161 if(dobj_->LocalMap_isDone()) 162 { 163 dvl["LCMP"] = (int_4) 1; 164 dvl.SetComment("LCMP", "local mapping 1= done, 0= not done"); 137 165 int_4 x0 = 0; 138 166 int_4 y0 = 0; … … 159 187 dvl["ANGLEY"] = angleY; 160 188 dvl.SetComment("ANGLEY", "sphere angle covered by map y-extension "); 161 //}162 //else163 //{164 //dvl["LCMP"] = (int_4) 0;165 //}189 } 190 else 191 { 192 dvl["LCMP"] = (int_4) 0; 193 } 166 194 dvl["Content"]= "LocalMap"; 167 195 dvl.SetComment("Content", "name of SOPHYA object"); … … 171 199 string extname("SIMULATION"); 172 200 173 string Type; 174 if (typeid(T) == typeid(r_8) ) Type+='D'; 201 // sortie sur image fits 202 // 203 char type; 204 if ( typeid(T) == typeid(r_8) ) type='D'; 175 205 else 176 if ( typeid(T) == typeid(r_4) ) Type+='E';206 if ( typeid(T) == typeid(r_4) ) type='E'; 177 207 else 178 { 179 cout << " type de la LocalMap = " << typeid(T).name() << endl; 180 throw IOExc("FITS_LocalMap:: unknown type"); 181 } 182 vector<int> dummy; 183 os.makeHeaderBntblOnFits(Type, Noms, dobj_->NbPixels(), 1, &dvl, extname, dummy); 184 os.PutColToFits(0, dobj_->NbPixels(), dobj_->DataBlock().Data()); 208 if ( typeid(T) == typeid(int_4) ) type='J'; 209 else 210 { 211 cout << " type du tableau= " << typeid(T).name() << endl; 212 throw IOExc("FITS_LocalMap:: unknown type"); 213 } 214 int nbdim = 2; 215 int* naxisn = new int[nbdim]; 216 naxisn[0] = dobj_->Matrix().Size(0); 217 naxisn[1] = dobj_->Matrix().Size(1); 218 os.makeHeaderImageOnFits(type, nbdim, naxisn, &dvl); 219 os.PutImageToFits(nx*ny, dobj_->Matrix().Data()); 220 221 delete [] naxisn; 222 // 223 224 // sortie sur bin-table fits 225 // 226 // string Type; 227 // if (typeid(T) == typeid(r_8) ) Type+='D'; 228 // else 229 // if (typeid(T) == typeid(r_4) ) Type+='E'; 230 // else 231 // { 232 // cout << " type de la LocalMap = " << typeid(T).name() << endl; 233 // throw IOExc("FITS_LocalMap:: unknown type"); 234 // } 235 // vector<int> dummy; 236 // os.makeHeaderBntblOnFits(Type, Noms, dobj_->NbPixels(), 1, &dvl, extname, dummy); 237 // os.PutColToFits(0, dobj_->NbPixels(), dobj_->DataBlock().Data()); 238 // 185 239 186 240 }
Note:
See TracChangeset
for help on using the changeset viewer.