galight.fitting_specify package

Submodules

galight.fitting_specify module

Created on Mon Sep 14 12:16:43 2020

@author: Xuheng Ding

class galight.fitting_specify.FittingSpecify(data_process_class, sersic_major_axis=True)[source]

Bases: object

A class to generate the materials for the ‘FittingSequence’, defined by ‘lenstronomy’ key materials include the following, which are prepared by ‘prepare_fitting_seq()’:

  • kwargs_data_joint: data materils

  • kwargs_model: a list of class

  • kwargs_constraints

  • kwargs_likelihood

  • kwargs_params

  • imageModel

build_fitting_seq()[source]
plot_fitting_sets(savename=None, show_plot=True)[source]

To make a plot show how the data will be fitted. The extend source will be shown using aperture, point source will be show as point source.

savename: None or string. -Defining the saving name.

show_plot: bool. -Plot or not plot. Note that figure can be saved without shown.

prepare_fitting_seq(supersampling_factor=2, psf_data=None, extend_source_model=None, point_source_num=0, ps_pix_center_list=None, fix_center_list=None, source_params=None, fix_n_list=None, fix_Re_list=None, ps_params=None, condition=None, neighborhood_size=4, threshold=5, apertures_center_focus=False, psf_error_map=None, mpi=False)[source]

Key function used to prepared for the fitting. Parameters will be passed to the corresponding functions.

sepc_imageModel(sersic_major_axis)[source]
sepc_kwargs_constraints(fix_center_list=None)[source]

Prepare the ‘kwargs_constraints’ for the fitting.

fix_center_list: list.

-if not None, describe how to fix the center [[0,0]] for example. This list defines how to ‘joint_lens_light_with_point_source’ definied by lenstronomy:

[[i_point_source, k_lens_light], […], …], see https://lenstronomy.readthedocs.io/en/latest/_modules/lenstronomy/Sampling/parameters.html?highlight=joint_lens_light_with_point_source# for example [[0, 1]], joint first (0) point source with the second extend source (1).

sepc_kwargs_data(supersampling_factor=2, psf_data=None, psf_error_map=None)[source]
sepc_kwargs_likelihood(condition=None)[source]

Prepare the ‘kwargs_likelihood’ for the fitting.

Most default values will be assigned.

condition: input as a defination.

Set up extra prior. For example if one want the first component have lower Sersic index, it can be set by first define a condition:

def condition_def(kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_special, kwargs_extinction):

logL = 0 cond_0 = (kwargs_source[0][‘n_sersic’] > kwargs_source[1][‘n_sersic’]) if cond_0:

logL -= 10**15

return logL

Then assign to condition:

fit_sepc.prepare_fitting_seq(**, condition = condition_def)

sepc_kwargs_model(extend_source_model=['SERSIC_ELLIPSE'], point_source_num=1)[source]
sepc_kwargs_params(source_params=None, fix_n_list=None, fix_Re_list=None, ps_params=None, ps_pix_center_list=None, neighborhood_size=4, threshold=5, apertures_center_focus=False)[source]

Setting up the ‘kwargs_params’ (i.e., the parameters) for the fitting. If ‘source_params’ or ‘ps_params’ are given, rather then setting as None, then, the input settings will be used.

fix_n_list: list.

Describe a prior if want to fix the Sersic index. e.g., fix_n_list= [[0,4], [1,1]], means the first (i.e., 0) fix n = 4; the second (i.e., 1) fix n = 1.

fix_Re_list: list.

Describe a prior if want to fix the Sersic effective radius. e.g., fix_n_list= [[0,0.4], [1,1]], means the first (i.e., 0) fix Reff value as 0.4.

apertures_center_focus: bool.

If true, the default parameters will have strong prior so that the center of the fitted Sersic will be closer to the apertures.

galight.fitting_specify.ps_params_generator(centers, deltaPix=1)[source]

Quickly generate a point source parameters for the fitting.

galight.fitting_specify.source_params_generator(frame_size, apertures=[], deltaPix=1, fix_n_list=None, fix_Re_list=None, apertures_center_focus=False)[source]

Quickly generate a source parameters for the fitting.

frame_size: int.

The frame size, to define the center of the frame

apertures:

The apertures of the targets

deltaPix:

The pixel size of the data

fix_n_list:

A list to define how to fix the sersic index, default = [] -for example: fix_n_list = [[0,1],[1,4]], fix first and disk and second as bulge.

apertures_center_focus:

If True, the prior of the Sersic postion will be most limited to the center of the aperture.

A Params list for the fitting.