Skip to content

Commit

Permalink
Correct time/freq cut and Quantity typo not ready for 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Oct 23, 2023
1 parent 046275f commit 12e584f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nenupy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 5 additions & 1 deletion nenupy/io/tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion nenupy/undysputed/dynspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12e584f

Please sign in to comment.