Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VILLASdataprocessing
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASdataprocessing
Commits
0ce21f35
Commit
0ce21f35
authored
6 years ago
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
dpsim: accept .real and .imag suffixes in complex CSV dataseries
parent
240b3a2e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dataprocessing/readtools.py
+30
-16
30 additions, 16 deletions
dataprocessing/readtools.py
with
30 additions
and
16 deletions
dataprocessing/readtools.py
+
30
−
16
View file @
0ce21f35
...
...
@@ -95,25 +95,39 @@ def read_timeseries_dpsim(filename, timeseries_names=None):
timestamps
=
pd_df
.
iloc
[:,
0
]
# Find real and complex variable names
real_string
=
'
_re
'
imaginary_string
=
'
_im
'
suffixes
=
[
(
'
_re
'
,
'
_im
'
),
(
'
.real
'
,
'
.imag
'
)
]
for
column
in
column_names
:
if
real_string
in
column
:
tmp
=
column
.
replace
(
real_string
,
''
)
cmpl_result_columns
.
append
(
tmp
)
#print("Found complex variable: " + tmp)
elif
not
imaginary_string
in
column
:
real_result_columns
.
append
(
column
)
#print("Found real variable: " + column)
for
column
in
real_result_columns
:
is_complex
=
False
for
suffix
in
suffixes
:
real_suffix
=
suffix
[
0
]
imag_suffix
=
suffix
[
1
]
if
column
.
endswith
(
imag_suffix
):
is_complex
=
True
break
# Ignore imag columns
if
column
.
endswith
(
real_suffix
):
is_complex
=
True
column_base
=
column
.
replace
(
real_suffix
,
''
)
if
column_base
+
imag_suffix
not
in
column_names
:
continue
cmpl_result_columns
.
append
(
column_base
)
timeseries_list
[
column_base
]
=
TimeSeries
(
column_base
,
timestamps
,
np
.
vectorize
(
complex
)(
pd_df
[
column_base
+
real_suffix
],
pd_df
[
column_base
+
imag_suffix
]
)
)
break
if
is_complex
:
continue
real_result_columns
.
append
(
column
)
timeseries_list
[
column
]
=
TimeSeries
(
column
,
timestamps
,
pd_df
[
column
])
for
column
in
cmpl_result_columns
:
timeseries_list
[
column
]
=
TimeSeries
(
column
,
timestamps
,
np
.
vectorize
(
complex
)(
pd_df
[
column
+
real_string
],
pd_df
[
column
+
imaginary_string
]))
else
:
# Read in specified time series
print
(
'
cannot read specified columns yet
'
)
...
...
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