Changeset 14813
- Timestamp:
- Sep 11, 2007, 10:37:55 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimLoadStars.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimLoadStars.c
r14667 r14813 14 14 psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE); 15 15 if (!astroRecipe) { 16 psError(PSASTRO_ERR_CONFIG, false, "Can't find recipe %s", PSASTRO_RECIPE);17 return NULL;16 psError(PSASTRO_ERR_CONFIG, false, "Can't find recipe %s", PSASTRO_RECIPE); 17 return NULL; 18 18 } 19 19 … … 25 25 float scale = psMetadataLookupF32(NULL, config->arguments, "SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel) 26 26 float expTime = psMetadataLookupF32(NULL, config->arguments, "EXPTIME"); // Exposure time 27 27 28 28 // Size of FPA 29 29 psRegion *bounds = ppSimFPABounds (fpa); … … 40 40 psArray *refStars = psastroLoadRefstars(config); 41 41 if (!refStars || refStars->n == 0) { 42 psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars.");43 psFree(refStars);44 return NULL;42 psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars."); 43 psFree(refStars); 44 return NULL; 45 45 } 46 46 psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld reference stars", refStars->n); … … 51 51 // Conversion loop 52 52 for (long i = 0; i < refStars->n; i++) { 53 ppSimStar *star = ppSimStarAlloc ();53 ppSimStar *star = ppSimStarAlloc (); 54 54 55 pmAstromObj *ref = refStars->data[i]; // Reference star56 star->ra = ref->sky->r; // RA of star57 star->dec = ref->sky->d; // Dec of star58 star->mag = ref->Mag; // Magnitude of star55 pmAstromObj *ref = refStars->data[i]; // Reference star 56 star->ra = ref->sky->r; // RA of star 57 star->dec = ref->sky->d; // Dec of star 58 star->mag = ref->Mag; // Magnitude of star 59 59 60 // Convert to x,y position on tangent plane, in pixels61 float div = (sin(star->ra) * sin(dec0) + cos(star->dec) * cos(dec0) * cos(star->ra - ra0)) * scale;62 float xi = cos(star->dec) * sin(star->ra - ra0) / div;63 float eta = (sin(star->dec) * cos(dec0) - cos(star->dec) * sin(dec0) * cos(star->ra - ra0)) / div;60 // Convert to x,y position on tangent plane, in pixels 61 float div = (sin(star->ra) * sin(dec0) + cos(star->dec) * cos(dec0) * cos(star->ra - ra0)) * scale; 62 float xi = cos(star->dec) * sin(star->ra - ra0) / div; 63 float eta = (sin(star->dec) * cos(dec0) - cos(star->dec) * sin(dec0) * cos(star->ra - ra0)) / div; 64 64 65 // Apply rotation, make FPA center of boresite66 star->x = cos(pa) * xi - sin(pa) * eta + x0fpa;67 star->y = sin(pa) * xi + cos(pa) * eta + y0fpa;65 // Apply rotation, make FPA center of boresite 66 star->x = cos(pa) * xi - sin(pa) * eta + x0fpa; 67 star->y = sin(pa) * xi + cos(pa) * eta + y0fpa; 68 68 69 // Convert magnitude to peak flux 70 star->flux = powf(10.0, -0.4 * (star->mag - zp)) * expTime; 71 star->peak = star->flux / sqrt(2.0*M_PI) / seeing; 72 stars->data[oldSize + i] = star; 69 // Convert magnitude to peak flux 70 star->flux = powf(10.0, -0.4 * (star->mag - zp)) * expTime; 71 star->peak = star->flux / (2.0*M_PI * PS_SQR(seeing)); 72 stars->data[oldSize + i] = star; 73 74 psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", star->x, star->y, star->flux); 73 75 } 76 stars->n = oldSize + refStars->n; 74 77 psFree(refStars); 75 78
Note:
See TracChangeset
for help on using the changeset viewer.
