Hi, http://drop.io/Dark_Matter_Density In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly. How can I correct "M" and "D" ? Here is the script I am using... from yt.mods import * fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region") pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf) Shankar
Hi, try the LaTex syntax: p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) Jean-Claude Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi, nope. It gives a syntax error. Traceback (most recent call last): File "1.py", line 12, in <module> p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) KeyError: 'Dark\\_Matter\\_Density' Shankar -----Original Message----- From: yt-users-bounces@lists.spacepope.org on behalf of Jean-Claude Passy Sent: Tue 3/30/2010 10:40 AM To: Discussion of the yt analysis package Subject: Re: [yt-users] Labels on plot Hi, try the LaTex syntax: p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) Jean-Claude Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Shankar, Jean-Claude,
This is a wart in the code. I think Jeff Oishi is going to take a
whack at fixing it broadly today, but here's a quick hotfix.
Jean-Claude's right, it should be LaTeX-style syntax (with some
caveats.) The trick is that the field name stays the same, but you
apply a label afterward:
p = pc.add_projection("Dark_Matter_Density",0)
p.set_label("Dark Matter Density")
Note that this will not have the "Dark Matter Density" rendered in a
LaTeX (mathtext is the actual name) font. To do that, you specify it
inside $'s:
p.set_label(r"$\mathrm{Dark}\/\mathrm{Matter}\/\mathrm{Density}$")
Note here that we have to put our roman text inside "\mathrm{}" calls,
and we have to explicitly escape the spaces with "\/". Additionally,
we make it a "raw" string, which means all special characters are
unescaped -- that's what the preceding "r" is.
Also, if you are *adding* a field, you can specify a "display_name" (
http://yt.enzotools.org/doc/howto/creating_derived_fields.html#field-options
) that will be used instead. For many fields, this is in the code,
but evidently Dark_Matter_Density is not specified -- which is why it
tries to render the field name.
Hope that helps!
-Matt
On Tue, Mar 30, 2010 at 8:49 AM, Agarwal, Shankar
Hi,
nope. It gives a syntax error.
Traceback (most recent call last): File "1.py", line 12, in <module> p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) KeyError: 'Dark\\_Matter\\_Density'
Shankar
-----Original Message----- From: yt-users-bounces@lists.spacepope.org on behalf of Jean-Claude Passy Sent: Tue 3/30/2010 10:40 AM To: Discussion of the yt analysis package Subject: Re: [yt-users] Labels on plot
Hi,
try the LaTex syntax:
p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1)
Jean-Claude
Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi, uhhhh I am stupid. "Dark_Matter_Density" is actually your key, not the label... So yes, keep it that way. The error seems to come from an error in yt which generates automatically a label. May be there is a way to force yt to use a certain label ? JC Agarwal, Shankar a écrit :
Hi,
nope. It gives a syntax error.
Traceback (most recent call last): File "1.py", line 12, in <module> p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) KeyError: 'Dark\\_Matter\\_Density'
Shankar
-----Original Message----- From: yt-users-bounces@lists.spacepope.org on behalf of Jean-Claude Passy Sent: Tue 3/30/2010 10:40 AM To: Discussion of the yt analysis package Subject: Re: [yt-users] Labels on plot
Hi,
try the LaTex syntax:
p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1)
Jean-Claude
Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi, uhhhh I am stupid. "Dark_Matter_Density" is actually your key, not the label... So yes, keep it that way. The error seems to come from an error in yt which generates automatically a label - with lower case letters in your case. May be there is a way to force yt to use a certain label ? JC Agarwal, Shankar a écrit :
Hi,
nope. It gives a syntax error.
Traceback (most recent call last): File "1.py", line 12, in <module> p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) KeyError: 'Dark\\_Matter\\_Density'
Shankar
-----Original Message----- From: yt-users-bounces@lists.spacepope.org on behalf of Jean-Claude Passy Sent: Tue 3/30/2010 10:40 AM To: Discussion of the yt analysis package Subject: Re: [yt-users] Labels on plot
Hi,
try the LaTex syntax:
p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1)
Jean-Claude
Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Here you go ! Thanks Matt, JC Matthew Turk a écrit :
Hi Shankar, Jean-Claude,
This is a wart in the code. I think Jeff Oishi is going to take a whack at fixing it broadly today, but here's a quick hotfix.
Jean-Claude's right, it should be LaTeX-style syntax (with some caveats.) The trick is that the field name stays the same, but you apply a label afterward:
p = pc.add_projection("Dark_Matter_Density",0) p.set_label("Dark Matter Density")
Note that this will not have the "Dark Matter Density" rendered in a LaTeX (mathtext is the actual name) font. To do that, you specify it inside $'s:
p.set_label(r"$\mathrm{Dark}\/\mathrm{Matter}\/\mathrm{Density}$")
Note here that we have to put our roman text inside "\mathrm{}" calls, and we have to explicitly escape the spaces with "\/". Additionally, we make it a "raw" string, which means all special characters are unescaped -- that's what the preceding "r" is.
Also, if you are *adding* a field, you can specify a "display_name" ( http://yt.enzotools.org/doc/howto/creating_derived_fields.html#field-options ) that will be used instead. For many fields, this is in the code, but evidently Dark_Matter_Density is not specified -- which is why it tries to render the field name.
Hope that helps!
-Matt
On Tue, Mar 30, 2010 at 8:49 AM, Agarwal, Shankar
wrote: Hi,
nope. It gives a syntax error.
Traceback (most recent call last): File "1.py", line 12, in <module> p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1) KeyError: 'Dark\\_Matter\\_Density'
Shankar
-----Original Message----- From: yt-users-bounces@lists.spacepope.org on behalf of Jean-Claude Passy Sent: Tue 3/30/2010 10:40 AM To: Discussion of the yt analysis package Subject: Re: [yt-users] Labels on plot
Hi,
try the LaTex syntax:
p = pc.add_projection("Dark\_Matter\_Density", 0, source=reg1)
Jean-Claude
Agarwal, Shankar a écrit :
Hi,
http://drop.io/Dark_Matter_Density
In the above plot, the label is Dark_Matter_Density. But the "M" in matter and "D" in Density do not print correctly.
How can I correct "M" and "D" ?
Here is the script I am using...
from yt.mods import *
fn = "RedshiftOutput0001" pf = load(fn) reg = pf.h.region([0.5, 0.5, 0.5], [0.45, 0.0, 0.0], [0.55, 1.0, 1.0]) pf.h.save_object(reg, "region") reg1 = pf.h.load_object("region")
pc = PlotCollection(pf,center=[0.5, 0.5, 0.5]) p = pc.add_projection("Dark_Matter_Density", 0, source=reg1) p.set_zlim(1e-8, 5e-3) pc.save("%s" % pf)
Shankar _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Shankar, This has been fixed in yt 1.6 and in trunk. It should properly display now. Please update and let me know if there are any problems. j
participants (4)
-
Agarwal, Shankar
-
j s oishi
-
Jean-Claude Passy
-
Matthew Turk