Пример #1
0
    def test_aperture_select(self):
        kwargs_slit = {
            'length': 2,
            'width': 0.5,
            'center_ra': 0,
            'center_dec': 0,
            'angle': 0
        }
        slit = Aperture(aperture_type='slit', **kwargs_slit)
        bool, i = slit.aperture_select(ra=0.9, dec=0.2)
        assert bool is True
        bool, i = slit.aperture_select(ra=1.1, dec=0.2)
        assert bool is False
        assert slit.num_segments == 1

        kwargs_shell = {
            'r_in': 0.2,
            'r_out': 1.,
            'center_ra': 0,
            'center_dec': 0
        }
        shell = Aperture(aperture_type='shell', **kwargs_shell)
        bool, i = shell.aperture_select(ra=0.9, dec=0)
        assert bool is True
        bool, i = shell.aperture_select(ra=1.1, dec=0)
        assert bool is False
        bool, i = shell.aperture_select(ra=0.1, dec=0)
        assert bool is False
        assert shell.num_segments == 1
Пример #2
0
 def __init__(self,
              mass_profile_list,
              light_profile_list,
              aperture_type='slit',
              anisotropy_model='isotropic',
              fwhm=0.7,
              kwargs_numerics={},
              kwargs_cosmo={
                  'D_d': 1000,
                  'D_s': 2000,
                  'D_ds': 500
              }):
     self.massProfile = MassProfile(mass_profile_list,
                                    kwargs_cosmo,
                                    kwargs_numerics=kwargs_numerics)
     self.lightProfile = LightProfile(light_profile_list,
                                      kwargs_numerics=kwargs_numerics)
     self.aperture = Aperture(aperture_type)
     self.anisotropy = MamonLokasAnisotropy(anisotropy_model)
     self.FWHM = fwhm
     self.cosmo = Cosmo(kwargs_cosmo)
     #kwargs_numerics = {'sampling_number': 10000, 'interpol_grid_num': 5000, 'log_integration': False,
     #                   'max_integrate': 500}
     self._num_sampling = kwargs_numerics.get('sampling_number', 1000)
     self._interp_grid_num = kwargs_numerics.get('interpol_grid_num', 500)
     self._log_int = kwargs_numerics.get('log_integration', False)
     self._max_integrate = kwargs_numerics.get(
         'max_integrate',
         10)  # maximal integration (and interpolation) in units of arcsecs
     self._min_integrate = kwargs_numerics.get(
         'min_integrate',
         0.001)  # min integration (and interpolation) in units of arcsecs
Пример #3
0
 def __init__(self,
              aperture='slit',
              mass_profile='power_law',
              light_profile='Hernquist',
              anisotropy_type='r_ani',
              psf_fwhm=0.7,
              kwargs_cosmo={
                  'D_d': 1000,
                  'D_s': 2000,
                  'D_ds': 500
              }):
     """
     initializes the observation condition and masks
     :param aperture_type: string
     :param psf_fwhm: float
     """
     self._mass_profile = mass_profile
     self._fwhm = psf_fwhm
     self._kwargs_cosmo = kwargs_cosmo
     self.lightProfile = LightProfileOld(light_profile)
     self.aperture = Aperture(aperture)
     self.anisotropy = Anisotropy(anisotropy_type)
     self.FWHM = psf_fwhm
     self.jeans_solver = JeansSolver(kwargs_cosmo, mass_profile,
                                     light_profile, anisotropy_type)
