Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dagss/healpix4py
base: 9a730266a1
...
head fork: dagss/healpix4py
compare: db74e651f8
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
9 healpix/healpix_wrapper.f90
@@ -115,6 +115,15 @@ subroutine cywrap_vec2pix_ring(nside, vector, ipix)
call vec2pix_ring(nside, vector, ipix)
end subroutine cywrap_vec2pix_ring
+ subroutine cywrap_pix2ang_ring(nside, ipix, theta, phi)
+ use healpix_types
+ use pix_tools
+ INTEGER(KIND=I4B), INTENT(IN) :: nside
+ INTEGER(KIND=I4B), INTENT(IN) :: ipix
+ REAL(KIND=DP), INTENT(OUT) :: theta, phi
+ call pix2ang_ring(nside, ipix, theta, phi)
+ end subroutine cywrap_pix2ang_ring
+
subroutine cywrap_sub_udgrade_nest_d(map_in, nside_in, map_out, nside_out)
use healpix_types
use udgrade_nr
View
34 healpix/lib.pyx
@@ -53,8 +53,9 @@ cdef extern:
void cywrap_pix2vec_nest_(i4b* nside, i4b* ipix, double* vector)
void cywrap_pix2vec_ring_(i4b* nside, i4b* ipix, double* vector)
- void cywrap_vec2pix_ring_(i4b* nside, double* vector, i4b* ipix)
-
+ void cywrap_vec2pix_ring_(i4b* nside, double* vector, i4b* ipix)
+ void cywrap_pix2ang_ring_(i4b* nside, i4b* ipix, double *theta, double *phi)
+
void cywrap_alm2map_sc_d_(
i4b* nsmax,
i4b* nlmax,
@@ -273,7 +274,6 @@ def pix2vec_ring(nside, ipix):
cdef i4b nside_val, ipix_val
cdef double* vector
cdef np.flatiter out_it = np.PyArray_IterAllButAxis(out, &vecaxis)
- import sys
assert out.strides[vecaxis] == sizeof(double)
while np.PyArray_ITER_NOTDONE(out_it):
nside_val = (<i4b*>np.PyArray_MultiIter_DATA(input_it, 0))[0]
@@ -289,6 +289,32 @@ def pix2vec_ring(nside, ipix):
assert not np.PyArray_MultiIter_NOTDONE(input_it)
return out
+def pix2ang_ring(nside, ipix):
+ nside = np.asarray(nside, np.int32)
+ ipix = np.asarray(ipix, np.int32)
+ cdef np.broadcast input_it = np.broadcast(nside, ipix)
+ out_shape = (<object>input_it).shape + (2,)
+ out = np.empty(out_shape, dtype=np.double)
+ cdef int vecaxis = len(out_shape) - 1
+ cdef i4b nside_val, ipix_val
+ cdef double* vector
+ cdef np.flatiter out_it = np.PyArray_IterAllButAxis(out, &vecaxis)
+ assert out.strides[vecaxis] == sizeof(double)
+ while np.PyArray_ITER_NOTDONE(out_it):
+ nside_val = (<i4b*>np.PyArray_MultiIter_DATA(input_it, 0))[0]
+ ipix_val = (<i4b*>np.PyArray_MultiIter_DATA(input_it, 1))[0]
+ if ipix_val >= nside2npix(nside_val):
+ raise ValueError("ipix too large")
+ theta_phi = <double*>np.PyArray_ITER_DATA(out_it)
+
+ cywrap_pix2ang_ring_(&nside_val, &ipix_val, &theta_phi[0],
+ &theta_phi[1])
+
+ np.PyArray_ITER_NEXT(out_it)
+ np.PyArray_MultiIter_NEXT(input_it)
+ assert not np.PyArray_MultiIter_NOTDONE(input_it)
+ return out
+
def vec2pix_ring(i4b nside, np.ndarray[double, ndim=2] vecs):
"""
>>> vec2pix_ring(16, (-0.19915651, -0.03961469, 0.97916667))
@@ -391,8 +417,6 @@ def rotate_alm_d(i4b lmax, np.ndarray[np.complex128_t, ndim=3, mode='fortran'] a
double psi, double theta, double phi):
cdef i4b i, j, k
i, j, k = alm.shape[0], alm.shape[1], alm.shape[2]
- if single is None:
- single = False
with nogil:
cywrap_rotate_alm_d_(&lmax, <double*>alm.data, &psi, &theta, &phi, &i, &j, &k)
View
64 tools/inplace.py
@@ -0,0 +1,64 @@
+"""
+waf tool for supporting in-place install, in particular useful for
+Python projects.
+
+By passing --inplace to 'waf configure', the behaviour of 'waf install'
+is changed:
+
+ - Python extensions are dropped directly to the source
+ tree.
+ - Other shared libraries are put in a 'lib' directory in the project dir
+ - rpath is set up for all shared libraries to contain the 'lib' directory
+ in the project dir, using the ${ORIGIN} feature of modern ld.so.
+
+BUGS:
+
+This may only work on Linux? Should probe for success of ${ORIGIN} in
+rpath and use an absolute path otherwise. And I have no idea about
+Windows.
+"""
+
+import os
+from waflib.Configure import conf
+from waflib.TaskGen import after_method, before_method, feature, taskgen_method, extension
+
+@feature('cshlib', 'fcshlib', 'pyext')
+@after_method('process_source')
+@before_method('propagate_uselib_vars', 'apply_link', 'init_pyext')
+def apply_inplace_install_path_shlib(self):
+ if self.env['INPLACE_INSTALL'] and not getattr(self, 'install_path', None):
+ if 'pyext' in self.features:
+ # Scan sources for likely position of extension source
+ # For now, just take Cython source -- not sure how to deal with C extensions
+ # which can have multiple C suffixes
+ package_node = None
+ for x in self.source:
+ if x.suffix() == '.pyx':
+ package_node = x.parent
+ break
+ else:
+ raise AssertionError("Python extension does not have an associated .pyx file")
+ self.install_path = package_node.get_src().abspath()
+
+ lib_path = self.bld.srcnode.make_node('lib')
+ if not getattr(self, 'rpath', None):
+ self.rpath = os.path.join('${ORIGIN}', lib_path.path_from(package_node))
+ else:
+ self.install_path = self.bld.srcnode.make_node('lib').abspath()
+ if not getattr(self, 'rpath', None):
+ self.rpath = '${ORIGIN}'
+
+@feature('cprogram')
+@before_method('process_source')
+def apply_inplace_install_path_cprogram(self):
+ self.install_path = self.bld.srcnode.make_node('bin').abspath()
+ self.rpath = '${ORIGIN}/../lib'
+
+def options(self):
+ self.add_option('--inplace', action='store_true',
+ help='"install" command installs to the project directory')
+
+def configure(self):
+ if self.options.inplace:
+ self.env['INPLACE_INSTALL'] = True
+
View
2  wscript
@@ -15,6 +15,7 @@ def options(ctx):
ctx.load('compiler_c')
ctx.load('compiler_fc')
ctx.load('python')
+ ctx.load('inplace', tooldir='tools')
def configure(ctx):
ctx.load('compiler_c')
@@ -29,6 +30,7 @@ def configure(ctx):
ctx.check_python_module('numpy')
ctx.check_numpy_version(minver=(1,3))
ctx.get_numpy_includes()
+ ctx.check_tool('inplace', tooldir='tools')
ctx.find_program('cython', var='CYTHON')
ctx.check_cython_version(minver=(0,11,1))

No commit comments for this range

Something went wrong with that request. Please try again.