foscat 3.0.32__tar.gz → 3.0.33__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 (30) hide show
  1. {foscat-3.0.32 → foscat-3.0.33}/PKG-INFO +7 -1
  2. {foscat-3.0.32 → foscat-3.0.33}/setup.py +1 -1
  3. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/FoCUS.py +42 -15
  4. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/GCNN.py +15 -8
  5. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/backend.py +8 -0
  6. {foscat-3.0.32 → foscat-3.0.33}/src/foscat.egg-info/PKG-INFO +7 -1
  7. {foscat-3.0.32 → foscat-3.0.33}/README.md +0 -0
  8. {foscat-3.0.32 → foscat-3.0.33}/setup.cfg +0 -0
  9. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/CNN.py +0 -0
  10. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/CircSpline.py +0 -0
  11. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/GetGPUinfo.py +0 -0
  12. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/Softmax.py +0 -0
  13. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/Spline1D.py +0 -0
  14. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/Synthesis.py +0 -0
  15. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/__init__.py +0 -0
  16. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/backend_tens.py +0 -0
  17. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/loss_backend_tens.py +0 -0
  18. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/loss_backend_torch.py +0 -0
  19. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat.py +0 -0
  20. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat1D.py +0 -0
  21. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat2D.py +0 -0
  22. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat_cov.py +0 -0
  23. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat_cov1D.py +0 -0
  24. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat_cov2D.py +0 -0
  25. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat_cov_map.py +0 -0
  26. {foscat-3.0.32 → foscat-3.0.33}/src/foscat/scat_cov_map2D.py +0 -0
  27. {foscat-3.0.32 → foscat-3.0.33}/src/foscat.egg-info/SOURCES.txt +0 -0
  28. {foscat-3.0.32 → foscat-3.0.33}/src/foscat.egg-info/dependency_links.txt +0 -0
  29. {foscat-3.0.32 → foscat-3.0.33}/src/foscat.egg-info/requires.txt +0 -0
  30. {foscat-3.0.32 → foscat-3.0.33}/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.0.32
3
+ Version: 3.0.33
4
4
  Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
5
5
  Home-page: https://github.com/jmdelouis/FOSCAT
6
6
  Author: Jean-Marc DELOUIS
@@ -9,6 +9,12 @@ Maintainer: Theo Foulquier
9
9
  Maintainer-email: theo.foulquier@ifremer.fr
10
10
  License: MIT
11
11
  Keywords: Scattering transform,Component separation,denoising
12
+ Requires-Dist: imageio
13
+ Requires-Dist: imagecodecs
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: numpy
16
+ Requires-Dist: tensorflow
17
+ Requires-Dist: healpy
12
18
 
13
19
  Utilize the Cross Scattering Transform (described in https://arxiv.org/abs/2207.12527) to synthesize Healpix or 2D data that is suitable for component separation purposes, such as denoising.
14
20
  A demo package for this process can be found at https://github.com/jmdelouis/FOSCAT_DEMO.
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name='foscat',
6
- version='3.0.32',
6
+ version='3.0.33',
7
7
  description='Generate synthetic Healpix or 2D data using Cross Scattering Transform' ,
8
8
  long_description='Utilize the Cross Scattering Transform (described in https://arxiv.org/abs/2207.12527) to synthesize Healpix or 2D data that is suitable for component separation purposes, such as denoising. \n A demo package for this process can be found at https://github.com/jmdelouis/FOSCAT_DEMO. \n Complete doc can be found at https://foscat-documentation.readthedocs.io/en/latest/index.html. \n\n List of developers : J.-M. Delouis, T. Foulquier, L. Mousset, T. Odaka, F. Paul, E. Allys ' ,
9
9
  license='MIT',
@@ -32,7 +32,7 @@ class FoCUS:
32
32
  mpi_size=1,
33
33
  mpi_rank=0):
34
34
 
35
- self.__version__ = '3.0.32'
35
+ self.__version__ = '3.0.33'
36
36
  # P00 coeff for normalization for scat_cov
37
37
  self.TMPFILE_VERSION=TMPFILE_VERSION
38
38
  self.P1_dic = None
@@ -441,25 +441,37 @@ class FoCUS:
441
441
  return self.X_CNN[nside],self.Y_CNN[nside],self.Z_CNN[nside]
