IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10966


Ignore:
Timestamp:
Jan 8, 2007, 12:30:21 PM (19 years ago)
Author:
Paul Price
Message:

Changes to support automatically generated mosaicked camera configurations. Added pmFPAfileDefineChipMosaic and ...FPAMosaic that define fpa files using the new mosaicked camera configurations. Added mosaicLevel to pmFPAfile to prevent the mosaicked files being written out at too low a level. Changes to concept reads so that all concepts are read as available.

Location:
trunk/psModules/src/camera
Files:
8 edited

Legend:

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

    r10713 r10966  
    10451045    psFree(chipRegion);
    10461046
    1047     // Currently, there's nothing interesting in the chip concepts that needs to be updated.
    1048 
    1049     // Copy the concepts for the target FPA
    1050     target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts);
     1047    // Copy the concepts
     1048    target->concepts = psMetadataCopy(target->concepts, source->concepts); // Chip level
     1049    target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts); // FPA lvl
    10511050
    10521051    // Now make a new readout to go in the target cell
  • trunk/psModules/src/camera/pmFPAWrite.c

    r10526 r10966  
    141141        pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
    142142                                 PM_CONCEPT_SOURCE_DEFAULTS;
    143         if (!pmConceptsWriteCell(cell, source, false, NULL)) {
     143        if (!pmConceptsWriteCell(cell, source, true, NULL)) {
    144144            psError(PS_ERR_IO, false, "Unable to write concepts for cell.\n");
    145145            return false;
     
    191191            pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
    192192                                     PM_CONCEPT_SOURCE_DEFAULTS;
    193             if (!pmConceptsWriteChip(chip, source, false, true, NULL)) {
     193            if (!pmConceptsWriteChip(chip, source, true, true, NULL)) {
    194194                psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n");
    195195                return false;
  • trunk/psModules/src/camera/pmFPAfile.c

    r10918 r10966  
    6666    file->header = NULL;
    6767
     68    file->fileLevel = PM_FPA_LEVEL_NONE;
     69    file->dataLevel = PM_FPA_LEVEL_NONE;
     70    file->freeLevel = PM_FPA_LEVEL_NONE;
     71    file->mosaicLevel = PM_FPA_LEVEL_NONE;
     72
    6873    file->fpa = NULL;
    6974    file->fits = NULL;
  • trunk/psModules/src/camera/pmFPAfile.h

    r10918 r10966  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2007-01-05 20:17:21 $
     9*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2007-01-08 22:30:21 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    6363    pmFPAfileState state;  // have we opened the file, etc?
    6464
     65    // Desired levels, set by the user
    6566    pmFPALevel fileLevel;  // what level in the FPA hierarchy represents a unique file?
    6667    pmFPALevel dataLevel;  // at what level do we read/write the data segment?
    6768    pmFPALevel freeLevel;  // at what level do we free the data segment?
     69    pmFPALevel mosaicLevel;             // at what level is the mosaic?
    6870
    6971    pmFPA *fpa;    // for I/O files, we carry a pointer to the complete fpa
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r10724 r10966  
    3030
    3131// define an input-type pmFPAfile, bind to the optional fpa if supplied
    32 pmFPAfile *pmFPAfileDefineInput(pmConfig *config, pmFPA *fpa, char *name)
     32pmFPAfile *pmFPAfileDefineInput(pmConfig *config, pmFPA *fpa, const char *name)
    3333{
    3434    PS_ASSERT_PTR_NON_NULL(config, NULL);
    3535    PS_ASSERT_PTR_NON_NULL(config->files, NULL);
    3636    PS_ASSERT_PTR_NON_NULL(config->camera, NULL);
    37     PS_ASSERT_PTR_NON_NULL(name, NULL);
    38     PS_ASSERT_INT_POSITIVE(strlen(name), NULL);
     37    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    3938
    4039    bool status;
     
    5049    // select the name from the FILERULES
    5150    // check for alias name (type == STR, name is aliased name)
    52     char *realname = psMetadataLookupStr (&status, filerules, name);
     51    const char *realname = psMetadataLookupStr (&status, filerules, name);
    5352    if (!realname || strlen(realname) == 0) {
    5453        realname = name;
     
    107106
    108107// define a pmFPAfile, bind to the optional fpa if supplied
    109 pmFPAfile *pmFPAfileDefineOutput(pmConfig *config, pmFPA *fpa, char *name)
     108pmFPAfile *pmFPAfileDefineOutput(pmConfig *config, pmFPA *fpa, const char *name)
    110109{
    111110    PS_ASSERT_PTR_NON_NULL(config, NULL);
    112111    PS_ASSERT_PTR_NON_NULL(config->files, NULL);
    113112    PS_ASSERT_PTR_NON_NULL(config->camera, NULL);
    114     PS_ASSERT_PTR_NON_NULL(name, NULL);
    115     PS_ASSERT_INT_POSITIVE(strlen(name), NULL);
     113    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    116114
    117115    bool status;
    118     char *type;
    119116
    120117    // select the FILERULES from the camera config
     
    127124    // select the name from the FILERULES
    128125    // check for alias name (type == STR, name is aliased name)
    129     char *realname = psMetadataLookupStr (&status, filerules, name);
     126    const char *realname = psMetadataLookupStr (&status, filerules, name);
    130127    if (!realname || strlen(realname) == 0) {
    131128        realname = name;
     
    148145    file->extxtra  = psMemIncrRefCounter(psMetadataLookupStr (&status, data, "EXTNAME.XTRA"));
    149146
    150     type = psMetadataLookupStr (&status, data, "FILE.TYPE");
     147    const char *type = psMetadataLookupStr (&status, data, "FILE.TYPE");
    151148    file->type = pmFPAfileTypeFromString(type);
    152149    if (file->type == PM_FPA_FILE_NONE) {
     
    188185    }
    189186
     187    #if 0
    190188    // for WRITE type of data, the output format needs to be determined
    191189    // this is only needed if the output file is not identical in structure to the input?
     
    231229        psFree (words);
    232230    }
     231    #endif
    233232
    234233    // add argument-supplied OUTPUT name to this file
     
    248247// save the pmFPAfile on config->files
    249248// return the pmFPAfile (a view to the one saved on config->files)
    250 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, char *filename, char *argname)
     249pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, const char *filename, const char *argname)
    251250{
    252251    PS_ASSERT_PTR_NON_NULL(config, NULL);
    253     PS_ASSERT_PTR_NON_NULL(filename, NULL);
    254     PS_ASSERT_INT_POSITIVE(strlen(filename), NULL);
    255     PS_ASSERT_PTR_NON_NULL(argname, NULL);
    256     PS_ASSERT_INT_POSITIVE(strlen(argname), NULL);
     252    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     253    PS_ASSERT_STRING_NON_EMPTY(argname, NULL);
    257254
    258255    bool status;
     
    269266    psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname);
    270267    if (!status) {
    271         psTrace("psModules.camera", 5, "Failed to find %s in argument list", argname);
     268        //        psTrace("psModules.camera", 5, "Failed to find %s in argument list", argname);
     269        psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to find %s in argument list", argname);
    272270        return NULL;
    273271    }
     
    296294        return NULL;
    297295    }
    298     psFitsClose (fits);
     296    psFitsClose(fits);
    299297
    300298    // determine the current format from the header
     
    417415// save the pmFPAfiles on config->files
    418416// return the pmFPAfiles (a view to the one saved on config->files)
    419 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, char *filename, char *argname, int entry)
     417pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, const char *filename,
     418        const char *argname, int entry)
    420419{
    421420    PS_ASSERT_PTR_NON_NULL(config, NULL);
    422     PS_ASSERT_PTR_NON_NULL(filename, NULL);
    423     PS_ASSERT_INT_POSITIVE(strlen(filename), NULL);
    424     PS_ASSERT_PTR_NON_NULL(argname, NULL);
    425     PS_ASSERT_INT_POSITIVE(strlen(argname), NULL);
     421    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     422    PS_ASSERT_STRING_NON_EMPTY(argname, NULL);
    426423
    427424    bool status;
     
    533530// define the named pmFPAfile from the camera->config
    534531// only valid for pmFPAfile->mode = READ
    535 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, char *filename)
     532pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, const char *filename)
    536533{
    537534    PS_ASSERT_PTR_NON_NULL(config, false);
    538     PS_ASSERT_PTR_NON_NULL(filename, false);
    539     PS_ASSERT_INT_POSITIVE(strlen(filename), false);
     535    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    540536
    541537    if (*found) {
     
    603599// save the pmFPAfile on config->files
    604600// return the pmFPAfile (a view to the one saved on config->files)
    605 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, char *filename, pmFPA *input, pmDetrendType type)
     601pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, const char *filename,
     602                                     pmFPA *input, pmDetrendType type)
    606603{
    607604    PS_ASSERT_PTR_NON_NULL(input, NULL);
     
    609606    PS_ASSERT_PTR_NON_NULL(config->camera, NULL);
    610607    PS_ASSERT_PTR_NON_NULL(config->files, NULL);
    611     PS_ASSERT_PTR_NON_NULL(filename, NULL);
     608    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    612609
    613610    pmFPA *fpa = NULL;
     
    681678// create a new output pmFPAfile based on an existing FPA
    682679// only valid for pmFPAfile->mode == WRITE (or internal?)
    683 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename)
     680pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, const char *filename)
    684681{
    685682    PS_ASSERT_PTR_NON_NULL(config, false);
    686683    PS_ASSERT_PTR_NON_NULL(src, false);
    687     PS_ASSERT_PTR_NON_NULL(filename, false);
    688     PS_ASSERT_INT_POSITIVE(strlen(filename), false);
    689 
    690     pmFPA *fpa = pmFPAConstruct (src->camera);
     684    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     685
     686    // Need to look up the format
     687    bool mdok;                          // Status of MD lookup
     688    psMetadata *formats = psMetadataLookupMetadata(&mdok, src->camera, "FORMATS"); // The FORMATS
     689    if (!mdok || !formats) {
     690        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n",
     691                config->cameraName);
     692        return NULL;
     693    }
     694    psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format
     695    if (!mdok || !format) {
     696        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n",
     697                config->formatName, config->cameraName);
     698        return NULL;
     699    }
     700
     701    pmFPA *fpa = pmFPAConstruct(src->camera);
    691702    pmFPAfile *file = pmFPAfileDefineOutput (config, fpa, filename);
    692703    if (!file) {
     
    697708    file->xBin = xBin;
    698709    file->yBin = yBin;
     710    file->format = psMemIncrRefCounter(format);
    699711
    700712    psFree (fpa);
     
    704716// create a new output pmFPAfile based on an existing FPA
    705717// only valid for pmFPAfile->mode == WRITE (or internal?)
    706 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, char *filename)
     718pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, const char *filename)
    707719{
    708720    PS_ASSERT_PTR_NON_NULL(config, false);
    709     PS_ASSERT_PTR_NON_NULL(filename, false);
    710     PS_ASSERT_INT_POSITIVE(strlen(filename), false);
     721    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    711722
    712723    pmFPAfile *file = pmFPAfileDefineOutput (config, NULL, filename);
     
    724735}
    725736
     737pmFPAfile *pmFPAfileDefineChipMosaic(pmConfig *config, pmFPA *src, const char *filename)
     738{
     739    PS_ASSERT_PTR_NON_NULL(config, NULL);
     740    PS_ASSERT_PTR_NON_NULL(src, NULL);
     741    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     742    PS_ASSERT_STRING_NON_EMPTY(config->cameraName, NULL);
     743    PS_ASSERT_STRING_NON_EMPTY(config->formatName, NULL);
     744
     745    if (config->cameraName[0] == '_' &&
     746            strcmp(config->cameraName + strlen(config->cameraName) - 5, "-CHIP") == 0) {
     747        // The input camera has already been mosaicked to this level
     748        pmFPAfile *file = pmFPAfileDefineOutput(config, NULL, filename);
     749        file->camera = psMemIncrRefCounter(config->camera);
     750        file->format = psMemIncrRefCounter(config->format);
     751        file->fpa = pmFPAConstruct(file->camera);
     752        return file;
     753    }
     754
     755    // Find the correct camera configuration
     756    bool mdok;                          // Status of MD lookup
     757    psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->site, "CAMERAS"); // Camera configurations
     758    if (!mdok || !cameras) {
     759        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the site configuration.\n");
     760        return NULL;
     761    }
     762    psString name = NULL;               // Name of the new (automatically-generated) camera configuration
     763    psStringAppend(&name, "_%s-CHIP", config->cameraName);
     764    psMetadata *camera = psMetadataLookupMetadata(&mdok, cameras, name); // Camera configuration of interest
     765    if (!mdok || !camera) {
     766        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find automatically generated "
     767                "camera configuration %s in site configuration.\n", name);
     768        psFree(name);
     769        return NULL;
     770    }
     771    psFree(name);
     772
     773    // Need to look up the format of the same name, but under the mosaic camera
     774    psMetadata *formats = psMetadataLookupMetadata(&mdok, camera, "FORMATS"); // The FORMATS
     775    if (!mdok || !formats) {
     776        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n",
     777                config->cameraName);
     778        return NULL;
     779    }
     780    psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format
     781    if (!mdok || !format) {
     782        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n",
     783                config->formatName, config->cameraName);
     784        return NULL;
     785    }
     786
     787    pmFPA *fpa = pmFPAConstruct(camera);
     788    if (!fpa) {
     789        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate mosaicked camera.\n");
     790        return NULL;
     791    }
     792    pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, filename);
     793    if (!file) {
     794        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     795        return NULL;
     796    }
     797    file->src = src; // inherit output elements from this source pmFPA
     798    file->mosaicLevel = PM_FPA_LEVEL_CHIP; // don't do any I/O on this at a lower level
     799    file->format = psMemIncrRefCounter(format);
     800
     801    psFree(fpa);
     802
     803    return file;
     804}
     805
     806pmFPAfile *pmFPAfileDefineFPAMosaic(pmConfig *config, pmFPA *src, const char *filename)
     807{
     808    PS_ASSERT_PTR_NON_NULL(config, NULL);
     809    PS_ASSERT_PTR_NON_NULL(src, NULL);
     810    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     811    PS_ASSERT_STRING_NON_EMPTY(config->cameraName, NULL);
     812
     813    if (config->cameraName[0] == '_' &&
     814            strcmp(config->cameraName + strlen(config->cameraName) - 4 , "-FPA") == 0) {
     815        // The input camera has already been mosaicked to this level
     816        pmFPAfile *file = pmFPAfileDefineOutput(config, NULL, filename);
     817        file->camera = psMemIncrRefCounter(config->camera);
     818        file->format = psMemIncrRefCounter(config->format);
     819        file->fpa = pmFPAConstruct(file->camera);
     820        return file;
     821    }
     822
     823    // Find the correct camera configuration
     824    bool mdok;                          // Status of MD lookup
     825    psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->site, "CAMERAS"); // Camera configurations
     826    if (!mdok || !cameras) {
     827        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the site configuration.\n");
     828        return NULL;
     829    }
     830    psString original;                  // Name of the original camera configuration
     831    psString name = NULL;               // Name of the new (automatically-generated) camera configuration
     832    if (config->cameraName[0] == '_' &&
     833            strcmp(config->cameraName + strlen(config->cameraName) - 5 , "-CHIP") == 0) {
     834        // It's a chip mosaic; we need to get the original name
     835        original = psStringNCopy(config->cameraName + 1, strlen(config->cameraName) - 6);
     836    } else {
     837        original = psMemIncrRefCounter(config->cameraName);
     838    }
     839    psStringAppend(&name, "_%s-FPA", original);
     840    psFree(original);
     841    psMetadata *camera = psMetadataLookupMetadata(&mdok, cameras, name); // Camera configuration of interest
     842    if (!mdok || !camera) {
     843        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find automatically generated "
     844                "camera configuration %s in site configuration.\n", name);
     845        psFree(name);
     846        return NULL;
     847    }
     848    psFree(name);
     849
     850    // Need to look up the format of the same name, but under the mosaic camera
     851    psMetadata *formats = psMetadataLookupMetadata(&mdok, camera, "FORMATS"); // The FORMATS
     852    if (!mdok || !formats) {
     853        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n",
     854                config->cameraName);
     855        return NULL;
     856    }
     857    psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format
     858    if (!mdok || !format) {
     859        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n",
     860                config->formatName, config->cameraName);
     861        return NULL;
     862    }
     863
     864    pmFPA *fpa = pmFPAConstruct(camera);
     865    if (!fpa) {
     866        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate mosaicked camera.\n");
     867        return NULL;
     868    }
     869    pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, filename);
     870    if (!file) {
     871        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     872        return NULL;
     873    }
     874    file->src = src; // inherit output elements from this source pmFPA
     875    file->mosaicLevel = PM_FPA_LEVEL_FPA; // don't do any I/O on this at a lower level
     876    file->format = psMemIncrRefCounter(format);
     877
     878    psFree(fpa);
     879
     880    return file;
     881}
     882
    726883// create a file with the given name, assign it type "INTERNAL", and supply it with an image
    727884// of the requested dimensions. (image only, mask and weight are ignored)
    728 pmReadout *pmFPAfileDefineInternal (psMetadata *files, char *name, int Nx, int Ny, int type)
     885pmReadout *pmFPAfileDefineInternal (psMetadata *files, const char *name, int Nx, int Ny, int type)
    729886{
    730887    PS_ASSERT_PTR_NON_NULL(files, false);
    731     PS_ASSERT_PTR_NON_NULL(name, false);
    732     PS_ASSERT_INT_POSITIVE(strlen(name), false);
     888    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    733889
    734890    pmReadout *readout = pmReadoutAlloc(NULL);
     
    748904}
    749905
    750 bool pmFPAfileDropInternal(psMetadata *files, char *name)
     906bool pmFPAfileDropInternal(psMetadata *files, const char *name)
    751907{
    752908    PS_ASSERT_PTR_NON_NULL(files, false);
    753     PS_ASSERT_PTR_NON_NULL(name, false);
    754     PS_ASSERT_INT_POSITIVE(strlen(name), false);
     909    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    755910
    756911    bool status = false;
  • trunk/psModules/src/camera/pmFPAfileDefine.h

    r10084 r10966  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-11-19 01:55:24 $
     9*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2007-01-08 22:30:21 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    2222// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    2323// reference count is held by the config->files metadata.
    24 pmFPAfile *pmFPAfileDefineInput (pmConfig *config, pmFPA *fpa, char *name);
     24pmFPAfile *pmFPAfileDefineInput (pmConfig *config, pmFPA *fpa, const char *name);
    2525
    2626// load the pmFPAfile information from the camera configuration data
     
    2828// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    2929// reference count is held by the config->files metadata.
    30 pmFPAfile *pmFPAfileDefineOutput (pmConfig *config, pmFPA *fpa, char *name);
     30pmFPAfile *pmFPAfileDefineOutput (pmConfig *config, pmFPA *fpa, const char *name);
    3131
    3232// look for the given argname on the argument list.  find the give filename from the file rules
     
    3434// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    3535// reference count is held by the config->files metadata.
    36 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, char *filename, char *argname);
     36pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, const char *filename, const char *argname);
    3737
    3838// look for the given argname on the argument list.  find the give filename from the file rules
     
    4040// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    4141// reference count is held by the config->files metadata.
    42 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, char *filename);
     42pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, const char *filename);
    4343
    4444// look for the given argname on the argument list.  find the give filename from the file rules
     
    4646// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    4747// reference count is held by the config->files metadata.
    48 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, char *filename, pmFPA *input, pmDetrendType type);
     48pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, const char *filename,
     49                                     pmFPA *input, pmDetrendType type);
    4950
    5051// create a new output pmFPAfile based on an existing FPA
     
    5253// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    5354// reference count is held by the config->files metadata.
    54 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename);
     55pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, const char *filename);
    5556
    5657// create a new output pmFPAfile based on an existing FPA
     
    5960// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    6061// reference count is held by the config->files metadata.
    61 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, char *filename);
     62pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, const char *filename);
     63
     64/// Create a new output pmFPAfile based upon a chip mosaic of an existing FPA
     65///
     66/// The new pmFPAfile is inserted into the config->files metadata, freed and returned; so that the user does
     67/// not have to (and should not!) free the result.
     68pmFPAfile *pmFPAfileDefineChipMosaic(pmConfig *config, ///< Configuration data
     69                                     pmFPA *src, ///< Source FPA
     70                                     const char *filename ///< Output (root) filename
     71                                    );
     72
     73/// Create a new output pmFPAfile based upon an FPA mosaic of an existing FPA
     74///
     75/// The new pmFPAfile is inserted into the config->files metadata, freed and returned; so that the user does
     76/// not have to (and should not!) free the result.
     77pmFPAfile *pmFPAfileDefineFPAMosaic(pmConfig *config, ///< Configuration data
     78                                    pmFPA *src, ///< Source FPA
     79                                    const char *filename ///< Output (root) filename
     80                                   );
    6281
    6382// create a file with the given name, assign it type "INTERNAL", and supply it with an image
    6483// of the requested dimensions. (image only, mask and weight are ignored)
    65 pmReadout *pmFPAfileDefineInternal (psMetadata *files, char *name, int Nx, int Ny, int type);
     84pmReadout *pmFPAfileDefineInternal (psMetadata *files, const char *name, int Nx, int Ny, int type);
    6685
    6786// delete the INTERNAL file of the given name (if it exists)
    68 bool pmFPAfileDropInternal (psMetadata *files, char *name);
     87bool pmFPAfileDropInternal (psMetadata *files, const char *name);
    6988
    7089// look for the given argname on the argument list.  find the give filename from the file rules
     
    7291// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    7392// reference count is held by the config->files metadata.
    74 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, char *filename, char *argname, int entry);
     93pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, const char *filename,
     94        const char *argname, int entry);
     95
    7596# endif
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r10827 r10966  
    465465
    466466    // do we need to write this file?
    467     if (level != file->dataLevel) {
     467    if ((file->mosaicLevel == PM_FPA_LEVEL_NONE && level != file->dataLevel) || // No mosaicking happening
     468            (file->mosaicLevel != PM_FPA_LEVEL_NONE && level != file->mosaicLevel)) { // Mosaicking happening
    468469        psTrace("psModules.camera", 6, "skip writing of %s at this level %s: dataLevel is %s",
    469470                file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
     
    472473
    473474    // do we need to open this file?
    474     if (level >= file->fileLevel) {
     475    if (level >= file->fileLevel &&
     476            (file->mosaicLevel == PM_FPA_LEVEL_NONE ||
     477             (file->mosaicLevel != PM_FPA_LEVEL_NONE && level >= file->mosaicLevel))) {
    475478        if (!pmFPAfileOpen (file, view, config)) {
    476479            psError(PS_ERR_IO, false, "failed to open %s", file->filename);
     
    540543
    541544// create the data elements (headers, images) appropriate for this view
    542 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view)
     545bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view, const pmConfig *config)
    543546{
    544547    PS_ASSERT_PTR_NON_NULL(file, false);
     
    571574
    572575    // do we need to write this file?
    573     if (level != file->fileLevel) {
     576    if (level != file->fileLevel || file->mosaicLevel != PM_FPA_LEVEL_NONE) {
    574577        psTrace("psModules.camera", 6, "skip creation of %s at this level %s: fileLevel is %s",
    575578                file->name, pmFPALevelToName(level), pmFPALevelToName(file->fileLevel));
     
    581584    case PM_FPA_FILE_MASK:
    582585    case PM_FPA_FILE_WEIGHT:
    583     case PM_FPA_FILE_FRINGE:
    584         // create FPA structure component based on view
    585         pmFPAAddSourceFromView (file->fpa, view, file->format);
    586         psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
    587         break;
    588 
     586    case PM_FPA_FILE_FRINGE: {
     587            // create FPA structure component based on view
     588            #if 0
     589            psMetadata *format = file->format; // Camera format configuration
     590            if (!format) {
     591                // It's likely a mosaic, for which we don't yet know the appropriate format
     592                const psMetadata *camera = file->fpa->camera; // Camera configuration
     593                psMetadata *formats = psMetadataLookupMetadata(NULL, camera, "FORMATS"); // The FORMATS
     594                if (!formats) {
     595                    psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FORMATS in camera configuration.\n");
     596                    return false;
     597                }
     598                format = psMetadataLookupMetadata(NULL, formats, config->formatName);
     599                if (!format) {
     600                    psError(PS_ERR_UNEXPECTED_NULL, false,
     601                            "Unable to find format %s in camera configuration.\n", config->formatName);
     602                    return false;
     603                }
     604                file->format = psMemIncrRefCounter(format);
     605            }
     606            #endif
     607            pmFPAAddSourceFromView (file->fpa, view, file->format);
     608            psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
     609            break;
     610        }
    589611    case PM_FPA_FILE_SX:
    590612    case PM_FPA_FILE_RAW:
     
    727749                goto failure;
    728750            }
    729             if (!pmFPAfileCreate(file, view)) {
     751            if (!pmFPAfileCreate(file, view, config)) {
    730752                psError(PS_ERR_IO, false, "failed CREATE in FPA_BEFORE block for %s", file->name);
    731753                goto failure;
  • trunk/psModules/src/camera/pmFPAfileIO.h

    r7589 r10966  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-06-17 01:50:43 $
     9*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2007-01-08 22:30:21 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    2222bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view, pmConfig *config);
    2323
    24 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view);
     24bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view, pmConfig *config);
    2525
    2626// write to the real file corresponding to the given pmFPAfile for the current view
Note: See TracChangeset for help on using the changeset viewer.