Skip to content

Commit

Permalink
fixed small bugs in MCALens
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasTersenov committed May 12, 2024
1 parent 2474c03 commit 139f491
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions pycs/astro/wl/mass_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,11 @@ def sparse_wiener_filtering(
)

RMS_ShearMap = np.sqrt(InshearData.Ncov / 2.0) # shape = (nx, ny)
# shape = ([nimgs], [Nrea], nx, ny)
# TODO: complex or complex128? Same question for real-valued arrays
xg = np.zeros_like(gamma1, dtype=complex) # Gaussian + sparse components
xs = np.zeros_like(gamma1, dtype=complex) # sparse component
xw = np.zeros_like(gamma1, dtype=complex) # Gaussian component
SigmaNoise = np.min(RMS_ShearMap) # float
Esn_Sparse = SigmaNoise / RMS_ShearMap # shape = (nx, ny)
Esn_Sparse[Esn_Sparse == np.inf] = 0
Expand Down Expand Up @@ -1250,11 +1255,7 @@ def sparse_wiener_filtering(
InshearData, mask, Nrea=Nrea, inpshape=inpshape
) # shape = ([nimgs], [Nrea], nx, ny)

# shape = ([nimgs], [Nrea], nx, ny)
# TODO: complex or complex128? Same question for real-valued arrays
xg = np.zeros_like(gamma1, dtype=complex) # Gaussian + sparse components
xs = np.zeros_like(gamma1, dtype=complex) # sparse component
xw = np.zeros_like(gamma1, dtype=complex) # Gaussian component


for n in range(niter):
resi1, resi2 = self.get_resi(
Expand Down
4 changes: 2 additions & 2 deletions pycs/sparsity/sparse2d/starlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,13 @@ def threshold(
if dim in (0, 2): # SigmaNoise: scalar or shape = (nx, ny)
# The noise level is obtained at each scale by multiplying by self.TabNorm
Thres = (
SigmaNoise * (self.TabNsigma * self.TabNorm)[:, np.newdim, np.newdim]
SigmaNoise * (self.TabNsigma * self.TabNorm)[:, np.newaxis, np.newaxis]
) # shape = (ns, nx, ny)
elif dim == 1: # SigmaNoise: shape = (ns,)
Thres = SigmaNoise * self.TabNsigma # shape = (ns,)
else: # SigmaNoise: shape = (ns, nx, ny)
Thres = (
SigmaNoise * self.TabNsigma[:, np.newdim, np.newdim]
SigmaNoise * self.TabNsigma[:, np.newaxis, np.newaxis]
) # shape = (ns, nx, ny)

if ThresCoarse:
Expand Down

0 comments on commit 139f491

Please sign in to comment.