@@ -60,4 +60,68 @@ plt.plot(freqs, power_levels)
6060plt.show()
6161```
6262
63+ ## 4.2 Waterfall
64+ The ` plot.waterfall.Waterfall ` class can be used to generate waterfall plots.
65+
66+ ### 4.2.1 Construction
67+
68+ | Parameter | Description |
69+ | --- | --- |
70+ | filter_bank | A ` filterbank ` object. |
71+ | center_freq | The center frequency of the signal in the filterbank object |
72+ | sample_freq | The sample frequency of the signal in the filterbank object|
73+ | fig | An imaging object, like ` pyplot.figure() ` |
74+ | mode | String ` {discrete, stream} ` . The mode to operate on. Use discrete for discrete datasets, and stream for stream data. Defaults to ` stream ` . |
75+
76+ ### 4.2.2 Methods
77+ | Method | Description |
78+ | --- | --- |
79+ | init_plot(self) | Initialize the plot |
80+ | update_plot_labes(self) | Generate the plot labels |
81+ | get_next(self) | Returns the next row of data in the filterbank object |
82+ | get_image(self) | Returns the image data of the full dataset, if using a discrete dataset. |
83+ | update(self, i) | Updates the image with the next row of data, when using a continuous datastream. |
84+ | animated_plotter(self) | Returns the figure and update function for matplotlib animation |
85+ | get_center_freq(self) | Returns the center frequency stored in the filterbank header |
86+
87+ ### 4.2.3 Example Usage
88+ #### 4.2.3.1 With discrete data
89+ ``` python
90+ import matplotlib.animation as animation
91+ from filterbank.header import read_header
92+ from filterbank.filterbank import Filterbank
93+ from plot import waterfall
94+ import pylab as pyl
95+ from plot.plot import next_power_of_2
96+
97+ fb = Filterbank(filename = ' ./pspm32.fil' , read_all = True )
98+
99+ wf = waterfall.Waterfall(filter_bank = fb, fig = pyl.figure(), mode = " discrete" )
100+
101+ img = wf.get_image()
102+
103+ pyl.show(img)
104+ ```
105+
106+ #### 4.2.3.2 With stream data
107+ ``` python
108+ import matplotlib.animation as animation
109+ from filterbank.header import read_header
110+ from filterbank.filterbank import Filterbank
111+ from plot import waterfall
112+ import pylab as pyl
113+ from plot.plot import next_power_of_2
114+
115+
116+ fb = Filterbank(filename = ' ./pspm32.fil' )
117+
118+ wf = waterfall.Waterfall(fb = fb, fig = pyl.figure(), mode = " stream" )
119+
120+ fig, update, frames, repeat = wf.animated_plotter()
121+
122+ ani = animation.FuncAnimation(fig, update, frames = frames,repeat = repeat)
123+ pyl.show()
124+ ```
125+
126+
63127[ Back to table of contents] ( ../README.md )
0 commit comments