foscat 3.0.34__tar.gz → 3.0.36__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.34 → foscat-3.0.36}/PKG-INFO +1 -1
- {foscat-3.0.34 → foscat-3.0.36}/setup.py +1 -1
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/FoCUS.py +1 -1
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/GCNN.py +71 -15
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat.egg-info/PKG-INFO +1 -1
- {foscat-3.0.34 → foscat-3.0.36}/README.md +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/setup.cfg +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/CNN.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/CircSpline.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/GetGPUinfo.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/Softmax.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/Spline1D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/Synthesis.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/__init__.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/backend.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/backend_tens.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/loss_backend_tens.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/loss_backend_torch.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat1D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat2D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat_cov.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat_cov1D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat_cov2D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat_cov_map.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat/scat_cov_map2D.py +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat.egg-info/SOURCES.txt +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat.egg-info/dependency_links.txt +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/src/foscat.egg-info/requires.txt +0 -0
- {foscat-3.0.34 → foscat-3.0.36}/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.36',
|
|
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',
|
|
@@ -14,6 +14,7 @@ class GCNN:
|
|
|
14
14
|
n_chan_out=1,
|
|
15
15
|
nbatch=1,
|
|
16
16
|
SEED=1234,
|
|
17
|
+
hidden=None,
|
|
17
18
|
filename=None):
|
|
18
19
|
|
|
19
20
|
if filename is not None:
|
|
@@ -29,7 +30,11 @@ class GCNN:
|
|
|
29
30
|
self.in_nside=outlist[4]
|
|
30
31
|
self.nbatch=outlist[1]
|
|
31
32
|
self.n_chan_out=outlist[8]
|
|
32
|
-
|
|
33
|
+
if len(outlist[9])>0:
|
|
34
|
+
self.hidden=outlist[9]
|
|
35
|
+
else:
|
|
36
|
+
self.hidden=None
|
|
37
|
+
|
|
33
38
|
self.x=self.scat_operator.backend.bk_cast(outlist[6])
|
|
34
39
|
else:
|
|
35
40
|
self.nscale=nscale
|
|
@@ -46,21 +51,33 @@ class GCNN:
|
|
|
46
51
|
self.KERNELSZ= scat_operator.KERNELSZ
|
|
47
52
|
self.all_type= scat_operator.all_type
|
|
48
53
|
self.in_nside=in_nside
|
|
54
|
+
self.hidden=hidden
|
|
49
55
|
|
|
50
56
|
np.random.seed(SEED)
|
|
51
57
|
self.x=scat_operator.backend.bk_cast(np.random.randn(self.get_number_of_weights())/(self.KERNELSZ*self.KERNELSZ))
|
|
52
58
|
|
|
53
59
|
def save(self,filename):
|
|
60
|
+
|
|
61
|
+
if self.hidden is None:
|
|
62
|
+
tabh=[]
|
|
63
|
+
else:
|
|
64
|
+
tabh=self.hidden
|
|
65
|
+
|
|
66
|
+
www= self.get_weights()
|
|
54
67
|
|
|
68
|
+
if not isinstance(www,np.ndarray):
|
|
69
|
+
www=www.numpy()
|
|
70
|
+
|
|
55
71
|
outlist=[self.chanlist, \
|
|
56
72
|
self.nbatch, \
|
|
57
73
|
self.npar, \
|
|
58
74
|
self.KERNELSZ, \
|
|
59
75
|
self.in_nside, \
|
|
60
76
|
self.nscale, \
|
|
61
|
-
|
|
77
|
+
www, \
|
|
62
78
|
self.all_type, \
|
|
63
|
-
self.n_chan_out
|
|
79
|
+
self.n_chan_out, \
|
|
80
|
+
tabh]
|
|
64
81
|
|
|
65
82
|
myout=open("%s.pkl"%(filename),"wb")
|
|
66
83
|
pickle.dump(outlist,myout)
|
|
@@ -68,10 +85,19 @@ class GCNN:
|
|
|
68
85
|
|
|
69
86
|
def get_number_of_weights(self):
|
|
70
87
|
totnchan=0
|
|
88
|
+
szk=self.KERNELSZ*self.KERNELSZ
|
|
89
|
+
if self.hidden is not None:
|
|
90
|
+
totnchan=totnchan+self.hidden[0]*self.npar
|
|
91
|
+
for i in range(1,len(self.hidden)):
|
|
92
|
+
totnchan=totnchan+self.hidden[i]*self.hidden[i-1]
|
|
93
|
+
totnchan=totnchan+self.hidden[len(self.hidden)-1]*12*self.in_nside**2*self.chanlist[0]
|
|
94
|
+
else:
|
|
95
|
+
totnchan=self.npar*12*self.in_nside**2*self.chanlist[0]
|
|
96
|
+
|
|
71
97
|
for i in range(self.nscale):
|
|
72
|
-
totnchan=totnchan+self.chanlist[i]*self.chanlist[i+1]
|
|
73
|
-
|
|
74
|
-
|
|
98
|
+
totnchan=totnchan+self.chanlist[i]*self.chanlist[i+1]*szk
|
|
99
|
+
|
|
100
|
+
return totnchan+self.chanlist[i+1]*self.n_chan_out*szk
|
|
75
101
|
|
|
76
102
|
def set_weights(self,x):
|
|
77
103
|
self.x=x
|
|
@@ -83,20 +109,46 @@ class GCNN:
|
|
|
83
109
|
|
|
84
110
|
x=self.x
|
|
85
111
|
|
|
86
|
-
ww=self.scat_operator.backend.bk_reshape(x[0:self.npar*12*self.in_nside**2*self.chanlist[0]], \
|
|
87
|
-
[self.npar,12*self.in_nside**2*self.chanlist[0]])
|
|
88
112
|
|
|
89
113
|
if axis==0:
|
|
90
114
|
nval=1
|
|
91
115
|
else:
|
|
92
116
|
nval=param.shape[0]
|
|
93
|
-
|
|
117
|
+
|
|
118
|
+
nn=0
|
|
94
119
|
im=self.scat_operator.backend.bk_reshape(param,[nval,self.npar])
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
120
|
+
if self.hidden is not None:
|
|
121
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.npar*self.hidden[0]], \
|
|
122
|
+
[self.npar,self.hidden[0]])
|
|
123
|
+
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
124
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
125
|
+
nn+=self.npar*self.hidden[0]
|
|
126
|
+
|
|
127
|
+
for i in range(1,len(self.hidden)):
|
|
128
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.hidden[i]*self.hidden[i-1]], \
|
|
129
|
+
[self.hidden[i-1],self.hidden[i]])
|
|
130
|
+
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
131
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
132
|
+
nn+=self.hidden[i]*self.hidden[i-1]
|
|
133
|
+
|
|
134
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.hidden[len(self.hidden)-1]*12*self.in_nside**2*self.chanlist[0]], \
|
|
135
|
+
[self.hidden[len(self.hidden)-1],
|
|
136
|
+
12*self.in_nside**2*self.chanlist[0]])
|
|
137
|
+
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
138
|
+
im=self.scat_operator.backend.bk_reshape(im,[nval,12*self.in_nside**2,self.chanlist[0]])
|
|
139
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
140
|
+
nn+=self.hidden[len(self.hidden)-1]*12*self.in_nside**2*self.chanlist[0]
|
|
141
|
+
|
|
142
|
+
else:
|
|
143
|
+
ww=self.scat_operator.backend.bk_reshape(x[0:self.npar*12*self.in_nside**2*self.chanlist[0]], \
|
|
144
|
+
[self.npar,12*self.in_nside**2*self.chanlist[0]])
|
|
145
|
+
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
146
|
+
im=self.scat_operator.backend.bk_reshape(im,[nval,12*self.in_nside**2,self.chanlist[0]])
|
|
147
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
148
|
+
|
|
149
|
+
nn=self.npar*12*self.chanlist[0]*self.in_nside**2
|
|
98
150
|
|
|
99
|
-
|
|
151
|
+
|
|
100
152
|
for k in range(self.nscale):
|
|
101
153
|
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]],
|
|
102
154
|
[self.KERNELSZ*self.KERNELSZ,self.chanlist[k],self.chanlist[k+1]])
|
|
@@ -107,8 +159,12 @@ class GCNN:
|
|
|
107
159
|
im=self.scat_operator.healpix_layer_transpose(im,ww,indices=indices[k],weights=weights[k],axis=1)
|
|
108
160
|
im=self.scat_operator.backend.bk_relu(im)
|
|
109
161
|
|
|
110
|
-
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],self.n_chan_out])
|
|
111
|
-
|
|
162
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.KERNELSZ*self.KERNELSZ,self.chanlist[self.nscale],self.n_chan_out])
|
|
163
|
+
if indices is None:
|
|
164
|
+
im=self.scat_operator.healpix_layer(im,ww,axis=1)
|
|
165
|
+
else:
|
|
166
|
+
im=self.scat_operator.healpix_layer(im,ww,indices=indices[self.nscale],weights=weights[self.nscale],axis=1)
|
|
167
|
+
|
|
112
168
|
if axis==0:
|
|
113
169
|
im=self.scat_operator.backend.bk_reshape(im,[im.shape[1],im.shape[2]])
|
|
114
170
|
return im
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|