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
Simon Perkins
ducc
Commits
a2311484
Commit
a2311484
authored
Mar 02, 2020
by
Martin Reinecke
Browse files
improvements
parent
37b7ef49
Changes
3
Hide whitespace changes
Inline
Side-by-side
interpol_ng/demo.py
View file @
a2311484
...
...
@@ -2,6 +2,7 @@ import interpol_ng
import
numpy
as
np
import
pysharp
import
time
import
matplotlib.pyplot
as
plt
np
.
random
.
seed
(
42
)
...
...
@@ -32,10 +33,14 @@ slmT[0:lmax+1].imag = 0.
blmT
=
deltabeam
(
lmax
,
kmax
)
t0
=
time
.
time
()
# build interpolator object for slmT and blmT
foo
=
interpol_ng
.
PyInterpolator
(
slmT
,
blmT
,
lmax
,
kmax
,
epsilon
=
1e-6
,
nthreads
=
2
)
print
(
"setup time: "
,
time
.
time
()
-
t0
)
# evaluate total convolution on a sufficiently resolved Gauss-Legendre grid
# assemble a set of (theta, phi, psi) pointings, at which we want to evaluate
# the interpolated signal.
# For testig purposes, we choose theta and phi such that they form a
# Gauss-Legendre grid of sufficient resolution to recover the input a_lm
nth
=
lmax
+
1
nph
=
2
*
mmax
+
1
ptg
=
np
.
zeros
((
nth
,
nph
,
3
))
...
...
@@ -45,17 +50,17 @@ ptg[:,:,0] = th.reshape((-1,1))
ptg
[:,:,
1
]
=
(
2
*
np
.
pi
*
np
.
arange
(
nph
)
/
nph
).
reshape
((
1
,
-
1
))
ptg
[:,:,
2
]
=
0
t0
=
time
.
time
()
# do the actual interpolation
bar
=
foo
.
interpol
(
ptg
.
reshape
((
-
1
,
3
))).
reshape
((
nth
,
nph
))
print
(
"interpolation time: "
,
time
.
time
()
-
t0
)
# get a_lm back from interpolat
ed array
# get a_lm back from interpolat
ion results
job
=
pysharp
.
sharpjob_d
()
job
.
set_triangular_alm_info
(
lmax
,
mmax
)
job
.
set_gauss_geometry
(
nth
,
nph
)
alm2
=
job
.
map2alm
(
bar
.
reshape
((
-
1
,)))
#compare with original a_lm
import
matplotlib.pyplot
as
plt
plt
.
plot
(
np
.
abs
(
alm2
-
slmT
))
plt
.
suptitle
(
"Deviations between original and reconstructed a_lm"
)
plt
.
show
()
interpol_ng/setup.py
View file @
a2311484
...
...
@@ -73,7 +73,7 @@ def get_extension_modules():
setup
(
name
=
'interpol_ng'
,
version
=
'0.0.1'
,
description
=
'Python bindings for
some libsharp func
tion
a
li
t
y'
,
description
=
'Python bindings for
total convolution and interpola
tion
li
brar
y'
,
include_package_data
=
True
,
author
=
'Martin Reinecke'
,
author_email
=
'martin@mpa-garching.mpg.de'
,
...
...
src/mr_util/math/es_kernel.h
View file @
a2311484
...
...
@@ -36,6 +36,8 @@ namespace detail_es_kernel {
using
namespace
std
;
/* This class implements the "exponential of semicircle" gridding kernel
described in https://arxiv.org/abs/1808.06736 */
class
ES_Kernel
{
private:
...
...
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