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
0b5cbdf1
Commit
0b5cbdf1
authored
Aug 19, 2019
by
Martin Reinecke
Browse files
Merge remote-tracking branch 'origin/master' into more_weights
parents
e501d680
17f8b827
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty_gridder.cc
View file @
0b5cbdf1
...
...
@@ -423,7 +423,7 @@ template<typename T> class Baselines
The visibility data for the index array
)"""
;
pyarr_c
<
T
>
ind2
effectiveuvw
(
const
pyarr_c
<
uint32_t
>
&
idx_
)
const
pyarr_c
<
T
>
effectiveuvw
(
const
pyarr_c
<
uint32_t
>
&
idx_
)
const
{
checkArray
(
idx_
,
"idx"
,
{
0
});
size_t
nvis
=
size_t
(
idx_
.
shape
(
0
));
...
...
@@ -1477,7 +1477,7 @@ PYBIND11_MODULE(nifty_gridder, m)
.
def
(
"Nchannels"
,
&
Baselines
<
double
>::
Nchannels
)
.
def
(
"ms2vis"
,
&
Baselines
<
double
>::
ms2vis
<
complex
<
double
>>
,
Baselines
<
double
>::
ms2vis_DS
,
"ms"
_a
,
"idx"
_a
)
.
def
(
"
ind2
effectiveuvw"
,
&
Baselines
<
double
>::
ind2
effectiveuvw
,
"idx"
_a
)
.
def
(
"effectiveuvw"
,
&
Baselines
<
double
>::
effectiveuvw
,
"idx"
_a
)
.
def
(
"vis2ms"
,
&
Baselines
<
double
>::
vis2ms
<
complex
<
double
>>
,
Baselines
<
double
>::
vis2ms_DS
,
"vis"
_a
,
"idx"
_a
,
"ms_in"
_a
=
None
);
py
::
class_
<
GridderConfig
<
double
>>
(
m
,
"GridderConfig"
,
GridderConfig_DS
)
...
...
profile.py
deleted
100644 → 0
View file @
e501d680
import
nifty_gridder
as
ng
from
time
import
time
import
numpy
as
np
def
_wscreen
(
npix
,
dst
,
w
):
dc
=
(
np
.
linspace
(
start
=-
npix
/
2
,
stop
=
npix
/
2
-
1
,
num
=
npix
)
*
dst
)
**
2
ls
=
np
.
broadcast_to
(
dc
,
(
dc
.
shape
[
0
],)
*
2
)
theta
=
np
.
sqrt
(
ls
+
ls
.
T
)
n
=
np
.
cos
(
theta
)
wscreen
=
np
.
exp
(
2
*
np
.
pi
*
1j
*
w
*
(
n
-
1
))
/
n
return
wscreen
def
time_op
(
func
,
x
,
ntries
=
5
):
t0
=
time
()
for
ii
in
range
(
ntries
):
print
(
ii
)
func
(
x
)
return
(
time
()
-
t0
)
/
ntries
if
__name__
==
'__main__'
:
ng
.
set_nthreads
(
4
)
ntries
=
20
nx
=
2048
dx
=
12
w
=
1000.2
ny
,
dy
=
nx
,
dx
conf
=
ng
.
GridderConfig
(
nx
,
ny
,
1e-7
,
dx
,
dy
)
x
,
y
=
conf
.
Nxdirty
(),
conf
.
Nydirty
()
fld
=
np
.
random
.
randn
(
x
,
y
)
+
1j
*
np
.
random
.
randn
(
x
,
y
)
func0
=
lambda
x
:
_wscreen
(
nx
,
dy
,
w
).
conjugate
()
*
x
func1
=
lambda
x
:
conf
.
apply_wscreen
(
x
,
w
,
True
)
print
(
time_op
(
func0
,
fld
),
time_op
(
func1
,
fld
))
fld
=
np
.
random
.
randn
(
nx
,
ny
)
func0
=
lambda
x
:
_wscreen
(
nx
,
dx
,
w
)
*
x
.
real
func1
=
lambda
x
:
conf
.
apply_wscreen
(
x
,
w
,
False
)
print
(
time_op
(
func0
,
fld
),
time_op
(
func1
,
fld
))
Write
Preview
Supports
Markdown
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