SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
sourcextractor.config.model_fitting Namespace Reference

Classes

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

Functions

 get_pos_parameters ()
 get_flux_parameter (type=FluxParameterType.ISO, scale=1)
 pixel_to_world_coordinate (x, y)
 get_sky_coord (x, y)
 radius_to_wc_angle (x, y, rad)
 get_separation_angle (x1, y1, x2, y2)
 get_position_angle (x1, y1, x2, y2)
 get_world_position_parameters (x, y)
 get_world_parameters (x, y, radius, angle, ratio)
 print_model_fitting_info (group, show_params=False, prefix='', file=sys.stderr)

Function Documentation

◆ get_flux_parameter()

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 374 of file model_fitting.py.

◆ get_pos_parameters()

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 344 of file model_fitting.py.

◆ get_position_angle()

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 899 of file model_fitting.py.

References get_sky_coord().

Referenced by get_world_parameters().

Here is the call graph for this function:

◆ get_separation_angle()

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 879 of file model_fitting.py.

References get_sky_coord().

Referenced by get_world_parameters(), and radius_to_wc_angle().

Here is the call graph for this function:

◆ get_sky_coord()

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 844 of file model_fitting.py.

References pixel_to_world_coordinate().

Referenced by get_position_angle(), and get_separation_angle().

Here is the call graph for this function:

◆ get_world_parameters()

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.radius, Range(lambda v, o: (.01 * v, 100 * v), RangeType.EXPONENTIAL))
>>> angle = FreeParameter(lambda o: o.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 953 of file model_fitting.py.

References get_position_angle(), get_separation_angle(), and pixel_to_world_coordinate().

Here is the call graph for this function:

◆ get_world_position_parameters()

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 922 of file model_fitting.py.

References pixel_to_world_coordinate().

Here is the call graph for this function:

◆ pixel_to_world_coordinate()

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 826 of file model_fitting.py.

Referenced by get_sky_coord(), get_world_parameters(), and get_world_position_parameters().

◆ print_model_fitting_info()

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 1259 of file model_fitting.py.

References print_model_fitting_info().

Referenced by print_model_fitting_info().

Here is the call graph for this function:

◆ radius_to_wc_angle()

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 862 of file model_fitting.py.

References get_separation_angle().

Here is the call graph for this function: