modulo-vki 2.0.6__tar.gz → 2.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/LICENSE +21 -21
  2. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/PKG-INFO +304 -304
  3. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/README.rst +280 -280
  4. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/__init__.py +22 -22
  5. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/__init__.py +9 -9
  6. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_dft.py +61 -61
  7. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_dmd_s.py +72 -72
  8. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_k_matrix.py +81 -81
  9. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_mpod_space.py +180 -180
  10. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_mpod_time.py +154 -154
  11. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_pod_space.py +184 -184
  12. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_pod_time.py +48 -48
  13. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_spod_s.py +101 -101
  14. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/core/_spod_t.py +104 -104
  15. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/modulo.py +828 -828
  16. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/utils/__init__.py +4 -4
  17. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/utils/_plots.py +51 -51
  18. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/utils/_utils.py +341 -341
  19. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/utils/others.py +452 -452
  20. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki/utils/read_db.py +339 -339
  21. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki.egg-info/PKG-INFO +304 -304
  22. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/setup.cfg +4 -4
  23. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/setup.py +82 -82
  24. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki.egg-info/SOURCES.txt +0 -0
  25. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki.egg-info/dependency_links.txt +0 -0
  26. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki.egg-info/requires.txt +0 -0
  27. {modulo_vki-2.0.6 → modulo_vki-2.0.7}/modulo_vki.egg-info/top_level.txt +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 lorenzoschena
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 lorenzoschena
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,304 +1,304 @@
1
- Metadata-Version: 2.1
2
- Name: modulo_vki
3
- Version: 2.0.6
4
- Summary: MODULO (MODal mULtiscale pOd) is a software developed at the von Karman Institute to perform Multiscale Modal Analysis of numerical and experimental data.
5
- Home-page: https://github.com/mendezVKI/MODULO/tree/master/modulo_python_package/
6
- Author: ['R. Poletti', 'L. Schena', 'D. Ninni', 'M. A. Mendez']
7
- Author-email: mendez@vki.ac.be
8
- License: BSD (3-clause)
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Natural Language :: English
11
- Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.6
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: tqdm
16
- Requires-Dist: numpy
17
- Requires-Dist: scipy
18
- Requires-Dist: scikit-learn
19
- Requires-Dist: ipykernel
20
- Requires-Dist: ipython
21
- Requires-Dist: ipython-genutils
22
- Requires-Dist: ipywidgets
23
- Requires-Dist: matplotlib
24
-
25
-
26
-
27
- MODULO: a python toolbox for data-driven modal decomposition
28
- -----------------------------------------------------------
29
-
30
- .. image:: https://readthedocs.org/projects/modulo/badge/?version=latest
31
- :target: https://modulo.readthedocs.io/en/latest/?badge=latest
32
- :alt: Documentation Status
33
-
34
- .. raw:: html
35
-
36
- <div style="text-align: center;">
37
- <img src="https://modulo.readthedocs.io/en/latest/_images/modulo_logo.png" alt="Modulo Logo" width="500"/>
38
- </div>
39
-
40
- **MODULO** is a modal decomposition package developed at the von Karman Institute for Fluid Dynamics (VKI).
41
- It offers a wide range of decomposition techniques, enabling users to select the most suitable method based
42
- on the specific physics of their problem and their desired outcomes. MODULO can natively handle large
43
- datasets efficiently, featuring a memory-saving option that partitions the data and computes the decomposition in
44
- chunks (ninni2020modulo). Additionally, it supports non-uniform meshes through its weighted inner product formulation.
45
-
46
- While the discontinued MATLAB version of MODULO (ninni2020modulo) is accessible in the “Old_Matlab_Implementation” branch,
47
- it is no longer maintained. The latest decomposition techniques are exclusively available in the current Python version.
48
-
49
- As a part of the MODULO project, we provide a series of lectures on data-driven modal decomposition, and its applications.
50
- These are available at the `MODULO YouTube channel <https://www.youtube.com/@modulompod5682>`_.
51
-
52
-
53
- .. contents:: Table of contents
54
-
55
- Modal decompositions
56
- --------------------
57
- Modal decompositions aim to describe the data as a linear combination of *modes*, obtained by projecting the data
58
- onto a suitable set of basis. For instance, consider a matrix $D(x, t)$, where $x$ and $t$ are the spatial and temporal
59
- coordinates, respectively, the modal decomposition can be written as:
60
-
61
- $D(x_i, t_k) = \\phi(x_i) \\Sigma \\psi(t_k)^T$
62
-
63
- where $\\phi(x_i)$ is the spatial basis, $\\psi(t_k)$ is the temporal basis, and $\\Sigma$ is the modal coefficients.
64
- Different decompositions employ different basis, such as prescribed Fourier basis ($\\psi_\\mathcal{F}$) for
65
- the Discrete Fourier Transform (DFT), or data-driven basis, i.e. tailored on the dataset at hand,
66
- for the Proper Orthogonal Decomposition (POD).
67
-
68
- We refer to (mendez2022statistical, mendez2022generalizedmultiscalemodalanalysis, Mendez_2023) for an introduction to the topic.
69
-
70
- MODULO currently features the following decompositions:
71
- - Discrete Fourier Transform (DFT) (briggs1995dft)
72
- - Proper Orthogonal Decomposition (POD) (sirovich1987turbulence, berkooz1993proper)
73
- - Multi-Scale Proper Orthogonal Decomposition (mPOD) (mendez2019multi)
74
- - Dynamic Mode Decomposition (DMD) (schmid2010dynamic)
75
- - Spectral Proper Orthogonal Decomposition (SPOD) (csieber2016spectral, towne2018spectral), note that the two are
76
- different formulations, and both are available in MODULO.
77
- - Kernel Proper Orthogonal Decomposition (KPOD) (mika1998kernel)
78
-
79
- We remind the curious reader to the respective references for a detailed description of each decomposition, and to the
80
- documentation for a practical guide on how to use them in MODULO.
81
-
82
-
83
- Release Notes
84
- -------------
85
- The latest version of MODULO (v2.0) includes the following updates:
86
-
87
- 1. **Faster EIG/SVD algorithms**, using powerful randomized svd solvers from scikit_learn
88
- (see `here<https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html>`_
89
- and `here <https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html>`_.)
90
- It is now possible to select various options as "eig_solver" and "svd_solver",
91
- offering different trade-offs in terms of accuracy vs computational time.
92
-
93
- 2. **Computation the POD directly via SVD**, using any of the four "svd_solver" options.
94
- This is generally faster but requires more memory.
95
-
96
- 1. **Faster subscale estimators for the mPOD:** the previous version used the rank of the correlation matrix in each scale to define
97
- the number of modes to be computed in each portion of the splitting vector before assembling the full basis.
98
- This is computationally very demanding. This estimation has been replaced by a
99
- frequency-based threshold (i.e. based on the frequency bins within each portion) since one can show that the
100
- frequency-based estimator is always more "conservative" than the rank-based estimator.
101
-
102
- 1. **Major improvement on the memory saving option**: the previous version of modulo always required in input the matrix D.
103
- Then, if the memory saving option was active, the matrix was partitioned and stored locally to free the RAM before computing the
104
- correlation matrix (see [this tutorial by D. Ninni](https://www.youtube.com/watch?v=LclxO1WTuao)).
105
- In the new version, it is possible to initialize a modulo object *without* the matrix D (see exercise 5 in the examples).
106
- Instead, one can create the partitions without loading the matrix D.
107
-
108
- 1. **Implementation of Dynamic Mode Decomposition (DMD)** from (Schmid, P.J 2010)
109
-
110
- 2. **Implementation of the two Spectral POD formulations**, namely the one from (Sieber et al 2016),
111
- and the one from (Towne et al 2018).
112
-
113
- 3. **Implementation of a kernel version of the POD**, in which the correlation matrix is replaced by a kernel matrix.
114
- This is described in Lecture 15 of the course `Hands on Machine Learning for Fluid dynamics 2023 <https://www.vki.ac.be/index.php/events-ls/events/eventdetail/552/-/online-on-site-hands-on-machine-learning-for-fluid-dynamics-2023>`_.
115
- We refer also to: `https://arxiv.org/abs/2208.07746`.
116
-
117
- 1. **Implementation of a formulation for non-uniform meshes**, using a weighted matrix for all the relevant inner products.
118
- This is currently available only for POD and mPOD but allows for handling data produced from CFD simulation without resampling on a uniform grid (see exercise 4).
119
- It can be used both with and without the memory-saving option.
120
-
121
-
122
- Installation
123
- -------------
124
-
125
- Installation via pip
126
- ^^^^^^^^^^^^^^^^^^^^
127
-
128
- You can access the latest update of the modulo python package on PyPI using the command line:
129
-
130
- .. code-block:: bash
131
-
132
- $ pip install modulo_vki
133
-
134
- Installation from source
135
- ^^^^^^^^^^^^^^^^^^^^^^^^
136
-
137
- Alternatively, you can clone the repository and install the package locally:
138
-
139
- .. code-block:: bash
140
-
141
- $ git clone https://github.com/mendezVKI/MODULO.git
142
-
143
- $ cd MODULO
144
-
145
- $ python setup.py install
146
-
147
- or, if you have pip installed in your environment,
148
-
149
- .. code-block:: bash
150
-
151
- $ pip install .
152
-
153
-
154
- Documentation
155
- -------------
156
-
157
- The documentation of MODULO is available `here <https://modulo.readthedocs.io/en/latest/intro.html>`_. It
158
- contains a comprehensive guide on how to install and use the package, as well as a detailed description of the
159
- decompositions required inputs and outputs. A `list of YouTube videos<https://www.youtube.com/@modulompod5682>`_
160
- is also available to guide the introduce the user to modal decomposition and MODULO.
161
-
162
- Example
163
- -------------
164
-
165
- Example 1: POD decomposition
166
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
-
168
- The following example illustrates how to decompose a data set (D) using the POD decomposition.
169
-
170
- .. code-block:: python
171
-
172
- from modulo_vki import ModuloVKI
173
- import numpy as np
174
-
175
- # Create a random dataset
176
- D = np.random.rand(100, 1000)
177
-
178
- # Initialize the ModuloVKI object
179
- m = ModuloVKI(D)
180
-
181
- # Compute the POD decomposition
182
- phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
183
-
184
- which returns the spatial basis ($\phi$), the temporal basis ($\psi$), and the modal
185
- amplitudes ($\Sigma$) of the POD decomposition.
186
-
187
- Example 2: Memory Saving option
188
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189
-
190
- For the Memory Saving option, MODULO decomposes $D$ in `N_partitions`, defined
191
- by the user (refer to `examples/ex_04_Memory_Saving.py`).
192
-
193
- .. code-block:: python
194
-
195
- from modulo_vki import ModuloVKI
196
- import numpy as np
197
-
198
- # Create a random dataset
199
- D = np.random.rand(100, 1000)
200
-
201
- # Initialize the ModuloVKI object
202
- m = ModuloVKI(D, N_PARTITIONS=10)
203
-
204
- # Compute the POD decomposition
205
- phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
206
-
207
- Example 3: non-uniform grid
208
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209
-
210
- If you are dealing with non-uniform grid (e.g. output of a Computational Fluid Dynamic (CFD) simulation),
211
- you can use the weighted inner product formulation (refer to `examples/ex_05_nonUniform_POD.py`).
212
-
213
- .. code-block:: python
214
-
215
- from modulo_vki import ModuloVKI
216
- import numpy as np
217
-
218
- # Create a random dataset
219
- D = np.random.rand(100, 1000)
220
-
221
- # Get the area of the grid
222
- a_dataSet = gridData.compute_cell_sizes()
223
- area = a_dataSet['Area']
224
-
225
- # Compute weights
226
- areaTot = np.sum(area)
227
- weights = area/areaTot # sum should be equal to 1
228
-
229
- # Initialize the ModuloVKI object
230
- m = ModuloVKI(D, weights=weights)
231
-
232
- # Compute the POD decomposition
233
- phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
234
-
235
-
236
-
237
- Community guidelines
238
- ---------------------
239
-
240
- Contributing to MODULO
241
- ^^^^^^^^^^^^^^^^^^^^^^^
242
- We welcome contributions to MODULO. To create a new feature, please submit a pull request, specifying the proposed changes and
243
- providing an example of how to use the new feature (that will be included in the `examples/` folder).
244
-
245
- The pull request will be reviewed by the MODULO team before being merged into the main branch, and your contribution duly acknowledged.
246
-
247
- Report bugs
248
- ^^^^^^^^^^^^
249
- If you find a bug, or you encounter unexpected behaviour, please open an issue on the MODULO GitHub repository.
250
-
251
- Ask for help
252
- ^^^^^^^^^^^^
253
-
254
- Citation
255
- ---------
256
- If you use MODULO in your research, please cite it as follows:
257
-
258
- ``Ninni, D., & Mendez, M. A. (2020). MODULO: A software for Multiscale Proper Orthogonal Decomposition of data. SoftwareX, 12, 100622.``
259
-
260
- .. code-block:: text
261
-
262
- @article{ninni2020modulo,
263
- title={MODULO: A software for Multiscale Proper Orthogonal Decomposition of data},
264
- author={Ninni, Davide and Mendez, Miguel A},
265
- journal={SoftwareX},
266
- volume={12},
267
- pages={100622},
268
- year={2020},
269
- publisher={Elsevier}
270
- }
271
-
272
- We are currently working on a Journal of Open Source article that will be available soon.
273
-
274
- References
275
- ----------
276
-
277
- - Mendez, Miguel Alfonso. "Statistical Treatment, Fourier and Modal Decomposition." arXiv preprint arXiv:2201.03847 (2022).
278
- - Mendez, M. A. (2023) "Generalized and Multiscale Modal Analysis". In : Mendez M.A., Ianiro, A., Noack, B.R., Brunton, S. L. (Eds),
279
- "Data-Driven Fluid Mechanics: Combining First Principles and Machine Learning". Cambridge University Press, 2023:153-181.
280
- https://doi.org/10.1017/9781108896214.013. The pre-print is available at https://arxiv.org/abs/2208.12630.
281
- - Ninni, Davide, and Miguel A. Mendez. "MODULO: A software for Multiscale Proper Orthogonal Decomposition of data." SoftwareX 12 (2020): 100622.
282
- - Mendez, Miguel A. "Linear and nonlinear dimensionality reduction from fluid mechanics to machine learning." Measurement Science and Technology 34.4 (2023): 042001.
283
- - Briggs, William L., and Van Emden Henson. The DFT: an owner's manual for the discrete Fourier transform. Society for Industrial and Applied Mathematics, 1995.
284
- - Berkooz, Gal, Philip Holmes, and John L. Lumley. "The proper orthogonal decomposition in the analysis of turbulent flows." Annual review of fluid mechanics 25.1 (1993): 539-575.
285
- - Sirovich, Lawrence. "Turbulence and the dynamics of coherent structures. III. Dynamics and scaling." Quarterly of Applied mathematics 45.3 (1987): 583-590.
286
- - Mendez, M. A., M. Balabane, and J-M. Buchlin. "Multi-scale proper orthogonal decomposition of complex fluid flows." Journal of Fluid Mechanics 870 (2019): 988-1036.
287
- - Schmid, Peter J. "Dynamic mode decomposition of numerical and experimental data." Journal of fluid mechanics 656 (2010): 5-28.
288
- - Sieber, Moritz, C. Oliver Paschereit, and Kilian Oberleithner. "Spectral proper orthogonal decomposition." Journal of Fluid Mechanics 792 (2016): 798-828.
289
- - Towne, Aaron, Oliver T. Schmidt, and Tim Colonius. "Spectral proper orthogonal decomposition and its relationship to dynamic mode decomposition and resolvent analysis." Journal of Fluid Mechanics 847 (2018): 821-867.
290
- - Mika, Sebastian, et al. "Kernel PCA and de-noising in feature spaces." Advances in neural information processing systems 11 (1998).
291
-
292
- Related projects
293
- ----------------
294
- MODULO encapsulates a wide range of decomposition techniques, but not all of them. We refer to the project below for an additional set of decomposition techniques:
295
-
296
- - ModRed, https://github.com/belson17/modred
297
-
298
- There are also decomposition-specific projects, some of which are listed below:
299
-
300
- - Rogowski, Marcin, Brandon CY Yeung, Oliver T. Schmidt, Romit Maulik, Lisandro Dalcin, Matteo Parsani, and Gianmarco Mengaldo. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
301
- - Lario, A., Maulik, R., Schmidt, O.T., Rozza, G. and Mengaldo, G., 2022. Neural-network learning of SPOD latent dynamics. Journal of Computational Physics, 468, p.111475.
302
- - Ichinaga, Andreuzzi, Demo, Tezzele, Lapo, Rozza, Brunton, Kutz. PyDMD: A Python package for robust dynamic mode decomposition. arXiv preprint, 2024.
303
- - Rogowski, Marcin, et al. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
304
-
1
+ Metadata-Version: 2.1
2
+ Name: modulo_vki
3
+ Version: 2.0.7
4
+ Summary: MODULO (MODal mULtiscale pOd) is a software developed at the von Karman Institute to perform Multiscale Modal Analysis of numerical and experimental data.
5
+ Home-page: https://github.com/mendezVKI/MODULO/tree/master/modulo_python_package/
6
+ Author: ['R. Poletti', 'L. Schena', 'D. Ninni', 'M. A. Mendez']
7
+ Author-email: mendez@vki.ac.be
8
+ License: BSD (3-clause)
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Natural Language :: English
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: tqdm
16
+ Requires-Dist: numpy
17
+ Requires-Dist: scipy
18
+ Requires-Dist: scikit-learn
19
+ Requires-Dist: ipykernel
20
+ Requires-Dist: ipython
21
+ Requires-Dist: ipython-genutils
22
+ Requires-Dist: ipywidgets
23
+ Requires-Dist: matplotlib
24
+
25
+
26
+
27
+ MODULO: a python toolbox for data-driven modal decomposition
28
+ -----------------------------------------------------------
29
+
30
+ .. image:: https://readthedocs.org/projects/modulo/badge/?version=latest
31
+ :target: https://modulo.readthedocs.io/en/latest/?badge=latest
32
+ :alt: Documentation Status
33
+
34
+ .. raw:: html
35
+
36
+ <div style="text-align: center;">
37
+ <img src="https://modulo.readthedocs.io/en/latest/_images/modulo_logo.png" alt="Modulo Logo" width="500"/>
38
+ </div>
39
+
40
+ **MODULO** is a modal decomposition package developed at the von Karman Institute for Fluid Dynamics (VKI).
41
+ It offers a wide range of decomposition techniques, enabling users to select the most suitable method based
42
+ on the specific physics of their problem and their desired outcomes. MODULO can natively handle large
43
+ datasets efficiently, featuring a memory-saving option that partitions the data and computes the decomposition in
44
+ chunks (ninni2020modulo). Additionally, it supports non-uniform meshes through its weighted inner product formulation.
45
+
46
+ While the discontinued MATLAB version of MODULO (ninni2020modulo) is accessible in the “Old_Matlab_Implementation” branch,
47
+ it is no longer maintained. The latest decomposition techniques are exclusively available in the current Python version.
48
+
49
+ As a part of the MODULO project, we provide a series of lectures on data-driven modal decomposition, and its applications.
50
+ These are available at the `MODULO YouTube channel <https://www.youtube.com/@modulompod5682>`_.
51
+
52
+
53
+ .. contents:: Table of contents
54
+
55
+ Modal decompositions
56
+ --------------------
57
+ Modal decompositions aim to describe the data as a linear combination of *modes*, obtained by projecting the data
58
+ onto a suitable set of basis. For instance, consider a matrix $D(x, t)$, where $x$ and $t$ are the spatial and temporal
59
+ coordinates, respectively, the modal decomposition can be written as:
60
+
61
+ $D(x_i, t_k) = \\phi(x_i) \\Sigma \\psi(t_k)^T$
62
+
63
+ where $\\phi(x_i)$ is the spatial basis, $\\psi(t_k)$ is the temporal basis, and $\\Sigma$ is the modal coefficients.
64
+ Different decompositions employ different basis, such as prescribed Fourier basis ($\\psi_\\mathcal{F}$) for
65
+ the Discrete Fourier Transform (DFT), or data-driven basis, i.e. tailored on the dataset at hand,
66
+ for the Proper Orthogonal Decomposition (POD).
67
+
68
+ We refer to (mendez2022statistical, mendez2022generalizedmultiscalemodalanalysis, Mendez_2023) for an introduction to the topic.
69
+
70
+ MODULO currently features the following decompositions:
71
+ - Discrete Fourier Transform (DFT) (briggs1995dft)
72
+ - Proper Orthogonal Decomposition (POD) (sirovich1987turbulence, berkooz1993proper)
73
+ - Multi-Scale Proper Orthogonal Decomposition (mPOD) (mendez2019multi)
74
+ - Dynamic Mode Decomposition (DMD) (schmid2010dynamic)
75
+ - Spectral Proper Orthogonal Decomposition (SPOD) (csieber2016spectral, towne2018spectral), note that the two are
76
+ different formulations, and both are available in MODULO.
77
+ - Kernel Proper Orthogonal Decomposition (KPOD) (mika1998kernel)
78
+
79
+ We remind the curious reader to the respective references for a detailed description of each decomposition, and to the
80
+ documentation for a practical guide on how to use them in MODULO.
81
+
82
+
83
+ Release Notes
84
+ -------------
85
+ The latest version of MODULO (v2.0) includes the following updates:
86
+
87
+ 1. **Faster EIG/SVD algorithms**, using powerful randomized svd solvers from scikit_learn
88
+ (see `here<https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html>`_
89
+ and `here <https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html>`_.)
90
+ It is now possible to select various options as "eig_solver" and "svd_solver",
91
+ offering different trade-offs in terms of accuracy vs computational time.
92
+
93
+ 2. **Computation the POD directly via SVD**, using any of the four "svd_solver" options.
94
+ This is generally faster but requires more memory.
95
+
96
+ 1. **Faster subscale estimators for the mPOD:** the previous version used the rank of the correlation matrix in each scale to define
97
+ the number of modes to be computed in each portion of the splitting vector before assembling the full basis.
98
+ This is computationally very demanding. This estimation has been replaced by a
99
+ frequency-based threshold (i.e. based on the frequency bins within each portion) since one can show that the
100
+ frequency-based estimator is always more "conservative" than the rank-based estimator.
101
+
102
+ 1. **Major improvement on the memory saving option**: the previous version of modulo always required in input the matrix D.
103
+ Then, if the memory saving option was active, the matrix was partitioned and stored locally to free the RAM before computing the
104
+ correlation matrix (see [this tutorial by D. Ninni](https://www.youtube.com/watch?v=LclxO1WTuao)).
105
+ In the new version, it is possible to initialize a modulo object *without* the matrix D (see exercise 5 in the examples).
106
+ Instead, one can create the partitions without loading the matrix D.
107
+
108
+ 1. **Implementation of Dynamic Mode Decomposition (DMD)** from (Schmid, P.J 2010)
109
+
110
+ 2. **Implementation of the two Spectral POD formulations**, namely the one from (Sieber et al 2016),
111
+ and the one from (Towne et al 2018).
112
+
113
+ 3. **Implementation of a kernel version of the POD**, in which the correlation matrix is replaced by a kernel matrix.
114
+ This is described in Lecture 15 of the course `Hands on Machine Learning for Fluid dynamics 2023 <https://www.vki.ac.be/index.php/events-ls/events/eventdetail/552/-/online-on-site-hands-on-machine-learning-for-fluid-dynamics-2023>`_.
115
+ We refer also to: `https://arxiv.org/abs/2208.07746`.
116
+
117
+ 1. **Implementation of a formulation for non-uniform meshes**, using a weighted matrix for all the relevant inner products.
118
+ This is currently available only for POD and mPOD but allows for handling data produced from CFD simulation without resampling on a uniform grid (see exercise 4).
119
+ It can be used both with and without the memory-saving option.
120
+
121
+
122
+ Installation
123
+ -------------
124
+
125
+ Installation via pip
126
+ ^^^^^^^^^^^^^^^^^^^^
127
+
128
+ You can access the latest update of the modulo python package on PyPI using the command line:
129
+
130
+ .. code-block:: bash
131
+
132
+ $ pip install modulo_vki
133
+
134
+ Installation from source
135
+ ^^^^^^^^^^^^^^^^^^^^^^^^
136
+
137
+ Alternatively, you can clone the repository and install the package locally:
138
+
139
+ .. code-block:: bash
140
+
141
+ $ git clone https://github.com/mendezVKI/MODULO.git
142
+
143
+ $ cd MODULO
144
+
145
+ $ python setup.py install
146
+
147
+ or, if you have pip installed in your environment,
148
+
149
+ .. code-block:: bash
150
+
151
+ $ pip install .
152
+
153
+
154
+ Documentation
155
+ -------------
156
+
157
+ The documentation of MODULO is available `here <https://modulo.readthedocs.io/en/latest/intro.html>`_. It
158
+ contains a comprehensive guide on how to install and use the package, as well as a detailed description of the
159
+ decompositions required inputs and outputs. A `list of YouTube videos<https://www.youtube.com/@modulompod5682>`_
160
+ is also available to guide the introduce the user to modal decomposition and MODULO.
161
+
162
+ Example
163
+ -------------
164
+
165
+ Example 1: POD decomposition
166
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
+
168
+ The following example illustrates how to decompose a data set (D) using the POD decomposition.
169
+
170
+ .. code-block:: python
171
+
172
+ from modulo_vki import ModuloVKI
173
+ import numpy as np
174
+
175
+ # Create a random dataset
176
+ D = np.random.rand(100, 1000)
177
+
178
+ # Initialize the ModuloVKI object
179
+ m = ModuloVKI(D)
180
+
181
+ # Compute the POD decomposition
182
+ phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
183
+
184
+ which returns the spatial basis ($\phi$), the temporal basis ($\psi$), and the modal
185
+ amplitudes ($\Sigma$) of the POD decomposition.
186
+
187
+ Example 2: Memory Saving option
188
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189
+
190
+ For the Memory Saving option, MODULO decomposes $D$ in `N_partitions`, defined
191
+ by the user (refer to `examples/ex_04_Memory_Saving.py`).
192
+
193
+ .. code-block:: python
194
+
195
+ from modulo_vki import ModuloVKI
196
+ import numpy as np
197
+
198
+ # Create a random dataset
199
+ D = np.random.rand(100, 1000)
200
+
201
+ # Initialize the ModuloVKI object
202
+ m = ModuloVKI(D, N_PARTITIONS=10)
203
+
204
+ # Compute the POD decomposition
205
+ phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
206
+
207
+ Example 3: non-uniform grid
208
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209
+
210
+ If you are dealing with non-uniform grid (e.g. output of a Computational Fluid Dynamic (CFD) simulation),
211
+ you can use the weighted inner product formulation (refer to `examples/ex_05_nonUniform_POD.py`).
212
+
213
+ .. code-block:: python
214
+
215
+ from modulo_vki import ModuloVKI
216
+ import numpy as np
217
+
218
+ # Create a random dataset
219
+ D = np.random.rand(100, 1000)
220
+
221
+ # Get the area of the grid
222
+ a_dataSet = gridData.compute_cell_sizes()
223
+ area = a_dataSet['Area']
224
+
225
+ # Compute weights
226
+ areaTot = np.sum(area)
227
+ weights = area/areaTot # sum should be equal to 1
228
+
229
+ # Initialize the ModuloVKI object
230
+ m = ModuloVKI(D, weights=weights)
231
+
232
+ # Compute the POD decomposition
233
+ phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
234
+
235
+
236
+
237
+ Community guidelines
238
+ ---------------------
239
+
240
+ Contributing to MODULO
241
+ ^^^^^^^^^^^^^^^^^^^^^^^
242
+ We welcome contributions to MODULO. To create a new feature, please submit a pull request, specifying the proposed changes and
243
+ providing an example of how to use the new feature (that will be included in the `examples/` folder).
244
+
245
+ The pull request will be reviewed by the MODULO team before being merged into the main branch, and your contribution duly acknowledged.
246
+
247
+ Report bugs
248
+ ^^^^^^^^^^^^
249
+ If you find a bug, or you encounter unexpected behaviour, please open an issue on the MODULO GitHub repository.
250
+
251
+ Ask for help
252
+ ^^^^^^^^^^^^
253
+
254
+ Citation
255
+ ---------
256
+ If you use MODULO in your research, please cite it as follows:
257
+
258
+ ``Ninni, D., & Mendez, M. A. (2020). MODULO: A software for Multiscale Proper Orthogonal Decomposition of data. SoftwareX, 12, 100622.``
259
+
260
+ .. code-block:: text
261
+
262
+ @article{ninni2020modulo,
263
+ title={MODULO: A software for Multiscale Proper Orthogonal Decomposition of data},
264
+ author={Ninni, Davide and Mendez, Miguel A},
265
+ journal={SoftwareX},
266
+ volume={12},
267
+ pages={100622},
268
+ year={2020},
269
+ publisher={Elsevier}
270
+ }
271
+
272
+ We are currently working on a Journal of Open Source article that will be available soon.
273
+
274
+ References
275
+ ----------
276
+
277
+ - Mendez, Miguel Alfonso. "Statistical Treatment, Fourier and Modal Decomposition." arXiv preprint arXiv:2201.03847 (2022).
278
+ - Mendez, M. A. (2023) "Generalized and Multiscale Modal Analysis". In : Mendez M.A., Ianiro, A., Noack, B.R., Brunton, S. L. (Eds),
279
+ "Data-Driven Fluid Mechanics: Combining First Principles and Machine Learning". Cambridge University Press, 2023:153-181.
280
+ https://doi.org/10.1017/9781108896214.013. The pre-print is available at https://arxiv.org/abs/2208.12630.
281
+ - Ninni, Davide, and Miguel A. Mendez. "MODULO: A software for Multiscale Proper Orthogonal Decomposition of data." SoftwareX 12 (2020): 100622.
282
+ - Mendez, Miguel A. "Linear and nonlinear dimensionality reduction from fluid mechanics to machine learning." Measurement Science and Technology 34.4 (2023): 042001.
283
+ - Briggs, William L., and Van Emden Henson. The DFT: an owner's manual for the discrete Fourier transform. Society for Industrial and Applied Mathematics, 1995.
284
+ - Berkooz, Gal, Philip Holmes, and John L. Lumley. "The proper orthogonal decomposition in the analysis of turbulent flows." Annual review of fluid mechanics 25.1 (1993): 539-575.
285
+ - Sirovich, Lawrence. "Turbulence and the dynamics of coherent structures. III. Dynamics and scaling." Quarterly of Applied mathematics 45.3 (1987): 583-590.
286
+ - Mendez, M. A., M. Balabane, and J-M. Buchlin. "Multi-scale proper orthogonal decomposition of complex fluid flows." Journal of Fluid Mechanics 870 (2019): 988-1036.
287
+ - Schmid, Peter J. "Dynamic mode decomposition of numerical and experimental data." Journal of fluid mechanics 656 (2010): 5-28.
288
+ - Sieber, Moritz, C. Oliver Paschereit, and Kilian Oberleithner. "Spectral proper orthogonal decomposition." Journal of Fluid Mechanics 792 (2016): 798-828.
289
+ - Towne, Aaron, Oliver T. Schmidt, and Tim Colonius. "Spectral proper orthogonal decomposition and its relationship to dynamic mode decomposition and resolvent analysis." Journal of Fluid Mechanics 847 (2018): 821-867.
290
+ - Mika, Sebastian, et al. "Kernel PCA and de-noising in feature spaces." Advances in neural information processing systems 11 (1998).
291
+
292
+ Related projects
293
+ ----------------
294
+ MODULO encapsulates a wide range of decomposition techniques, but not all of them. We refer to the project below for an additional set of decomposition techniques:
295
+
296
+ - ModRed, https://github.com/belson17/modred
297
+
298
+ There are also decomposition-specific projects, some of which are listed below:
299
+
300
+ - Rogowski, Marcin, Brandon CY Yeung, Oliver T. Schmidt, Romit Maulik, Lisandro Dalcin, Matteo Parsani, and Gianmarco Mengaldo. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
301
+ - Lario, A., Maulik, R., Schmidt, O.T., Rozza, G. and Mengaldo, G., 2022. Neural-network learning of SPOD latent dynamics. Journal of Computational Physics, 468, p.111475.
302
+ - Ichinaga, Andreuzzi, Demo, Tezzele, Lapo, Rozza, Brunton, Kutz. PyDMD: A Python package for robust dynamic mode decomposition. arXiv preprint, 2024.
303
+ - Rogowski, Marcin, et al. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
304
+