Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
nifty_gridder
Commits
043a57c1
Commit
043a57c1
authored
Aug 31, 2019
by
Martin Reinecke
Browse files
slight tweaks
parent
cd0adad1
Changes
2
Hide whitespace changes
Inline
Side-by-side
gridder_cxx.h
View file @
043a57c1
...
@@ -155,7 +155,9 @@ template<typename T> inline T fmodulo (T v1, T v2)
...
@@ -155,7 +155,9 @@ template<typename T> inline T fmodulo (T v1, T v2)
{
{
if
(
v1
>=
0
)
if
(
v1
>=
0
)
return
(
v1
<
v2
)
?
v1
:
fmod
(
v1
,
v2
);
return
(
v1
<
v2
)
?
v1
:
fmod
(
v1
,
v2
);
T
tmp
=
fmod
(
v1
,
v2
)
+
v2
;
T
tmp
=
v1
+
v2
;
if
(
tmp
<
0
)
tmp
=
fmod
(
v1
,
v2
)
+
v2
;
return
(
tmp
==
v2
)
?
T
(
0
)
:
tmp
;
return
(
tmp
==
v2
)
?
T
(
0
)
:
tmp
;
}
}
...
@@ -518,14 +520,14 @@ template<typename T> class GridderConfig
...
@@ -518,14 +520,14 @@ template<typename T> class GridderConfig
grid
.
data
(),
grid
.
data
(),
T
(
1
),
nthreads
);
grid
.
data
(),
grid
.
data
(),
T
(
1
),
nthreads
);
}
}
inline
void
getpix
(
T
u_in
,
T
v_in
,
T
&
u
,
T
&
v
,
int
&
iu0
,
int
&
iv0
)
const
void
getpix
(
T
u_in
,
T
v_in
,
T
&
u
,
T
&
v
,
int
&
iu0
,
int
&
iv0
)
const
{
{
u
=
fmodulo
(
u_in
*
psx
,
T
(
1
))
*
nu
,
u
=
fmodulo
(
u_in
*
psx
,
T
(
1
))
*
nu
,
iu0
=
int
(
u
-
supp
*
0.5
+
1
+
nu
)
-
nu
;
iu0
=
int
(
u
-
supp
*
0.5
+
1
+
nu
)
-
nu
;
i
f
(
iu0
+
supp
>
nu
+
nsafe
)
iu0
=
nu
+
nsafe
-
supp
;
i
u0
=
min
<
int
>
(
iu0
,
(
nu
+
nsafe
)
-
supp
)
;
v
=
fmodulo
(
v_in
*
psy
,
T
(
1
))
*
nv
;
v
=
fmodulo
(
v_in
*
psy
,
T
(
1
))
*
nv
;
iv0
=
int
(
v
-
supp
*
0.5
+
1
+
nv
)
-
nv
;
iv0
=
int
(
v
-
supp
*
0.5
+
1
+
nv
)
-
nv
;
i
f
(
iv0
+
supp
>
nv
+
nsafe
)
iv0
=
nv
+
nsafe
-
supp
;
i
v0
=
min
<
int
>
(
iv0
,
(
nv
+
nsafe
)
-
supp
)
;
}
}
void
apply_wscreen
(
const
const_mav
<
complex
<
T
>
,
2
>
&
dirty
,
void
apply_wscreen
(
const
const_mav
<
complex
<
T
>
,
2
>
&
dirty
,
...
@@ -640,14 +642,11 @@ template<typename T, typename T2=complex<T>> class Helper
...
@@ -640,14 +642,11 @@ template<typename T, typename T2=complex<T>> class Helper
auto
y0
=
xsupp
*
(
iv0
-
v
);
auto
y0
=
xsupp
*
(
iv0
-
v
);
for
(
int
i
=
0
;
i
<
supp
;
++
i
)
for
(
int
i
=
0
;
i
<
supp
;
++
i
)
{
{
auto
x
=
x0
+
i
*
xsupp
;
kernel
[
i
]
=
x0
+
i
*
xsupp
;
kernel
[
i
]
=
beta
*
sqrt
(
T
(
1
)
-
x
*
x
);
kernel
[
i
+
supp
]
=
y0
+
i
*
xsupp
;
auto
y
=
y0
+
i
*
xsupp
;
kernel
[
i
+
supp
]
=
beta
*
sqrt
(
T
(
1
)
-
y
*
y
);
}
}
for
(
auto
&
k
:
kernel
)
for
(
auto
&
k
:
kernel
)
k
=
exp
(
k
);
k
=
exp
(
beta
*
sqrt
(
T
(
1
)
-
k
*
k
));
if
((
iu0
<
bu0
)
||
(
iv0
<
bv0
)
||
(
iu0
+
supp
>
bu0
+
su
)
||
(
iv0
+
supp
>
bv0
+
sv
))
if
((
iu0
<
bu0
)
||
(
iv0
<
bv0
)
||
(
iu0
+
supp
>
bu0
+
su
)
||
(
iv0
+
supp
>
bv0
+
sv
))
{
{
if
(
grid_w
)
{
dump
();
fill
(
wbuf
.
begin
(),
wbuf
.
end
(),
T
(
0
));
}
if
(
grid_w
)
{
dump
();
fill
(
wbuf
.
begin
(),
wbuf
.
end
(),
T
(
0
));
}
...
...
test.py
View file @
043a57c1
...
@@ -233,11 +233,12 @@ def test_no_correlation(nrow, nchan, epsilon, weight):
...
@@ -233,11 +233,12 @@ def test_no_correlation(nrow, nchan, epsilon, weight):
@
pmp
(
'epsilon'
,
[
1e-2
,
1e-4
,
1e-7
,
1e-10
,
1e-11
,
1e-12
,
2e-13
])
@
pmp
(
'epsilon'
,
[
1e-2
,
1e-4
,
1e-7
,
1e-10
,
1e-11
,
1e-12
,
2e-13
])
@
pmp
(
'nxdirty'
,
[
12
,
128
])
@
pmp
(
'nxdirty'
,
[
2
,
12
,
128
])
@
pmp
(
'nydirty'
,
[
4
,
12
,
128
])
@
pmp
(
'nydirty'
,
[
2
,
4
,
12
,
128
])
@
pmp
(
"nrow"
,
(
10
,
100
))
@
pmp
(
"nrow"
,
(
10
,
100
))
@
pmp
(
"nchan"
,
(
1
,
10
))
@
pmp
(
"nchan"
,
(
1
,
10
))
def
test_against_dft
(
nxdirty
,
nydirty
,
epsilon
,
nchan
,
nrow
):
def
test_against_dft
(
nxdirty
,
nydirty
,
epsilon
,
nchan
,
nrow
):
np
.
random
.
seed
(
42
)
bl
,
conf
,
idx
=
_init_gridder
(
nxdirty
,
nydirty
,
epsilon
,
nchan
,
nrow
)
bl
,
conf
,
idx
=
_init_gridder
(
nxdirty
,
nydirty
,
epsilon
,
nchan
,
nrow
)
ms
=
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
+
1j
*
(
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
)
ms
=
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
+
1j
*
(
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
)
vis
=
bl
.
ms2vis
(
ms
,
idx
)
vis
=
bl
.
ms2vis
(
ms
,
idx
)
...
...
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