Skip to content

Commit daf54f3

Browse files
authored
Merge pull request #35 from radionets-project/fix_uv_time_plot
Fix time unit conversion in plotting
2 parents f7baf13 + 9476bc0 commit daf54f3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/changes/35.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed missing MJD to hours conversion in ungridded uv plot times

src/pyvisgrid/plotting/plotting.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import matplotlib
55
import matplotlib.pyplot as plt
66
import numpy as np
7+
from astropy.time import Time
78

89
__all__ = ["plot_ungridded_uv", "plot_dirty_image", "plot_mask"]
910

@@ -217,12 +218,17 @@ def plot_ungridded_uv(
217218
"The given mode does not exist! Valid modes are: wave, meter."
218219
)
219220

220-
times = np.tile(gridder.times.mjd, reps=2) if show_times else None
221+
times = Time(
222+
np.tile(gridder.times.mjd, reps=2) if show_times else None, format="mjd"
223+
)
221224
time_unit = "MJD"
222225

223226
if use_relative_time and show_times:
224-
times -= times[0] * 24
227+
times = [time.unix / 3600 for time in times]
228+
times -= times[0]
225229
time_unit = "h"
230+
elif not use_relative_time and show_times:
231+
times = times.value
226232

227233
scat = ax.scatter(
228234
x=np.append(-u, u),

0 commit comments

Comments
 (0)