Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
739e470e
Commit
739e470e
authored
4 months ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
use scipy find_peaks instead of wafo
parent
f1294728
No related branches found
No related tags found
1 merge request
!288
remove wafo dependency
Pipeline
#68868
passed with warnings
4 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyproject.toml
+2
-2
2 additions, 2 deletions
pyproject.toml
wetb/prepost/mplutils.py
+10
-12
10 additions, 12 deletions
wetb/prepost/mplutils.py
with
12 additions
and
14 deletions
pyproject.toml
+
2
−
2
View file @
739e470e
...
...
@@ -43,8 +43,8 @@ documentation = "https://toolbox.pages.windenergy.dtu.dk/WindEnergyToolbox/"
[project.optional-dependencies]
prepost
=
[
"openpyxl"
,
"tables"
,
"wafo=
=
0.1
.
2
",
"
xlwt
", "
Cython
"]
all
=
[
"openpyxl"
,
"tables"
,
"wafo=
=
0.1
.
2
",
"
xlwt
", "
Cython
", "
paramiko
", "
sshtunnel
", 'pytest', 'mock', 'click']
prepost
=
[
"openpyxl"
,
"tables"
,
"xlwt"
,
"Cython"
]
all
=
[
"openpyxl"
,
"tables"
,
"xlwt"
,
"Cython"
,
"paramiko"
,
"sshtunnel"
,
'pytest'
,
'mock'
,
'click'
]
[tool.setuptools_scm]
version_scheme
=
"no-guess-dev"
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/mplutils.py
+
10
−
12
View file @
739e470e
...
...
@@ -6,16 +6,13 @@ Created on Wed Nov 23 11:22:50 2011
"""
# external libraries
import
numpy
as
np
from
scipy.signal
import
find_peaks
import
matplotlib
as
mpl
from
matplotlib.figure
import
Figure
# use a headless backend
from
matplotlib.backends.backend_agg
import
FigureCanvasAgg
as
FigCanvas
# wafo is an optional dependency only required for non default PSD peak marking
try
:
import
wafo
except
ImportError
:
pass
# from matplotlib.backends.backend_agg import FigureCanvasAgg as FigCanvas
def
make_fig
(
nrows
=
1
,
ncols
=
1
,
figsize
=
(
12
,
8
),
dpi
=
120
):
...
...
@@ -221,20 +218,21 @@ def peaks(ax, freqs, Pxx, fn_max, min_h, nr_peaks=15, min_p=0, col_line='k',
Pxx
=
Pxx
[:
i_fn_max
]
Pxx_log
=
10.
*
np
.
log10
(
Pxx
)
try
:
pi
=
wafo
.
misc
.
findpeaks
(
Pxx_log
,
n
=
len
(
Pxx
),
min_h
=
min_h
,
min_p
=
min_p
)
# pi = wafo.misc.findpeaks(Pxx_log, n=len(Pxx), min_h=min_h, min_p=min_p)
pi
,
pi_props
=
find_peaks
(
Pxx_log
,
height
=
Pxx_log
.
min
(),
prominence
=
(
20
,
None
))
if
verbose
:
print
(
'
len Pxx
'
,
len
(
Pxx_log
),
'
nr of peaks:
'
,
len
(
pi
))
except
Exception
as
e
:
if
verbose
:
print
(
'
len Pxx
'
,
len
(
Pxx_log
))
print
(
'
*** wafo.misc.findpeaks FAILED ***
'
)
#
print('*** wafo.misc.findpeaks FAILED ***')
print
(
e
)
return
ax
# only take the nr_peaks most significant heights
pi
=
pi
[:
nr_peaks
]
# and sort them accoriding to frequency (or index)
pi
.
sort
()
#
#
only take the nr_peaks most significant heights
#
pi = pi[:nr_peaks]
#
#
and sort them accoriding to frequency (or index)
#
pi.sort()
# mark the peaks with a circle
# ax.plot(freqs[pi], Pxx[:xlim][pi], 'o')
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment