Index: /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro
===================================================================
--- /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro	(revision 35654)
+++ /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro	(revision 35655)
@@ -170,4 +170,60 @@
 
   # plot (input - output) vs mag
+end
+
+macro ckgalaxy
+
+  data test.exp.dat
+  read Xin_all 1 Yin_all 2 Type 4 Min_all 5 RmajIn_all 7 RminIn_all 8 ThetaIn_all 9
+
+  subset Xin = Xin_all if (Type == 1)
+  subset Yin = Yin_all if (Type == 1)
+  subset Min = Min_all if (Type == 1)
+  subset Tin = ThetaIn_all if (Type == 1)
+
+  subset RmajIn = RmajIn_all if (Type == 1)
+  subset RminIn = RminIn_all if (Type == 1)
+
+  data test.exp.cmf 
+  read -fits Chip.xfit X_EXT Y_EXT EXT_INST_MAG EXT_WIDTH_MAJ EXT_WIDTH_MIN EXT_THETA
+  set EXT_THETA_ALT = EXT_THETA * (EXT_THETA >= 0.0) + (EXT_THETA + 3.14159265) * (EXT_THETA < 0.0)
+  set EXT_THETA = EXT_THETA_ALT
+  
+  match2d X_EXT Y_EXT Xin Yin 1.0 -index1 index1 -index2 index2
+
+  reindex Xot_m = X_EXT using index1
+  reindex Yot_m = Y_EXT using index1
+
+  reindex Xin_m = Xin using index2
+  reindex Yin_m = Yin using index2
+
+  set dX = Xin_m - Xot_m  
+  set dY = Yin_m - Yot_m  
+  lim -n 0 dX dY; clear; box; plot dX dY
+
+  reindex Mot_m = EXT_INST_MAG using index1
+  reindex Tot_m = EXT_THETA using index1
+
+  reindex Min_m = Min using index2
+  reindex Tin_m = Tin using index2
+
+  reindex Rot_m = EXT_WIDTH_MAJ using index1
+  reindex rot_m = EXT_WIDTH_MIN using index1
+
+  reindex Rin_m = RmajIn using index2
+  reindex rin_m = RminIn using index2
+
+  set n = ramp(Xin_m)
+
+  set dM = Min_m - Mot_m  
+  set dT = (Tin_m - Tot_m) * 180 / 3.14159265
+  lim -n 1 n dM; clear; box; plot n dM; label -y "delta mag"
+  lim -n 2 n dT; clear; box; plot n dT; label -y "delta theta (deg)"
+  lim -n 3 dT dM; clear; box; plot dT dM; label -x "delta theta (deg)" -y "delta mag"
+
+  set dR = Rin_m - Rot_m  
+  set dr = rin_m - rot_m
+  lim -n 4 n dR; clear; box; plot n dR; label -y "delta Rmaj"
+  lim -n 5 n dr; clear; box; plot n dr; label -y "delta Rmin"
 end
 
