def test_composite_peak(filtered_peak_list, im_i): print(".", end='') composite_peak_list = filtered_peak_list[10:20] print(".", end='') peak = composite_peak(composite_peak_list) print(".", end='') assert isinstance(peak, Peak) uid = peak.UID assert uid == '96-69-62-47.73' assert peak.get_third_highest_mz() == 57 assert peak.bounds is None assert peak.get_int_of_ion(100) == 3.603215488138507 assert peak.rt == 47.727200388899995 assert peak.ic_mass is None assert peak.top_ions(10)[0] == 115 # area = peak_sum_area(im_i, peak) # peak.area = area # assert peak.area == area assert isinstance(peak.mass_spectrum, MassSpectrum) assert isinstance(peak.mass_spectrum.mass_spec, list) peak.null_mass(73) index_73 = peak.mass_spectrum.mass_list.index(73) assert peak.mass_spectrum.mass_spec[index_73] == 0 peak.crop_mass(100, 200) assert peak.UID != uid # Errors for obj in [test_dict, *test_sequences, *test_numbers, test_string]: with pytest.raises(TypeError): composite_peak(obj)
def test_composite_peak_outliers(filtered_peak_list, im_i): composite_peak_list = filtered_peak_list[10:13] peak = composite_peak(composite_peak_list, ignore_outliers=True) assert isinstance(peak, Peak) uid = peak.UID assert uid == '88-86-92-39.07' assert peak.get_third_highest_mz() == 85 assert peak.bounds is None assert peak.get_int_of_ion(100) == 7.1236965120460285 assert peak.rt == 39.0680015087 assert peak.ic_mass is None assert peak.top_ions(10)[0] == 161 # area = peak_sum_area(im_i, peak) # peak.area = area # assert peak.area == area peak.null_mass(73) index_73 = peak.mass_spectrum.mass_list.index(73) assert peak.mass_spectrum.mass_spec[index_73] == 0 peak.crop_mass(100, 200) assert peak.UID != uid