Changeset 19506
- Timestamp:
- Sep 11, 2008, 3:04:49 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmAstrometryModel.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryModel.c
r18601 r19506 9 9 * 10 10 * @author EAM, IfA 11 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2008-0 7-17 22:38:15$11 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2008-09-12 01:04:49 $ 13 13 * 14 14 * Copyright 2007 Institute for Astronomy, University of Hawaii … … 250 250 bool pmAstromModelWriteFP (pmFPAfile *file) { 251 251 252 bool status;253 254 252 psMetadata *header = psMetadataAlloc(); 255 253 psMetadataAddStr(header, PS_LIST_TAIL, "COORD", PS_META_REPLACE, "name of this layer", "FOCAL_PLANE"); … … 260 258 psArray *model = psArrayAllocEmpty (1); 261 259 262 // XXX is this or the tpa region correct? 263 psRegion *region = pmAstromFPAExtent (file->fpa); 264 265 // rotate the toTPA to have 0.0 posangle 266 float posangle = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.POSANGLE"); 267 268 // the to/from TPA transform currently has rotation of posangle; remove it & create the toTPA version 269 psPlaneTransform *fromTPA = psPlaneTransformRotate (NULL, file->fpa->fromTPA, -posangle); 270 psPlaneTransform *toTPA = psPlaneTransformInvert(NULL, fromTPA, *region, 50); 260 // region over which the fromTPA projection is valid 261 psRegion *region = pmAstromFPInTP (file->fpa); 262 263 psPlaneTransform *toTPA = file->fpa->toTPA; 271 264 272 265 for (int i = 0; i <= toTPA->x->nX; i++) { … … 315 308 bool status; 316 309 317 // get the boresite model parameters 310 // get the boresite model parameters. these track the position of the boresite 311 // as a function of the rotator angle 318 312 float Xo = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.BORE.X0"); 319 313 float Yo = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.BORE.Y0"); … … 322 316 float To = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.BORE.T0"); 323 317 float Po = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.BORE.P0"); 318 319 // the PosZero is the offset between the reported and actual POSANGLE values 324 320 float PosZero = psMetadataLookupF32 (&status, file->fpa->concepts, "FPA.POS_ZERO"); /// XXX be consistent with degrees v radians 325 321 char *refChip = psMetadataLookupStr (&status, file->fpa->concepts, "FPA.REF.CHIP"); … … 341 337 psMetadataAddF32(row, PS_LIST_TAIL, "MINY", PS_META_REPLACE, "range", region->y0); 342 338 psMetadataAddF32(row, PS_LIST_TAIL, "MAXY", PS_META_REPLACE, "range", region->y1); 343 344 // psMetadataAddF32(row, PS_LIST_TAIL, "XREF", PS_META_REPLACE, "", file->fpa->toSky->R * PS_DEG_RAD);345 // psMetadataAddF32(row, PS_LIST_TAIL, "YREF", PS_META_REPLACE, "", file->fpa->toSky->D * PS_DEG_RAD);346 339 347 340 psMetadataAddF32(row, PS_LIST_TAIL, "XSCALE", PS_META_REPLACE, "", file->fpa->toSky->Xs * PS_DEG_RAD); … … 353 346 psMetadataAddF32(row, PS_LIST_TAIL, "BORE_T0", PS_META_REPLACE, "boresite parameter", To); 354 347 psMetadataAddF32(row, PS_LIST_TAIL, "BORE_P0", PS_META_REPLACE, "boresite parameter", Po); 355 psMetadataAddF32(row, PS_LIST_TAIL, "POS_ZERO", PS_META_REPLACE, "boresite parameter", PosZero); 356 psMetadataAddStr(row, PS_LIST_TAIL, "REF_CHIP", PS_META_REPLACE, "boresite parameter", refChip); 348 349 psMetadataAddF32(row, PS_LIST_TAIL, "POS_ZERO", PS_META_REPLACE, "POSANGLE offset (degrees)", PosZero); 350 psMetadataAddStr(row, PS_LIST_TAIL, "REF_CHIP", PS_META_REPLACE, "reference chip for model", refChip); 357 351 358 352 psArrayAdd (model, 100, row); … … 454 448 bool pmAstromModelReadPHU (pmFPAfile *file) { 455 449 456 fprintf (stderr, "not sure we need to read PHU\n");450 // not necessary to read the PHU 457 451 return true; 458 452 } … … 500 494 } 501 495 502 // XXX do I need anything from the header?496 // load the header 503 497 psMetadata *header = psFitsReadHeader(NULL, file->fits); // The FITS header 504 498 if (!header) psAbort("cannot read model header"); … … 507 501 psArray *model = psFitsReadTable (file->fits); 508 502 if (!model) psAbort("cannot read model"); 509 fprintf (stderr, "read %ld rows from FP\n", model->n);503 psLogMsg ("psModules.astrom", 4, "read %ld rows from FP\n", model->n); 510 504 511 505 // parse the model entries … … 535 529 int iy = psMetadataLookupS32(&status, row, "YORDER"); REQUIRE (status, "missing YORDER"); 536 530 537 // XXX do I need to use this or can i rely on the camera concepts?538 // minX = psMetadataLookupF32(&status, row, "MINX");539 // maxX = psMetadataLookupF32(&status, row, "MAXX");540 // minY = psMetadataLookupF32(&status, row, "MINY");541 // maxY = psMetadataLookupF32(&status, row, "MAXY");542 543 // XXX need to include mask values544 531 chip->toFPA->x->coeff[ix][iy] = psMetadataLookupF32(&status, row, "POLY_X"); 545 532 chip->toFPA->y->coeff[ix][iy] = psMetadataLookupF32(&status, row, "POLY_Y"); … … 584 571 // read the complete model data at one shot 585 572 psArray *model = psFitsReadTable (file->fits); 586 fprintf (stderr, "read %ld rows from FP\n", model->n);573 psLogMsg ("psModules.astrom", 4, "read %ld rows from FP\n", model->n); 587 574 588 575 // parse the model … … 644 631 645 632 psArray *model = psFitsReadTable (file->fits); 646 fprintf (stderr, "read %ld rows from TP\n", model->n);633 psLogMsg ("psModules.astrom", 4, "read %ld rows from TP\n", model->n); 647 634 if (model->n != 1) psAbort("invalid number of rows in TP model (%ld)", model->n); 648 635 … … 679 666 680 667 psArray *model = psFitsReadTable (file->fits); 681 fprintf (stderr, "read %ld rows from SKY\n", model->n);668 psLogMsg ("psModules.astrom", 4, "read %ld rows from SKY\n", model->n); 682 669 if (model->n != 1) psAbort("invalid number of rows in SKY model (%ld)", model->n); 683 670 684 671 // XXX not much information of interest in this table... 672 673 // generate a template projection for comparisons 674 psFree (file->fpa->toSky); 675 file->fpa->toSky = psProjectionAlloc (0.0, 0.0, PS_RAD_DEG/3600.0, PS_RAD_DEG/3600.0, PS_PROJ_DIS); 685 676 686 677 psFree (model); … … 698 689 double DEC = psMetadataLookupF64 (&status, concepts, "FPA.DEC"); REQUIRE (status, "missing FPA.DEC"); 699 690 double POS = PM_RAD_DEG * psMetadataLookupF64 (&status, concepts, "FPA.POSANGLE"); REQUIRE (status, "missing FPA.POSANGLE"); 700 // double ROT = psMetadataLookupF64 (&status, concepts, "FPA.ROTANGLE"); REQUIRE (status, "missing FPA.ROTANGLE");701 691 702 692 // get projection scale; center is supplied … … 721 711 722 712 // apply true posangle = -(POS - POS_ZERO) 713 psLogMsg ("psModules.astrom", 4, "Position Angle: %f, Model Position Angle Zero Point: %f\n", POS, PosZero); 723 714 psPlaneTransform *fromTPA = psPlaneTransformRotate (NULL, file->fpa->fromTPA, (POS - PosZero)); 724 715 psFree (file->fpa->fromTPA); … … 728 719 psFree (file->fpa->toTPA); 729 720 file->fpa->toTPA = psPlaneTransformInvert(NULL, file->fpa->fromTPA, *region, 50); 721 psFree (region); 730 722 731 723 // current position of the nominal boresite in refChip coordinates 732 724 double X = Xo + RX*cos(POS - To)*cos(Po) + RY*sin(POS - To)*sin(Po); 733 725 double Y = Yo + RY*sin(POS - To)*cos(Po) - RX*cos(POS - To)*sin(Po); 726 psLogMsg ("psModules.astrom", 4, "Boresite coords on reference chip: %f, %f\n", X, Y); 734 727 735 728 // get reference chip from name … … 742 735 psSphere *boreSky = psSphereAlloc(); 743 736 744 // find the true RA,DEC coord of the mirror of the reported boresite745 boreCH->x = -X;746 boreCH->y = -Y;737 // find the FP coord of the reported boresite location 738 boreCH->x = X; 739 boreCH->y = Y; 747 740 psPlaneTransformApply (boreFP, chip->toFPA, boreCH); 741 742 // find the true RA,DEC coord of the mirror of the reported boresite FP location 743 boreFP->x = -boreFP->x; 744 boreFP->y = -boreFP->y; 748 745 psPlaneTransformApply (boreTP, file->fpa->toTPA, boreFP); 749 746 psDeproject (boreSky, boreTP, file->fpa->toSky); … … 761 758 psFree (boreSky); 762 759 763 psFree (region);764 760 return (true); 765 761 }
Note:
See TracChangeset
for help on using the changeset viewer.
