# HG changeset patch # User Iannis # Date 1571659668 -10800 # Node ID 26551701d0137cd9ba1e48d33942b2904fa5dabf # Parent 804313c093a8215f4223ebddd12395dde1eaf118 Simplistic first signal bin correction when calculating range-corrected signal for plotting. diff -r 804313c093a8 -r 26551701d013 atmospheric_lidar/generic.py --- a/atmospheric_lidar/generic.py Fri May 31 14:52:42 2019 +0300 +++ b/atmospheric_lidar/generic.py Mon Oct 21 15:07:48 2019 +0300 @@ -712,7 +712,7 @@ duration = np.array(durations) return duration - def calculate_rc(self, idx_min=-2000, idx_max=-500): + def calculate_rc(self, idx_min=-2000, idx_max=-500, first_signal_bin=0): """ Calculate range corrected signal. The background signal is estimated as the mean signal between idx_min and idx_max. @@ -725,9 +725,14 @@ Minimum index to calculate background signal. idx_max : int Maximum index to calculate background signal. + first_signal_bin : int + First bin with useful signal. Positive integer. """ background = np.mean(self.matrix[:, idx_min:idx_max], axis=1) - self.rc = (self.matrix.transpose() - background).transpose() * (self.z ** 2) + background_corrected = (self.matrix.transpose() - background).transpose() + background_corrected = np.roll(background_corrected, -first_signal_bin, axis=1) + background_corrected[:, -9:] = 0 + self.rc = background_corrected * (self.z ** 2) def noise_mask(self, idx_min=-2000, idx_max=-500, threshold=1.): """ Calculate points that are probably noise.