Index: trunk/psastro/src/psastroBuildFPA.c
===================================================================
--- trunk/psastro/src/psastroBuildFPA.c	(revision 5575)
+++ trunk/psastro/src/psastroBuildFPA.c	(revision 6176)
@@ -68,159 +68,2 @@
     return (fpa);
 }
-
-// interpret header WCS (only handles traditional WCS for the moment)
-bool pmAstromReadWCS (psPlaneTransform **toFPAOut, psProjection **toSkyOut, psMetadata *header) { 
-
-    psPlaneTransform *toFPA;
-    psProjection *toSky;
-    psProjectionType type;
-    bool status;
-    float crval1, crval2, crpix1, crpix2, cdelt1, cdelt2;
-    float pc1_1, pc1_2, pc2_1, pc2_2;
-
-    // *** interpret header data, convert to crval(i), etc
-    char *ctype = psMetadataLookupPtr (&status, header, "CTYPE2");
-    if (!status) {
-	psLogMsg ("psastro", 2, "warning: no WCS metadata in header\n");
-	return false;
-    }
-
-    // determine projection type
-    type = PS_PROJ_NTYPE;
-    if (!strcmp (&ctype[4], "-SIN")) type = PS_PROJ_SIN;
-    if (!strcmp (&ctype[4], "-TAN")) type = PS_PROJ_TAN;
-    if (!strcmp (&ctype[4], "-AIT")) type = PS_PROJ_AIT;
-    if (!strcmp (&ctype[4], "-PAR")) type = PS_PROJ_PAR;
-    if (type == PS_PROJ_NTYPE) {
-	psLogMsg ("psastro", 2, "warning: unknown projection type %s\n", ctype);
-	return false;
-    }
-
-    crval1 = psMetadataLookupF32 (&status, header, "CRVAL1");
-    crval2 = psMetadataLookupF32 (&status, header, "CRVAL2");
-    crpix1 = psMetadataLookupF32 (&status, header, "CRPIX1");
-    crpix2 = psMetadataLookupF32 (&status, header, "CRPIX2");
-    
-    // test the CDELTi varient
-    cdelt1 = psMetadataLookupF32 (&status, header, "CDELT1");
-    if (status) {
-	cdelt2 = psMetadataLookupF32 (&status, header, "CDELT2");
-
-	// test the CROTAi varient:
-	double rotate = psMetadataLookupF32 (&status, header, "CROTA2");
-	if (status) {
-	    double Lambda = cdelt2 / cdelt1;
-	    pc1_1 =  cos(rotate*RAD_DEG);
-	    pc1_2 = -sin(rotate*RAD_DEG) * Lambda;
-	    pc2_1 =  sin(rotate*RAD_DEG) / Lambda;
-	    pc2_2 =  cos(rotate*RAD_DEG);
-	    goto got_matrix;
-	}
-
-	// test the PC00i00j varient:
-	pc1_1 = psMetadataLookupF32 (&status, header, "PC001001");
-	if (status) {
-	    pc1_2 = psMetadataLookupF32 (&status, header, "PC001002");
-	    pc2_1 = psMetadataLookupF32 (&status, header, "PC002001");
-	    pc2_2 = psMetadataLookupF32 (&status, header, "PC002002");
-
-	    // XXX EAM : add Elixir polynomial terms here eventually
-	    goto got_matrix;
-	}
-	psLogMsg ("psastro", 2, "warning: missing rotation matrix?\n");
-	return false;
-    }
-
-    // test the CDi_j varient
-    pc1_1 = psMetadataLookupF32 (&status, header, "CD1_1");
-    if (status) {
-	pc1_2 = psMetadataLookupF32 (&status, header, "CD1_2");
-	pc2_1 = psMetadataLookupF32 (&status, header, "CD2_1");
-	pc2_2 = psMetadataLookupF32 (&status, header, "CD2_2");
-	
-	// renormalize to cdelt1, cdelt2, etc
-	float scale = hypot (pc1_1, pc1_2);
-	cdelt1 = cdelt2 = scale;
-	pc1_1 /= scale;
-	pc1_2 /= scale;
-	pc2_1 /= scale;
-	pc2_2 /= scale;
-	goto got_matrix;
-    }
-    psLogMsg ("psastro", 2, "warning: missing rotation matrix?\n");
-    return false;
-
-got_matrix:
-
-    // XXX EAM : if fpa->toSky and fpa->toTPA are already defined, then the
-    //           toFPA must be modified to match the crval(i), scale(i) and crpix(i)
-    //           scale = scale(i)/scale(0) (i == chip #)
-    //           project crval1(0),crval2(0 using projection
-
-    // XXX EAM : psPlaneTransformAlloc uses nTerm not nOrder (bug 581)
-    // XXX EAM : I've fixed this in pslib eam_rel8_b2
-    toFPA = psPlaneTransformAlloc (1, 1);
-    
-    toFPA->x->coeff[0][0] = crpix1;
-    toFPA->x->coeff[1][0] = pc1_1;
-    toFPA->x->coeff[0][1] = pc1_2;
-    toFPA->x->mask[1][1]  = 1;
-
-    toFPA->y->coeff[0][0] = crpix2;
-    toFPA->y->coeff[1][0] = pc2_1;
-    toFPA->y->coeff[0][1] = pc2_2;
-    toFPA->y->mask[1][1]  = 1;
-
-    // center of projection is (0,0) coordinate of TPA
-    toSky = psProjectionAlloc (crval1*RAD_DEG, crval2*RAD_DEG, cdelt1*RAD_DEG, cdelt2*RAD_DEG, type);
-
-    *toFPAOut = toFPA;
-    *toSkyOut = toSky;
-
-    return true;
-}
-
-
-// convert toFPA / toSky components to traditional WCS
-bool pmAstromWriteWCS (psPlaneTransform *toFPA, psProjection *toSky, psMetadata *header) { 
-
-    switch (toSky->type) {
-      case PS_PROJ_SIN:
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE1", PS_DATA_STRING | PS_META_REPLACE, "", "RA---SIN");
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE2", PS_DATA_STRING | PS_META_REPLACE, "", "DEC--SIN");
-	break;
-      case PS_PROJ_TAN:
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE1", PS_DATA_STRING | PS_META_REPLACE, "", "RA---TAN");
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE2", PS_DATA_STRING | PS_META_REPLACE, "", "DEC--TAN");
-	break;
-      case PS_PROJ_AIT:
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE1", PS_DATA_STRING | PS_META_REPLACE, "", "RA---AIT");
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE2", PS_DATA_STRING | PS_META_REPLACE, "", "DEC--AIT");
-	break;
-      case PS_PROJ_PAR:
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE1", PS_DATA_STRING | PS_META_REPLACE, "", "RA---PAR");
-	psMetadataAdd (header, PS_LIST_TAIL, "CTYPE2", PS_DATA_STRING | PS_META_REPLACE, "", "DEC--PAR");
-	break;
-      default:
-	psLogMsg ("psastro", 2, "warning: unknown projection type %s\n", toSky->type);
-	return false;
-    }
-
-    psMetadataAdd (header, PS_LIST_TAIL, "CRVAL1", PS_DATA_F32 | PS_META_REPLACE, "", toSky->R*DEG_RAD);
-    psMetadataAdd (header, PS_LIST_TAIL, "CRVAL2", PS_DATA_F32 | PS_META_REPLACE, "", toSky->D*DEG_RAD);
-    psMetadataAdd (header, PS_LIST_TAIL, "CRPIX1", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->x->coeff[0][0]);
-    psMetadataAdd (header, PS_LIST_TAIL, "CRPIX2", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->y->coeff[0][0]);
-    psMetadataAdd (header, PS_LIST_TAIL, "CDELT1", PS_DATA_F32 | PS_META_REPLACE, "", toSky->Xs*DEG_RAD);
-    psMetadataAdd (header, PS_LIST_TAIL, "CDELT2", PS_DATA_F32 | PS_META_REPLACE, "", toSky->Ys*DEG_RAD);
-
-    psMetadataAdd (header, PS_LIST_TAIL, "PC001001", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->x->coeff[1][0]);
-    psMetadataAdd (header, PS_LIST_TAIL, "PC001002", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->x->coeff[0][1]);
-    psMetadataAdd (header, PS_LIST_TAIL, "PC002001", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->y->coeff[1][0]);
-    psMetadataAdd (header, PS_LIST_TAIL, "PC002002", PS_DATA_F32 | PS_META_REPLACE, "", toFPA->y->coeff[0][1]);
-
-    // alternative representations use
-    // CD1_1 = PC001001*CDELT1, etc
-    // make these representations optional
-
-    return true;
-}
