[yt-users] changing units for data in a projection container
Ricarda Beckmann
ricarda.beckmann at astro.ox.ac.uk
Thu Jun 11 15:24:22 PDT 2015
Hi Phil,
I tried to answer your question yesterday but maybe you didn’t get my answer. Let’s try this again, here is the message I wrote last night:
Hi Phil,
I think you were almost there. Instead of changing the units of the plot, change them once you have the frb:
ds=yt.load(…)
prj=ds.proj(‘density’,2)
frb=prj.to_frb((10,’pc’),(1024,1024))
#now, instead of changing directly to a numpy array, first extract the field and change the units
dens=frb[‘density’] #For me, this comes out in g/cm**2 already
dens=dens.in_units(‘kg/m**2’) #here you can change the units to anything you want. Or just skip it if you are happy with g/cm**2
surfdens=np.array(dens) #and here is the plotable array, in the right units.
I hope this helped,
Ricarda
> On 10 Jun 2015, at 19:11, mc knabbits <elknabbits at googlemail.com> wrote:
>
> hi,
> I have the simple problem that I cant figure out how to change the units for data within a YTQuadTreeProjBase. so I'm stuck with code units all along. heres my script part:
>
>
> ds = yt.load(some ramses data)
>
> prj = ds.proj("Density", 2)
> prj.apply_units(arr,'g/cm**2') #maybe it's all because I dont know what to put in for "arr"
>
> frb=prj.to_frb((10,'pc'),(1024,1024))
> surfdense=np.array(frb[density])
>
>
>
> as you can see the unit I need is g/cm**2 but the method applied above dont work!?
>
> thanx for your help
>
> phil
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150611/8e4947e0/attachment.htm>
More information about the yt-users
mailing list