diff --git a/nenupy/__init__.py b/nenupy/__init__.py index f5c5847..1bca95e 100644 --- a/nenupy/__init__.py +++ b/nenupy/__init__.py @@ -5,7 +5,7 @@ __copyright__ = "Copyright 2023, nenupy" __credits__ = ["Alan Loh"] __license__ = "MIT" -__version__ = "2.4.0" +__version__ = "2.4.1" __maintainer__ = "Alan Loh" __email__ = "alan.loh@obspm.fr" diff --git a/nenupy/io/tf.py b/nenupy/io/tf.py index 321e41f..502ff4e 100644 --- a/nenupy/io/tf.py +++ b/nenupy/io/tf.py @@ -329,8 +329,10 @@ def _select_data(self): # Get the closest time index within each of the two bounding blocks dt_sec = self.dt.to_value(u.s) time_idx_min_in_block = int(np.round((tmin - self._block_start_unix[block_idx_min])/dt_sec)) + time_idx_min_in_block = 0 if time_idx_min_in_block < 0 else time_idx_min_in_block time_idx_min = block_idx_min * self._n_time_per_block + time_idx_min_in_block time_idx_max_in_block = int(np.round((tmax - self._block_start_unix[block_idx_max])/dt_sec)) + time_idx_max_in_block = self._n_time_per_block - 1 if time_idx_max_in_block >= self._n_time_per_block else time_idx_max_in_block time_idx_max = block_idx_max * self._n_time_per_block + time_idx_max_in_block if time_idx_min == time_idx_max: @@ -342,7 +344,9 @@ def _select_data(self): block_start_time_unix=self._block_start_unix[block_idx_min:block_idx_max + 1], ntime_per_block=self._n_time_per_block, time_step_s=self.dt.to_value(u.s) - )[time_idx_min_in_block:-(self._n_time_per_block - time_idx_max_in_block) + 1] + ) + # Cut down the first and last time blocks + time_unix = time_unix[time_idx_min_in_block:time_unix.size - (self._n_time_per_block - time_idx_max_in_block) + 1] log.info("\tComputing the frequency selection...") fmin, fmax = self.configuration.frequency_range.to_value(u.Hz) diff --git a/nenupy/undysputed/dynspec.py b/nenupy/undysputed/dynspec.py index 4e7ff73..6726926 100644 --- a/nenupy/undysputed/dynspec.py +++ b/nenupy/undysputed/dynspec.py @@ -777,7 +777,7 @@ def rotation_measure(self) -> u.Quantity: @rotation_measure.setter #@u.quantity_input - def rotation_measure(self, rm: u.Quantity[u.rad/u.m**2]) -> None: + def rotation_measure(self, rm: u.Quantity) -> None: # rm: u.Quantity[u.rad/u.m**2]) -> None: if not (rm is None): # if not isinstance(rm, u.Quantity): # rm *= u.rad/u.m**2