[yt-users] segmentation fault while extract_obj

Matthew Turk matthewturk at gmail.com
Tue Aug 20 12:38:23 PDT 2013


Hi Luki,

Welcome to yt!  Sorry you're having trouble.

I was able to get it to work by adding this line:

surf["Density"]

just after surf=

I believe this is a genuine bug, as what I think is going on is that
the triangles are not getting created properly.  Once that line went
in, yt would go and walk the surface and create the vertices.  I don't
know why it's not doing that by default, so I have filed a bug to
ensure that it gets addressed:

https://bitbucket.org/yt_analysis/yt/issue/633/vertices-not-correctly-created-in-surface

You may also find it a bit nicer if you use "pf.h.all_data()" instead
of the sphere, as the sphere will cut off any data outside that
spherical region.  Anyway, try with the line surf["Density"] before
the export, and let us know if that works.

-Matt

On Tue, Aug 20, 2013 at 1:42 PM, Lucky Puspitarini
<lucky.puspitarini at gmail.com> wrote:
> Hello all,
>
> My name is Luki.
> I'm new in yt.
>
> I have a problem in extracting object from yt. I want to have the surface
> object in .obj or .ply file so then i can transform it to .u3d for 3d pdf
>
> I have a data cube that i build this way.
>
> from yt.mods import *
>
> from numpy import *
>
>
> myfile=loadtxt("3ddata_300_lowerres.txt")
>
> dens=myfile[:,3]
>
> densitycube=dens.reshape(61,61,61)
>
>
> mydata=dict(Density=densitycube)
>
> bbox=np.array([[-300,300],[-300,300],[-300,300]])
>
> pf=load_uniform_grid(mydata,densitycube.shape,3.08e18,bbox=bbox)
>
>
> Then, I would like to have a surface of certain value in my data and extract
> it to .obj files
>
>
> sp = pf.h.sphere("center", (250, "pc"))
>
> trans = 1.0
>
> distf = 3.08e18
>
> surf = pf.h.surface(sp, "Density", 0.0006)
>
> surf.export_obj("myism.obj", transparency=trans, dist_fac = distf)
>
>
> But i have a problem with segmentation fault.
>
> Segmentation fault: 11
>
> I'll also try export_ply but i have the same problem :(
>
> sp = pf.h.sphere("center", (250, "pc"))
>
> surf = pf.h.surface(sp, "Density", 0.0006)
>
> bounds = [(sp.center[i] - 125.0/pf['pc'],sp.center[i] + 125.0/pf['pc']) for
> i in range(3)]
>
> surf.export_ply("myism.ply",bounds=bounds)
>
>
> Can you help me?
>
> Thankyou in advance
>
> Best regards,
> luki
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list