Skip to content

Commit

Permalink
use transformcl functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ntessore committed Jan 30, 2025
1 parent d83c203 commit fd2f020
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions glass/grf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import flt
import numpy as np
from transformcl import cltocorr, corrtocl

if TYPE_CHECKING:
from collections.abc import Callable
Expand Down Expand Up @@ -300,8 +301,6 @@ def solve(
"""
from ._twopoint import cl2corr, corr2cl

if t2 is None:
t2 = t1

Expand All @@ -310,16 +309,16 @@ def solve(
raise TypeError("pad must be a positive integer")

if initial is None:
gl = corr2cl(icorr(t1, t2, cl2corr(cl)))
gl = corrtocl(icorr(t1, t2, cltocorr(cl)))
else:
gl = np.zeros(n)
gl[: len(initial)] = initial[:n]

if monopole is not None:
gl[0] = monopole

gt = cl2corr(np.pad(gl, (0, pad)))
rl = corr2cl(corr(t1, t2, gt))
gt = cltocorr(np.pad(gl, (0, pad)))
rl = corrtocl(corr(t1, t2, gt))
fl = rl[:n] - cl
if monopole is not None:
fl[0] = 0
Expand All @@ -332,16 +331,16 @@ def solve(
if info > 0:
break

ft = cl2corr(np.pad(fl, (0, pad)))
ft = cltocorr(np.pad(fl, (0, pad)))
dt = dcorr(t1, t2, gt)
xl = -corr2cl(ft / dt)[:n]
xl = -corrtocl(ft / dt)[:n]
if monopole is not None:
xl[0] = 0

while True:
gl_ = gl + xl
gt_ = cl2corr(np.pad(gl_, (0, pad)))
rl_ = corr2cl(corr(t1, t2, gt_))
gt_ = cltocorr(np.pad(gl_, (0, pad)))
rl_ = corrtocl(corr(t1, t2, gt_))
fl_ = rl_[:n] - cl
if monopole is not None:
fl_[0] = 0
Expand Down

0 comments on commit fd2f020

Please sign in to comment.