IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4189


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

cleaning arg parsing, adding noise/mask images

Location:
trunk/psphot/src
Files:
1 added
3 edited

Legend:

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

    r4115 r4189  
    1919    psImageSmooth (smooth, SIGMA, NSIGMA);
    2020
    21     // XXX missing pslib functions:
    22     // kernel = psKernelParts ();
    23     // smooth = psImageConvolve (smooth, image, kernel, PS_PARTS);
     21    psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot"));
    2422
    25     psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot"));
    2623
    2724    // find the peaks in the smoothed image
  • trunk/psphot/src/psphot.c

    r4188 r4189  
    77    psMetadata *header  = NULL;         // input image header
    88    psImage    *image   = NULL;         // input image data
     9    psImage    *noise   = NULL;         // input image data
     10    psImage    *mask    = NULL;         // input image data
    911    psArray    *sources = NULL;
    1012    psArray    *peaks   = NULL;         // a list of pmPeaks
     
    1416    psLogArguments (&argc, argv);
    1517    psTraceArguments (&argc, argv);
    16     if (argc != 4) usage ();
     18    config = load_args (&argc, argv);
    1719
    1820    // load input data (image and config)
    19     setup (&image, &header, &config, argv);
     21    // create or load mask and noise images
     22    setup (&image, &mask, &noise, &header, config);
    2023
    2124    // measure image stats for initial guess
     
    5861}
    5962
    60 int usage () {
    61 
    62     fprintf (stderr, "USAGE: psphot (image.fits) (output.fits) (config)\n");
    63     exit (2);
    64 }
    65 
    6663void dump_image (psImage *image, char *filename) {
    6764
  • 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.