IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11201


Ignore:
Timestamp:
Jan 19, 2007, 3:47:27 PM (19 years ago)
Author:
eugene
Message:

defined features to read in externally-supplied source coordinates

Location:
trunk/psphot/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphot.h

    r11187 r11201  
    9898bool psphotFitSummary ();
    9999bool psphotMergeSources (psArray *oldSources, psArray *newSources);
     100
     101bool psphotSaveExtSources (pmReadout *readout);
     102bool psphotLoadExtSources (pmReadout *readout, psArray *sources);
  • trunk/psphot/src/psphotArguments.c

    r11190 r11201  
    103103    pmConfigFileSetsMD (config->arguments, config, "WEIGHT", "-weight", "-weightlist");
    104104    pmConfigFileSetsMD (config->arguments, config, "PSF",    "-psf", "-psflist");
     105    pmConfigFileSetsMD (config->arguments, config, "SRC",    "-src", "-srclist");
    105106
    106107    // the input file is a required argument; if not found, we will exit
  • trunk/psphot/src/psphotMergeSources.c

    r11183 r11201  
    1010    return true;
    1111}
     12
     13// XXX this is something of a hack: external sources are loaded with the same functions used to
     14// read and write the sources.  These use the readout->analysis entry PSPHOT.SOURCES.  at the
     15// beginning of psphotReadout, we need to rename any such entry for later use by
     16// psphotLoadExtSources below
     17
     18bool psphotSaveExtSources (pmReadout *readout) {
     19
     20    psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
     21    if (!sources) return true;
     22
     23    psLogMsg ("psphot", 3, "%ld external sources loaded, saved for later use", sources->n);
     24    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.EXTSRC", PS_DATA_ARRAY, "external sources", sources);
     25
     26    psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES");
     27
     28    return true;
     29}
     30
     31// merge the externally supplied sources with the existing sources.  mark them as having
     32// mode PM_SOURCE_MODE_EXTERNAL
     33bool psphotLoadExtSources (pmReadout *readout, psArray *sources) {
     34
     35    psArray *extSources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.EXTSRC");
     36    if (!extSources) return true;
     37
     38    for (int i = 0; i < extSources->n; i++) {
     39        pmSource *source = extSources->data[i];
     40        source->mode |= PM_SOURCE_MODE_EXTERNAL;
     41        pmModel *model = source->modelPSF;
     42
     43        float xpos = model->params->data.F32[PM_PAR_XPOS];
     44        float ypos = model->params->data.F32[PM_PAR_YPOS];
     45
     46        source->peak = pmPeakAlloc(xpos, ypos, 1.0, PM_PEAK_LONE);
     47        source->peak->xf = xpos;
     48        source->peak->yf = ypos;
     49        source->peak->flux = 1.0;
     50       
     51        // drop the loaded source modelPSF
     52        psFree (source->modelPSF);
     53        source->modelPSF = NULL;
     54    }
     55
     56    psphotMergeSources (sources, extSources);
     57    psLogMsg ("psphot", 3, "%ld external sources merged to yield %ld total sources", extSources->n, sources->n);
     58
     59    return true;
     60}
  • trunk/psphot/src/psphotParseCamera.c

    r11190 r11201  
    2020    pmFPAfileBindFromArgs (NULL, input, config, "INPUT.MASK", "MASK");
    2121    pmFPAfileBindFromArgs (NULL, input, config, "INPUT.WEIGHT", "WEIGHT");
    22    
    23     // optionally load the PSF Model
    24     pmFPAfile *psfInput = pmFPAfileBindFromArgs (NULL, input, config, "INPUT.PSF", "PSF");
    25     if (psfInput == NULL) {
     22
     23    // optionally load the PSF Model and/or fixed stars
     24    pmFPAfileBindFromArgs (NULL, input, config, "INPUT.PSF", "PSF");
     25    pmFPAfile *srcInput = pmFPAfileBindFromArgs (NULL, input, config, "INPUT.SRC", "SRC");
     26    if (!srcInput) {
    2627        fprintf (stderr, "!");
    2728    }
  • trunk/psphot/src/psphotReadout.c

    r11188 r11201  
    88    // find the currently selected readout
    99    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT");
     10    psphotSaveExtSources (readout);
    1011
    1112    // optional break-point for processing
     
    7980    }
    8081
    81     // construct an initial PSF model for each object
     82    // include externally-supplied sources
     83    psphotLoadExtSources (readout, sources);
     84
     85    // construct an initial model for each object
    8286    psphotGuessModels (readout, sources, recipe, psf);
    8387
Note: See TracChangeset for help on using the changeset viewer.