Changeset 19520 for trunk/psastro/src/psastroUseModel.c
- Timestamp:
- Sep 11, 2008, 3:11:48 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroUseModel.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroUseModel.c
r17040 r19520 1 1 # include "psastroInternal.h" 2 2 # define NONLIN_TOL 0.001 /* tolerance in pixels */ 3 # define DEBUG 0 3 4 4 5 // apply the generic astrometry model to this image. this assumes the WCS terms either do not … … 35 36 } 36 37 38 // XXX TEST: apply the input image RA & DEC to the astrometry model, save corners 39 if (0) { 40 // these externally supplied values are used to set the final transformation terms 41 double RA = psMetadataLookupF64 (&status, input->fpa->concepts, "FPA.RA"); 42 double DEC = psMetadataLookupF64 (&status, input->fpa->concepts, "FPA.DEC"); 43 // double POS = PM_RAD_DEG * psMetadataLookupF64 (&status, input->fpa->concepts, "FPA.POSANGLE"); 44 45 // get projection scale; center is supplied 46 // XXX should this be astrom or input?? 47 float Xs = psMetadataLookupF32(&status, astrom->fpa->concepts, "XSCALE") * PM_RAD_DEG; 48 float Ys = psMetadataLookupF32(&status, astrom->fpa->concepts, "YSCALE") * PM_RAD_DEG; 49 50 // allocate a new toSky projection using the reported position 51 psFree (astrom->fpa->toSky); 52 astrom->fpa->toSky = psProjectionAlloc (RA, DEC, Xs, Ys, PS_PROJ_DIS); 53 54 // local view 55 pmFPAview *myView = pmFPAviewAlloc (0); 56 57 // loop over all chips, replace input astrometry elements with those from astrom 58 pmChip *obsChip = NULL; 59 while ((obsChip = pmFPAviewNextChip (myView, input->fpa, 1)) != NULL) { 60 psTrace ("psastro", 4, "Chip %d: %x %x\n", myView->chip, obsChip->file_exists, obsChip->process); 61 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; } 62 63 // set the chip astrometry using the astrom file 64 pmChip *refChip = pmFPAviewThisChip (myView, astrom->fpa); 65 66 psFree (obsChip->toFPA); 67 psFree (obsChip->fromFPA); 68 69 // supply astrometry from model 70 obsChip->toFPA = psMemIncrRefCounter (refChip->toFPA); 71 obsChip->fromFPA = psMemIncrRefCounter (refChip->fromFPA); 72 73 // XXX if we want to write out the result, update the header here. this needs to be 74 // updated with the correct HDU selection. obsChip->hdu may not exist. 75 // pmAstromWriteBilevelChip (obsChip->hdu->header, obsChip, NONLIN_TOL); 76 } 77 78 psFree (input->fpa->toSky); 79 psFree (input->fpa->toTPA); 80 psFree (input->fpa->fromTPA); 81 input->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky); 82 input->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA); 83 input->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA); 84 85 // XXX this is temporarily hardwired because of model error 86 input->fpa->toSky->type = PS_PROJ_TAN; 87 88 if (DEBUG) psastroDumpCorners ("corners.up.ast1.dat", "corners.dn.ast1.dat", input->fpa); 89 } 90 37 91 // set the model using the RA, DEC, POSANGLE of the input image. 38 92 pmAstromModelSetTP (astrom, input->fpa->concepts); 93 94 if (DEBUG) psastroDumpCorners ("corners.up.ast2.dat", "corners.dn.ast2.dat", astrom->fpa); 39 95 40 96 // loop over all chips, replace input astrometry elements with those from astrom … … 57 113 // updated with the correct HDU selection. obsChip->hdu may not exist. 58 114 // pmAstromWriteBilevelChip (obsChip->hdu->header, obsChip, NONLIN_TOL); 59 60 61 62 115 } 63 116 … … 72 125 input->fpa->toSky->type = PS_PROJ_TAN; 73 126 74 // psastroDumpCorners ("corners.useModel.dat", input->fpa);127 if (DEBUG) psastroDumpCorners ("corners.up.inp.dat", "corners.dn.inp.dat", input->fpa); 75 128 76 129 // updated with the correct HDU selection. obsChip->hdu may not exist.
Note:
See TracChangeset
for help on using the changeset viewer.
