Changeset 607 in Sophya for trunk/SophyaLib


Ignore:
Timestamp:
Nov 20, 1999, 10:00:54 PM (26 years ago)
Author:
ansari
Message:

Modifs preparatoire pour Garching MAP , Reza 20/11/99

Location:
trunk/SophyaLib/SkyT
Files:
1 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyT/blackbody.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: blackbody.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: blackbody.cc,v 1.2 1999-11-20 21:00:47 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/blackbody.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: blackbody.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: blackbody.h,v 1.2 1999-11-20 21:00:47 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/convtools.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: convtools.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: convtools.cc,v 1.2 1999-11-20 21:00:48 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/convtools.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: convtools.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: convtools.h,v 1.2 1999-11-20 21:00:48 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/gaussfilt.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: gaussfilt.cc,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     3//      $Id: gaussfilt.cc,v 1.2 1999-11-20 21:00:48 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/gaussfilt.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: gaussfilt.h,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     4//      $Id: gaussfilt.h,v 1.2 1999-11-20 21:00:49 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/nupower.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: nupower.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: nupower.cc,v 1.2 1999-11-20 21:00:49 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/nupower.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: nupower.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: nupower.h,v 1.2 1999-11-20 21:00:49 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/radspec.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: radspec.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: radspec.cc,v 1.2 1999-11-20 21:00:50 ansari Exp $
    44//
    55// Description:
     
    106106    _raypourfinteg = const_cast<RadSpectra *>(this);
    107107    TrpzInteg I(RadSpectra_fluxFunction , f1, f2); 
    108     _raypourfinteg = NULL;
    109     return((double)I);       
     108    double val = (double)I;
     109    _raypourfinteg = NULL;  // On ne peut pas faire ca avant la destruction de I
     110    return(val);       
    110111}
    111112double
     
    160161  _raypourfinteg = const_cast<RadSpectra *>(this);
    161162  _filter = const_cast<SpectralResponse *>(&filter);
    162   TrpzInteg I(RadSpectra_filteredFlux,f1,f2); 
     163  TrpzInteg I(RadSpectra_filteredFlux,f1,f2);
     164  double val = (double)I;
    163165  _raypourfinteg = NULL;
    164166  _filter = NULL;
    165   return((double)I);       
     167  return(val);       
    166168}
    167169
     
    210212   _filter = const_cast<SpectralResponse *>(&filter);
    211213   TrpzInteg I(RadSpectra_logFilteredFlux,f1Log,f2Log); 
     214   double val = (double)I;
    212215   _raypourfinteg = NULL;
    213216   _filter = NULL;
    214    return((double)I* log(10.));       
     217   return(val* log(10.));       
    215218}
    216219
  • trunk/SophyaLib/SkyT/radspec.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: radspec.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: radspec.h,v 1.2 1999-11-20 21:00:50 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/radspecvector.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: radspecvector.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: radspecvector.cc,v 1.2 1999-11-20 21:00:50 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/radspecvector.h

    r601 r607  
    4444  virtual double flux(double nu) const;
    4545
     46  // Acces to Nu and F(nu) vectors
     47  inline Vector& getNuVec() { return _vecOfNu; }
     48  inline Vector& getFNuVec() { return _vecOfFDeNu; }
     49
    4650  virtual void   Print(ostream& os)  const;
    4751
  • trunk/SophyaLib/SkyT/skm.d

    r601 r607  
     1#  MAPPATH  PathForFITS files
     2@MAPPATH /exp/eros/Reza/CartesRT
    13#  SKYMIX  NbComponents  M_Gorski
    24@SKYMIX  2  64
     
    57
    68#  Sky components
    7 SCMFILE FITSfilename [Normalisation]
    8 @SCMFILE1  comp1.fits
    9 @SCMFILE2  comp2.fits    0.25
     9MAPFITSFILEi FITSfilename [Normalisation]
     10@MAPFITSFILE1  map_essai.fits
     11@MAPFITSFILE2    comp2.fits    0.25
    1012
    11 #  SCSPEC1  FITSfilename  Fmin Fmax
    12 @SCSPEC1  spec1.fits 
    13 @SCSPEC2  spec2.fits
     13#   SPECTRAFITSFILEi  FITSfilename  Fmin Fmax
     14@SPECTRAFITSFILE1  spec1.fits 
     15@SPECTRAFUNC2  3. 4. 5.
     16
     17#  Define the Debug level
     18@DEBUGLEVEL  5
  • trunk/SophyaLib/SkyT/skymixer.cc

    r601 r607  
    3232                  PixelMap<double>& mapToAdd, RadSpectra& rs, double K=1.);
    3333
     34int CheckCards(DataCards & dc, string & msg);
     35char * BuildFITSFileName(string const & fname);
     36void RadSpec2Nt(RadSpectra & rs, POutPersist & so, string name);
     37void SpectralResponse2Nt(SpectralResponse& sr, POutPersist & so, string name);
     38
     39//  ----- Variable globale ------------
     40static char mapPath[256];     // Path for input maps
     41static int  hp_nside = 32;    // HealPix NSide
     42static int  nskycomp = 0;     // Number of sky components
     43static int  debuglev = 0;     // debuglevel
     44
    3445// -------------------------------------------------------------------------
    3546//                             main program
     
    3748int main(int narg, char * arg[])
    3849{
    39   if ((narg < 2) || (strcmp(arg[1], "-h") == 0) ) {
    40     cout << " skymixer / Error args \n Usage: skymixer parameterFile " << endl;
     50  if ((narg < 3) || ((narg > 1) && (strcmp(arg[1], "-h") == 0) )) {
     51    cout << "  Usage: skymixer parameterFile outputfitsname [outppfname]" << endl;
    4152    exit(0);
    4253  }
     
    4657string msg;
    4758int rc = 0;
    48  
     59POutPersist * so = NULL;
     60
    4961try {
    5062  string dcard = arg[1];
     
    5264  DataCards dc(dcard);
    5365
    54   //  Cheking datacards
    55   if ( (!dc.HasKey("SKYMIX")) || (!dc.HasKey("FILTER")) ) {
    56      rc = 71;
    57      msg = "Invalid parameters  - NO @SKYMIX or @FILTER card ";
    58      goto problem;
    59   }
    60 
    61   // Decoding number of component and pixelisation parameter
    62   int mg = 32;
    63   int ncomp = 0;
    64   ncomp = dc.IParam("SKYMIX", 0, 0);
    65   mg = dc.IParam("SKYMIX", 1, 32);
    66   if (ncomp < 1)  {
    67     msg = "Invalid parameters  - Check datacards @SKYMIX ";
    68     rc = 72;
    69     goto problem;
    70   }
    71 
    72   int kc;
    73   string key;
    74   char buff[256];
    75   bool pb = false;
    76   for(kc=0; kc<ncomp; kc++) {
    77     sprintf(buff, "SCMFILE%d", kc+1);
    78     key = buff;
    79     if (dc.NbParam(key) < 1) {   
    80       msg = "Missing or invalid card : " + key;
    81       pb = true;  break;
    82     }
    83     sprintf(buff, "SCSPEC%d", kc+1);
    84     key = buff;
    85     if (dc.NbParam(key) < 1)  {   
    86       msg = "Missing or invalid card : " + key;
    87       pb = true;  break;
    88     }
    89 
    90     }
    91 
    92   if (pb)  {
    93     rc = 72;
    94     goto problem;
    95   }
    96 
    97   cout << " skymix/Info : NComp = " <<  ncomp << " M_SphereGorski= " << mg << endl;
    98 
    99   SphereGorski<float> outgs(mg);
    100   cout << " Creating Output Gorski Map  NbPixels= " << outgs.NbPixels() << endl;
     66  rc = CheckCards(dc, msg);
     67  if (rc) goto Fin;
     68
     69  cout << " skymix/Info : NComp = " <<  nskycomp << " SphereGorski_NSide= " << hp_nside << endl;
     70  cout << "  ... MapPath = " << (string)mapPath << "  DbgLev= " << debuglev << endl;
     71
     72// We create an output persist file for writing debug objects
     73  if (debuglev > 0) so = new POutPersist("skymixdbg.ppf");
     74
     75  SphereGorski<float> outgs(hp_nside);
     76  cout << " Output Gorski Map  created - NbPixels= " << outgs.NbPixels() << endl;
    10177  outgs.SetPixels(0.);
    10278
     
    11187  cout << filt << endl;
    11288
     89// FOR debug
     90  if (debuglev > 0)  SpectralResponse2Nt(filt, *so, "filter");
     91
    11392  PrtTim(" After FilterCreation ");
    114   }
     93
     94  SphereGorski<float> * ings = NULL;  // Our input map 
     95  FitsIoServer fios; // Our FITS IO Server
     96  char * flnm, buff[64];
     97  string key;
     98
     99  // Loop over sky component
     100  int sk;
     101  for(sk = 0; sk<nskycomp; sk++) {
     102    cout << " Processing sky component No " << sk+1 << endl;
     103    if (ings) { delete ings;  ings = NULL; }
     104    ings = new SphereGorski<float>(hp_nside);
     105    sprintf(buff, "MAPFITSFILE%d", sk+1);
     106    key = buff;
     107    flnm = BuildFITSFileName(dc.SParam(key, 0));
     108    cout << " Reading Input FITS map " << (string)flnm << endl;
     109    fios.load(*ings, flnm, 1);
     110
     111    if (debuglev > 4) {  // Writing tne input map to the outppf
     112      FIO_SphereGorski<float> fiog(ings);
     113      fiog.Write(*so, key);
     114      } 
     115    }
     116  }   // End of try block
    115117
    116118catch (PException exc) {
    117119  msg = exc.Msg();
    118120  cerr << " !!!! skymixer - Catched exception - Msg= " << exc.Msg() << endl;
    119   rc = 70;
     121  rc = 90;
    120122  }   
    121123
    122124
    123 problem:
     125Fin:
     126if (so) delete so;  //  Closing the debug ppf file
    124127if (rc == 0)  return(0);
    125128cerr << " Error condition -> Rc= " << rc << endl;
     
    128131}
    129132
     133/* Nouvelle-Fonction */
     134int CheckCards(DataCards & dc, string & msg)
     135//   Function to check datacards
     136{
     137mapPath[0] = '\0';
     138hp_nside = 32;
     139nskycomp = 0;
     140debuglev  = 0;
     141
     142int rc = 0;
     143  //  Cheking datacards
     144  if ( (!dc.HasKey("SKYMIX")) || (!dc.HasKey("FILTER")) ) {
     145     rc = 71;
     146     msg = "Invalid parameters  - NO @SKYMIX or @FILTER card ";
     147     return(rc);
     148  }
     149
     150  // Decoding number of component and pixelisation parameter
     151  int mg = 32;
     152  int ncomp = 0;
     153  ncomp = dc.IParam("SKYMIX", 0, 0);
     154  mg = dc.IParam("SKYMIX", 1, 32);
     155  if (ncomp < 1)  {
     156    msg = "Invalid parameters  - Check datacards @SKYMIX ";
     157    rc = 72;
     158    return(rc);
     159  }
     160
     161//  Checking input FITS file specifications
     162  int kc;
     163  string key, key2;
     164  char buff[256];
     165  bool pb = false;
     166  for(kc=0; kc<ncomp; kc++) {
     167    sprintf(buff, "MAPFITSFILE%d", kc+1);
     168    key = buff;
     169    if (dc.NbParam(key) < 1) {   
     170      msg = "Missing or invalid card : " + key;
     171      pb = true;  break;
     172    }
     173    sprintf(buff, "SPECTRAFITSFILE%d", kc+1);
     174    key = buff;
     175    sprintf(buff, "SPECTRAFUNC%d", kc+1);
     176    key2 = buff;
     177    if ( (dc.NbParam(key) < 1) && (dc.NbParam(key2) < 2) )  {   
     178      msg = "Missing card or invalid parameters : " + key + " or " + key2;
     179      pb = true;  break;
     180    }
     181
     182    }
     183
     184  if (pb)  {
     185    rc = 72;
     186    return(72);
     187  }
     188
     189//  Checking detection filter specification
     190  key = "FILTER";
     191  if (dc.NbParam(key) < 3) {
     192    msg = "Missing card or invalid parameters : " + key;
     193    rc = 73;  return(rc);
     194    }
     195
     196// Initialiazing parameters
     197  rc = 0;
     198  msg = "OK";
     199  nskycomp = ncomp;
     200  hp_nside = mg; 
     201
     202// Checking for PATH definition card
     203  key = "MAPPATH";
     204  if (dc.NbParam(key) < 3)  strncpy(mapPath, dc.SParam(key, 0).c_str(), 255);
     205  mapPath[255] = '\0';
     206  key = "DEBUGLEVEL";
     207  debuglev =  dc.IParam(key, 0, 0);
     208  return(rc);
     209}
     210
     211static char buff_flnm[1024];   // Mal protege !
     212/* Nouvelle-Fonction */
     213char* BuildFITSFileName(string const & fname)
     214{
     215if (mapPath[0] != '\0') sprintf(buff_flnm, "%s/%s", mapPath, fname.c_str());
     216else sprintf(buff_flnm, "%s", fname.c_str());
     217return(buff_flnm);
     218}
     219
     220/* Nouvelle-Fonction */
    130221// template <class T>
    131222void addComponent(SpectralResponse&  sr, PixelMap<float>& finalMap,
     
    144235}
    145236
     237/* Nouvelle-Fonction */
    146238void addComponent(SpectralResponse&  sr, PixelMap<double>& finalMap,
    147239                  PixelMap<double>& mapToAdd, RadSpectra& rs, double K)
     
    158250    }
    159251}
     252
     253
     254/* Nouvelle-Fonction */
     255void RadSpec2Nt(RadSpectra & rs, POutPersist & so, string name)
     256{
     257  char *ntn[2] = {"nu","fnu"};
     258  NTuple nt(2,ntn);  // Creation NTuple (AVEC new )
     259  float xnt[2];
     260  double nu;
     261  double numin = rs.minFreq();
     262  double numax = rs.maxFreq();
     263  int nmax = 500;
     264  double dnu = (numax-numin)/nmax;
     265  for(int k=0; k<nmax; k++) {
     266    nu = numin+k*dnu;
     267    xnt[0] = nu;
     268    xnt[1] = rs.flux(nu);
     269    nt.Fill(xnt);
     270  }
     271  ObjFileIO<NTuple> oiont(nt);
     272  oiont.Write(so, name);
     273  return;
     274}
     275
     276/* Nouvelle-Fonction */
     277void SpectralResponse2Nt(SpectralResponse& sr, POutPersist & so, string name)
     278{
     279  char *ntn[2] = {"nu","tnu"};
     280  NTuple nt(2,ntn);  // Creation NTuple (AVEC new )
     281  float xnt[2];
     282  double nu;
     283  double numin = sr.minFreq();
     284  double numax = sr.maxFreq();
     285  int nmax = 500;
     286  double dnu = (numax-numin)/nmax;
     287  for(int k=0; k<nmax; k++) {
     288    nu = numin+k*dnu;
     289    xnt[0] = nu;
     290    xnt[1] = sr.transmission(nu);
     291    nt.Fill(xnt);
     292  }
     293  ObjFileIO<NTuple> oiont(nt);
     294  oiont.Write(so, name);
     295  return;
     296}
     297
  • trunk/SophyaLib/SkyT/specresp.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: specresp.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: specresp.cc,v 1.2 1999-11-20 21:00:52 ansari Exp $
    44//
    55// Description:
     
    112112  if(numax >= _numax) numax = _numax;
    113113  TrpzInteg I(SpectralResponse_transmission , numin, numax); 
    114   return((double)I);
     114  double val = (double)I;
    115115  _mySpecResp= NULL;
     116  return(val);
    116117}
    117118
     
    137138  _myLogSpecResp = const_cast<SpectralResponse *>(this);
    138139  TrpzInteg I(SpectralResponse_logTransmission ,f1Log,f2Log);
    139   return((double)I*log(10.));
     140  double val = (double)I;
    140141  _myLogSpecResp= NULL;
     142  return(val*log(10.));
    141143}
    142144
  • trunk/SophyaLib/SkyT/specresp.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: specresp.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: specresp.h,v 1.2 1999-11-20 21:00:52 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/specrespvector.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: specrespvector.cc,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     3//      $Id: specrespvector.cc,v 1.2 1999-11-20 21:00:53 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/specrespvector.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: specrespvector.h,v 1.1.1.1 1999-11-19 16:34:32 ansari Exp $
     4//      $Id: specrespvector.h,v 1.2 1999-11-20 21:00:53 ansari Exp $
    55//
    66// Description:
     
    4646  virtual double transmission(double nu) const;
    4747
     48  // Acces to Nu and T(nu) vectors
     49  inline Vector& getNuVec() { return _vecOfNu; }
     50  inline Vector& getTNuVec() { return _vecOfFDeNu; }
     51
    4852  virtual void      Print(ostream& os)  const;
    4953
  • trunk/SophyaLib/SkyT/squarefilt.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: squarefilt.cc,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     3//      $Id: squarefilt.cc,v 1.2 1999-11-20 21:00:53 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/squarefilt.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: squarefilt.h,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     4//      $Id: squarefilt.h,v 1.2 1999-11-20 21:00:54 ansari Exp $
    55//
    66// Description:
  • trunk/SophyaLib/SkyT/trianglefilt.cc

    r601 r607  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: trianglefilt.cc,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     3//      $Id: trianglefilt.cc,v 1.2 1999-11-20 21:00:54 ansari Exp $
    44//
    55// Description:
  • trunk/SophyaLib/SkyT/trianglefilt.h

    r601 r607  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: trianglefilt.h,v 1.1.1.1 1999-11-19 16:34:33 ansari Exp $
     4//      $Id: trianglefilt.h,v 1.2 1999-11-20 21:00:54 ansari Exp $
    55//
    66// Description:
Note: See TracChangeset for help on using the changeset viewer.