Пример #4
0
    def __init__(self, mass_profile_list, light_profile_list, aperture_type='slit', anisotropy_model='isotropic',
                 psf_type='GAUSSIAN', fwhm=0.7, moffat_beta=2.6, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500},
                 sampling_number=1000, interpol_grid_num=500, log_integration=False, max_integrate=10, min_integrate=0.001):
        """

        :param mass_profile_list: list of lens (mass) model profiles
        :param light_profile_list: list of light model profiles of the lensing galaxy
        :param aperture_type: type of slit/shell aperture where the light is coming from. See details in Aperture() class.
        :param anisotropy_model: type of stellar anisotropy model. See details in MamonLokasAnisotropy() class.
        :param psf_type: string, point spread functino type, current support for 'GAUSSIAN' and 'MOFFAT'
        :param fwhm: full width at half maximum seeing condition
        :param moffat_beta: float, beta parameter of Moffat profile
        :param kwargs_cosmo: keyword arguments that define the cosmology in terms of the angular diameter distances involved
        """
        self.massProfile = MassProfile(mass_profile_list, kwargs_cosmo, interpol_grid_num=interpol_grid_num,
                                         max_interpolate=max_integrate, min_interpolate=min_integrate)
        self.lightProfile = LightProfile(light_profile_list, interpol_grid_num=interpol_grid_num,
                                         max_interpolate=max_integrate, min_interpolate=min_integrate)
        self.aperture = Aperture(aperture_type)
        self.anisotropy = MamonLokasAnisotropy(anisotropy_model)

        self.cosmo = Cosmo(**kwargs_cosmo)
        self._num_sampling = sampling_number
        self._interp_grid_num = interpol_grid_num
        self._log_int = log_integration
        self._max_integrate = max_integrate  # maximal integration (and interpolation) in units of arcsecs
        self._min_integrate = min_integrate  # min integration (and interpolation) in units of arcsecs
        self._psf = PSF(psf_type=psf_type, fwhm=fwhm, moffat_beta=moffat_beta)
Пример #5
0
    def __init__(self,
                 mass_profile_list,
                 light_profile_list,
                 aperture_type='slit',
                 anisotropy_model='isotropic',
                 fwhm=0.7,
                 kwargs_cosmo={
                     'D_d': 1000,
                     'D_s': 2000,
                     'D_ds': 500
                 },
                 sampling_number=1000,
                 interpol_grid_num=500,
                 log_integration=False,
                 max_integrate=10,
                 min_integrate=0.001):
        """

        :param mass_profile_list: list of lens (mass) model profiles
        :param light_profile_list: list of light model profiles of the lensing galaxy
        :param aperture_type: type of slit/shell aperture where the light is coming from. See details in Aperture() class.
        :param anisotropy_model: type of stellar anisotropy model. See details in MamonLokasAnisotropy() class.
        :param fwhm: full width at half maximum seeing condition
        :param kwargs_numerics: keyword arguments that control the numerical computation
        :param kwargs_cosmo: keyword arguments that define the cosmology in terms of the angular diameter distances involved
        """
        self.massProfile = MassProfile(mass_profile_list,
                                       kwargs_cosmo,
                                       interpol_grid_num=interpol_grid_num,
                                       max_interpolate=max_integrate,
                                       min_interpolate=min_integrate)
        self.lightProfile = LightProfile(light_profile_list,
                                         interpol_grid_num=interpol_grid_num,
                                         max_interpolate=max_integrate,
                                         min_interpolate=min_integrate)
        self.aperture = Aperture(aperture_type)
        self.anisotropy = MamonLokasAnisotropy(anisotropy_model)
        self._fwhm = fwhm
        self.cosmo = Cosmo(**kwargs_cosmo)
        self._num_sampling = sampling_number
        self._interp_grid_num = interpol_grid_num
        self._log_int = log_integration
        self._max_integrate = max_integrate  # maximal integration (and interpolation) in units of arcsecs
        self._min_integrate = min_integrate  # min integration (and interpolation) in units of arcsecs
Пример #6
0
    def test_shell_select(self):
        aperture = Aperture()
        ra, dec = 1, 1
        r_in = 2
        r_out = 4
        bool_select = aperture.shell_select(ra,
                                            dec,
                                            r_in,
                                            r_out,
                                            center_ra=0,
                                            center_dec=0)
        assert bool_select is False

        bool_select = aperture.shell_select(3,
                                            0,
                                            r_in,
                                            r_out,
                                            center_ra=0,
                                            center_dec=0)
        assert bool_select is True
Пример #7
0
 def test_raise(self):
     with self.assertRaises(ValueError):
         Aperture(aperture_type='wrong', kwargs_aperture={})