Skip to content

Commit 355e3cc

Browse files
committed
Plot method for SourceInLobes : auto data roll independant of selected unit
1 parent ddcba25 commit 355e3cc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

nenupy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__copyright__ = "Copyright 2023, nenupy"
66
__credits__ = ["Alan Loh"]
77
__license__ = "MIT"
8-
__version__ = "2.6.3"
8+
__version__ = "2.6.4"
99
__maintainer__ = "Alan Loh"
1010
__email__ = "alan.loh@obspm.fr"
1111

nenupy/schedule/contamination.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,27 @@ def plot(self, time_unit: str = "utc", **kwargs):
9595
"""
9696
fig = plt.figure(figsize=kwargs.get("figsize", (10, 6)))
9797

98+
roll_index = 0
9899
if time_unit == "utc":
100+
try:
101+
roll_index = np.argwhere(np.diff(self.time.jd) < 0)[0, 0] + 1
102+
except IndexError:
103+
pass
99104
time_to_plot = self.time.datetime
100105
time_label = f"Time (UTC since {self.time[0].isot.split('.')[0]})"
106+
101107
elif time_unit == "lst":
108+
try:
109+
roll_index = np.argwhere(np.diff(self.lst_time.rad) < 0)[0, 0] + 1
110+
except IndexError:
111+
pass
102112
time_to_plot = self.lst_time.rad
103113
time_label = "Local Sidereal Time (rad)"
104114

105-
106-
# TODO : roll if there is a gap in lst and or utc
107115
plt.pcolormesh(
108-
time_to_plot,
116+
np.roll(time_to_plot, -roll_index),
109117
self.frequency.to(u.MHz).value,
110-
self.value,
118+
np.roll(self.value, -roll_index, axis=1),
111119
shading="auto",
112120
cmap=kwargs.get("cmap", "Blues")
113121
)

0 commit comments

Comments
 (0)