Index: trunk/tools/heather/pv3slicer/p2.txt
===================================================================
--- trunk/tools/heather/pv3slicer/p2.txt	(revision 39571)
+++ trunk/tools/heather/pv3slicer/p2.txt	(revision 39571)
@@ -0,0 +1,244 @@
+4.58492550068 2.80745729282e-16
+13.6796279736 0.238742418442
+10.8391192313 0.378279793251
+19.8584310114 1.0393099566
+34.931723142 2.43671371485
+34.9796734415 3.04867947893
+36.2269319929 3.78674557433
+37.8729416579 4.61555042863
+36.6888790652 5.10610523541
+37.1260665581 5.80779623892
+38.3503117785 6.65946179349
+36.872783836 7.03565887734
+37.4916752465 7.79495738726
+38.8884392902 8.74799559172
+39.7346667238 9.61268613674
+40.905766841 10.5871914546
+42.8955348246 11.8236119039
+44.126353845 12.9012966659
+45.6479189908 14.1059831183
+47.4576201122 15.4506904921
+49.7103320817 17.0019354909
+50.917928824 18.2473537753
+53.1132462793 19.8965715619
+56.7632275592 22.1791598211
+60.7543923517 24.7110375514
+63.6767450124 26.9109558184
+67.6161640771 29.6409756951
+69.8704082668 31.7205007486
+71.4163824096 33.5279613826
+71.7004339565 34.7610592404
+70.2644325048 35.1322162524
+68.2079486288 35.1296903603
+65.4970372207 34.7081418689
+63.4093219116 34.5351928901
+61.9476003945 34.640657993
+60.9936048388 34.9844954144
+60.2292363644 35.4018563908
+58.5007734559 35.2066456117
+56.6058670171 34.8500529937
+55.4337381609 34.8855813388
+54.1935202461 34.8349248059
+53.8235348463 35.3114159573
+53.5995264314 35.865084637
+52.0357920248 35.4883254934
+51.5580211421 35.8152124491
+50.8351811543 35.9459007047
+50.1131211361 36.048361877
+49.6500963364 36.3117817212
+48.7818695121 36.2519932836
+47.7879379205 36.0660155658
+48.0166363837 36.7828772692
+48.4486543983 37.6516770124
+48.1213647015 37.9201539792
+56.3841645066 45.0303944871
+133.952705595 108.370016727
+256.508483143 210.119451493
+366.571028495 303.901147048
+428.62810606 359.477769809
+803.224559752 681.173059482
+2823.99809512 2420.63883705
+5305.82107784 4594.9757576
+6666.51790023 5830.66806473
+6501.22527652 5740.24098396
+6415.73223967 5716.45930104
+6274.39844611 5639.3919895
+6159.7488071 5582.62850965
+6342.5785668 5794.23360729
+6149.84086318 5660.95846331
+5916.02678919 5485.24460979
+5684.59738289 5307.02869165
+5553.02604008 5218.13757356
+5539.40063526 5237.60607938
+5462.95364487 5195.57779275
+5243.29100192 5014.18399775
+5115.69087875 4917.5176582
+4910.27777459 4742.96406446
+4720.34232202 4580.12798408
+4613.56000834 4495.31475767
+4452.23445456 4354.94256644
+4457.32360833 4375.42994928
+4487.65639604 4419.47871217
+4490.90829192 4435.61785883
+4399.87081736 4357.05149815
+4435.10208131 4402.04345186
+4350.45756095 4326.62537725
+4071.28881288 4055.79641247
+3920.78394292 3911.23320965
+4002.12203685 3996.63717469
+4088.12653875 4085.6362083
+4266.64419055 4265.99442148
+4058.87609982 4058.87609982
+4066.62658644 4066.00727391
+4188.05774689 4185.506567
+4249.02605867 4243.20282555
+4109.54536772 4099.53482199
+4089.60755372 4074.04545307
+4147.30297303 4124.58370113
+4133.00896287 4102.20209479
+4090.76923275 4050.95807362
+4129.47138238 4078.63082218
+4092.82352138 4030.64424777
+4132.10278988 4056.18435121
+4037.80894232 3949.5732255
+4045.48069978 3941.79529524
+4054.4527297 3934.01817679
+3971.48343539 3836.15837646
+3945.75188708 3792.90012693
+3956.24013209 3783.37114596
+3991.77464104 3796.40338826
+4039.38444686 3819.31292105
+3936.32250571 3698.93319225
+3873.5319221 3616.25348401
+3810.2019465 3532.75777555
+3816.53167701 3513.13599706
+3841.26025867 3509.16575193
+3858.68095469 3497.15272665
+3924.97437716 3527.74362993
+3987.52624011 3552.9119184
+4068.5993371 3592.35987258
+4031.79142284 3526.28430152
+4034.63867331 3494.09951162
+3934.50787711 3372.53151917
+3922.04076815 3326.07918835
+4024.07798886 3374.87570596
+4002.49604201 3318.2194984
+4082.0914681 3343.853616
+4095.93965459 3313.68482971
+3994.98529673 3190.53700829
+3983.58463383 3139.10763073
+3933.20709991 3056.67609477
+3971.77754283 3042.55809355
+3917.40256429 2956.50132322
+3969.16988754 2949.66800904
+3929.49009442 2873.84712505
+3980.40115285 2863.26092482
+4127.74604225 2918.7571671
+4191.92971063 2911.95917749
+4210.33449888 2871.44127059
+4256.72370386 2848.30418444
+4327.91890287 2839.37026834
+4260.57636499 2738.6458087
+4282.43553066 2695.02396917
+4280.0468035 2635.0600367
+4375.22144532 2633.07408655
+4465.36536527 2624.67587447
+4396.78621817 2521.89303279
+4339.0727253 2426.37864685
+4276.0659883 2328.91251707
+4162.32332397 2205.69531882
+4124.32559729 2124.18471599
+4084.38326967 2042.19163483
+3974.13304687 1926.69788575
+3929.25066638 1844.67149282
+3881.65167081 1762.23294473
+3696.93570459 1620.6299606
+3440.90952814 1454.1912297
+3192.99944806 1298.70987386
+3060.81585729 1195.95602643
+2993.61381292 1121.42743105
+2895.93548322 1037.81046048
+2842.7788589 972.287660718
+2757.01094735 897.595006436
+2636.3766464 814.685208887
+2536.2607043 741.530829166
+2458.93639189 677.774732023
+2387.85125196 618.021376312
+2359.04857832 570.705516353
+2300.77575445 517.561940789
+2289.39969653 475.992949069
+2199.63868117 419.710849822
+2188.11907369 379.962892145
+2114.79287815 330.82648468
+2035.11272621 283.232958198
+1970.492064 240.142568678
+1842.80440378 192.625514567
+1765.48538876 153.872193396
+1548.28138804 108.002645195
+1340.68785238 70.1661793962
+932.492465019 32.5435166582
+242.916385412 4.2394753173
+277   360   -35   -26   PSPS_PV3_P2_SLICE_0 6740.16396051 ipp100.0
+263   277   -35   -26   PSPS_PV3_P2_SLICE_1 6493.73772466 ipp100.1
+161   263   -35   -26   PSPS_PV3_P2_SLICE_2 6476.44614946 ipp101.0
+0     161   -35   -26   PSPS_PV3_P2_SLICE_3 6147.30653759 ipp101.1
+275   360   -26   -21   PSPS_PV3_P2_SLICE_4 7248.08059501 ipp102.0
+261   275   -26   -21   PSPS_PV3_P2_SLICE_5 7368.77213287 ipp102.1
+157   261   -26   -21   PSPS_PV3_P2_SLICE_6 7055.64291716 ipp103.0
+0     157   -26   -21   PSPS_PV3_P2_SLICE_7 6489.9615345 ipp103.1
+274   360   -21   -17   PSPS_PV3_P2_SLICE_8 5307.57097422 ipp104.0
+258   274   -21   -17   PSPS_PV3_P2_SLICE_9 5503.72396469 ipp104.1
+154   258   -21   -17   PSPS_PV3_P2_SLICE_10 5241.01318765 ipp100.0
+0     154   -21   -17   PSPS_PV3_P2_SLICE_11 4906.04201078 ipp100.1
+271   360   -17   -12   PSPS_PV3_P2_SLICE_12 6240.38892037 ipp101.0
+254   271   -17   -12   PSPS_PV3_P2_SLICE_13 6244.03386307 ipp101.1
+124   254   -17   -12   PSPS_PV3_P2_SLICE_14 5947.18009043 ipp102.0
+0     124   -17   -12   PSPS_PV3_P2_SLICE_15 5318.50558829 ipp102.1
+266   360   -12   -7    PSPS_PV3_P2_SLICE_16 5651.84031514 ipp103.0
+251   266   -12   -7    PSPS_PV3_P2_SLICE_17 5646.0561142 ipp103.1
+128   251   -12   -7    PSPS_PV3_P2_SLICE_18 5501.19907856 ipp104.0
+0     128   -12   -7    PSPS_PV3_P2_SLICE_19 5143.42507696 ipp104.1
+263   360   -7    -1    PSPS_PV3_P2_SLICE_20 6217.20369795 ipp100.0
+248   263   -7    -1    PSPS_PV3_P2_SLICE_21 6222.74501514 ipp100.1
+127   248   -7    -1    PSPS_PV3_P2_SLICE_22 6215.82623529 ipp101.0
+0     127   -7    -1    PSPS_PV3_P2_SLICE_23 6122.19688582 ipp101.1
+263   360   -1    4     PSPS_PV3_P2_SLICE_24 5271.930264 ipp102.0
+244   263   -1    4     PSPS_PV3_P2_SLICE_25 5408.21640873 ipp102.1
+122   244   -1    4     PSPS_PV3_P2_SLICE_26 5214.37824249 ipp103.0
+0     122   -1    4     PSPS_PV3_P2_SLICE_27 4925.06227255 ipp103.1
+262   360   4     9     PSPS_PV3_P2_SLICE_28 5137.93326807 ipp104.0
+243   262   4     9     PSPS_PV3_P2_SLICE_29 5136.61160564 ipp104.1
+126   243   4     9     PSPS_PV3_P2_SLICE_30 5127.23534274 ipp100.0
+0     126   4     9     PSPS_PV3_P2_SLICE_31 5049.54392815 ipp100.1
+258   360   9     15    PSPS_PV3_P2_SLICE_32 6159.23766446 ipp101.0
+243   258   9     15    PSPS_PV3_P2_SLICE_33 6028.55503082 ipp101.1
+127   243   9     15    PSPS_PV3_P2_SLICE_34 6004.94591403 ipp102.0
+0     127   9     15    PSPS_PV3_P2_SLICE_35 5798.10750937 ipp102.1
+255   360   15    21    PSPS_PV3_P2_SLICE_36 5758.51058722 ipp103.0
+240   255   15    21    PSPS_PV3_P2_SLICE_37 5793.04980469 ipp103.1
+122   240   15    21    PSPS_PV3_P2_SLICE_38 5697.71941209 ipp104.0
+0     122   15    21    PSPS_PV3_P2_SLICE_39 5477.79934692 ipp104.1
+251   360   21    28    PSPS_PV3_P2_SLICE_40 6424.79206586 ipp100.0
+233   251   21    28    PSPS_PV3_P2_SLICE_41 6323.19407272 ipp100.1
+113   233   21    28    PSPS_PV3_P2_SLICE_42 6188.67031217 ipp101.0
+0     113   21    28    PSPS_PV3_P2_SLICE_43 5812.46483278 ipp101.1
+248   360   28    35    PSPS_PV3_P2_SLICE_44 6272.04837203 ipp102.0
+228   248   28    35    PSPS_PV3_P2_SLICE_45 6022.45598221 ipp102.1
+114   228   28    35    PSPS_PV3_P2_SLICE_46 6030.8351295 ipp103.0
+0     114   28    35    PSPS_PV3_P2_SLICE_47 5679.11011386 ipp103.1
+247   360   35    42    PSPS_PV3_P2_SLICE_48 5511.00540519 ipp104.0
+217   247   35    42    PSPS_PV3_P2_SLICE_49 5617.67864275 ipp104.1
+114   217   35    42    PSPS_PV3_P2_SLICE_50 5528.62885427 ipp100.0
+0     114   35    42    PSPS_PV3_P2_SLICE_51 5385.60569406 ipp100.1
+239   360   42    50    PSPS_PV3_P2_SLICE_52 5837.38097978 ipp101.0
+205   239   42    50    PSPS_PV3_P2_SLICE_53 5872.25277996 ipp101.1
+117   205   42    50    PSPS_PV3_P2_SLICE_54 5777.10199976 ipp102.0
+0     117   42    50    PSPS_PV3_P2_SLICE_55 5589.87236738 ipp102.1
+228   360   50    60    PSPS_PV3_P2_SLICE_56 6325.26457886 ipp103.0
+191   228   50    60    PSPS_PV3_P2_SLICE_57 6363.57689428 ipp103.1
+126   191   50    60    PSPS_PV3_P2_SLICE_58 6244.51773024 ipp104.0
+0     126   50    60    PSPS_PV3_P2_SLICE_59 6000.18480372 ipp104.1
+236   360   60    90    PSPS_PV3_P2_SLICE_60 5986.83767 ipp100.0
+179   236   60    90    PSPS_PV3_P2_SLICE_61 5963.32087529 ipp100.1
+120   179   60    90    PSPS_PV3_P2_SLICE_62 5984.41789492 ipp101.0
+0     120   60    90    PSPS_PV3_P2_SLICE_63 5871.42299783 ipp101.1
Index: trunk/tools/heather/pv3slicer/slicebatch_FO.py
===================================================================
--- trunk/tools/heather/pv3slicer/slicebatch_FO.py	(revision 39571)
+++ trunk/tools/heather/pv3slicer/slicebatch_FO.py	(revision 39571)
@@ -0,0 +1,148 @@
+import astropy
+import math
+import numpy as np
+from astropy.io import fits
+hdu_list = fits.open('grid.cam.obj.fits')
+image_data = hdu_list[0].data
+
+# these are all FITS images with very simple coordinates: RA = X - 180, DEC = Y - 90, with pixels of 
+# first [ ] is the dec
+# second [ ] is the ra
+
+total = np.nansum(image_data)
+
+decslice = np.nansum(image_data,1, dtype='double')
+#print decslice.shape
+#for i in range(0,180):
+#    print i, decslice[i]
+
+datamachines = ['ipp100.0','ipp100.1' , 'ipp101.0', 'ipp101.1','ipp102.0','ipp102.1','ipp103.0','ipp103.1','ipp104.0','ipp104.1']
+numdata = len(datamachines)
+dmlen = len(datamachines)
+dmcnt =0 
+#decboundaries from email (see end)
+
+decboundaries=[-28,-26,-24,-21,-19,-17,-14,-12,-9,-7,-4,-1,1,4,6,9,12,15,18,21,25,28,31,35,38,42,46,50,55,60,67,90]
+
+image_data_decfix = np.empty_like (image_data)
+image_data_decfix[:] = image_data
+
+for d in range (0,180):
+    conv = math.cos((d-90)*math.pi/180.)
+    image_data_decfix[d,:]=image_data[d,:]*conv
+    
+    
+decslice2 = np.nansum(image_data_decfix,1,dtype='double')
+for i in range (0,180):
+    print decslice[i], decslice2[i]
+
+
+image_data [:] = image_data_decfix
+    
+decmin = -55
+xmin = decmin + 90
+#print "full total", np.nansum(image_data,dtype='double')
+actualtotal = np.nansum(image_data[xmin:180,0:360], dtype='double')
+#ok! I figured it out: np.nansum[x:x] gives 0, so to get a 1 pixel slice, need [x:x+1]
+#print "total between -55 and 90 dec " , actualtotal
+#print "other total between -55 and 90dec ", np.nansum(decslice[decmin:180],dtype='double')
+j = 0
+sumtotal = 0
+slicecnt =0
+for dec in decboundaries:
+    i = dec+90
+    if dec == 90:
+        j = 1 
+    if j == 0:
+        imin = decmin+90
+        j  = 1
+    else:
+        j = 0
+        sumcheck = np.nansum(image_data[imin:i],dtype='double')
+        #print imin, i, decmin, dec, sumcheck
+        decmin = dec
+        sumtotal = sumtotal + sumcheck
+        segsize = sumcheck/2.
+        jj =0
+        sumtotalra = 0
+        sumcheckra = 0
+        armin = 0
+        armax = 0
+        newsumcheckra = 0 
+        for ar in range (1,361):
+            #note, this is not how gene defined it, however, he's completely wrong I think...
+            oldsumcheckra = newsumcheckra
+            newsumcheckra = np.nansum(image_data[imin:i,armin:ar],dtype='double')
+      #     print "check",imin, i, armin, ar, armax, sumcheckra, newsumcheckra, segsize
+#            if ar == 360:
+#                print newsumcheckra
+            if (newsumcheckra > segsize or ar == 360):
+                # print the previous one
+                
+                armax = ar
+#                print imin, i, armin, armax, newsumcheckra, "here"
+#                print 360-armax, 360-armin, imin-90, i-90
+                ramin= 360-armax
+                ramax = 360-armin
+                decccmin=imin-90
+                decccmax = i-90
+                PSPS = "PSPS_PV3_OB_ra"+str(360-armax)+"to"+str(360-armin)+"dec"+str(imin-90)+"to"+str(i-90)
+                PSPS2 = "PSPS_PV3_OB_SLICE_"+str(slicecnt)
+                
+                print str(ramin).ljust(5), str(ramax).ljust(5),str(decccmin).ljust(5), str(decccmax).ljust(5),PSPS2,newsumcheckra, datamachines[dmcnt]
+                dmcnt = ( dmcnt + 1 ) % dmlen
+                sumtotalra = newsumcheckra + sumtotalra
+#                sumtotalra = newsumcheckra
+                armin = ar
+                sumcheckra = 0
+                slicecnt=slicecnt+1
+#                sumcheckra = np.nansum(image_data[imin:i][armin:ar],dtype='double')
+                #calnew
+            else:
+                
+                sumcheckra = newsumcheckra
+       # print "total ra sizes for decmin: " + str(decccmin)+", decmax: "+str(decccmax)+" expected: " + str(sumcheck)+" sum of slices: "+ str(sumtotalra)
+        #print "--------"
+#print "these should match" ,sumtotal, actualtotal        
+
+#decd
+for i in range(0,180):
+    for j in range(0,360):
+	ra = j - 180
+       	dec = i - 90	
+	#print ra, dec, image_data[i][j]
+	
+#Dec Boundaries from email:
+#-54.82   3.02e+12
+#-28.68   3.44e+12
+#-26.41   3.45e+12
+#-24.12   3.47e+12
+#-21.88   3.47e+12
+#-19.55   3.45e+12
+#-17.20   3.47e+12
+#-14.78   3.45e+12
+#-12.24   3.44e+12
+# -9.64   3.49e+12
+# -7.00   3.45e+12
+# -4.29   3.44e+12
+# -1.40   3.47e+12
+# +1.38   3.47e+12
+# +4.13   3.45e+12
+# +6.91   3.48e+12
+# +9.78   3.46e+12
+#+12.70   3.48e+12
+#+15.72   3.43e+12
+#+18.79   3.44e+12
+#+21.93   3.44e+12
+#+25.24   3.45e+12
+#+28.59   3.42e+12
+#+31.95   3.46e+12
+#+35.44   3.44e+12
+#+38.98   3.46e+12
+#+42.73   3.45e+12
+#+46.73   3.46e+12
+#+50.90   3.45e+12
+#+55.41   3.48e+12
+#+60.62   3.46e+12
+#+67.83   3.42e+12
+#+90.00        nan
Index: trunk/tools/heather/pv3slicer/slicebatch_FW.py
===================================================================
--- trunk/tools/heather/pv3slicer/slicebatch_FW.py	(revision 39571)
+++ trunk/tools/heather/pv3slicer/slicebatch_FW.py	(revision 39571)
@@ -0,0 +1,148 @@
+import astropy
+import math
+import numpy as np
+from astropy.io import fits
+hdu_list = fits.open('grid.ff.obj.fits')
+image_data = hdu_list[0].data
+
+# these are all FITS images with very simple coordinates: RA = X - 180, DEC = Y - 90, with pixels of 
+# first [ ] is the dec
+# second [ ] is the ra
+
+total = np.nansum(image_data)
+
+decslice = np.nansum(image_data,1, dtype='double')
+#print decslice.shape
+#for i in range(0,180):
+#    print i, decslice[i]
+
+datamachines = ['ipp100.0','ipp100.1' , 'ipp101.0', 'ipp101.1','ipp102.0','ipp102.1','ipp103.0','ipp103.1','ipp104.0','ipp104.1']
+numdata = len(datamachines)
+dmlen = len(datamachines)
+dmcnt =0 
+#decboundaries from email (see end)
+
+decboundaries=[-28,-26,-24,-21,-19,-17,-14,-12,-9,-7,-4,-1,1,4,6,9,12,15,18,21,25,28,31,35,38,42,46,50,55,60,67,90]
+
+image_data_decfix = np.empty_like (image_data)
+image_data_decfix[:] = image_data
+
+for d in range (0,180):
+    conv = math.cos((d-90)*math.pi/180.)
+    image_data_decfix[d,:]=image_data[d,:]*conv
+    
+    
+decslice2 = np.nansum(image_data_decfix,1,dtype='double')
+for i in range (0,180):
+    print decslice[i], decslice2[i]
+
+
+image_data [:] = image_data_decfix
+    
+decmin = -55
+xmin = decmin + 90
+#print "full total", np.nansum(image_data,dtype='double')
+actualtotal = np.nansum(image_data[xmin:180,0:360], dtype='double')
+#ok! I figured it out: np.nansum[x:x] gives 0, so to get a 1 pixel slice, need [x:x+1]
+#print "total between -55 and 90 dec " , actualtotal
+#print "other total between -55 and 90dec ", np.nansum(decslice[decmin:180],dtype='double')
+j = 0
+sumtotal = 0
+slicecnt =0
+for dec in decboundaries:
+    i = dec+90
+    if dec == 90:
+        j = 1 
+    if j == 0:
+        imin = decmin+90
+        j  = 1
+    else:
+        j = 0
+        sumcheck = np.nansum(image_data[imin:i],dtype='double')
+        #print imin, i, decmin, dec, sumcheck
+        decmin = dec
+        sumtotal = sumtotal + sumcheck
+        segsize = sumcheck/2.
+        jj =0
+        sumtotalra = 0
+        sumcheckra = 0
+        armin = 0
+        armax = 0
+        newsumcheckra = 0 
+        for ar in range (1,361):
+            #note, this is not how gene defined it, however, he's completely wrong I think...
+            oldsumcheckra = newsumcheckra
+            newsumcheckra = np.nansum(image_data[imin:i,armin:ar],dtype='double')
+      #     print "check",imin, i, armin, ar, armax, sumcheckra, newsumcheckra, segsize
+#            if ar == 360:
+#                print newsumcheckra
+            if (newsumcheckra > segsize or ar == 360):
+                # print the previous one
+                
+                armax = ar
+#                print imin, i, armin, armax, newsumcheckra, "here"
+#                print 360-armax, 360-armin, imin-90, i-90
+                ramin= 360-armax
+                ramax = 360-armin
+                decccmin=imin-90
+                decccmax = i-90
+                PSPS = "PSPS_PV3_OB_ra"+str(360-armax)+"to"+str(360-armin)+"dec"+str(imin-90)+"to"+str(i-90)
+                PSPS2 = "PSPS_PV3_OB_SLICE_"+str(slicecnt)
+                
+                print str(ramin).ljust(5), str(ramax).ljust(5),str(decccmin).ljust(5), str(decccmax).ljust(5),PSPS2,newsumcheckra, datamachines[dmcnt]
+                dmcnt = ( dmcnt + 1 ) % dmlen
+                sumtotalra = newsumcheckra + sumtotalra
+#                sumtotalra = newsumcheckra
+                armin = ar
+                sumcheckra = 0
+                slicecnt=slicecnt+1
+#                sumcheckra = np.nansum(image_data[imin:i][armin:ar],dtype='double')
+                #calnew
+            else:
+                
+                sumcheckra = newsumcheckra
+       # print "total ra sizes for decmin: " + str(decccmin)+", decmax: "+str(decccmax)+" expected: " + str(sumcheck)+" sum of slices: "+ str(sumtotalra)
+        #print "--------"
+#print "these should match" ,sumtotal, actualtotal        
+
+#decd
+for i in range(0,180):
+    for j in range(0,360):
+	ra = j - 180
+       	dec = i - 90	
+	#print ra, dec, image_data[i][j]
+	
+#Dec Boundaries from email:
+#-54.82   3.02e+12
+#-28.68   3.44e+12
+#-26.41   3.45e+12
+#-24.12   3.47e+12
+#-21.88   3.47e+12
+#-19.55   3.45e+12
+#-17.20   3.47e+12
+#-14.78   3.45e+12
+#-12.24   3.44e+12
+# -9.64   3.49e+12
+# -7.00   3.45e+12
+# -4.29   3.44e+12
+# -1.40   3.47e+12
+# +1.38   3.47e+12
+# +4.13   3.45e+12
+# +6.91   3.48e+12
+# +9.78   3.46e+12
+#+12.70   3.48e+12
+#+15.72   3.43e+12
+#+18.79   3.44e+12
+#+21.93   3.44e+12
+#+25.24   3.45e+12
+#+28.59   3.42e+12
+#+31.95   3.46e+12
+#+35.44   3.44e+12
+#+38.98   3.46e+12
+#+42.73   3.45e+12
+#+46.73   3.46e+12
+#+50.90   3.45e+12
+#+55.41   3.48e+12
+#+60.62   3.46e+12
+#+67.83   3.42e+12
+#+90.00        nan
Index: trunk/tools/heather/pv3slicer/slicebatch_P2.py
===================================================================
--- trunk/tools/heather/pv3slicer/slicebatch_P2.py	(revision 39571)
+++ trunk/tools/heather/pv3slicer/slicebatch_P2.py	(revision 39571)
@@ -0,0 +1,148 @@
+import astropy
+import math
+import numpy as np
+from astropy.io import fits
+hdu_list = fits.open('grid.cam.meas.fits')
+image_data = hdu_list[0].data
+
+# these are all FITS images with very simple coordinates: RA = X - 180, DEC = Y - 90, with pixels of 
+# first [ ] is the dec
+# second [ ] is the ra
+
+total = np.nansum(image_data)
+
+decslice = np.nansum(image_data,1, dtype='double')
+#print decslice.shape
+#for i in range(0,180):
+#    print i, decslice[i]
+
+datamachines = ['ipp100.0','ipp100.1' , 'ipp101.0', 'ipp101.1','ipp102.0','ipp102.1','ipp103.0','ipp103.1','ipp104.0','ipp104.1']
+numdata = len(datamachines)
+dmlen = len(datamachines)
+dmcnt =0 
+#decboundaries from email (see end)
+
+decboundaries=[-28,-26,-24,-21,-19,-17,-14,-12,-9,-7,-4,-1,1,4,6,9,12,15,18,21,25,28,31,35,38,42,46,50,55,60,67,90]
+
+image_data_decfix = np.empty_like (image_data)
+image_data_decfix[:] = image_data
+
+for d in range (0,180):
+    conv = math.cos((d-90)*math.pi/180.)
+    image_data_decfix[d,:]=image_data[d,:]*conv
+    
+    
+decslice2 = np.nansum(image_data_decfix,1,dtype='double')
+for i in range (0,180):
+    print decslice[i], decslice2[i]
+
+
+image_data [:] = image_data_decfix
+    
+decmin = -35
+xmin = decmin + 90
+#print "full total", np.nansum(image_data,dtype='double')
+actualtotal = np.nansum(image_data[xmin:180,0:360], dtype='double')
+#ok! I figured it out: np.nansum[x:x] gives 0, so to get a 1 pixel slice, need [x:x+1]
+#print "total between -55 and 90 dec " , actualtotal
+#print "other total between -55 and 90dec ", np.nansum(decslice[decmin:180],dtype='double')
+j = 0
+sumtotal = 0
+slicecnt =0
+for dec in decboundaries:
+    i = dec+90
+    if dec == 90:
+        j = 1 
+    if j == 0:
+        imin = decmin+90
+        j  = 1
+    else:
+        j = 0
+        sumcheck = np.nansum(image_data[imin:i],dtype='double')
+        #print imin, i, decmin, dec, sumcheck
+        decmin = dec
+        sumtotal = sumtotal + sumcheck
+        segsize = sumcheck/4.
+        jj =0
+        sumtotalra = 0
+        sumcheckra = 0
+        armin = 0
+        armax = 0
+        newsumcheckra = 0 
+        for ar in range (1,361):
+            #note, this is not how gene defined it, however, he's completely wrong I think...
+            oldsumcheckra = newsumcheckra
+            newsumcheckra = np.nansum(image_data[imin:i,armin:ar],dtype='double')
+      #     print "check",imin, i, armin, ar, armax, sumcheckra, newsumcheckra, segsize
+#            if ar == 360:
+#                print newsumcheckra
+            if (newsumcheckra > segsize or ar == 360):
+                # print the previous one
+                
+                armax = ar
+#                print imin, i, armin, armax, newsumcheckra, "here"
+#                print 360-armax, 360-armin, imin-90, i-90
+                ramin= 360-armax
+                ramax = 360-armin
+                decccmin=imin-90
+                decccmax = i-90
+                PSPS = "PSPS_PV3_OB_ra"+str(360-armax)+"to"+str(360-armin)+"dec"+str(imin-90)+"to"+str(i-90)
+                PSPS2 = "PSPS_PV3_P2_SLICE_"+str(slicecnt)
+                
+                print str(ramin).ljust(5), str(ramax).ljust(5),str(decccmin).ljust(5), str(decccmax).ljust(5),PSPS2,newsumcheckra, datamachines[dmcnt]
+                dmcnt = ( dmcnt + 1 ) % dmlen
+                sumtotalra = newsumcheckra + sumtotalra
+#                sumtotalra = newsumcheckra
+                armin = ar
+                sumcheckra = 0
+                slicecnt=slicecnt+1
+#                sumcheckra = np.nansum(image_data[imin:i][armin:ar],dtype='double')
+                #calnew
+            else:
+                
+                sumcheckra = newsumcheckra
+       # print "total ra sizes for decmin: " + str(decccmin)+", decmax: "+str(decccmax)+" expected: " + str(sumcheck)+" sum of slices: "+ str(sumtotalra)
+        #print "--------"
+#print "these should match" ,sumtotal, actualtotal        
+
+#decd
+for i in range(0,180):
+    for j in range(0,360):
+	ra = j - 180
+       	dec = i - 90	
+	#print ra, dec, image_data[i][j]
+	
+#Dec Boundaries from email:
+#-54.82   3.02e+12
+#-28.68   3.44e+12
+#-26.41   3.45e+12
+#-24.12   3.47e+12
+#-21.88   3.47e+12
+#-19.55   3.45e+12
+#-17.20   3.47e+12
+#-14.78   3.45e+12
+#-12.24   3.44e+12
+# -9.64   3.49e+12
+# -7.00   3.45e+12
+# -4.29   3.44e+12
+# -1.40   3.47e+12
+# +1.38   3.47e+12
+# +4.13   3.45e+12
+# +6.91   3.48e+12
+# +9.78   3.46e+12
+#+12.70   3.48e+12
+#+15.72   3.43e+12
+#+18.79   3.44e+12
+#+21.93   3.44e+12
+#+25.24   3.45e+12
+#+28.59   3.42e+12
+#+31.95   3.46e+12
+#+35.44   3.44e+12
+#+38.98   3.46e+12
+#+42.73   3.45e+12
+#+46.73   3.46e+12
+#+50.90   3.45e+12
+#+55.41   3.48e+12
+#+60.62   3.46e+12
+#+67.83   3.42e+12
+#+90.00        nan
Index: trunk/tools/heather/pv3slicer/slicebatch_ST.py
===================================================================
--- trunk/tools/heather/pv3slicer/slicebatch_ST.py	(revision 39571)
+++ trunk/tools/heather/pv3slicer/slicebatch_ST.py	(revision 39571)
@@ -0,0 +1,148 @@
+import astropy
+import math
+import numpy as np
+from astropy.io import fits
+hdu_list = fits.open('grid.ff.obj.fits')
+image_data = hdu_list[0].data
+
+# these are all FITS images with very simple coordinates: RA = X - 180, DEC = Y - 90, with pixels of 
+# first [ ] is the dec
+# second [ ] is the ra
+
+total = np.nansum(image_data)
+
+decslice = np.nansum(image_data,1, dtype='double')
+#print decslice.shape
+#for i in range(0,180):
+#    print i, decslice[i]
+
+datamachines = ['ipp100.0','ipp100.1' , 'ipp101.0', 'ipp101.1','ipp102.0','ipp102.1','ipp103.0','ipp103.1','ipp104.0','ipp104.1']
+numdata = len(datamachines)
+dmlen = len(datamachines)
+dmcnt =0 
+#decboundaries from email (see end)
+
+decboundaries=[-28,-26,-24,-21,-19,-17,-14,-12,-9,-7,-4,-1,1,4,6,9,12,15,18,21,25,28,31,35,38,42,46,50,55,60,67,90]
+
+image_data_decfix = np.empty_like (image_data)
+image_data_decfix[:] = image_data
+
+for d in range (0,180):
+    conv = math.cos((d-90)*math.pi/180.)
+    image_data_decfix[d,:]=image_data[d,:]*conv
+    
+    
+decslice2 = np.nansum(image_data_decfix,1,dtype='double')
+for i in range (0,180):
+    print decslice[i], decslice2[i]
+
+
+image_data [:] = image_data_decfix
+    
+decmin = -55
+xmin = decmin + 90
+#print "full total", np.nansum(image_data,dtype='double')
+actualtotal = np.nansum(image_data[xmin:180,0:360], dtype='double')
+#ok! I figured it out: np.nansum[x:x] gives 0, so to get a 1 pixel slice, need [x:x+1]
+#print "total between -55 and 90 dec " , actualtotal
+#print "other total between -55 and 90dec ", np.nansum(decslice[decmin:180],dtype='double')
+j = 0
+sumtotal = 0
+slicecnt =0
+for dec in decboundaries:
+    i = dec+90
+    if dec == 90:
+        j = 1 
+    if j == 0:
+        imin = decmin+90
+        j  = 1
+    else:
+        j = 0
+        sumcheck = np.nansum(image_data[imin:i],dtype='double')
+        #print imin, i, decmin, dec, sumcheck
+        decmin = dec
+        sumtotal = sumtotal + sumcheck
+        segsize = sumcheck/2.
+        jj =0
+        sumtotalra = 0
+        sumcheckra = 0
+        armin = 0
+        armax = 0
+        newsumcheckra = 0 
+        for ar in range (1,361):
+            #note, this is not how gene defined it, however, he's completely wrong I think...
+            oldsumcheckra = newsumcheckra
+            newsumcheckra = np.nansum(image_data[imin:i,armin:ar],dtype='double')
+      #     print "check",imin, i, armin, ar, armax, sumcheckra, newsumcheckra, segsize
+#            if ar == 360:
+#                print newsumcheckra
+            if (newsumcheckra > segsize or ar == 360):
+                # print the previous one
+                
+                armax = ar
+#                print imin, i, armin, armax, newsumcheckra, "here"
+#                print 360-armax, 360-armin, imin-90, i-90
+                ramin= 360-armax
+                ramax = 360-armin
+                decccmin=imin-90
+                decccmax = i-90
+                PSPS = "PSPS_PV3_OB_ra"+str(360-armax)+"to"+str(360-armin)+"dec"+str(imin-90)+"to"+str(i-90)
+                PSPS2 = "PSPS_PV3_OB_SLICE_"+str(slicecnt)
+                
+                print str(ramin).ljust(5), str(ramax).ljust(5),str(decccmin).ljust(5), str(decccmax).ljust(5),PSPS2,newsumcheckra, datamachines[dmcnt]
+                dmcnt = ( dmcnt + 1 ) % dmlen
+                sumtotalra = newsumcheckra + sumtotalra
+#                sumtotalra = newsumcheckra
+                armin = ar
+                sumcheckra = 0
+                slicecnt=slicecnt+1
+#                sumcheckra = np.nansum(image_data[imin:i][armin:ar],dtype='double')
+                #calnew
+            else:
+                
+                sumcheckra = newsumcheckra
+       # print "total ra sizes for decmin: " + str(decccmin)+", decmax: "+str(decccmax)+" expected: " + str(sumcheck)+" sum of slices: "+ str(sumtotalra)
+        #print "--------"
+#print "these should match" ,sumtotal, actualtotal        
+
+#decd
+for i in range(0,180):
+    for j in range(0,360):
+	ra = j - 180
+       	dec = i - 90	
+	#print ra, dec, image_data[i][j]
+	
+#Dec Boundaries from email:
+#-54.82   3.02e+12
+#-28.68   3.44e+12
+#-26.41   3.45e+12
+#-24.12   3.47e+12
+#-21.88   3.47e+12
+#-19.55   3.45e+12
+#-17.20   3.47e+12
+#-14.78   3.45e+12
+#-12.24   3.44e+12
+# -9.64   3.49e+12
+# -7.00   3.45e+12
+# -4.29   3.44e+12
+# -1.40   3.47e+12
+# +1.38   3.47e+12
+# +4.13   3.45e+12
+# +6.91   3.48e+12
+# +9.78   3.46e+12
+#+12.70   3.48e+12
+#+15.72   3.43e+12
+#+18.79   3.44e+12
+#+21.93   3.44e+12
+#+25.24   3.45e+12
+#+28.59   3.42e+12
+#+31.95   3.46e+12
+#+35.44   3.44e+12
+#+38.98   3.46e+12
+#+42.73   3.45e+12
+#+46.73   3.46e+12
+#+50.90   3.45e+12
+#+55.41   3.48e+12
+#+60.62   3.46e+12
+#+67.83   3.42e+12
+#+90.00        nan
