Changeset 17930
- Timestamp:
- Jun 5, 2008, 1:37:24 AM (18 years ago)
- Location:
- branches/eam_branch_20080511/ppSim/src
- Files:
-
- 4 edited
-
ppSimLoadForceSources.c (modified) (1 diff)
-
ppSimLoadSpots.c (modified) (3 diffs)
-
ppSimLoadStars.c (modified) (1 diff)
-
ppSimLoop.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080511/ppSim/src/ppSimLoadForceSources.c
r17901 r17930 12 12 pmFPAfileActivate (config->files, true, "PSASTRO.OUT.REFSTARS"); 13 13 14 // this loop selects the matched stars for all chips 15 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) { 16 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 17 if (!chip->process || !chip->file_exists) { continue; } 18 if (!chip->fromFPA) { continue; } 19 20 while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) { 21 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 22 if (!cell->process || !cell->file_exists) { continue; } 23 24 // process each of the readouts 25 // XXX there can only be one readout per chip in astrometry, right? 26 while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) { 27 if (! readout->data_exists) { continue; } 14 readout = pmFPAviewThisReadout (view, fpa); 15 if (! readout->data_exists) { continue; } 28 16 29 17 // read WCS data from the corresponding header -
branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
r17707 r17930 1 1 # include "ppSim.h" 2 2 3 bool ppSimLoadSpots (pmFPA *fpa, pmConfig *config) { 3 // need to specify an alternative CATDIR for the force positions 4 bool ppSimLoadSpots (psArray *spots, pmFPA *fpa, pmConfig *config) { 4 5 5 # if (0) 6 bool status; 6 7 7 bool mdok; 8 assert (stars); 8 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 9 9 10 psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSIM_RECIPE); // Recipe 11 12 bool forcedPhot = psMetadataLookupBool(&mdok, recipe, "FORCED.PHOT"); // Density of fakes 10 bool forcedPhot = psMetadataLookupBool(&status, recipe, "FORCED.PHOT"); // Density of fakes 13 11 if (!forcedPhot) return true; 14 12 15 // Read catalogue stars using psastro 16 // XXX probably need to modify this... 13 // We read the catalogue stars using psastroLoadRefstars 17 14 psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE); 18 15 if (!astroRecipe) { … … 20 17 return NULL; 21 18 } 19 20 float ra0 = psMetadataLookupF32(NULL, recipe, "RA"); // Boresight RA (radians) 21 float dec0 = psMetadataLookupF32(NULL, recipe, "DEC"); // Boresight Dec (radians) 22 float scale = psMetadataLookupF32(NULL, recipe, "PIXEL.SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel) 22 23 23 24 // Size of FPA … … 44 45 // convert the pmAstromObj sources to the storage format used by the CMF files 45 46 46 long oldSize = s tars->n;47 s tars = psArrayRealloc (stars,refStars->n);47 long oldSize = spots->n; 48 spots = psArrayRealloc (spots, oldSize + refStars->n); 48 49 49 50 // Conversion loop 50 51 for (long i = 0; i < refStars->n; i++) { 51 ppSimStar *s tar= ppSimStarAlloc ();52 ppSimStar *spot = ppSimStarAlloc (); 52 53 53 54 pmAstromObj *ref = refStars->data[i]; // Reference star 54 s tar->ra = ref->sky->r; // RA of star55 s tar->dec = ref->sky->d; // Dec of star56 s tar->mag = ref->Mag; // Magnitude of star55 spot->ra = ref->sky->r; // RA of star 56 spot->dec = ref->sky->d; // Dec of star 57 spot->mag = ref->Mag; // Magnitude of star 57 58 58 59 // Apply rotation, make FPA center of boresite 59 60 // convert the ra,dec to x,y using examples in psastro. 60 // s tar->x = cos(pa) * xi - sin(pa) * eta + x0fpa;61 // s tar->y = sin(pa) * xi + cos(pa) * eta + y0fpa;61 // spot->x = cos(pa) * xi - sin(pa) * eta + x0fpa; 62 // spot->y = sin(pa) * xi + cos(pa) * eta + y0fpa; 62 63 63 s tars->data[oldSize + i] = star;64 spots->data[oldSize + i] = star; 64 65 65 psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", s tar->x, star->y, star->flux);66 psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", spot->x, spot->y, ref->Mag); 66 67 } 67 68 # endif69 68 70 69 // XXX these need to be saved on PSPHOT.INPUT.CMF -
branches/eam_branch_20080511/ppSim/src/ppSimLoadStars.c
r17672 r17930 18 18 } 19 19 20 // XXX push these into the recipe in ppSimArguments()20 // relevant metadata 21 21 float zp = psMetadataLookupF32(NULL, recipe, "ZEROPOINT"); // Photometric zero point 22 22 float ra0 = psMetadataLookupF32(NULL, recipe, "RA"); // Boresight RA (radians) -
branches/eam_branch_20080511/ppSim/src/ppSimLoop.c
r17901 r17930 27 27 int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y 28 28 29 psArray *spots = psArrayAllocEmpty (1); 29 30 psArray *stars = psArrayAllocEmpty (1); 30 31 psArray *galaxies = psArrayAllocEmpty (1); 31 32 if (type == PPSIM_TYPE_OBJECT) { 32 33 // Load forced-photometry positions 33 if (!ppSimLoadSpots ( fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");34 if (!ppSimLoadSpots (spots, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots"); 34 35 35 36 // Load catalogue stars
Note:
See TracChangeset
for help on using the changeset viewer.
