Skip to content

Commit 060de5c

Browse files
committed
removed some issues
1 parent 99d0fbf commit 060de5c

File tree

16 files changed

+70
-124
lines changed

16 files changed

+70
-124
lines changed

README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@
2525
</a>
2626
</p>
2727

28-
2928
**PySPOD**: Python Spectral Proper Orthogonal Decomposition
3029

3130
## Table of contents
32-
* [Description](#description)
33-
* [Installation and dependencies](#installation-and-dependencies)
34-
* [Installing via PIP](#installing-via-pip)
35-
* [Installing from source](#installing-from-source)
36-
* [Documentation](#documentation)
37-
* [Testing](#testing)
38-
* [Tutorials](#tutorials)
39-
* [References](#references)
40-
* [Recent works with PySPOD](#recent-works-with-pyspod)
41-
* [Authors and contributors](#authors-and-contributors)
42-
* [License](#license)
4331

32+
* [Description](#description)
33+
34+
* [Installation and dependencies](#installation-and-dependencies)
35+
* [Installing via PIP](#installing-via-pip)
36+
* [Installing from source](#installing-from-source)
4437

38+
* [Documentation](#documentation)
39+
* [Testing](#testing)
40+
* [Tutorials](#tutorials)
41+
* [References](#references)
42+
* [Recent works with PySPOD](#recent-works-with-pyspod)
43+
* [Authors and contributors](#authors-and-contributors)
44+
* [License](#license)
4545

4646
## Description
4747
**PySPOD** is a Python package that implements the so-called **Spectral Proper Orthgonal Decomposition** whose name was first conied by (picard-&-delville-2000), and goes back to the original work by [(Lumley 1970)](#lumley-1970). The implementation proposed here follows the original contributions by [(Towne et al. 2018)](#towne-et-al-2018), [(Schmidt and Towne 2019)](#schmidt-and-towne-2019).
@@ -53,14 +53,12 @@ The SPOD approach targets statistically stationary problems and involves the dec
5353
This can help identifying relations to multiple variables or understanding the reduced order behavior of a given phenomenon of interest and represent a powerful tool for the data-driven analysis of nonlinear dynamical systems. The SPOD approach shares some relationships with the dynamic mode decomposition (DMD), and the resolvent analysis, [(Towne et al. 2018)](#Towne-et-al-2018), that are also widely used approaches for the data-driven analysis of nonlinear systems. SPOD can be used for both experimental and simulation data, and a general description of its key parameters can be found in [(Schmidt and Colonius 2020)](#schmidt-and-colonius-2020).
5454

5555
In this package we implement three version of SPOD
56-
- SPOD_low_storage: that is intended for large RAM machines or small datasets
57-
- SPOD_low_ram: that is intended for small RAM machines or large datasets, and
58-
- SPOD_streaming: that is the algorithm presented in [(Schmidt and Towne 2019)](schmidt-and-towne-2019), and it is intended for large datasets.
56+
- SPOD_low_storage: that is intended for large RAM machines or small datasets
57+
- SPOD_low_ram: that is intended for small RAM machines or large datasets, and
58+
- SPOD_streaming: that is the algorithm presented in [(Schmidt and Towne 2019)](schmidt-and-towne-2019), and it is intended for large datasets.
5959

6060
To see how to use the **PySPOD** package and its user-friendly interface, you can look at the [**Tutorials**](tutorials/README.md).
6161

62-
63-
6462
## Installation and dependencies
6563
**PySPOD** requires `numpy`, `scipy`, `matplotlib`, `pyfftw`, `future`, `sphinx` (for the documentation). The code is developed and tested for Python 3 only.
6664
It can be installed using `pip` or directly from the source code.
@@ -94,7 +92,6 @@ To uninstall the package you have to rerun the installation and record the insta
9492
> cat installed_files.txt | xargs rm -rf
9593
```
9694

97-
9895
## Get started with a simple analysis
9996
**PySPOD** comes with an extensive suite of [**Tutorials**](tutorials/README.md).
10097
You can browse the [**Tutorials**](tutorials/README.md) to explore the capabilities
@@ -173,8 +170,6 @@ spod_ls.plot_2D_modes_at_frequency(
173170
You can change `SPOD_low_storage` to `SPOD_low_ram` and `SPOD_streaming`,
174171
to run the other two SPOD algorithms available.
175172

176-
177-
178173
## Documentation
179174
**PySPOD** uses [Sphinx](http://www.sphinx-doc.org/en/stable/) for code documentation.
180175
You can view the documentation online [here](http://mengaldo.github.io/PySPOD/).
@@ -189,8 +184,6 @@ by:
189184
This will generate a `docs/build/html` folder, where you can find an `index.html` file.
190185
Open it with your browser and explore the documentation locally.
191186

192-
193-
194187
## Testing
195188
Regression tests are deployed using Travis CI, that is a continuous intergration framework.
196189
You can check out the current status of **PySPOD** [here](https://travis-ci.org/mengaldo/PySPOD).
@@ -202,64 +195,71 @@ IF you want to run tests locally, you can do so by:
202195
> pytest -v
203196
```
204197

205-
206198
## References
199+
207200
#### (Lumley 1970)
208201
*Stochastic Tools in Turbulence.*
202+
209203
[[DOI](https://www.elsevier.com/books/stochastic-tools-in-turbulence/lumey/978-0-12-395772-6?aaref=https%3A%2F%2Fwww.google.com)]
210204

211205
#### (Picard and Delville 2000)
206+
212207
*Pressure velocity coupling in a subsonic round jet.*
213208
[[DOI](https://www.sciencedirect.com/science/article/abs/pii/S0142727X00000217)]
214209

215210
#### (Tutkun and George 2017)
211+
216212
*Lumley decomposition of turbulent boundary layer at high Reynolds numbers.*
217213
[[DOI](https://aip.scitation.org/doi/10.1063/1.4974746)]
218214

219215
#### (Schmidt et al 2017)
216+
220217
*Wavepackets and trapped acoustic modes in a turbulent jet: coherent structure eduction and global stability.*
221218
[[DOI](https://doi.org/10.1017/jfm.2017.407)]
222219

223220
#### (Araya et al 2017)
221+
224222
*Transition to bluff-body dynamics in the wake of vertical-axis wind turbines.*
225223
[[DOI]( https://doi.org/10.1017/jfm.2016.862)]
226224

227225
#### (Taira et al 2017)
226+
228227
*Modal analysis of fluid flows: An overview.*
229228
[[DOI](https://doi.org/10.2514/1.J056060)]
230229

231230
#### (Towne et al 2018)
231+
232232
*Spectral proper orthogonal decomposition and its relationship to dynamic mode decomposition and resolvent analysis.*
233233
[[DOI]( https://doi.org/10.1017/jfm.2018.283)]
234234

235235
#### (Schmidt and Towne 2019)
236+
236237
*An efficient streaming algorithm for spectral proper orthogonal decomposition.*
237238
[[DOI](https://doi.org/10.1016/j.cpc.2018.11.009)]
238239

239240
#### (Schmidt et al 2019)
241+
240242
*Spectral empirical orthogonal function analysis of weather and climate data.*
241243
[[DOI](https://doi.org/10.1175/MWR-D-18-0337.1)]
242244

243245
#### (Schmidt and Colonius 2020)
246+
244247
*Guide to spectral proper orthogonal decomposition.*
245248
[[DOI](https://doi.org/10.2514/1.J058809)]
246249

247-
248-
249250
## Recent works with **PySPOD**
250-
Please, [contact me](mailto:[email protected]) if you used PySPOD for a publication and you want it to be advertised here.
251-
252251

252+
Please, [contact me](mailto:[email protected]) if you used PySPOD for a publication and you want it to be advertised here.
253253

254254
## Authors and contributors
255+
255256
**PySPOD** is currently developed and mantained by
256257

257-
* [Gianmarco Mengaldo](mailto:[email protected]).
258+
* [Gianmarco Mengaldo](mailto:[email protected]).
258259

259260
Contact me by email for further information or questions about **PySPOD**, or suggest pull requests.
260261
Contributions improving code and documentation, as well as suggestions about new features are more than welcome!
261262

262-
263-
264263
## License
264+
265265
See the [LICENSE](LICENSE.rst) file for license rights and limitations (MIT).

pyspod/postprocessing.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
# import standard python packages
66
import os
7-
import sys
87
import numpy as np
98
from scipy.io import loadmat
109
import matplotlib as mpl
1110
import matplotlib.pyplot as plt
1211
from matplotlib import animation
1312
import matplotlib.gridspec as gridspec
14-
from matplotlib import colors as mcolors
1513
from mpl_toolkits.axes_grid1 import make_axes_locatable
1614
mpl.rc('figure', max_open_warning = 0)
1715
from os.path import splitext
@@ -214,7 +212,6 @@ def plot_eigs_vs_frequency(eigs, freq, title='', xticks=None, yticks=None,
214212
raise TypeError('`freq` must be ndarray type.')
215213

216214
# plot figure
217-
dpi = 200
218215
plt.figure(figsize=figsize, frameon=True, constrained_layout=False)
219216
ax = plt.gca()
220217
ratio = 1. / eigs.shape[1]
@@ -1044,7 +1041,7 @@ def plot_mode_tracers(modes, freq_required, freq, coords_list, x=None, vars_idx=
10441041
mode = np.fft.fftshift(mode, axes=1)
10451042
mode_point_phase = mode[idx_coords] * phase.conj()
10461043
ax = fig.add_subplot(spec[cnt,0])
1047-
ax_obj = ax.plot(t, np.real(mode_point_phase), 'k-')
1044+
_ = ax.plot(t, np.real(mode_point_phase), 'k-')
10481045
ax.set_ylabel('mode {}'.format(mode_id),
10491046
rotation=0,
10501047
labelpad=30,
@@ -1297,10 +1294,6 @@ def generate_2D_data_video(X, time_limits=[0,10], vars_idx=None, sampling=1,
12971294
'Data dimension Z = (N,M); x1 and x2 '
12981295
'must have dimension N and M, respectively.')
12991296

1300-
# get figure size
1301-
wsize = figsize[0]
1302-
hsize = figsize[1]
1303-
13041297
# overlay coastlines if required
13051298
cst = False
13061299
if coastlines.lower() == 'regular':

pyspod/spod_low_ram.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
import os
77
import sys
88
import time
9-
import scipy.io
109
import numpy as np
1110
from tqdm import tqdm
1211
from numpy import linalg as la
1312
import scipy.special as sc
1413
from scipy.fft import fft
1514
import warnings
1615
import shutil
17-
import psutil
1816

1917
# Import PySPOD base class for SPOD_low_ram
2018
from pyspod.spod_base import SPOD_base

pyspod/spod_low_storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import sys
88
import time
9-
import scipy.io
109
import numpy as np
1110
from tqdm import tqdm
1211
from numpy import linalg as la
@@ -85,7 +84,6 @@ def fit(self):
8584
# loop over number of blocks and generate Fourier realizations
8685
for iBlk in range(0,self._n_blocks):
8786

88-
start0 = time.time()
8987
# get time index for present block
9088
offset = min(iBlk * (self._n_DFT - self._n_overlap) + self._n_DFT, self._nt) - self._n_DFT
9189

pyspod/spod_streaming.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@
44

55
# import standard python packages
66
import os
7-
import sys
87
import time
9-
import scipy.io
108
import numpy as np
11-
from tqdm import tqdm
129
from numpy import linalg as la
1310
import scipy.special as sc
14-
import warnings
15-
import shutil
16-
import psutil
1711

1812
# import PySPOD base class for SSPOD
1913
from pyspod.spod_base import SPOD_base

pyspod/weights.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# import standard python packages
6-
import os
7-
import sys
86
import numpy as np
97

108

tests/test_basic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import shutil
44
import pytest
55
import subprocess
6-
import xarray as xr
7-
import numpy as np
6+
import numpy as np
87

98
# Import library specific modules
109
sys.path.append("../")
@@ -71,7 +70,7 @@ def test_basic_spod_low_storage():
7170

7271
try:
7372
bashCmd = ["ffmpeg", " --version"]
74-
sbp = subprocess.Popen(bashCmd, stdin=subprocess.PIPE)
73+
_ = subprocess.Popen(bashCmd, stdin=subprocess.PIPE)
7574
spod_ls.generate_2D_data_video(
7675
sampling=10,
7776
time_limits=[0,t.shape[0]],

tests/test_earthquakes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_postprocessing():
357357
filename='data_tracers.png')
358358
try:
359359
bashCmd = ["ffmpeg", " --version"]
360-
sbp = subprocess.Popen(bashCmd, stdin=subprocess.PIPE)
360+
_ = subprocess.Popen(bashCmd, stdin=subprocess.PIPE)
361361
spod.generate_2D_data_video(
362362
sampling=5,
363363
time_limits=[0,t.shape[0]],

tests/test_fluidmechanics.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,6 @@ def test_spod_low_storage_savefft():
289289

290290

291291
def test_spod_low_ram_savefft():
292-
'''
293-
spod tests on jet data for methodologies.
294-
'''
295292
'''
296293
spod tests on jet data for methodologies.
297294
'''

tutorials/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ These are organized in the form of `jupyter-notebooks`, along with their plain
77
In particular, we divided the tutorials in such a way that they cover different
88
functionalities of the library and practical application areas.
99

10-
1110
### Basic
1211

1312
#### [Tutorial: Basic 1](Basic/methods_comparison/methods_comparison.ipynb)
@@ -26,8 +25,6 @@ in this tutorial we highlight how one can define a function to read
2625
data and pass it to the constructor of the SPOD class, thereby allowing
2726
for a reduced use of RAM (for large datasets).
2827

29-
30-
3128
### Climate
3229

3330
#### [Tutorial: 2D Multivariate ENSO Index](climate/ERA20C_MEI_2D/ERA20C_MEI_2D.ipynb)
@@ -40,7 +37,6 @@ pressure (MSL), zonal component of the surface wind (U10), meridional component
4037
of the surface wind (V10), sea surface temperature (SST), 2-meter temperature
4138
(T2M), and, total cloud cover (TCC), on a 2D longitude-latitude grid.
4239

43-
4440
#### [Tutorial: 3D Quasi-Bienniel Oscillation](climate/ERA20C_QBO_3D/ERA20C_QBO_3D.ipynb)
4541

4642
This tutorial shows how to download data from an ECMWF reanalysis dataset (ERA20C),
@@ -49,32 +45,23 @@ and use **PySPOD** to identify spatio-temporal coherent structured in univariate
4945
The data is composed by the monthly-averages of the zonal-mean zonal winds
5046
on a 3D longitude, latitude, pressure-levels grid.
5147

52-
5348
#### [Tutorial: 2D ERA5 Mean-Sea Level Pressure](climate/ERA5_MSLP_2D/ERA5_MSLP_2D.ipynb)
5449

5550
This tutorial shows how to download data from an ECMWF reanalysis dataset (ERA5),
5651
and use **PySPOD** to identify spatio-temporal coherent structured in univariate
5752
2D data. In particular, we seek to identify spatio-temporal coherent structure in
5853
high-resolution mean-sea level pressure data from the ERA5 dataset.
5954

60-
61-
6255
### Fluidmechanics
6356

6457
#### [Tutorial: 2D Jet](fluidmechanics/jet_2D/jet_2D.ipynb)
6558

6659
This tutorial shows a simple 2D application to a turbulent jet, where the variable
6760
studied is pressure.
6861

69-
70-
7162
### Earthquakes
7263

7364
#### [Tutorial: 2D Slip Potency](earthquakes/slip_potency_2D/slip_potency_2D.ipynb)
7465

7566
This tutorial shows a simple 2D application seismic data, where the variable studied
76-
is the slip potency.
77-
78-
79-
80-
67+
is the slip potency.

0 commit comments

Comments
 (0)