Index: /trunk/Ohana/src/relastro/test/dvo.photcodes
===================================================================
--- /trunk/Ohana/src/relastro/test/dvo.photcodes	(revision 39363)
+++ /trunk/Ohana/src/relastro/test/dvo.photcodes	(revision 39363)
@@ -0,0 +1,33 @@
+# this file contains the list of valid photometry codes.  there should
+# be one code for each combination of CCD, filter, and telescope (and
+# possibly additional ones if filter transmission reduces with time).
+# The code on each line is a unique number, while the name is a
+# representative name.  The type defines how the photometry is
+# treated.  There can only be one primary photcode.  There should only
+# be a few secondary photcodes: these are the calibrated values for
+# stars.  The dependent photcodes are those which are equivalent to a
+# primary or secondary photcode, and are equated after photometric
+# solutions.  Reference photcodes are for anything without a dynamic
+# solution: the reference values are provided externally.
+
+# NOTE: the photcodes defined below supplement CFHT Elixir values.
+# Do not use this photcode file with old CFHT DVO databases.
+
+# camera ranges used in this file:
+# megacam:  u: 100-139, g: 200-239, r: 300-339, i: 400-439, z: 500-539
+# cfh12k:   B: 140-152, V: 240-252, R: 340-352, I: 440-452, Z: 540-552, NB: 600-693
+# mosaic2:  B: 160-167, V: 260-267, VR: 360-367, R: 460-467, I: 560-567
+# PS1 ISP:  g: 3200,      r: 3300,      i: 3400,      z: 3500,      y: 3600
+# PS1 TC3:  g: 3280-3296, r: 3380-3396, i: 3480-3496, z: 3580-3596, y: 3680-3696, 
+# PS1 GPC1: g: 3201-3264, r: 3301-3364, i: 3401-3464, z: 3501-3564, y: 3601-3664, w: 3201-3464
+
+# NOTE 2012.03.30 EAM : I have added 'poor' and 'bad' bitsets for GPC1 data using psphot
+# I have also set the current best guess values for the GPC1 zero points
+
+# external references: 1000 - 2999
+
+#                                           airmass      color                         astrometry  mag    photom  astrom mask    photom mask
+# code  name                type    zero  slope offset c1    c2   slope   zero  equiv  sys scale   scale  sys     poor   bad     poor   bad
+  3     i                    sec   0.000  0.000 0.000     2     3 0.0000     0  1053   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
+
+  10233 GPC1.i.XY33          dep  24.611 -0.044 0.000     -     - 0.0000     0     3   0.000 1.000 0.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
Index: /trunk/Ohana/src/relastro/test/mana.sh
===================================================================
--- /trunk/Ohana/src/relastro/test/mana.sh	(revision 39363)
+++ /trunk/Ohana/src/relastro/test/mana.sh	(revision 39363)
@@ -0,0 +1,127 @@
+
+$TIMEFORMAT = mjd
+$TIMEREF = 2000/01/01,00:00:00
+ctimes -abs 2010/01/01,00:00:00 -var MJD_MIN
+ctimes -abs 2015/01/01,00:00:00 -var MJD_MAX
+ctimes -abs 2012/01/01,00:00:00 -var MJD_REF
+
+$Tref = 12.4148
+
+macro go
+  echo "--- pos : noutliers"
+  testsuite pos
+  testsuite pos-irls
+  testsuite pos-boot
+
+  echo "--- pos : noutliers"
+  testsuite pm
+  testsuite pm-irls
+  testsuite pm-boot
+
+  echo "--- pos : noutliers"
+  testsuite plx
+  testsuite plx-irls
+  testsuite plx-boot
+
+  echo "--- nboot"
+  testnboot pos-boot
+  testnboot pm-boot
+  testnboot plx-boot
+end
+
+macro testnboot
+  if ($0 != 2)
+    echo "USAGE: testnboot (mode)"
+    break
+  end
+
+  foreach nboot 20 30 100 300 1000
+    exec bin/fitpm.lin64 -Nstars 3000 -Noutliers 20 -Npoints 100 -Nbootstrap $nboot $1 > test.$1.dat
+    reload test.$1.dat
+
+    fprintf "%4d : %5.2f %5.2f %5.2f %5.2f %5.2f : %5.2f %5.2f %5.2f %5.2f %5.2f : %5.2f %5.2f %5.2f %5.2f %5.2f : %6.2f %5.2f" $nboot $value_dRf $value_dDf $value_duR $value_duD $value_dP $value_dRo $value_dDo $value_duRo $value_duDo $value_dPo $sigma_dRo $sigma_dDo $sigma_duRo $sigma_duDo $sigma_dPo $mean_Nfit $mean_chisq
+  end
+end
+
+macro testsuite
+  if ($0 != 2)
+    echo "USAGE: testsuite (mode)"
+    break
+  end
+
+  foreach outliers 0 3 10 30 100 
+    exec bin/fitpm.lin64 -Nstars 3000 -Noutliers $outliers -Npoints 100 -Nbootstrap 100 $1 > test.$1.dat
+    reload test.$1.dat
+
+    fprintf "%4d : %5.2f %5.2f %5.2f %5.2f %5.2f : %5.2f %5.2f %5.2f %5.2f %5.2f : %5.2f %5.2f %5.2f %5.2f %5.2f : %6.2f %5.2f" $outliers $value_dRf $value_dDf $value_duR $value_duD $value_dP $value_dRo $value_dDo $value_duRo $value_duDo $value_dPo $sigma_dRo $sigma_dDo $sigma_duRo $sigma_duDo $sigma_dPo $mean_Nfit $mean_chisq
+  end
+end
+
+macro reload
+  if ($0 != 2)
+    echo "USAGE: reload (file)"
+    break
+  end
+
+  data $1
+  read Ro 1 Do 2 uRo 3 uDo 4 Po 5 Rx 7 Dx 8 uRx 9 uDx 10 Px 11 Tx 13 dRo 15 dDo 16 duRo 17 duDo 18 dPo 19 Nfit 20 chisq 22
+
+  foreach f R D uD uR P
+    set d$f = $f\o - $f\x
+  end
+
+  set Rf = Rx - uRx*(Tx - $Tref)/3600.0/dcos(Dx)
+  set Df = Dx - uDx*(Tx - $Tref)/3600.0
+
+  set dRf = 3600*(Ro - Rf)*dcos(Dx)
+  set dDf = 3600*(Do - Df) 
+
+  # echo "fit scatter"
+  vstat -q dRf;  $value_dRf =  $SIGMA*1000
+  vstat -q dDf;  $value_dDf =  $SIGMA*1000
+  vstat -q duR;  $value_duR =  $SIGMA*1000
+  vstat -q duD;  $value_duD =  $SIGMA*1000
+  vstat -q dP ;  $value_dP  =  $SIGMA*1000
+
+  # echo "fit errors"
+  vstat -q dRo;  $value_dRo  = $MEAN*1000; $sigma_dRo  = $SIGMA*1000
+  vstat -q dDo;  $value_dDo  = $MEAN*1000; $sigma_dDo  = $SIGMA*1000
+  vstat -q duRo; $value_duRo = $MEAN*1000; $sigma_duRo = $SIGMA*1000
+  vstat -q duDo; $value_duDo = $MEAN*1000; $sigma_duDo = $SIGMA*1000
+  vstat -q dPo ; $value_dPo  = $MEAN*1000; $sigma_dPo  = $SIGMA*1000
+
+  # echo "Nfit"
+  vstat -q Nfit; $mean_Nfit = $MEAN
+
+  # echo chisq
+  vstat -q chisq; $mean_chisq = $MEAN
+end
+
+# determine the parallax factor (time) (ra) (dec) (parfR) (parfD) are vectors, 
+macro getParFactor_vectors
+  if ($0 != 6)
+    echo "USAGE: getParFactor (time) (ra) (dec) (parfR) (parfD) -- time in MJD"
+    echo "RETURN: parfR & parfD (vectors of length ra[],dec[])"
+    break
+  end
+
+  set dJ2000 = $1 - $J2000
+  ## first, determine the sun postion
+  set L_v = 280.460 + 0.9856474 * dJ2000
+  set g_v = 357.528 + 0.9856003 * dJ2000
+  set epsilon_v = 23.439 - 0.0000004 * dJ2000 ; # obliquity of ecliptic in degrees
+  
+  set lambda_v = L_v + 1.915 * dsin(g_v) + 0.020 * dsin(2. * g_v); # longitude in degrees
+  set sol_dist_v = 1.00014 - 0.01671*dcos(g_v) - 0.00014*dcos(2*g_v); # earth-to-sun dist in AU
+
+  set tmp_x = sol_dist_v*dcos(lambda_v)
+  set tmp_y = sol_dist_v*dcos(epsilon_v)*dsin(lambda_v)
+  set tmp_z = sol_dist_v*dsin(epsilon_v)*dsin(lambda_v)
+
+  set tmp_ra  = $2
+  set tmp_dec = $3
+
+  set $4 = +(tmp_y*dcos(tmp_ra) - tmp_x*dsin(tmp_ra))
+  set $5 = -(tmp_y*dsin(tmp_ra) + tmp_x*dcos(tmp_ra))*dsin(tmp_dec) + tmp_z*dcos(tmp_dec)
+end
+
