SourceXtractorPlusPlus  0.13
Please provide a description of the project.
Classes | Functions | Variables
sourcextractor.config.model_fitting Namespace Reference

Classes

class  ConstantModel
 
class  ConstantParameter
 
class  CoordinateModelBase
 
class  DependentParameter
 
class  DeVaucouleursModel
 
class  ExponentialModel
 
class  FluxParameterType
 
class  FreeParameter
 
class  ModelBase
 
class  ParameterBase
 
class  PointSourceModel
 
class  Prior
 
class  Range
 
class  RangeType
 
class  SersicModel
 
class  SersicModelBase
 
class  Unbounded
 
class  WorldCoordinate
 

Functions

def print_parameters (file=sys.stderr)
 
def get_pos_parameters ()
 
def get_flux_parameter (type=FluxParameterType.ISO, scale=1)
 
def add_prior (param, value, sigma)
 
def _set_model_to_frames (group, model)
 
def add_model (group, model)
 
def print_model_fitting_info (group, show_params=False, prefix='', file=sys.stderr)
 
def set_max_iterations (iterations)
 
def set_modified_chi_squared_scale (scale)
 
def set_engine (engine)
 
def pixel_to_world_coordinate (x, y)
 
def get_sky_coord (x, y)
 
def radius_to_wc_angle (x, y, rad)
 
def get_separation_angle (x1, y1, x2, y2)
 
def get_position_angle (x1, y1, x2, y2)
 
def set_coordinate_system (cs)
 
def get_world_position_parameters (x, y)
 
def get_world_parameters (x, y, radius, angle, ratio)
 

Variables

dictionary constant_parameter_dict = {}
 
dictionary free_parameter_dict = {}
 
dictionary dependent_parameter_dict = {}
 
dictionary prior_dict = {}
 
dictionary frame_models_dict = {}
 
dictionary constant_model_dict = {}
 
dictionary point_source_model_dict = {}
 
dictionary sersic_model_dict = {}
 
dictionary exponential_model_dict = {}
 
dictionary de_vaucouleurs_model_dict = {}
 
dictionary params_dict = {"max_iterations": 100, "modified_chi_squared_scale": 10, "engine": ""}
 

Function Documentation

◆ _set_model_to_frames()

def sourcextractor.config.model_fitting._set_model_to_frames (   group,
  model 
)
private

Definition at line 432 of file model_fitting.py.

Referenced by sourcextractor.config.model_fitting.add_model().

◆ add_model()

def sourcextractor.config.model_fitting.add_model (   group,
  model 
)
Add a model to be fitted to the given group.

Parameters
----------
group : MeasurementGroup
model : ModelBase

Definition at line 442 of file model_fitting.py.

References sourcextractor.config.model_fitting._set_model_to_frames().

Here is the call graph for this function:

◆ add_prior()

def sourcextractor.config.model_fitting.add_prior (   param,
  value,
  sigma 
)
Add a prior to the given parameter.

Parameters
----------
param : ParameterBase
value : float or callable that receives a source and returns a float
    Mean of the Gaussian
sigma : float or callable that receives a source and returns a float
    Standard deviation of the Gaussian

Definition at line 413 of file model_fitting.py.

◆ get_flux_parameter()

def sourcextractor.config.model_fitting.get_flux_parameter (   type = FluxParameterType.ISO,
  scale = 1 
)
Convenience function for the flux parameter.

Parameters
----------
type : int
    One of the values defined in FluxParameterType
scale : float
    Scaling of the initial flux. Defaults to 1.

Returns
-------
flux : FreeParameter
    Flux parameter, starting at the flux defined by `type`, and limited to +/- 1e3 times the initial value.

Definition at line 364 of file model_fitting.py.

◆ get_pos_parameters()

def sourcextractor.config.model_fitting.get_pos_parameters ( )
Convenience function for the position parameter X and Y.

Returns
-------
x : FreeParameter
    X coordinate, starting at the X coordinate of the centroid and linearly limited to X +/- the object radius.
y : FreeParameter
    Y coordinate, starting at the Y coordinate of the centroid and linearly limited to Y +/- the object radius.
Notes
-----
X and Y are fitted on the detection image X and Y coordinates. Internally, these are translated to measurement
images using the WCS headers.

Definition at line 335 of file model_fitting.py.

◆ get_position_angle()

def sourcextractor.config.model_fitting.get_position_angle (   x1,
  y1,
  x2,
  y2 
)
Get the position angle in sky coordinates for two points defined in pixels on the detection image.

