IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6125


Ignore:
Timestamp:
Jan 21, 2006, 12:29:48 AM (20 years ago)
Author:
Paul Price
Message:

Working, but leaks memory something chronic

Location:
trunk/ppImage
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppFile.c

    r5977 r6125  
    77    psFree(file->fpa);
    88    psFree(file->phu);
    9     psFitsClose(file->fits);
     9    if (file->fits) {
     10        psFitsClose(file->fits);
     11    }
    1012    return;
    1113}
  • trunk/ppImage/src/ppImage.h

    r6064 r6125  
    7878    ppFile *flat;                       // The flat-field correction image
    7979    ppFile *fringe;                     // The fringe correction image
     80    psFits *output;                     // The output file
    8081#if 0
    8182    ppFile *process;                    // A dummy file pointing out what needs to be processed
  • trunk/ppImage/src/ppImageDetrendBias.c

    r6064 r6125  
    11#include "ppImage.h"
    22
    3 bool ppDetrendBias(pmReadout *inputReadout, pmReadout *bias, pmReadout *dark, ppOptions *options) {
    4 
    5 
    6 //    psMetadataPrint(inputCell->concepts, 7);
     3bool ppDetrendBias(pmReadout *inputReadout, pmReadout *bias, pmReadout *dark, ppOptions *options)
     4{
     5    psTrace(__func__, 1, "Commencing bias processing....\n");
     6//    psMetadataPrint(inputReadout->parent->concepts, 7);
    77
    88    pmSubtractBias(inputReadout, options->overscan, bias, dark);
  • trunk/ppImage/src/ppImageDetrendCell.c

    r6114 r6125  
    66pmReadout *ppDetrendSelectFirst(pmCell *cell, char *name, bool doThis)
    77{
    8 
    98    if (!doThis) {
    109        return NULL;
     
    3433#endif
    3534
    36     // Dark time for dark image
    37     float darkTime = 1.0;
    38     if (options->doDark) {
    39         darkTime = psMetadataLookupF32(NULL, detrend->dark->concepts, "CELL.DARKTIME");
    40         if (darkTime <= 0.0) {
    41             psErrorStackPrint(stderr, "DARKTIME for dark image (%f) is non-positive.\n", darkTime);
    42             exit(EXIT_FAILURE);
    43         }
    44     }
    45 
    4635    for (int k = 0; k < detrend->input->readouts->n; k++) {
    4736
     
    5039        // Mask bad pixels
    5140        if (options->doMask) {
    52             ppDetrendMask (detrend->input, input, mask);
     41            ppDetrendMask(detrend->input, input, mask);
    5342        }
    5443
    5544        // Non-linearity correction
    5645        if (options->doNonLin) {
    57             ppDetrendNonLinear (detrend->input, input, options);
     46            ppDetrendNonLinear(detrend->input, input, options);
    5847        }
    5948
  • trunk/ppImage/src/ppImageLoop.c

    r6114 r6125  
    11# include "ppImage.h"
     2
     3psMemId ppMemPrint(const psMemBlock *ptr)
     4{
     5    psLogMsg(__func__, PS_LOG_INFO,
     6             "Memory block %d (%ld):\n"
     7             "\tFile %s, line %d, size %d\n"
     8             "\tPosts: %lx %lx %lx\n",
     9             ptr->id, ptr->refCounter, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock,
     10             ptr->endblock, *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize));
     11    return 0;
     12}
    213
    314// Read the entire FPA
     
    5162    psArray *chips = data->input->fpa->chips; // Component chips
    5263    for (int i = 0; i < chips->n; i++) {
     64
     65        if (i > 6) {
     66            continue;
     67        }
     68
    5369        if (processChip >= 0 && i != processChip) {
    5470            continue;
     
    100116        psLogMsg(__func__, PS_LOG_INFO, "%d cells mosaicked.\n", numMosaicked);
    101117
     118        // XXX EAM: Photometry goes here!
     119
     120        // A kludge to get the write to behave wrt the concepts
     121        const psMetadata *camera = data->input->fpa->camera;
     122        data->input->fpa->camera = NULL;
     123        pmFPAWrite(data->output, data->input->fpa, config->database);
     124        data->input->fpa->camera = camera;
     125
     126        // Now I can blow away the mosaic so I can then read more.
     127        psFree(chips->data[i]);
     128        ppMemPrint((psMemBlock*)chips->data[i]-1);
    102129    }
     130
     131#if 0
     132    // Write out the mosaicked chip, just to see; this wouldn't normally happen
     133    psFits *mosaicFile = psFitsOpen("mosaic.fits", "w");
     134    for (int i = 0; i < chips->n; i++) {
     135        pmChip *chip = chips->data[i];
     136        if (! chip || ! chip->exists || ! chip->process) {
     137            continue;
     138        }
     139#if 0
     140        psArray *cells = chip->cells;
     141        pmCell *cell = cells->data[0];
     142        psArray *readouts = cell->readouts;
     143        pmReadout *readout = readouts->data[0];
     144        psImage *image = readout->image;
     145#else
     146        psImage *image = chip->hdu->images->data[0];
     147#endif
     148        psFitsWriteImage(mosaicFile, NULL, image, 0);
     149
     150    }
     151#endif
    103152
    104153    // Free the detrend FPA and chips
     
    108157    psFree(data->flat);
    109158
     159    psFitsClose(data->output);
    110160
    111161    return true;
  • trunk/ppImage/src/ppImageParseCamera.c

    r6114 r6125  
    5656    data->fringe->fpa  = pmFPAConstruct(config->camera);
    5757
     58    // Open output file
     59    const char *outname = psMetadataLookupStr(NULL, config->arguments, "-output"); // Name of output file
     60    data->output = psFitsOpen(outname, "w"); // File for writing
     61    if (! data->output) {
     62        psError(PS_ERR_IO, false, "Unable to open output file %s.\n", data->output);
     63        exit(EXIT_FAILURE);
     64    }
     65
    5866    // XXX EAM : extend this to allow an array of selected chips by name
    5967    // Chip selection: if we are using a single chip, select it for each FPA
  • trunk/ppImage/test/ipprc.config

    r6089 r6125  
    2121LOGDEST STR     STDOUT                          # Log destination
    2222TRACE           METADATA                        # Trace levels
    23 #       ppImageLoop             S32     10
     23        ppImageLoop             S32     10
    2424#       ppImageLoadPixels       S32     10
     25#       pmFPAWrite              S32     10
     26#       pmFPARead               S32     10
    2527#       pmSubtractBias          S32     10
     28#       ppDetrendBias           S32     10
    2629#       pmFPAPrint              S32     10
    2730#       psModule.concepts       S32     10
    28 #       pmFPAWrite              S32     10
    2931#       pmConfigRead            S32     10
    3032#       pmFPAWriteMask          S32     10
    3133#       pmFPAWriteWeight        S32     10
    3234#       pmChipMosaic            S32     10
    33 #       pmFPAMorph              S32     10
    34 #       pap_psMetadataCopy      S32     9
    3535END
  • trunk/ppImage/test/phase2.config

    r6089 r6125  
    55NONLIN          BOOL    FALSE           # Non-linearity correction
    66OVERSCAN        BOOL    TRUE            # Overscan subtraction
    7 BIAS            BOOL    TRUE            # Bias subtraction
     7BIAS            BOOL    FALSE           # Bias subtraction
    88DARK            BOOL    FALSE           # Dark subtraction
    9 FLAT            BOOL    TRUE            # Flat-field normalisation
     9FLAT            BOOL    FALSE           # Flat-field normalisation
    1010FRINGE          BOOL    FALSE           # Fringe subtraction
    1111SOURCE          BOOL    FALSE           # Source identification and photometry
Note: See TracChangeset for help on using the changeset viewer.