IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 9, 2010, 4:41:16 PM (16 years ago)
Author:
eugene
Message:

working on psphotStack (nearly done)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/stackphot.20100406/psphot/src/psphotStackParseCamera.c

    r27625 r27649  
    1515    }
    1616
    17     psMetadataItem *item = NULL;
    18     int nInputs = 0;
    19     while ((item = psMetadataGet(inputs, nInputs)) != NULL) {
     17    int nInputs = inputs->list->n;
     18    for (int i = 0; i < nInputs; i++) {
     19        psMetadataItem *item = psMetadataGet(inputs, i);
    2020        if (item->type != PS_DATA_METADATA) {
    2121            psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Component %s of the input metadata is not of type METADATA", item->name);
     
    3434        pmFPAfile *imageFile = defineFile(config, NULL, "PSPHOT.INPUT", image, PM_FPA_FILE_IMAGE); // File for image
    3535        if (!imageFile) {
    36             psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", nInputs, image);
     36            psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, image);
    3737            return false;
    3838        }
     
    4040        psString mask = psMetadataLookupStr(&status, input, "MASK"); // Name of mask
    4141        if (mask && strlen(mask) > 0) {
    42             if (!defineFile(config, imageFile, "PSPHOT.INPUT.MASK", mask, PM_FPA_FILE_MASK)) {
    43                 psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", nInputs, mask);
     42            if (!defineFile(config, imageFile, "PSPHOT.MASK", mask, PM_FPA_FILE_MASK)) {
     43                psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask);
    4444                return false;
    4545            }
     
    4848        psString variance = psMetadataLookupStr(&status, input, "VARIANCE"); // Name of variance map
    4949        if (variance && strlen(variance) > 0) {
    50             if (!defineFile(config, imageFile, "PSPHOT.INPUT.VARIANCE", variance, PM_FPA_FILE_VARIANCE)) {
    51                 psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)", nInputs, variance);
     50            if (!defineFile(config, imageFile, "PSPHOT.VARIANCE", variance, PM_FPA_FILE_VARIANCE)) {
     51                psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)", i, variance);
    5252                return false;
    5353            }
    5454        }
    55         nInputs ++;
     55        // the output sources are carried on the input->fpa structures
     56        pmFPAfile *outsources = pmFPAfileDefineOutputFromFile (config, imageFile, "PSPHOT.STACK.OUTPUT");
     57        if (!outsources) {
     58            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.OUTPUT");
     59            return false;
     60        }
     61        outsources->save = true;
     62        outsources->fileID = i;         // this is used to generate output names
    5663    }
    5764    psMetadataRemoveKey(config->arguments, "FILENAMES");
    5865    psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", nInputs);
     66
     67    if (!psphotSetMaskBits (config)) {
     68        psError (PS_ERR_UNKNOWN, false, "failed to set mask bit values");
     69        return NULL;
     70    }
    5971
    6072    // generate an pmFPAimage for the chisqImage
     
    6476        return false;
    6577    }
    66     pmFPAfile *chisqMask = pmFPAfileDefineOutput(config, chisqImage->fpa, "PPIMAGE.CHISQ.MASK");
     78    chisqImage->save = true;
     79
     80    pmFPAfile *chisqMask = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.MASK");
    6781    if (!chisqMask) {
    68         psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHISQ.MASK"));
     82        psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.MASK"));
    6983        return NULL;
    7084    }
    7185    if (chisqMask->type != PM_FPA_FILE_MASK) {
    72         psError(PS_ERR_IO, true, "PPIMAGE.CHISQ.MASK is not of type MASK");
     86        psError(PS_ERR_IO, true, "PSPHOT.CHISQ.MASK is not of type MASK");
    7387        return NULL;
    7488    }
    75     pmFPAfile *chisqVariance = pmFPAfileDefineOutput(config, chisqImage->fpa, "PPIMAGE.CHISQ.VARIANCE");
     89    chisqMask->save = true;
     90
     91    pmFPAfile *chisqVariance = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.VARIANCE");
    7692    if (!chisqVariance) {
    77         psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHISQ.VARIANCE"));
     93        psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.VARIANCE"));
    7894        return NULL;
    7995    }
    8096    if (chisqVariance->type != PM_FPA_FILE_VARIANCE) {
    81         psError(PS_ERR_IO, true, "PPIMAGE.CHISQ.VARIANCE is not of type VARIANCE");
     97        psError(PS_ERR_IO, true, "PSPHOT.CHISQ.VARIANCE is not of type VARIANCE");
    8298        return NULL;
    8399    }
     100    chisqVariance->save = true;
    84101
    85102# if (0)   
Note: See TracChangeset for help on using the changeset viewer.