IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2012, 5:46:39 PM (14 years ago)
Author:
bills
Message:

In psphot and psphotStack accept exposure number images (EXPNUM) as inputs.
If supplied set the N_FRAMES value for each source based on the
value in the EXPNUM image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotStackImageLoop.c

    r33030 r33690  
    3030    }
    3131
     32    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
     33    bool useRaw = psMetadataLookupBool (NULL, recipe, "PSPHOT.STACK.USE.RAW");
     34    if (useRaw && inputRaw == NULL) {
     35        psLogMsg ("psphot", 1, "PSPHOT.STACK.USE.RAW set but no raw input.");
     36        useRaw = false;
     37    }
     38
    3239    pmFPAview *view = pmFPAviewAlloc (0);
    3340
    34     // XXX for now, just load the full set of images up front
     41
     42    // XXX for now, just load the full set of images up front except for EXPNUM which we defer
     43    pmFPAfileActivate (config->files, false, "PSPHOT.STACK.EXPNUM.RAW");
    3544    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot.");
    3645
     
    8695        UpdateHeadersForChip(config, view);
    8796
    88         // save output which is saved at the chip level
    89         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");
     97        // Defer output until we have performed psphotSetNFrames()
     98        pmFPAfileActivate (config->files, false, NULL);
     99
     100        // Iterate up
     101        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed pmFPAfileIOChecks for Chip in psphot.");
    90102    }
    91103    psMemDump("doneloop");
     
    93105    UpdateHeadersForFPA(config, view);
    94106
    95     // save output which is saved at the fpa level
     107    // Iterate up output which is saved at the fpa level
     108    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed ouput pmFPAfileIOChecks FPA in psphot.");
     109
     110    // Load the appropriate EXPNUM image
     111    pmFPAfileActivate (config->files, true, useRaw ? "PSPHOT.STACK.EXPNUM.RAW" : "PSPHOT.STACK.EXPNUM.CNV");
     112
     113    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa EXPNUM in psphot.");
     114
     115    // for psphot, we force data to be read at the chip level
     116    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     117        psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     118        if (! chip->process || ! chip->file_exists) { continue; }
     119        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip EXPNUM in psphotStack.");
     120
     121        // there is now only a single chip (multiple readouts?). loop over it and process
     122        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
     123            psLogMsg ("psphot", 5, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     124            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Cell in psphotStack.");
     125
     126            // process each of the readouts
     127            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     128                psLogMsg ("psphot", 6, "Readout %d: %x %x\n", view->readout, cell->file_exists, cell->process);
     129                if (! readout->data_exists) { continue; }
     130
     131                if (!psphotSetNFrames (config, view, useRaw ? inputRaw->name : inputCnv->name)) ESCAPE ("failed to setNFrames.");
     132            }
     133        }
     134        // now activate all files to trigger final output
     135        pmFPAfileActivate (config->files, true, NULL);
     136
     137        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");
     138    }
    96139    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed ouput for FPA in psphot.");
    97140
Note: See TracChangeset for help on using the changeset viewer.