IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 1, 2011, 6:21:28 PM (15 years ago)
Author:
eugene
Message:

fix threading for psphotStack; use standard PS_ARGUMENTS_ macros for ppSub, ppStack, pswarp, ppImage, psphotStack; fix FPA.EXPOSURE in ppImageAddNoise; fix accounting for psf bad and poor weights; added flags for substantial poor masks due to each poor mask bit type; fix the measurement of the fwhm in pmPSFtoFWHM

Location:
branches/eam_branches/ipp-20110213/psphot/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c

    r30764 r30772  
    117117
    118118    // set limits on the aperture magnitudes
    119     pmSourceMagnitudesInit (recipe);
     119    pmSourceMagnitudesInit (config, recipe);
    120120
    121121    // threaded measurement of the source magnitudes
     
    466466        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);
    467467
    468         bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
     468        bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    469469
    470470        // clear the mask bit
  • branches/eam_branches/ipp-20110213/psphot/src/psphotArguments.c

    r29004 r30772  
    109109    }
    110110
    111     PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
     111    // generic arguments (version, dumpconfig)
     112    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
     113
     114    // thread arguments
     115    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
    112116
    113117    // save the following additional recipe values based on command-line options
    114118    // these options override the PSPHOT recipe values loaded from recipe files
    115119    psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
    116 
    117     // Number of threads is handled
    118     PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
    119120
    120121    // run the test model (requires X,Y coordinate)
  • branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c

    r30764 r30772  
    448448            }
    449449            psFree (modelPSF);
     450
     451            // float fwhmtest = pmPSFtoFWHM(psf, xc, yc);
     452            // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);
    450453        }
    451454    }
  • branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c

    r30764 r30772  
    4343    int NplainPass = 0;
    4444    int Nfaint = 0;
     45    int Nfail = 0;
    4546
    4647    psTimerStart ("psphot.extended");
     
    176177            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nplain
    177178            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for NplainPass
    178             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfain
     179            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfaint
     180            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail
    179181
    180182// set this to 0 to run without threading
     
    204206            scalar = job->args->data[12];
    205207            Nfaint += scalar->data.S32;
     208            scalar = job->args->data[13];
     209            Nfail += scalar->data.S32;
    206210            psFree(job);
    207211# endif
     
    234238                scalar = job->args->data[12];
    235239                Nfaint += scalar->data.S32;
     240                scalar = job->args->data[13];
     241                Nfail += scalar->data.S32;
    236242            }
    237243            psFree(job);
     
    244250    psLogMsg ("psphot", PS_LOG_INFO, "  %d convolved models (%d passed)\n", Nconvolve, NconvolvePass);
    245251    psLogMsg ("psphot", PS_LOG_INFO, "  %d plain models (%d passed)\n", Nplain, NplainPass);
    246     psLogMsg ("psphot", PS_LOG_INFO, "  %d too faint to fit\n", Nfaint);
     252    psLogMsg ("psphot", PS_LOG_INFO, "  %d too faint to fit, %d failed\n", Nfaint, Nfail);
    247253    return true;
    248254}
     
    253259    bool status;
    254260    int Next = 0;
     261    int Nfaint = 0;
     262    int Nfail = 0;
    255263    int Nconvolve = 0;
    256264    int NconvolvePass = 0;
    257265    int Nplain = 0;
    258     int Nfaint = 0;
    259266    int NplainPass = 0;
    260267    bool savePics = false;
     
    271278    psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA);
    272279
    273     pthread_t tid = pthread_self();     // Thread identifier
     280    // pthread_t tid = pthread_self();     // Thread identifier
    274281
    275282    // Define source fitting parameters for extended source fits
     
    305312        // if (source->modelEXT == NULL) continue;
    306313
    307         fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid);
     314        // fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid);
    308315
    309316        // replace object in image
     
    398405              if (!modelFit) {
    399406                  psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My);
     407                  Nfail ++;
    400408                  continue;
    401409              }
     
    412420              if (!modelFit) {
    413421                  psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My);
     422                  Nfail ++;
    414423                  continue;
    415424              }
     
    529538    scalar->data.S32 = Nfaint;
    530539
     540    scalar = job->args->data[13];
     541    scalar->data.S32 = Nfail;
     542
    531543    return true;
    532544}
  • branches/eam_branches/ipp-20110213/psphot/src/psphotForcedArguments.c

    r25981 r30772  
    103103    }
    104104
    105     PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
     105    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
    106106
    107107    // save the following additional recipe values based on command-line options
     
    110110
    111111    // Number of threads is handled
    112     PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
     112    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
    113113
    114114    // visual : interactive display mode
  • branches/eam_branches/ipp-20110213/psphot/src/psphotMagnitudes.c

    r29936 r30772  
    7676    maskVal |= markVal;
    7777
    78     pmSourceMagnitudesInit (recipe);
     78    pmSourceMagnitudesInit (config, recipe);
    7979
    8080    // the binning details are saved on the analysis metadata
     
    176176        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);
    177177
    178         status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
     178        status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    179179        if (status && isfinite(source->apMag)) Nap ++;
    180180
     
    295295    psArray *sources                = job->args->data[0];
    296296    psImageMaskType maskVal         = PS_SCALAR_VALUE(job->args->data[1],PS_TYPE_IMAGE_MASK_DATA);
    297     psImageMaskType markVal         = PS_SCALAR_VALUE(job->args->data[2],PS_TYPE_IMAGE_MASK_DATA);
    298297
    299298    for (int i = 0; i < sources->n; i++) {
     
    309308        }
    310309
    311         status = pmSourcePixelWeight (&source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);
     310        status = pmSourcePixelWeight (source, model, source->maskObj, maskVal, source->apRadius);
    312311        if (!status) {
    313312          psTrace ("psphot", 3, "fail to measure pixel weight");
  • branches/eam_branches/ipp-20110213/psphot/src/psphotMakeGrowthCurve.c

    r21183 r30772  
    88
    99    // set limits on the aperture magnitudes
    10     pmSourceMagnitudesInit (recipe);
     10    pmSourceMagnitudesInit (NULL, recipe);
    1111
    1212    // bit-masks to test for good/bad pixels
  • branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSFArguments.c

    r25982 r30772  
    103103    }
    104104
    105     PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
     105    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
    106106
    107107    // save the following additional recipe values based on command-line options
     
    110110
    111111    // Number of threads is handled
    112     PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
     112    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
    113113
    114114    // visual : interactive display mode
  • branches/eam_branches/ipp-20110213/psphot/src/psphotSetThreads.c

    r30624 r30772  
    3535    psFree(task);
    3636
    37     task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 13);
     37    task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 14);
    3838    task->function = &psphotExtendedSourceFits_Threaded;
    3939    psThreadTaskAdd(task);
  • branches/eam_branches/ipp-20110213/psphot/src/psphotSourceSize.c

    r30624 r30772  
    207207        num++;
    208208
    209         pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
     209        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    210210
    211211        float kMag = -2.5*log10(source->moments->KronFlux);
     
    327327
    328328        // XXX can we test if psfMag is set and calculate only if needed?
    329         pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
     329        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    330330
    331331        // convert to Mmaj, Mmin:
     
    501501        // psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal));
    502502        // psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", options->markVal);
    503         pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
     503        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    504504
    505505        // clear the mask bit
  • branches/eam_branches/ipp-20110213/psphot/src/psphotStackArguments.c

    r30624 r30772  
    2222    }
    2323
    24     // -version and -dumpconfig arguments
    25     PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
     24    // generic arguments (version, dumpconfig)
     25    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
     26
     27    // thread arguments
     28    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
    2629
    2730    // save the following additional recipe values based on command-line options
     
    2932    psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
    3033
    31     // Number of threads is handled
    32     PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
    33 
    3434    // visual : interactive display mode
    3535    if ((N = psArgumentGet (argc, argv, "-visual"))) {
    3636        psArgumentRemove (N, &argc, argv);
    3737        pmVisualSetVisual(true);
     38    }
     39
     40    // memdump : enable memory spot checks
     41    if ((N = psArgumentGet (argc, argv, "-memdump"))) {
     42        psArgumentRemove (N, &argc, argv);
     43        psMemDumpSetState(true);
    3844    }
    3945
  • branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c

    r30624 r30772  
    5050                psLogMsg ("psphot", 6, "Readout %d: %x %x\n", view->readout, cell->file_exists, cell->process);
    5151                if (! readout->data_exists) { continue; }
     52
     53                psMemDump("load");
    5254
    5355                // PSF matching
     
    5759                    return false;
    5860                }
     61                psMemDump("stackmatch");
    5962
    6063                // XXX for now, we assume there is only a single chip in the PHU:
     
    6467                    return false;
    6568                }
    66 
     69                psMemDump("psphot");
    6770            }
    6871            // drop all versions of the internal files
  • branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFsUtils.c

    r30707 r30772  
    287287
    288288    float penalty = psMetadataLookupF32(NULL, subRecipe, "PENALTY"); // Penalty for wideness
    289     int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
     289    int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
    290290
    291291    int order = psMetadataLookupS32(NULL, subRecipe, "SPATIAL.ORDER"); // Spatial polynomial order
  • branches/eam_branches/ipp-20110213/psphot/src/psphotStackPSF.c

    r30624 r30772  
    5656        }
    5757
    58         float Sxx = sqrt(2.0)*targetFWHM / 2.35;
     58        // measured scale factors (fwhm = Sxx * 2.35 * scaleFactor / sqrt(2.0))
     59        // GAUSS  : 1.000
     60        // PGAUSS : 1.006
     61        // QGAUSS : 1.151
     62        // RGAUSS : 0.883
     63        // PS1_V1 : 1.134
     64       
     65        float scaleFactor = NAN;
     66        if (!strcmp(psfModel, "PS_MODEL_GAUSS")) {
     67            scaleFactor = 1.000;
     68        }
     69        if (!strcmp(psfModel, "PS_MODEL_PGAUSS")) {
     70            scaleFactor = 1.0006;
     71        }
     72        if (!strcmp(psfModel, "PS_MODEL_QGAUSS")) {
     73            scaleFactor = 1.151;
     74        }
     75        if (!strcmp(psfModel, "PS_MODEL_RGAUSS")) {
     76            scaleFactor = 0.883;
     77        }
     78        if (!strcmp(psfModel, "PS_MODEL_PS1_V1")) {
     79            scaleFactor = 1.134;
     80        }
     81        psAssert (isfinite(scaleFactor), "invalid model for PSF");
     82
     83        float Sxx = sqrt(2.0)*targetFWHM / 2.35 / scaleFactor;
    5984
    6085        // XXX probably should make the model type (and par 7) optional from recipe
    61         psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
     86        // psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
     87        psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 0.2);
    6288        if (!psf) {
    6389            psError(PSPHOT_ERR_PSF, false, "Unable to build dummy PSF.");
Note: See TracChangeset for help on using the changeset viewer.