IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2014, 6:38:38 AM (12 years ago)
Author:
eugene
Message:

add pswarp backwards transformations so we can map warp pixels to chip pixels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpUpdateMetadata.c

    r35563 r36835  
    7878                psFree(md5string);
    7979                psFree(headerName);
     80
     81                bool status;
     82                psString keyword = NULL;
     83                psString mapstring = NULL;
     84
     85                // we (should) have an array of chipnames on the analysis
     86                psArray *chipnames = psMetadataLookupPtr(&status, readout->analysis, PSWARP_ANALYSIS_CHIPNAMES);
     87                for (int i = 0; chipnames && (i < chipnames->n); i++) {
     88                  psStringAppend (&keyword, "SRC_%04d", i);
     89                  psMetadataAddStr(hdu->header, PS_LIST_TAIL, keyword, PS_META_REPLACE, "input image", chipnames->data[i]);
     90                  psFree (keyword);
     91                }
     92
     93                // we (should) have an array of chipnames on the analysis
     94                psArray *chipRegions = psMetadataLookupPtr(&status, readout->analysis, PSWARP_ANALYSIS_CHIPREGIONS);
     95                for (int i = 0; chipRegions && (i < chipRegions->n); i++) {
     96                  psStringAppend (&keyword, "SEC_%04d", i);
     97                  psMetadataAddStr(hdu->header, PS_LIST_TAIL, keyword, PS_META_REPLACE, "input image", chipRegions->data[i]);
     98                  psFree (keyword);
     99                }
     100
     101                // we (should) also have an array of backwards maps (warp->chip) for the above chips
     102                psArray *backmaps  = psMetadataLookupPtr(&status, readout->analysis, PSWARP_ANALYSIS_BACKMAPS); //
     103                for (int i = 0; backmaps && (i < backmaps->n); i++) {
     104                  psPlaneTransform *map = backmaps->data[i];             
     105                  psStringAppend (&keyword, "MPX_%04d", i);
     106                  psStringAppend (&mapstring, "[%8.2f,%8.4f,%8.4f]", map->x->coeff[0][0], map->x->coeff[1][0], map->x->coeff[0][1]);
     107                  psMetadataAddStr(hdu->header, PS_LIST_TAIL, keyword, PS_META_REPLACE, "warp to image map", mapstring);
     108                  psFree (keyword);
     109                  psFree (mapstring);
     110                  psStringAppend (&keyword, "MPY_%04d", i);
     111                  psStringAppend (&mapstring, "[%8.2f,%8.4f,%8.4f]", map->y->coeff[0][0], map->y->coeff[1][0], map->y->coeff[0][1]);
     112                  psMetadataAddStr(hdu->header, PS_LIST_TAIL, keyword, PS_META_REPLACE, "warp to image map", mapstring);
     113                  psFree (keyword);
     114                  psFree (mapstring);
     115                }
    80116            }
    81117
Note: See TracChangeset for help on using the changeset viewer.