Changeset 612 in Sophya for trunk/Poubelle


Ignore:
Timestamp:
Nov 22, 1999, 10:43:44 AM (26 years ago)
Author:
ansari
Message:

fin de fichier, start

Location:
trunk/Poubelle/archTOI.old
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Poubelle/archTOI.old/archfileset.cc

    r534 r612  
    155155    if (fich.nextBlock()) {
    156156      file1stSamp[*i] = fich.blockNum()*72; // premier numsample
    157       cout << "File " << *i << " 1st sample = " << fich.blockNum()*72 << endl;
     157      cout << "File " << *i << " 1st sample = " << fich.blockNum()*72
     158                            << " UTC " << archParam.acq.SN2UTC(fich.blockNum()*72) << endl;
    158159    } else {
    159160      cout << "File " << *i << " unrecoverable, skipping" << endl;
  • trunk/Poubelle/archTOI.old/archparam.cc

    r534 r612  
    2121ArchParam::SSTParam::SSTParam()
    2222:  soustPente   (true),
    23    analFine     (false)
     23   analFine     (true)
    2424{}
    2525
  • trunk/Poubelle/archTOI.old/archvers.h

    r534 r612  
    22#define ARCHVERS_H
    33
    4 #define ARCHTOI_VERS "2.0"
    5 #define ARCHTOI_TAG  "V_011199"
     4#define ARCHTOI_VERS "3.0"
     5#define ARCHTOI_TAG  "V_191199"
    66
    77#endif
  • trunk/Poubelle/archTOI.old/gondolageom.cc

    r581 r612  
    44#include <math.h>
    55#include "gondolageom.h"
     6
     7
    68extern "C" {
    79#include "aa_hadec.h"
     
    2729           
    2830
    29 GondolaGeom::GondolaGeom() {
     31GondolaGeom::GondolaGeom()
     32: fit(200, 2)
     33{
    3034  azPend = 0;
    3135  angPend = 0;
     
    5155  if (nstars<0) {
    5256    nstars = 0;
    53     saz=staz=st=st2=0;
     57    fit.clear();
    5458  }
    5559 
     
    6165  if (azCor - az0 >  180) azCor -= 360;
    6266  if (azCor - az0 < -180) azCor += 360;
    63   saz  += azCor;
    64   staz += azCor*deltasn;
    65   st   += deltasn;
    66   st2  += deltasn*deltasn;
     67 
     68  fit.addData(deltasn, azCor);
    6769}
    6870
     
    7072int GondolaGeom::solveStars() {
    7173  if (nstars<2) return -1;
    72   staz /= nstars;
    73   st   /= nstars;
    74   saz  /= nstars;
    75   st2  /= nstars;
    76   double a = (staz - st*saz) / (st2 - st*st);
    77   double b = saz - a*st;
    78  
    79   nstars = -1;
    80  
    81   azimut = b;
     74  fit.doFit();
     75  azimut = fit.value(0);
    8276 
    8377  if (azimut > 360) azimut -= 360;
    8478  if (azimut < 0)   azimut += 360;
    8579
     80  nstars = -1;
     81 
    8682  return 0;
    8783}
  • trunk/Poubelle/archTOI.old/gondolageom.h

    r581 r612  
    44#ifndef GONDOLAGEOM_H
    55#define GONDOLAGEOM_H
     6
     7#include "polfitclip.h"
    68
    79class GondolaGeom {
     
    5961 
    6062  long nstars;
    61   double saz,staz,st,st2;
    6263  double az0;
     64 
     65  PolFitClip fit;
    6366};
    6467
  • trunk/Poubelle/archTOI.old/starmatcher.cc

    r581 r612  
    1111
    1212#define STARDUMP
     13
     14#define TEchan TFin
    1315
    1416#include <math.h>
     
    271273     
    272274        double da = azim-az; if (da>360) da -= 360;
    273         if (da < -0.6 || da > 0.4) continue;
     275       // if (da < -0.6 || da > 0.4) continue; // appropriate for TEchan
     276        if (da < -0.7 || da > 0.3) continue; // appropriate for TFin
    274277        double elv0 = elv - GondolaGeom::sstPixelHeight * lastStar.NoDiode;
    275278        if (fabs(elv0-GondolaGeom::elevSST0) > 0.25) continue; // Might be too strong
     
    568571int StarMatcher::getPendulInfo(double sampleNum, pendulInfo& info) {
    569572
     573  static double lastSN = -1;
     574  static pendulInfo lastPendul;
     575 
     576  if (sampleNum == lastSN) {
     577    info = lastPendul;
     578    return 0;
     579  }
     580
    570581  PolFitClip2 fitPendul(30,2);
    571582
    572583  map<double, pendulInfo>::iterator i = pendulInfos.lower_bound(sampleNum);
    573584  if (i == pendulInfos.begin() && (*i).second.SN >= sampleNum) return -1;
    574   if (i == pendulInfos.end()   && (*i).second.SN <= sampleNum) return -1;
    575  
    576   if ((*i).second.SN > sampleNum) i--;
     585  if (i == pendulInfos.end()) return -1;
     586  map<double, pendulInfo>::iterator last = pendulInfos.end();
     587  if (last == pendulInfos.begin()) return -1;
     588  last--;
     589  if (i == last   && (*i).second.SN <= sampleNum) return -1;
     590 
     591  if ((*i).second.SN > sampleNum) i--; // i just before us...
     592 
     593  //$CHECK$ reject if too large a gap...
     594  if (sampleNum - (*i).second.SN > 1000) return -1;
     595  last = i; last++;
     596  if ((*last).second.SN - sampleNum > 1000) return -1;
    577597
    578598  int nn=0;
    579599  double aziprev=0, azicur=0, azi0=0;
    580600  for (map<double, pendulInfo>::iterator ii=i; ii != pendulInfos.begin(); ii--) {
    581     nn++;
    582601    pendulInfo inf1 = (*ii).second;
     602    if (fabs(inf1.SN - sampleNum) > 1000) continue;
    583603    aziprev = azicur;
    584604    azicur = inf1.azPendul;
     605    nn++;
    585606    if (nn==1) azi0 = azicur;
    586607    if (nn>1 && azicur - aziprev > 180)  azicur -= 360;
     
    593614  if (i != pendulInfos.end()) i++;
    594615  for (map<double, pendulInfo>::iterator ii=i; ii != pendulInfos.end(); ii++) {
    595     nn++;
    596616    pendulInfo inf1 = (*ii).second;
     617    if (fabs(inf1.SN - sampleNum) > 1000) continue;
    597618    aziprev = azicur;
    598619    azicur = inf1.azPendul;
     620    nn++;
    599621    if (nn>1 && azicur - aziprev > 180)  azicur -= 360;
    600622    if (nn>1 && azicur - aziprev < -180) azicur += 360;
     
    610632  if (info.azPendul <   0) info.azPendul += 360;
    611633  info.angPendul  = fitPendul.valueY(sampleNum);
     634 
     635  lastSN = sampleNum;
     636  lastPendul = info;
     637
    612638  return 0;
    613639}
    614 
    615 #if 0
    616 
    617 int StarMatcher::getPendulInfo(double sampleNum, pendulInfo& info) {
    618   static double* sn    = ::vector(1, 100);
    619   static double* aziP  = ::vector(1, 100);
    620   static double* ampP  = ::vector(1, 100);
    621   static double* sig   = ::vector(1, 100);
    622   static double* aAzi  = ::vector(1, 3);
    623   static double* aAmp  = ::vector(1, 3);
    624   static int*   ia    = ::ivector(1,3);
    625   static double** cov  = ::matrix(1,3,1,3);
    626   int ndata = 0;
    627   map<double, pendulInfo>::iterator i = pendulInfos.lower_bound(sampleNum);
    628   if (i == pendulInfos.begin() && (*i).second.SN >= sampleNum) return -1;
    629   if (i == pendulInfos.end()   && (*i).second.SN <= sampleNum) return -1;
    630  
    631   if ((*i).second.SN > sampleNum) i--;
    632 
    633   int nn=0;
    634   for (map<double, pendulInfo>::iterator ii=i; ii != pendulInfos.begin(); ii--) {
    635     nn++;
    636     ndata++;
    637     pendulInfo inf1 = (*ii).second;
    638     sn[ndata]   = inf1.SN;
    639     ampP[ndata] = inf1.angPendul;
    640     aziP[ndata] = inf1.azPendul;
    641     int prev = ndata-1;
    642     if (ndata>1 && aziP[ndata] - aziP[prev] > 180)  aziP[ndata] -= 360;
    643     if (ndata>1 && aziP[ndata] - aziP[prev] < -180) aziP[ndata] += 360;
    644     sig[ndata]  = 1;
    645     if (nn>=50) break;
    646   }
    647  
    648   nn=0;
    649   if (i != pendulInfos.end()) i++;
    650   for (map<double, pendulInfo>::iterator ii=i; ii != pendulInfos.end(); ii++) {
    651     nn++;
    652     ndata++;
    653     pendulInfo inf1 = (*ii).second;
    654     sn[ndata]   = inf1.SN;
    655     ampP[ndata] = inf1.angPendul;
    656     aziP[ndata] = inf1.azPendul;
    657     int prev = ndata-1;
    658     if (nn==1) prev=1;
    659     if (ndata>1 && aziP[ndata] - aziP[prev] > 180)  aziP[ndata] -= 360;
    660     if (ndata>1 && aziP[ndata] - aziP[prev] < -180) aziP[ndata] += 360;
    661     sig[ndata]  = 1;
    662     if (nn>=50) break;
    663   }
    664  
    665   if (ndata < 3) return -1;
    666  
    667   ia[1] = ia[2] = ia[3] = 1;
    668   double chi2;
    669   try {
    670     lfit(sn, aziP,  sig, ndata, aAzi, ia, 3, cov, &chi2, polfunc);
    671     lfit(sn, ampP,  sig, ndata, aAmp, ia, 3, cov, &chi2, polfunc);
    672   } catch(string st) {
    673     return -1;
    674   }
    675 
    676   info.SN = sampleNum;
    677   info.azPendul   = polval(sampleNum, aAzi, 3);
    678   if (info.azPendul > 360) info.azPendul -= 360;
    679   if (info.azPendul <   0) info.azPendul += 360;
    680   info.angPendul  = polval(sampleNum, aAmp, 3);
    681   return 0;
    682 }
    683 
    684 #endif
    685 
    686 #if 0
    687 
    688 int StarMatcher::getPendulInfo(double sampleNum, pendulInfo& info) {
    689   map<double, pendulInfo>::iterator i = pendulInfos.lower_bound(sampleNum);
    690   if (i == pendulInfos.begin() && (*i).second.SN >= sampleNum) return -1;
    691   if (i == pendulInfos.end()   && (*i).second.SN <= sampleNum) return -1;
    692  
    693   if ((*i).second.SN > sampleNum) i--;
    694   pendulInfo inf1 = (*i).second;
    695   i++;
    696   pendulInfo inf2 = (*i).second;
    697  
    698   info.SN = sampleNum;
    699   if (inf2.azPendul - inf1.azPendul > 180)  inf2.azPendul -= 360;
    700   if (inf2.azPendul - inf1.azPendul < -180) inf2.azPendul += 360;
    701   info.azPendul  = inf1.azPendul  + (inf2.azPendul  -  inf1.azPendul) * (sampleNum - inf1.SN) / (inf2.SN - inf1.SN);
    702   if (info.azPendul<0)    info.azPendul += 360;
    703   if (info.azPendul>360)  info.azPendul += 360;
    704   info.angPendul = inf1.angPendul + (inf2.angPendul - inf1.angPendul) * (sampleNum - inf1.SN) / (inf2.SN - inf1.SN);
    705   return 0;
    706 }
    707 
    708 #endif
    709640
    710641
  • trunk/Poubelle/archTOI.old/toiboloproducer.cc

    r555 r612  
    55#include "archexc.h"
    66#include "requesthandler.h"
     7#include "polfitclip.h"
    78
    8 #define filt2 "boloMuV"
     9#define boloMuV "boloMuV"
    910
    1011
    1112TOIBoloProducer::TOIBoloProducer() {
    12   possibleTOIs.insert(TOI(filt2, TOI::all, "", "microVolts")); 
     13  possibleTOIs.insert(TOI(boloMuV, TOI::all, "linfilt sqfilt", "microVolts")); 
    1314}
    1415
     16// No option == linfilt
     17
    1518string TOIBoloProducer::getName() {
    16   return("TOIBoloProducer 1.0");
     19  return("TOIBoloProducer 1.1");
    1720}
     21
     22int TOIBoloProducer::filtHalfRange = 20;
    1823
    1924
     
    2126  if (source->canGetValue(sampleNum-1, toi)) {
    2227    value = (value + source->getValue(sampleNum-1, toi))/2.;
    23     TOI toi2 = toi;
    24     toi2.name = filt2;
     28   
     29    //TOI toi2 = toi;
     30    //toi2.name = boloMuV;
     31
     32    TOI toi2(boloMuV, toi.index, "sqfilt", toi.unit);
    2533    computedValue(toi2, sampleNum, value);
     34  }
     35 
     36  // $CHECK$ possible optimization : keep fit for several successive values
     37 
     38  if (source->canGetValue(sampleNum-2*filtHalfRange, toi)) {
     39    PolFitClip fit(2*filtHalfRange,1);
     40    int s = sampleNum % 2 ? 1 : -1;
     41    for (int i=0; i<2*filtHalfRange-1; i++) {
     42      fit.addData(sampleNum - i,
     43         s*(source->getValue(sampleNum - i, toi) -  source->getValue(sampleNum - i -1, toi))/2);
     44      s = -s;
     45    }
     46    fit.doFit();
     47    double y = source->getValue(sampleNum - filtHalfRange, toi);
     48    s = sampleNum % 2 ? 1 : -1;
     49    y =y - s*fit.value(sampleNum - filtHalfRange);
     50    TOI toi2(boloMuV, toi.index, "linfilt", toi.unit);
     51    if (isProducing(toi2))
     52      computedValue(toi2, sampleNum - filtHalfRange, y);
     53    TOI toi3(boloMuV, toi.index, "", toi.unit);
     54    if (isProducing(toi3))
     55      computedValue(toi3, sampleNum - filtHalfRange, y);
    2656  }
    2757}
    2858
    2959set<TOI> TOIBoloProducer::reqTOIFor(TOI const& toi) {
    30   TOI toi2 = toi;
    3160  set<TOI> t;
    32   if (toi.name == filt2) {
    33     toi2.name = "boloRawMuV";
     61  if (toi.name == boloMuV) {
     62    TOI toi2("boloRawMuV", toi.index);
     63    //toi2.name = "boloRawMuV";
    3464    t.insert(toi2);
    3565  } else {
  • trunk/Poubelle/archTOI.old/toiboloproducer.h

    r534 r612  
    1818  virtual set<TOI>     reqTOIFor(TOI const&);
    1919  virtual void         propagateLowBound(TOI const&, long sampleNum);
     20 
     21  static int filtHalfRange;
    2022};
    2123
  • trunk/Poubelle/archTOI.old/toiiter.cc

    r555 r612  
    205205  processRequest("#UTCORIGIN 1376.5");
    206206  processRequest("#ASIGPS ASI_GPS_archeops1999.ascii");
    207   processRequest("#COMMENT Archtoi V2 -- october 1999 -- Eric Aubourg CEA/DAPNIA");
    208   processRequest("#COMMENT ***WARNING***");
    209   processRequest("#COMMENT ***SOME TOI'S ARE PRELIMINARY***");
    210   processRequest("#COMMENT gyroSpeed is not calibrated");
    211   processRequest("#COMMENT azimut/alpha/delta use galaxy crossings and ASI GPS data");
    212   processRequest("#COMMENT   and assume no pendulation");
    213   processRequest("#COMMENT Focal plane center elevation found at 41.5 deg");
    214   processRequest("#COMMENT   with Jupiter");
    215   processRequest("#COMMENT boloMuV2 is not protected against glitches");
     207  processRequest("#COMMENT Archtoi V3 -- novembre 1999 -- Eric Aubourg CEA/DAPNIA");
    216208}
    217209
     
    233225  }
    234226
    235   fset.setMJDRange(mjdStart-0.01, mjdEnd+0.01);
    236   fset.setSNumRange(sStart-1000, sEnd+1000);
     227  // Let's add some time on each side, 30 seconds should be ok, at least
     228  // for Trapani
     229 
     230  double delT = 30. / 86400;
     231  long   delSN = long(delT / archParam.acq.perEch);
     232
     233  fset.setMJDRange(mjdStart-delT, mjdEnd+delT);
     234  fset.setSNumRange(sStart-delSN, sEnd+delSN);
    237235
    238236  fset.init();
     
    267265// Si on a epuise les fichiers de donnees, on s'arrete des qu'aucune
    268266// TOI n'a de valeurs apres curSample...
    269   if (curSample <= 0) curSample = sStart-1;
     267  if (curSample <= 0) curSample = sStart-1; 
     268  if (curSample <= 0) {
     269    long sn = archParam.acq.MJD2SN(mjdStart) - 1;
     270    if (sn > curSample) curSample = sn;
     271  }
     272 
    270273  if (curSample <= 0) curSample = fset.getSampleIndex()-1;
    271274 
     
    288291    }
    289292    bool found=false;
    290     bool valuesAhead = false;
     293    //bool valuesAhead = false;
    291294    for (vector<TOIInfo>::iterator i = request.begin(); i != request.end(); i++) {
    292295      if (((*i).third & triggering) == 0) continue;
    293296      if ((*i).second->canGetValue(curSample, (*i).first)) {found=true;break;}
    294       if ((*i).second->lastSampleNum((*i).first)>curSample) valuesAhead=true;
     297      //if ((*i).second->lastSampleNum((*i).first)>curSample) valuesAhead=true;
    295298    }
    296299    if (found) break;
    297     if (endFound && !valuesAhead) return false;
     300    if (endFound && curSample >= fset.getSampleIndex()+71) return false;
    298301  }
    299302  return true;
Note: See TracChangeset for help on using the changeset viewer.