foscat 3.0.14__tar.gz → 3.0.16__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.14 → foscat-3.0.16}/PKG-INFO +7 -1
- {foscat-3.0.14 → foscat-3.0.16}/setup.py +1 -1
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/FoCUS.py +15 -12
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/GCNN.py +9 -4
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/backend.py +11 -4
- foscat-3.0.16/src/foscat/backend_tens.py +49 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat.egg-info/PKG-INFO +7 -1
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat.egg-info/SOURCES.txt +1 -0
- {foscat-3.0.14 → foscat-3.0.16}/README.md +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/setup.cfg +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/CircSpline.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/GetGPUinfo.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/Softmax.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/Spline1D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/Synthesis.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/__init__.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/loss_backend_tens.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/loss_backend_torch.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat1D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat2D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat_cov.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat_cov1D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat_cov2D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat_cov_map.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat/scat_cov_map2D.py +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat.egg-info/dependency_links.txt +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/src/foscat.egg-info/requires.txt +0 -0
- {foscat-3.0.14 → foscat-3.0.16}/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.
|
|
3
|
+
Version: 3.0.16
|
|
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.
|
|
6
|
+
version='3.0.16',
|
|
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',
|
|
@@ -4,6 +4,7 @@ import os, sys
|
|
|
4
4
|
import foscat.backend as bk
|
|
5
5
|
from scipy.interpolate import griddata
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
TMPFILE_VERSION='V2_6'
|
|
8
9
|
|
|
9
10
|
class FoCUS:
|
|
@@ -31,6 +32,7 @@ class FoCUS:
|
|
|
31
32
|
mpi_size=1,
|
|
32
33
|
mpi_rank=0):
|
|
33
34
|
|
|
35
|
+
self.__version__ = '3.0.16'
|
|
34
36
|
# P00 coeff for normalization for scat_cov
|
|
35
37
|
self.TMPFILE_VERSION=TMPFILE_VERSION
|
|
36
38
|
self.P1_dic = None
|
|
@@ -45,7 +47,7 @@ class FoCUS:
|
|
|
45
47
|
self.return_data=return_data
|
|
46
48
|
self.silent=silent
|
|
47
49
|
|
|
48
|
-
if not silent:
|
|
50
|
+
if not self.silent:
|
|
49
51
|
print('================================================')
|
|
50
52
|
print(' START FOSCAT CONFIGURATION')
|
|
51
53
|
print('================================================')
|
|
@@ -53,14 +55,14 @@ class FoCUS:
|
|
|
53
55
|
|
|
54
56
|
self.TEMPLATE_PATH=TEMPLATE_PATH
|
|
55
57
|
if os.path.exists(self.TEMPLATE_PATH)==False:
|
|
56
|
-
if not silent:
|
|
58
|
+
if not self.silent:
|
|
57
59
|
print('The directory %s to store temporary information for FoCUS does not exist: Try to create it'%(self.TEMPLATE_PATH))
|
|
58
60
|
try:
|
|
59
61
|
os.system('mkdir -p %s'%(self.TEMPLATE_PATH))
|
|
60
|
-
if not silent:
|
|
62
|
+
if not self.silent:
|
|
61
63
|
print('The directory %s is created')
|
|
62
64
|
except:
|
|
63
|
-
if not silent:
|
|
65
|
+
if not self.silent:
|
|
64
66
|
print('Impossible to create the directory %s'%(self.TEMPLATE_PATH))
|
|
65
67
|
exit(0)
|
|
66
68
|
|
|
@@ -71,14 +73,14 @@ class FoCUS:
|
|
|
71
73
|
self.padding=padding
|
|
72
74
|
|
|
73
75
|
if OSTEP!=0:
|
|
74
|
-
if not silent:
|
|
76
|
+
if not self.silent:
|
|
75
77
|
print('OPTION option is deprecated after version 2.0.6. Please use Jmax option')
|
|
76
78
|
JmaxDelta=OSTEP
|
|
77
79
|
else:
|
|
78
80
|
OSTEP=JmaxDelta
|
|
79
81
|
|
|
80
82
|
if JmaxDelta<-1:
|
|
81
|
-
if not silent:
|
|
83
|
+
if not self.silent:
|
|
82
84
|
print('Warning : Jmax can not be smaller than -1')
|
|
83
85
|
exit(0)
|
|
84
86
|
|
|
@@ -101,7 +103,8 @@ class FoCUS:
|
|
|
101
103
|
self.backend=bk.foscat_backend(BACKEND,
|
|
102
104
|
all_type=all_type,
|
|
103
105
|
mpi_rank=mpi_rank,
|
|
104
|
-
gpupos=gpupos
|
|
106
|
+
gpupos=gpupos,
|
|
107
|
+
silent=self.silent)
|
|
105
108
|
|
|
106
109
|
self.all_bk_type=self.backend.all_bk_type
|
|
107
110
|
self.all_cbk_type=self.backend.all_cbk_type
|
|
@@ -111,7 +114,7 @@ class FoCUS:
|
|
|
111
114
|
|
|
112
115
|
self.gpupos=(gpupos+mpi_rank)%self.backend.ngpu
|
|
113
116
|
|
|
114
|
-
if not silent:
|
|
117
|
+
if not self.silent:
|
|
115
118
|
print('============================================================')
|
|
116
119
|
print('== ==')
|
|
117
120
|
print('== ==')
|
|
@@ -221,7 +224,7 @@ class FoCUS:
|
|
|
221
224
|
|
|
222
225
|
for i in range(1,6):
|
|
223
226
|
lout=(2**i)
|
|
224
|
-
if not silent:
|
|
227
|
+
if not self.silent:
|
|
225
228
|
print('Init Wave ',lout)
|
|
226
229
|
|
|
227
230
|
if self.InitWave is None:
|
|
@@ -332,7 +335,7 @@ class FoCUS:
|
|
|
332
335
|
indices=np.zeros([12*nside*nside,l_kernel,2],dtype='int')
|
|
333
336
|
for k in range(12*nside*nside):
|
|
334
337
|
if k%(nside*nside)==0:
|
|
335
|
-
if not silent:
|
|
338
|
+
if not self.silent:
|
|
336
339
|
print('Pre-compute nside=%6d %.2f%%'%(nside,100*k/(12*nside*nside)))
|
|
337
340
|
|
|
338
341
|
rot=[po[k]/np.pi*180.0,90+(-to[k])/np.pi*180.0]
|
|
@@ -345,11 +348,11 @@ class FoCUS:
|
|
|
345
348
|
if transpose:
|
|
346
349
|
indices[:,:,1]=indices[:,:,1]//4
|
|
347
350
|
np.save('%s/FOSCAT_%s_W%d_%d_%d_CNN_Transpose.npy'%(self.TEMPLATE_PATH,TMPFILE_VERSION,l_kernel,self.NORIENT,nside),indices)
|
|
348
|
-
if not silent:
|
|
351
|
+
if not self.silent:
|
|
349
352
|
print('Write %s/FOSCAT_%s_W%d_%d_%d_CNN_Transpose.npy'%(self.TEMPLATE_PATH,TMPFILE_VERSION,l_kernel,self.NORIENT,nside))
|
|
350
353
|
else:
|
|
351
354
|
np.save('%s/FOSCAT_%s_W%d_%d_%d_CNNnpy'%(self.TEMPLATE_PATH,TMPFILE_VERSION,l_kernel,self.NORIENT,nside),indices)
|
|
352
|
-
if not silent:
|
|
355
|
+
if not self.silent:
|
|
353
356
|
print('Write %s/FOSCAT_%s_W%d_%d_%d_CNN.npy'%(self.TEMPLATE_PATH,TMPFILE_VERSION,l_kernel,self.NORIENT,nside))
|
|
354
357
|
|
|
355
358
|
|
|
@@ -11,6 +11,7 @@ class GCNN:
|
|
|
11
11
|
nscale=1,
|
|
12
12
|
chanlist=[],
|
|
13
13
|
in_nside=1,
|
|
14
|
+
n_chan_out=1,
|
|
14
15
|
nbatch=1,
|
|
15
16
|
SEED=1234,
|
|
16
17
|
filename=None):
|
|
@@ -27,12 +28,14 @@ class GCNN:
|
|
|
27
28
|
self.chanlist=outlist[0]
|
|
28
29
|
self.in_nside=outlist[4]
|
|
29
30
|
self.nbatch=outlist[1]
|
|
31
|
+
self.n_chan_out=outlist[8]
|
|
30
32
|
|
|
31
33
|
self.x=self.scat_operator.backend.bk_cast(outlist[6])
|
|
32
34
|
else:
|
|
33
35
|
self.nscale=nscale
|
|
34
36
|
self.nbatch=nbatch
|
|
35
37
|
self.npar=nparam
|
|
38
|
+
self.n_chan_out=n_chan_out
|
|
36
39
|
self.scat_operator=scat_operator
|
|
37
40
|
|
|
38
41
|
if len(chanlist)!=nscale+1:
|
|
@@ -56,7 +59,9 @@ class GCNN:
|
|
|
56
59
|
self.in_nside, \
|
|
57
60
|
self.nscale, \
|
|
58
61
|
self.get_weights().numpy(), \
|
|
59
|
-
self.all_type
|
|
62
|
+
self.all_type, \
|
|
63
|
+
self.n_chan_out]
|
|
64
|
+
|
|
60
65
|
myout=open("%s.pkl"%(filename),"wb")
|
|
61
66
|
pickle.dump(outlist,myout)
|
|
62
67
|
myout.close()
|
|
@@ -66,7 +71,7 @@ class GCNN:
|
|
|
66
71
|
for i in range(self.nscale):
|
|
67
72
|
totnchan=totnchan+self.chanlist[i]*self.chanlist[i+1]
|
|
68
73
|
return self.npar*12*self.in_nside**2*self.chanlist[0] \
|
|
69
|
-
+totnchan*self.KERNELSZ*self.KERNELSZ+self.chanlist[self.nscale]
|
|
74
|
+
+totnchan*self.KERNELSZ*self.KERNELSZ+self.chanlist[self.nscale]*self.n_chan_out
|
|
70
75
|
|
|
71
76
|
def set_weights(self,x):
|
|
72
77
|
self.x=x
|
|
@@ -93,8 +98,8 @@ class GCNN:
|
|
|
93
98
|
im=self.scat_operator.healpix_layer_transpose(im,ww)
|
|
94
99
|
im=self.scat_operator.backend.bk_relu(im)
|
|
95
100
|
|
|
96
|
-
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],
|
|
101
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],self.n_chan_out])
|
|
97
102
|
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
98
103
|
|
|
99
|
-
return
|
|
104
|
+
return im
|
|
100
105
|
|
|
@@ -3,7 +3,7 @@ import numpy as np
|
|
|
3
3
|
|
|
4
4
|
class foscat_backend:
|
|
5
5
|
|
|
6
|
-
def __init__(self,name,mpi_rank=0,all_type='float64',gpupos=0):
|
|
6
|
+
def __init__(self,name,mpi_rank=0,all_type='float64',gpupos=0,silent=False):
|
|
7
7
|
|
|
8
8
|
self.TENSORFLOW=1
|
|
9
9
|
self.TORCH=2
|
|
@@ -71,7 +71,7 @@ class foscat_backend:
|
|
|
71
71
|
#===========================================================================
|
|
72
72
|
# INIT
|
|
73
73
|
if mpi_rank==0:
|
|
74
|
-
if self.BACKEND==self.TENSORFLOW:
|
|
74
|
+
if self.BACKEND==self.TENSORFLOW and silent==False:
|
|
75
75
|
print("Num GPUs Available: ", len(self.backend.config.experimental.list_physical_devices('GPU')))
|
|
76
76
|
sys.stdout.flush()
|
|
77
77
|
|
|
@@ -264,7 +264,14 @@ class foscat_backend:
|
|
|
264
264
|
if self.BACKEND==self.TORCH:
|
|
265
265
|
return x
|
|
266
266
|
if self.BACKEND==self.NUMPY:
|
|
267
|
-
|
|
267
|
+
res=np.zeros([x.shape[0],x.shape[1],x.shape[2],w.shape[3]],dtype=x.dtype)
|
|
268
|
+
for k in range(w.shape[2]):
|
|
269
|
+
for l in range(w.shape[3]):
|
|
270
|
+
for j in range(res.shape[0]):
|
|
271
|
+
tmp=self.scipy.signal.convolve2d(x[j,:,:,k],w[:,:,k,l], mode='same', boundary='fill', fillvalue=0.0)
|
|
272
|
+
res[j,:,:,l]+=tmp
|
|
273
|
+
del tmp
|
|
274
|
+
return res
|
|
268
275
|
|
|
269
276
|
def bk_threshold(self,x,threshold,greater=True):
|
|
270
277
|
|
|
@@ -303,7 +310,7 @@ class foscat_backend:
|
|
|
303
310
|
res=np.zeros([x.shape[0],x.shape[1],w.shape[1]],dtype=x.dtype)
|
|
304
311
|
for k in range(w.shape[1]):
|
|
305
312
|
for l in range(w.shape[2]):
|
|
306
|
-
res[:,:,l]+=self.scipy.ndimage.convolve1d(x[:,:,k],w[:,k,l],axis=1)
|
|
313
|
+
res[:,:,l]+=self.scipy.ndimage.convolve1d(x[:,:,k],w[:,k,l],axis=1,mode='constant',cval=0.0)
|
|
307
314
|
return res
|
|
308
315
|
|
|
309
316
|
def bk_flattenR(self,x):
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import tensorflow as tf
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
class foscat_backend_tens:
|
|
5
|
+
|
|
6
|
+
def __init__(self,backend):
|
|
7
|
+
|
|
8
|
+
self.bk=backend
|
|
9
|
+
# ---------------------------------------------−---------
|
|
10
|
+
|
|
11
|
+
@tf.function
|
|
12
|
+
def loss(self,x,batch,loss_function):
|
|
13
|
+
|
|
14
|
+
operation=loss_function.scat_operator
|
|
15
|
+
|
|
16
|
+
nx=1
|
|
17
|
+
if len(x.shape)>1:
|
|
18
|
+
nx=x.shape[0]
|
|
19
|
+
|
|
20
|
+
with tf.device(operation.gpulist[(operation.gpupos+self.curr_gpu)%operation.ngpu]):
|
|
21
|
+
print('%s Run [PROC=%04d] on GPU %s'%(loss_function.name,self.mpi_rank,
|
|
22
|
+
operation.gpulist[(operation.gpupos+self.curr_gpu)%operation.ngpu]))
|
|
23
|
+
sys.stdout.flush()
|
|
24
|
+
|
|
25
|
+
l_x=x
|
|
26
|
+
"""
|
|
27
|
+
if nx>1:
|
|
28
|
+
l_x={}
|
|
29
|
+
for i in range(nx):
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
if nx==1:
|
|
33
|
+
ndata=x.shape[0]
|
|
34
|
+
else:
|
|
35
|
+
ndata=x.shape[0]*x.shape[1]
|
|
36
|
+
|
|
37
|
+
if self.KEEP_TRACK is not None:
|
|
38
|
+
l,linfo=loss_function.eval(l_x,batch,return_all=True)
|
|
39
|
+
else:
|
|
40
|
+
l=loss_function.eval(l_x,batch)
|
|
41
|
+
|
|
42
|
+
g=tf.gradients(l,x)[0]
|
|
43
|
+
g=self.backend.check_dense(g,ndata)
|
|
44
|
+
self.curr_gpu=self.curr_gpu+1
|
|
45
|
+
|
|
46
|
+
if self.KEEP_TRACK is not None:
|
|
47
|
+
return l,g,linfo
|
|
48
|
+
else:
|
|
49
|
+
return l,g
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foscat
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.16
|
|
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
|
|
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
|