IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15218


Ignore:
Timestamp:
Oct 4, 2007, 11:47:30 AM (19 years ago)
Author:
Paul Price
Message:

Have been running into problems because various write functions (i.e., sources, psf) aren't updating the headers before they write. Attempting to aggregate the functions that update the headers in pmFPAfileWrite, since that will be called by everything. This is an attempt; not sure if it works yet or not.

Location:
trunk/psModules/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r15099 r15218  
    10981098        const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.NAME"); // Current name
    10991099        if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaname) != 0) {
    1100             psLogMsg(__func__, PS_LOG_WARN, "FPA.NAME for new source (%s) doesn't match FPA.NAME for current "
     1100            psWarning("FPA.NAME for new source (%s) doesn't match FPA.NAME for current "
    11011101                     "fpa (%s).\n", fpaname, currentName);
    11021102        }
     
    13561356    psString fpaname = phuNameFromHeader("FPA.NAME", fileInfo, phu); // New name for the FPA
    13571357    if (!fpaname || strlen(fpaname) == 0) {
    1358         psError(PS_ERR_IO, true, "Unable to determine FPA.NAME: check for FPA.NAME in FILE in camera format");
    1359         return NULL;
     1358        psWarning("Unable to determine FPA.NAME: check for FPA.NAME in FILE in camera format");
    13601359    }
    13611360
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r15180 r15218  
    3737#include "pmSourcePlots.h"
    3838#include "pmFPAConstruct.h"
     39#include "pmConcepts.h"
    3940
    4041// attempt create, read, write, close, or free pmFPAfiles available in files files are
     
    374375            psError(PS_ERR_UNKNOWN, false, "Unable to set compression options for %s (%s) (%d:%d:%d)\n",
    375376                    file->filename, file->name, view->chip, view->cell, view->readout);
     377            return false;
     378        }
     379    }
     380
     381
     382    // Ensure headers and all are updated
     383    // This is here so that the individual write functions (e.g., images, PSFs, sources, etc) don't have to
     384    // take care of all this themselves (because they generally don't).
     385    {
     386        pmHDU *hdu = pmFPAviewThisHDU(view, file->fpa);
     387        if (hdu) {
     388            pmConfigConformHeader(hdu->header, file->format);
     389        }
     390
     391        pmFPA *fpa = file->fpa;         // FPA of interest
     392        pmChip *chip = pmFPAviewThisChip(view, file->fpa); // Chip of interest, or NULL
     393        pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest, or NULL
     394        pmFPAUpdateNames(fpa, chip, cell);
     395
     396        pmConceptSource sources = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
     397            PM_CONCEPT_SOURCE_DEFAULTS; // Concept sources to write
     398        if (cell) {
     399            if (!pmConceptsWriteCell(cell, sources, true, NULL)) {
     400                psError(PS_ERR_IO, false, "Unable to write concepts for cell.\n");
     401                return false;
     402            }
     403        } else if (chip) {
     404            if (!pmConceptsWriteChip(chip, sources, true, true, NULL)) {
     405                psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n");
     406                return false;
     407            }
     408        } else if (!pmConceptsWriteFPA(fpa, sources, true, NULL)) {
     409            psError(PS_ERR_IO, false, "Unable to write concepts for FPA.\n");
    376410            return false;
    377411        }
  • trunk/psModules/src/config/pmConfig.c

    r15217 r15218  
    11661166    psFree(rulesIter);
    11671167
    1168     // XXX do we need to update the header based on elements of the FILE?
    1169     # if (0)
    1170     psMetadata *file = psMetadataLookupMetadata(&mdok, format, "FILE"); // How to identify this format
    1171     if (!mdok || !file) {
    1172         psError(PS_ERR_IO, true, "Unable to find FILE in camera format.\n");
    1173         return false;
    1174     }
    1175     psString fpaName = psMetadataLookupStr(&mdok, file, "FPA.NAME");
    1176     # endif
    1177 
    11781168    return true;
    11791169}
Note: See TracChangeset for help on using the changeset viewer.