@@ -941,6 +941,7 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
941
941
byte_offset = byte_offset [:]
942
942
samps_per_frame = samps_per_frame [:]
943
943
skew = skew [:]
944
+ init_value = init_value [:]
944
945
945
946
# Set defaults for empty fields
946
947
for i in range (n_sig ):
@@ -950,6 +951,8 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
950
951
samps_per_frame [i ] = 1
951
952
if skew [i ] == None :
952
953
skew [i ] = 0
954
+ if init_value [i ] == None :
955
+ init_value [i ] = 0
953
956
954
957
# If skew is to be ignored, set all to 0
955
958
if ignore_skew :
@@ -966,6 +969,7 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
966
969
w_byte_offset = {} # one scalar per dat file
967
970
w_samps_per_frame = {} # one list per dat file
968
971
w_skew = {} # one list per dat file
972
+ w_init_value = {} # one list per dat file
969
973
w_channel = {} # one list per dat file
970
974
971
975
for fn in file_name :
@@ -979,6 +983,7 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
979
983
w_byte_offset [fn ] = byte_offset [datchannel [fn ][0 ]]
980
984
w_samps_per_frame [fn ] = [samps_per_frame [c ] for c in datchannel [fn ]]
981
985
w_skew [fn ] = [skew [c ] for c in datchannel [fn ]]
986
+ w_init_value [fn ] = [init_value [c ] for c in datchannel [fn ]]
982
987
w_channel [fn ] = idc
983
988
984
989
# Wanted dat channels, relative to the dat file itself
@@ -1009,6 +1014,7 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
1009
1014
byte_offset = w_byte_offset [fn ],
1010
1015
samps_per_frame = w_samps_per_frame [fn ],
1011
1016
skew = w_skew [fn ],
1017
+ init_value = w_init_value [fn ],
1012
1018
sampfrom = sampfrom ,
1013
1019
sampto = sampto ,
1014
1020
smooth_frames = smooth_frames ,
@@ -1033,6 +1039,7 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
1033
1039
byte_offset = w_byte_offset [fn ],
1034
1040
samps_per_frame = w_samps_per_frame [fn ],
1035
1041
skew = w_skew [fn ],
1042
+ init_value = w_init_value [fn ],
1036
1043
sampfrom = sampfrom ,
1037
1044
sampto = sampto ,
1038
1045
smooth_frames = smooth_frames ,
@@ -1047,8 +1054,9 @@ def _rd_segment(file_name, dir_name, pn_dir, fmt, n_sig, sig_len, byte_offset,
1047
1054
1048
1055
1049
1056
def _rd_dat_signals (file_name , dir_name , pn_dir , fmt , n_sig , sig_len ,
1050
- byte_offset , samps_per_frame , skew , sampfrom , sampto ,
1051
- smooth_frames , no_file = False , sig_data = None ):
1057
+ byte_offset , samps_per_frame , skew , init_value ,
1058
+ sampfrom , sampto , smooth_frames ,
1059
+ no_file = False , sig_data = None ):
1052
1060
"""
1053
1061
Read all signals from a WFDB dat file.
1054
1062
@@ -1074,6 +1082,8 @@ def _rd_dat_signals(file_name, dir_name, pn_dir, fmt, n_sig, sig_len,
1074
1082
The samples/frame for each signal of the dat file.
1075
1083
skew : list
1076
1084
The skew for the signals of the dat file.
1085
+ init_value : list
1086
+ The initial value for each signal of the dat file.
1077
1087
sampfrom : int
1078
1088
The starting sample number to be read from the signals.
1079
1089
sampto : int
0 commit comments