GaussianMorphology#
- class scarlet2.GaussianMorphology(size, ellipticity=None, shape=None)[source]#
Bases:
ProfileMorphologyGaussian radial profile
- ellipticity: (None, <function array at 0x7fe56388e8e0>)#
Ellipticity of the profile
- f(r2)[source]#
Radial profile function
- Parameters:
r2 (
floatorarray) – Radius (distance from the center) squared
- static from_image(image)[source]#
Create Gaussian radial profile from the 2nd moments of image
- Parameters:
image (
array) – 2D array to measureMomentsfrom.- Return type:
- static from_moments(g, shape=None)[source]#
Create Gaussian radial profile from the moments g
- Parameters:
g (
Moments) – Moments, order >= 2shape (
tuple) – Shape of the bounding box
- Return type:
- get(name=None)#
Get parameter(s) from this module
- Parameters:
name (
str, optional) – Name of parameter. If not set, returns all parameters.- Returns:
requested data arrays for parameters
- Return type:
dict
- property parameters#
Parameters defined for this module
- Returns:
name: (node, param) mapping for all parameters
- Return type:
dict
- replace(name, value)#
Replace member attribuge name with value
- Parameters:
name (
str) – Name of member to replacevalue (
any) – Value to replace member with
- Returns:
The modified module.
- Return type:
- replace_subtree(where, value, parameters=None)#
Replace the subtree where(self) with value and carry over all other parameters
Unlike
replace(), value does not need to have the same structure as the subtree it replaces, e.g. an array morphology can be replaced by aSersicMorphology. Parameters defined for this module remain attached to the same nodes, except those inside the replaced subtree, which are dropped.- Parameters:
where (
callable) – Function module -> node that selects the subtree to replace, as inequinox.tree_at()value (
any) – Replacement for the subtree. If this module has a frame, attributes of value given in sky coordinates are converted to pixel coordinates of that frame.parameters (
callable, optional) – Function module -> None that is called with the new module inside of aParameterscontext to define parameters for the replacement, e.g. by callingParameteron nodes of value.
- Returns:
The modified module.
- Return type:
Examples
>>> sersic = SersicMorphology(n=jnp.array(2.), size=jnp.array(2.), shape=morph.shape) >>> def sersic_parameters(morph): >>> Parameter(morph.n, name="n:0", prior=dist.Uniform(0.5, 6)) >>> Parameter(morph.size, name="size:0", constraint=constraints.positive, stepsize=0.1) >>> >>> scene_ = scene.replace_subtree(lambda sc: sc.sources[0].morphology, sersic, sersic_parameters)
See also
- set(values)#
Set parameter(s) from this module with values
- Parameters:
values (
dict[str,jnp.array]) – values to replace parameters with, identified by their name- Returns:
new module with parameter(s) replaced by values
- Return type:
- property shape#
Shape of the bounding box for the profile.
If not set during __init__, uses a square box with an odd number of pixels not smaller than 10*size.