Changeset 669 in Sophya


Ignore:
Timestamp:
Nov 29, 1999, 5:59:13 PM (26 years ago)
Author:
ansari
Message:

Adaptation a PPersist de SpectralResponse - Suite 1 , Sophie 29/11/99

Location:
trunk/SophyaLib/SkyT
Files:
16 edited

Legend:

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

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: blackbody.cc,v 1.3 1999-11-29 14:16:03 ansari Exp $
     3//      $Id: blackbody.cc,v 1.4 1999-11-29 16:59:09 ansari Exp $
    44//
    55// Description:
     
    5757}
    5858
     59
     60void
     61BlackBody::Print(ostream& os) const
     62{
     63  os << "BlackBody::Print Temp= " << getTemperature()
     64     << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
     65  os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
     66  os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
     67
     68}
     69
     70/*
    5971void
    6072BlackBody::WriteSelf(POutPersist& s) 
     
    7587}
    7688
    77 
    78 void
    79 BlackBody::Print(ostream& os) const
    80 {
    81   os << "BlackBody::Print Temp= " << getTemperature()
    82      << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
    83   os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
    84   os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
    85 
    86 }
     89*/
  • trunk/SophyaLib/SkyT/blackbody.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: blackbody.h,v 1.3 1999-11-29 14:16:03 ansari Exp $
     4//      $Id: blackbody.h,v 1.4 1999-11-29 16:59:10 ansari Exp $
    55//
    66// Description:
     
    3333  inline void setTemperature(double newtemp) { _temperature = newtemp; }
    3434
    35   virtual void ReadSelf(PInPersist& s);
    36   virtual void WriteSelf(POutPersist& s);
    3735  // Redefintion of the Print function
    3836  virtual void      Print(ostream& os)  const;
  • trunk/SophyaLib/SkyT/easyTest.cc

    r668 r669  
    55#include "tvector.h"
    66#include "squarefilt.h"
     7#include "gaussfilt.h"
    78#include "trianglefilt.h"
    89
    9 #include "iobjspecresp.cc"
    1010
    1111int
     
    1515//   SR_ReadSelf(in);
    1616//   cout << " " << endl;
    17 
    18     PInPersist in2("outTF");
    19     SR_ReadSelf(in2);
    20     cout << " " << endl;
    2117
    2218  cout << "BlackBody!" << endl;
     
    9288  freqmax = vecOfNuRSV(SRVmaxVal-1);
    9389  SpecRespVec mySRV(vecOfNuRSV, vecOfFDeNuRSV);
     90
     91// Test ecriture en PPF
     92  {
     93  cout << " Writing mySRV (RadSpecVec to PPF " << endl;
     94  POutPersist s("srvec.ppf");
     95  s << mySRV;
     96  }
     97  {
     98  cout << " Reading  mySRV from PPF " << endl;
     99  PInPersist s("srvec.ppf");
     100  SpecRespVec srv;
     101  s >> srv;
     102  cout << srv;
     103  }
     104
    94105  double SRV    = mySRV.IntegratedSpect(freqmin,freqmax);
    95106  double logSRV = mySRV.logIntegratedSpect(freqmin,freqmax);
     
    158169  cout << "read and write things in file...ppersist!" << endl;
    159170  TriangleFilter myTF2(10,200,20,40);
    160   POutPersist outTF("outTF");
    161   myTF2.WriteSelf(outTF);
    162171//   PInPersist inTF("outTF");
    163172//   myTF2.ReadSelf(inTF);
    164  
     173
     174  {  // Test IO PPF GaussianFilter
     175  cout << " Writing  GaussianFilter gf(276., 39.6, 0.794, 27., 690.) to PPF " << endl;
     176  GaussianFilter gf(276., 39.6, 0.794, 27., 690.);
     177  POutPersist s("fgauss.ppf");
     178  s << gf ;
     179  }
     180  {
     181  cout << " Reading  GaussianFilter from PPF " << endl;
     182  PInPersist s("fgauss.ppf");
     183  GaussianFilter gf2;
     184  s >> gf2;
     185  cout << gf2 << endl;
     186  }
    165187
    166188}
  • trunk/SophyaLib/SkyT/nupower.cc

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: nupower.cc,v 1.4 1999-11-29 14:16:05 ansari Exp $
     3//      $Id: nupower.cc,v 1.5 1999-11-29 16:59:10 ansari Exp $
    44//
    55// Description:
     
    5252
    5353
     54
     55void
     56PowerLawSpectra::Print(ostream& os) const
     57{
     58  os << "PowerLawSpectra::Print f = a ((nu-nu0)/dnu)^b " << _a << "((nu-" << _nu0
     59     << ") / " << _dnu << ") ^ " << _b << endl;
     60  os << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
     61  os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
     62  os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
     63
     64}
     65
     66
     67/*
    5468void
    5569PowerLawSpectra::WriteSelf(POutPersist& s) 
     
    7690}
    7791
    78 
    79 void
    80 PowerLawSpectra::Print(ostream& os) const
    81 {
    82   os << "PowerLawSpectra::Print f = a ((nu-nu0)/dnu)^b " << _a << "((nu-" << _nu0
    83      << ") / " << _dnu << ") ^ " << _b << endl;
    84   os << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
    85   os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
    86   os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
    87 
    88 }
     92*/
  • trunk/SophyaLib/SkyT/nupower.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: nupower.h,v 1.4 1999-11-29 14:16:05 ansari Exp $
     4//      $Id: nupower.h,v 1.5 1999-11-29 16:59:10 ansari Exp $
    55//
    66// Description:
     
    3737  virtual inline double giveExp() const {return _b;};
    3838 
    39   virtual void WriteSelf(POutPersist& s) ;
    40   virtual void ReadSelf(PInPersist& s) ;
    41  
    4239
    4340protected:
  • trunk/SophyaLib/SkyT/radspec.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: radspec.h,v 1.3 1999-11-29 14:16:06 ansari Exp $
     4//      $Id: radspec.h,v 1.4 1999-11-29 16:59:11 ansari Exp $
    55//
    66// Description:
     
    7676
    7777  virtual void      Print(ostream& os)  const;
    78   virtual void ReadSelf(PInPersist& s) = 0;
    79   virtual void WriteSelf(POutPersist& s) = 0;
    8078
    8179protected:
  • trunk/SophyaLib/SkyT/radspecvector.cc

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: radspecvector.cc,v 1.4 1999-11-29 14:16:06 ansari Exp $
     3//      $Id: radspecvector.cc,v 1.5 1999-11-29 16:59:11 ansari Exp $
    44//
    55// Description:
     
    3939  _numin = nu(0);
    4040  _numax = nu(nu.NElts()-1);
    41   _size = nu.NElts();
    42   if(_vecOfNu.NElts() != _vecOfFDeNu.NElts()) cout << "vectors are not compatible" << exit;
    4341}
    4442
     
    8381}
    8482
     83
     84
     85void
     86RadSpectraVec::Print(ostream& os) const
     87{
     88  //  os << "RadSpectraVec::Print (" << typeid(*this).name()
     89  //     << ") - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
     90  os << "RadSpectraVec::Print  - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
     91  os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
     92  os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
     93
     94}
     95
     96/*
    8597void
    8698RadSpectraVec::WriteSelf(POutPersist& s)
     
    114126  cout <<    _numin<< "-" <<  _numax << endl;
    115127}
     128*/
    116129
    117130
    118 
    119 void
    120 RadSpectraVec::Print(ostream& os) const
    121 {
    122   //  os << "RadSpectraVec::Print (" << typeid(*this).name()
    123   //     << ") - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
    124   os << "RadSpectraVec::Print  - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
    125   os << "MeanFreq= " << meanFreq() << "  Emission= " << flux(meanFreq()) << endl;
    126   os << "PeakFreq= " << peakFreq() << "  Emission= " << flux(peakFreq()) << endl;
    127 
    128 }
    129 
    130 
  • trunk/SophyaLib/SkyT/radspecvector.h

    r668 r669  
    5050  inline double getNuVec(int i) const { return _vecOfNu(i); }
    5151  inline double getFNuVec(int i) const { return _vecOfFDeNu(i); }
    52   inline int NbElts() const { return _size;}
    53   virtual void ReadSelf(PInPersist& s);
    54   virtual void WriteSelf(POutPersist& s);
    5552
    5653  virtual void   Print(ostream& os)  const;
     
    5956  Vector _vecOfNu;
    6057  Vector _vecOfFDeNu;
    61   int _size;
    6258};
    6359
  • trunk/SophyaLib/SkyT/skyinit.cc

    r668 r669  
    22#include <unistd.h>
    33
    4 #include "sambainit.h"
     4#include "skyinit.h"
    55#include "ppersist.h"
    66#include "objfio.h"
    77#include "specrespvector.h"
    8 #include "gaussianfilter.h"
     8#include "gaussfilt.h"
    99
    1010int SkyTInitiator::FgInit = 0;
  • trunk/SophyaLib/SkyT/specrespvector.cc

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: specrespvector.cc,v 1.4 1999-11-29 14:16:09 ansari Exp $
     3//      $Id: specrespvector.cc,v 1.5 1999-11-29 16:59:12 ansari Exp $
    44//
    55// Description:
     
    3232SpecRespVec::SpecRespVec(Vector const & nu, Vector const & fdenu, double numin, double numax)
    3333        : SpectralResponse(numin, numax)
     34{
     35  if(nu.NElts() != fdenu.NElts()) 
     36    throw SzMismatchError("SpecRespVec::SpecRespVec() - Non equal vector sizes");
     37  _vecOfNu = nu;
     38  _vecOfFDeNu = fdenu;
     39  _size = nu.NElts();
     40  if(_vecOfNu.NElts() != _vecOfFDeNu.NElts()) cout << "vectors are not compatible" << exit;
     41}
     42
     43SpecRespVec::SpecRespVec(Vector const & nu, Vector const & fdenu)
     44        : SpectralResponse()
    3445{
    3546  if(nu.NElts() != fdenu.NElts()) 
     
    116127  s.PutR8(dobj->maxFreq());
    117128
    118   // TVector<T> has Persistence Manager
    119   s <<  dobj->getNuVec();
    120   s <<  dobj->getTNuVec();
     129  // TVector<T> has Persistence Manager
     130  s << dobj->getNuVec();
     131  {
     132  Vector& xv2 = dobj->getTNuVec();
     133  cout << xv2 ;
     134  FIO_TVector<double> vio2(&xv2);
     135  vio2.Write(s);
     136  }
    121137}
    122138
     
    132148  if(dobj == NULL)
    133149    {
    134       Vector v1(10);
    135       Vector v2(10);
    136       dobj= new SpecRespVec();
    137       ownobj= true;
     150    dobj= new SpecRespVec();
     151    ownobj= true;
    138152    }
    139  
    140153  r_8 minf, maxf;
    141154  s.GetR8(minf);
     
    143156  dobj->setMinMaxFreq(minf, maxf);
    144157  // TVector<T> has Persistence Manager
    145   s >>  dobj->getNuVec();
    146   s >>  dobj->getTNuVec();
     158  FIO_TVector<double> vio(&(dobj->getNuVec()));
     159  vio.Read(s);
     160  FIO_TVector<double> vio2(&(dobj->getTNuVec()));
     161  vio2.Read(s);
    147162}
    148163
  • trunk/SophyaLib/SkyT/specrespvector.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: specrespvector.h,v 1.3 1999-11-29 14:16:09 ansari Exp $
     4//      $Id: specrespvector.h,v 1.4 1999-11-29 16:59:12 ansari Exp $
    55//
    66// Description:
     
    3838  //Constructor
    3939  SpecRespVec();
    40   SpecRespVec(Vector const & nu, Vector const & fdenu, double numin=0., double numax=1.);
     40  SpecRespVec(Vector const & nu, Vector const & fdenu, double numin, double numax);
     41  SpecRespVec(Vector const & nu, Vector const & fdenu);
    4142
    4243  // destructor
  • trunk/SophyaLib/SkyT/squarefilt.cc

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: squarefilt.cc,v 1.3 1999-11-29 14:16:09 ansari Exp $
     3//      $Id: squarefilt.cc,v 1.4 1999-11-29 16:59:12 ansari Exp $
    44//
    55// Description:
     
    6868}
    6969
     70/*
    7071void
    7172SquareFilter::WriteSelf(POutPersist& s)
     
    8384  cout << "minFreq - maxFreq " <<  _numin << "-" << _numax  << endl;
    8485}
     86*/
  • trunk/SophyaLib/SkyT/squarefilt.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: squarefilt.h,v 1.3 1999-11-29 14:16:09 ansari Exp $
     4//      $Id: squarefilt.h,v 1.4 1999-11-29 16:59:13 ansari Exp $
    55//
    66// Description:
     
    4747  virtual double peakTransmission() const;
    4848 
    49   virtual void WriteSelf(POutPersist& s) ;
    50   virtual void ReadSelf(PInPersist& s) ;
    51  
    52  
    5349
    5450protected:
  • trunk/SophyaLib/SkyT/tgrsr.cc

    r668 r669  
    2929  if ((narg < 5) || ((narg>1) && (strcmp(arg[1],"-h") == 0)) )  {
    3030    cout << " tgrsr : Generation of RadSpectraVec and SpecRespVec in FITS  " << endl;
    31     cout << " Usage: tgrsr 0/1 Params NPoints FitsFileName [ImageR4FITSName]" << endl;
     31    cout << " Usage: tgrsr 0/1 Params NPoints FitsFileName [ImageR4FITSName] [ppfname] " << endl;
    3232    cout << " 0 -> GaussianFilter  T = A exp(((nu-nu0)/dnu)^2" << endl;
    3333    cout << " Params : A,Nu0,DNu,MinFreq,MaxFreq " << endl;
     
    8282      img(k,1) = tnu(k);
    8383    }
     84    if ((typ == 0) && (narg > 6)) { // Writing to ppf  file
     85      cout << "writing SpecRespVec(" << npt << ") to PPF file: "
     86           << (string)(arg[6]) << endl;
     87      cout << sr ;
     88      cout << srv ;
     89      {
     90        POutPersist pos(arg[6]);
     91        pos << srv;
     92      }
     93      PrtTim("End of ImageR4->PPF ");
     94    }
     95
    8496  }
    8597  else { // Generation de RadSpectraVec from PowerLawSpectra
  • trunk/SophyaLib/SkyT/trianglefilt.cc

    r668 r669  
    11//--------------------------------------------------------------------------
    22// File and Version Information:
    3 //      $Id: trianglefilt.cc,v 1.3 1999-11-29 14:16:10 ansari Exp $
     3//      $Id: trianglefilt.cc,v 1.4 1999-11-29 16:59:13 ansari Exp $
    44//
    55// Description:
     
    6767}
    6868
     69/*
    6970void
    7071TriangleFilter::WriteSelf(POutPersist& s)
     
    8990
    9091}
     92
     93*/
  • trunk/SophyaLib/SkyT/trianglefilt.h

    r668 r669  
    22//--------------------------------------------------------------------------
    33// File and Version Information:
    4 //      $Id: trianglefilt.h,v 1.3 1999-11-29 14:16:10 ansari Exp $
     4//      $Id: trianglefilt.h,v 1.4 1999-11-29 16:59:13 ansari Exp $
    55//
    66// Description:
     
    4343  virtual double peakFreq() const;
    4444  virtual double peakTransmission() const;
    45   virtual void WriteSelf(POutPersist& s) ;
    46   virtual void ReadSelf(PInPersist& s)  ;
    4745
    4846protected:
Note: See TracChangeset for help on using the changeset viewer.