def test_function(self): """ :return: """ ellipsoid = Ellipsoid() output = ellipsoid.function(x=1, y=1, amp=1., radius=1, e1=0, e2=0, center_x=0, center_y=0) assert output == 0 output = ellipsoid.function(x=0.99, y=0, amp=1., radius=1, e1=0, e2=0, center_x=0, center_y=0) assert output == 1. / np.pi
def __init__(self, light_model_list, smoothing=0.001): """ :param light_model_list: list of light models :param smoothing: smoothing factor for certain models (deprecated) """ self.profile_type_list = light_model_list self.func_list = [] for profile_type in light_model_list: if profile_type == 'GAUSSIAN': from lenstronomy.LightModel.Profiles.gaussian import Gaussian self.func_list.append(Gaussian()) elif profile_type == 'GAUSSIAN_ELLIPSE': from lenstronomy.LightModel.Profiles.gaussian import GaussianEllipse self.func_list.append(GaussianEllipse()) elif profile_type == 'ELLIPSOID': from lenstronomy.LightModel.Profiles.ellipsoid import Ellipsoid self.func_list.append(Ellipsoid()) elif profile_type == 'MULTI_GAUSSIAN': from lenstronomy.LightModel.Profiles.gaussian import MultiGaussian self.func_list.append(MultiGaussian()) elif profile_type == 'MULTI_GAUSSIAN_ELLIPSE': from lenstronomy.LightModel.Profiles.gaussian import MultiGaussianEllipse self.func_list.append(MultiGaussianEllipse()) elif profile_type == 'SERSIC': from lenstronomy.LightModel.Profiles.sersic import Sersic self.func_list.append(Sersic(smoothing=smoothing)) elif profile_type == 'SERSIC_ELLIPSE': from lenstronomy.LightModel.Profiles.sersic import SersicElliptic self.func_list.append( SersicElliptic(smoothing=smoothing, sersic_major_axis=sersic_major_axis_conf)) elif profile_type == 'CORE_SERSIC': from lenstronomy.LightModel.Profiles.sersic import CoreSersic self.func_list.append(CoreSersic(smoothing=smoothing)) elif profile_type == 'SHAPELETS': from lenstronomy.LightModel.Profiles.shapelets import ShapeletSet self.func_list.append(ShapeletSet()) elif profile_type == 'SHAPELETS_POLAR': from lenstronomy.LightModel.Profiles.shapelets_polar import ShapeletSetPolar self.func_list.append(ShapeletSetPolar(exponential=False)) elif profile_type == 'SHAPELETS_POLAR_EXP': from lenstronomy.LightModel.Profiles.shapelets_polar import ShapeletSetPolar self.func_list.append(ShapeletSetPolar(exponential=True)) elif profile_type == 'HERNQUIST': from lenstronomy.LightModel.Profiles.hernquist import Hernquist self.func_list.append(Hernquist()) elif profile_type == 'HERNQUIST_ELLIPSE': from lenstronomy.LightModel.Profiles.hernquist import HernquistEllipse self.func_list.append(HernquistEllipse()) elif profile_type == 'PJAFFE': from lenstronomy.LightModel.Profiles.p_jaffe import PJaffe self.func_list.append(PJaffe()) elif profile_type == 'PJAFFE_ELLIPSE': from lenstronomy.LightModel.Profiles.p_jaffe import PJaffe_Ellipse self.func_list.append(PJaffe_Ellipse()) elif profile_type == 'UNIFORM': from lenstronomy.LightModel.Profiles.uniform import Uniform self.func_list.append(Uniform()) elif profile_type == 'POWER_LAW': from lenstronomy.LightModel.Profiles.power_law import PowerLaw self.func_list.append(PowerLaw()) elif profile_type == 'NIE': from lenstronomy.LightModel.Profiles.nie import NIE self.func_list.append(NIE()) elif profile_type == 'CHAMELEON': from lenstronomy.LightModel.Profiles.chameleon import Chameleon self.func_list.append(Chameleon()) elif profile_type == 'DOUBLE_CHAMELEON': from lenstronomy.LightModel.Profiles.chameleon import DoubleChameleon self.func_list.append(DoubleChameleon()) elif profile_type == 'TRIPLE_CHAMELEON': from lenstronomy.LightModel.Profiles.chameleon import TripleChameleon self.func_list.append(TripleChameleon()) elif profile_type == 'INTERPOL': from lenstronomy.LightModel.Profiles.interpolation import Interpol self.func_list.append(Interpol()) elif profile_type == 'SLIT_STARLETS': from lenstronomy.LightModel.Profiles.starlets import SLIT_Starlets self.func_list.append( SLIT_Starlets(fast_inverse=True, second_gen=False)) elif profile_type == 'SLIT_STARLETS_GEN2': from lenstronomy.LightModel.Profiles.starlets import SLIT_Starlets self.func_list.append(SLIT_Starlets(second_gen=True)) else: raise ValueError( 'No light model of type %s found! Supported are the following models: %s' % (profile_type, _MODELS_SUPPORTED)) self._num_func = len(self.func_list)