def test_clipping(project): am = AnnotationManager(project) input_annotations = pd.read_csv( 'examples/valid_raw_data/raw_annotations/input.csv') am.import_annotations(input_annotations) am.read() start = 1981 stop = 1984 segments = am.get_segments( am.annotations[am.annotations['set'] == 'vtc_rttm']) segments = am.clip_segments(segments, start, stop) assert segments['segment_onset'].between( start, stop).all() and segments['segment_offset'].between( start, stop).all(), "segments not properly clipped" assert segments.shape[0] == 2, "got {} segments, expected 2".format( segments.shape[0])
def test_clipping(project): am = AnnotationManager(project) input_annotations = pd.read_csv("examples/valid_raw_data/annotations/input.csv") input_annotations = input_annotations[input_annotations["recording_filename"] == "sound.wav"] am.import_annotations(input_annotations[input_annotations["set"] == "vtc_rttm"]) am.read() start = 1981000 stop = 1984000 segments = am.get_segments(am.annotations[am.annotations["set"] == "vtc_rttm"]) segments = am.clip_segments(segments, start, stop) assert ( segments["segment_onset"].between(start, stop).all() and segments["segment_offset"].between(start, stop).all() ), "segments not properly clipped" assert segments.shape[0] == 2, "got {} segments, expected 2".format( segments.shape[0] )