LSST Applications g0603fd7c41+501e3db9f9,g0aad566f14+23d8574c86,g0dd44d6229+a1a4c8b791,g2079a07aa2+86d27d4dc4,g2305ad1205+a62672bbc1,g2bbee38e9b+047b288a59,g337abbeb29+047b288a59,g33d1c0ed96+047b288a59,g3a166c0a6a+047b288a59,g3d1719c13e+23d8574c86,g487adcacf7+cb7fd919b2,g4be5004598+23d8574c86,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+4a9e435310,g63cd9335cc+585e252eca,g858d7b2824+23d8574c86,g88963caddf+0cb8e002cc,g99cad8db69+43388bcaec,g9ddcbc5298+9a081db1e4,ga1e77700b3+a912195c07,gae0086650b+585e252eca,gb0e22166c9+60f28cb32d,gb2522980b2+793639e996,gb3a676b8dc+b4feba26a1,gb4b16eec92+63f8520565,gba4ed39666+c2a2e4ac27,gbb8dafda3b+a5d255a82e,gc120e1dc64+d820f8acdb,gc28159a63d+047b288a59,gc3e9b769f7+f4f1cc6b50,gcf0d15dbbd+a1a4c8b791,gdaeeff99f8+f9a426f77a,gdb0af172c8+b6d5496702,ge79ae78c31+047b288a59,w.2024.19
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lsst.scarlet.lite.initialization.FactorizedWaveletInitialization Class Reference
Inheritance diagram for lsst.scarlet.lite.initialization.FactorizedWaveletInitialization:
lsst.scarlet.lite.initialization.FactorizedInitialization

Public Member Functions

 __init__ (self, Observation observation, Sequence[tuple[int, int]] centers, slice bulge_slice=slice(None, 2), slice disk_slice=slice(2, -1), int bulge_padding=5, int disk_padding=5, bool use_psf=True, int scales=5, np.ndarray|None wavelets=None, Monotonicity|None monotonicity=None, float min_snr=50)
 
Source|None init_source (self, tuple[int, int] center)
 

Public Attributes

 detectlets
 
 bulgelets
 
 disklets
 
 bulge_grow
 
 disk_grow
 
 use_psf
 

Detailed Description

Parameters used to initialize all sources with wavelet detections

There are a large number of parameters that are universal for all of the
sources being initialized from the same set of wavelet coefficients.
To simplify the API those parameters are all initialized by this class
and passed to `init_wavelet_source` for each source.

Parameters
----------
observation:
    The multiband observation of the blend.
centers:
    The center of each source to initialize.
bulge_slice, disk_slice:
    The slice used to select the wavelet scales used for the
    bulge/disk.
bulge_padding, disk_padding:
    The number of pixels to grow the bounding box of the bulge/disk
    to leave extra room for growth in the first few iterations.
use_psf:
    Whether or not to use the PSF for single component sources.
    If `use_psf` is `False` then only sources with low signal
    at all scales are initialized with the PSF morphology.
scales:
    Number of wavelet scales to use.
wavelets:
    The array of wavelet coefficients `(scale, y, x)`
    used for detection.
monotonicity:
    When `monotonicity` is `None`,
    the component is initialized with only the
    monotonic pixels, otherwise the monotonicity operator is used to
    project the morphology to a monotonic solution.
min_snr:
    The minimum SNR required per component.
    So a 2-component source requires at least `2*min_snr` while sources
    with SNR < `min_snr` will be initialized with the PSF.

Definition at line 561 of file initialization.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.__init__ ( self,
Observation observation,
Sequence[tuple[int, int]] centers,
slice bulge_slice = slice(None, 2),
slice disk_slice = slice(2, -1),
int bulge_padding = 5,
int disk_padding = 5,
bool use_psf = True,
int scales = 5,
np.ndarray | None wavelets = None,
Monotonicity | None monotonicity = None,
float min_snr = 50 )

Reimplemented from lsst.scarlet.lite.initialization.FactorizedInitialization.

Definition at line 601 of file initialization.py.

