generic.py

changeset 24
b148076f7295
parent 23
06d612c6cd0a
child 27
74f7617f5356
--- a/generic.py	Mon May 12 12:41:22 2014 +0300
+++ b/generic.py	Wed Jun 18 17:52:13 2014 +0300
@@ -302,8 +302,9 @@
         temp_v =  f.createVariable('Laser_Shots','i',('time','channels'))
         for (channel,n) in zip(channels, range(len(channels))):
             time_length = len(self.variables['Raw_Data_Start_Time'][self.variables['id_timescale'][channel]])
-            temp_v[:time_length, n] = params.channel_parameters[channel]['Laser_Shots']
-        
+            # Array slicing stoped working as usual ex. temp_v[:10] = 100 does not work. ??? np.ones was added.
+            temp_v[:time_length, n] = np.ones(time_length) * params.channel_parameters[channel]['Laser_Shots']
+
         #Raw lidar data
         temp_v = f.createVariable('Raw_Lidar_Data','d',('time', 'channels','points'))
         for (channel,n) in zip(channels, range(len(channels))):
@@ -511,7 +512,7 @@
                 plt.show()
         #plt.close() ???
     
-    def draw_plot(self,ax1, cmap = plt.cm.jet, signal_type = 'rc', zoom = [0,12000,0,-1], z0 = None, cmap_label = 'a.u.', vmin = 0, vmax = 1.3 * 10 ** 7):
+    def draw_plot(self,ax1, cmap = plt.cm.jet, signal_type = 'rc', zoom = [0,12000,0,-1], z0 = None, cmap_label = 'a.u.',  cb_format = None, vmin = 0, vmax = 1.3 * 10 ** 7):
         
         if signal_type == 'rc':
             if len(self.rc) == 0:
@@ -561,7 +562,10 @@
             extent = [ts1,ts2,self.z[zoom[0]]/1000.0 + z0/1000., self.z[hmax_idx]/1000.0 + z0/1000.],
             )
         
-        cb1 = plt.colorbar(im1)
+        if cb_format:
+            cb1 = plt.colorbar(im1, format = cb_format)
+        else:
+            cb1 = plt.colorbar(im1)
         cb1.ax.set_ylabel(cmap_label)
         
         # Make the ticks of the colorbar smaller, two points smaller than the default font size
@@ -572,7 +576,7 @@
 
     def index_at_height(self, height):
         idx = np.array(np.abs(self.z - height).argmin())
-        if idx.size >1:
+        if idx.size > 1:
             idx =idx[0]
         return idx
     

mercurial