Example #1
0
 def test_r_min_and_r_max(self):
     peak_list = np.array([[50, 0], [0, 30]])
     peak_filtered_list0 = ct._filter_peak_list_radius(peak_list,
                                                       xc=0,
                                                       yc=0,
                                                       r_min=20,
                                                       r_max=40)
     assert (peak_filtered_list0 == np.array([[0, 30]])).all()
     peak_filtered_list1 = ct._filter_peak_list_radius(peak_list,
                                                       xc=0,
                                                       yc=0,
                                                       r_min=20,
                                                       r_max=60)
     assert (peak_filtered_list1 == np.array([[50, 0], [0, 30]])).all()
     peak_filtered_list2 = ct._filter_peak_list_radius(peak_list,
                                                       xc=0,
                                                       yc=0,
                                                       r_min=40,
                                                       r_max=60)
     assert (peak_filtered_list2 == np.array([[50, 0]])).all()
     peak_filtered_list3 = ct._filter_peak_list_radius(peak_list,
                                                       xc=0,
                                                       yc=0,
                                                       r_min=10,
                                                       r_max=20)
     assert len(peak_filtered_list3) == 0
     peak_filtered_list4 = ct._filter_peak_list_radius(peak_list,
                                                       xc=0,
                                                       yc=0,
                                                       r_min=90,
                                                       r_max=99)
     assert len(peak_filtered_list4) == 0
Example #2
0
 def test_r_min_larger_than_r_max(self):
     peak_list = np.array([[50, 10], [50, 50]])
     with pytest.raises(ValueError):
         ct._filter_peak_list_radius(peak_list,
                                     xc=10,
                                     yc=50,
                                     r_min=50,
                                     r_max=30)
Example #3
0
 def test_r_lim(self):
     peak_list = np.array([[50, 50], [50, 30]])
     peak_filtered_list0 = ct._filter_peak_list_radius(
         peak_list, xc=50, yc=50, r_min=19
     )
     assert (peak_filtered_list0 == np.array([[50, 30]])).all()
     peak_filtered_list1 = ct._filter_peak_list_radius(
         peak_list, xc=50, yc=50, r_min=21
     )
     assert len(peak_filtered_list1) == 0
Example #4
0
 def test_simple(self):
     peak_list = np.random.randint(100, size=(1000, 2))
     peak_filtered_list0 = ct._filter_peak_list_radius(
         peak_list, xc=50, yc=50, r_min=30
     )
     assert len(peak_list) != len(peak_filtered_list0)
     peak_filtered_list1 = ct._filter_peak_list_radius(
         peak_list, xc=50, yc=50, r_min=1000
     )
     assert len(peak_filtered_list1) == 0
Example #5
0
 def test_xc_yc(self):
     peak_list = np.array([[50, 10], [50, 50]])
     peak_filtered_list = ct._filter_peak_list_radius(peak_list,
                                                      xc=10,
                                                      yc=50,
                                                      r_min=10)
     assert (peak_filtered_list == np.array([[50, 50]])).all()
Example #6
0
 def test_r_max(self):
     peak_list = np.array([[50, 0], [0, 30]])
     peak_filtered_list0 = ct._filter_peak_list_radius(
         peak_list, xc=0, yc=0, r_max=40
     )
     assert (peak_filtered_list0 == np.array([[0, 30]])).all()
     peak_filtered_list1 = ct._filter_peak_list_radius(
         peak_list, xc=0, yc=0, r_max=52
     )
     assert (peak_filtered_list1 == np.array([[50, 0], [0, 30]])).all()
     peak_filtered_list2 = ct._filter_peak_list_radius(
         peak_list, xc=0, yc=0, r_max=81
     )
     assert len(peak_filtered_list2) == 2
     peak_filtered_list3 = ct._filter_peak_list_radius(
         peak_list, xc=0, yc=0, r_max=11
     )
     assert len(peak_filtered_list3) == 0
Example #7
0
 def test_wrong_input_no_r_min_or_r_max(self):
     peak_list = np.array([[50, 10], [50, 50]])
     with pytest.raises(ValueError):
         ct._filter_peak_list_radius(peak_list, xc=10, yc=50)