IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15039


Ignore:
Timestamp:
Sep 26, 2007, 5:35:29 PM (19 years ago)
Author:
eugene
Message:

adding PS1_DEV_1 as pmSource I/O format; various cleanups of I/O operations

Location:
trunk/psModules/src/objects
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/Makefile.am

    r14938 r15039  
    2323     pmSourceIO_SMPDATA.c \
    2424     pmSourceIO_PS1_DEV_0.c \
     25     pmSourceIO_PS1_DEV_1.c \
    2526     pmSourcePlots.c \
    2627     pmSourcePlotPSFModel.c \
  • trunk/psModules/src/objects/pmPeaks.c

    r14652 r15039  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-08-24 00:11:02 $
     8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-09-27 03:35:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151
    5252    // calculate peak position relative to ix,iy
     53    // XXX these functions need to take a mask, weight, and calculate the errors
    5354    psPolynomial2D *bicube = psImageBicubeFit (image, ix + image->col0, iy + image->row0);
    5455    psPlane min = psImageBicubeMin (bicube);
     
    5960        peak->xf = min.x + ix + image->col0;
    6061        peak->yf = min.y + iy + image->row0;
     62        peak->dx = 0.0;
     63        peak->dy = 0.0;
    6164    } else {
    6265        peak->xf = ix;
    6366        peak->yf = iy;
     67        peak->dx = 1.0;
     68        peak->dy = 1.0;
    6469    }
    6570
     
    189194    }
    190195    psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);
     196    return (0);
     197}
     198
     199// sort by SN (descending)
     200int pmPeakSortBySN (const void **a, const void **b)
     201{
     202    pmPeak *A = *(pmPeak **)a;
     203    pmPeak *B = *(pmPeak **)b;
     204
     205    psF32 fA = A->SN;
     206    psF32 fB = B->SN;
     207    if (isnan (fA)) fA = 0;
     208    if (isnan (fB)) fB = 0;
     209
     210    psF32 diff = fA - fB;
     211    if (diff > FLT_EPSILON) return (-1);
     212    if (diff < FLT_EPSILON) return (+1);
     213    return (0);
     214}
     215
     216// sort by Y (ascending)
     217int pmPeakSortByY (const void **a, const void **b)
     218{
     219    pmPeak *A = *(pmPeak **)a;
     220    pmPeak *B = *(pmPeak **)b;
     221
     222    psF32 fA = A->y;
     223    psF32 fB = B->y;
     224
     225    psF32 diff = fA - fB;
     226    if (diff > FLT_EPSILON) return (+1);
     227    if (diff < FLT_EPSILON) return (-1);
    191228    return (0);
    192229}
  • trunk/psModules/src/objects/pmPeaks.h

    r14652 r15039  
    1010 * @author GLG, MHPCC
    1111 *
    12  * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  * @date $Date: 2007-08-24 00:11:02 $
     12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 * @date $Date: 2007-09-27 03:35:29 $
    1414 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1515 */
     
    5353    float xf;                           ///< bicube fit to peak coord (x)
    5454    float yf;                           ///< bicube fit to peak coord (y)
     55    float dx;                           ///< bicube fit error on peak coord (x)
     56    float dy;                           ///< bicube fit error on peak coord (y)
    5557    float value;                        ///< level in detection image
    5658    float flux;                         ///< level in unsmoothed sci image
     
    148150int pmPeaksCompareDescend (const void **a, const void **b);
    149151
     152int pmPeakSortBySN (const void **a, const void **b);
     153int pmPeakSortByY (const void **a, const void **b);
     154
    150155/// @}
    151156# endif /* PM_PEAKS_H */
  • trunk/psModules/src/objects/pmSource.c

    r14950 r15039  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-21 00:21:57 $
     8 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-09-27 03:35:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8787    pmSource *source = (pmSource *) psAlloc(sizeof(pmSource));
    8888    *(int *)&source->id = id++;
     89    source->seq = -1;
    8990    source->peak = NULL;
    9091    source->pixels = NULL;
     
    111112    source->skyErr = NAN;
    112113    source->pixWeight = NAN;
     114
     115    source->psfProb = NAN;
     116    source->crNsigma = NAN;
     117    source->extNsigma = NAN;
    113118
    114119    psTrace("psModules.objects", 5, "---- end ----\n");
     
    930935    return NULL;
    931936}
     937
     938// sort by SN (descending)
     939int pmSourceSortBySN (const void **a, const void **b)
     940{
     941    pmSource *A = *(pmSource **)a;
     942    pmSource *B = *(pmSource **)b;
     943
     944    psF32 fA = (A->peak == NULL) ? 0 : A->peak->SN;
     945    psF32 fB = (B->peak == NULL) ? 0 : B->peak->SN;
     946    if (isnan (fA)) fA = 0;
     947    if (isnan (fB)) fB = 0;
     948
     949    psF32 diff = fA - fB;
     950    if (diff > FLT_EPSILON) return (-1);
     951    if (diff < FLT_EPSILON) return (+1);
     952    return (0);
     953}
     954
     955// sort by Y (ascending)
     956int pmSourceSortByY (const void **a, const void **b)
     957{
     958    pmSource *A = *(pmSource **)a;
     959    pmSource *B = *(pmSource **)b;
     960
     961    psF32 fA = (A->peak == NULL) ? 0 : A->peak->y;
     962    psF32 fB = (B->peak == NULL) ? 0 : B->peak->y;
     963
     964    psF32 diff = fA - fB;
     965    if (diff > FLT_EPSILON) return (+1);
     966    if (diff < FLT_EPSILON) return (-1);
     967    return (0);
     968}
     969
  • trunk/psModules/src/objects/pmSource.h

    r14652 r15039  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2007-08-24 00:11:02 $
     5 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2007-09-27 03:35:29 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    5959struct pmSource {
    6060    const int id;                       ///< Unique ID for object
     61    int seq;                            ///< ID for output (generated on write)
    6162    pmPeak *peak;                       ///< Description of peak pixel.
    6263    psImage *pixels;                    ///< Rectangular region including object pixels.
     
    7879    float apMag;                        ///< apMag corresponding to psfMag or extMag (depending on type)
    7980    float pixWeight;                    ///< model-weighted coverage of valid pixels
     81    float psfProb;                      ///< probability of PSF
     82    float crNsigma;                     ///< Nsigma deviation from PSF to CR
     83    float extNsigma;                    ///< Nsigma deviation from PSF to EXT
    8084    psRegion region;                    ///< area on image covered by selected pixels
    8185    float sky, skyErr;                  ///< The sky and its error at the center of the object
     
    223227bool pmSourceCachePSF (pmSource *source, psMaskType maskVal);
    224228
     229int             pmSourceSortBySN (const void **a, const void **b);
     230int             pmSourceSortByY (const void **a, const void **b);
     231
    225232/// @}
    226233# endif /* PM_SOURCE_H */
  • trunk/psModules/src/objects/pmSourceIO.c

    r14938 r15039  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-09-27 03:35:29 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    388388                status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname);
    389389            }
     390            if (!strcmp (exttype, "PS1_DEV_1")) {
     391                status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname);
     392            }
    390393
    391394            if (!status) {
     
    708711            sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
    709712        }
     713        if (!strcmp (exttype, "PS1_DEV_1")) {
     714            sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
     715        }
    710716
    711717        psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname);
  • trunk/psModules/src/objects/pmSourceIO.h

    r14208 r15039  
    44 * @author EAM, IfA; GLG, MHPCC
    55 *
    6  * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-07-14 03:20:44 $
     6 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-09-27 03:35:29 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 *
     
    2626bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    2727bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
     28bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    2829
    2930bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
     
    3334psArray *pmSourcesRead_SMPDATA (psFits *fits, psMetadata *header);
    3435psArray *pmSourcesRead_PS1_DEV_0 (psFits *fits, psMetadata *header);
     36psArray *pmSourcesRead_PS1_DEV_1 (psFits *fits, psMetadata *header);
    3537
    3638bool pmSourcesWritePSFs (psArray *sources, char *filename);
Note: See TracChangeset for help on using the changeset viewer.