Parameters
----------
x1
y1
x2
y2

Returns
-------
Position angle in degrees, normalized to -/+ 90

Definition at line 909 of file model_fitting.py.

References sourcextractor.config.model_fitting.get_sky_coord().

Referenced by sourcextractor.config.model_fitting.get_world_parameters().

Here is the call graph for this function:

◆ get_separation_angle()

def sourcextractor.config.model_fitting.get_separation_angle (   x1,
  y1,
  x2,
  y2 
)
Get the separation angle in sky coordinates for two points defined in pixels on the detection image.

Parameters
----------
x1 : float
y1 : float
x2 : float
y2 : float

Returns
-------
Separation in degrees

Definition at line 889 of file model_fitting.py.

References sourcextractor.config.model_fitting.get_sky_coord().

Referenced by sourcextractor.config.model_fitting.get_world_parameters(), and sourcextractor.config.model_fitting.radius_to_wc_angle().

Here is the call graph for this function:

◆ get_sky_coord()

def sourcextractor.config.model_fitting.get_sky_coord (   x,
  y 
)
Transform an (X, Y) in pixel coordinates on the detection image to astropy SkyCoord.

Parameters
----------
x : float
y : float

Returns
-------
SkyCoord

Definition at line 854 of file model_fitting.py.

References sourcextractor.config.model_fitting.pixel_to_world_coordinate().

Referenced by sourcextractor.config.model_fitting.get_position_angle(), and sourcextractor.config.model_fitting.get_separation_angle().

Here is the call graph for this function:

◆ get_world_parameters()

def sourcextractor.config.model_fitting.get_world_parameters (   x,
  y,
  radius,
  angle,
  ratio 
)
Convenience function for generating five dependent parameters, in world coordinates, for the position
and shape of a model.

Parameters
----------
x : ParameterBase
y : ParameterBase
radius : ParameterBase
angle : ParameterBase
ratio : ParameterBase

Returns
-------
ra : DependentParameter
    Right ascension
dec : DependentParameter
    Declination
rad : DependentParameter
    Radius as degrees
angle : DependentParameter
    Angle in degrees
ratio : DependentParameter
    Aspect ratio. It has to be recomputed as the axis of the ellipse may have different ratios
    in image coordinates than in world coordinates

Examples
--------
>>> flux = get_flux_parameter()
>>> x, y = get_pos_parameters()
>>> radius = FreeParameter(lambda o: o.get_radius(), Range(lambda v, o: (.01 * v, 100 * v), RangeType.EXPONENTIAL))
>>> angle = FreeParameter(lambda o: o.get_angle(), Range((-np.pi, np.pi), RangeType.LINEAR))
>>> ratio = FreeParameter(1, Range((0, 10), RangeType.LINEAR))
>>> add_model(group, ExponentialModel(x, y, flux, radius, ratio, angle))
>>> ra, dec, wc_rad, wc_angle, wc_ratio = get_world_parameters(x, y, radius, angle, ratio)
>>> add_output_column('mf_world_angle', wc_angle)

Definition at line 971 of file model_fitting.py.

References sourcextractor.config.model_fitting.get_position_angle(), sourcextractor.config.model_fitting.get_separation_angle(), and sourcextractor.config.model_fitting.pixel_to_world_coordinate().

Here is the call graph for this function:

◆ get_world_position_parameters()

def sourcextractor.config.model_fitting.get_world_position_parameters (   x,
  y 
)
Convenience function for generating two dependent parameter with world (alpha, delta) coordinates
from image (X, Y) coordinates.

Parameters
----------
x : ParameterBase
y : ParameterBase

Returns
-------
ra : DependentParameter
dec : DependentParameter

See Also
--------
get_pos_parameters

Examples
--------
>>> x, y = get_pos_parameters()
>>> ra, dec = get_world_position_parameters(x, y)
>>> add_output_column('mf_ra', ra)
>>> add_output_column('mf_dec', dec)

Definition at line 940 of file model_fitting.py.

References sourcextractor.config.model_fitting.pixel_to_world_coordinate().

Here is the call graph for this function:

◆ pixel_to_world_coordinate()

def sourcextractor.config.model_fitting.pixel_to_world_coordinate (   x,
  y 
)
Transform an (X, Y) in pixel coordinates on the detection image to (RA, DEC) in world coordinates.
Parameters
----------
x : float
y : float

Returns
-------
WorldCoordinate

