Skip to content

Commit 8c872d7

Browse files
Merge pull request #163 from ArnauMiro/162_compiled_docs
162 compiled docs
2 parents 881c7ea + 1d7aca5 commit 8c872d7

File tree

3 files changed

+40
-42
lines changed

3 files changed

+40
-42
lines changed

Diff for: .github/workflows/deploy_documentation.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ jobs:
4040
run: |
4141
sed -i 's/USE_MKL = ON/USE_MKL = OFF/g' options.cfg
4242
sed -i 's/FORCE_GCC = OFF/FORCE_GCC = ON/g' options.cfg
43+
sed -i 's/USE_COMPILED = ON/USE_COMPILED = OFF/g' options.cfg
4344
- name: Fix h5py
4445
run: |
4546
sudo apt install libhdf5-mpi-dev
4647
CC=mpicc HDF5_MPI="ON" pip install --no-binary=h5py h5py
4748
- name: Set up dependencies
4849
run: make deps requirements_full
49-
- name: Build compiled code
50-
run: make python
5150
- name: Install
5251
run: make install
5352
- name: Install sphinx dependencies

Diff for: pyLOM/POD/wrapper.pyx

+31-30
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,19 @@ def _drun(double[:,:] X, int remove_mean, int randomized, int r, int q, int seed
135135
@cython.nonecheck(False)
136136
@cython.cdivision(True) # turn off zero division check
137137
def run(real[:,:] X, int remove_mean=True, int randomized=False, const int r=1, const int q=3, const int seed=-1):
138-
'''
139-
Run POD analysis of a matrix X.
138+
r'''
139+
Run POD analysis of a matrix.
140140
141-
Inputs:
142-
- X[ndims*nmesh,n_temp_snapshots]: data matrix
143-
- remove_mean: whether or not to remove the mean flow
141+
Args:
142+
X (np.ndarray): data matrix of size [ndims*nmesh,n_temp_snapshots].
143+
remove_mean (bool, optional): whether or not to remove the mean flow (default: ``True``).
144+
randomized (bool, optional): whether to perform randomized POD or not (default: ``False``).
145+
r (int, optional): in case of performing randomized POD, how many modes do we want to recover. This option has no effect when randomized=False (default: ``1``).
146+
q (int, optional): in case of performing randomized POD, how many power iterations are performed. This option has no effect when randomized=False (default: ``3``).
147+
seed (int, optional): seed for reproducibility of randomized operations. This option has no effect when randomized=False (default: ``-1``).
144148
145149
Returns:
146-
- U: are the POD modes.
147-
- S: are the singular values.
148-
- V: are the right singular vectors.
150+
[(np.ndarray), (np.ndarray), (np.ndarray)]: POD spatial modes (left singular vectors), singular values and temporal coefficients (right singular vectors).
149151
'''
150152
seed = <int>time(NULL) if seed < 0 else seed
151153
if real is double:
@@ -234,23 +236,22 @@ def _dtruncate(double[:,:] U, double[:] S, double[:,:] V, double r):
234236
@cython.nonecheck(False)
235237
@cython.cdivision(True) # turn off zero division check
236238
def truncate(real[:,:] U, real[:] S, real[:,:] V, real r=1e-8):
237-
'''
238-
Truncate POD matrices (U,S,V) given a residual r.
239-
240-
Inputs:
241-
- U(m,n) are the POD modes.
242-
- S(n) are the singular values.
243-
- V(n,n) are the right singular vectors.
244-
- r target residual, number of modes, or cumulative energy threshold.
245-
* If r >= 1, it is treated as the number of modes.
246-
* If r < 1 and r > 0 it is treated as the residual target.
247-
* If r < 1 and r < 0 it is treated as the fraction of cumulative energy to retain.
248-
Note: must be in (0,-1] and r = -1 is valid
239+
r'''
240+
Truncate POD matrices (U, S, V) given a residual, number of modes or cumulative energy r.
241+
242+
Args:
243+
U (np.ndarray): of size (m,n), are the POD modes.
244+
S (np.ndarray): of size (n), are the singular values.
245+
V (np.ndarray): of size (n,n), are the right singular vectors.
246+
r (float, optional) target residual, number of modes, or cumulative energy threshold (default: ``1e-8``).
247+
* If r >= 1, it is treated as the number of modes.
248+
* If r < 1 and r > 0 it is treated as the residual target.
249+
* If r < 1 and r < 0 it is treated as the fraction of cumulative energy to retain.
250+
Note: must be in (0,-1] and r = -1 is valid
249251
250252
Returns:
251-
- U(m,N) are the POD modes (truncated at N).
252-
- S(N) are the singular values (truncated at N).
253-
- V(N,n) are the right singular vectors (truncated at N).
253+
[(np.array), (np.array), (np.array)]: Truncated POD spatial modes (left singular vectors), singular values and temporal coefficients (right singular vectors).
254+
254255
'''
255256
if real is double:
256257
return _dtruncate(U,S,V,r)
@@ -334,19 +335,19 @@ def _dreconstruct(double[:,:] U, double[:] S, double[:,:] V):
334335
@cython.nonecheck(False)
335336
@cython.cdivision(True) # turn off zero division check
336337
def reconstruct(real[:,:] U, real[:] S, real[:,:] V):
337-
'''
338+
r'''
338339
Reconstruct the flow given the POD decomposition matrices
339340
that can be possibly truncated.
340341
N is the truncated size
341342
n is the number of snapshots
342343
343-
Inputs:
344-
- U(m,N) are the POD modes.
345-
- S(N) are the singular values.
346-
- V(N,n) are the right singular vectors.
344+
Args:
345+
U (np.ndarray): of size (m,n), are the POD modes.
346+
S (np.ndarray): of size (n), are the singular values.
347+
V (np.ndarray): of size (n,n), are the right singular vectors.
347348
348-
Outputs
349-
- X(m,n) is the reconstructed flow.
349+
Returns:
350+
(np.array): Reconstructed flow.
350351
'''
351352
if real is double:
352353
return _dreconstruct(U,S,V)

Diff for: pyLOM/SPOD/wrapper.pyx

+8-10
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,18 @@ def _drun(double[:,:] X, double[:] t, int nDFT, int nolap, int remove_mean):
430430
@cython.nonecheck(False)
431431
@cython.cdivision(True) # turn off zero division check
432432
def run(real[:,:] X, real[:] t, int nDFT=0, int nolap=0, int remove_mean=True):
433-
'''
433+
r'''
434434
Run SPOD analysis of a matrix X.
435435
436-
Inputs:
437-
- X[ndims*nmesh,nt]: data matrix
438-
- dt: timestep between adjacent snapshots
439-
- npwin: number of points in each window (0 will set default value: ~10% nt)
440-
- nolap: number of overlap points between windows (0 will set default value: 50% nwin)
441-
- remove_mean: whether or not to remove the mean flow
436+
Args:
437+
X (np.ndarray): data matrix.
438+
t (np.ndarray): times at which the snapshots of X were collected
439+
nDFT (int, optional): number of points in each window (0 will set default value: ~10% nt)
440+
nolap (int, optional): number of overlap points between windows (0 will set default value: 50% nwin)
441+
remove_mean (bool, optional): whether or not to remove the mean flow (default, ``True``)
442442
443443
Returns:
444-
- L: modal energy spectra.
445-
- P: SPOD modes, whose spatial dimensions are identical to those of X.
446-
- f: frequency vector.
444+
[(np.ndarray), (np.ndarray), (np.ndarray)]: where the first array is L, the modal energy spectra, the second array is P, SPOD modes, whose spatial dimensions are identical to those of X and finally f is the frequency vectors
447445
'''
448446
if real is double:
449447
return _drun(X,t,nDFT,nolap,remove_mean)

0 commit comments

Comments
 (0)