Skip to content

Commit

Permalink
Plot method for SourceInLobes : auto data roll independant of selecte…
Browse files Browse the repository at this point in the history
…d unit
  • Loading branch information
AlanLoh committed Jan 24, 2024
1 parent ddcba25 commit 355e3cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 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.6.3"
__version__ = "2.6.4"
__maintainer__ = "Alan Loh"
__email__ = "[email protected]"

Expand Down
16 changes: 12 additions & 4 deletions nenupy/schedule/contamination.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,27 @@ def plot(self, time_unit: str = "utc", **kwargs):
"""
fig = plt.figure(figsize=kwargs.get("figsize", (10, 6)))

roll_index = 0
if time_unit == "utc":
try:
roll_index = np.argwhere(np.diff(self.time.jd) < 0)[0, 0] + 1
except IndexError:
pass
time_to_plot = self.time.datetime
time_label = f"Time (UTC since {self.time[0].isot.split('.')[0]})"

elif time_unit == "lst":
try:
roll_index = np.argwhere(np.diff(self.lst_time.rad) < 0)[0, 0] + 1
except IndexError:
pass
time_to_plot = self.lst_time.rad
time_label = "Local Sidereal Time (rad)"


# TODO : roll if there is a gap in lst and or utc
plt.pcolormesh(
time_to_plot,
np.roll(time_to_plot, -roll_index),
self.frequency.to(u.MHz).value,
self.value,
np.roll(self.value, -roll_index, axis=1),
shading="auto",
cmap=kwargs.get("cmap", "Blues")
)
Expand Down

0 comments on commit 355e3cc

Please sign in to comment.