示例#1
0
    def __init__(self, point_source_type_list, lensModel=None, fixed_magnification_list=None, additional_images_list=None,
                 save_cache=False):
        """

        :param point_source_model_list:
        :param lensModel:
        """
        self._lensModel = lensModel
        self._point_source_type_list = point_source_type_list
        self._point_source_list = []
        if fixed_magnification_list is None:
            fixed_magnification_list = [False] * len(point_source_type_list)
        self._fixed_magnification_list = fixed_magnification_list
        if additional_images_list is None:
            additional_images_list = [False] * len(point_source_type_list)
        for i, model in enumerate(point_source_type_list):
            if model == 'UNLENSED':
                from lenstronomy.PointSource.point_source_types import Unlensed
                self._point_source_list.append(PointSourceCached(Unlensed(), save_cache=save_cache))
            elif model == 'LENSED_POSITION':
                from lenstronomy.PointSource.point_source_types import LensedPositions
                self._point_source_list.append(PointSourceCached(LensedPositions(lensModel, fixed_magnification=fixed_magnification_list[i],
                                                               additional_image=additional_images_list[i]), save_cache=save_cache))
            elif model == 'SOURCE_POSITION':
                from lenstronomy.PointSource.point_source_types import SourcePositions
                self._point_source_list.append(PointSourceCached(SourcePositions(lensModel,
                                                                 fixed_magnification=fixed_magnification_list[i]),
                                                                 save_cache=save_cache))
            elif model == 'NONE':
                pass
            else:
                raise ValueError("Point-source model %s not available" % model)
示例#2
0
    def __init__(self, point_source_type_list, lensModel=None, fixed_magnification_list=None,
                 additional_images_list=None, flux_from_point_source_list=None, magnification_limit=None,
                 save_cache=False, kwargs_lens_eqn_solver=None):
        """
        min_distance=0.05, search_window=5, precision_limit=10**(-10), num_iter_max=100,
                 x_center=0, y_center=0):
        :param point_source_type_list: list of point source types
        :param lensModel: instance of the LensModel() class
        :param fixed_magnification_list: list of bools (same length as point_source_type_list). If True, magnification
        ratio of point sources is fixed to the one given by the lens model
        :param additional_images_list: list of bools (same length as point_source_type_list). If True, search for
        additional images of the same source is conducted.
        :param flux_from_point_source_list: list of bools (optional), if set, will only return image positions
         (for imaging modeling) for the subset of the point source lists that =True. This option enables to model
        :param magnification_limit: float >0 or None, if float is set and additional images are computed, only those
         images will be computed that exceed the lensing magnification (absolute value) limit
        :param save_cache: bool, saves image positions and only if delete_cache is executed, a new solution of the lens
         equation is conducted with the lens model parameters provided. This can increase the speed as multiple times the
         image positions are requested for the same lens model. Attention in usage!
        :param kwargs_lens_eqn_solver: keyword arguments specifying the numerical settings for the lens equation solver
         see LensEquationSolver() class for details

        for the parameters: min_distance=0.01, search_window=5, precision_limit=10**(-10), num_iter_max=100
        have a look at the lensEquationSolver class

        """
        self._lensModel = lensModel
        self.point_source_type_list = point_source_type_list
        self._point_source_list = []
        if fixed_magnification_list is None:
            fixed_magnification_list = [False] * len(point_source_type_list)
        self._fixed_magnification_list = fixed_magnification_list
        if additional_images_list is None:
            additional_images_list = [False] * len(point_source_type_list)
        if flux_from_point_source_list is None:
            flux_from_point_source_list = [True] * len(point_source_type_list)
        self._flux_from_point_source_list = flux_from_point_source_list
        for i, model in enumerate(point_source_type_list):
            if model == 'UNLENSED':
                from lenstronomy.PointSource.point_source_types import Unlensed
                self._point_source_list.append(PointSourceCached(Unlensed(), save_cache=save_cache))
            elif model == 'LENSED_POSITION':
                from lenstronomy.PointSource.point_source_types import LensedPositions
                self._point_source_list.append(PointSourceCached(LensedPositions(lensModel, fixed_magnification=fixed_magnification_list[i],
                                                               additional_image=additional_images_list[i]), save_cache=save_cache))
            elif model == 'SOURCE_POSITION':
                from lenstronomy.PointSource.point_source_types import SourcePositions
                self._point_source_list.append(PointSourceCached(SourcePositions(lensModel,
                                                                 fixed_magnification=fixed_magnification_list[i]),
                                                                 save_cache=save_cache))
            else:
                raise ValueError("Point-source model %s not available" % model)
        if kwargs_lens_eqn_solver is None:
            kwargs_lens_eqn_solver = {}
        self._kwargs_lens_eqn_solver = kwargs_lens_eqn_solver
        self._magnification_limit = magnification_limit
        self._save_cache = save_cache
