IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 6, 2008, 10:49:03 AM (18 years ago)
Author:
Paul Price
Message:

Changing to produce multi-darks instead of boring old darks. This allows us to fit the dark current as a function of temperature, time since PON, etc. In fact, what's fit is very configurable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeOptions.c

    r15953 r16842  
    1010#include "ppMerge.h"
    1111#include "ppMergeOptions.h"
     12
     13#define ARRAY_BUFFER 4                  // Number of values to add at once
    1214
    1315//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    3436    options->zero = false;
    3537    options->scale = false;
    36     options->darktime = false;
     38    options->dark = false;
    3739    options->fringe = false;
    3840    options->shutter = false;
     
    6567    options->badMask = 0x00;
    6668    options->growPixels = 0;
     69    options->darkOrdinates = NULL;
    6770    return options;
    6871}
     
    174177            options->zero = false;
    175178            options->scale = false;
    176             options->darktime = false;
     179            options->dark = false;
    177180            options->fringe = false;
    178181            options->shutter = false;
     
    181184            options->zero = false;
    182185            options->scale = false;
    183             options->darktime = true;
     186            options->dark = true;
    184187            options->fringe = false;
    185188            options->shutter = false;
     
    188191            options->zero = false;
    189192            options->scale = true;
    190             options->darktime = false;
     193            options->dark = false;
    191194            options->fringe = false;
    192195            options->shutter = false;
     
    195198            options->zero = false;
    196199            options->scale = true;
    197             options->darktime = false;
     200            options->dark = false;
    198201            options->fringe = false;
    199202            options->shutter = false;
     
    202205            options->zero = false;
    203206            options->scale = true;
    204             options->darktime = false;
     207            options->dark = false;
    205208            options->fringe = false;
    206209            options->shutter = false;
     
    209212            options->zero = true;
    210213            options->scale = true;
    211             options->darktime = false;
     214            options->dark = false;
    212215            options->fringe = true;
    213216            options->shutter = false;
     
    216219            options->zero = false;
    217220            options->scale = false;
    218             options->darktime = false;
     221            options->dark = false;
    219222            options->fringe = false;
    220223            options->shutter = true;
     
    225228            options->zero = false;
    226229            options->scale = false;
    227             options->darktime = false;
     230            options->dark = false;
    228231            options->fringe = false;
    229232            options->shutter = false;
     
    255258
    256259#if 0
    257     // Or you can set them individually
    258     OPTION_PARSE(options->zero,     config->arguments, "-zero",    Bool);
    259     OPTION_PARSE(options->scale,    config->arguments, "-scale",   Bool);
    260     OPTION_PARSE(options->darktime, config->arguments, "-exptime", Bool);
    261 #endif
    262 
    263260    // Number of on/off images
    264261    OPTION_PARSE(options->onOff, config->arguments, "-onoff", S32);
     262#endif
    265263
    266264    // Masking options
     
    268266    options->badMask = pmConfigMask("BAD", config);
    269267
     268    if (options->dark) {
     269        psMetadata *ordinates = psMetadataLookupMetadata(NULL, recipe, "DARK.ORDINATES"); // Ordinates info
     270        options->darkOrdinates = psArrayAllocEmpty(psListLength(ordinates->list));
     271
     272        psMetadataIterator *iter = psMetadataIteratorAlloc(ordinates, PS_LIST_HEAD, NULL); // Iterator
     273        psMetadataItem *item;           // Item from iteration
     274        while ((item = psMetadataGetAndIncrement(iter))) {
     275            int order = 0;              // Polynomial order
     276            bool scale = false;         // Scale values?
     277            float min = NAN, max = NAN; // Minimum and maximum values for scaling
     278            switch (item->type) {
     279              case PS_TYPE_S32:
     280                order = item->data.S32;
     281                break;
     282              case PS_DATA_METADATA:
     283                order = psMetadataLookupS32(NULL, item->data.md, "ORDER");
     284                bool mdok;                  // Status of MD lookup
     285                scale = psMetadataLookupBool(&mdok, item->data.md, "SCALE");
     286                min = psMetadataLookupF32(&mdok, item->data.md, "MIN");
     287                max = psMetadataLookupF32(&mdok, item->data.md, "MAX");
     288                break;
     289              default:
     290                psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     291                        "Type of DARK.ORDINATES entry %s (%x) is not METADATA or S32",
     292                        item->name, item->type);
     293                psFree(options);
     294                return false;
     295            }
     296            if (order <= 0) {
     297                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ORDER not positive (%d) for DARK.ORDINATES %s",
     298                        order, item->name);
     299                psFree(options);
     300                return false;
     301            }
     302
     303            pmDarkOrdinate *ord = pmDarkOrdinateAlloc(item->name, order);
     304            ord->scale = scale;
     305            ord->min = min;
     306            ord->max = max;
     307            psArrayAdd(options->darkOrdinates, options->darkOrdinates->n, ord);
     308            psFree(ord);
     309        }
     310        psFree(iter);
     311    }
     312
    270313    return options;
    271314}
Note: See TracChangeset for help on using the changeset viewer.