IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 9, 2005, 7:22:03 AM (21 years ago)
Author:
eugene
Message:

cleaning arg parsing, adding noise/mask images

File:
1 edited

Legend:

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

    r4114 r4189  
    11# include "psphot.h"
    22
    3 bool setup (psImage **image, psMetadata **header, psMetadata **config, char **argv)
     3bool setup (psImage **image, psImage **mask, psImage **noise, psMetadata **header, psMetadata **config)
    44{
    55    int       Nfail;
     
    99    psTimerStart ("psphot");
    1010
    11     *config = psMetadataParseConfig (NULL, &Nfail, argv[3], FALSE);
    12 
    13     file   = psFitsAlloc (argv[1]);
     11    char *input = pmConfigLookupSTR (&status, *config, *header, "INPUT");
     12    file = psFitsAlloc (input);
    1413
    1514    *header = psMetadataAlloc ();
     
    2726    psMetadataAdd (*config, PS_LIST_TAIL, "GAIN",    PS_META_F32 | PS_META_REPLACE, "gain value used", GAIN);
    2827
     28    // load the noise image if it exists, otherwise build from input
     29    char *noiseName = pmConfigLookupSTR (&status, *config, *header, "NOISE");
     30    if (status == true) {
     31      file = psFitsAlloc (noiseName);
     32      *noise  = psFitsReadImage  (*noise, file, region, 0);
     33      psFree (file);
     34    } else {
     35      *value = psScalar (1.0 / GAIN);
     36      *noise = BinaryOp (NULL, *image, '/', value);
     37      psFree (value);
     38
     39      *value = psScalar (PS_SQR(RDNOISE/GAIN));
     40      *noise = BinaryOp (*noise, *noise, '+', value);
     41      psFree (value);
     42    }
     43
     44    char *maskName = pmConfigLookupSTR (&status, *config, *header, "MASK");
     45    if (status == true) {
     46      file = psFitsAlloc (maskName);
     47      *mask  = psFitsReadImage  (*mask, file, region, 0);
     48      psFree (file);
     49    } else {
     50      *mask = psImageAlloc (image->numCols, image->numRows, PS_TYPE_U8);
     51    }
     52
    2953    psLogMsg ("psphot", 3, "load data: %f sec\n", psTimerMark ("psphot"));
    3054
Note: See TracChangeset for help on using the changeset viewer.