IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2012, 6:32:19 PM (14 years ago)
Author:
watersc1
Message:

merge from trunk. Preliminary versions of stacktool/warptool updates and regenerate_background.pl script. The warp code is finished and tested, and I still need to get the stack version resolved.

Location:
branches/czw_branch/20120906/psModules
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/psModules

  • branches/czw_branch/20120906/psModules/src/objects

    • Property svn:ignore
      •  

        old new  
        77pmSourceIO_CMF_PS1_V1.c
        88pmSourceIO_CMF_PS1_V2.c
         9pmSourceIO_CMF_PS1_V2.v1.c
        910pmSourceIO_CMF_PS1_V3.c
         11pmSourceIO_CMF_PS1_V3.v1.c
         12pmSourceIO_CMF_PS1_V1.v1.c
        1013pmSourceIO_CMF_PS1_V4.c
        1114pmSourceIO_CMF_PS1_SV1.c
         15pmSourceIO_CMF_PS1_SV2.c
        1216pmSourceIO_CMF_PS1_DV1.c
        1317pmSourceIO_CMF_PS1_DV2.c
         18pmSourceIO_CMF_PS1_DV3.c
         19
  • branches/czw_branch/20120906/psModules/src/objects/pmModel.c

    r31153 r34772  
    6464    tmp->type = type;
    6565    tmp->mag = NAN;
     66    tmp->magErr = NAN;
    6667    tmp->chisq = NAN;
    6768    tmp->chisqNorm = NAN;
  • branches/czw_branch/20120906/psModules/src/objects/pmMoments.c

    r32347 r34772  
    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/czw_branch/20120906/psModules/src/objects/pmSourceIO.c

    r34403 r34772  
    10281028        if (strcmp (xtension, "BINTABLE")) {
    10291029            psWarning ("no binary table in extension %s, skipping\n", dataname);
     1030            psFree(tableHeader);
    10301031            return false;
    10311032        }
     
    12321233{
    12331234    if (!psFitsMoveExtNameClean (file->fits, xsrcname)) {
    1234         psWarning ("cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
     1235        psTrace ("pmFPAfile", 1, "cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
    12351236        return false;
    12361237    }
     
    12421243    if (!xtension) psAbort("cannot read table type");
    12431244    if (strcmp (xtension, "BINTABLE")) {
     1245        psFree(tableHeader);
    12441246        psWarning ("no binary table in extension %s, skipping\n", xsrcname);
    12451247        return false;
     
    12701272{
    12711273    if (!psFitsMoveExtNameClean (file->fits, extname)) {
    1272         psWarning ("cannot find xfit extension %s in %s, skipping", extname, file->filename);
     1274        psTrace ("pmFPAfile", 1, "cannot find xfit extension %s in %s, skipping", extname, file->filename);
    12731275        return false;
    12741276    }
     
    12811283    if (strcmp (xtension, "BINTABLE")) {
    12821284        psWarning ("no binary table in extension %s, skipping\n", extname);
     1285        psFree(tableHeader);
    12831286        return false;
    12841287    }
     
    13071310{
    13081311    if (!psFitsMoveExtNameClean (file->fits, extname)) {
    1309         psWarning ("cannot find xrad extension %s in %s, skipping", extname, file->filename);
     1312        psTrace ("pmFPAfile", 1, "cannot find xrad extension %s in %s, skipping", extname, file->filename);
    13101313        return false;
    13111314    }
     
    13181321    if (strcmp (xtension, "BINTABLE")) {
    13191322        psWarning ("no binary table in extension %s, skipping\n", extname);
     1323        psFree(tableHeader);
    13201324        return false;
    13211325    }
  • branches/czw_branch/20120906/psModules/src/objects/pmSourceIO_CMF.c.in

    r34403 r34772  
    118118
    119119        row = psMetadataAlloc ();
     120
     121        // the psMetadataAdd entry and the double quotes are used by grep to select the output fields for automatic documentation
     122        // This set of psMetadataAdd Entries marks the "----" "Start of the PSF segment"
    120123        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "IPP_IDET",         PS_DATA_U32, "IPP detection identifier index",             source->seq);
    121124        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "X_PSF",            PS_DATA_F32, "PSF x coordinate",                           outputs.xPos);
     
    193196        @PS1_DV?@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_NRATIO_ALL",  PS_DATA_F32, "nPos / (nGood + nMask + nBad)",              diffStats.nRatioAll);
    194197
    195         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_P",         PS_DATA_F32, "distance to positive match source",          diffStats.Rp);
    196         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_P",        PS_DATA_F32, "signal-to-noise of pos match src",           diffStats.SNp);
    197         @PS1_DV2@                 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_R_M",         PS_DATA_F32, "distance to negative match source",          diffStats.Rm);
    198         @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);
    199202
    200203        @ALL@                      psMetadataAdd (row, PS_LIST_TAIL, "FLAGS",            PS_DATA_U32, "psphot analysis flags",                      source->mode);
     
    306309        @ALL@     axes.minor        = psMetadataLookupF32 (&status, row, "PSF_MINOR");
    307310        @ALL@     axes.theta        = psMetadataLookupF32 (&status, row, "PSF_THETA");
     311        @ALL@     axes.theta        = axes.theta * PS_RAD_DEG;
    308312
    309313        @ALL@     PAR[PM_PAR_SKY]   = psMetadataLookupF32 (&status, row, "SKY");
     
    462466        sprintf (keyword2, "RMAX_%02d", i);
    463467        psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword1, PS_META_REPLACE, "min radius for SB profile", radMin->data.F32[i]);
    464         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]);
    465469    }
    466470
     
    491495
    492496        // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
     497        // the psMetadataAdd entry and the double quotes are used by grep to select the output fields for automatic documentation
     498        // This set of psMetadataAdd Entries marks the "----" "Start of the XSRC segment"
    493499        psMetadataAdd (row, PS_LIST_TAIL, "IPP_IDET",         PS_DATA_U32, "IPP detection identifier index",             source->seq);
    494500        psMetadataAdd (row, PS_LIST_TAIL, "X_EXT",            PS_DATA_F32, "EXT model x coordinate",                     xPos);
     
    718724    sources = psArraySort (sources, pmSourceSortByFlux);
    719725
     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
    720732    // we are writing one row per model; we need to write out same number of columns for each row: find the max Nparams
    721733    int nParamMax = 0;
     
    776788            @>PS1_DV2@ double raPos = ptSky.r*PS_DEG_RAD;
    777789            @>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;
    778792
    779793            float kronFlux = source->moments ? source->moments->KronFlux : NAN;
     
    783797
    784798            // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
     799            // the psMetadataAdd entry and the double quotes are used by grep to select the output fields for automatic documentation
     800            // This set of psMetadataAdd Entries marks the "----" "Start of the XFIT segment"
    785801            psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
    786802            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT",            0, "EXT model x coordinate",                     xPos);
     
    790806            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model ra coordinate",                    raPos);
    791807            @>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
    792811            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
    793812            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);
    794818
    795819            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "POSANGLE",   0, "position angle at source (degrees)",         posAngle);
     
    806830            psMetadataAddF32 (row, PS_LIST_TAIL, "KRON_MAG",         0, "Kron Mag",                                   kronMag);
    807831
    808             @ALL, <PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
    809             @>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);
    810834            psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
    811835
     
    813837            if (model->type == pmModelClassGetType("PS_MODEL_TRAIL")) {
    814838                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width (major axis), length for trail", PAR[PM_PAR_LENGTH]);
    815                 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
    816840                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                    PAR[PM_PAR_THETA]);
    817841                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ_ERR",0, "EXT width error (major axis)",            dPAR[PM_PAR_LENGTH]);
    818                 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
    819843                psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA_ERR",    0, "EXT orientation angle (error)",           dPAR[PM_PAR_THETA]);
    820844            } else {
     
    10721096
    10731097            // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
     1098            // the psMetadataAdd entry and the double quotes are used by grep to select the output fields for automatic documentation
     1099            // This set of psMetadataAdd Entries marks the "----" "Start of the XRAD segment"
    10741100            psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
    10751101            psMetadataAddF32 (row, PS_LIST_TAIL, "X_APER",           0, "Center of aperture measurements",            xPos);
  • branches/czw_branch/20120906/psModules/src/objects/pmSourceOutputs.c

    r34403 r34772  
    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/czw_branch/20120906/psModules/src/objects/pmSourcePhotometry.c

    r34403 r34772  
    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.