1 | // GPH 424.1 Planck HFI-L2 Simple Map Making
|
---|
2 | // Parallel version
|
---|
3 | // Eric Aubourg CEA/DAPNIA/SPP
|
---|
4 | // $Id: quickmap_p.cc,v 1.5 2003-02-24 09:18:01 aubourg Exp $
|
---|
5 |
|
---|
6 | #include <stdlib.h>
|
---|
7 | #include <stdio.h>
|
---|
8 | #include "toi.h"
|
---|
9 | #include "toiprocessor.h"
|
---|
10 | #include "fitstoirdr.h"
|
---|
11 | #include "fitstoiwtr.h"
|
---|
12 | #include "toimanager.h"
|
---|
13 | #include "toisegment.h"
|
---|
14 |
|
---|
15 |
|
---|
16 | #include "sambainit.h"
|
---|
17 | #include "toi2map.h"
|
---|
18 | #include "fitsspherehealpix.h"
|
---|
19 | #include "localmap.h"
|
---|
20 | #include "fitslocalmap.h"
|
---|
21 |
|
---|
22 | #include <util/PlatformUtils.hpp>
|
---|
23 | #include <sax/SAXException.hpp>
|
---|
24 | #include <sax/SAXParseException.hpp>
|
---|
25 | #include <parsers/DOMParser.hpp>
|
---|
26 | #include <dom/DOM_DOMException.hpp>
|
---|
27 |
|
---|
28 |
|
---|
29 | void usage(void);
|
---|
30 |
|
---|
31 | void usage(void) {
|
---|
32 | cerr << "usage: gph424_1p xml_options_file" << endl;
|
---|
33 | exit(-1);
|
---|
34 | }
|
---|
35 |
|
---|
36 | // Prefs structure
|
---|
37 |
|
---|
38 | struct Gph424_1_Prefs {
|
---|
39 | struct {
|
---|
40 | struct {
|
---|
41 | string fname;
|
---|
42 | string flagfname;
|
---|
43 | vector<FlagToiDef> flags;
|
---|
44 | string coord1; // TOI name
|
---|
45 | string coord2; // TOI name
|
---|
46 | unsigned long typcoord;
|
---|
47 | } pointing;
|
---|
48 | struct {
|
---|
49 | string fname;
|
---|
50 | string flagfname;
|
---|
51 | vector<FlagToiDef> flags;
|
---|
52 | string toiname;
|
---|
53 | } signal;
|
---|
54 | } input;
|
---|
55 |
|
---|
56 | struct {
|
---|
57 | string fname;
|
---|
58 | string wfname; // weight
|
---|
59 | unsigned long typcoord;
|
---|
60 | string typmap; // local, healpix...
|
---|
61 | struct {
|
---|
62 | int nlat;
|
---|
63 | } healpix_opt;
|
---|
64 | struct {
|
---|
65 | int npx, npy;
|
---|
66 | double org1,org2;
|
---|
67 | double anglex, angley;
|
---|
68 | } local_opt;
|
---|
69 | } output;
|
---|
70 |
|
---|
71 | int nproc;
|
---|
72 | long snb, sne;
|
---|
73 |
|
---|
74 | void dump() {
|
---|
75 | cout << "*** GPH424-1 settings\n";
|
---|
76 | cout << " input\n";
|
---|
77 | cout << " | pointing\n";
|
---|
78 | cout << " | | fname " << input.pointing.fname << "\n";
|
---|
79 | cout << " | | flagfname " << input.pointing.flagfname << "\n";
|
---|
80 | for (int i=0; i<input.pointing.flags.size(); i++) {
|
---|
81 | cout << " | | | flag " << i << " : " << input.pointing.flags[i] << "\n";
|
---|
82 | }
|
---|
83 | cout << " | | coord1 " << input.pointing.coord1 << "\n";
|
---|
84 | cout << " | | coord2 " << input.pointing.coord2 << "\n";
|
---|
85 | cout << " | | typcoord "
|
---|
86 | << ((input.pointing.typcoord & TypCoordGal) ? "G" : "E")
|
---|
87 | << ((input.pointing.typcoord & TypCoord1H) ? "H" :
|
---|
88 | (input.pointing.typcoord & TypCoord1D) ? "D" : "R")
|
---|
89 | << ((input.pointing.typcoord & TypCoord1C) ? "C" : "L")
|
---|
90 | << ((input.pointing.typcoord & TypCoord2H) ? "H" :
|
---|
91 | (input.pointing.typcoord & TypCoord2D) ? "D" : "R")
|
---|
92 | << ((input.pointing.typcoord & TypCoord2C) ? "C" : "L")
|
---|
93 | << "\n";
|
---|
94 | cout << " | signal\n";
|
---|
95 | cout << " | | fname " << input.signal.fname << "\n";
|
---|
96 | cout << " | | flagfname " << input.signal.flagfname << "\n";
|
---|
97 | {for (int i=0; i<input.signal.flags.size(); i++) {
|
---|
98 | cout << " | | | flag " << i << " : " << input.signal.flags[i] << "\n";
|
---|
99 | }}
|
---|
100 | cout << " | | toiname " << input.signal.toiname << "\n";
|
---|
101 | cout << " output\n";
|
---|
102 | cout << " | fname " << output.fname << "\n";
|
---|
103 | cout << " | wfname " << output.wfname << "\n";
|
---|
104 | cout << " | typcoord "
|
---|
105 | << ((output.typcoord & TypCoordGal) ? "G" : "E")
|
---|
106 | << "\n";
|
---|
107 | cout << " | typmap " << output.typmap << "\n";
|
---|
108 | if (output.typmap == "healpix") {
|
---|
109 | cout << " | | nlat " << output.healpix_opt.nlat << "\n";
|
---|
110 | } else if (output.typmap == "local") {
|
---|
111 | cout << " | | npix " << output.local_opt.npx << ", " << output.local_opt.npy << "\n";
|
---|
112 | cout << " | | origin " << output.local_opt.org1 << ", " << output.local_opt.org2 << "\n";
|
---|
113 | cout << " | | extension " << output.local_opt.anglex << ", " << output.local_opt.angley << "\n";
|
---|
114 | }
|
---|
115 | cout << " nproc " << nproc << "\n";
|
---|
116 | if (sne >= 0 && snb >= 0) {
|
---|
117 | cout << " samples " << snb << " " << sne << "\n";
|
---|
118 | }
|
---|
119 | cout << "***" << endl;
|
---|
120 | }
|
---|
121 | };
|
---|
122 |
|
---|
123 | DOM_Node DOMGetNode(DOM_Document& doc, string path) {
|
---|
124 | DOM_Element el = doc.getDocumentElement();
|
---|
125 |
|
---|
126 | while (path != "") {
|
---|
127 | if (path[0] == '/') {
|
---|
128 | path = path.substr(1);
|
---|
129 | }
|
---|
130 | if (path == "") break;
|
---|
131 | int x = path.find('/');
|
---|
132 | string pathElem;
|
---|
133 | if (x == -1) {
|
---|
134 | pathElem = path;
|
---|
135 | path = "";
|
---|
136 | } else {
|
---|
137 | pathElem = path.substr(0, x);
|
---|
138 | path = path.substr(x);
|
---|
139 | }
|
---|
140 | DOM_Node n = el.getElementsByTagName(pathElem.c_str()).item(0);
|
---|
141 | if (n==0) return n;
|
---|
142 | el = (DOM_Element&) n;
|
---|
143 | }
|
---|
144 | return el;
|
---|
145 | }
|
---|
146 |
|
---|
147 | string DOMGetString(DOM_Document& doc, string path, string def="") {
|
---|
148 | DOM_Node n = DOMGetNode(doc, path);
|
---|
149 | if (n==0) return def;
|
---|
150 | char* s = n.getFirstChild().getNodeValue().transcode();
|
---|
151 | char* p=s; while ((*p)==' ') p++;
|
---|
152 | char* q=p+strlen(p)-1;
|
---|
153 | while (q>p && *q==' ') {
|
---|
154 | *q = '\0';
|
---|
155 | q--;
|
---|
156 | }
|
---|
157 | string ss = p;
|
---|
158 | free(s);
|
---|
159 | return ss;
|
---|
160 | }
|
---|
161 |
|
---|
162 | bool DOMHasOption(DOM_Document& doc, string path) {
|
---|
163 | DOM_Node n = DOMGetNode(doc, path);
|
---|
164 | return n != 0;
|
---|
165 | }
|
---|
166 |
|
---|
167 | void parseFlags(DOM_Node flagnode, vector<FlagToiDef>& flgs) {
|
---|
168 | DOM_Element elt = (DOM_Element&) flagnode;
|
---|
169 | DOM_NodeList l = elt.getElementsByTagName("flag");
|
---|
170 | // prepare array
|
---|
171 | flgs.clear();
|
---|
172 | flgs.insert(flgs.begin(), l.getLength(), (FlagToiDef)0);
|
---|
173 | for (int i = 0; i<l.getLength(); i++) {
|
---|
174 | DOM_Node node = l.item(i);
|
---|
175 | DOM_Element elt = (DOM_Element&) node;
|
---|
176 | DOMString scol = elt.getAttribute("column");
|
---|
177 | DOMString sval = elt.getAttribute("kind");
|
---|
178 | int col = atoi(scol.transcode());
|
---|
179 | int value = atoi(sval.transcode());
|
---|
180 | flgs[col-1] = (FlagToiDef) value;
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | void parsePrefs(string prefFile, Gph424_1_Prefs& prefs) {
|
---|
185 | try {
|
---|
186 | XMLPlatformUtils::Initialize();
|
---|
187 | } catch (const XMLException& toCatch) {
|
---|
188 | cerr << "Error during XML initialization! :\n"
|
---|
189 | << toCatch.getMessage() << endl;
|
---|
190 | exit(-1);
|
---|
191 | }
|
---|
192 |
|
---|
193 | DOMParser* parser = new DOMParser;
|
---|
194 |
|
---|
195 | try {
|
---|
196 | parser->parse(prefFile.c_str());
|
---|
197 | } catch (const XMLException& toCatch) {
|
---|
198 | cerr << "\nError during parsing: '" << prefFile << "'\n"
|
---|
199 | << "Exception message is: \n"
|
---|
200 | << toCatch.getMessage() << "\n" << endl;
|
---|
201 | exit(-1);
|
---|
202 | } catch (const DOM_DOMException& toCatch) {
|
---|
203 | cerr << "\nDOM Error during parsing: '" << prefFile << "'\n"
|
---|
204 | << "DOMException code is: \n"
|
---|
205 | << toCatch.code << "\n" << endl;
|
---|
206 | exit(-1);
|
---|
207 | } catch (...) {
|
---|
208 | cerr << "\nUnexpected exception during parsing: '" << prefFile << "'\n";
|
---|
209 | exit(-1);
|
---|
210 | }
|
---|
211 |
|
---|
212 | DOM_Document doc = parser->getDocument();
|
---|
213 |
|
---|
214 | prefs.input.pointing.fname = DOMGetString(doc, "/input/pointing/fname");
|
---|
215 | if (DOMHasOption(doc, "/input/pointing/flags")) {
|
---|
216 | prefs.input.pointing.flagfname =
|
---|
217 | DOMGetString(doc, "/input/pointing/flags/fname");
|
---|
218 | DOM_Node flagnode = DOMGetNode(doc, "/input/pointing/flags");
|
---|
219 | parseFlags(flagnode, prefs.input.pointing.flags);
|
---|
220 | }
|
---|
221 | prefs.input.pointing.coord1 = DOMGetString(doc, "/input/pointing/coord1","phi");
|
---|
222 | prefs.input.pointing.coord2 = DOMGetString(doc, "/input/pointing/coord2","theta");
|
---|
223 | bool inequ = DOMHasOption(doc, "/input/pointing/equatorial");
|
---|
224 | bool ingal = DOMHasOption(doc, "/input/pointing/galactic");
|
---|
225 | prefs.input.pointing.typcoord = ingal ? TypCoordGal : TypCoordEq;
|
---|
226 | bool inhd = DOMHasOption(doc, "/input/pointing/hourdeg");
|
---|
227 | bool indd = DOMHasOption(doc, "/input/pointing/degdeg");
|
---|
228 | bool inrr = DOMHasOption(doc, "/input/pointing/radian");
|
---|
229 | bool iscolat = DOMHasOption(doc, "/input/pointing/colat");
|
---|
230 | if (inhd) {
|
---|
231 | prefs.input.pointing.typcoord |= TypCoord1H|TypCoord2D;
|
---|
232 | } else if (indd) {
|
---|
233 | prefs.input.pointing.typcoord |= TypCoord1D|TypCoord2D;
|
---|
234 | } else if (inrr) {
|
---|
235 | prefs.input.pointing.typcoord |= TypCoord1R|TypCoord2R;
|
---|
236 | } else if (prefs.input.pointing.typcoord & TypCoordEq) {
|
---|
237 | prefs.input.pointing.typcoord = TypCoordEqStd;
|
---|
238 | } else {
|
---|
239 | prefs.input.pointing.typcoord = TypCoordGalStd;
|
---|
240 | }
|
---|
241 | if (iscolat) {
|
---|
242 | prefs.input.pointing.typcoord |= TypCoord2C;
|
---|
243 | }
|
---|
244 |
|
---|
245 | prefs.input.signal.fname = DOMGetString(doc, "/input/signal/fname");
|
---|
246 | prefs.input.signal.toiname = DOMGetString(doc, "/input/signal/toiname");
|
---|
247 | if (DOMHasOption(doc, "/input/signal/flags")) {
|
---|
248 | prefs.input.signal.flagfname =
|
---|
249 | DOMGetString(doc, "/input/signal/flags/fname");
|
---|
250 | DOM_Node flagnode = DOMGetNode(doc, "/input/signal/flags");
|
---|
251 | parseFlags(flagnode, prefs.input.signal.flags);
|
---|
252 | }
|
---|
253 | prefs.output.fname = DOMGetString(doc, "/output/fname");
|
---|
254 | prefs.output.wfname = DOMGetString(doc, "/output/wfname");
|
---|
255 | bool outequ = DOMHasOption(doc, "/output/equatorial");
|
---|
256 | bool outgal = DOMHasOption(doc, "/output/galactic");
|
---|
257 | prefs.output.typcoord = outgal ? TypCoordGal : TypCoordEq;
|
---|
258 | bool outhd = DOMHasOption(doc, "/output/hourdeg");
|
---|
259 | bool outdd = DOMHasOption(doc, "/output/degdeg");
|
---|
260 | bool outrr = DOMHasOption(doc, "/output/radian");
|
---|
261 | if (outhd) {
|
---|
262 | prefs.output.typcoord |= TypCoord1H | TypCoord2D;
|
---|
263 | } else if (outdd) {
|
---|
264 | prefs.output.typcoord |= TypCoord1D | TypCoord2D;
|
---|
265 | } else if (outrr) {
|
---|
266 | prefs.output.typcoord |= TypCoord1R | TypCoord2R;
|
---|
267 | } else if (prefs.output.typcoord & TypCoordEq) {
|
---|
268 | prefs.output.typcoord = TypCoordEqStd;
|
---|
269 | } else {
|
---|
270 | prefs.output.typcoord |= TypCoordGalStd;
|
---|
271 | }
|
---|
272 |
|
---|
273 | prefs.output.typmap = DOMHasOption(doc, "/output/local") ? "local" :
|
---|
274 | (DOMHasOption(doc, "/output/healpix") ? "healpix" : "healpix");
|
---|
275 | prefs.output.healpix_opt.nlat = atoi(DOMGetString(doc, "/output/healpix/nlat", "128").c_str());
|
---|
276 |
|
---|
277 | string s = DOMGetString(doc, "/output/local/npx");
|
---|
278 | prefs.output.local_opt.npx = prefs.output.local_opt.npy = -1;
|
---|
279 | int nc = sscanf(s.c_str(), "%d %d", &prefs.output.local_opt.npx, &prefs.output.local_opt.npy);
|
---|
280 | if (nc == 1) prefs.output.local_opt.npy = prefs.output.local_opt.npx;
|
---|
281 |
|
---|
282 | s = DOMGetString(doc, "/output/local/center");
|
---|
283 | prefs.output.local_opt.org1 = prefs.output.local_opt.org2 = 0;
|
---|
284 | sscanf(s.c_str(), "%lg %lg", &prefs.output.local_opt.org1, &prefs.output.local_opt.org2);
|
---|
285 |
|
---|
286 | s = DOMGetString(doc, "/output/local/angle");
|
---|
287 | prefs.output.local_opt.anglex = prefs.output.local_opt.angley = 0;
|
---|
288 | nc = sscanf(s.c_str(), "%d %d", &prefs.output.local_opt.anglex, &prefs.output.local_opt.angley);
|
---|
289 | if (nc == 1) prefs.output.local_opt.angley = prefs.output.local_opt.anglex;
|
---|
290 |
|
---|
291 | prefs.nproc = atoi(DOMGetString(doc, "/nproc", "1").c_str());
|
---|
292 |
|
---|
293 | s = DOMGetString(doc, "/samples", "-1 -1");
|
---|
294 | sscanf(s.c_str(), "%ld %ld", &prefs.snb, &prefs.sne);
|
---|
295 | }
|
---|
296 |
|
---|
297 | int main(int argc, char** argv) {
|
---|
298 |
|
---|
299 | // Read prefs
|
---|
300 | Gph424_1_Prefs prefs;
|
---|
301 | parsePrefs(argv[1], prefs);
|
---|
302 | prefs.dump();
|
---|
303 |
|
---|
304 | int np = prefs.nproc;
|
---|
305 |
|
---|
306 | // Assemble pipeline
|
---|
307 |
|
---|
308 | TOIManager* mgr = TOIManager::getManager();
|
---|
309 |
|
---|
310 | // Two input files for each data chunk
|
---|
311 |
|
---|
312 | vector<FITSTOIReader*> inPoint;
|
---|
313 | vector<FITSTOIReader*> inSig;
|
---|
314 | for (int i=0; i<np; i++) {
|
---|
315 | inPoint.push_back(new FITSTOIReader(prefs.input.pointing.fname));
|
---|
316 | inSig.push_back(new FITSTOIReader(prefs.input.signal.fname));
|
---|
317 | inPoint[i]->setImplicitSN();
|
---|
318 | inSig[i]->setImplicitSN();
|
---|
319 | if (prefs.input.pointing.flagfname != "") {
|
---|
320 | inPoint[i]->setFlagFile(prefs.input.pointing.flagfname, prefs.input.pointing.flags);
|
---|
321 | }
|
---|
322 | if (prefs.input.signal.flagfname != "") {
|
---|
323 | inSig[i]->setFlagFile(prefs.input.signal.flagfname, prefs.input.signal.flags);
|
---|
324 | }
|
---|
325 | }
|
---|
326 |
|
---|
327 | // Prepare maps for output
|
---|
328 |
|
---|
329 | vector<PixelMap<r_8>*> map;
|
---|
330 | vector<PixelMap<r_8>*> wmap;
|
---|
331 |
|
---|
332 | for (int i=0; i<np; i++) {
|
---|
333 | if (prefs.output.typmap == "local") {
|
---|
334 | LocalMap<r_8>* lmap =
|
---|
335 | new LocalMap<r_8>(prefs.output.local_opt.npx, prefs.output.local_opt.npy);
|
---|
336 | lmap->SetOrigin(prefs.output.local_opt.org1, prefs.output.local_opt.org2);
|
---|
337 | lmap->SetSize(prefs.output.local_opt.anglex, prefs.output.local_opt.angley);
|
---|
338 | map.push_back(lmap);
|
---|
339 | wmap.push_back(new LocalMap<r_8>(*lmap));
|
---|
340 | } else if (prefs.output.typmap == "healpix") {
|
---|
341 | map.push_back(new SphereHEALPix<r_8>(prefs.output.healpix_opt.nlat));
|
---|
342 | wmap.push_back(new SphereHEALPix<r_8>(prefs.output.healpix_opt.nlat));
|
---|
343 | } else {
|
---|
344 | cout << "typmap " << prefs.output.typmap << " unknown" << endl;
|
---|
345 | exit(-1);
|
---|
346 | }
|
---|
347 | }
|
---|
348 |
|
---|
349 | // One map projector per data chunk
|
---|
350 |
|
---|
351 | vector<TOI2Map*> toi2m;
|
---|
352 | {for (int i=0; i<np; i++) {
|
---|
353 | toi2m.push_back(new TOI2Map(map[i],wmap[i]));
|
---|
354 | toi2m[i]->SetEquinox(2000.);
|
---|
355 | toi2m[i]->SetCoorIn((TypAstroCoord) prefs.input.pointing.typcoord);
|
---|
356 | toi2m[i]->SetCoorMap((TypAstroCoord) prefs.output.typcoord);
|
---|
357 | }}
|
---|
358 |
|
---|
359 |
|
---|
360 | if (prefs.snb >= 0 && prefs.sne >= 0) {
|
---|
361 | mgr->setRequestedSample(prefs.snb, prefs.sne);
|
---|
362 | }
|
---|
363 |
|
---|
364 | int sn0 = inPoint[0]->getMinOut();
|
---|
365 | int sn1 = inPoint[0]->getMaxOut();
|
---|
366 |
|
---|
367 | cout << "Range to be processed : " << sn0 << " - " << sn1 << endl;
|
---|
368 |
|
---|
369 | int chunksize = (sn1-sn0)/np;
|
---|
370 | {for (int i=0; i<np; i++) {
|
---|
371 | int isn0 = sn0 + chunksize*i;
|
---|
372 | int isn1 = sn0 + chunksize*(i+1) - 1;
|
---|
373 | if (i == np-1) isn1 = sn1;
|
---|
374 | cout << "Processor " << i << " range " << isn0 << " - " << isn1 << endl;
|
---|
375 | inPoint[i]->setMinSn(isn0);
|
---|
376 | inSig[i]->setMinSn(isn0);
|
---|
377 | inPoint[i]->setMaxSn(isn1);
|
---|
378 | inSig[i]->setMaxSn(isn1);
|
---|
379 | }}
|
---|
380 |
|
---|
381 | // Connect pipes
|
---|
382 |
|
---|
383 | {for (int i=0; i<np; i++) {
|
---|
384 | TOISegmented * toicoord1in = new TOISegmented(prefs.input.pointing.coord1);
|
---|
385 | inPoint[i]->addOutput(prefs.input.pointing.coord1,toicoord1in);
|
---|
386 | toi2m[i]->addInput("Coord1In",toicoord1in);
|
---|
387 |
|
---|
388 | TOISegmented * toicoord2in = new TOISegmented(prefs.input.pointing.coord2);
|
---|
389 | inPoint[i]->addOutput(prefs.input.pointing.coord2,toicoord2in);
|
---|
390 | toi2m[i]->addInput("Coord2In",toicoord2in);
|
---|
391 |
|
---|
392 | TOISegmented * toibolin = new TOISegmented("toi_bolo_in");
|
---|
393 | inSig[i]->addOutput(prefs.input.signal.toiname,toibolin);
|
---|
394 | toi2m[i]->addInput("BoloIn",toibolin);
|
---|
395 | }}
|
---|
396 |
|
---|
397 | // Start processing
|
---|
398 |
|
---|
399 | {for (int i=0; i<np; i++) {
|
---|
400 | inPoint[i]->start();
|
---|
401 | inSig[i]->start();
|
---|
402 | toi2m[i]->start();
|
---|
403 | }}
|
---|
404 | mgr->joinAll();
|
---|
405 |
|
---|
406 | // Merge maps
|
---|
407 |
|
---|
408 | PixelMap<r_8>* smap = map[0];
|
---|
409 | PixelMap<r_8>* swmap = wmap[0];
|
---|
410 |
|
---|
411 | {for (int i=1; i<np; i++) {
|
---|
412 | // There should be a += operator in all maps, not only in local maps
|
---|
413 | // *smap += *map[i];
|
---|
414 | // *swmap += *wmap[i];
|
---|
415 | int n = smap->NbPixels();
|
---|
416 | for (int j=0; j<n; j++) {
|
---|
417 | (*smap)(j) += (*map[i])(j);
|
---|
418 | (*swmap)(j) += (*wmap[i])(j);
|
---|
419 | }
|
---|
420 | }}
|
---|
421 |
|
---|
422 | // Save maps
|
---|
423 |
|
---|
424 | {
|
---|
425 | FitsOutFile sfits(prefs.output.fname,FitsFile::clear);
|
---|
426 | cout<<"Creating map fits file "<<prefs.output.fname<<endl;
|
---|
427 | // Would need some generic mechanism here $CHECK$ $$TBD$$
|
---|
428 | if ((string)smap->TypeOfMap() == "RING") {
|
---|
429 | sfits << * (SphereHEALPix<r_8>*)smap;
|
---|
430 | } else if ((string)smap->TypeOfMap() == "LOCAL") {
|
---|
431 | sfits << * (LocalMap<r_8>*)smap;
|
---|
432 | } else {
|
---|
433 | cout << "error, unknown type " << smap->TypeOfMap() << endl;
|
---|
434 | }
|
---|
435 | }
|
---|
436 |
|
---|
437 | {
|
---|
438 | FitsOutFile swfits(prefs.output.wfname,FitsFile::clear);
|
---|
439 | cout<<"Creating map weight fits file "<<prefs.output.wfname<<endl;
|
---|
440 | // swfits << *wmap;
|
---|
441 | if ((string)swmap->TypeOfMap() == "RING") {
|
---|
442 | swfits << * (SphereHEALPix<r_8>*)swmap;
|
---|
443 | } else if ((string)swmap->TypeOfMap() == "LOCAL") {
|
---|
444 | swfits << * (LocalMap<r_8>*)swmap;
|
---|
445 | } else {
|
---|
446 | cout << "error, unknown type " << swmap->TypeOfMap() << endl;
|
---|
447 | }
|
---|
448 | }
|
---|
449 |
|
---|
450 | return 0;
|
---|
451 | }
|
---|