IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6864


Ignore:
Timestamp:
Apr 17, 2006, 7:10:08 AM (20 years ago)
Author:
magnier
Message:

fixed up object output file functions, small speed improvements

Location:
branches/rel10_ifa/psModules/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/pmFPAfile.c

    r6859 r6864  
    245245    bool status;
    246246    char *extra;
    247     char *mode;
     247    char *mode = NULL;
    248248    char *readMode = "r";
    249249    char *writeMode = "w";
  • branches/rel10_ifa/psModules/src/objects/models/pmModel_QGAUSS.c

    r6712 r6864  
    123123    // the area needs to be multiplied by the integral of f(z)
    124124    norm = 0.0;
    125     for (z = 0.005; z < 50; z += 0.01) {
     125    for (z = 0.05; z < 50; z += 0.1) {
    126126        f = 1.0 / (1 + PAR[7]*z + pow(z, 2.25));
    127127        // test: f = 1.0 / (1 + PAR[7]*z + PS_SQR(z));
    128128        norm += f;
    129129    }
    130     norm *= 0.01;
     130    norm *= 0.1;
    131131
    132132    psF64 Flux = PAR[1] * Area * norm;
  • branches/rel10_ifa/psModules/src/objects/pmSourceIO.c

    r6859 r6864  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    326326
    327327    bool status;
    328     psArray *sources;
     328    psArray *sources = NULL;
    329329    pmHDU *hdu;
    330330
  • branches/rel10_ifa/psModules/src/objects/pmSourceIO_CMF.c

    r6859 r6864  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.6 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.7 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8989    psMetadataAdd (header, PS_LIST_HEAD, "EXTNAME", PS_DATA_STRING | PS_META_REPLACE, "extension name", extname);
    9090
     91    // XXX this is broken : does not write the existing header elements except EXTNAME
    9192    psFitsWriteTable (fits, header, table);
    9293    psTrace ("pmFPAfile", 5, "wrote ext data %s\n", extname);
  • branches/rel10_ifa/psModules/src/objects/pmSourceIO_CMP.c

    r6859 r6864  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.6 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3737    psMetadataItem *mdi;
    3838    psF32 *PAR, *dPAR;
    39     float dmag, lsky;
     39    float lsky = 0;
    4040    bool status;
    4141    psEllipseShape shape;
     
    9999        psLineAdd (line, "%6.1f ",  PAR[3]);
    100100        psLineAdd (line, "%6.3f ",  PS_MIN (99.0, source->psfMag + ZERO_POINT));
    101         psLineAdd (line, "%03d ",   PS_MIN (999, (int)(1000*dmag)));
     101        psLineAdd (line, "%03d ",   PS_MIN (999, (int)(1000*source->errMag)));
    102102        psLineAdd (line, "%2d ",    type);
    103103        psLineAdd (line, "%3.1f ",  lsky);
     
    249249    return (sources);
    250250}
    251 
    252 # if (0)
    253     PAR = model->params->data.F32;
    254 dPAR = model->dparams->data.F32;
    255 
    256 dmag = dPAR[1] / PAR[1];
    257 type = pmSourceDophotType (source);
    258 lsky = (PAR[0] < 1.0) ? 0.0 : log10(PAR[0]);
    259 
    260 psLineInit (line);
    261 psLineAdd (line, "%6.1f ", PAR[2]);
    262 psLineAdd (line, "%6.1f ", PAR[3]);
    263 psLineAdd (line, "%6.3f ", PS_MIN (99.999, source->fitMag + ZERO_POINT));
    264 psLineAdd (line, "%03d ",  PS_MIN (999, (int)(1000*dmag)));
    265 psLineAdd (line, "%2d ",   type);
    266 psLineAdd (line, "%3.1f ", lsky);
    267 psLineAdd (line, "%6.3f ", 99.999); // should be 'Mgal
    268 psLineAdd (line, "%6.3f ", PS_MIN (99.999, source->apMag + ZERO_POINT));
    269 psLineAdd (line, "%6.2f ", PAR[4]); // should be 'FHWM x'
    270 psLineAdd (line, "%6.2f ", PAR[5]); // should be 'FHWM y'
    271 psLineAdd (line, "%5.1f\n", 0); // should be theta
    272 
    273 # endif
  • branches/rel10_ifa/psModules/src/objects/pmSourceIO_RAW.c

    r6859 r6864  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.6 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    130130        if (source->type != PM_SOURCE_TYPE_EXTENDED)
    131131            continue;
    132         model = pmSourceMagnitudes (source, NULL, false, false);
     132
     133        model = source->modelEXT;
    133134        if (model == NULL)
    134135            continue;
  • branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.c

    r6859 r6864  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5656
    5757// XXX EAM : masked region should be (optionally) elliptical
    58 // XXX curve of growth is corrected to
    59 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr)
    60 {
    61 
    62     int status;
     58bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode)
     59{
     60
     61    int status = false;
    6362    bool isPSF;
    6463    float x, y;
     
    6766    pmModel *model;
    6867
     68    source->psfMag = 99.0;
     69    source->extMag = 99.0;
     70    source->errMag = 99.0;
     71    source->apMag  = 99.0;
     72
    6973    switch (source->type) {
    7074    case PM_SOURCE_TYPE_STAR:
    7175        model = source->modelPSF;
    7276        if (model == NULL)
    73             return NULL;
     77            return false;
    7478        isPSF = true;
    7579        break;
     
    7882        model = source->modelEXT;
    7983        if (model == NULL)
    80             return NULL;
     84            return false;
    8185        isPSF = false;
    8286        break;
    8387
    8488    default:
    85         return NULL;
     89        return false;
    8690    }
    8791
     
    96100    y = model->params->data.F32[3];
    97101
     102    // measure object model photometry
     103    status = pmSourcePhotometryModel (&source->psfMag, source->modelPSF);
     104    status = pmSourcePhotometryModel (&source->extMag, source->modelEXT);
     105    // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS
     106    if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf) {
     107        // convert to the equivalent 2D model?
     108        source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     109    }
     110
     111    if (SN < AP_MIN_SN)
     112        return false;
     113
    98114    // replace source flux
    99115    // XXX test to see if source has been subtracted?
     
    103119    psImageKeepCircle (source->mask, x, y, model->radiusTMP, "OR", PM_SOURCE_MASK_MARKED);
    104120
    105     // measure object model photometry
    106     status = pmSourcePhotometryModel (&source->psfMag, source->modelPSF);
    107     status = pmSourcePhotometryModel (&source->extMag, source->modelEXT);
    108 
    109121    // measure the weight of included pixels
    110     status = pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->mask);
     122    if (mode & PM_SOURCE_PHOT_WEIGHT) {
     123        pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->mask);
     124    }
    111125
    112126    // measure object aperture photometry
    113     if (SN > AP_MIN_SN) {
    114         status = pmSourcePhotometryAper  (&source->apMag, model, source->pixels, source->mask);
    115     } else {
    116         source->apMag = 99.0;
    117     }
     127    status = pmSourcePhotometryAper  (&source->apMag, model, source->pixels, source->mask);
    118128
    119129    // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS
    120     if (isPSF && (psf != NULL)) {
    121         if (SN > AP_MIN_SN) {
    122             if ((psf->growth != NULL) && growthCorr) {
    123                 source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP);
    124             }
    125             if (apTrendCorr) {
    126                 rflux   = pow (10.0, 0.4*source->psfMag);
    127                 source->apMag  -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux;
    128             }
    129         }
    130         if (apTrendCorr) {
    131             source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     130    if (status && isPSF && psf) {
     131        if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) {
     132            source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP);
     133        }
     134        if (mode & PM_SOURCE_PHOT_APCORR) {
     135            rflux   = pow (10.0, 0.4*source->psfMag);
     136            source->apMag  -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux;
    132137        }
    133138    }
     
    139144    pmModelSub (source->pixels, source->mask, model, false, false);
    140145
    141     if (!status)
    142         return NULL;
    143     return model;
     146    return status;
    144147}
    145148
  • branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.h

    r6859 r6864  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-14 21:43:59 $
     5 *  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-17 17:10:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525 *
    2626 */
     27
     28typedef enum {
     29    PM_SOURCE_PHOT_NONE   = 0x0000,
     30    PM_SOURCE_PHOT_GROWTH = 0x0001,
     31    PM_SOURCE_PHOT_APCORR = 0x0002,
     32    PM_SOURCE_PHOT_WEIGHT = 0x0004,
     33} pmSourcePhotometryMode;
     34
    2735bool pmSourcePhotometryModel(
    2836    float *fitMag,                      ///< integrated fit magnitude
     
    3745);
    3846
    39 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr);
     47bool pmSourceMagnitudesInit (psMetadata *config);
     48bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode);
    4049float pmSourceCrossProduct (pmSource *Mi, pmSource *Mj);
    4150float pmSourceCrossWeight (pmSource *Mi, pmSource *Mj);
Note: See TracChangeset for help on using the changeset viewer.