Ignore:
Timestamp:
Feb 24, 2003, 10:18:01 AM (23 years ago)
Author:
aubourg
Message:

pour piolib

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/TestPipes/quickmap.cc

    r1819 r2328  
    11// GPH 424.1   Planck HFI-L2 Simple Map Making
    22// Eric Aubourg     CEA/DAPNIA/SPP
    3 // $Id: quickmap.cc,v 1.3 2001-12-17 23:12:08 aubourg Exp $
     3// This version is able to produce local maps as well
     4// $Id: quickmap.cc,v 1.4 2003-02-24 09:18:01 aubourg Exp $
    45
    56#include <stdlib.h>
     
    78#include "toi.h"
    89#include "toiprocessor.h"
    9 #include "fitstoirdr.h"
    10 #include "fitstoiwtr.h"
     10#include "piotoirdr.h"
    1111#include "toimanager.h"
    1212#include "toisegment.h"
     
    3838    struct {
    3939      string fname;
     40      string flags;
    4041      string coord1;  // TOI name
    4142      string coord2;  // TOI name
     
    4445    struct {
    4546      string fname;
     47      string flags;
    4648      string toiname;
    4749    } signal;
     
    7173    cout << "  | pointing\n";
    7274    cout << "  | | fname       " << input.pointing.fname << "\n";
     75    cout << "  | | flags       " << input.pointing.flagfs << "\n";
    7376    cout << "  | | coord1      " << input.pointing.coord1 << "\n";
    7477    cout << "  | | coord2      " << input.pointing.coord2 << "\n";
     
    8487    cout << "  | signal\n";
    8588    cout << "  | | fname       " << input.signal.fname << "\n";
     89    cout << "  | | flags       " << input.signal.flags << "\n";
    8690    cout << "  | | toiname     " << input.signal.toiname << "\n";
    8791    cout << "  output\n";
     
    150154  return n != 0;
    151155}
     156
    152157
    153158void parsePrefs(string prefFile, Gph424_1_Prefs& prefs) {
     
    182187 
    183188  prefs.input.pointing.fname  = DOMGetString(doc, "/input/pointing/fname");
     189  if (DOMHasOption(doc, "/input/pointing/flags")) {
     190    prefs.input.pointing.flags=
     191      DOMGetString(doc, "/input/pointing/flags");
     192  }
    184193  prefs.input.pointing.coord1 = DOMGetString(doc, "/input/pointing/coord1","phi");
    185194  prefs.input.pointing.coord2 = DOMGetString(doc, "/input/pointing/coord2","theta");
     
    208217  prefs.input.signal.fname    = DOMGetString(doc, "/input/signal/fname");
    209218  prefs.input.signal.toiname  = DOMGetString(doc, "/input/signal/toiname");
    210 
     219  if (DOMHasOption(doc, "/input/signal/flags")) {
     220    prefs.input.signal.flags =
     221      DOMGetString(doc, "/input/signal/flags");
     222  }
    211223  prefs.output.fname          = DOMGetString(doc, "/output/fname");
    212224  prefs.output.wfname         = DOMGetString(doc, "/output/wfname");
     
    264276  TOIManager* mgr = TOIManager::getManager();
    265277
    266   // Two input files
    267 
    268   FITSTOIReader inPoint(prefs.input.pointing.fname);
    269   FITSTOIReader inSig  (prefs.input.signal.fname);
    270 
    271   inPoint.setImplicitSN();
    272   inSig.setImplicitSN();
     278  // INPUT TOIs
     279
     280  PIOTOIReader inPoint1(prefs.input.pointing.fname, prefs.input.pointing.coord1,
     281                        prefs.input.pointing.flags);
     282  PIOTOIReader inPoint2(prefs.input.pointing.fname, prefs.input.pointing.coord2,
     283                        prefs.input.pointing.flags);
     284  PIOTOIReader inSig   (prefs.input.signal.fname, prefs.input.signal.toiname,
     285                        prefs.input.signal.flags);
     286
    273287
    274288  // Prepare maps for output
     
    298312
    299313  TOISegmented * toicoord1in = new TOISegmented(prefs.input.pointing.coord1);
    300   inPoint.addOutput(prefs.input.pointing.coord1,toicoord1in);
     314  inPoint1.addOutput(prefs.input.pointing.coord1,toicoord1in);
    301315  toi2m.addInput("Coord1In",toicoord1in);
    302316
    303317  TOISegmented * toicoord2in = new TOISegmented(prefs.input.pointing.coord2);
    304   inPoint.addOutput(prefs.input.pointing.coord2,toicoord2in);
     318  inPoint2.addOutput(prefs.input.pointing.coord2,toicoord2in);
    305319  toi2m.addInput("Coord2In",toicoord2in);
    306320
     
    312326
    313327  if (prefs.snb >= 0 && prefs.sne >= 0) {
    314     mgr->setRequestedSample(prefs.snb, prefs.sne);
    315   }
    316 
    317   inPoint.start();
    318   inSig.start();
    319   toi2m.start();
    320   mgr->joinAll();
     328    toi2m.setRequestedSample(prefs.snb, prefs.sne);
     329  }
     330
     331  mgr->startAll();
     332  mgr->waitForAll();
    321333
    322334  // Save maps
     335
     336  // Huh ? Should we create a Map(group) ? Should we create a MapObject ?
     337  // Should we open ? Where do we define the size ? How does this work ??
     338
     339  PIOCreateMAP(prefs.output.fname,
     340               prefs.output.typcoord == TypCoordGal ? "GALACTIC" : "ECLIPTIC",
     341               "RING",
     342               prefs.output.healpix_opt.nlat);
     343
     344  PIOGroup* mapGroup = PIOOpenMAP(prefs.output.fname,
     345                                  "w");
     346
     347  PIOCreateMAPObject("MAP", "PIODOUBLE", mapGroup);
     348
     349  PIOWriteMAP(map->GetData(),
     350              "MAP",
     351              "PIODOUBLE",
     352              "",
     353              mapGroup);
     354
     355  PIOCreateMAPObject("WMAP", "PIODOUBLE", mapGroup);
     356
     357  PIOWriteMAP(wmap->GetData(),
     358              "WMAP",
     359              "PIODOUBLE",
     360              "",
     361              mapGroup);
     362
     363  PIOCloseMAP(mapGroup);
    323364
    324365  {
     
    329370      sfits << * (SphereHEALPix<r_8>*)map;
    330371    } else if (map->TypeOfMap() == "LOCAL") {
    331       sfits << * (LocalMap<r_8>*)map;
     372      cout << "error, local maps not yet in PIOLib" << endl;
    332373    } else {
    333374      cout << "error, unknown type " << map->TypeOfMap() << endl;
Note: See TracChangeset for help on using the changeset viewer.