From 1e960466c0d686e15d719e06896e6d1ba6d47dc3 Mon Sep 17 00:00:00 2001 From: yusuke-takase Date: Tue, 17 Sep 2024 09:57:27 +0900 Subject: [PATCH] update gitignore --- .gitignore | 1 + sbm/__pycache__/sbm.cpython-310.pyc | Bin 25689 -> 25790 bytes sbm/sbm.py | 11 +++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d21eafd..e65c2da 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ crosslinks_2407.zip/ crosslinks_2407_3yr.zip/ notebooks/__pycache__/ .ipynb_checkpoints/ +__pycache__/ diff --git a/sbm/__pycache__/sbm.cpython-310.pyc b/sbm/__pycache__/sbm.cpython-310.pyc index b04fa4470301e71a24574e93f1cb92fcf9d2192b..84d10d062f27e47019382ff066243303dbbb4c9e 100644 GIT binary patch delta 1557 zcmZuwO>7%Q6yEWU*XzyN`N6?)ld9B#fK?(lMWUr50;05b93r(zDI$kDj(20$aqKX= zDG}Q6Cl!Ipc%{On} z``(*<-^^}(NZ$X5L~4CgD?0L;27|gmLrF;GwsrEi)tL2?yiQg^Zomiue;N50 z;m;k}9Z|uv+Tw`~Kq!P|8na#sHj=|YJ=aPd0!pw!#aaJPYDlDprlgcsSSFIh_vTjl z#?h~t&%;i#@qjcBBc zB*`HXc$PcahsX>3-Ry&)A8qItFo;1wKY=c7(Ql%m-;L~j51@V}YzYQ+<)(fOtKsqW z3%XL-S8zp$03810*dC$a*{0{)u{c+9(Kw3cXP|5sTH`5SURlVj!yc;8(4X}ZY8G^Z zs2Sgr+n}F7%b-#pzn+VcGLMe;%v?gH1`$3*_zWPWux_+JNB9CkN7#?>B|@YLQM9l` zJRnInD%wRAqPHkoe|~&}lDqlHF_Y}@H;(PJzwXerD2#Sjf$J6G7mnXTI{16Xt*1C7Us3y%=F5Hv^MB#1Co<_NRCNT_U2VHSQ;kH)0Z^C1 z=o7CBwn}>7RsN)%Jp9PDj;}CXoa&EgUFA8Z@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mXCMNx61=O7-QgTD3Kw?u*%@v z&r#04A+XhA<&6A+Ga>bgQ7zkA%`^>LRI0M9m)u*+r(_)IxWeg`y z^aYcU1o22~$I6Lc+t--F2Pf|_{DRe)Pt^h6&c@)YdsOj&=N{rzF1>>f+zv{!Ry5wE zwfVBAK!dCJ%Iu3fLNsl|5gB&kq-??WXWxUH z*gyA7B1Us5u!HkeY3B7>-MvvAIHxDX8g(q=cy{jPz7AHt#mdf&b1vJnG+bxOTM7>A z-APX>RMYEbsZ^|+O1=~4FX2pnv5m77$lu+tj@R=U0NiEl lj*qZfgxfq-l*VkWSe65L)JO`)#0@%y1fDaVS4ZRh{{RRjY_R|U diff --git a/sbm/sbm.py b/sbm/sbm.py index 186be5f..aae06fe 100755 --- a/sbm/sbm.py +++ b/sbm/sbm.py @@ -512,9 +512,10 @@ def map_make(self, signal_fields, mdim): # noise = self.generate_noise(seed) b = self.coupled_fields# + noise A = self.get_covmat(mdim) - x = np.empty_like(b) + x = np.zeros_like(b) for i in range(b.shape[1]): - x[:,i] = np.linalg.solve(A[:,:,i], b[:,i]) + if np.linalg.det(A[:,:,i]) != 0.0: + x[:,i] = np.linalg.solve(A[:,:,i], b[:,i]) if mdim == 2: # Note that: # x[0] = Q + iU @@ -538,9 +539,10 @@ def solve(self): assert self.coupled_fields is not None, "Couple the fields first" b = self.coupled_fields A = self.get_covmat(self.mdim) - x = np.empty_like(b) + x = np.zeros_like(b) for i in range(b.shape[1]): - x[:,i] = np.linalg.solve(A[:,:,i], b[:,i]) + if np.linalg.det(A[:,:,i]) != 0.0: + x[:,i] = np.linalg.solve(A[:,:,i], b[:,i]) if self.mdim == 2: output_map = np.array([np.zeros_like(x[0].real), x[0].real, x[0].imag]) if self.mdim == 3: @@ -615,6 +617,7 @@ def generate_noise(self, mdim, seed=None): n_u = np.random.normal(loc=0., scale=self.noise_pdf[1], size=[self.npix]) if mdim == 2: noise = np.array([ + np.zeros_like(n_i), n_q * self.covmat_inv[0,0,:].real, n_u * self.covmat_inv[0,0,:].real, ])