IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 27, 2019, 12:05:20 PM (6 years ago)
Author:
eugene
Message:

merge fixes from EAM dev branch ipp-20191011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimMakeStars.c

    r25760 r41173  
    2727    float zp           = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); // Photometric zero point
    2828    float seeing       = psMetadataLookupF32(&status, recipe, "SEEING"); // Seeing SIGMA (pixels)
    29     float scale        = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel)
     29    float scale        = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); // Plate scale (arcsec/pixel)
     30    // there has been some confusion over pixel scale: PIXEL.SCALE is supplied in arcsec / pixel.
     31    // In some other places (ppSimLoadStars.c, ppSimUtils.c) it is needed in radius for WCS conversion.
     32    // in the past, it was converted to radians on load (but applied inconsisently elsewhere)
     33    // Now the radian version is carried as scaleRad to be more explicit
    3034
    3135    if (isnan(darkRate)) darkRate = 0.0;
     
    4246        float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
    4347        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
     48        // skyMags is in mags / square arcsec, so scale must be in arcsec / pixel
    4449    }
    4550
     
    6166        if (!status) {
    6267            refMag = brightMag;
    63             refSum = starsDensity * xSize * ySize * PS_SQR(scale * 180.0 / M_PI);
     68            refSum = starsDensity * xSize * ySize * PS_SQR(scale / 3600.0);
    6469        }
    6570    } else {
    6671        refMag = brightMag;
    67         refSum = starsDensity * xSize * ySize * PS_SQR(scale * 180.0 / M_PI);
     72        refSum = starsDensity * xSize * ySize * PS_SQR(scale / 3600.0);
    6873    }
    6974    psTrace("ppSim", 6, "refMag: %f, refSum: %f\n", refMag, refSum);
     
    120125    psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld stars between %f and %f mag\n", nTotal, brightMag, faintMag);
    121126
     127    if (nTotal > 1e7) {
     128      psLogMsg("ppSim", PS_LOG_INFO, "Trying to add %d stars (far more than 10M stars!), giving up\n", (int) nTotal);
     129      exit (2);
     130    }
     131
    122132    long oldSize = stars->n;
    123133    psArrayRealloc (stars, stars->n + nTotal);
Note: See TracChangeset for help on using the changeset viewer.