foscat 3.3.1__tar.gz → 3.3.4__tar.gz

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.
Files changed (31) hide show
  1. {foscat-3.3.1/src/foscat.egg-info → foscat-3.3.4}/PKG-INFO +1 -1
  2. {foscat-3.3.1 → foscat-3.3.4}/pyproject.toml +1 -1
  3. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/alm.py +10 -7
  4. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/backend.py +8 -0
  5. {foscat-3.3.1 → foscat-3.3.4/src/foscat.egg-info}/PKG-INFO +1 -1
  6. {foscat-3.3.1 → foscat-3.3.4}/LICENCE +0 -0
  7. {foscat-3.3.1 → foscat-3.3.4}/README.md +0 -0
  8. {foscat-3.3.1 → foscat-3.3.4}/setup.cfg +0 -0
  9. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/CNN.py +0 -0
  10. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/CircSpline.py +0 -0
  11. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/FoCUS.py +0 -0
  12. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/GCNN.py +0 -0
  13. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/Softmax.py +0 -0
  14. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/Spline1D.py +0 -0
  15. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/Synthesis.py +0 -0
  16. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/__init__.py +0 -0
  17. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/backend_tens.py +0 -0
  18. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/loss_backend_tens.py +0 -0
  19. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/loss_backend_torch.py +0 -0
  20. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat.py +0 -0
  21. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat1D.py +0 -0
  22. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat2D.py +0 -0
  23. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat_cov.py +0 -0
  24. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat_cov1D.py +0 -0
  25. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat_cov2D.py +0 -0
  26. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat_cov_map.py +0 -0
  27. {foscat-3.3.1 → foscat-3.3.4}/src/foscat/scat_cov_map2D.py +0 -0
  28. {foscat-3.3.1 → foscat-3.3.4}/src/foscat.egg-info/SOURCES.txt +0 -0
  29. {foscat-3.3.1 → foscat-3.3.4}/src/foscat.egg-info/dependency_links.txt +0 -0
  30. {foscat-3.3.1 → foscat-3.3.4}/src/foscat.egg-info/requires.txt +0 -0
  31. {foscat-3.3.1 → foscat-3.3.4}/src/foscat.egg-info/top_level.txt +0 -0
@@ -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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "foscat"
3
- version = "3.3.1"
3
+ version = "3.3.4"
4
4
  description = "Generate synthetic Healpix or 2D data using Cross Scattering Transform"
5
5
  readme = "README.md"
6
6
  license = { text = "BSD-3-Clause" }
@@ -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:
@@ -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>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes