Message subsetting and slicing¶
In this notebook, I will demonstrate, how to identify use strym to get a subset of message satisfying a condition or a combination of conditions. Let’s start with reading a csv file.
[1]:
import signal
import pandas as pd
import sys, math, time, datetime
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
import numpy as np
from matplotlib.pyplot import cm
import pickle
from strym import strymread
import strym
import copy
/home/ivory/anaconda3/envs/dbn/lib/python3.7/site-packages/statsmodels/tools/_testing.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
import pandas.util.testing as tm
[3]:
datafolder = "../../PandaData/2020_03_03/"
import glob
csvlist = glob.glob(datafolder+"*.csv")
num_of_files = len(csvlist)
print("Total number of datafiles in {} is {}.".format(datafolder, num_of_files))
dbcfile = '../examples/newToyotacode.dbc'
Total number of datafiles in ../../PandaData/2020_03_03/ is 8.
[4]:
csvlist
[4]:
['../../PandaData/2020_03_03/2020-03-03-15-36-24-479038__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-18-29-15-641040__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-18-09-36-362663__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-15-27-20-702814__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-19-57-11-286348__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-19-32-39-704415__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-10-35-13-966077__CAN_Messages.csv',
'../../PandaData/2020_03_03/2020-03-03-20-15-01-595829__CAN_Messages.csv']
[5]:
r0 = strymread(csvlist[0], dbcfile)
Let’s see how original dataframe for first csvfile looks like
[6]:
r0.dataframe
[6]:
Time | Buffer | Bus | MessageID | Message | MessageLength | |
---|---|---|---|---|---|---|
Clock | ||||||
2020-03-03 22:36:24.759860992 | 1.583275e+09 | 0000602c05004ef9130f038018000000 | 0 | 355 | 130f038018 | 5 |
2020-03-03 22:36:24.760409594 | 1.583275e+09 | 000080380800eef90000210056004084 | 0 | 452 | 0000210056004084 | 8 |
2020-03-03 22:36:24.761665106 | 1.583275e+09 | 00000030180058b4a5fff80000000025 | 1 | 384 | a5fff80000000025 | 8 |
2020-03-03 22:36:24.762725592 | 1.583275e+09 | 0000403018004eb6a5fff80000000027 | 1 | 386 | a5fff80000000027 | 8 |
2020-03-03 22:36:24.763091087 | 1.583275e+09 | 000060301800cbb6a5fff80000000028 | 1 | 387 | a5fff80000000028 | 8 |
... | ... | ... | ... | ... | ... | ... |
2020-03-03 23:21:06.934266090 | 1.583278e+09 | 000060500700666b0000000000008c00 | 0 | 643 | 0000000000008c | 7 |
2020-03-03 23:21:06.935342073 | 1.583278e+09 | 0000c05c0800606dfff800087fe0004e | 0 | 742 | fff800087fe0004e | 8 |
2020-03-03 23:21:06.935601950 | 1.583278e+09 | 0000403a08000f6e9904fa54ffae0073 | 0 | 466 | 9904fa54ffae0073 | 8 |
2020-03-03 23:21:06.937319279 | 1.583278e+09 | 000020320800467198fb71300964003b | 0 | 401 | 98fb71300964003b | 8 |
2020-03-03 23:21:06.938321590 | 1.583278e+09 | 0000401508000b731a6f1a6f1a6f1a6f | 0 | 170 | 1a6f1a6f1a6f1a6f | 8 |
3942410 rows × 6 columns
[9]:
speed = r0.speed()
strymread.plt_ts(speed, title="Speed")
[10]:
r0.dataframe.shape
[10]:
(3942410, 6)
Lead Vehicle Distance Data¶
I want to look at the lead vehicle’s distance data that will be used for cross-checking of message subsetting.
[13]:
plt.rcParams["figure.figsize"] = (16,5)
headway = r0.get_ts('DSU_CRUISE', "LEAD_DISTANCE")
strymread.plt_ts(headway)
Now lets filter above distance to remove all distance that is equal to 252m. A distance of 252m tells that there was no vehicle detected in the front.
[14]:
headway_filtered = headway[headway['Message'] < 252]
strymread.plt_ts(headway_filtered)
Now we will use strym
’s inbuilt function msg_subset
to retrieve a subset of original message
Now lets specify conditions for subsetting.¶
Subsetting can be done in following ways: specify elpased-time ranges for which you want all messages, specify a list of particular message id or specify conditions. See the documentation for all options.
[15]:
print(r0.msg_subset.__doc__)
Get the subset of message dataframe based on a condition.
Parameters
-------------
kwargs: variable list of argument in the dictionary format
conditions: `str` | `list<str>`
Human readable condition for subsetting of message dataframe.
Following conditions are available:
- *lead vehicle present*: Extracts only those messages for which there was lead vehicle present.
- *cruise control on*: Extracts only those messages for which cruise control is on.
- *operand op x*: Extracts those messages for which operator `op` is operated on operand to fulfil `x`.
Available operators `op` are `[>,<,==, !=, >=,<=]`
Available operand `operand` are `[speed, acceleration, lead_distance, steering_angle, steering_rate, yaw_rate ]`.
Details of operands are as follows:
- speed: timeseries longitudinal speed of the vehicle
- acceleration: timeseries longitudinal acceleration of the vehicle
- lead_distance: timeseries distance of lead vehicle from the vehicle
- steering_angle: timeseries steering angle of the vehicle
- steering_rate: timeseries steering rate of the vehicle
- yaw_rate: timeseries yaw rate of the vehicle
For example, "speed < 2.3"
time: (t0, t1)
`t0` start elapsed-time
`t1` end elapsed-time
Extracts messages from time `t0` to `t1`. `t0` and `t1` denotes elapsed-time and not the actual time.
ids: `list`
Get message dataframe containing messages given the list `id`
Returns
-----------
`strymread`
Returns strymread object with a modified dataframe attribute
[16]:
r_new = r0.msg_subset(conditions="lead vehicle present")
[19]:
r_new.dataframe.shape
[19]:
(3086577, 6)
[16]:
r0.dataframe.shape
[16]:
(3942410, 6)
Now, to check whether subset has been successful, we will plot (‘DSU_CRUISE’, ‘LEAD_DISTANCE’) and the give plot should give headway distance same as filtered headway distance we saw above. Since strym
’s function originally require passing csvfile to get the benefit or all utility and plotting functions, we need to manual set dataframe to this subset dataframe as we didn’t pass inplace=True
. In future, we will be able to create strym
object with a valid CAN dataframe.
[21]:
dsu = r_new.get_ts('DSU_CRUISE', 'LEAD_DISTANCE')
strymread.plt_ts(dsu)
As you can see, using msg_subset
can provide a subset of the message that we previously got by operating on dataframe. However, msg_subset
also combines multiple conditions and include human-readable conditions which are easier to understand.
Get the time slices.¶
We can also get the time slices satisfying the given condition. It can be done using function time_subset
. Lets see documentation of this function.
[22]:
print(r0.time_subset.__doc__)
Get the time slices satsifying a particular condition for the dataframe.
Parameters
-------------
kwargs: variable list of argument in the dictionary format
conditions: `str` | `list<str>`
Human readable condition for subsetting of message dataframe.
Following conditions are available:
- "lead vehicle present": Extracts only those message for which there was lead vehicle present.
Returns
--------
`list`
A list of tuples with start and end time of slices. E.g. [(t0, t1), (t2, t3), ...] satisfying the given conditions
The timeslices cabe used for further analysis.
[23]:
timeslices = r0.time_subset(conditions="lead vehicle present")
timeslices
[23]:
[[(Timestamp('2020-03-03 22:36:24.787207365'),
Timestamp('2020-03-03 22:37:33.590708017')),
(Timestamp('2020-03-03 22:38:01.589940071'),
Timestamp('2020-03-03 22:38:47.991396666')),
(Timestamp('2020-03-03 22:38:52.591384888'),
Timestamp('2020-03-03 22:39:00.391503572')),
(Timestamp('2020-03-03 22:39:36.792317629'),
Timestamp('2020-03-03 22:39:37.592354774')),
(Timestamp('2020-03-03 22:39:40.392557383'),
Timestamp('2020-03-03 22:39:56.393051624')),
(Timestamp('2020-03-03 22:40:00.192902565'),
Timestamp('2020-03-03 22:40:17.593435049')),
(Timestamp('2020-03-03 22:40:21.793538094'),
Timestamp('2020-03-03 22:40:24.993632317')),
(Timestamp('2020-03-03 22:40:27.393696547'),
Timestamp('2020-03-03 22:46:57.804323435')),
(Timestamp('2020-03-03 22:47:05.204793453'),
Timestamp('2020-03-03 22:48:31.208158493')),
(Timestamp('2020-03-03 22:48:32.007115126'),
Timestamp('2020-03-03 22:51:30.012042046')),
(Timestamp('2020-03-03 22:51:31.412022352'),
Timestamp('2020-03-03 22:51:31.611897945')),
(Timestamp('2020-03-03 22:51:32.211933613'),
Timestamp('2020-03-03 22:59:39.025678635')),
(Timestamp('2020-03-03 22:59:39.825560570'),
Timestamp('2020-03-03 22:59:40.225656509')),
(Timestamp('2020-03-03 22:59:40.825712681'),
Timestamp('2020-03-03 22:59:46.425674438')),
(Timestamp('2020-03-03 22:59:54.425823927'),
Timestamp('2020-03-03 23:00:08.226311445')),
(Timestamp('2020-03-03 23:00:23.226538420'),
Timestamp('2020-03-03 23:00:31.626742601')),
(Timestamp('2020-03-03 23:01:38.629034996'),
Timestamp('2020-03-03 23:10:15.442380190')),
(Timestamp('2020-03-03 23:10:16.642498970'),
Timestamp('2020-03-03 23:10:29.242714167')),
(Timestamp('2020-03-03 23:10:39.443002462'),
Timestamp('2020-03-03 23:11:51.646449804')),
(Timestamp('2020-03-03 23:12:06.646334887'),
Timestamp('2020-03-03 23:13:01.446827888')),
(Timestamp('2020-03-03 23:14:20.048857450'),
Timestamp('2020-03-03 23:14:37.649171114')),
(Timestamp('2020-03-03 23:14:55.849929571'),
Timestamp('2020-03-03 23:15:08.650103807')),
(Timestamp('2020-03-03 23:15:30.250662565'),
Timestamp('2020-03-03 23:15:52.251535891')),
(Timestamp('2020-03-03 23:19:22.256939173'),
Timestamp('2020-03-03 23:20:21.658813238')),
(Timestamp('2020-03-03 23:20:31.859943628'),
Timestamp('2020-03-03 23:20:32.458867073'))]]
Cruise Control ON¶
Lets look at cruise control information
[24]:
acc_on = r0.acc_state(plot = True)
[25]:
rnew_2 = r0.msg_subset(conditions="cruise control on")
[26]:
cruise = rnew_2.acc_state(plot = True)
ID based filtering¶
In the ID based filtering we can filter out message based on particular Message ID and Signal Name/ID
[29]:
r3new = r0.msg_subset(conditions="180.SPEED.Message > 0")
[31]:
speed_subset = r3new.speed()
strymread.plt_ts(speed_subset, title = "Positive Speed")
ID Based filtering to get timeslices¶
[35]:
timeslices = r0.time_subset(conditions=["180.SPEED.Message >= 4", "cruise control on"])
[36]:
timeslices = r0.time_subset(conditions="cruise control on")
[37]:
from itertools import chain
timeslices = list(chain.from_iterable(timeslices))
timeslices
[37]:
[(Timestamp('2020-03-03 22:40:30.250442504'),
Timestamp('2020-03-03 22:46:54.947874308')),
(Timestamp('2020-03-03 22:47:07.301365137'),
Timestamp('2020-03-03 22:47:11.397818565')),
(Timestamp('2020-03-03 22:48:39.183156490'),
Timestamp('2020-03-03 22:51:22.000110626')),
(Timestamp('2020-03-03 22:51:44.094992638'),
Timestamp('2020-03-03 22:52:03.551586390')),
(Timestamp('2020-03-03 22:59:33.474892616'),
Timestamp('2020-03-03 22:59:39.470468760')),
(Timestamp('2020-03-03 22:59:39.658811569'),
Timestamp('2020-03-03 22:59:46.827667952')),
(Timestamp('2020-03-03 22:59:54.273617506'),
Timestamp('2020-03-03 23:00:08.609681845')),
(Timestamp('2020-03-03 23:00:23.142306328'),
Timestamp('2020-03-03 23:00:30.310319901'))]
[38]:
subset_frames = []
for time_frame in timeslices:
sliced_frame = r0.dataframe.loc[time_frame[0]: time_frame[1]]
subset_frames.append(sliced_frame)
[39]:
subset_frames
[39]:
[ Time Buffer \
Clock
2020-03-03 22:40:30.250442504 1.583275e+09 000020730800e2781066003700000000
2020-03-03 22:40:30.250880480 1.583275e+09 0000607708006c790000c28000000000
2020-03-03 22:40:30.251142502 1.583275e+09 000040150800e5793b523b733b583b5a
2020-03-03 22:40:30.251735926 1.583275e+09 0000401704004a7b01ed00ac00000000
2020-03-03 22:40:30.252018452 1.583275e+09 0000e05c08009c7b7d04000000000072
... ... ...
2020-03-03 22:46:54.945369959 1.583276e+09 000040150800adc01f371f311f341f34
2020-03-03 22:46:54.945670605 1.583276e+09 00008016080036c1000000005504b9ce
2020-03-03 22:46:54.945927382 1.583276e+09 0000a0040800aec100000fff5000008b
2020-03-03 22:46:54.946479559 1.583276e+09 000080650800d2c20000000000000037
2020-03-03 22:46:54.947874308 1.583276e+09 00002073080077c51026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:40:30.250442504 0 921 1066003700000000 8
2020-03-03 22:40:30.250880480 0 955 0000c28000000000 8
2020-03-03 22:40:30.251142502 0 170 3b523b733b583b5a 8
2020-03-03 22:40:30.251735926 0 186 01ed00ac 4
2020-03-03 22:40:30.252018452 0 743 7d04000000000072 8
... ... ... ... ...
2020-03-03 22:46:54.945369959 0 170 1f371f311f341f34 8
2020-03-03 22:46:54.945670605 0 180 000000005504b9ce 8
2020-03-03 22:46:54.945927382 0 37 00000fff5000008b 8
2020-03-03 22:46:54.946479559 0 812 0000000000000037 8
2020-03-03 22:46:54.947874308 0 921 1026003700000000 8
[553052 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:47:07.301365137 1.583276e+09 000020730800acff1026003700000000
2020-03-03 22:47:07.301627398 1.583276e+09 0000404c08002500000800021800008e
2020-03-03 22:47:07.301880360 1.583276e+09 0000602c05009d0013af010000000000
2020-03-03 22:47:07.302132845 1.583276e+09 000060770800f8000000bc8000000000
2020-03-03 22:47:07.305477381 1.583276e+09 000040150800e507263c2649263c2648
... ... ...
2020-03-03 22:47:11.396260500 1.583276e+09 000080040800853b01fd01f5420280e4
2020-03-03 22:47:11.396818638 1.583276e+09 000040460600cd3c807f18f06dae0000
2020-03-03 22:47:11.397078991 1.583276e+09 0000a0460800323d000000000000003f
2020-03-03 22:47:11.397513151 1.583276e+09 000080650800253e0000000000000037
2020-03-03 22:47:11.397818565 1.583276e+09 000020730800a13e1026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:47:07.301365137 0 921 1026003700000000 8
2020-03-03 22:47:07.301627398 0 610 000800021800008e 8
2020-03-03 22:47:07.301880360 0 355 13af010000 5
2020-03-03 22:47:07.302132845 0 955 0000bc8000000000 8
2020-03-03 22:47:07.305477381 0 170 263c2649263c2648 8
... ... ... ... ...
2020-03-03 22:47:11.396260500 0 36 01fd01f5420280e4 8
2020-03-03 22:47:11.396818638 0 562 807f18f06dae 6
2020-03-03 22:47:11.397078991 0 565 000000000000003f 8
2020-03-03 22:47:11.397513151 0 812 0000000000000037 8
2020-03-03 22:47:11.397818565 0 921 1026003700000000 8
[5900 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:48:39.183156490 1.583276e+09 00002073080033d51026003700000000
2020-03-03 22:48:39.184428215 1.583276e+09 000080331800f74c05f8008060faf06c
2020-03-03 22:48:39.184720039 1.583276e+09 0000a0331800724d0500000660ff6070
2020-03-03 22:48:39.185168028 1.583276e+09 0000803808002ed905aa21083700c09c
2020-03-03 22:48:39.185430050 1.583276e+09 0000c0331800eb4e05fa00c061fbc082
... ... ...
2020-03-03 22:51:21.998913050 1.583276e+09 00004015080030b81f261f2f1f2b1f29
2020-03-03 22:51:21.999356508 1.583276e+09 00008004080007b901ff01ee420380e0
2020-03-03 22:51:21.999608994 1.583276e+09 0000a004080087b90ffe0fffdfff0026
2020-03-03 22:51:21.999861479 1.583276e+09 0000c044080005ba4000100000000000
2020-03-03 22:51:22.000110626 1.583276e+09 0000207308007fba1026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:48:39.183156490 0 921 1026003700000000 8
2020-03-03 22:48:39.184428215 1 412 05f8008060faf06c 8
2020-03-03 22:48:39.184720039 1 413 0500000660ff6070 8
2020-03-03 22:48:39.185168028 0 452 05aa21083700c09c 8
2020-03-03 22:48:39.185430050 1 414 05fa00c061fbc082 8
... ... ... ... ...
2020-03-03 22:51:21.998913050 0 170 1f261f2f1f2b1f29 8
2020-03-03 22:51:21.999356508 0 36 01ff01ee420380e0 8
2020-03-03 22:51:21.999608994 0 37 0ffe0fffdfff0026 8
2020-03-03 22:51:21.999861479 0 550 4000100000000000 8
2020-03-03 22:51:22.000110626 0 921 1026003700000000 8
[241997 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:51:44.094992638 1.583276e+09 000020730800e1411026003700000000
2020-03-03 22:51:44.096988201 1.583276e+09 0000005b0800e1450001000000000000
2020-03-03 22:51:44.099168539 1.583276e+09 000040150800444a21ed21ed21ec21e1
2020-03-03 22:51:44.099436998 1.583276e+09 0000406e0800b44a007f7f7f7f000000
2020-03-03 22:51:44.099689484 1.583276e+09 0000a00408002d4b00020ffff000002d
... ... ...
2020-03-03 22:52:03.550325155 1.583276e+09 00000045040083a70000002e007fffff
2020-03-03 22:52:03.550790548 1.583276e+09 0000c04408002ba84000100000000000
2020-03-03 22:52:03.551072359 1.583276e+09 0000e05c0800a5a87d04000000000072
2020-03-03 22:52:03.551326036 1.583276e+09 0000806508001fa90000000000000037
2020-03-03 22:52:03.551586390 1.583276e+09 0000207308009ba91026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:51:44.094992638 0 921 1026003700000000 8
2020-03-03 22:51:44.096988201 0 728 0001000000000000 8
2020-03-03 22:51:44.099168539 0 170 21ed21ed21ec21e1 8
2020-03-03 22:51:44.099436998 0 882 007f7f7f7f000000 8
2020-03-03 22:51:44.099689484 0 37 00020ffff000002d 8
... ... ... ... ...
2020-03-03 22:52:03.550325155 0 552 0000002e 4
2020-03-03 22:52:03.550790548 0 550 4000100000000000 8
2020-03-03 22:52:03.551072359 0 743 7d04000000000072 8
2020-03-03 22:52:03.551326036 0 812 0000000000000037 8
2020-03-03 22:52:03.551586390 0 921 1026003700000000 8
[28418 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:59:33.474892616 1.583276e+09 0000207308004f7a1026003600000000
2020-03-03 22:59:33.475150824 1.583276e+09 000060770800dc7a0000ba8000000000
2020-03-03 22:59:33.477011442 1.583276e+09 000000450400bb7e007900a7fc000000
2020-03-03 22:59:33.479079247 1.583276e+09 0000205808004482000d2a0cb6b735b0
2020-03-03 22:59:33.479700804 1.583276e+09 0000e0481800b4b2e000100100100100
... ... ...
2020-03-03 22:59:39.467923403 1.583276e+09 0000602c05005b3013cf010000000000
2020-03-03 22:59:39.468412399 1.583276e+09 0000002516000d60fe80200008d50000
2020-03-03 22:59:39.468669415 1.583276e+09 0000002c18007260000008160104911d
2020-03-03 22:59:39.469322681 1.583276e+09 0000202c1700036280736eff0008d100
2020-03-03 22:59:39.470468760 1.583276e+09 00002073080093351026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:59:33.474892616 0 921 1026003600000000 8
2020-03-03 22:59:33.475150824 0 955 0000ba8000000000 8
2020-03-03 22:59:33.477011442 0 552 007900a7 4
2020-03-03 22:59:33.479079247 0 705 000d2a0cb6b735b0 8
2020-03-03 22:59:33.479700804 1 583 e000100100100100 8
... ... ... ... ...
2020-03-03 22:59:39.467923403 0 355 13cf010000 5
2020-03-03 22:59:39.468412399 1 296 fe80200008d5 6
2020-03-03 22:59:39.468669415 1 352 000008160104911d 8
2020-03-03 22:59:39.469322681 1 353 80736eff0008d1 7
2020-03-03 22:59:39.470468760 0 921 1026003700000000 8
[8383 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:59:39.658811569 1.583276e+09 00002073080066a51026003700000000
2020-03-03 22:59:39.659069300 1.583276e+09 0000a0c00800dfa50000000000000013
2020-03-03 22:59:39.659510851 1.583276e+09 0000e05c08007fa67d04000000000072
2020-03-03 22:59:39.659811258 1.583276e+09 0000404c0800f9a6000800021800008e
2020-03-03 22:59:39.660312414 1.583276e+09 000000251600f2d6fd80800008340000
... ... ...
2020-03-03 22:59:46.826662540 1.583276e+09 00004015080086513bbe3bc63bb43bb4
2020-03-03 22:59:46.826917171 1.583276e+09 000040170400f75101f800b7ff000000
2020-03-03 22:59:46.827166319 1.583276e+09 0000a00408005d520fff0fffe0000029
2020-03-03 22:59:46.827418566 1.583276e+09 000080040800da5201ff01f9420480ec
2020-03-03 22:59:46.827667952 1.583276e+09 00002073080054531026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:59:39.658811569 0 921 1026003700000000 8
2020-03-03 22:59:39.659069300 0 1541 0000000000000013 8
2020-03-03 22:59:39.659510851 0 743 7d04000000000072 8
2020-03-03 22:59:39.659811258 0 610 000800021800008e 8
2020-03-03 22:59:39.660312414 1 296 fd8080000834 6
... ... ... ... ...
2020-03-03 22:59:46.826662540 0 170 3bbe3bc63bb43bb4 8
2020-03-03 22:59:46.826917171 0 186 01f800b7 4
2020-03-03 22:59:46.827166319 0 37 0fff0fffe0000029 8
2020-03-03 22:59:46.827418566 0 36 01ff01f9420480ec 8
2020-03-03 22:59:46.827667952 0 921 1026003700000000 8
[10468 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 22:59:54.273617506 1.583276e+09 000020730800e21e1026003700000000
2020-03-03 22:59:54.275180101 1.583276e+09 0000807f08000a220000060004005fa8
2020-03-03 22:59:54.276608229 1.583276e+09 000040150800e9243b883b8b3b943b7f
2020-03-03 22:59:54.277416229 1.583276e+09 00000045040062260000002e003fffff
2020-03-03 22:59:54.278011560 1.583276e+09 00006048180012546000100100100100
... ... ...
2020-03-03 23:00:08.607620239 1.583276e+09 000080650800fe730000000000000037
2020-03-03 23:00:08.607867956 1.583276e+09 000080040800ec7401fd0200420180ef
2020-03-03 23:00:08.608118534 1.583276e+09 0000203208006875b1ffe9320064fac3
2020-03-03 23:00:08.609238386 1.583276e+09 0000606808005777fffd43000000008d
2020-03-03 23:00:08.609681845 1.583276e+09 00002073080020781026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 22:59:54.273617506 0 921 1026003700000000 8
2020-03-03 22:59:54.275180101 0 1020 0000060004005fa8 8
2020-03-03 22:59:54.276608229 0 170 3b883b8b3b943b7f 8
2020-03-03 22:59:54.277416229 0 552 0000002e 4
2020-03-03 22:59:54.278011560 1 579 6000100100100100 8
... ... ... ... ...
2020-03-03 23:00:08.607620239 0 812 0000000000000037 8
2020-03-03 23:00:08.607867956 0 36 01fd0200420180ef 8
2020-03-03 23:00:08.608118534 0 401 b1ffe9320064fac3 8
2020-03-03 23:00:08.609238386 0 835 fffd43000000008d 8
2020-03-03 23:00:08.609681845 0 921 1026003700000000 8
[22216 rows x 6 columns],
Time Buffer \
Clock
2020-03-03 23:00:23.142306328 1.583276e+09 00002073080060511026003700000000
2020-03-03 23:00:23.142556906 1.583276e+09 0000e0321800917a04000000000000a4
2020-03-03 23:00:23.142806768 1.583276e+09 0000003318000e7b04fa000260fc706d
2020-03-03 23:00:23.143601894 1.583276e+09 000020331800857c04fc2f026002a0d5
2020-03-03 23:00:23.143851757 1.583276e+09 000040331800fd7c04ca005060fd607e
... ... ...
2020-03-03 23:00:30.307449818 1.583276e+09 00008004080046f802000205420480fb
2020-03-03 23:00:30.307700872 1.583276e+09 0000a0040800c2f800000fffe000001b
2020-03-03 23:00:30.308242083 1.583276e+09 0000a0460800f8f9000000000000003f
2020-03-03 23:00:30.308512211 1.583276e+09 00008065080075fa0000000000000037
2020-03-03 23:00:30.310319901 1.583276e+09 0000207308000afe1026003700000000
Bus MessageID Message MessageLength
Clock
2020-03-03 23:00:23.142306328 0 921 1026003700000000 8
2020-03-03 23:00:23.142556906 1 407 04000000000000a4 8
2020-03-03 23:00:23.142806768 1 408 04fa000260fc706d 8
2020-03-03 23:00:23.143601894 1 409 04fc2f026002a0d5 8
2020-03-03 23:00:23.143851757 1 410 04ca005060fd607e 8
... ... ... ... ...
2020-03-03 23:00:30.307449818 0 36 02000205420480fb 8
2020-03-03 23:00:30.307700872 0 37 00000fffe000001b 8
2020-03-03 23:00:30.308242083 0 565 000000000000003f 8
2020-03-03 23:00:30.308512211 0 812 0000000000000037 8
2020-03-03 23:00:30.310319901 0 921 1026003700000000 8
[10222 rows x 6 columns]]
We can also visualize time slices on time-axis.¶
[42]:
fig, ax = strymread.create_fig(1)
for slices in timeslices:
ax[0].scatter([slices[0], slices[1]], [0, 0], marker = '*')
ax[0].plot([slices[0], slices[1]], [0, 0], linewidth=2.0)
ax[0].set_xlim([np.min(timeslices)-0.1*(np.max(timeslices)-np.min(timeslices)), np.max(timeslices)+0.1*(np.max(timeslices)-np.min(timeslices))])
ax[0].set_ylim([-0.0001, 0.0001])
plt.yticks([])
plt.show()