foscat 3.0.11__tar.gz → 3.0.13__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.11 → foscat-3.0.13}/PKG-INFO +1 -7
- {foscat-3.0.11 → foscat-3.0.13}/setup.py +1 -1
- foscat-3.0.13/src/foscat/GCNN.py +100 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/Synthesis.py +11 -6
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/backend.py +35 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat.egg-info/PKG-INFO +1 -7
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat.egg-info/SOURCES.txt +1 -0
- {foscat-3.0.11 → foscat-3.0.13}/README.md +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/setup.cfg +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/CircSpline.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/FoCUS.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/GetGPUinfo.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/Softmax.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/Spline1D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/__init__.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/loss_backend_tens.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/loss_backend_torch.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat1D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat2D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat_cov.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat_cov1D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat_cov2D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat_cov_map.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat/scat_cov_map2D.py +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat.egg-info/dependency_links.txt +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/src/foscat.egg-info/requires.txt +0 -0
- {foscat-3.0.11 → foscat-3.0.13}/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.13
|
|
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,12 +9,6 @@ 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
|
|
18
12
|
|
|
19
13
|
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.
|
|
20
14
|
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.13',
|
|
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',
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pickle
|
|
3
|
+
import foscat.scat_cov as sc
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GCNN:
|
|
7
|
+
|
|
8
|
+
def __init__(self,
|
|
9
|
+
scat_operator=None,
|
|
10
|
+
nparam=1,
|
|
11
|
+
nscale=1,
|
|
12
|
+
chanlist=[],
|
|
13
|
+
in_nside=1,
|
|
14
|
+
nbatch=1,
|
|
15
|
+
SEED=1234,
|
|
16
|
+
filename=None):
|
|
17
|
+
|
|
18
|
+
if filename is not None:
|
|
19
|
+
|
|
20
|
+
outlist=pickle.load(open("%s.pkl"%(filename),"rb"))
|
|
21
|
+
|
|
22
|
+
self.scat_operator=sc.funct(KERNELSZ=outlist[3],all_type=outlist[7])
|
|
23
|
+
self.KERNELSZ= self.scat_operator.KERNELSZ
|
|
24
|
+
self.all_type= self.scat_operator.all_type
|
|
25
|
+
self.npar=outlist[2]
|
|
26
|
+
self.nscale=outlist[5]
|
|
27
|
+
self.chanlist=outlist[0]
|
|
28
|
+
self.in_nside=outlist[4]
|
|
29
|
+
self.nbatch=outlist[1]
|
|
30
|
+
|
|
31
|
+
self.x=self.scat_operator.backend.bk_cast(outlist[6])
|
|
32
|
+
else:
|
|
33
|
+
self.nscale=nscale
|
|
34
|
+
self.nbatch=nbatch
|
|
35
|
+
self.npar=nparam
|
|
36
|
+
self.scat_operator=scat_operator
|
|
37
|
+
|
|
38
|
+
if len(chanlist)!=nscale+1:
|
|
39
|
+
print('len of chanlist (here %d) should of nscale+1 (here %d)'%(len(chanlist),nscale+1))
|
|
40
|
+
exit(0)
|
|
41
|
+
|
|
42
|
+
self.chanlist=chanlist
|
|
43
|
+
self.KERNELSZ= scat_operator.KERNELSZ
|
|
44
|
+
self.all_type= scat_operator.all_type
|
|
45
|
+
self.in_nside=in_nside
|
|
46
|
+
|
|
47
|
+
np.random.seed(SEED)
|
|
48
|
+
self.x=scat_operator.backend.bk_cast(np.random.randn(self.get_number_of_weights())/(self.KERNELSZ*self.KERNELSZ))
|
|
49
|
+
|
|
50
|
+
def save(self,filename):
|
|
51
|
+
|
|
52
|
+
outlist=[self.chanlist, \
|
|
53
|
+
self.nbatch, \
|
|
54
|
+
self.npar, \
|
|
55
|
+
self.KERNELSZ, \
|
|
56
|
+
self.in_nside, \
|
|
57
|
+
self.nscale, \
|
|
58
|
+
self.get_weights().numpy(), \
|
|
59
|
+
self.all_type]
|
|
60
|
+
myout=open("%s.pkl"%(filename),"wb")
|
|
61
|
+
pickle.dump(outlist,myout)
|
|
62
|
+
myout.close()
|
|
63
|
+
|
|
64
|
+
def get_number_of_weights(self):
|
|
65
|
+
totnchan=0
|
|
66
|
+
for i in range(self.nscale):
|
|
67
|
+
totnchan=totnchan+self.chanlist[i]*self.chanlist[i+1]
|
|
68
|
+
return self.npar*12*self.in_nside**2*self.chanlist[0] \
|
|
69
|
+
+totnchan*self.KERNELSZ*self.KERNELSZ+self.chanlist[self.nscale]
|
|
70
|
+
|
|
71
|
+
def set_weights(self,x):
|
|
72
|
+
self.x=x
|
|
73
|
+
|
|
74
|
+
def get_weights(self):
|
|
75
|
+
return self.x
|
|
76
|
+
|
|
77
|
+
def eval(self,param):
|
|
78
|
+
|
|
79
|
+
x=self.x
|
|
80
|
+
|
|
81
|
+
ww=self.scat_operator.backend.bk_reshape(x[0:self.npar*12*self.in_nside**2*self.chanlist[0]], \
|
|
82
|
+
[self.npar,12*self.in_nside**2*self.chanlist[0]])
|
|
83
|
+
|
|
84
|
+
im=self.scat_operator.backend.bk_matmul(self.scat_operator.backend.bk_reshape(param,[1,self.npar]),ww)
|
|
85
|
+
im=self.scat_operator.backend.bk_reshape(im,[12*self.in_nside**2,self.chanlist[0]])
|
|
86
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
87
|
+
|
|
88
|
+
nn=self.npar*12*self.chanlist[0]*self.in_nside**2
|
|
89
|
+
for k in range(self.nscale):
|
|
90
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]],
|
|
91
|
+
[self.KERNELSZ*self.KERNELSZ,self.chanlist[k],self.chanlist[k+1]])
|
|
92
|
+
nn=nn+self.KERNELSZ*self.KERNELSZ*self.chanlist[k]*self.chanlist[k+1]
|
|
93
|
+
im=self.scat_operator.healpix_layer_transpose(im,ww)
|
|
94
|
+
im=self.scat_operator.backend.bk_relu(im)
|
|
95
|
+
|
|
96
|
+
ww=self.scat_operator.backend.bk_reshape(x[nn:],[self.chanlist[self.nscale],1])
|
|
97
|
+
im=self.scat_operator.backend.bk_matmul(im,ww)
|
|
98
|
+
|
|
99
|
+
return self.scat_operator.backend.bk_reshape(im,[im.shape[0]])
|
|
100
|
+
|
|
@@ -49,6 +49,7 @@ class Synthesis:
|
|
|
49
49
|
|
|
50
50
|
self.loss_class=loss_list
|
|
51
51
|
self.number_of_loss=len(loss_list)
|
|
52
|
+
self.__iteration__=1234
|
|
52
53
|
self.nlog=0
|
|
53
54
|
self.m_dw, self.v_dw = 0.0, 0.0
|
|
54
55
|
self.beta1 = beta1
|
|
@@ -115,7 +116,7 @@ class Synthesis:
|
|
|
115
116
|
|
|
116
117
|
self.nlog=self.nlog+1
|
|
117
118
|
self.itt2=0
|
|
118
|
-
|
|
119
|
+
|
|
119
120
|
if self.itt%self.EVAL_FREQUENCY==0 and self.mpi_rank==0:
|
|
120
121
|
end = time.time()
|
|
121
122
|
cur_loss='%10.3g ('%(self.ltot[self.ltot!=-1].mean())
|
|
@@ -131,6 +132,7 @@ class Synthesis:
|
|
|
131
132
|
for k in range(info_gpu.shape[0]):
|
|
132
133
|
mess=mess+'[GPU%d %.0f/%.0f MB %.0f%%]'%(k,info_gpu[k,0],info_gpu[k,1],info_gpu[k,2])
|
|
133
134
|
|
|
135
|
+
|
|
134
136
|
print('%sItt %6d L=%s %.3fs %s'%(self.MESSAGE,self.itt,cur_loss,(end-self.start),mess))
|
|
135
137
|
sys.stdout.flush()
|
|
136
138
|
if self.KEEP_TRACK is not None:
|
|
@@ -140,13 +142,14 @@ class Synthesis:
|
|
|
140
142
|
self.start = time.time()
|
|
141
143
|
|
|
142
144
|
self.itt=self.itt+1
|
|
143
|
-
|
|
145
|
+
|
|
144
146
|
# ---------------------------------------------−---------
|
|
145
147
|
def calc_grad(self,in_x):
|
|
146
148
|
|
|
147
149
|
g_tot=None
|
|
148
150
|
l_tot=0.0
|
|
149
151
|
|
|
152
|
+
|
|
150
153
|
if self.do_all_noise and self.totalsz>self.batchsz:
|
|
151
154
|
nstep=self.totalsz//self.batchsz
|
|
152
155
|
else:
|
|
@@ -158,6 +161,7 @@ class Synthesis:
|
|
|
158
161
|
|
|
159
162
|
for istep in range(nstep):
|
|
160
163
|
|
|
164
|
+
|
|
161
165
|
for k in range(self.number_of_loss):
|
|
162
166
|
if self.loss_class[k].batch is None:
|
|
163
167
|
l_batch=None
|
|
@@ -271,6 +275,7 @@ class Synthesis:
|
|
|
271
275
|
self.SHOWGPU=SHOWGPU
|
|
272
276
|
self.axis=axis
|
|
273
277
|
self.in_x_nshape=in_x.shape[0]
|
|
278
|
+
self.seed=1234
|
|
274
279
|
|
|
275
280
|
np.random.seed(self.mpi_rank*7+1234)
|
|
276
281
|
|
|
@@ -347,7 +352,7 @@ class Synthesis:
|
|
|
347
352
|
start_x=x.copy()
|
|
348
353
|
|
|
349
354
|
for iteration in range(NUM_STEP_BIAS):
|
|
350
|
-
|
|
355
|
+
|
|
351
356
|
x,l,i=opt.fmin_l_bfgs_b(self.calc_grad,
|
|
352
357
|
x.astype('float64'),
|
|
353
358
|
callback=self.info_back,
|
|
@@ -357,17 +362,17 @@ class Synthesis:
|
|
|
357
362
|
|
|
358
363
|
# update bias input data
|
|
359
364
|
if iteration<NUM_STEP_BIAS-1:
|
|
360
|
-
if self.mpi_rank==0:
|
|
361
|
-
|
|
365
|
+
#if self.mpi_rank==0:
|
|
366
|
+
# print('%s Hessian restart'%(self.MESSAGE))
|
|
362
367
|
|
|
363
368
|
omap=self.xtractmap(x,axis)
|
|
364
369
|
|
|
365
370
|
for k in range(self.number_of_loss):
|
|
366
371
|
if self.loss_class[k].batch_update is not None:
|
|
367
372
|
self.loss_class[k].batch_update(self.loss_class[k].batch_data,omap)
|
|
373
|
+
if self.loss_class[k].batch is not None:
|
|
368
374
|
l_batch=self.loss_class[k].batch(self.loss_class[k].batch_data,0,init=True)
|
|
369
375
|
#x=start_x.copy()
|
|
370
|
-
|
|
371
376
|
|
|
372
377
|
if self.mpi_rank==0 and SHOWGPU:
|
|
373
378
|
self.stop_synthesis()
|
|
@@ -480,6 +480,41 @@ class foscat_backend:
|
|
|
480
480
|
return(self.backend.mean(data,axis))
|
|
481
481
|
if self.BACKEND==self.NUMPY:
|
|
482
482
|
return(np.mean(data,axis))
|
|
483
|
+
|
|
484
|
+
def bk_reduce_min(self,data,axis=None):
|
|
485
|
+
|
|
486
|
+
if axis is None:
|
|
487
|
+
if self.BACKEND==self.TENSORFLOW:
|
|
488
|
+
return(self.backend.reduce_min(data))
|
|
489
|
+
if self.BACKEND==self.TORCH:
|
|
490
|
+
return(self.backend.min(data))
|
|
491
|
+
if self.BACKEND==self.NUMPY:
|
|
492
|
+
return(np.min(data))
|
|
493
|
+
else:
|
|
494
|
+
if self.BACKEND==self.TENSORFLOW:
|
|
495
|
+
return(self.backend.reduce_min(data,axis=axis))
|
|
496
|
+
if self.BACKEND==self.TORCH:
|
|
497
|
+
return(self.backend.min(data,axis))
|
|
498
|
+
if self.BACKEND==self.NUMPY:
|
|
499
|
+
return(np.min(data,axis))
|
|
500
|
+
|
|
501
|
+
def bk_random_seed(self,value):
|
|
502
|
+
|
|
503
|
+
if self.BACKEND==self.TENSORFLOW:
|
|
504
|
+
return(self.backend.random.set_seed(value))
|
|
505
|
+
if self.BACKEND==self.TORCH:
|
|
506
|
+
return(self.backend.random.set_seed(value))
|
|
507
|
+
if self.BACKEND==self.NUMPY:
|
|
508
|
+
return(np.random.seed(value))
|
|
509
|
+
|
|
510
|
+
def bk_random_uniform(self,shape):
|
|
511
|
+
|
|
512
|
+
if self.BACKEND==self.TENSORFLOW:
|
|
513
|
+
return(self.backend.random.uniform(shape))
|
|
514
|
+
if self.BACKEND==self.TORCH:
|
|
515
|
+
return(self.backend.random.uniform(shape))
|
|
516
|
+
if self.BACKEND==self.NUMPY:
|
|
517
|
+
return(np.random.rand(shape))
|
|
483
518
|
|
|
484
519
|
def bk_reduce_std(self,data,axis=None):
|
|
485
520
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foscat
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.13
|
|
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,12 +9,6 @@ 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
|
|
18
12
|
|
|
19
13
|
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.
|
|
20
14
|
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
|