[Yt-dev] Namespace Issue

Matthew Turk matthewturk at gmail.com
Fri Jun 4 11:12:46 PDT 2010


Hi Stephen,

This looks more like a Python in general issue.  When you import a
module, you are not creating a copy of it.  This seems to be a problem
with the type of kD-tree created; it looks like it's a static object,
rather than an instance or an array or whatever.  Modules are
singletons, so when you update a property of that singleton, it
updates it everywhere -- this is doubly true for shared-library
extensions, which cannot be reloaded.

I thought that one of the advantages of the Forthon kD-tree was that
the memory was allocated in Python space and operated on by Fortran,
rather than allocated in Fortran space and also operated on in
Fortran?

-Matt

On Fri, Jun 4, 2010 at 11:06 AM, Stephen Skory <stephenskory at yahoo.com> wrote:
> Hi All,
>
> I am attempting to formulate an example method of using my Two Point Functions (née Structure Function Generator) stuff for two point correlations of halos. This means that I want the ability to have multiple Fortran kd trees active at once. However, I think I am running into a namespace issue of Python. See below:
>
> In [1]: import yt.extensions.kdtree as One
>
> In [2]: One.fKD.pos = na.random.random((3,100))
>
> In [3]: One.fKD.pos.shape
> Out[3]: (3, 100)
>
> In [5]: import yt.extensions.kdtree as Two
>
> In [6]: Two.fKD.pos = na.random.random((3,200))
>
> In [7]: Two.fKD.pos.shape
> Out[7]: (3, 200)
>
> In [8]: One.fKD.pos.shape
> Out[8]: (3, 200)
>
> (In [4] was a typo) This isn't just a Forthon issue:
>
> In [1]: import numpy as na
>
> In [2]: na.NaN
> Out[2]: nan
>
> In [3]: na.NaN = 8
>
> In [4]: na.NaN
> Out[4]: 8
>
> In [5]: import numpy as np
>
> In [6]: np.NaN
> Out[6]: 8
>
>
> I want np.NaN==NaN, not 8. Does anyone know of a way around this?
>
> Thanks!
>
>  _______________________________________________________
> sskory at physics.ucsd.edu           o__  Stephen Skory
> http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student
> ________________________________(_)_\(_)_______________
>
> _______________________________________________
> Yt-dev mailing list
> Yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>



More information about the yt-dev mailing list