@@ -1198,26 +1198,34 @@ def rdann(record_name, extension, sampfrom=0, sampto=None, shift_samps=False,
1198
1198
1199
1199
"""
1200
1200
1201
- return_label_elements = check_read_inputs (sampfrom , sampto , return_label_elements )
1201
+ return_label_elements = check_read_inputs (sampfrom , sampto ,
1202
+ return_label_elements )
1202
1203
1203
1204
# Read the file in byte pairs
1204
1205
filebytes = load_byte_pairs (record_name , extension , pb_dir )
1205
1206
1206
1207
# Get wfdb annotation fields from the file bytes
1207
- sample , label_store , subtype , chan , num , aux_note = proc_ann_bytes (filebytes , sampto )
1208
+ (sample , label_store , subtype ,
1209
+ chan , num , aux_note ) = proc_ann_bytes (filebytes , sampto )
1208
1210
1209
1211
# Get the indices of annotations that hold definition information about
1210
1212
# the entire annotation file, and other empty annotations to be removed.
1211
- potential_definition_inds , rm_inds = get_special_inds (sample , label_store , aux_note )
1213
+ potential_definition_inds , rm_inds = get_special_inds (sample , label_store ,
1214
+ aux_note )
1212
1215
1213
1216
# Try to extract information describing the annotation file
1214
- fs , custom_labels = interpret_defintion_annotations (potential_definition_inds , aux_note )
1217
+ (fs ,
1218
+ custom_labels ) = interpret_defintion_annotations (potential_definition_inds ,
1219
+ aux_note )
1215
1220
1216
1221
# Remove annotations that do not store actual sample and label information
1217
- sample , label_store , subtype , chan , num , aux_note = rm_empty_indices (rm_inds , sample , label_store , subtype , chan , num , aux_note )
1222
+ (sample , label_store , subtype ,
1223
+ chan , num , aux_note ) = rm_empty_indices (rm_inds , sample , label_store ,
1224
+ subtype , chan , num , aux_note )
1218
1225
1219
- # Convert lists to numpy arrays
1220
- sample , label_store , subtype , chan , num = lists_to_arrays (sample , label_store , subtype , chan , num )
1226
+ # Convert lists to numpy arrays dtype='int'
1227
+ (sample , label_store , subtype ,
1228
+ chan , num ) = lists_to_int_arrays (sample , label_store , subtype , chan , num )
1221
1229
1222
1230
# Obtain annotation sample relative to the starting signal index
1223
1231
if shift_samps and len (sample ) > 0 and sampfrom :
@@ -1232,11 +1240,12 @@ def rdann(record_name, extension, sampfrom=0, sampto=None, shift_samps=False,
1232
1240
pass
1233
1241
1234
1242
# Create the annotation object
1235
- annotation = Annotation (os .path .split (record_name )[1 ], extension , sample = sample , label_store = label_store ,
1236
- subtype = subtype , chan = chan , num = num , aux_note = aux_note , fs = fs ,
1243
+ annotation = Annotation (record_name = os .path .split (record_name )[1 ],
1244
+ extension = extension , sample = sample ,
1245
+ label_store = label_store , subtype = subtype ,
1246
+ chan = chan , num = num , aux_note = aux_note , fs = fs ,
1237
1247
custom_labels = custom_labels )
1238
1248
1239
-
1240
1249
# Get the set of unique label definitions contained in this annotation
1241
1250
if summarize_labels :
1242
1251
annotation .get_contained_labels (inplace = True )
@@ -1509,9 +1518,9 @@ def rm_empty_indices(*args):
1509
1518
1510
1519
return [[a [i ] for i in keep_inds ] for a in args [1 :]]
1511
1520
1512
- def lists_to_arrays (* args ):
1521
+ def lists_to_int_arrays (* args ):
1513
1522
"""
1514
- Convert lists to numpy arrays
1523
+ Convert lists to numpy int arrays
1515
1524
"""
1516
1525
return [np .array (a , dtype = 'int' ) for a in args ]
1517
1526
0 commit comments