Skip to content

Commit

Permalink
reallly getting rid of SciencePlots
Browse files Browse the repository at this point in the history
  • Loading branch information
KshitijAggarwal committed Nov 6, 2020
1 parent 3a5f57f commit 97e3f86
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions your/utils/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def plot_h5(
None
"""
with h5py.File(h5_file, "r") as f, plt.style.context(
[ "no-latex"]
):
with h5py.File(h5_file, "r") as f:
dm_time = np.array(f["data_dm_time"])
if detrend_ft:
freq_time = detrend(np.array(f["data_freq_time"])[:, ::-1].T)
Expand Down Expand Up @@ -160,23 +158,22 @@ def save_bandpass(
else:
bp_plot = outname

with plt.style.context(["no-latex"]):
fig = plt.figure()
ax11 = fig.add_subplot(111)
if foff < 0:
ax11.invert_xaxis()

ax11.plot(freqs, bandpass, "k-", label="Bandpass")
if mask is not None:
if mask.sum():
logging.info("Flagged %d channels", mask.sum())
ax11.plot(freqs[mask], bandpass[mask], "r.", label="Flagged Channels")
ax11.set_xlabel("Frequency (MHz)")
ax11.set_ylabel("Arb. Units")
ax11.legend()

ax21 = ax11.twiny()
ax21.plot(chan_nos, bandpass, alpha=0)
ax21.set_xlabel("Channel Numbers")
fig = plt.figure()
ax11 = fig.add_subplot(111)
if foff < 0:
ax11.invert_xaxis()

ax11.plot(freqs, bandpass, "k-", label="Bandpass")
if mask is not None:
if mask.sum():
logging.info("Flagged %d channels", mask.sum())
ax11.plot(freqs[mask], bandpass[mask], "r.", label="Flagged Channels")
ax11.set_xlabel("Frequency (MHz)")
ax11.set_ylabel("Arb. Units")
ax11.legend()

ax21 = ax11.twiny()
ax21.plot(chan_nos, bandpass, alpha=0)
ax21.set_xlabel("Channel Numbers")

return plt.savefig(bp_plot, bbox_inches="tight", dpi=300)

0 comments on commit 97e3f86

Please sign in to comment.