Skip to content

Commit abfcb9c

Browse files
authored
Merge pull request #50 from AUAS-Pulsar/waterfall-docs
added docs for waterfall
2 parents a3f970c + fb2b81e commit abfcb9c

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ Creating a free and open source framework that contains the generic algorithms a
3838
1. [PSD](docs/plots.md#41-psd)
3939
1. [Parameters](docs/plots.md#411-parameters)
4040
2. [Returns](docs/plots.md#412-returns)
41-
1. [Example usage](docs/plots.md#413-example-usage)
41+
3. [Example usage](docs/plots.md#413-example-usage)
42+
2. [Waterfall](docs/plots.md#41-psd)
43+
1. [Construction](docs/plots.md#421-parameters)
44+
2. [Methods](docs/plots.md#422-returns)
45+
3. [Example usage](docs/plots.md#423-example-usage)
46+
1. [With discrete data](docs/plots.md#4231-with-discrete-data)
47+
2. [With stream data](docs/plots.md#4232-with-stream-data)
4248
5. [Timeseries](docs/timeseries.md)
4349
1. [Initialize timeseries object](docs/timeseries.md#51-initialize-the-timeseries-object)
4450
2. [Retrieve timeseries](docs/timeseries.md#521-retrieve-timeseries-object)

docs/plots.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,68 @@ plt.plot(freqs, power_levels)
6060
plt.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

Comments
 (0)