Changeset 3330 in Sophya for trunk/Cosmo/SimLSS/geneutils.cc


Ignore:
Timestamp:
Oct 1, 2007, 7:10:50 PM (18 years ago)
Author:
cmv
Message:

intro ComputeSpectrum avec soustraction de bruit et deconvolution par la fct de transfert du pixel cmv 01/10/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/geneutils.cc

    r3329 r3330  
    5555//-------------------------------------------------------------------
    5656// Classe d'inversion d'une fonction STRICTEMENT MONOTONE CROISSANTE
    57 // - Le vecteur y a "Nin" elements y_i tels que "y_i = f(x_i)"
    58 // - On a x(i) < x(i+1) et y(i) < y(i+1)
    59 // - La classe renvoie ymin=y(0) , ymax=y(Nin -1)
    60 //   et le vecteur x = f^-1(y) de "Nout" elements
    61 //   Les y_i sont regulierement espaces et ymin et ymax
    62 //   La re-interpolation inverse est faite par lineaire
     57//
     58// - On part de deux vecteurs x,y de "Nin" elements tels que "y_i = f[x_i]"
     59//   ou la fonction "f" est strictement monotone croissante:
     60//          x(i) < x(i+1)   et   y(i) < y(i+1)
     61// - Le but de la classe est de remplir un vecteur X de "Nout" elements
     62//   tels que:    X_j = f^-1[Y_j]    avec   j=[0,Nout[
     63//   avec les Y_j regulierement espaces entre ymin=y(0) , ymax=y(Nin -1)
     64//   cad:     X_j = f^-1[ ymin+j*(ymax-ymin)/(Nout-1) ]
     65// - La construction du vecteur X est realisee
     66//   par interpolation lineaire (ComputeLinear) ou parabolique (ComputeParab)
    6367InverseFunc::InverseFunc(vector<double>& x,vector<double>& y)
    6468  : _ymin(0.) , _ymax(0.) , _x(x) , _y(y)
     
    9296}
    9397
    94 int InverseFunc::ComputeLinear(long n,vector<double>& xfcty)
     98int InverseFunc::ComputeLinear(long nout,vector<double>& xfcty)
    9599// Compute table "xfcty" by linear interpolation of "x" versus "y"
    96 //   on "n" points from "ymin" to "ymax":
    97 // xfcty[i] = interpolation of function "x" for "ymin+i*(ymax-ymin)/(n-1.)"
    98 {
    99   if(n<3) return -1;
    100 
    101   xfcty.resize(n);
     100//   on "nout" points from "ymin" to "ymax":
     101// xfcty[i] = interpolation of function "x" for "ymin+i*(ymax-ymin)/(nout-1)"
     102{
     103  if(nout<3) return -1;
     104
     105  xfcty.resize(nout);
    102106
    103107  long i1,i2;
    104108  double x;
    105   for(int_4 i=0;i<n;i++) {
    106     double y = _ymin + i*(_ymax-_ymin)/(n-1.);
     109  for(int_4 i=0;i<nout;i++) {
     110    double y = _ymin + i*(_ymax-_ymin)/(nout-1.);
    107111    find_in_y(y,i1,i2);
    108112    double dy = _y[i2]-_y[i1];
     
    118122}
    119123
    120 int InverseFunc::ComputeParab(long n,vector<double>& xfcty)
    121 {
    122   if(n<3) return -1;
    123 
    124   xfcty.resize(n);
     124int InverseFunc::ComputeParab(long nout,vector<double>& xfcty)
     125{
     126  if(nout<3) return -1;
     127
     128  xfcty.resize(nout);
    125129
    126130  long i1,i2,i3;
    127131  double x;
    128   for(int_4 i=0;i<n;i++) {
    129     double y = _ymin + i*(_ymax-_ymin)/(n-1.);
     132  for(int_4 i=0;i<nout;i++) {
     133    double y = _ymin + i*(_ymax-_ymin)/(nout-1.);
    130134    find_in_y(y,i1,i2);
    131135    // On cherche le 3ieme point selon la position de y / au 2 premiers
Note: See TracChangeset for help on using the changeset viewer.