IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34568


Ignore:
Timestamp:
Oct 24, 2012, 3:53:46 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20120905/psModules
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120905/psModules

  • branches/eam_branches/ipp-20120905/psModules/src/objects

    • Property svn:mergeinfo deleted
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmModel.c

    r31153 r34568  
    6464    tmp->type = type;
    6565    tmp->mag = NAN;
     66    tmp->magErr = NAN;
    6667    tmp->chisq = NAN;
    6768    tmp->chisqNorm = NAN;
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmMoments.c

    r32347 r34568  
    3030    pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments));
    3131
    32     tmp->Mrf = 0.0;
    33     tmp->Mrh = 0.0;
     32    tmp->Mrf = NAN;
     33    tmp->Mrh = NAN;
    3434
    35     tmp->KronCore = 0.0;
    36     tmp->KronCoreErr = 0.0;
     35    tmp->KronCore = NAN;
     36    tmp->KronCoreErr = NAN;
    3737
    38     tmp->KronFlux = 0.0;
    39     tmp->KronFluxErr = 0.0;
     38    tmp->KronFlux = NAN;
     39    tmp->KronFluxErr = NAN;
    4040
    41     tmp->KronFinner = 0.0;
    42     tmp->KronFouter = 0.0;
     41    tmp->KronFinner = NAN;
     42    tmp->KronFouter = NAN;
    4343
    44     tmp->KronFluxPSF = 0.0;
    45     tmp->KronFluxPSFErr = 0.0;
    46     tmp->KronRadiusPSF = 0.0;
     44    tmp->KronFluxPSF = NAN;
     45    tmp->KronFluxPSFErr = NAN;
     46    tmp->KronRadiusPSF = NAN;
    4747
    48     tmp->Mx = 0.0;
    49     tmp->My = 0.0;
     48    tmp->Mx = NAN;
     49    tmp->My = NAN;
    5050
    51     tmp->Mxx = 0.0;
    52     tmp->Mxy = 0.0;
    53     tmp->Myy = 0.0;
     51    tmp->Mxx = NAN;
     52    tmp->Mxy = NAN;
     53    tmp->Myy = NAN;
    5454
    55     tmp->Mxxx = 0.0;
    56     tmp->Mxxy = 0.0;
    57     tmp->Mxyy = 0.0;
    58     tmp->Myyy = 0.0;
     55    tmp->Mxxx = NAN;
     56    tmp->Mxxy = NAN;
     57    tmp->Mxyy = NAN;
     58    tmp->Myyy = NAN;
    5959
    60     tmp->Mxxxx = 0.0;
    61     tmp->Mxxxy = 0.0;
    62     tmp->Mxxyy = 0.0;
    63     tmp->Mxyyy = 0.0;
    64     tmp->Myyyy = 0.0;
     60    tmp->Mxxxx = NAN;
     61    tmp->Mxxxy = NAN;
     62    tmp->Mxxyy = NAN;
     63    tmp->Mxyyy = NAN;
     64    tmp->Myyyy = NAN;
    6565
    66     tmp->Sum = 0.0;
    67     tmp->Peak = 0.0;
    68     tmp->Sky = 0.0;
     66    tmp->Sum = NAN;
     67    tmp->Peak = NAN;
     68    tmp->Sky = NAN;
    6969    tmp->nPixels = 0;
    7070    tmp->SN = 0;
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmSourceIO.c

    r34403 r34568  
    12321232{
    12331233    if (!psFitsMoveExtNameClean (file->fits, xsrcname)) {
    1234         psWarning ("cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
     1234        psTrace ("pmFPAfile", 1, "cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
    12351235        return false;
    12361236    }
     
    12701270{
    12711271    if (!psFitsMoveExtNameClean (file->fits, extname)) {
    1272         psWarning ("cannot find xfit extension %s in %s, skipping", extname, file->filename);
     1272        psTrace ("pmFPAfile", 1, "cannot find xfit extension %s in %s, skipping", extname, file->filename);
    12731273        return false;
    12741274    }
     
    13071307{
    13081308    if (!psFitsMoveExtNameClean (file->fits, extname)) {
    1309         psWarning ("cannot find xrad extension %s in %s, skipping", extname, file->filename);
     1309        psTrace ("pmFPAfile", 1, "cannot find xrad extension %s in %s, skipping", extname, file->filename);
    13101310        return false;
    13111311    }
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmSourceIO_CMF.c.in

    r34451 r34568  
    196196        @PS1_DV?@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_NRATIO_ALL",  PS_DATA_F32, "nPos / (nGood + nMask + nBad)",              diffStats.nRatioAll);
    197197
    198         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_P",         PS_DATA_F32, "distance to positive match source",          diffStats.Rp);
    199         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_P",        PS_DATA_F32, "signal-to-noise of pos match src",           diffStats.SNp);
    200         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_M",         PS_DATA_F32, "distance to negative match source",          diffStats.Rm);
    201         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_M",        PS_DATA_F32, "signal-to-noise of neg match src",           diffStats.SNm);
     198        @>PS1_DV1@                        psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_P",         PS_DATA_F32, "distance to positive match source",          diffStats.Rp);
     199        @>PS1_DV1@                        psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_P",        PS_DATA_F32, "signal-to-noise of pos match src",           diffStats.SNp);
     200        @>PS1_DV1@                        psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_M",         PS_DATA_F32, "distance to negative match source",          diffStats.Rm);
     201        @>PS1_DV1@                        psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_M",        PS_DATA_F32, "signal-to-noise of neg match src",           diffStats.SNm);
    202202
    203203        @ALL@                      psMetadataAdd (row, PS_LIST_TAIL, "FLAGS",            PS_DATA_U32, "psphot analysis flags",                      source->mode);
     
    309309        @ALL@     axes.minor        = psMetadataLookupF32 (&status, row, "PSF_MINOR");
    310310        @ALL@     axes.theta        = psMetadataLookupF32 (&status, row, "PSF_THETA");
     311        @ALL@     axes.theta        = axes.theta * PS_RAD_DEG;
    311312
    312313        @ALL@     PAR[PM_PAR_SKY]   = psMetadataLookupF32 (&status, row, "SKY");
     
    465466        sprintf (keyword2, "RMAX_%02d", i);
    466467        psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword1, PS_META_REPLACE, "min radius for SB profile", radMin->data.F32[i]);
    467         psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword2, PS_META_REPLACE, "min radius for SB profile", radMax->data.F32[i]);
     468        psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword2, PS_META_REPLACE, "max radius for SB profile", radMax->data.F32[i]);
    468469    }
    469470
     
    723724    sources = psArraySort (sources, pmSourceSortByFlux);
    724725
     726    @>PS1_DV2@ float magOffset;
     727    @>PS1_DV2@ float zeroptErr;
     728    @>PS1_DV2@ float fwhmMajor;
     729    @>PS1_DV2@ float fwhmMinor;
     730    @>PS1_DV2@ pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);
     731
    725732    // we are writing one row per model; we need to write out same number of columns for each row: find the max Nparams
    726733    int nParamMax = 0;
     
    781788            @>PS1_DV2@ double raPos = ptSky.r*PS_DEG_RAD;
    782789            @>PS1_DV2@ double decPos = ptSky.d*PS_DEG_RAD;
     790            @>PS1_DV2@ posAngle *= PS_DEG_RAD;
     791            @>PS1_DV2@ pltScale *= PS_DEG_RAD*3600.0;
    783792
    784793            float kronFlux = source->moments ? source->moments->KronFlux : NAN;
     
    797806            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model ra coordinate",                    raPos);
    798807            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT",          0, "EXT model dec coordinate",                   decPos);
     808            @>PS1_DV2@ float instFlux = isfinite(model->mag) ? pow(10.0, -0.4*model->mag) : NAN;
     809            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_FLUX",    0, "EXT fit instrumental counts",                instFlux);
     810
    799811            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
    800812            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
     813
     814            @>PS1_DV2@ float calMag = isfinite(magOffset) ? model->mag + magOffset : NAN;
     815            @>PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "EXT_CAL_MAG", PS_DATA_F32, "EXT Magnitude using supplied calibration",   calMag);
     816            @>PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "EXT_CHISQ",   PS_DATA_F32, "EXT Magnitude using supplied calibration",   model->chisq);
     817            @>PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "EXT_NDOF",    PS_DATA_S32, "EXT Magnitude using supplied calibration",   model->nDOF);
    801818
    802819            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "POSANGLE",   0, "position angle at source (degrees)",         posAngle);
     
    813830            psMetadataAddF32 (row, PS_LIST_TAIL, "KRON_MAG",         0, "Kron Mag",                                   kronMag);
    814831
    815             @ALL, <PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
    816             @>PS1_DV2@      psMetadataAddS32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
     832            @PS1_DV1,PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
     833            @ALL,!PS1_DV0,!PS1_DV1@ psMetadataAddS32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
    817834            psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
    818835
     
    820837            if (model->type == pmModelClassGetType("PS_MODEL_TRAIL")) {
    821838                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width (major axis), length for trail", PAR[PM_PAR_LENGTH]);
    822                 psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width (minor axis), sigma for trail",  PAR[PM_PAR_SIGMA]);
     839                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width (minor axis), sigma for trail",  PAR[PM_PAR_SIGMA]); // this is not fitted
    823840                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                    PAR[PM_PAR_THETA]);
    824841                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ_ERR",0, "EXT width error (major axis)",            dPAR[PM_PAR_LENGTH]);
    825                 psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN_ERR",0, "EXT width error (minor axis)",            dPAR[PM_PAR_SIGMA]);
     842                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN_ERR",0, "EXT width error (minor axis)",            NAN); // this is not fitted, so error is NAN
    826843                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA_ERR",    0, "EXT orientation angle (error)",           dPAR[PM_PAR_THETA]);
    827844            } else {
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmSourceOutputs.c

    r34403 r34568  
    227227    *pltScale = 0.5*(pltScale_x + pltScale_y);
    228228
     229    float posAngle_x, posAngle_y;
    229230    float crossProduct = dTPx_dCHx * dTPy_dCHy - dTPx_dCHy * dTPy_dCHx;
    230231    if  (crossProduct > 0.) {
    231232      *pltScale *= -1.0;
    232     }
    233 
    234     float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx);
    235     float posAngle_y = atan2 (-dTPy_dCHy, +dTPx_dCHy);
     233      posAngle_x = atan2 (dTPy_dCHx, dTPx_dCHx);
     234      posAngle_y = atan2 (dTPy_dCHy, dTPx_dCHy) - M_PI_2;
     235    } else {
     236      posAngle_x = atan2 (dTPy_dCHx, -dTPx_dCHx);
     237      posAngle_y = atan2 (dTPy_dCHy,  dTPx_dCHy) - M_PI_2;
     238    }
     239
     240    // with errors, these may end up on opposite sides of the M_PI boundary. 
     241    if (posAngle_x - posAngle_y > M_PI) {
     242      posAngle_y += 2.0 * M_PI;
     243    }
     244    if (posAngle_y - posAngle_x > M_PI) {
     245      posAngle_x += 2.0 * M_PI;
     246    }
    236247    *posAngle = 0.5*(posAngle_x + posAngle_y);
    237248
  • branches/eam_branches/ipp-20120905/psModules/src/objects/pmSourcePhotometry.c

    r34403 r34568  
    165165            status = pmSourcePhotometryModel (&model->mag, NULL, model);
    166166            if (model == source->modelEXT) foundEXT = true;
     167            float SN = fabs(model->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0]);
     168            model->magErr = 1.0 / SN;
    167169        }
    168170        if (foundEXT) {
Note: See TracChangeset for help on using the changeset viewer.