Note
This page was generated from a Jupyter Notebook. Download the notebook (.ipynb)
Visualization Deep Dive
SegmentTable provides rich plotting features, specifically optimized for comparing spectra over multiple segments via overlay_spectra().
[ ]:
import numpy as np
from gwpy.segments import Segment
from gwexpy.table import SegmentTable
from gwpy.frequencyseries import FrequencySeries
def make_fs(i):
f = np.linspace(1, 32, 256)
data = (1.0/(f**1.5)) * (1.0 + i*0.1)
return FrequencySeries(data, frequencies=f)
segs = [Segment(i*100, i*100+100) for i in range(10)]
st = SegmentTable.from_segments(segs, snr=np.random.uniform(5, 20, 10))
st.add_series_column("asd", data=[make_fs(i) for i in range(10)], kind="frequencyseries")
# 1. Overlay spectra graded by start time (default)
plot = st.overlay_spectra("asd", color_by="t0")
plot.show() # NOTE: Normally use plot in notebooks
Color Grading by Meta Column
You can color individual lines based on any numeric meta column (e.g., SNR).
[ ]:
plot = st.overlay_spectra("asd", color_by="snr", cmap="plasma")
plot
Overview Layouts
Use segments() to see the temporal layout of your table.
[ ]:
st.segments(color="snr")