Changeset 1321 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Nov 13, 2000, 4:32:34 PM (25 years ago)
Author:
ercodmgr
Message:

Adaptateur de TArray et lecture FITS - Reza 13/11/2000

Location:
trunk/SophyaPI/PIext
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/cxxexecwin.cc

    r1319 r1321  
    160160  switch (msg)  {
    161161    case 600:    // Bouton Execute C++
    162       dap->SetBusy();
    163162      SetUnSensitive();
    164163      dap->GetConsole()->AddStr(
    165164         "CxxExecWind::Process() - Executing C++ Code ... \n", PIVA_Magenta);
     165      dap->SetBusy();
    166166      cxxex->ExecuteCXX(mText[1]->GetText(),mText[0]->GetText());
    167167      dap->GetConsole()->AddStr(
    168          "CxxExecWind ... End of Executing C++ Code \n", PIVA_Magenta);
     168         "CxxExecWind ... End of Executing C++ Code \n");
    169169      SetSensitive();
    170170      dap->SetReady();
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r1315 r1321  
    2222#ifdef SANS_EVOLPLANCK
    2323#include "fitsimage.h" 
     24#else
     25#include "fitsautoreader.h"
    2426#endif
    2527
     
    536538
    537539if ( (myImgApp != NULL) && (myImgApp->ObjMgrW())->Visible() ) {
    538   string oln = nobj + "  (T= " + typeid(*obj).name() + ")" ;
     540  string oln = nobj + "  (T= " + no.obja->GetDataObjType() + ")" ;
    539541  (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
    540542  }
     
    604606if ( (myImgApp != NULL) && (myImgApp->ObjMgrW())->Visible() ) {
    605607  (myImgApp->ObjMgrW())->DelObjList(dids, no.oid);
    606   string oln = n2 + "  (T= " + typeid(*(no.obj)).name() + ")" ;
     608  string oln = n2 + "  (T= " + no.obja->GetDataObjType() + ")" ;
    607609  (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
    608610}
     
    942944}
    943945#else
    944  cerr << " NamedObjMgr::ReadFits() Vide ! A faire Reza ! " << endl;
     946 try {
     947   FITS_AutoReader fiar(flnm);
     948   char buff[512], bun[16];
     949   strncpy(buff, flnm.c_str(), 512);
     950   int nhdu = FitsInFile::NbBlocks(buff);
     951   if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
     952   string name;
     953   AnyDataObj* obj;
     954   for(int k=1; k<=nhdu; k++) {
     955     obj = fiar.ReadObject(k);
     956     if (obj)
     957       cout << " NamedObjMgr::ReadFits() " << (string)typeid(*obj).name()
     958            << "  read From HDU " << k << endl;
     959     else cerr << " NamedObjMgr::ReadFits()  NULL pointer from FITS_AutoReader" << endl;
     960     if (k > 1) {
     961       sprintf(bun, "%d", k);
     962       name = nobj + bun;
     963     }
     964     else name = nobj;
     965     AddObj(obj, name);
     966   }
     967 }
     968 catch(PThrowable & exc) {
     969   cerr << " NamedObjMgr::ReadFits() / Error - Catched Exception \n "
     970        << "    Type= " << (string)typeid(exc).name()
     971        << " - Msg= " << exc.Msg() << endl;
     972
     973   }
    945974#endif
    946975
     
    13741403  if ((*it).second.dirid != did) continue;
    13751404  cn = (*it).first.substr(1);
    1376   cn = cn.substr(cn.find('/')+1) + "  (T= " + typeid(*((*it).second.obj)).name() + ")" ;
     1405  //  cn = cn.substr(cn.find('/')+1) + "  (T= " + typeid(*((*it).second.obj)).name() + ")" ;
     1406  cn = cn.substr(cn.find('/')+1) + "  (T= " + (*it).second.obja->GetDataObjType() + ")" ;
    13771407  (myImgApp->ObjMgrW())->AddObj(cn.c_str(), (*it).second.oid);
    13781408  }
  • trunk/SophyaPI/PIext/nomhistadapter.cc

    r1315 r1321  
    1313#ifndef SANS_EVOLPLANCK
    1414#include "objfitter.h"
     15#include "fitsntuple.h"
     16#include "fitsxntuple.h"
    1517#endif
    1618
     
    417419
    418420/* --Methode-- */
     421void NOMAdapter_NTuple::ReadFits(string const & flnm)
     422{
     423#ifdef SANS_EVOLPLANCK
     424  cerr << " NOMAdapter_NTuple::ReadFits() Non disponible !! " << endl;
     425#else
     426  FitsInFile fis(flnm);
     427  fis >> (*mNt);
     428#endif
     429}
     430
     431/* --Methode-- */
     432void NOMAdapter_NTuple::SaveFits(string const & flnm)
     433{
     434#ifdef SANS_EVOLPLANCK
     435  cerr << " NOMAdapter_NTuple::SaveFits() Non disponible !! " << endl;
     436#else
     437  FitsOutFile fos(flnm);
     438  fos << (*mNt);
     439
     440#endif
     441}
     442
     443
     444/* --Methode-- */
    419445void NOMAdapter_NTuple::SavePPF(POutPersist& pos, string const & nom)
    420446{
     
    482508
    483509/* --Methode-- */
     510void NOMAdapter_XNTuple::ReadFits(string const & flnm)
     511{
     512#ifdef SANS_EVOLPLANCK
     513  cerr << " NOMAdapter_XNTuple::ReadFits() Non disponible !! " << endl;
     514#else
     515  FitsInFile fis(flnm);
     516  fis >> (*mNt);
     517#endif
     518}
     519
     520/* --Methode-- */
     521void NOMAdapter_XNTuple::SaveFits(string const & flnm)
     522{
     523#ifdef SANS_EVOLPLANCK
     524  cerr << " NOMAdapter_XNTuple::SaveFits() Non disponible !! " << endl;
     525#else
     526  FitsOutFile fos(flnm);
     527  fos << (*mNt);
     528
     529#endif
     530}
     531
     532/* --Methode-- */
    484533void NOMAdapter_XNTuple::SavePPF(POutPersist& pos, string const & nom)
    485534{
  • trunk/SophyaPI/PIext/nomhistadapter.h

    r1315 r1321  
    127127  virtual AnyDataObj*           CloneDataObj(bool share=false);
    128128
    129   //  virtual void                      ReadFits(string const & flnm);
    130   //  virtual void                      SaveFits(string const & flnm);
     129  virtual void                  ReadFits(string const & flnm);
     130  virtual void                  SaveFits(string const & flnm);
    131131  virtual void                  SavePPF(POutPersist& s, string const & nom);
    132132
     
    153153  virtual AnyDataObj*           CloneDataObj(bool share=false);
    154154
    155   //  virtual void                      ReadFits(string const & flnm);
    156   //  virtual void                      SaveFits(string const & flnm);
     155  virtual void                  ReadFits(string const & flnm);
     156  virtual void                  SaveFits(string const & flnm);
    157157  virtual void                  SavePPF(POutPersist& s, string const & nom);
    158158
  • trunk/SophyaPI/PIext/nomimagadapter.cc

    r1315 r1321  
    1414#else
    1515#include "objfitter.h"
     16#include "fitstarray.h"
    1617#endif
    1718
     
    7273/* --Methode-- */
    7374template <class T>
     75void NOMAdapter_Image<T>::ReadFits(string const & flnm)
     76{
     77#ifdef SANS_EVOLPLANCK
     78  cerr << " NOMAdapter_Image<T>::ReadFits() Non disponible !! " << endl;
     79#else
     80  FitsInFile fis(flnm);
     81  fis >> (*mImg);
     82#endif
     83}
     84
     85/* --Methode-- */
     86template <class T>
    7487void NOMAdapter_Image<T>::SaveFits(string const & flnm)
    7588{
     
    7891fim.Save(flnm);
    7992#else
    80 string s = typeid(*mImg).name();
    81 cout << "NOMAdapter_Image<T>::SaveFits() - Error : Not supported for " << s << endl;
    82 #endif
    83 }
     93  FitsOutFile fos(flnm);
     94  fos << (*mImg);
     95#endif
     96}
     97
     98#ifndef SANS_EVOLPLANCK
     99void NOMAdapter_Image< uint_2 >::SaveFits(string const & flnm)
     100{
     101cout << " NOMAdapter_Image< uint_2 >::SaveFits() - Error "
     102     << " Not supported uint_2 data type ! " << endl;
     103}
     104
     105void NOMAdapter_Image< uint_2 >::ReadFits(string const & flnm)
     106{
     107cout << " NOMAdapter_Image< uint_2 >::ReadFits() - Error "
     108     << " Not supported uint_2 data type ! " << endl;
     109}
     110#endif
    84111
    85112/* --Methode-- */
  • trunk/SophyaPI/PIext/nomimagadapter.h

    r1315 r1321  
    2727  virtual AnyDataObj*           CloneDataObj(bool share=false);
    2828
    29   //  virtual void                      ReadFits(string const & flnm);
     29  virtual void                  ReadFits(string const & flnm);
    3030  virtual void                  SaveFits(string const & flnm);
    3131  virtual void                  SavePPF(POutPersist& s, string const & nom);
  • trunk/SophyaPI/PIext/nomskymapadapter.cc

    r1315 r1321  
    1414#include "complexios.h"
    1515
     16#include "fitsspherehealpix.h"
     17#include "fitslocalmap.h"
     18
     19
    1620//  Classe array adapter pour localMap
    1721template <class T>
     
    105109return(NULL);
    106110}
     111
     112/* --Methode-- */
     113template <class T>
     114void NOMAdapter_PixelMap<T>::ReadFits(string const & flnm)
     115{
     116LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
     117if (lm != NULL) {
     118  FitsInFile fis(flnm);
     119  fis >> (*lm);
     120  return;
     121}
     122SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
     123if (sg != NULL) {
     124  FitsInFile fis(flnm);
     125  fis >> (*sg);
     126  return;
     127}
     128string s = typeid(*mMap).name();
     129cout << " NOMAdapter_PixelMap<T>::ReadFits() - Error "
     130     << " Not supported for " << s << endl;
     131return;
     132}
     133
     134
     135/* --Methode-- */
     136template <class T>
     137void NOMAdapter_PixelMap<T>::SaveFits(string const & flnm)
     138{
     139LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
     140if (lm != NULL) {
     141  FitsOutFile fos(flnm);
     142  fos << (*lm);
     143  return;
     144}
     145SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
     146if (sg != NULL) {
     147  FitsOutFile fos(flnm);
     148  fos << (*sg);
     149  return;
     150}
     151string s = typeid(*mMap).name();
     152cout << " NOMAdapter_PixelMap<T>::SaveFits() - Error "
     153     << " Not supported for " << s << endl;
     154return;
     155}
     156
     157// ---- Specialisation pour complexes -----
     158void NOMAdapter_PixelMap< complex<r_4> >::ReadFits(string const & flnm)
     159{
     160cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
     161     << " Not supported (complex data type)" << endl;
     162}
     163void NOMAdapter_PixelMap< complex<r_4> >::SaveFits(string const & flnm)
     164{
     165cout << " void NOMAdapter_PixelMap< complex<r_4> >::SaveFits() - Error "
     166     << " Not supported (complex data type)" << endl;
     167}
     168void NOMAdapter_PixelMap< complex<r_8> >::ReadFits(string const & flnm)
     169{
     170cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
     171     << " Not supported (complex data type)" << endl;
     172}
     173void NOMAdapter_PixelMap< complex<r_8> >::SaveFits(string const & flnm)
     174{
     175cout << " void NOMAdapter_PixelMap< complex<r_8> >::SaveFits() - Error "
     176     << " Not supported (complex data type)" << endl;
     177}
     178
    107179
    108180/* --Methode-- */
  • trunk/SophyaPI/PIext/nomskymapadapter.h

    r1315 r1321  
    3030  virtual AnyDataObj*           CloneDataObj(bool share=false);
    3131
    32   //  virtual void                      ReadFits(string const & flnm);
    33   //  virtual void                      SaveFits(string const & flnm);
     32  virtual void                  ReadFits(string const & flnm);
     33  virtual void                  SaveFits(string const & flnm);
    3434  virtual void                  SavePPF(POutPersist& s, string const & nom);
    3535
  • trunk/SophyaPI/PIext/nomtarradapter.cc

    r1315 r1321  
    99
    1010#include "nomtarradapter.h"
     11#include "tvector.h"
     12#include "pitvmaad.h"
     13#include "piscdrawwdg.h"
    1114
    1215#include "fioarr.h"
     16#include "fitstarray.h"
    1317
    1418
     
    6367/* --Methode-- */
    6468template <class T>
     69void NOMAdapter_TArray<T>::ReadFits(string const & flnm)
     70{
     71  FitsInFile fis(flnm);
     72  fis >> (*mArr);
     73}
     74
     75/* --Methode-- */
     76template <class T>
     77void NOMAdapter_TArray<T>::SaveFits(string const & flnm)
     78{
     79  FitsOutFile fos(flnm);
     80  fos << (*mArr);
     81}
     82
     83// ---- Specialisation pour complexes -----
     84void NOMAdapter_TArray< complex<r_4> >::ReadFits(string const & flnm)
     85{
     86cout << " NOMAdapter_TArray< complex<r_4> >::ReadFits() - Error "
     87     << " Not supported (complex data type)" << endl;
     88}
     89void NOMAdapter_TArray< complex<r_4> >::SaveFits(string const & flnm)
     90{
     91cout << " NOMAdapter_TArray< complex<r_4> >::SaveFits() - Error "
     92     << " Not supported (complex data type)" << endl;
     93}
     94
     95void NOMAdapter_TArray< complex<r_8> >::ReadFits(string const & flnm)
     96{
     97cout << " NOMAdapter_TArray< complex<r_8> >::ReadFits() - Error "
     98     << " Not supported (complex data type)" << endl;
     99}
     100void NOMAdapter_TArray< complex<r_8> >::SaveFits(string const & flnm)
     101{
     102cout << " NOMAdapter_TArray< complex<r_8> >::SaveFits() - Error "
     103     << " Not supported (complex data type)" << endl;
     104}
     105
     106/* --Methode-- */
     107template <class T>
    65108void NOMAdapter_TArray<T>::SavePPF(POutPersist& pos, string const & nom)
    66109{
     
    76119}
    77120
     121/* --Methode-- */
     122template <class T>
     123PIDrawer * NOMAdapter_TArray<T>::GetDrawer(string & dopt)
     124{
     125if (mArr->NbDimensions() == 1) {
     126  // On peut en faire un vecteur ...
     127  TVector<T>* v = new TVector<T>(*mArr, true);  // on partage les donnees
     128  dopt = "thinline," + dopt;
     129  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, true), NULL, true) );
     130}
     131 else return(NULL);
     132}
     133
     134/* --Methode-- */
     135template <class T>
     136P2DArrayAdapter* NOMAdapter_TArray<T>::Get2DArray(string &)
     137{
     138if (mArr->NbDimensions() <= 2) {
     139  // On peut en faire un tableau 2-D ...
     140  TMatrix<T>* m = new TMatrix<T>(*mArr, true);  // on partage les donnees
     141  return ( new POTMatrixAdapter<T>(m, true) );
     142}
     143else return(NULL);
     144}
    78145
    79146/* --Methode-- */
  • trunk/SophyaPI/PIext/nomtarradapter.h

    r1315 r1321  
    2727  virtual AnyDataObj*           CloneDataObj(bool share=false);
    2828
    29   //  virtual void                      ReadFits(string const & flnm);
    30   //  virtual void                      SaveFits(string const & flnm);
     29  virtual void                  ReadFits(string const & flnm);
     30  virtual void                  SaveFits(string const & flnm);
    3131  virtual void                  SavePPF(POutPersist& s, string const & nom);
    3232
    3333  virtual void                  Print(ostream& os);
    34   //  virtual PIDrawer*         GetDrawer(string& dopt);
    35   //  virtual P2DArrayAdapter*  Get2DArray(string& dopt);
     34  virtual PIDrawer*             GetDrawer(string& dopt);
     35  virtual P2DArrayAdapter*      Get2DArray(string& dopt);
    3636  virtual NTupleInterface*      GetNTupleInterface(bool& adel);
    37 
    38   //  virtual GeneralFitData* GetGeneralFitData(bool& adel
    39   //        ,GeneralFitData::FitErrType errtype=GeneralFitData::DefaultError
    40   //        ,double errscale=1.,double errmin=0.
    41   //        ,int i1=0,int i2=-1,int j1=0,int j2=-1);
    42   // virtual AnyDataObj* FitResidusObj(GeneralFit& mfit);
    43   // virtual AnyDataObj* FitFunctionObj(GeneralFit& mfit);
    4437
    4538protected:
  • trunk/SophyaPI/PIext/nomtmatvecadapter.cc

    r1315 r1321  
    1515
    1616#include "fioarr.h"
    17 
     17#include "fitstarray.h"
    1818
    1919
     
    6969if (v != NULL) return( new TVector<T>(*v, share) );
    7070else return ( new TMatrix<T>(*mMtx, share) );
     71}
     72
     73/* --Methode-- */
     74template <class T>
     75void NOMAdapter_TMatrix<T>::ReadFits(string const & flnm)
     76{
     77  FitsInFile fis(flnm);
     78  fis >> (*mMtx);
     79}
     80
     81/* --Methode-- */
     82template <class T>
     83void NOMAdapter_TMatrix<T>::SaveFits(string const & flnm)
     84{
     85  FitsOutFile fos(flnm);
     86  fos << (*mMtx);
     87}
     88// ---- Specialisation pour complexes -----
     89void NOMAdapter_TMatrix< complex<r_4> >::ReadFits(string const & flnm)
     90{
     91cout << " NOMAdapter_TMatrix< complex<r_4> >::ReadFits() - Error "
     92     << " Not supported (complex data type)" << endl;
     93}
     94void NOMAdapter_TMatrix< complex<r_4> >::SaveFits(string const & flnm)
     95{
     96cout << " NOMAdapter_TMatrix< complex<r_4> >::SaveFits() - Error "
     97     << " Not supported (complex data type)" << endl;
     98}
     99
     100void NOMAdapter_TMatrix< complex<r_8> >::ReadFits(string const & flnm)
     101{
     102cout << " NOMAdapter_TMatrix< complex<r_8> >::ReadFits() - Error "
     103     << " Not supported (complex data type)" << endl;
     104}
     105void NOMAdapter_TMatrix< complex<r_8> >::SaveFits(string const & flnm)
     106{
     107cout << " NOMAdapter_TMatrix< complex<r_8> >::SaveFits() - Error "
     108     << " Not supported (complex data type)" << endl;
    71109}
    72110
  • trunk/SophyaPI/PIext/nomtmatvecadapter.h

    r1315 r1321  
    2828  virtual AnyDataObj*           CloneDataObj(bool share=false);
    2929
    30   //  virtual void                      ReadFits(string const & flnm);
    31   //  virtual void                      SaveFits(string const & flnm);
     30  virtual void                  ReadFits(string const & flnm);
     31  virtual void                  SaveFits(string const & flnm);
    3232  virtual void                  SavePPF(POutPersist& s, string const & nom);
    3333
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r1319 r1321  
    428428gimv->SetUnSensitive();
    429429PIApplication::SetBusy();
     430// Attention : Appel XSync specifique X11 -  en attendant multi-thread
     431XSync(PIXDisplay(), False); 
    430432}
    431433
     
    436438gimv->SetUnSensitive();
    437439PIApplication::SetBlocked();
     440// Attention : Appel XSync specifique X11 -  en attendant multi-thread
     441XSync(PIXDisplay(), False); 
    438442}
    439443
Note: See TracChangeset for help on using the changeset viewer.