Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CFA Analysis
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
JOSSOUD Olivier
CFA Analysis
Commits
3d64fd68
Commit
3d64fd68
authored
5 years ago
by
JOSSOUD Olivier
Browse files
Options
Downloads
Patches
Plain Diff
Instant_config_df: fill NAs with previous values, to match new CFA conductcalib setup.
parent
31a85d67
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dataprovider/conductcalibprovider.py
+16
-0
16 additions, 0 deletions
src/dataprovider/conductcalibprovider.py
with
16 additions
and
0 deletions
src/dataprovider/conductcalibprovider.py
+
16
−
0
View file @
3d64fd68
...
@@ -61,18 +61,34 @@ class CalibRun:
...
@@ -61,18 +61,34 @@ class CalibRun:
def
update_steps_df
(
self
):
def
update_steps_df
(
self
):
config_df
=
self
.
instant_config_df
.
copy
()
config_df
=
self
.
instant_config_df
.
copy
()
# From long to wide format
config_df
=
config_df
.
pivot
(
index
=
'
datetime
'
,
columns
=
'
name
'
,
values
=
'
value
'
)
config_df
=
config_df
.
pivot
(
index
=
'
datetime
'
,
columns
=
'
name
'
,
values
=
'
value
'
)
# Forward fill NAs. Values not changing are not recorded in instant_config_df, so fill with previous value.
config_df
=
config_df
.
fillna
(
method
=
'
ffill
'
)
# Compute step number for each line
config_df
[
"
step
"
]
=
np
.
arange
(
len
(
config_df
))
+
1
config_df
[
"
step
"
]
=
np
.
arange
(
len
(
config_df
))
+
1
# Set start/end datetime for each step
config_df
[
"
start_datetime
"
]
=
config_df
.
index
config_df
[
"
start_datetime
"
]
=
config_df
.
index
config_df
[
"
end_datetime
"
]
=
config_df
[
"
start_datetime
"
].
shift
(
-
1
)
config_df
[
"
end_datetime
"
]
=
config_df
[
"
start_datetime
"
].
shift
(
-
1
)
# For the last step, compute the end_datetime from expected length written in User-defined config file.
config_df
.
loc
[
config_df
.
index
[
-
1
],
'
end_datetime
'
]
=
\
config_df
.
loc
[
config_df
.
index
[
-
1
],
'
end_datetime
'
]
=
\
config_df
.
loc
[
config_df
.
index
[
-
1
],
'
start_datetime
'
]
\
config_df
.
loc
[
config_df
.
index
[
-
1
],
'
start_datetime
'
]
\
+
datetime
.
timedelta
(
seconds
=
int
(
self
.
user_config_df
.
loc
[
self
.
user_config_df
.
index
[
-
1
],
'
length_sec
'
]))
+
datetime
.
timedelta
(
seconds
=
int
(
self
.
user_config_df
.
loc
[
self
.
user_config_df
.
index
[
-
1
],
'
length_sec
'
]))
config_df
.
reset_index
(
drop
=
True
,
inplace
=
True
)
config_df
.
reset_index
(
drop
=
True
,
inplace
=
True
)
# Reshape: separate column for excite and headgain
config_df
=
pd
.
wide_to_long
(
config_df
,
[
"
excite
"
,
"
headgain
"
],
i
=
"
step
"
,
j
=
"
channel
"
,
sep
=
"
_
"
).
reset_index
()
config_df
=
pd
.
wide_to_long
(
config_df
,
[
"
excite
"
,
"
headgain
"
],
i
=
"
step
"
,
j
=
"
channel
"
,
sep
=
"
_
"
).
reset_index
()
# Add "stable" timeframe limit for each step, i.e. remove transition phases at the beginning/end of each step.
config_df
[
"
stable_start_datetime
"
]
=
config_df
[
"
start_datetime
"
]
+
datetime
.
timedelta
(
seconds
=
2
)
config_df
[
"
stable_start_datetime
"
]
=
config_df
[
"
start_datetime
"
]
+
datetime
.
timedelta
(
seconds
=
2
)
config_df
[
"
stable_end_datetime
"
]
=
config_df
[
"
end_datetime
"
]
-
datetime
.
timedelta
(
seconds
=
2
)
config_df
[
"
stable_end_datetime
"
]
=
config_df
[
"
end_datetime
"
]
-
datetime
.
timedelta
(
seconds
=
2
)
# Compute mean, standard deviation and validity for each step/channelComment
for
channel
in
range
(
1
,
6
):
for
channel
in
range
(
1
,
6
):
channel_config_df
=
config_df
[
config_df
[
"
channel
"
]
==
channel
].
copy
()
channel_config_df
=
config_df
[
config_df
[
"
channel
"
]
==
channel
].
copy
()
for
index
,
row
in
channel_config_df
.
iterrows
():
for
index
,
row
in
channel_config_df
.
iterrows
():
...
...
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