Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
28c6c7b6
Commit
28c6c7b6
authored
Jun 18, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to better_params branch
parent
3be21948
Pipeline
#50926
passed with stages
in 17 minutes and 34 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
18 deletions
+28
-18
Dockerfile
Dockerfile
+1
-1
demos/bench_gridder.py
demos/bench_gridder.py
+4
-2
nifty5/library/gridder.py
nifty5/library/gridder.py
+5
-5
test/test_operators/test_nft.py
test/test_operators/test_nft.py
+18
-10
No files found.
Dockerfile
View file @
28c6c7b6
...
...
@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \
python3-mpi4py python3-matplotlib \
# more optional NIFTy dependencies
&& pip3 install git+https://gitlab.mpcdf.mpg.de/ift/pyHealpix.git \
&& pip3 install git+https://gitlab.mpcdf.mpg.de/ift/nifty_gridder.git@
powergrid
\
&& pip3 install git+https://gitlab.mpcdf.mpg.de/ift/nifty_gridder.git@
better_params
\
&& pip3 install git+https://gitlab.mpcdf.mpg.de/mtr/pypocketfft.git \
&& pip3 install jupyter \
&& rm -rf /var/lib/apt/lists/*
...
...
demos/bench_gridder.py
View file @
28c6c7b6
...
...
@@ -10,13 +10,15 @@ np.random.seed(40)
N0s
,
a0s
,
b0s
,
c0s
=
[],
[],
[],
[]
for
ii
in
range
(
10
,
26
):
fovx
=
0.0001
fovy
=
0.0002
nu
=
1024
nv
=
1024
N
=
int
(
2
**
ii
)
print
(
'N = {}'
.
format
(
N
))
nchan
=
16
nrow
=
N
//
nchan
f
ct
=
1.
+
0.00001
*
np
.
arange
(
nchan
)
f
req
=
1e9
+
1e6
*
np
.
arange
(
nchan
)
uvw
=
np
.
random
.
rand
(
nrow
,
3
)
-
0.5
vis
=
(
np
.
random
.
randn
(
N
)
+
1j
*
np
.
random
.
randn
(
N
)).
reshape
((
nrow
,
nchan
))
...
...
@@ -30,7 +32,7 @@ for ii in range(10, 26):
t0
=
time
()
GM
=
ift
.
GridderMaker
(
uvspace
,
eps
=
1e-7
,
uvw
=
uvw
,
channel_fact
=
fct
,
freq
=
freq
,
fovx
=
fovx
,
fovy
=
fovy
,
flags
=
np
.
zeros
((
N
//
nchan
,
nchan
),
dtype
=
np
.
bool
))
vis
=
ift
.
from_global_data
(
visspace
,
vis
)
op
=
GM
.
getFull
().
adjoint
...
...
nifty5/library/gridder.py
View file @
28c6c7b6
...
...
@@ -24,17 +24,17 @@ import numpy as np
class
GridderMaker
(
object
):
def
__init__
(
self
,
dirty_domain
,
uvw
,
channel_fact
,
flags
,
eps
=
2e-13
):
def
__init__
(
self
,
dirty_domain
,
uvw
,
freq
,
fovx
,
fovy
,
flags
,
eps
=
2e-13
):
import
nifty_gridder
dirty_domain
=
makeDomain
(
dirty_domain
)
if
(
len
(
dirty_domain
)
!=
1
or
not
isinstance
(
dirty_domain
[
0
],
RGSpace
)
or
not
len
(
dirty_domain
.
shape
)
==
2
):
raise
ValueError
(
"need dirty_domain with exactly one 2D RGSpace"
)
if
channel_fact
.
ndim
!=
1
:
raise
ValueError
(
"
channel_fact
must be a 1D array"
)
bl
=
nifty_gridder
.
Baselines
(
uvw
,
channel_fact
)
if
freq
.
ndim
!=
1
:
raise
ValueError
(
"
freq
must be a 1D array"
)
bl
=
nifty_gridder
.
Baselines
(
uvw
,
freq
)
nxdirty
,
nydirty
=
dirty_domain
.
shape
gconf
=
nifty_gridder
.
GridderConfig
(
nxdirty
,
nydirty
,
eps
,
1.
,
1.
)
gconf
=
nifty_gridder
.
GridderConfig
(
nxdirty
,
nydirty
,
eps
,
fovx
,
fovy
)
nu
=
gconf
.
Nu
()
nv
=
gconf
.
Nv
()
self
.
_idx
=
nifty_gridder
.
getIndices
(
bl
,
gconf
,
flags
)
...
...
test/test_operators/test_nft.py
View file @
28c6c7b6
...
...
@@ -29,19 +29,24 @@ pmp = pytest.mark.parametrize
def
_l2error
(
a
,
b
):
return
np
.
sqrt
(
np
.
sum
(
np
.
abs
(
a
-
b
)
**
2
)
/
np
.
sum
(
np
.
abs
(
a
)
**
2
))
speedOfLight
=
299792458.
@
pmp
(
'eps'
,
[
1e-2
,
1e-4
,
1e-7
,
1e-10
,
1e-11
,
1e-12
,
2e-13
])
@
pmp
(
'nu'
,
[
12
,
128
])
@
pmp
(
'nv'
,
[
4
,
12
,
128
])
@
pmp
(
'N'
,
[
1
,
10
,
100
])
@
pmp
(
'channel_fact'
,
[
1
,
1.2
])
def
test_gridding
(
nu
,
nv
,
N
,
eps
,
channel_fact
):
uvw
=
np
.
random
.
rand
(
N
,
3
)
-
0.5
@
pmp
(
'freq'
,
[
1e9
])
def
test_gridding
(
nu
,
nv
,
N
,
eps
,
freq
):
fovx
=
0.0001
fovy
=
0.0002
uvw
=
(
np
.
random
.
rand
(
N
,
3
)
-
0.5
)
uvw
[:,
0
]
/=
fovx
*
freq
/
speedOfLight
uvw
[:,
1
]
/=
fovy
*
freq
/
speedOfLight
vis
=
(
np
.
random
.
randn
(
N
)
+
1j
*
np
.
random
.
randn
(
N
)).
reshape
((
-
1
,
1
))
# Nifty
GM
=
ift
.
GridderMaker
(
ift
.
RGSpace
((
nu
,
nv
)),
uvw
=
uvw
,
channel_fact
=
np
.
array
([
channel_fact
]),
eps
=
eps
,
freq
=
np
.
array
([
freq
]),
eps
=
eps
,
fovx
=
fovx
,
fovy
=
fovy
,
flags
=
np
.
zeros
((
N
,
1
),
dtype
=
np
.
bool
))
vis2
=
ift
.
from_global_data
(
ift
.
UnstructuredDomain
(
vis
.
shape
),
vis
)
...
...
@@ -50,9 +55,11 @@ def test_gridding(nu, nv, N, eps, channel_fact):
# DFT
x
,
y
=
np
.
meshgrid
(
*
[
-
ss
/
2
+
np
.
arange
(
ss
)
for
ss
in
[
nu
,
nv
]],
indexing
=
'ij'
)
x
*=
fovx
*
freq
/
speedOfLight
y
*=
fovy
*
freq
/
speedOfLight
dft
=
pynu
*
0.
for
i
in
range
(
N
):
dft
+=
(
vis
[
i
]
*
np
.
exp
(
2j
*
np
.
pi
*
(
x
*
uvw
[
i
,
0
]
+
y
*
uvw
[
i
,
1
])
*
channel_fact
)).
real
dft
+=
(
vis
[
i
]
*
np
.
exp
(
2j
*
np
.
pi
*
(
x
*
uvw
[
i
,
0
]
+
y
*
uvw
[
i
,
1
]))).
real
assert_
(
_l2error
(
dft
,
pynu
)
<
eps
)
...
...
@@ -60,14 +67,15 @@ def test_gridding(nu, nv, N, eps, channel_fact):
@
pmp
(
'nu'
,
[
12
,
128
])
@
pmp
(
'nv'
,
[
4
,
12
,
128
])
@
pmp
(
'N'
,
[
1
,
10
,
100
])
@
pmp
(
'
cfact'
,
[
np
.
array
([
1.
]),
np
.
array
([
0.3
,
0.5
,
2.3
])])
def
test_build
(
nu
,
nv
,
N
,
eps
,
cfact
):
@
pmp
(
'
freq'
,
[
np
.
array
([
1e9
]),
np
.
array
([
1e9
,
2e9
,
2.5e9
])])
def
test_build
(
nu
,
nv
,
N
,
eps
,
freq
):
dom
=
ift
.
RGSpace
([
nu
,
nv
])
fov
=
np
.
pi
/
180
/
60
uvw
=
np
.
random
.
rand
(
N
,
3
)
-
0.5
flags
=
np
.
zeros
((
N
,
cfact
.
shape
[
0
]),
dtype
=
np
.
bool
)
flags
=
np
.
zeros
((
N
,
freq
.
shape
[
0
]),
dtype
=
np
.
bool
)
flags
[
0
,
0
]
=
True
GM
=
ift
.
GridderMaker
(
dom
,
uvw
=
uvw
,
channel_fact
=
cfact
,
eps
=
eps
,
flags
=
flags
)
GM
=
ift
.
GridderMaker
(
dom
,
uvw
=
uvw
,
freq
=
freq
,
eps
=
eps
,
flags
=
flags
,
fovx
=
fov
,
fovy
=
fov
)
R0
=
GM
.
getGridder
()
R1
=
GM
.
getRest
()
R
=
R1
@
R0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment