Skip to content

Commit

Permalink
add ComputeExPsfConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
PFLeget committed Oct 10, 2024
1 parent 8fbbff3 commit 9c26806
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
16 changes: 13 additions & 3 deletions python/lsst/meas/algorithms/computeExPsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,24 @@


from lsst.meas.algorithms.treecorrUtils import TreecorrConfig
from lsst.pex.config import Config, ConfigField
from lsst.pipe.base import Task
import lsst.pipe.base as pipeBase
import treecorr
import copy
import numpy.typing as npt


__all__ = ("ComputeExPsfTask")
__all__ = ("ComputeExPsfTask", "ComputeExPsfConfig")


class ComputeExPsfConfig(Config):
"""Config class of ComputeExPsfTask."""

treecorr_config = ConfigField(
dtype=TreecorrConfig,
doc="treecorr config.",
)


class ComputeExPsfTask(Task):
Expand Down Expand Up @@ -67,7 +77,7 @@ class ComputeExPsfTask(Task):
in an angular bin define in TreecorrConfig.
"""

ConfigClass = TreecorrConfig
ConfigClass = ComputeExPsfConfig
_DefaultName = "computeExPsf"

def run(
Expand All @@ -89,7 +99,7 @@ def run(
cat1 = treecorr.Catalog(k=de1, **kwargs_cat)
cat2 = treecorr.Catalog(k=de2, **kwargs_cat)

config_kk = self.config.toDict()
config_kk = self.config.treecorr_config.toDict()

kk = treecorr.KKCorrelation(config_kk)

Expand Down
30 changes: 15 additions & 15 deletions tests/test_computeExPsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ def test_comp_ex_psf(self) -> None:

config = ComputeExPsfTask.ConfigClass()

config.min_sep = 0.01
config.max_sep = 5.0
config.nbins = 1
config.bin_type = "Linear"
config.sep_units = "arcmin"
config.treecorr_config.min_sep = 0.01
config.treecorr_config.max_sep = 5.0
config.treecorr_config.nbins = 1
config.treecorr_config.bin_type = "Linear"
config.treecorr_config.sep_units = "arcmin"

task = ComputeExPsfTask(config)
output1 = task.run(self.de1, self.de2, ra, dec, units="arcmin")
Expand All @@ -242,11 +242,11 @@ def test_comp_ex_psf(self) -> None:

config = ComputeExPsfTask.ConfigClass()

config.min_sep = 5.0
config.max_sep = 600.0
config.nbins = 1
config.bin_type = "Linear"
config.sep_units = "arcmin"
config.treecorr_config.min_sep = 5.0
config.treecorr_config.max_sep = 600.0
config.treecorr_config.nbins = 1
config.treecorr_config.bin_type = "Linear"
config.treecorr_config.sep_units = "arcmin"

# At intermediar scale, expect E1>E2>Ex.

Expand All @@ -259,11 +259,11 @@ def test_comp_ex_psf(self) -> None:

config = ComputeExPsfTask.ConfigClass()

config.min_sep = 600.0
config.max_sep = 1000.0
config.nbins = 1
config.bin_type = "Linear"
config.sep_units = "arcmin"
config.treecorr_config.min_sep = 600.0
config.treecorr_config.max_sep = 1000.0
config.treecorr_config.nbins = 1
config.treecorr_config.bin_type = "Linear"
config.treecorr_config.sep_units = "arcmin"

# At large scale, expect the scalar two-point correlation function to
# be all close to 0.
Expand Down

0 comments on commit 9c26806

Please sign in to comment.