Minor change in colorbar and warning messages.

Thu, 29 Mar 2018 17:30:39 +0300

author
Iannis B <ioannis@inoe.ro>
date
Thu, 29 Mar 2018 17:30:39 +0300
changeset 146
968f8c944f90
parent 145
a99ae250e086
child 147
d6a27ff6df88
child 148
7c29ce781d9a

Minor change in colorbar and warning messages.

atmospheric_lidar/generic.py file | annotate | diff | comparison | revisions
atmospheric_lidar/licel.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/generic.py	Tue Mar 27 15:13:05 2018 +0300
+++ b/atmospheric_lidar/generic.py	Thu Mar 29 17:30:39 2018 +0300
@@ -1120,11 +1120,11 @@
 
         if add_colorbar:
             if cb_format:
-                cb1 = plt.colorbar(im1, format=cb_format)
+                cb1 = plt.colorbar(im1, format=cb_format, extend='both')
             else:
                 cb_formatter = ScalarFormatter()
                 cb_formatter.set_powerlimits(power_limits)
-                cb1 = plt.colorbar(im1, format=cb_formatter)
+                cb1 = plt.colorbar(im1, format=cb_formatter, extend='both')
             cb1.ax.set_ylabel(cmap_label)
 
             # Make the ticks of the colorbar smaller, two points smaller than the default font size
--- a/atmospheric_lidar/licel.py	Tue Mar 27 15:13:05 2018 +0300
+++ b/atmospheric_lidar/licel.py	Thu Mar 29 17:30:39 2018 +0300
@@ -123,10 +123,10 @@
             ADCrange = self.discriminator  # Discriminator value already in mV
 
             if self.is_photodiode and (self.adcbits == 0):
-                logger.warning("Changing adcbits to 1. This is a bug in current licel format.")
+                logger.warning("Assuming adcbits equal 1. This is a bug in current licel format when storing photodiode data.")
                 channel_data = norm * ADCrange / (2 ** self.adcbits)
             else:
-                channel_data = norm * ADCrange / ((2 ** self.adcbits) - 1)  # TODO: Check this. Agrees with Licel docs, but differs from their LabView code.
+                channel_data = norm * ADCrange / ((2 ** self.adcbits) - 1)  # Licel LabView code has a bug (does not account -1).
 
         else:
              channel_data = norm * self.number_of_shots
@@ -186,7 +186,7 @@
         channels = {}
         photodiodes = {}
 
-        with open(self.filename, 'rbU') as f:
+        with open(self.filename, 'rb') as f:
 
             self.read_header(f)
 
@@ -200,7 +200,8 @@
                 b = np.fromfile(f, 'b', 1)
 
                 if (a[0] != 13) | (b[0] != 10):
-                    logging.warning("No end of line found after record. File could be corrupt: %s" % self.filename)
+                    logger.warning("No end of line found after record. File could be corrupt: %s" % self.filename)
+                    logger.warning('a: {0}, b: {1}.'.format(a, b))
 
                 channel = self.channel_data_class(current_channel_info, raw_data, self.duration(),
                                                   use_id_as_name=self.use_id_as_name)
@@ -325,8 +326,8 @@
         return dt.seconds
 
     def import_header_only(self):
-        """ Import only the header lines, withouth reading the acutal data."""
-        with open(self.filename, 'rbU') as f:
+        """ Import only the header lines, without reading the actual data."""
+        with open(self.filename, 'rb') as f:
             self.read_header(f)
 
     @staticmethod

mercurial