Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
JOSSOUD Olivier
CFA Tools
Commits
da8de1d1
Commit
da8de1d1
authored
Jan 18, 2022
by
JOSSOUD Olivier
Browse files
Collector. Re-number flask to have unique numbers, segregated by rack.
parent
95b51930
Pipeline
#157222
passed with stages
in 1 minute and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
cfatools/processor/collector.py
cfatools/processor/collector.py
+33
-0
No files found.
cfatools/processor/collector.py
0 → 100644
View file @
da8de1d1
"""
The collector processor module provides functions to manipulate collector's raw data.
"""
import
pandas
as
pd
def
renumber_flasks
(
collector_df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
if
"flask"
not
in
collector_df
.
columns
:
raise
ValueError
(
"The collector_df expected should have a 'flask' column"
)
# In the old numbering system, flasks were grouped by 50. Re-number them by 100
if
collector_df
.
index
[
0
]
<
pd
.
Timestamp
(
year
=
2021
,
month
=
12
,
day
=
16
,
tz
=
"UTC"
):
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
101
)
&
(
collector_df
[
"flask"
]
<=
148
)]
=
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
101
)
&
(
collector_df
[
"flask"
]
<=
148
)]
+
300
-
100
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
51
)
&
(
collector_df
[
"flask"
]
<=
98
)]
=
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
51
)
&
(
collector_df
[
"flask"
]
<=
98
)]
+
200
-
50
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
1
)
&
(
collector_df
[
"flask"
]
<=
48
)]
=
collector_df
.
loc
[(
collector_df
[
"flask"
]
>=
1
)
&
(
collector_df
[
"flask"
]
<=
48
)]
+
100
# Re-number the flasks of the 4th rack and followings.
collector_df
[
"cumcount"
]
=
collector_df
.
groupby
(
"flask"
).
cumcount
()
collector_df
[
"flask"
]
=
collector_df
[
"flask"
]
+
collector_df
[
"cumcount"
]
*
300
return
collector_df
if
__name__
==
'__main__'
:
from
cfatools.logreader.dataset
import
DatasetReader
dataset
=
DatasetReader
(
"/homel/ojossoud/_temp/data_cfa"
,
"20210826_ASUMA2016_6-1_sq"
)
# collector_df = dataset.get_timeseries("COLLECTR_instant")
# renumber_flasks(collector_df)
collector_df
=
dataset
.
get_timeseries
(
"COLLECTR_instant"
,
"flask"
)
collector_df
=
collector_df
.
rename
(
columns
=
{
"value"
:
"flask"
})
renumber_flasks
(
collector_df
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment