Closest Point Lookup

[1]:
# Import of necessary libraries
import pathlib
import detl
import numpy as np

Parsing and Accessing the Raw Data

Alternatively, instead of using pathlib.Path(), a filepath can be given as well (as a rawstring).

[ ]:
# Parsing of data file
path_to_file = pathlib.Path('..', 'tests', 'testfiles', 'v4_NT-WMB-2.Control.csv')
ddata = detl.parse(path_to_file)

Application Examples

Example 1: Retrieve data closest to a set of given timepoints

[4]:
# Define some timepoints to look up (parameter: 'process_time')
sampling_times = np.array([0, 2, 4, 6, 7, 8, 10])

# Retrieve data from reactor 2 at the defined points
ddata[2].get_closest_data(sampling_times)
[4]:
timestamp duration process_time volume_pv temperature_sp temperature_pv temperature_out stirrer_speed_sp stirrer_speed_pv stirrer_torque_pv ... loop_b_sp loop_b_pv loop_b_out loop_c_sp loop_c_pv loop_c_out loop_d_sp loop_d_pv loop_d_out internal_a_start_oszillation
6181 2022-03-31 08:56:04+00:00 17.197553 0.000000 1001.642 30.0 29.916 3.613 400.000 398.806 24.956 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6900 2022-03-31 10:56:05+00:00 19.198009 1.999722 1002.739 30.0 30.017 2.803 428.657 426.134 26.928 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
7619 2022-03-31 12:56:10+00:00 21.199410 4.001111 1004.966 30.0 30.004 2.008 576.682 577.423 28.522 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
8337 2022-03-31 14:56:04+00:00 23.197583 5.999444 1008.937 30.0 29.981 1.866 616.291 618.838 28.102 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
8696 2022-03-31 15:56:02+00:00 24.197055 6.998889 1010.868 30.0 30.019 1.910 612.672 613.727 28.898 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
9056 2022-03-31 16:56:10+00:00 25.199314 8.001111 1013.138 30.0 29.965 1.976 596.205 607.313 27.884 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
9774 2022-03-31 18:56:02+00:00 27.197161 9.998889 1018.850 30.0 29.996 1.936 610.679 611.356 28.209 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

7 rows × 59 columns

Example 2: Retrieve data closest to a set of defined total pump volumes

[6]:
# Define pump volumes for data retrieval
pump_volumes = np.array([2, 5, 10])

# Retrieve data from reactor 4 at the defined points
ddata[4].get_closest_data(pump_volumes, reference='pump_b_volume_pv')
[6]:
timestamp duration process_time volume_pv temperature_sp temperature_pv temperature_out stirrer_speed_sp stirrer_speed_pv stirrer_torque_pv ... loop_b_sp loop_b_pv loop_b_out loop_c_sp loop_c_pv loop_c_out loop_d_sp loop_d_pv loop_d_out internal_a_start_oszillation
6723 2022-03-31 10:26:22+00:00 18.702739 1.462500 1002.014 30.0 30.023 3.157 401.879 402.688 27.091 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
7708 2022-03-31 13:10:52+00:00 21.444261 4.203889 1004.968 30.0 29.989 2.909 592.199 593.634 34.763 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
8590 2022-03-31 15:38:10+00:00 23.899420 6.659167 1010.046 30.0 29.999 2.086 630.550 630.419 35.504 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

3 rows × 59 columns

[ ]: