[Yt-dev] Hierarchy optimization

Matthew Turk matthewturk at gmail.com
Tue Sep 1 14:20:05 PDT 2009


Hi Jennifer,

You're underflowing the floating point precision -- (10^-27)^2 breaks
32-bit precision.  Unfortunately, if you run with 32-bit precision,
data fields obtained from the CPU files are not promoted to 64-bit
precision.  We might be able to hack something like this in if we cast
the conversion factors to 64-bits.  That's what's happening with the
Pressure field, because Pressure is a derived field defined by yt, and
so when you add it it's replacing the function but not the conversion
factor.

Cast the first data["Density"] to float64 with .astype("float64") and
it should work.  Be sure to delete your .yt files to ensure you're
making new projections!  :)

Best of luck, and let us know if this doesn't work,

Matt

PS This is really better suited to the yt-users list.  I think it
would also be very helpful if we could keep the subject line and
thread information relevant to the new question -- maybe it'd be
better if you started a new thread for new questions and problems.

On Tue, Sep 1, 2009 at 1:51 PM, Jennifer Jones<westbr39 at msu.edu> wrote:
> I have a coding question:
>
> If my code reads:
> from yt.mods import *
>
> pf =
> load("/Users/Jennifer/work/little_galcluster_highres_crs/RD0031/RD0031")
> pc = PlotCollection(pf)
>
>
>
> def Press(field, data):
>    densq= (data["Density"]*data["Density"])
>    return densq
> add_field("Press", function=Press, units=r"\rm{g}/\rm{cm}^{2}")
>
>
> pc.add_projection("Press",0)
> print pc.save("test1")
>
> It fails.
>
> But if there is "Pressure" in place of ever "press" it works.  What is the
> reason for that to occur?
>
> Thanks,
> Jennifer
>
> P.S. yes I am aware that this is not actually creating pressure.
> _______________________________________________
> 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