IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 6, 2017, 11:30:10 AM (9 years ago)
Author:
eugene
Message:

merging changes from czw dev branch (compare with r39924)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psastro/src/psastroConvert.c

    r38040 r39926  
    5151    bool status;
    5252
     53    // XXX I want to make this optional
     54    float MagOffset = 0.0;
     55    if (1) {
     56      // select the input data sources
     57      pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     58      if (!input) {
     59        psError(PSASTRO_ERR_CONFIG, true, "failed to find PSASTRO.INPUT\n");
     60        return false;
     61      }
     62      pmFPA *fpa = input->fpa;
     63
     64      float zeropt, exptime;
     65
     66      // really error-out here?  or just skip?
     67      if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     68        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
     69        zeropt = 0.0;
     70        exptime = 1.0;
     71      }
     72
     73      // recipe values are given in instrumental magnitudes
     74      // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
     75      MagOffset = zeropt + 2.5*log10(exptime);
     76    }
     77
    5378    // PSPHOT.SOURCES carries the pmSource objects (from psphot analysis or loaded externally)
    5479    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     
    5984
    6085    // convert the pmSource objects into pmAstromObj objects (drop !STAR and SATSTAR?)
    61     psArray *inStars = pmSourceToAstromObj (sources);
     86    psArray *inStars = pmSourceToAstromObj (sources, MagOffset);
    6287
    6388    // apply Koppenhoefer correction if needed
     
    175200
    176201// select a magnitude range?
    177 psArray *pmSourceToAstromObj (psArray *sources) {
     202psArray *pmSourceToAstromObj (psArray *sources, float MagOffset) {
    178203
    179204    psArray *objects = psArrayAllocEmpty (sources->n);
     
    211236        obj->dMag = source->psfMagErr;
    212237        obj->SBinst = source->psfMag + 5.0*log10(axes.major);
     238        obj->magCal = obj->Mag + MagOffset;
    213239
    214240        // XXX do we have the information giving the readout and cell offset?
Note: See TracChangeset for help on using the changeset viewer.