IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 30, 2006, 12:15:03 PM (20 years ago)
Author:
eugene
Message:

first complete working version (chip only)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroDataSave.c

    r6792 r7014  
    11# include "psastro.h"
     2// XXX leak free 2006.04.27
    23
    3 // load the data from the files in this loop.
    4 // we write out the result in a second loop
    5 // at the end of this function, the complete stellar data is loaded
    6 // into the correct fpa structure locations (readout.analysis:PSPHOT.SOURCES)
     4// this loop saves the photometry/astrometry data files
    75bool psastroDataSave (pmConfig *config) {
    86
    9   // define the output files:
    10     pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT");
    11     if (!status) {
    12         psErrorStackPrint(stderr, "Can't find input data!\n");
     7    pmChip *chip;
     8    pmCell *cell;
     9    pmReadout *readout;
     10
     11    // select the current recipe
     12    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
     13    if (!recipe) {
     14        psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    1315        exit(EXIT_FAILURE);
    1416    }
    1517
    16     // this is the output target
    17     pmFPAfileDefine (config->files, format, input, "PSASTRO.OUTPUT");
     18    // select the output data sources
     19    pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT");
     20    if (!output) {
     21        psErrorStackPrint(stderr, "Can't find output data!\n");
     22        exit(EXIT_FAILURE);
     23    }
    1824
    19     char *output = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");
    20     pmFPAfileAddOutputName (config->files, "OUTPUT", output, PM_FPA_MODE_WRITE);
     25    // de-activate all files except PSASTRO.OUTPUT
     26    pmFPAfileActivate (config->files, false, NULL);
     27    pmFPAfileActivate (config->files, true, "PSASTRO.OUTPUT");
    2128
    2229    pmFPAview *view = pmFPAviewAlloc (0);
    2330
    24     // files associated with the science image
     31    // open/load files as needed
    2532    pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    2633
    27     while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    28         psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     34    while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) {
     35        psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    2936        if (!chip->process || !chip->file_exists) { continue; }
    3037        pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    3138
    32         while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    33             psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     39        while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {
     40            psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    3441            if (!cell->process || !cell->file_exists) { continue; }
    3542            pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    3643
    3744            // process each of the readouts
    38             while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     45            while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) {
    3946                pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    4047                if (! readout->data_exists) { continue; }
     
    4754    }
    4855    pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     56
     57    psFree (view);
    4958    return true;
    5059}
Note: See TracChangeset for help on using the changeset viewer.