Skip to content

Commit 139f491

Browse files
fixed small bugs in MCALens
1 parent 2474c03 commit 139f491

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pycs/astro/wl/mass_mapping.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,11 @@ def sparse_wiener_filtering(
12001200
)
12011201

12021202
RMS_ShearMap = np.sqrt(InshearData.Ncov / 2.0) # shape = (nx, ny)
1203+
# shape = ([nimgs], [Nrea], nx, ny)
1204+
# TODO: complex or complex128? Same question for real-valued arrays
1205+
xg = np.zeros_like(gamma1, dtype=complex) # Gaussian + sparse components
1206+
xs = np.zeros_like(gamma1, dtype=complex) # sparse component
1207+
xw = np.zeros_like(gamma1, dtype=complex) # Gaussian component
12031208
SigmaNoise = np.min(RMS_ShearMap) # float
12041209
Esn_Sparse = SigmaNoise / RMS_ShearMap # shape = (nx, ny)
12051210
Esn_Sparse[Esn_Sparse == np.inf] = 0
@@ -1250,11 +1255,7 @@ def sparse_wiener_filtering(
12501255
InshearData, mask, Nrea=Nrea, inpshape=inpshape
12511256
) # shape = ([nimgs], [Nrea], nx, ny)
12521257

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

12591260
for n in range(niter):
12601261
resi1, resi2 = self.get_resi(

pycs/sparsity/sparse2d/starlet.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,13 @@ def threshold(
903903
if dim in (0, 2): # SigmaNoise: scalar or shape = (nx, ny)
904904
# The noise level is obtained at each scale by multiplying by self.TabNorm
905905
Thres = (
906-
SigmaNoise * (self.TabNsigma * self.TabNorm)[:, np.newdim, np.newdim]
906+
SigmaNoise * (self.TabNsigma * self.TabNorm)[:, np.newaxis, np.newaxis]
907907
) # shape = (ns, nx, ny)
908908
elif dim == 1: # SigmaNoise: shape = (ns,)
909909
Thres = SigmaNoise * self.TabNsigma # shape = (ns,)
910910
else: # SigmaNoise: shape = (ns, nx, ny)
911911
Thres = (
912-
SigmaNoise * self.TabNsigma[:, np.newdim, np.newdim]
912+
SigmaNoise * self.TabNsigma[:, np.newaxis, np.newaxis]
913913
) # shape = (ns, nx, ny)
914914

915915
if ThresCoarse:

0 commit comments

Comments
 (0)