atmospheric_lidar/licel.py

changeset 146
968f8c944f90
parent 145
a99ae250e086
child 147
d6a27ff6df88
--- 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