IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 23, 2021, 1:48:02 PM (5 years ago)
Author:
eugene
Message:

adding PATTERN.ROW.AMP I/O functions, clean up pmPatternRow code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPatternIO.c

    r41851 r41856  
    88#include "pmFPAview.h"
    99#include "pmFPAfile.h"
     10#include "pmFPAUtils.h"
    1011#include "pmFPAfileFitsIO.h"
    1112#include "pmFPAHeader.h"
     
    455456/**************** PatternRowAmp(litude) I/O *************************/
    456457
    457 # if (0)
    458 /********************* Read Data functions *****************************/
    459 
    460 bool pmPatternRowAmpReadForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     458bool pmPatternRowAmpRead (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    461459    {
    462460        // read the full model in one pass: require the level to be FPA
     
    499497    }
    500498
     499    int nGood = 0;
     500    int nTotal = 0;
    501501    while (haveData) {
    502502
     
    511511        // determine the chip:
    512512        char *extname = psMetadataLookupStr (&status, header, "EXTNAME");
    513         psLogMsg ("psModules.detrend", 4, "read %ld rows from Pattern Row Amplitude file, extname %s\n", model->n, extname);
     513        psLogMsg ("psModules.detrend", 8, "read %ld rows from Pattern Row Amplitude file, extname %s\n", model->n, extname);
     514        nTotal += model->n;
    514515
    515516        // I expect to find a name of the form: chipName.ptn (eg, XY01.ptn)
    516517        // where chipName like 'XY01'
    517         psAssert (strlen(extname) == 10, "invalid extension %s", extname);
     518        psAssert (strlen(extname) == 8, "invalid extension %s", extname);
    518519        psAssert (extname[5] == 'p', "invalid extension %s", extname);
    519520        psAssert (extname[6] == 't', "invalid extension %s", extname);
     
    530531        for (int i = 0; i < model->n; i++) {
    531532            psMetadata *row = model->data[i];
    532             char *cellName = psMetadataLookupStr(&status, row, "cellname");
    533             float *amplitude = psMetadataLookupF32(&status, row, "medianValue");
     533
     534            char *cellName = psMetadataLookupStr(&status, row, "CELL_NAME");
     535            if (!cellName) continue;
     536
     537            float amplitude = psMetadataLookupF32(&status, row, "VALUE_MEDIAN");
    534538
    535539            int cellNumber = pmChipFindCell (chip, cellName);
    536             pmCell *cell = chip->data[cellNumber];
     540            pmCell *cell = chip->cells->data[cellNumber];
     541            if (!cell) continue;
    537542
    538543            psMetadataAddF32 (cell->analysis, PS_LIST_TAIL, "PTN.ROW.AMP", PS_META_REPLACE, "", amplitude);
     544            nGood ++;
    539545        }
     546
    540547        psFree (model);
    541548        psFree (header);
     
    544551        haveData = psFitsMoveExtNum (file->fits, 1, true);
    545552    }
    546 
    547     return true;
    548 }
    549 # endif
     553    psLogMsg ("psModules.detrend", 4, "read %d of %d rows from Pattern Row Amplitude file\n", nGood, nTotal);
     554
     555    return true;
     556}
Note: See TracChangeset for help on using the changeset viewer.