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/ppMergeCombine.c

    r16229 r16842  
    1616#include "ppMergeVersion.h"
    1717
     18#define TESTING
     19
     20
    1821#if 0
    19 static psMemId memId = 0;
    20 
    2122static FILE *dumpFile = NULL;
    2223
     
    3637    exit(EXIT_FAILURE);
    3738}
    38 
    39 
     39#endif
     40
     41#if 0
     42static psMemId memId = 0;
    4043static void memDump(void)
    4144{
     
    5255    psFree(leaks);
    5356}
    54 
     57#endif
     58
     59#if 0
    5560static void memCheck(void)
    5661{
     
    7378        psTrace("ppMerge", 0, "Memory in use: %zd\n", totalSize);
    7479        psTrace("ppMerge", 0, "Largest block: %ld\n", largest);
    75         psTrace("ppMerge", 0, "sbrk(): %zd\n", sbrk(0));
     80        psTrace("ppMerge", 0, "sbrk(): %p\n", sbrk(0));
    7681    }
    7782    return;
     
    119124    }
    120125    while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    121         if (chip->hdu) {
    122             // Data will exist soon
    123             pmFPAUpdateNames(data->out, chip, NULL);
    124             chip->data_exists = true;
    125         }
     126        if (!chip->hdu) {
     127            continue;
     128        }
     129        // Data will exist soon
     130        pmFPAUpdateNames(data->out, chip, NULL);
     131        chip->data_exists = true;
    126132        pmChipWrite(chip, data->outFile, config->database, true, false); // Write header only
    127133        pmCell *cell;                   // Cell of interest
    128134        while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    129135            cellNum++;
    130             if (cell->hdu) {
    131                 // Data will exist soon
    132                 pmFPAUpdateNames(data->out, chip, cell);
    133                 chip->data_exists = cell->data_exists = true;
    134             }
     136            if (!cell->hdu) {
     137                continue;
     138            }
     139            // Data will exist soon
     140            pmFPAUpdateNames(data->out, chip, cell);
     141            chip->data_exists = cell->data_exists = true;
    135142            pmCellWrite(cell, data->outFile, config->database, true); // Write header only
    136143            pmReadout *readout = pmReadoutAlloc(cell); // Output readout of interest
     
    197204
    198205                        // If we're combining with weights, we want to generate weights.
    199                         if (options->combine->weights) {
     206                        if (options->combine->weights && !options->dark) {
    200207
    201208                            // If it's a bias or dark, set the gain to zero: noise only contributed by read
    202                             if ((!options->zero && !options->scale) || options->darktime) {
     209                            if (!options->zero && !options->scale) {
    203210                                pmReadoutSetWeight(stack->data[i], false);
    204211                            } else {
     
    209216                        numRead++;
    210217                    } else {
    211                         psTrace("ppMerge", 3, "Finished reading file %d, chip %d, cell %d, scan %d\n", i, view->chip, view->cell, numScan);
     218                        psTrace("ppMerge", 3, "Finished reading file %d, chip %d, cell %d, scan %d\n",
     219                                i, view->chip, view->cell, numScan);
    212220                    }
    213221
     
    220228                                                    options->shutterIter, options->shutterRej,
    221229                                                    options->combine->maskVal);
     230                    } else if (options->dark) {
     231                        pmDarkCombine(cell, stack, options->darkOrdinates, options->combine->iter,
     232                                      options->combine->rej, options->combine->maskVal);
    222233                    } else {
    223234                        pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine);
     
    246257            psFree(stack);
    247258
     259#if 0
    248260            // Set the dark time for the output image, since we normalised
    249261            if (options->darktime) {
     
    253265                expItem->data.F32 = 1.0;
    254266            }
     267#endif
    255268
    256269            // Measure the fringes for this cell
     
    334347            if (cell->hdu && !cell->hdu->blankPHU) {
    335348                psTrace("ppMerge", 5, "Writing out cell HDU.\n");
    336                 pmCellWrite(cell, data->outFile, config->database, false);
    337                 if (options->fringe) {
    338                     pmCellWriteTable(data->outFile, cell, "FRINGE");
    339                 }
    340 
     349                if (options->dark) {
     350                    pmCellWriteDark(cell, data->outFile, config->database, false);
     351                } else {
     352                    pmCellWrite(cell, data->outFile, config->database, false);
     353                    if (options->fringe) {
     354                        pmCellWriteTable(data->outFile, cell, "FRINGE");
     355                    }
     356                }
    341357                pmCellFreeData(cell);
    342358            }
     
    354370        if (chip->hdu && !chip->hdu->blankPHU) {
    355371            psTrace("ppMerge", 5, "Writing out chip HDU.\n");
    356             pmChipWrite(chip, data->outFile, config->database, false, false);
    357             if (options->fringe) {
    358                 pmChipWriteTable(data->outFile, chip, "FRINGE");
     372            if (options->dark) {
     373                pmChipWriteDark(chip, data->outFile, config->database, false, false);
     374            } else {
     375                pmChipWrite(chip, data->outFile, config->database, false, false);
     376                if (options->fringe) {
     377                    pmChipWriteTable(data->outFile, chip, "FRINGE");
     378                }
    359379            }
    360380
     
    373393        // Write the pixels
    374394        psTrace("ppMerge", 5, "Writing out FPA HDU.\n");
    375         pmFPAWrite(data->out, data->outFile, config->database, false, false);
    376         if (options->fringe) {
    377             pmFPAWriteTable(data->outFile, fpa, "FRINGE");
     395        if (options->dark) {
     396            pmFPAWriteDark(data->out, data->outFile, config->database, false, false);
     397        } else {
     398            pmFPAWrite(data->out, data->outFile, config->database, false, false);
     399            if (options->fringe) {
     400                pmFPAWriteTable(data->outFile, fpa, "FRINGE");
     401            }
    378402        }
    379403    }
Note: See TracChangeset for help on using the changeset viewer.