示例#3
0
    def __init__(self,
                 point_source_type_list,
                 lensModel=None,
                 fixed_magnification_list=None,
                 additional_images_list=None,
                 save_cache=False,
                 min_distance=0.01,
                 search_window=5,
                 precision_limit=10**(-10),
                 num_iter_max=100):
        """

        :param point_source_model_list:
        :param lensModel: instance of the LensModel() class

        for the parameters: min_distance=0.01, search_window=5, precision_limit=10**(-10), num_iter_max=100
        have a look at the lensEquationSolver class

        """
        self._lensModel = lensModel
        self._point_source_type_list = point_source_type_list
        self._point_source_list = []
        if fixed_magnification_list is None:
            fixed_magnification_list = [False] * len(point_source_type_list)
        self._fixed_magnification_list = fixed_magnification_list
        if additional_images_list is None:
            additional_images_list = [False] * len(point_source_type_list)
        for i, model in enumerate(point_source_type_list):
            if model == 'UNLENSED':
                from lenstronomy.PointSource.point_source_types import Unlensed
                self._point_source_list.append(
                    PointSourceCached(Unlensed(), save_cache=save_cache))
            elif model == 'LENSED_POSITION':
                from lenstronomy.PointSource.point_source_types import LensedPositions
                self._point_source_list.append(
                    PointSourceCached(LensedPositions(
                        lensModel,
                        fixed_magnification=fixed_magnification_list[i],
                        additional_image=additional_images_list[i]),
                                      save_cache=save_cache))
            elif model == 'SOURCE_POSITION':
                from lenstronomy.PointSource.point_source_types import SourcePositions
                self._point_source_list.append(
                    PointSourceCached(SourcePositions(
                        lensModel,
                        fixed_magnification=fixed_magnification_list[i]),
                                      save_cache=save_cache))
            else:
                raise ValueError("Point-source model %s not available" % model)
        self._min_distance, self._search_window, self._precision_limit, self._num_iter_max = min_distance, search_window, precision_limit, num_iter_max
示例#4
0
    def __init__(self,
                 point_source_type_list,
                 lensModel=None,
                 fixed_magnification_list=None,
                 additional_images_list=None,
                 save_cache=False,
                 min_distance=0.01,
                 search_window=5,
                 precision_limit=10**(-10),
                 num_iter_max=100,
                 x_center=0,
                 y_center=0):
        """

        :param point_source_type_list: list of point source types
        :param lensModel: instance of the LensModel() class
        :param fixed_magnification_list: list of bools (same length as point_source_type_list). If True, magnification
        ratio of point sources is fixed to the one given by the lens model
        :param additional_images_list: list of bools (same length as point_source_type_list). If True, search for
        additional images of the same source is conducted.
        :param save_cache: bool, saves image positions and only if delete_cache is executed, a new solution of the lens
        equation is conducted with the lens model parameters provided. This can increase the speed as multiple times the
        image positions are requested for the same lens model. Attention in usage!
        :param min_distance: float, minimum initial search grid for image positions when solving the lens equation.
        Image separations below this scale will not be found.
        :param search_window: window size of the image position search with the lens equation solver.
        Please adopt when dealing with wider separation image positions!
        :param precision_limit: see LensEquationSolver() instance
        :param num_iter_max: see LensEquationSolver() instance
        :param x_center: center of search window
        :param y_center: center of search window

        for the parameters: min_distance=0.01, search_window=5, precision_limit=10**(-10), num_iter_max=100
        have a look at the lensEquationSolver class

        """
        self._lensModel = lensModel
        self._point_source_type_list = point_source_type_list
        self._point_source_list = []
        if fixed_magnification_list is None:
            fixed_magnification_list = [False] * len(point_source_type_list)
        self._fixed_magnification_list = fixed_magnification_list
        if additional_images_list is None:
            additional_images_list = [False] * len(point_source_type_list)
        for i, model in enumerate(point_source_type_list):
            if model == 'UNLENSED':
                from lenstronomy.PointSource.point_source_types import Unlensed
                self._point_source_list.append(
                    PointSourceCached(Unlensed(), save_cache=save_cache))
            elif model == 'LENSED_POSITION':
                from lenstronomy.PointSource.point_source_types import LensedPositions
                self._point_source_list.append(
                    PointSourceCached(LensedPositions(
                        lensModel,
                        fixed_magnification=fixed_magnification_list[i],
                        additional_image=additional_images_list[i]),
                                      save_cache=save_cache))
            elif model == 'SOURCE_POSITION':
                from lenstronomy.PointSource.point_source_types import SourcePositions
                self._point_source_list.append(
                    PointSourceCached(SourcePositions(
                        lensModel,
                        fixed_magnification=fixed_magnification_list[i]),
                                      save_cache=save_cache))
            else:
                raise ValueError("Point-source model %s not available" % model)
        self._min_distance, self._search_window, self._precision_limit, self._num_iter_max, self._x_center, self._y_center = min_distance, search_window, precision_limit, num_iter_max, x_center, y_center