442
442
 
443
443
  # ---------------------------------------------−---------
444
- def healpix_layer_transpose(self,im,ww,indices=None,weights=None):
445
- nside=int(np.sqrt(im.shape[0]//12))
444
+ def healpix_layer_transpose(self,im,ww,indices=None,weights=None,axis=0):
445
+ nside=int(np.sqrt(im.shape[axis]//12))
446
446
  l_kernel=self.KERNELSZ*self.KERNELSZ
447
447
 
448
- if im.shape[1]!=ww.shape[1]:
448
+ if im.shape[1+axis]!=ww.shape[1]:
449
449
  if not self.silent:
450
450
  print('Weights channels should be equal to the input image channels')
451
451
  return -1
452
- tmp=self.healpix_layer(im,ww,indices=indices,weights=weights)
452
+ if axis==1:
453
+ results=[]
454
+
455
+ for k in range(im.shape[0]):
456
+
457
+ tmp=self.healpix_layer(im[k],ww,indices=indices,weights=weights,axis=0)
458
+ tmp=self.backend.bk_reshape(self.up_grade(tmp,2*nside),[12*4*nside**2,ww.shape[2]])
459
+
460
+ results.append(tmp)
461
+
462
+ return self.backend.bk_stack(results,axis=0)
463
+ else:
464
+ tmp=self.healpix_layer(im,ww,indices=indices,weights=weights,axis=axis)
453
465
 
454
- return self.up_grade(tmp,2*nside)
466
+ return self.up_grade(tmp,2*nside)
455
467
 
456
468
  # ---------------------------------------------−---------
457
469
  # ---------------------------------------------−---------
458
- def healpix_layer(self,im,ww,indices=None,weights=None):
459
- nside=int(np.sqrt(im.shape[0]//12))
470
+ def healpix_layer(self,im,ww,indices=None,weights=None,axis=0):
471
+ nside=int(np.sqrt(im.shape[axis]//12))
460
472
  l_kernel=self.KERNELSZ*self.KERNELSZ
461
-
462
- if im.shape[1]!=ww.shape[1]:
473
+
474
+ if im.shape[1+axis]!=ww.shape[1]:
463
475
  if not self.silent:
464
476
  print('Weights channels should be equal to the input image channels')
465
477
  return -1
@@ -474,12 +486,27 @@ class FoCUS:
474
486
  return 0
475
487
 
476
488
  mat=self.backend.bk_SparseTensor(indices,weights,[12*nside*nside*l_kernel,12*nside*nside])
477
-
478
- tmp=self.backend.bk_sparse_dense_matmul(mat,im)
479
-
480
- density=self.backend.bk_reshape(tmp,[12*nside*nside,l_kernel*im.shape[1]])
489
+
490
+ if axis==1:
491
+ results=[]
481
492
 
482
- return self.backend.bk_matmul(density,self.backend.bk_reshape(ww,[l_kernel*im.shape[1],ww.shape[2]]))
493
+ for k in range(im.shape[0]):
494
+
495
+ tmp=self.backend.bk_sparse_dense_matmul(mat,im[k])
496
+
497
+ density=self.backend.bk_reshape(tmp,[12*nside*nside,l_kernel*im.shape[1+axis]])
498
+
499
+ density=self.backend.bk_matmul(density,self.backend.bk_reshape(ww,[l_kernel*im.shape[1+axis],ww.shape[2]]))
500
+
501
+ results.append(self.backend.bk_reshape(density,[1,12*nside**2,ww.shape[2]]))
502
+
503
+ return self.backend.bk_stack(results,axis=0)
504
+ else:
505
+ tmp=self.backend.bk_sparse_dense_matmul(mat,im)
506
+
507
+ density=self.backend.bk_reshape(tmp,[12*nside*nside,l_kernel*im.shape[1]])
508
+
509
+ return self.backend.bk_matmul(density,self.backend.bk_reshape(ww,[l_kernel*im.shape[1],ww.shape[2]]))
483
510
  # ---------------------------------------------−---------
484
511
 
485
512
  # ---------------------------------------------−---------
@@ -79,15 +79,21 @@ class GCNN:
79
79
  def get_weights(self):
80
80
  return self.x
81
81
 
82
- def eval(self,param,indices=None,weights=None):
82
+ def eval(self,param,indices=None,weights=None,axis=0):
83
83
 
84
84
  x=self.x
85
85
 
86
86
  ww=self.scat_operator.backend.bk_reshape(x[0:self.npar*12*self.in_nside**2*self.chanlist[0]], \
87
87
  [self.npar,12*self.in_nside**2*self.chanlist[0]])
88
-
89
- im=self.scat_operator.backend.bk_matmul(self.scat_operator.backend.bk_reshape(param,[1,self.npar]),ww)
90
- im=self.scat_operator.backend.bk_reshape(im,[12*self.in_nside**2,self.chanlist[0]])
88
+
89
+ if axis==0:
90
+ nval=1
91
+ else:
92
+ nval=param.shape[0]
93
+
94
+ im=self.scat_operator.backend.bk_reshape(param,[nval,self.npar])
95
+ im=self.scat_operator.backend.bk_matmul(im,ww)
96
+ im=self.scat_operator.backend.bk_reshape(im,[nval,12*self.in_nside**2,self.chanlist[0]])
91
97
  im=self.scat_operator.backend.bk_relu(im)
92
98
 
93
99
  nn=self.npar*12*self.chanlist[0]*self.in_nside**2
@@ -96,14 +102,15 @@ class GCNN:
96
102
  [self.KERNELSZ*self.KERNELSZ,self.chanlist[k],self.chanlist[k+1]])
97
103
  nn=nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]
98
104
  if indices is None:
99
- im=self.scat_operator.healpix_layer_transpose(im,ww)
105
+ im=self.scat_operator.healpix_layer_transpose(im,ww,axis=1)
100
106
  else:
101
- im=self.scat_operator.healpix_layer_transpose(im,ww,indices=indices[k],weights=weights[k])
107
+ im=self.scat_operator.healpix_layer_transpose(im,ww,indices=indices[k],weights=weights[k],axis=1)
102
108
  im=self.scat_operator.backend.bk_relu(im)
103
-
109
+
104
110
  ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],self.n_chan_out])
105
111
  im=self.scat_operator.backend.bk_matmul(im,ww)
106
-
112
+ if axis==0:
113
+ im=self.scat_operator.backend.bk_reshape(im,[im.shape[1],im.shape[2]])
107
114
  return im
108
115
 
109
116
 
@@ -253,6 +253,14 @@ class foscat_backend:
253
253
  if self.BACKEND==self.NUMPY:
254
254
  return self.scipy.sparse.coo_matrix((w,(indice[:,0],indice[:,1])),shape=dense_shape)
255
255
 
256
+ def bk_stack(self,list,axis=0):
257
+ if self.BACKEND==self.TENSORFLOW:
258
+ return self.backend.stack(list,axis=axis)
259
+ if self.BACKEND==self.TORCH:
260
+ return self.backend.stack(list,axis=axis)
261
+ if self.BACKEND==self.NUMPY:
262
+ return self.backend.stack(list,axis=axis)
263
+
256
264
  def bk_sparse_dense_matmul(self,smat,mat):
257
265
  if self.BACKEND==self.TENSORFLOW:
258
266
  return self.backend.sparse.sparse_dense_matmul(smat,mat)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foscat
3
- Version: 3.0.32
3
+ Version: 3.0.33
4
4
  Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
5
5
  Home-page: https://github.com/jmdelouis/FOSCAT
6
6
  Author: Jean-Marc DELOUIS
@@ -9,6 +9,12 @@ Maintainer: Theo Foulquier
9
9
  Maintainer-email: theo.foulquier@ifremer.fr
10
10
  License: MIT
11
11
  Keywords: Scattering transform,Component separation,denoising
12
+ Requires-Dist: imageio
13
+ Requires-Dist: imagecodecs
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: numpy
16
+ Requires-Dist: tensorflow
17
+ Requires-Dist: healpy
12
18
 
13
19
  Utilize the Cross Scattering Transform (described in https://arxiv.org/abs/2207.12527) to synthesize Healpix or 2D data that is suitable for component separation purposes, such as denoising.
14
20
  A demo package for this process can be found at https://github.com/jmdelouis/FOSCAT_DEMO.
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