foscat 3.3.1__py3-none-any.whl → 3.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
foscat/alm.py CHANGED
@@ -3,10 +3,13 @@ import numpy as np
3
3
 
4
4
  class alm():
5
5
 
6
- def __init__(self,backend=None,lmax=24,limit_range=1E7):
6
+ def __init__(self,backend=None,lmax=24,nside=None,limit_range=1E7):
7
7
  self._logtab={}
8
- self.lmax=0
9
- for k in range(1,2*lmax+1):
8
+ if nside is not None:
9
+ self.lmax=3*nside
10
+ else:
11
+ self.lmax=lmax
12
+ for k in range(1,2*self.lmax+1):
10
13
  self._logtab[k]=np.log(k)
11
14
  self._limit_range=1/limit_range
12
15
  self._log_limit_range=np.log(limit_range)
@@ -52,7 +55,7 @@ class alm():
52
55
  ratio[0,0]= self.double_factorial_log(2*m - 1)-0.5*np.sum(self.log(1+np.arange(2*m)))
53
56
 
54
57
  if m == lmax:
55
- return result*np.exp(ratio)*np.sqrt((2*(np.arange(lmax-m+1)-m))/(4*np.pi)).reshape(lmax+1-m,1)
58
+ return result*np.exp(ratio)*np.sqrt(4*np.pi*(2*(np.arange(lmax-m+1)+m)+1)).reshape(lmax+1-m,1)
56
59
 
57
60
  # Étape 2 : Calcul de P_{l+1, m}(x)
58
61
  result[1] = x * (2*m + 1) * result[0]
@@ -68,7 +71,7 @@ class alm():
68
71
  result[l-m]*=self._limit_range
69
72
  ratio[l-m-1,0]+=self._log_limit_range
70
73
  ratio[l-m,0]+=self._log_limit_range
71
-
74
+
72
75
  return result*np.exp(ratio)*(np.sqrt(4*np.pi*(2*(np.arange(lmax-m+1)+m)+1))).reshape(lmax+1-m,1)
73
76
 
74
77
  def comp_tf(self,im,ph):
@@ -101,9 +104,9 @@ class alm():
101
104
  th,ph=hp.pix2ang(nside,np.arange(12*nside*nside))
102
105
  if nest:
103
106
  idx=hp.ring2nest(nside,np.arange(12*nside**2))
104
- ft_im=self.comp_tf(self.backend.bk_complex(im[idx],0*im),ph)
107
+ ft_im=self.comp_tf(self.backend.bk_complex(self.backend.bk_gather(im,idx),0*im),ph)
105
108
  if map2 is not None:
106
- ft_im2=self.comp_tf(self.backend.bk_complex(map2[idx],0*im),ph)
109
+ ft_im2=self.comp_tf(self.backend.bk_complex(self.backend.bk_gather(map2,idx),0*im),ph)
107
110
  else:
108
111
  ft_im=self.comp_tf(self.backend.bk_complex(im,0*im),ph)
109
112
  if map2 is not None:
foscat/backend.py CHANGED
@@ -932,6 +932,14 @@ class foscat_backend:
932
932
  return self.backend.zeros(shape,dtype=dtype)
933
933
  if self.BACKEND == self.NUMPY:
934
934
  return np.zeros(shape,dtype=dtype)
935
+
936
+ def bk_gather(self, data,idx):
937
+ if self.BACKEND == self.TENSORFLOW:
938
+ return self.backend.gather(data,idx)
939
+ if self.BACKEND == self.TORCH:
940
+ return data[idx]
941
+ if self.BACKEND == self.NUMPY:
942
+ return data[idx]
935
943
 
936
944
  def bk_fft(self, data):
937
945
  if self.BACKEND == self.TENSORFLOW:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foscat
3
- Version: 3.3.1
3
+ Version: 3.3.4
4
4
  Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