Definition at line 837 of file model_fitting.py.

Referenced by sourcextractor.config.model_fitting.get_sky_coord(), sourcextractor.config.model_fitting.get_world_parameters(), and sourcextractor.config.model_fitting.get_world_position_parameters().

◆ print_model_fitting_info()

def sourcextractor.config.model_fitting.print_model_fitting_info (   group,
  show_params = False,
  prefix = '',
  file = sys.stderr 
)
Print a human-readable representation of the configured models.

Parameters
----------
group : MeasurementGroup
    Print the models for this group.
show_params : bool
    If True, print also the parameters that belong to the model
prefix : str
    Prefix each line with this string. Used internally for indentation.
file : file object
    Where to print the representation. Defaults to sys.stderr

Definition at line 459 of file model_fitting.py.

◆ print_parameters()

def sourcextractor.config.model_fitting.print_parameters (   file = sys.stderr)
Print a human-readable representation of the configured model fitting parameters.

Parameters
----------
file : file object
    Where to print the representation. Defaults to sys.stderr

Definition at line 160 of file model_fitting.py.

◆ radius_to_wc_angle()

def sourcextractor.config.model_fitting.radius_to_wc_angle (   x,
  y,
  rad 
)
Transform a radius in pixels on the detection image to a radius in sky coordinates.

Parameters
----------
x : float
y : float
rad : float

Returns
-------
Radius in degrees

Definition at line 872 of file model_fitting.py.

References sourcextractor.config.model_fitting.get_separation_angle().

Here is the call graph for this function:

◆ set_coordinate_system()

def sourcextractor.config.model_fitting.set_coordinate_system (   cs)
Set the global coordinate system. This function is used internally by SourceXtractor++.

Definition at line 932 of file model_fitting.py.

◆ set_engine()

def sourcextractor.config.model_fitting.set_engine (   engine)
Parameters
----------
engine : str
    Minimization engine for the model fitting : levmar or gsl

Definition at line 515 of file model_fitting.py.

◆ set_max_iterations()

def sourcextractor.config.model_fitting.set_max_iterations (   iterations)
Parameters
----------
iterations : int
    Max number of iterations for the model fitting.

Definition at line 492 of file model_fitting.py.

◆ set_modified_chi_squared_scale()

def sourcextractor.config.model_fitting.set_modified_chi_squared_scale (   scale)
Parameters
----------
scale : float
    Sets u0, as used by the modified chi squared residual comparator, a function that reduces the effect of large
    deviations.
    Refer to the SourceXtractor++ documentation for a better explanation of how residuals are computed and how
    this value affects the model fitting.

Definition at line 502 of file model_fitting.py.

Variable Documentation

◆ constant_model_dict

dictionary sourcextractor.config.model_fitting.constant_model_dict = {}

Definition at line 484 of file model_fitting.py.

◆ constant_parameter_dict

dictionary sourcextractor.config.model_fitting.constant_parameter_dict = {}

Definition at line 155 of file model_fitting.py.

◆ de_vaucouleurs_model_dict

dictionary sourcextractor.config.model_fitting.de_vaucouleurs_model_dict = {}

Definition at line 488 of file model_fitting.py.

◆ dependent_parameter_dict

dictionary sourcextractor.config.model_fitting.dependent_parameter_dict = {}

Definition at line 157 of file model_fitting.py.

◆ exponential_model_dict

dictionary sourcextractor.config.model_fitting.exponential_model_dict = {}

Definition at line 487 of file model_fitting.py.

◆ frame_models_dict

dictionary sourcextractor.config.model_fitting.frame_models_dict = {}

Definition at line 429 of file model_fitting.py.

◆ free_parameter_dict

dictionary sourcextractor.config.model_fitting.free_parameter_dict = {}

Definition at line 156 of file model_fitting.py.

◆ params_dict

dictionary sourcextractor.config.model_fitting.params_dict = {"max_iterations": 100, "modified_chi_squared_scale": 10, "engine": ""}

Definition at line 489 of file model_fitting.py.

◆ point_source_model_dict

dictionary sourcextractor.config.model_fitting.point_source_model_dict = {}

Definition at line 485 of file model_fitting.py.

◆ prior_dict

dictionary sourcextractor.config.model_fitting.prior_dict = {}

Definition at line 386 of file model_fitting.py.

◆ sersic_model_dict

dictionary sourcextractor.config.model_fitting.sersic_model_dict = {}

Definition at line 486 of file model_fitting.py.