diff --git a/python/_project.pyx b/python/_project.pyx index 4b1d1dd..9d61cec 100644 --- a/python/_project.pyx +++ b/python/_project.pyx @@ -874,11 +874,11 @@ def spherical_projection(int Nside, job_done = view.array(shape=(N,), format="i", itemsize=sizeof(int)) job_done[:] = 0 theta,phi = hp.pix2ang(Nside, np.arange(N0)) - if True:#nogil, parallel(): + with nogil, parallel(): tid = smp_get_thread_id() - for i in range(N0):#prange(N0,schedule='dynamic',chunksize=256): + for i in prange(N0,schedule='dynamic',chunksize=256): if progress != 0 and (i%booster) == 0: -# with gil: + with gil: p.update(_mysum(job_done)) outm[i] = _spherical_projloop(theta[i], phi[i], density_view, min_distance, max_distance, shifter, integrator_id) job_done[tid] += 1 diff --git a/python/cosmotool/ctpv.py b/python/cosmotool/ctpv.py index 9aa8c11..22a9d22 100644 --- a/python/cosmotool/ctpv.py +++ b/python/cosmotool/ctpv.py @@ -4,7 +4,7 @@ from contextlib import contextmanager class ProgrammableParticleLoad(object): @staticmethod - def main_script(source, particles, aname="default"): + def main_script(source, particles, aname="default", aux=None): import vtk from vtk.util import numpy_support as ns @@ -20,6 +20,15 @@ class ProgrammableParticleLoad(object): out.Allocate(1,1) out.SetPoints(vv) + if aux is not None: + for n,a in aux: + a_vtk = ns.numpy_to_vtk( + np.ascontiguousarray(a.astype(np.float64) + ), + deep=1) + a_vtk.SetName(n) + out.GetPointData().AddArray(a_vtk) + out.InsertNextCell(vtk.VTK_VERTEX, particles.shape[0], range(particles.shape[0])) @staticmethod