614 ):
615 if wavelets is None:
616 wavelets = get_detect_wavelets(
617 observation.images.data,
618 observation.variance.data,
619 scales=scales,
620 )
621 wavelets[wavelets < 0] = 0
622 # The detection coadd for single component sources
623 detectlets = np.sum(wavelets[:-1], axis=0)
624 # The detection coadd for the bulge
625 bulgelets = np.sum(wavelets[bulge_slice], axis=0)
626 # The detection coadd for the disk
627 disklets = np.sum(wavelets[disk_slice], axis=0)
628
629 # The convolved image, used to initialize the spectrum
630 detect = Image(detectlets)
631 convolved = observation.convolve(detect.repeat(observation.bands), mode="real")
632
633 self.detectlets = detectlets
634 self.bulgelets = bulgelets
635 self.disklets = disklets
636 self.bulge_grow = bulge_padding
637 self.disk_grow = disk_padding
638 self.use_psf = use_psf
639
640 # Initialize the sources
641 super().__init__(observation, convolved, centers, min_snr, monotonicity)
642

Member Function Documentation

◆ init_source()

Source | None lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.init_source ( self,
tuple[int, int] center )
Initialize a source from a chi^2 detection.

Parameter
---------
center:
    The center of the source.

Reimplemented from lsst.scarlet.lite.initialization.FactorizedInitialization.

Definition at line 643 of file initialization.py.

643 def init_source(self, center: tuple[int, int]) -> Source | None:
644 """Initialize a source from a chi^2 detection.
645
646 Parameter
647 ---------
648 center:
649 The center of the source.
650 """
651 local_center = (
652 center[0] - self.observation.bbox.origin[0],
653 center[1] - self.observation.bbox.origin[1],
654 )
655 nbr_components = self.get_snr(center)
656 observation = self.observation
657
658 if (nbr_components < 1 and self.use_psf) or self.detectlets[local_center[0], local_center[1]] <= 0:
659 # Initialize the source as an PSF source
660 components = [self.get_psf_component(center)]
661 elif nbr_components < 2:
662 # Inititialize with a single component
663 component = self.get_single_component(center, self.detectlets, 0, self.disk_grow)
664 if component is not None:
665 components = [component]
666 else:
667 # Initialize with a 2 component model
668 bulge_box, bulge_morph = init_monotonic_morph(
669 self.bulgelets, center, observation.bbox, self.bulge_grow
670 )
671 disk_box, disk_morph = init_monotonic_morph(
672 self.disklets, center, observation.bbox, self.disk_grow
673 )
674 if bulge_morph is None or disk_morph is None:
675 if bulge_morph is None:
676 if disk_morph is None:
677 return None
678 # One of the components was null,
679 # so initialize as a single component
680 component = self.get_single_component(center, self.detectlets, 0, self.disk_grow)
681 if component is not None:
682 components = [component]
683 else:
684 local_bulge_box = bulge_box - self.observation.bbox.origin
685 local_disk_box = disk_box - self.observation.bbox.origin
686 bulge_morph = bulge_morph[local_bulge_box.slices]
687 disk_morph = disk_morph[local_disk_box.slices]
688
689 bulge_spectrum, disk_spectrum = multifit_spectra(
690 observation,
691 [
692 Image(bulge_morph, yx0=cast(tuple[int, int], bulge_box.origin)),
693 Image(disk_morph, yx0=cast(tuple[int, int], disk_box.origin)),
694 ],
695 )
696
697 components = []
698 if np.sum(bulge_spectrum != 0):
699 components.append(
700 FactorizedComponent(
701 observation.bands,
702 bulge_spectrum,
703 bulge_morph,
704 bulge_box,
705 center,
706 monotonicity=self.monotonicity,
707 )
708 )
709 else:
710 logger.debug("cut bulge")
711 if np.sum(disk_spectrum) != 0:
712 components.append(
713 FactorizedComponent(
714 observation.bands,
715 disk_spectrum,
716 disk_morph,
717 disk_box,
718 center,
719 monotonicity=self.monotonicity,
720 )
721 )
722 else:
723 logger.debug("cut disk")
724 return Source(components) # type: ignore

Member Data Documentation

◆ bulge_grow

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.bulge_grow

Definition at line 636 of file initialization.py.

◆ bulgelets

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.bulgelets

Definition at line 634 of file initialization.py.

◆ detectlets

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.detectlets

Definition at line 633 of file initialization.py.

◆ disk_grow

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.disk_grow

Definition at line 637 of file initialization.py.

◆ disklets

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.disklets

Definition at line 635 of file initialization.py.

◆ use_psf

lsst.scarlet.lite.initialization.FactorizedWaveletInitialization.use_psf

Definition at line 638 of file initialization.py.


The documentation for this class was generated from the following file: