Index: /fact/tools/pyscripts/fsc3.py
===================================================================
--- /fact/tools/pyscripts/fsc3.py	(revision 12610)
+++ /fact/tools/pyscripts/fsc3.py	(revision 12610)
@@ -0,0 +1,128 @@
+#!/usr/bin/python26
+#
+# FACT SLOW CONTROL DATA
+# FSC_CONTROL_TEMPERATURE DATA
+#
+# Plot temperatures versus time
+# Save plots to disk
+#
+# Werner Lustermann
+# ETH Zurich
+
+import pyfits # module for reading fits files
+ 
+import numpy as np
+import numpy.ma as ma # masked array module
+
+import matplotlib.pyplot as plt # for plotting
+
+class FSC_TEMPERATURE( object ):
+  
+    def __init__(self, dpath = '../temperature/', dfile = '20111103.FSC_CONTROL_TEMPERATURE.fits', plot_groups = True, show_plots = True ):
+    
+        self.dfile = dfile
+        self.dpath = dpath
+        self.fname = dpath + dfile
+
+        self.Tgroups = ['T_sens', 'T_ps', 'T_crate', 'T_eth', 'T_back', 'T_aux' ]
+        self.rData()
+
+    def rData( self ):
+
+        try:
+            hdu = pyfits.open( self.fname )
+        except:
+            print 'file: ', fname, ' does not exist! ==> BREAK!!!'
+            exit( 'unknown data file' )
+
+        self.tbdata = hdu[1].data
+        hdu.close()
+
+        t  = self.tbdata.field( 'Time' )
+        tt = np.modf( t )[0] * 24. 
+        # self.time = np.roll( tt, len( t[ t<12.] ) )
+        for i in range( len( tt[ tt >= 12.] ) + 1, len( tt ) ): tt[i] += 24. 
+        self.time = tt
+
+    def tplot_group( self, mT, gr ):
+        """ plot maxumum, minimum and mean of a group of sensors """
+        ax = plt.subplot(111)
+        ax.plot( self.time, np.max(mT, 1),  'b.', label = 'max', markersize = 1 )
+        ax.plot( self.time, np.min(mT, 1),  'b.', label = 'min', markersize = 1 )
+        ax.plot( self.time, np.mean(mT, 1),  'r.', label = 'mean', markersize = 1 )
+
+        ax.grid( 'on' )
+        plt.title( 'Temperatures: ' + gr + '  ' + self.dfile[0:12], fontsize = 18 )
+        plt.xlabel( 'time', fontsize = 14 )
+        plt.ylabel( 'T in degC', fontsize = 14 )
+        #plt.legend( loc = 4 )
+    
+        # Shink current axis by 20%
+        box = ax.get_position()
+        ax.set_position([box.x0, box.y0, box.width * 0.9, box.height])
+        plt.legend( fancybox=True, loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 7 )
+#
+    def plot_groups( self ):
+        for i,group in enumerate( self.Tgroups ):
+            T     = self.tbdata.field( group )
+            maska = self.tbdata.field( group ) == 0.0 
+            maskb = self.tbdata.field( group ) > 50.
+            mask  = maska | maskb
+            mT    = ma.masked_array( T, mask )
+            
+            plt.figure()
+
+            self.tplot_group( mT, group )
+            plt.savefig( self.dpath + self.dfile[0:-5] + '_' + group + '.png')
+
+
+#
+#
+    def plot_means( self ):
+   
+        fig = plt.figure()
+        ax = plt.subplot(111)
+        box = ax.get_position()
+        ax.set_position([box.x0, box.y0, box.width * 0.97, box.height])
+
+
+        for i,group in enumerate( self.Tgroups ):
+  
+            #print 'i = ', i, group
+            T     = self.tbdata.field( group )
+            maska = self.tbdata.field( group ) == 0.0
+            maskb = self.tbdata.field( group ) > 50.
+            mask  = maska | maskb
+            mT    = ma.masked_array( T, mask )
+
+            ax.plot( self.time, np.mean(mT, 1) , '.', label = group, markersize = 2 )
+    
+            ax.grid( 'on' )
+            plt.title( 'Mean Temperatures: ' + self.dfile[0:12], fontsize = 18 )
+            plt.xlabel( 'time', fontsize = 14 )
+            plt.ylabel( 'T in degC', fontsize = 14 )
+
+            # Shink current axis by 20%
+            box = ax.get_position()
+            ax.set_position([box.x0, box.y0, box.width * 0.97, box.height])
+            plt.legend( fancybox=True, loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 7 )
+            plt.savefig( self.dpath + self.dfile[0:-5] + '_means' + '.png' )
+           
+
+    def show_plot( self ):
+        plt.show()
+
+if __name__ == '__main__':
+        
+    print 'FACT FSC_CONTROL TEMPERATURE DATA'
+    
+    fsct = FSC_TEMPERATURE()
+    fsct.plot_means()
+    fsct.plot_groups()
+    fsct.show_plot()
+    
+
+
+
+    
+    
Index: /fact/tools/pyscripts/fscvolt1.py
===================================================================
--- /fact/tools/pyscripts/fscvolt1.py	(revision 12610)
+++ /fact/tools/pyscripts/fscvolt1.py	(revision 12610)
@@ -0,0 +1,98 @@
+#!/usr/bin/python26
+#
+# FACT SLOW CONTROL DATA
+# FSC_CONTROL_TEMPERATURE DATA
+#
+# Plot temperatures versus time
+# Save plots to disk
+#
+# Werner Lustermann
+# ETH Zurich
+
+import pyfits # module for reading fits files
+ 
+import numpy as np
+import numpy.ma as ma # masked array module
+
+import matplotlib.pyplot as plt # for plotting
+
+class FSC_VOLTAGE( object ):
+  
+    def __init__(self, dpath = '../voltage/', dfile = '20111102.FSC_CONTROL_VOLTAGE.fits', plot_groups = True, show_plots = True ):
+    
+        self.dfile = dfile
+        self.dpath = dpath
+        self.fname = dpath + dfile
+
+        self.Dgroups = ['FAD_Ud', 'FAD_U+', 'FAD_U-', 'FPA_Ud', 'FPA_U+', 'FPA_U-', 'ETH_U', 'FTM_U', 'FFC_U', 'FLP_U' ] 
+        # self.Dgroups = ['FAD_Ud', 'FAD_U+', 'FAD_U-', 'FPA_Ud', 'FPA_U+', 'FPA_U-', 'ETH_U', 'FTM_U' ] 
+       
+        self.rData()
+
+    def rData( self ):
+
+        try:
+            hdu = pyfits.open( self.fname )
+        except:
+            print 'file: ', fname, ' does not exist! ==> BREAK!!!'
+            exit( 'unknown data file' )
+
+        self.tbdata = hdu[1].data
+        hdu.close()
+
+        self.time  = self.tbdata.field( 'Time' )
+#
+#
+#
+    def vplot_all( self ):
+
+        for i, group in enumerate( self.Dgroups ):
+  
+            #print 'i = ', i, group
+            T     = self.tbdata.field( group )
+            # maska = self.tbdata.field( group ) == 0.0
+            # maskb = self.tbdata.field( group ) > 50.
+            # mask  = maska | maskb
+            # mT    = ma.masked_array( T, mask )
+            mT = T
+            
+            plt.figure(111)
+            ax = plt.subplot(111)
+            if i < 8:
+                ax.plot( self.time, np.mean(mT,1) , '.', label = group, markersize = 2 )
+            else:
+                ax.plot( self.time, mT , '.', label = group, markersize = 2 )
+
+            ax.grid( 'on' )
+            plt.title( 'DC Voltages: ' + self.dfile[0:12], fontsize = 18 )
+            plt.xlabel( 'time', fontsize = 14 )
+            plt.ylabel( 'Voltage in V', fontsize = 14 )
+
+            # Shink current axis by 20%
+            box = ax.get_position()
+            ax.set_position([box.x0, box.y0, box.width * 0.97, box.height])
+            plt.legend( fancybox=True, loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 7 )
+            plt.savefig( self.dfile[0:-5] + '.png' )
+            
+            
+
+    def tshow_plots( self ):
+        plt.show()
+
+if __name__ == '__main__':
+        
+    print 'FACT FAD_CONTROL TEMPERATURE DATA'
+    
+    fadt = FSC_VOLTAGE()
+    fadt.vplot_all()
+    #fadt.tshow_plots()
+    
+    #fadt = FSC_VOLTAGE()
+    #fadt.vplot_all()
+    #fadt.tshow_plots()
+    
+
+
+
+    
+    
Index: /fact/tools/pyscripts/paux.py
===================================================================
--- /fact/tools/pyscripts/paux.py	(revision 12610)
+++ /fact/tools/pyscripts/paux.py	(revision 12610)
@@ -0,0 +1,60 @@
+#!/usr/bin/python26
+
+import glob
+from os import path
+from os import system
+
+#import pyfits
+
+from fscvolt1 import FSC_VOLTAGE
+from fsc3 import FSC_TEMPERATURE
+
+class PAUX( object ):
+  
+    def __init__( self, year = 2011, month = 11, day = 0, dpoff = '../' ):
+
+        self.year = str( year )
+        self.month = str( month )
+        self.day = str( day )
+        self.dpoffset = dpoff 
+        
+    def anatemp( self ):
+    
+        # fsc temperatures
+        self.dpath = '../temperature/'
+        self.searchpath = self.dpath + self.year + self.month + '*.FSC_CONTROL_TEMPERATURE.fits'
+        print 'searchpath', self.searchpath
+        dflist = glob.glob( self.searchpath )        
+        print 'dflist', dflist, 'shape: ', len(dflist)
+        for i, file in enumerate( dflist ):
+            file = file[15:]
+            print 'file: ', i, ': ', file
+            tdata = FSC_TEMPERATURE( dpath = self.dpath, dfile = file )
+            tdata.plot_means()
+            tdata.plot_groups()
+        
+    
+    def anavolt( self ):
+    
+        # fsc voltages
+        self.dpath = '../voltage/'
+        self.searchpath = self.dpath + self.year + self.month + '*.FSC_CONTROL_VOLTAGE.fits'
+        # print 'searchpath', self.searchpath
+        dflist = glob.glob( self.searchpath )        
+        #print 'dflist', dflist, 'shape: ', len(dflist)
+        for i, file in enumerate( dflist ):
+            print 'file: ', i, ': ', file
+            vdata = FSC_VOLTAGE( dpath = self.dpath, dfile = file )
+            vdata.vplot_all()
+            del vdata
+            
+     
+            
+            
+if __name__ == '__main__':
+        
+    print 'FACT SLOW CONTROL DATA: PAUX'
+    
+    paux = PAUX(2011, 11)
+    paux.anatemp()
+    
