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
46e9e900
Commit
46e9e900
authored
Feb 18, 2021
by
JOSSOUD Olivier
Browse files
Flow Processor. Misc.
parent
9963cce8
Pipeline
#105356
passed with stages
in 7 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
cfatools/processor/flow.py
cfatools/processor/flow.py
+8
-3
cfatools/tests/test_processor/test_flow.py
cfatools/tests/test_processor/test_flow.py
+0
-3
No files found.
cfatools/processor/flow.py
View file @
46e9e900
...
...
@@ -257,14 +257,19 @@ def get_datetime_out(datetime_in: pd.Series, mlmin_df: pd.DataFrame, tube_volume
-------
pd.Series
Date/time when the fluid of interest exists the tube.
"""
"""
# Convert Series to single-column Dataframe (it is easier to merge and apply)
datetime_in_df
=
pd
.
DataFrame
(
datetime_in
)
data_colname
=
datetime_in_df
.
columns
[
0
]
datetime_in_df
=
datetime_in_df
.
set_index
(
data_colname
,
drop
=
False
)
# Add events' datetime to pump's mlmin change datetime
mlmin_df
=
pd
.
merge
(
mlmin_df
,
datetime_in
,
left_index
=
True
,
right_index
=
True
,
how
=
"outer"
)
mlmin_df
=
pd
.
merge
(
mlmin_df
,
datetime_in
_df
,
left_index
=
True
,
right_index
=
True
,
how
=
"outer"
)
mlmin_df
=
mlmin_df
[[
"mlmin"
]].
ffill
()
mlmin_df
[
"ml_cumul"
]
=
pump
.
add_cumulated_volume
(
mlmin_df
[
"mlmin"
])
# Make sure the earliest datetime_in is after the first available ml_cumul
datetime_in
=
datetime_in
[
datetime_in
.
index
>=
mlmin_df
[
"ml_cumul"
].
dropna
().
index
[
0
]]
datetime_in
=
datetime_in
[
datetime_in
>=
mlmin_df
[
"ml_cumul"
].
dropna
().
index
[
0
]]
if
parallel
:
pandarallel
.
initialize
()
...
...
cfatools/tests/test_processor/test_flow.py
View file @
46e9e900
...
...
@@ -56,9 +56,6 @@ class TestFlow(TestCase):
"2021-01-01 00:11:00"
])
icecore_df
=
pd
.
DataFrame
({
'icecore_id'
:
icecore_id
,
'datetime_in'
:
datetime_in
})
icecore_df
.
set_index
(
"datetime_in"
,
inplace
=
True
)
icecore_df
[
"datetime_in"
]
=
icecore_df
.
index
icecore_df
[
"datetime_out"
]
=
flow
.
get_datetime_out
(
icecore_df
[
"datetime_in"
],
mlmin_df
,
tube_volume_ml
,
parallel
=
False
)
...
...
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