foscat 3.0.31__tar.gz → 3.0.32__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.
- {foscat-3.0.31 → foscat-3.0.32}/PKG-INFO +1 -1
- {foscat-3.0.31 → foscat-3.0.32}/setup.py +1 -1
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/CNN.py +5 -2
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/FoCUS.py +9 -9
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/GCNN.py +8 -4
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/GetGPUinfo.py +1 -1
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/Synthesis.py +1 -1
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/backend.py +2 -2
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat.py +3 -3
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat1D.py +2 -2
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat_cov.py +5 -5
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat_cov1D.py +2 -2
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat.egg-info/PKG-INFO +1 -1
- {foscat-3.0.31 → foscat-3.0.32}/README.md +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/setup.cfg +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/CircSpline.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/Softmax.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/Spline1D.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/__init__.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/backend_tens.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/loss_backend_tens.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/loss_backend_torch.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat2D.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat_cov2D.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat_cov_map.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat/scat_cov_map2D.py +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat.egg-info/SOURCES.txt +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat.egg-info/dependency_links.txt +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat.egg-info/requires.txt +0 -0
- {foscat-3.0.31 → foscat-3.0.32}/src/foscat.egg-info/top_level.txt +0 -0
|
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
|
|
3
3
|
|
|
4
4
|
setup(
|
|
5
5
|
name='foscat',
|
|
6
|
-
version='3.0.
|
|
6
|
+
version='3.0.32',
|
|
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',
|
|
@@ -79,7 +79,7 @@ class CNN:
|
|
|
79
79
|
def get_weights(self):
|
|
80
80
|
return self.x
|
|
81
81
|
|
|
82
|
-
def eval(self,im):
|
|
82
|
+
def eval(self,im,indices=None,weights=None):
|
|
83
83
|
|
|
84
84
|
x=self.x
|
|
85
85
|
ww=self.scat_operator.backend.bk_reshape(x[0:self.KERNELSZ*self.KERNELSZ*self.n_chan_in*self.chanlist[0]],
|
|
@@ -93,7 +93,10 @@ class CNN:
|
|
|
93
93
|
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]],
|
|
94
94
|
[self.KERNELSZ*self.KERNELSZ,self.chanlist[k],self.chanlist[k+1]])
|
|
95
95
|
nn=nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]
|
|
96
|
-
|
|
96
|
+
if indices is None:
|
|
97
|
+
im=self.scat_operator.healpix_layer(im,ww)
|
|
98
|
+
else:
|
|
99
|
+
im=self.scat_operator.healpix_layer(im,ww,indices=indices[k],weights=weights[k])
|
|
97
100
|
im=self.scat_operator.backend.bk_relu(im)
|
|
98
101
|
im=self.scat_operator.ud_grade_2(im,axis=0)
|
|
99
102
|
|
|
@@ -32,7 +32,7 @@ class FoCUS:
|
|
|
32
32
|
mpi_size=1,
|
|
33
33
|
mpi_rank=0):
|
|
34
34
|
|
|
35
|
-
self.__version__ = '3.0.
|
|
35
|
+
self.__version__ = '3.0.32'
|
|
36
36
|
# P00 coeff for normalization for scat_cov
|
|
37
37
|
self.TMPFILE_VERSION=TMPFILE_VERSION
|
|
38
38
|
self.P1_dic = None
|
|
@@ -64,7 +64,7 @@ class FoCUS:
|
|
|
64
64
|
except:
|
|
65
65
|
if not self.silent:
|
|
66
66
|
print('Impossible to create the directory %s'%(self.TEMPLATE_PATH))
|
|
67
|
-
|
|
67
|
+
return None
|
|
68
68
|
|
|
69
69
|
self.number_of_loss=0
|
|
70
70
|
|
|
@@ -82,7 +82,7 @@ class FoCUS:
|
|
|
82
82
|
if JmaxDelta<-1:
|
|
83
83
|
if not self.silent:
|
|
84
84
|
print('Warning : Jmax can not be smaller than -1')
|
|
85
|
-
|
|
85
|
+
return None
|
|
86
86
|
|
|
87
87
|
self.OSTEP=JmaxDelta
|
|
88
88
|
self.use_2D=use_2D
|
|
@@ -450,7 +450,7 @@ class FoCUS:
|
|
|
450
450
|
print('Weights channels should be equal to the input image channels')
|
|
451
451
|
return -1
|
|
452
452
|
tmp=self.healpix_layer(im,ww,indices=indices,weights=weights)
|
|
453
|
-
|
|
453
|
+
|
|
454
454
|
return self.up_grade(tmp,2*nside)
|
|
455
455
|
|
|
456
456
|
# ---------------------------------------------−---------
|
|
@@ -519,7 +519,7 @@ class FoCUS:
|
|
|
519
519
|
if len(ishape)<axis+2:
|
|
520
520
|
if not self.silent:
|
|
521
521
|
print('Use of 2D scat with data that has less than 2D')
|
|
522
|
-
|
|
522
|
+
return None
|
|
523
523
|
|
|
524
524
|
npix=im.shape[axis]
|
|
525
525
|
npiy=im.shape[axis+1]
|
|
@@ -580,7 +580,7 @@ class FoCUS:
|
|
|
580
580
|
if len(ishape)<axis+2:
|
|
581
581
|
if not self.silent:
|
|
582
582
|
print('Use of 2D scat with data that has less than 2D')
|
|
583
|
-
|
|
583
|
+
return None
|
|
584
584
|
|
|
585
585
|
if nouty is None:
|
|
586
586
|
nouty=nout
|
|
@@ -1057,7 +1057,7 @@ class FoCUS:
|
|
|
1057
1057
|
if self.rank==0:
|
|
1058
1058
|
if not self.silent:
|
|
1059
1059
|
print('Only 3x3 and 5x5 kernel have been developped for Healpix and you ask for %dx%d'%(KERNELSZ,KERNELSZ))
|
|
1060
|
-
|
|
1060
|
+
return None
|
|
1061
1061
|
|
|
1062
1062
|
self.barrier()
|
|
1063
1063
|
if self.use_2D:
|
|
@@ -1342,7 +1342,7 @@ class FoCUS:
|
|
|
1342
1342
|
if len(ishape)<axis+2:
|
|
1343
1343
|
if not self.silent:
|
|
1344
1344
|
print('Use of 2D scat with data that has less than 2D')
|
|
1345
|
-
|
|
1345
|
+
return None
|
|
1346
1346
|
|
|
1347
1347
|
npix=ishape[axis]
|
|
1348
1348
|
npiy=ishape[axis+1]
|
|
@@ -1467,7 +1467,7 @@ class FoCUS:
|
|
|
1467
1467
|
if len(ishape)<axis+2:
|
|
1468
1468
|
if not self.silent:
|
|
1469
1469
|
print('Use of 2D scat with data that has less than 2D')
|
|
1470
|
-
|
|
1470
|
+
return None
|
|
1471
1471
|
|
|
1472
1472
|
npix=ishape[axis]
|
|
1473
1473
|
npiy=ishape[axis+1]
|
|
@@ -40,7 +40,7 @@ class GCNN:
|
|
|
40
40
|
|
|
41
41
|
if len(chanlist)!=nscale+1:
|
|
42
42
|
print('len of chanlist (here %d) should of nscale+1 (here %d)'%(len(chanlist),nscale+1))
|
|
43
|
-
|
|
43
|
+
return None
|
|
44
44
|
|
|
45
45
|
self.chanlist=chanlist
|
|
46
46
|
self.KERNELSZ= scat_operator.KERNELSZ
|
|
@@ -79,7 +79,7 @@ class GCNN:
|
|
|
79
79
|
def get_weights(self):
|
|
80
80
|
return self.x
|
|
81
81
|
|
|
82
|
-
def eval(self,param):
|
|
82
|
+
def eval(self,param,indices=None,weights=None):
|
|
83
83
|
|
|
84
84
|
x=self.x
|
|
85
85
|
|
|
@@ -95,11 +95,15 @@ class GCNN:
|
|
|
95
95
|
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]],
|
|
96
96
|
[self.KERNELSZ*self.KERNELSZ,self.chanlist[k],self.chanlist[k+1]])
|
|
97
97
|
nn=nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]
|
|
98
|
-
|
|
98
|
+
if indices is None:
|
|
99
|
+
im=self.scat_operator.healpix_layer_transpose(im,ww)
|
|
100
|
+
else:
|
|
101
|
+
im=self.scat_operator.healpix_layer_transpose(im,ww,indices=indices[k],weights=weights[k])
|
|
99
102
|
im=self.scat_operator.backend.bk_relu(im)
|
|
100
103
|
|
|
101
104
|
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],self.n_chan_out])
|
|
102
105
|
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
103
106
|
|
|
104
107
|
return im
|
|
105
|
-
|
|
108
|
+
|
|
109
|
+
|
|
@@ -77,7 +77,7 @@ class Synthesis:
|
|
|
77
77
|
|
|
78
78
|
if self.operation.BACKEND=='numpy':
|
|
79
79
|
print('Synthesis does not work with numpy. Please select Torch or Tensorflow FOSCAT backend')
|
|
80
|
-
|
|
80
|
+
return None
|
|
81
81
|
|
|
82
82
|
# ---------------------------------------------−---------
|
|
83
83
|
def get_gpu(self,event,delay):
|
|
@@ -29,7 +29,7 @@ class foscat_backend:
|
|
|
29
29
|
print(' - tensorflow')
|
|
30
30
|
print(' - torch')
|
|
31
31
|
print(' - numpy (Impossible to do synthesis using numpy)')
|
|
32
|
-
|
|
32
|
+
return None
|
|
33
33
|
|
|
34
34
|
if self.BACKEND=='tensorflow':
|
|
35
35
|
import tensorflow as tf
|
|
@@ -70,7 +70,7 @@ class foscat_backend:
|
|
|
70
70
|
self.all_cbk_type=self.backend.complex128
|
|
71
71
|
else:
|
|
72
72
|
print('ERROR INIT FOCUS ',all_type,' should be float32 or float64')
|
|
73
|
-
|
|
73
|
+
return None
|
|
74
74
|
#===========================================================================
|
|
75
75
|
# INIT
|
|
76
76
|
if mpi_rank==0:
|
|
@@ -1044,15 +1044,15 @@ class funct(FOC.FoCUS):
|
|
|
1044
1044
|
if list(image1.shape)!=list(image2.shape):
|
|
1045
1045
|
print('The two input image should have the same size to eval Scattering')
|
|
1046
1046
|
|
|
1047
|
-
|
|
1047
|
+
return None
|
|
1048
1048
|
if mask is not None:
|
|
1049
1049
|
if list(image1.shape)!=list(mask.shape)[1:]:
|
|
1050
1050
|
print('The mask should have the same size than the input image to eval Scattering')
|
|
1051
1051
|
print('Image shape ',image1.shape,'Mask shape ',mask.shape)
|
|
1052
|
-
|
|
1052
|
+
return None
|
|
1053
1053
|
if self.use_2D and len(image1.shape)<2:
|
|
1054
1054
|
print('To work with 2D scattering transform, two dimension is needed, input map has only on dimension')
|
|
1055
|
-
|
|
1055
|
+
return None
|
|
1056
1056
|
|
|
1057
1057
|
|
|
1058
1058
|
### AUTO OR CROSS
|
|
@@ -862,11 +862,11 @@ class funct(FOC.FoCUS):
|
|
|
862
862
|
if len(image1.shape)==1:
|
|
863
863
|
if image1.shape[0]!=mask.shape[1]:
|
|
864
864
|
print('The mask should have the same size than the input timeline to eval Scattering')
|
|
865
|
-
|
|
865
|
+
return None
|
|
866
866
|
else:
|
|
867
867
|
if image1.shape[1]!=mask.shape[1]:
|
|
868
868
|
print('The mask should have the same size than the input timeline to eval Scattering')
|
|
869
|
-
|
|
869
|
+
return None
|
|
870
870
|
|
|
871
871
|
### AUTO OR CROSS
|
|
872
872
|
cross = False
|
|
@@ -1647,7 +1647,7 @@ class funct(FOC.FoCUS):
|
|
|
1647
1647
|
for k in range(4):
|
|
1648
1648
|
hp.mollview(np.fmod(phase+np.pi,2*np.pi),cmap='jet',nest=True,hold=False,sub=(2,2,1+k))
|
|
1649
1649
|
plt.show()
|
|
1650
|
-
|
|
1650
|
+
return None
|
|
1651
1651
|
"""
|
|
1652
1652
|
iph=(4*phase/(2*np.pi)).astype('int')
|
|
1653
1653
|
alpha=(4*phase/(2*np.pi)-iph)
|
|
@@ -1720,14 +1720,14 @@ class funct(FOC.FoCUS):
|
|
|
1720
1720
|
if image2 is not None:
|
|
1721
1721
|
if list(image1.shape)!=list(image2.shape):
|
|
1722
1722
|
print('The two input image should have the same size to eval Scattering Covariance')
|
|
1723
|
-
|
|
1723
|
+
return None
|
|
1724
1724
|
if mask is not None:
|
|
1725
1725
|
if list(image1.shape)!=list(mask.shape)[1:]:
|
|
1726
|
-
print('The mask should have the same size ',mask.shape,'than the input image ',image1.shape,'to eval Scattering Covariance')
|
|
1727
|
-
|
|
1726
|
+
print('The LAST COLUMN of the mask should have the same size ',mask.shape,'than the input image ',image1.shape,'to eval Scattering Covariance')
|
|
1727
|
+
return None
|
|
1728
1728
|
if self.use_2D and len(image1.shape)<2:
|
|
1729
1729
|
print('To work with 2D scattering transform, two dimension is needed, input map has only on dimension')
|
|
1730
|
-
|
|
1730
|
+
return None
|
|
1731
1731
|
|
|
1732
1732
|
### AUTO OR CROSS
|
|
1733
1733
|
cross = False
|
|
@@ -1056,11 +1056,11 @@ class funct(FOC.FoCUS):
|
|
|
1056
1056
|
if image2 is not None:
|
|
1057
1057
|
if list(image1.shape)!=list(image2.shape):
|
|
1058
1058
|
print('The two input image should have the same size to eval Scattering Covariance')
|
|
1059
|
-
|
|
1059
|
+
return None
|
|
1060
1060
|
if mask is not None:
|
|
1061
1061
|
if list(image1.shape)!=list(mask.shape)[1:]:
|
|
1062
1062
|
print('The mask should have the same size ',mask.shape,'than the input image ',image1.shape,'to eval Scattering Covariance')
|
|
1063
|
-
|
|
1063
|
+
return None
|
|
1064
1064
|
|
|
1065
1065
|
### AUTO OR CROSS
|
|
1066
1066
|
cross = False
|
|
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
|