@@ -2742,8 +2742,9 @@ def mrgann(ann_file1, ann_file2, out_file_name='merged_ann.atr',
2742
2742
'combine' which simply combines the two files along every attribute;
2743
2743
duplicates will be preserved. The other options are 'replace1' which
2744
2744
replaces attributes of the first annotation file with attributes of
2745
- the second for the desired time range and 'replace2' which does the
2746
- same thing except switched (first file replaces second).
2745
+ the second for the desired time range, 'replace2' which does the
2746
+ same thing except switched (first file replaces second), and 'delete'
2747
+ which deletes all of the annotations in the desired time range.
2747
2748
chan1 : int, optional
2748
2749
Sets the value of `chan` for the first annotation file. The default is
2749
2750
-1 which means to keep it the same.
@@ -2851,7 +2852,7 @@ def mrgann(ann_file1, ann_file2, out_file_name='merged_ann.atr',
2851
2852
if verbose :
2852
2853
print (f'Start sample: { start_sample } , end sample: { end_sample } ' )
2853
2854
2854
- if merge_method == 'combine' :
2855
+ if ( merge_method == 'combine' ) or ( merge_method == 'delete' ) :
2855
2856
if verbose :
2856
2857
print ('Combining the two files together' )
2857
2858
# The sample should never be empty but others can (though they
@@ -2861,8 +2862,12 @@ def mrgann(ann_file1, ann_file2, out_file_name='merged_ann.atr',
2861
2862
sort_indices = np .argsort (both_sample )
2862
2863
both_sample = np .sort (both_sample )
2863
2864
# Find where to filter the array
2864
- sample_range = ((both_sample >= start_sample ) &
2865
- (both_sample <= end_sample ))
2865
+ if merge_method == 'combine' :
2866
+ sample_range = ((both_sample >= start_sample ) &
2867
+ (both_sample <= end_sample ))
2868
+ if merge_method == 'delete' :
2869
+ sample_range = ((both_sample < start_sample ) |
2870
+ (both_sample > end_sample ))
2866
2871
index_range = np .where (sample_range )[0 ]
2867
2872
both_sample = both_sample [sample_range ]
2868
2873
# Combine both annotation attributes
0 commit comments