5
5
  Author-email: Jean-Marc DELOUIS <jean.marc.delouis@ifremer.fr>
6
6
  Maintainer-email: Theo Foulquier <theo.foulquier@ifremer.fr>
@@ -6,8 +6,8 @@ foscat/Softmax.py,sha256=aBLQauoG0q2SJYPotV6U-cxAhsJcspWHNRWdnA_nAiQ,2854
6
6
  foscat/Spline1D.py,sha256=a5Jb8I9tb8y20iM8W-z6iZsIqDFByRp6eZdChpmuI5k,3010
7
7
  foscat/Synthesis.py,sha256=3_Lq5-gUM-WmO2h15kajMES8XjRo2BGseoxvTLW_xEc,13626
8
8
  foscat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- foscat/alm.py,sha256=Ga1PUDDQlXz6sNf9ZTewO2U3uspbN8GsieKj3fSaQ14,5446
10
- foscat/backend.py,sha256=SyPNkwuwIKAeUQZE4m5RSUr29jjVbL4wzNrtqYXmVno,38557
9
+ foscat/alm.py,sha256=L29DxMFuKUPk3LO9wVErhDKDqyWUxk5OndyxFHphgps,5597
10
+ foscat/backend.py,sha256=TZnOyPYjqbHjOTkH2Zk0zN5DQf2-WNHlaxenuPo_wO0,38822
11
11
  foscat/backend_tens.py,sha256=9Dp136m9frkclkwifJQLLbIpl3ETI3_txdPUZcKfuMw,1618
12
12
  foscat/loss_backend_tens.py,sha256=dCOVN6faDtIpN3VO78HTmYP2i5fnFAf-Ddy5qVBlGrM,1783
13
13
  foscat/loss_backend_torch.py,sha256=k3z18Dj3SaLKK6ZIKcm7GO4U_YKYVP6LtHG1aIbxkYk,1627
@@ -19,8 +19,8 @@ foscat/scat_cov1D.py,sha256=XOxsZZ5TYq8f34i2tUgIfzyaqaTDlICB3HzD2l_puro,531
19
19
  foscat/scat_cov2D.py,sha256=3gn6xjKvfKsyHJoPfYIu8q9LLVAbU3tsiS2l1LAJ0XM,531
20
20
  foscat/scat_cov_map.py,sha256=0wTRo4Nc7rYfI09RI2mh2bYixoukt5lrvAXR6wa9kjA,2744
21
21
  foscat/scat_cov_map2D.py,sha256=FqF45FBcoiQbvuVsrLWUIPRUc95GsKsrnH6fKzB3GlE,2841
22
- foscat-3.3.1.dist-info/LICENCE,sha256=i0ukIr8ZUpkSY2sZaE9XZK-6vuSU5iG6IgX_3pjatP8,1505
23
- foscat-3.3.1.dist-info/METADATA,sha256=HuiEXLDRqhuE2dGcp6Uvh8aCJeo80XUrh1ppa5ncB2Y,7191
24
- foscat-3.3.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
- foscat-3.3.1.dist-info/top_level.txt,sha256=AGySXBBAlJgb8Tj8af6m_F-aiNg2zNTcybCUPVOKjAg,7
26
- foscat-3.3.1.dist-info/RECORD,,
22
+ foscat-3.3.4.dist-info/LICENCE,sha256=i0ukIr8ZUpkSY2sZaE9XZK-6vuSU5iG6IgX_3pjatP8,1505
23
+ foscat-3.3.4.dist-info/METADATA,sha256=yaXfM1oeDDodXs_qfv1UlHx_Fmd4oeMFk-L3noimUmo,7191
24
+ foscat-3.3.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
+ foscat-3.3.4.dist-info/top_level.txt,sha256=AGySXBBAlJgb8Tj8af6m_F-aiNg2zNTcybCUPVOKjAg,7
26
+ foscat-3.3.4.dist-info/RECORD,,
File without changes