IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2020, 1:54:47 PM (6 years ago)
Author:
tdeboer
Message:

revert to working Ohana build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/mana/deimos_mkslit.c

    r41159 r41340  
    77  // input parameters:
    88  //   slit profile response : vector of fractional flux vs x-coord
    9   //   trace_ref,trace_blu   : spline fit of slit central x pos vs y-coord
    10   //   flux (optional)       : vector of input signal vs y-coord
    11   //   sky  (optional)       : vector of input signal vs y-coord
    12   //   fluxbins (optional)   : size of output image in y-direction
    13   //   NOTE: one of flux, sky, or fluxbins must be defined
    14 
    15   // output : buff (an image with Nx defined by profile and Ny defined
    16   //                by flux, sky, or fluxbins)
     9  //   trace                 : spline fit of slit central x pos vs y-coord
     10  //   flux                  : vector of input signal vs y-coord
    1711
    1812  int N;
    1913
    20   Vector *profile   = NULL;
    21   Vector *flux      = NULL;
    22   Vector *sky       = NULL;
    23   Spline *trace_red = NULL;
    24   Spline *trace_blu = NULL;
    25   Buffer *buff      = NULL;
     14  Vector *profile = NULL;
     15  Vector *flux    = NULL;
     16  Vector *sky     = NULL;
     17  Spline *trace   = NULL;
     18  Buffer *buff    = NULL;
    2619
    2720  // user-specified flux value (otherwise assumed to be 1)
     
    4740  }
    4841
    49   // either flux or fluxbins must be specified to define output size
    50   int profilebins = 0;
    51   if ((N = get_argument (argc, argv, "-profilebins"))) {
    52     remove_argument (N, &argc, argv);
    53     profilebins = atoi (argv[N]);
    54     remove_argument (N, &argc, argv);
    55   }
    56 
    57   // for a red vs blu spline, we need to specify the split point
    58   // XXX this is REALLY ad-hoc for Deimos.  not sure how to make
    59   // this more generic (need to define the ranges somewhere)
    60   int redlimit = 4096;
    61   if ((N = get_argument (argc, argv, "-redlimit"))) {
    62     remove_argument (N, &argc, argv);
    63     redlimit = atoi (argv[N]);
    64     remove_argument (N, &argc, argv);
    65   }
    66 
    67   if (argc != 5) {
    68     gprint (GP_ERR, "USAGE: deimos mkslit (profile) (trace_red) (trace_blu) (buffer) [-flux vector] [-fluxbins N] [-sky vector]\n");
     42  if (argc != 4) {
     43    gprint (GP_ERR, "USAGE: deimos mkslit (profile) (trace) (buffer) [-flux vector] [-fluxbins N] [-sky vector]\n");
    6944    return FALSE;
    7045  }
     
    7651
    7752  // XXX I probably should rename FindSpline as SelectSpline and give it the same behavior
    78   if ((profile   = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    79   if ((trace_red = FindSpline (argv[2])) == NULL) return (FALSE);
    80   if ((trace_blu = FindSpline (argv[3])) == NULL) return (FALSE);
    81   if ((buff      = SelectBuffer (argv[4], ANYBUFFER, TRUE)) == NULL) return (FALSE);
     53  if ((profile = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
     54  if ((trace   = FindSpline (argv[2])) == NULL) return (FALSE);
     55  if ((buff    = SelectBuffer (argv[3], ANYBUFFER, TRUE)) == NULL) return (FALSE);
    8256
    8357  // define the output window
    84   // if no profile half-width is specified, use supplied profile
    85   int Nx = profilebins ? 2*profilebins + 1 : 2*profile[0].Nelements + 1;
     58  int Nx = 2*profile[0].Nelements + 1;
    8659  int Ny = flux ? flux[0].Nelements : fluxbins;
    8760 
     
    10073
    10174    // evaluate the trace spline at this y-coord to find the x-coord offset of the profile center
    102     Spline *trace = (iy < redlimit) ? trace_red : trace_blu;
    10375    float dx = spline_apply_dbl (trace->xk, trace->yk, trace->y2, trace->Nknots, iy);
    10476   
     
    11890
    11991      // set the sky in the entire window
    120       out[ix + iy*Nx] = NAN;
     92      out[ix + iy*Nx] = sky ? sky->elements.Flt[iy] : 0.0;
    12193
    12294      // equivalent coord in the profile:
     
    12698
    12799      // a default value:
    128       float vsky = sky ? sky->elements.Flt[iy] : 0.0;
    129100      float vout = NAN;
    130101
     
    150121      if (flux) vout *= flux->elements.Flt[iy];
    151122
    152       out[ix + iy*Nx] = vsky + vout;
     123      out[ix + iy*Nx] += vout;
    153124    }
    154125  }
Note: See TracChangeset for help on using the changeset viewer.