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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
wtlib
WindEnergyToolbox
Commits
7d628546
Commit
7d628546
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
suppress runtime warning for nanmean([]) in rainflowcount.py and fatigue.py
parent
de39dd1e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/fatigue_tools/fatigue.py
+7
-5
7 additions, 5 deletions
wetb/fatigue_tools/fatigue.py
wetb/fatigue_tools/rainflowcounting/rainflowcount.py
+2
-1
2 additions, 1 deletion
wetb/fatigue_tools/rainflowcounting/rainflowcount.py
with
9 additions
and
6 deletions
wetb/fatigue_tools/fatigue.py
+
7
−
5
View file @
7d628546
...
...
@@ -19,6 +19,7 @@ from __future__ import print_function
from
__future__
import
unicode_literals
from
__future__
import
absolute_import
from
future
import
standard_library
import
warnings
standard_library
.
install_aliases
()
import
numpy
as
np
from
wetb.fatigue_tools.rainflowcounting
import
rainflowcount
...
...
@@ -156,11 +157,12 @@ def cycle_matrix(signals, ampl_bins=10, mean_bins=10, rainflow_func=rainflow_win
if
isinstance
(
ampl_bins
,
int
):
ampl_bins
=
np
.
linspace
(
0
,
1
,
num
=
ampl_bins
+
1
)
*
ampls
[
weights
>
0
].
max
()
cycles
,
ampl_edges
,
mean_edges
=
np
.
histogram2d
(
ampls
,
means
,
[
ampl_bins
,
mean_bins
],
weights
=
weights
)
ampl_bin_sum
=
np
.
histogram2d
(
ampls
,
means
,
[
ampl_bins
,
mean_bins
],
weights
=
weights
*
ampls
)[
0
]
ampl_bin_mean
=
np
.
nanmean
(
ampl_bin_sum
/
np
.
where
(
cycles
,
cycles
,
np
.
nan
),
1
)
mean_bin_sum
=
np
.
histogram2d
(
ampls
,
means
,
[
ampl_bins
,
mean_bins
],
weights
=
weights
*
means
)[
0
]
mean_bin_mean
=
np
.
nanmean
(
mean_bin_sum
/
np
.
where
(
cycles
,
cycles
,
np
.
nan
),
1
)
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"
ignore
"
)
ampl_bin_sum
=
np
.
histogram2d
(
ampls
,
means
,
[
ampl_bins
,
mean_bins
],
weights
=
weights
*
ampls
)[
0
]
ampl_bin_mean
=
np
.
nanmean
(
ampl_bin_sum
/
np
.
where
(
cycles
,
cycles
,
np
.
nan
),
1
)
mean_bin_sum
=
np
.
histogram2d
(
ampls
,
means
,
[
ampl_bins
,
mean_bins
],
weights
=
weights
*
means
)[
0
]
mean_bin_mean
=
np
.
nanmean
(
mean_bin_sum
/
np
.
where
(
cycles
,
cycles
,
np
.
nan
),
1
)
cycles
=
cycles
/
2
# to get full cycles
return
cycles
,
ampl_bin_mean
,
ampl_edges
,
mean_bin_mean
,
mean_edges
...
...
This diff is collapsed.
Click to expand it.
wetb/fatigue_tools/rainflowcounting/rainflowcount.py
+
2
−
1
View file @
7d628546
...
...
@@ -64,7 +64,8 @@ def rainflow_windap(signal, levels=255., thresshold=(255 / 50)):
check_signal
(
signal
)
#type <double> is required by <find_extreme> and <rainflow>
signal
=
signal
.
astype
(
np
.
double
)
if
np
.
all
(
np
.
isnan
(
signal
)):
return
None
offset
=
np
.
nanmin
(
signal
)
signal
-=
offset
if
np
.
nanmax
(
signal
)
>
0
:
...
...
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