Commit 46e9e900 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Flow Processor. Misc.

parent 9963cce8
Pipeline #105356 passed with stages
in 7 minutes and 46 seconds
......@@ -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()
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment