Skip to content

Commit

Permalink
Move log_linear_ells to generators
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpaterno committed Sep 18, 2024
1 parent f7f5703 commit 5fc0fb6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 16 additions & 0 deletions firecrown/generators/two_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ def generate(self) -> npt.NDArray[np.int64]:
# Round the results to the nearest integer values.
# N.B. the dtype of the result is np.dtype[float64]
return np.unique(np.around(concatenated)).astype(np.int64)


def log_linear_ells(
*, minimum: int, midpoint: int, maximum: int, n_log: int
) -> npt.NDArray[np.int64]:
"""Create an array of ells to sample the power spectrum.
This is used for for real-space predictions. The result will contain
each integral value from min to mid. Starting from mid, and going up
to max, there will be n_log logarithmically spaced values.
All values are rounded to the nearest integer.
"""
return LogLinearElls(
minimum=minimum, midpoint=midpoint, maximum=maximum, n_log=n_log
).generate()
18 changes: 1 addition & 17 deletions firecrown/likelihood/two_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# firecrown is needed for backward compatibility; remove support for deprecated
# directory structure is removed.
import firecrown # pylint: disable=unused-import # noqa: F401
from firecrown.generators.two_point import LogLinearElls, ELL_FOR_XI_DEFAULTS
from firecrown.generators.two_point import ELL_FOR_XI_DEFAULTS, log_linear_ells
from firecrown.likelihood.source import Source, Tracer
from firecrown.likelihood.weak_lensing import (
WeakLensingFactory,
Expand Down Expand Up @@ -66,22 +66,6 @@
}


def log_linear_ells(
*, minimum: int, midpoint: int, maximum: int, n_log: int
) -> npt.NDArray[np.int64]:
"""Create an array of ells to sample the power spectrum.
This is used for for real-space predictions. The result will contain
each integral value from min to mid. Starting from mid, and going up
to max, there will be n_log logarithmically spaced values.
All values are rounded to the nearest integer.
"""
return LogLinearElls(
minimum=minimum, midpoint=midpoint, maximum=maximum, n_log=n_log
).generate()


def generate_bin_centers(
*, minimum: float, maximum: float, n: int, binning: str = "log"
) -> npt.NDArray[np.float64]:
Expand Down
2 changes: 1 addition & 1 deletion tests/likelihood/gauss_family/statistic/test_two_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
)
from firecrown.likelihood.statistic import TheoryVector
from firecrown.likelihood.two_point import (
log_linear_ells,
generate_bin_centers,
TwoPoint,
TracerNames,
Expand All @@ -32,6 +31,7 @@
WeakLensingFactory,
NumberCountsFactory,
)
from firecrown.generators.two_point import log_linear_ells
from firecrown.metadata_types import (
Galaxies,
InferredGalaxyZDist,
Expand Down

0 comments on commit 5fc0fb6

Please sign in to comment.