IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8886


Ignore:
Timestamp:
Sep 22, 2006, 11:35:34 AM (20 years ago)
Author:
magnier
Message:

fixed compile errors from pmShutterCorrection stuff

Location:
trunk/psModules/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmShutterCorrection.c

    r8884 r8886  
    6161
    6262#include "pmShutterCorrection.h"
     63#include "psVectorBracket.h"
    6364
    6465static void pmShutterCorrParsFree (pmShutterCorrPars *pars)
     
    8990
    9091    pmShutterCorrPars *pars = pmShutterCorrParsAlloc ();
    91 
    92     N = exptime->n;
     92    psPolynomial1D *line = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1);
     93
     94    int N = exptime->n;
    9395    // ASSERT (N >> 5)
    9496
     
    111113
    112114    // fit a line and extrapolate the fit to 0.0
    113     psPolynomial1D *line = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1);
    114     line = psVectorFitPolynomial1D (line, NULL, 0, tmpY, NULL, tmpX);
    115     ratio = psPolynomial1DEval (line, 0.0) / pars->scale;
     115    psVectorFitPolynomial1D (line, NULL, 0, tmpY, NULL, tmpX);
     116    float ratio = psPolynomial1DEval (line, 0.0) / pars->scale;
    116117
    117118    // XXX we need a sanity check:
     
    122123
    123124    // find two points bracketing the value counts = A (1 + dTk/dTo) / 2 = pars->scale (1 + ratio) / 2
    124     value = pars->scale * (1 + ratio) / 2.0;
    125 
    126     Nm = psVectorBracket (exptime, value, (ratio < 1.0));
    127     Np = (Nm == N - 1) ? Nm - 1 : Nm + 1;
     125    float value = pars->scale * (1 + ratio) / 2.0;
     126
     127    int Nm = psVectorBracket (exptime, value, (ratio < 1.0));
     128    int Np = (Nm == N - 1) ? Nm - 1 : Nm + 1;
    128129
    129130    tmpX->data.F64[0] = counts->data.F64[Nm];
     
    133134
    134135    // fit a line and extrapolate the fit to counts = A (1 + dTk/dTo) : exptime = dTo
    135     psPolynomial1D *line = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1);
    136136    line = psVectorFitPolynomial1D (line, NULL, 0, tmpY, NULL, tmpX);
    137137    pars->offref = psPolynomial1DEval (line, value);
     
    154154
    155155    for (int i = 0; i < exptime->n; i++) {
    156         value = 1.0 / (exptime->data.F32[i] + offref);
     156        float value = 1.0 / (exptime->data.F32[i] + offref);
    157157        x->data.F32[i] = exptime->data.F32[i] * value;
    158158        y->data.F32[i] = value;
     
    171171    pmShutterCorrPars *pars = pmShutterCorrParsAlloc ();
    172172
    173     pars->offref = guess->offref;
     173    pars->offref = offref;
    174174    pars->scale  = line->coeff[1][0];
    175175    pars->offset = line->coeff[0][1] / line->coeff[1][0];
     
    235235    }
    236236
    237     fitStatus = psMinimizeLMChi2(myMin, covar, params, constrain, x, y, yErr, pmShutterCorrectionModel);
     237    psMinimizeLMChi2(myMin, covar, params, constrain, x, y, yErr, pmShutterCorrectionModel);
    238238
    239239    pmShutterCorrPars *pars = pmShutterCorrParsAlloc ();
  • trunk/psModules/src/objects/Makefile.am

    r8569 r8886  
    2222     pmPSF_IO.c \
    2323     pmPSFtry.c \
    24      pmGrowthCurve.c
     24     pmGrowthCurve.c \
     25     psVectorBracket.c
    2526
    2627EXTRA_DIST = \
     
    4546     pmPSF_IO.h \
    4647     pmPSFtry.h \
    47      pmGrowthCurve.h
     48     pmGrowthCurve.h \
     49     psVectorBracket.h
    4850
    4951CLEANFILES = *~
  • trunk/psModules/src/objects/pmGrowthCurve.c

    r8815 r8886  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-09-15 09:49:01 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-09-22 21:35:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <pslib.h>
    1919#include "pmGrowthCurve.h"
     20#include "psVectorBracket.h"
    2021
    2122static void pmGrowthCurveFree (pmGrowthCurve *growth)
     
    5758}
    5859
    59 // return the last entry below or first entry above key value
    60 int psVectorBracket (psVector *index, psF32 key, bool above)
    61 {
    62 
    63     int N;
    64     int Nlo = 0;
    65     int Nhi = index->n;
    66 
    67     if (above) {
    68         while (Nhi - Nlo > 10) {
    69             N = 0.5*(Nlo + Nhi);
    70             if (index->data.F32[N] > key) {
    71                 Nhi = N;
    72             } else {
    73                 Nlo = N - 1;
    74             }
    75         }
    76         // at this point, index[Nhi] > key >= index[Nlo]
    77         N = Nlo;
    78         while ((index->data.F32[N] <= key) && (N < Nhi)) {
    79             N++;
    80         }
    81         return (N);
    82     }
    83     while (Nhi - Nlo > 10) {
    84         N = 0.5*(Nlo + Nhi);
    85         if (index->data.F32[N] < key) {
    86             Nlo = N;
    87         } else {
    88             Nhi = N + 1;
    89         }
    90     }
    91     // at this point, index[Nhi] >= key > index[Nlo]
    92     N = Nhi;
    93     while ((index->data.F32[N] >= key) && (N > Nlo)) {
    94         N--;
    95     }
    96     return (N);
    97 }
    98 
    99 // search for the bins bounding key in index, interpolate the corresponding values
    100 psF32 psVectorInterpolate (psVector *index, psVector *value, psF32 key)
    101 {
    102 
    103     int n0 = 0;
    104     int n1 = 0;
    105 
    106     // extrapolate at ends
    107     if (key < index->data.F32[0]) {
    108         n0 = 0;
    109         n1 = 1;
    110     }
    111 
    112     // extrapolate at ends
    113     if (key > index->data.F32[index->n-1]) {
    114         n0 = index->n-2;
    115         n1 = index->n-1;
    116     }
    117 
    118     if (n1 == 0) {
    119         n0 = psVectorBracket (index, key, FALSE);
    120         n1 = n0 + 1;
    121     }
    122 
    123     if (n0 == index->n-1) {
    124         n1 = n0;
    125         n0 = n1 - 1;
    126     }
    127 
    128     float dy = value->data.F32[n1] - value->data.F32[n0];
    129     float dx = index->data.F32[n1] - index->data.F32[n0];
    130     float dX = key - index->data.F32[n0];
    131     float dY = dX * (dy/dx);
    132     float result = value->data.F32[n0] + dY;
    133     return result;
    134 }
    135 
  • trunk/psModules/src/psmodules.h

    r7679 r8886  
    4444#include <pmSubtractBias.h>
    4545#include <pmDetrendDB.h>
     46#include <pmShutterCorrection.h>
    4647// #include <pmSubtractSky.h>
    4748
     
    7071#include <pmModelGroup.h>
    7172#include <pmSourcePhotometry.h>
     73#include <psVectorBracket.h>
    7274
    7375#endif
Note: See TracChangeset for help on using the changeset viewer.