scarlet.constraint

class scarlet.constraint.CenterOnConstraint(tiny=1e-06)[source]

Bases: Constraint

Sets the center pixel to a tiny non-zero value

Methods

__call__(morph, step)

Proximal mapping

class scarlet.constraint.Constraint(f=None)[source]

Bases: object

Constraint base class

Constraints encode expected properties of the solution. Mathematically, they are the consequence of adding potentially non-differentiable penalty functions to the model fitting loss function.

As we use proximal gradient methods, all constraints act as proxmimal operators, i.e. they need to have the following signature:

f(X, step) -> X’

where X’ is the closest point to X that satisfies the feasibility criterion of the penalty function.

For reference, every operator of the proxmin package yields a valid Constraint.

Methods

__call__(X, step)

Proximal mapping

class scarlet.constraint.ConstraintChain(*constraints, repeat=1)[source]

Bases: object

An ordered list of `Constraint`s.

Uses the concept of alternating projections onto convex sets to find solutions that are feasible according to a list of constraints.

Parameters:
constraints: list of `Constraint`
repeat: int

How often the constrain chain is repeated to ensure feasibility

Methods

__call__(X, step)

Call self as a function.

class scarlet.constraint.L0Constraint(thresh, type='absolute')[source]

Bases: Constraint

Methods

__call__(X, step)

Proximal mapping

class scarlet.constraint.L1Constraint(thresh, type='absolute')[source]

Bases: Constraint

Methods

__call__(X, step)

Proximal mapping

class scarlet.constraint.LeakyConstraint(constraint, leak=0.05)[source]

Bases: Constraint

Make a constraint leak the original value with a configurable amount:

Updates x = (1-leak) * prox(x, step) + leak * x

Methods

__call__(x, step)

Proximal mapping

class scarlet.constraint.MonotonicMaskConstraint(center, center_radius=1, variance=0.0, max_iter=3)[source]

Bases: Constraint

Make morphology monotonic by branching from the center

Methods

__call__(morph, step)

Proximal mapping

class scarlet.constraint.MonotonicityConstraint(neighbor_weight='flat', min_gradient=0.1, use_mask=False, fit_center_radius=0)[source]

Bases: Constraint

Make morphology monotonically decrease from the center

See ~scarlet.operator.prox_monotonic for a description of the other parameters.

Methods

__call__(morph, step)

Proximal mapping

class scarlet.constraint.NormalizationConstraint(type='sum')[source]

Bases: Constraint

Methods

__call__(X, step)

Proximal mapping

class scarlet.constraint.PositivityConstraint(zero=0)[source]

Bases: Constraint

Allow only values not smaller than zero.

Methods

__call__(X, step)

Proximal mapping

class scarlet.constraint.SymmetryConstraint(strength=1)[source]

Bases: Constraint

Make the source symmetric about its center

See ~scarlet.operator.prox_uncentered_symmetry for a description of the parameters.

Methods

__call__(morph, step)

Proximal mapping

class scarlet.constraint.ThresholdConstraint(f=None)[source]

Bases: Constraint

Set a cutoff threshold for pixels below the noise

Use the log histogram of pixel values to determine when the source is fitting noise. This function works well to prevent faint sources from growing large footprints but for large diffuse galaxies with a wide range of pixel values this does not work as well.

The region that contains flux above the threshold is contained in component.bboxes[“thresh”].

Methods

__call__(X, step)

Proximal mapping

threshold(morph)

Find the threshold value for a given morphology

threshold(morph)[source]

Find the threshold value for a given morphology