Skip to content

Commit

Permalink
Spectra/Spectrogram plotting basic code added to plot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawith committed Oct 27, 2025
1 parent 4f443cf commit ea74dc7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions visualize/plot.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# --*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

def lineplot(data=None, x=None, y=None, hue=None):
"""
"""

if data is None or x is None or y is None:
raise ValueError("Data, x, and y parameters must be provided.")

Expand All @@ -19,5 +23,21 @@ def lineplot(data=None, x=None, y=None, hue=None):
plt.savefig(f"/app/workdir/figures/lineplot_{y}_by_{x}.png")
plt.close()

def spectra_plot(spec_array, name=None):
"""
"""

spec_array = spec_array[:,:130]
print(spec_array.shape)
plt.pcolor(spec_array, cmap="bwr", vmin=-1, vmax=1)
plt.title(f"{name} spectra")
plt.savefig(f"/app/workdir/figures/{name}_spectra_plot.png")
plt.close()

spec_array -= np.mean(spec_array[:6,:], axis=0)
plt.pcolor(spec_array, cmap="bwr", vmin=-1, vmax=1)
plt.title(f"{name} spectrogram")
plt.savefig(f"/app/workdir/figures/{name}_spectrogram_plot.png")
plt.close()

# EOF

0 comments on commit ea74dc7

Please sign in to comment.