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
Antariksh Dicholkar
WindEnergyToolbox
Commits
9f95a525
Commit
9f95a525
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
prepost.hawcstab2: add support for 3 set (real_eig) cmb file reading
parent
3a31fb84
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/prepost/hawcstab2.py
+16
-6
16 additions, 6 deletions
wetb/prepost/hawcstab2.py
wetb/prepost/tests/test_hawcstab2.py
+6
-2
6 additions, 2 deletions
wetb/prepost/tests/test_hawcstab2.py
with
22 additions
and
8 deletions
wetb/prepost/hawcstab2.py
+
16
−
6
View file @
9f95a525
...
...
@@ -121,17 +121,25 @@ class results(object):
return
ReadFileHAWCStab2Header
(
fname
)
def
load_cmb
(
self
,
fname
):
cmb
=
np
.
loadtxt
(
fname
)
# aero-(servo)-elastic results for HS2>=2.14 have real_eig as 3th set
with
open
(
fname
)
as
f
:
header
=
f
.
readline
().
replace
(
'
\n
'
,
''
)
cmb
=
np
.
loadtxt
(
f
)
# first column header has the units of the type of opearing points
cols
=
misc
.
remove_items
(
header
.
split
(
'
]
'
)[
1
].
split
(
'
'
),
''
)
nrmodes
=
np
.
array
([
int
(
k
)
for
k
in
cols
]).
max
()
# when there is only data for one operating condition we only have one
# row and consequently only a 1D array
if
len
(
cmb
.
shape
)
==
1
:
cmb
=
cmb
.
reshape
(
(
1
,
cmb
.
shape
[
0
])
)
wind
=
cmb
[:,
0
]
ii
=
int
((
cmb
.
shape
[
1
]
-
1
)
/
2
)
freq
=
cmb
[:,
1
:
ii
+
1
]
damp
=
cmb
[:,
ii
+
1
:]
freq
=
cmb
[:,
1
:
nrmodes
+
1
]
damp
=
cmb
[:,
nrmodes
+
1
:
nrmodes
*
2
+
1
]
real_eig
=
None
if
cmb
.
shape
[
1
]
>
nrmodes
*
2
+
1
:
real_eig
=
cmb
[:,
nrmodes
*
2
+
1
:]
return
wind
,
freq
,
damp
return
wind
,
freq
,
damp
,
real_eig
def
load_cmb_df
(
self
,
fname
):
# index name can be rotor speed or wind speed
...
...
@@ -141,13 +149,15 @@ class results(object):
oper_name
=
oper_name
.
replace
(
'
'
,
''
).
replace
(
'
[
'
,
'
_
'
)[:
-
1
]
oper_name
=
oper_name
.
replace
(
'
/
'
,
''
)
speed
,
freq
,
damp
=
self
.
load_cmb
(
fname
)
speed
,
freq
,
damp
,
real_eig
=
self
.
load_cmb
(
fname
)
mods
=
freq
.
shape
[
1
]
ops
=
freq
.
shape
[
0
]
df
=
pd
.
DataFrame
(
columns
=
[
oper_name
,
'
Fd_hz
'
,
'
damp_ratio
'
,
'
mode
'
])
df
[
'
Fd_hz
'
]
=
freq
.
flatten
()
df
[
'
damp_ratio
'
]
=
damp
.
flatten
()
if
real_eig
is
not
None
:
df
[
'
real_eig
'
]
=
real_eig
.
flatten
()
# now each mode number is a row so that means that each operating
# point is now repeated as many times as there are modes
df
[
oper_name
]
=
speed
.
repeat
(
mods
)
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/tests/test_hawcstab2.py
+
6
−
2
View file @
9f95a525
...
...
@@ -31,13 +31,17 @@ class Tests(unittest.TestCase):
def
test_cmb_df
(
self
):
fname1
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data/campbell_diagram.cmb
'
)
speed
,
freq
,
damp
=
results
().
load_cmb
(
fname1
)
speed
,
freq
,
damp
,
real_eig
=
results
().
load_cmb
(
fname1
)
self
.
assertIsNone
(
real_eig
)
df
=
results
().
load_cmb_df
(
fname1
)
#
mods = freq.shape[1]
mods
=
freq
.
shape
[
1
]
ops
=
freq
.
shape
[
0
]
self
.
assertEqual
(
len
(
speed
),
ops
)
self
.
assertEqual
(
ops
,
22
)
self
.
assertEqual
(
mods
,
10
)
for
k
in
range
(
ops
):
df_oper
=
df
[
df
[
'
wind_ms
'
]
==
speed
[
k
]]
...
...
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