Exemplo n.º 1
0
    def test__flux_at_radius__different_rotate_phi_90_same_result(self):
        sersic = light_profile.SersicLightProfile(axis_ratio=0.5,
                                                  phi=0.0,
                                                  flux=3.0,
                                                  effective_radius=2.0,
                                                  sersic_index=2.0)

        flux_at_radius_1 = sersic.flux_at_coordinates(coordinates=(0, 1))

        sersic = light_profile.SersicLightProfile(axis_ratio=0.5,
                                                  phi=90.0,
                                                  flux=3.0,
                                                  effective_radius=2.0,
                                                  sersic_index=2.0)

        flux_at_radius_2 = sersic.flux_at_coordinates(coordinates=(1, 0))

        assert flux_at_radius_1 == flux_at_radius_2
Exemplo n.º 2
0
    def test_2d_symmetry(self):
        sersic1 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0)

        sersic2 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0,
                                                   centre=(100, 0))
        sersic3 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0,
                                                   centre=(0, 100))

        sersic4 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0,
                                                   centre=(100, 100))

        combined = light_profile.CombinedLightProfile(sersic1, sersic2,
                                                      sersic3, sersic4)

        assert combined.flux_at_coordinates(
            (49, 0)) == pytest.approx(combined.flux_at_coordinates((51, 0)),
                                      1e-5)
        assert combined.flux_at_coordinates(
            (0, 49)) == pytest.approx(combined.flux_at_coordinates((0, 51)),
                                      1e-5)
        assert combined.flux_at_coordinates(
            (100,
             49)) == pytest.approx(combined.flux_at_coordinates((100, 51)),
                                   1e-5)
        assert combined.flux_at_coordinates(
            (49, 49)) == pytest.approx(combined.flux_at_coordinates((51, 51)),
                                       1e-5)
Exemplo n.º 3
0
    def test_1d_symmetry(self):
        sersic1 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0)

        sersic2 = light_profile.SersicLightProfile(axis_ratio=1.0,
                                                   phi=0.0,
                                                   flux=1.0,
                                                   effective_radius=0.6,
                                                   sersic_index=4.0,
                                                   centre=(100, 0))

        combined = light_profile.CombinedLightProfile(sersic1, sersic2)
        assert combined.flux_at_coordinates(
            (0, 0)) == combined.flux_at_coordinates((100, 0))
        assert combined.flux_at_coordinates(
            (49, 0)) == combined.flux_at_coordinates((51, 0))
Exemplo n.º 4
0
    def test__flux_at_radius__different_axis_ratio(self):
        sersic = light_profile.SersicLightProfile(axis_ratio=0.5,
                                                  phi=0.0,
                                                  flux=3.0,
                                                  effective_radius=2.0,
                                                  sersic_index=2.0)

        flux_at_radius = sersic.flux_at_coordinates(coordinates=(0, 1))

        assert flux_at_radius == pytest.approx(5.38066670129, 1e-3)
Exemplo n.º 5
0
 def test__flux_at_radius_2__correct_value(self):
     sersic = light_profile.SersicLightProfile(axis_ratio=1.0,
                                               phi=0.0,
                                               flux=3.0,
                                               effective_radius=2.0,
                                               sersic_index=2.0)
     flux_at_radius = sersic.flux_at_radius(
         radius=1.5
     )  # 3.0 * exp(-3.67206544592 * (1,5/2.0) ** (1.0 / 2.0)) - 1) = 0.351797
     assert flux_at_radius == pytest.approx(4.90657319276, 1e-3)
Exemplo n.º 6
0
def circular_sersic():
    return light_profile.SersicLightProfile(axis_ratio=1.0,
                                            phi=0.0,
                                            flux=1.0,
                                            effective_radius=0.6,
                                            sersic_index=4.0)
Exemplo n.º 7
0
def vertical_sersic():
    return light_profile.SersicLightProfile(axis_ratio=0.5,
                                            phi=90.0,
                                            flux=1.0,
                                            effective_radius=0.6,
                                            sersic_index=4.0)