def test_draw_peak_representation_for_spherical_shape_without_background(
            self):
        shape_descr = create_sphere_info(0.5)
        painter = draw_shape("spherical", json.dumps(shape_descr))

        painter.cross.assert_called_once()
        painter.circle.assert_called_once()
示例#2
0
    def test_draw_creates_circle_with_expected_properties_with_nonzero_alpha_and_no_background_in_JSON_shape(
            self, compute_alpha_mock):
        peak_center = [1, 2, 3]
        sphere = create_sphere_info(radius=0.4, specify_bkgd=False)
        painter = MagicMock()
        fg_color, bg_color = 'r', 'unused'
        fake_alpha = 0.5
        compute_alpha_mock.return_value = fake_alpha

        painted = draw_representation(EllipsoidalIntegratedPeakRepresentation,
                                      peak_center,
                                      sphere,
                                      painter,
                                      fg_color,
                                      bg_color,
                                      shape_name="spherical")

        self.assertTrue(painted is not None)
        self._assert_painter_calls(painter,
                                   peak_center[:2],
                                   cross_width=0.08,
                                   signal_width=0.8,
                                   signal_height=0.8,
                                   angle=0,
                                   alpha=fake_alpha,
                                   fg_color=fg_color)
示例#3
0
    def test_draw_peak_representation_for_spherical_shape_including_background(self):
        shape_descr = create_sphere_info(0.5, (1.1, 1.2))
        painter = draw_shape("spherical", json.dumps(shape_descr))

        painter.cross.assert_called_once()
        painter.ellipse.assert_called_once()
        painter.elliptical_shell.assert_called_once()
示例#4
0
def create_test_sphere(background=False):
    signal_radius = 0.4
    if background:
        return create_sphere_info(radius=signal_radius, bkgd_radii=(0.8, 0.9))
    else:
        return create_sphere_info(radius=signal_radius)