
Hi all,
I need to get radial profiles of my sims - like density as a function or radius. I know how to plot them using the method pc.add_profile_sphere but I now need to print out the values in a txt file. For this reason, I tried to use the class BinnedProfile1D. Below is my script:
##################################
file = 'DD0000/CommonEnvelope0021'
pf = load(file)
r_min = pf.h.get_smallest_dx()
r_max = 0.4
sphere = pf.h.sphere([0.5, 0.5, 0.5], r_max)
prof1d = L.BinnedProfile1D(sphere, 32, "Radius", r_min, r_max,log_space=False, lazy_reader=True)
prof1d.add_fields("Density")
prof1d.write_out('test.txt','%0.6e','left')
##################################
It run well but returned a density profile equal to 0:
##############################
[17:25:54] litai05:$ more test.txt
# Radius Density
7.812500e-03 0.000000e+00
2.006836e-02 0.000000e+00
3.232422e-02 0.000000e+00
4.458008e-02 0.000000e+00
5.683594e-02 0.000000e+00
6.909180e-02 0.000000e+00
8.134766e-02 0.000000e+00
9.360352e-02 0.000000e+00
1.058594e-01 0.000000e+00
1.181152e-01 0.000000e+00
1.303711e-01 0.000000e+00
1.426270e-01 0.000000e+00
1.548828e-01 0.000000e+00
1.671387e-01 0.000000e+00
1.793945e-01 0.000000e+00
1.916504e-01 0.000000e+00
2.039063e-01 0.000000e+00
2.161621e-01 0.000000e+00
2.284180e-01 0.000000e+00
2.406738e-01 0.000000e+00
2.529297e-01 0.000000e+00
2.651855e-01 0.000000e+00
2.774414e-01 0.000000e+00
2.896973e-01 0.000000e+00
3.019531e-01 0.000000e+00
3.142090e-01 0.000000e+00
3.264648e-01 0.000000e+00
3.387207e-01 0.000000e+00
3.509766e-01 0.000000e+00
3.632324e-01 0.000000e+00
3.754883e-01 0.000000e+00
3.877441e-01 0.000000e+00
##############################
Could someone tell me what I am doing wrong ?
Thanks,
JC

Hi JC,
Radius is in cm:
http://yt.enzotools.org/doc/api/field_list.html#radius
You might try RadiusCode, though, for what you're looking for.
-Matt
On Fri, Sep 3, 2010 at 5:35 PM, Jean-Claude Passy jcpassy@gmail.com wrote:
Hi all,
I need to get radial profiles of my sims - like density as a function or radius. I know how to plot them using the method pc.add_profile_sphere but I now need to print out the values in a txt file. For this reason, I tried to use the class BinnedProfile1D. Below is my script:
################################## file = 'DD0000/CommonEnvelope0021' pf = load(file) r_min = pf.h.get_smallest_dx() r_max = 0.4 sphere = pf.h.sphere([0.5, 0.5, 0.5], r_max) prof1d = L.BinnedProfile1D(sphere, 32, "Radius", r_min, r_max,log_space=False, lazy_reader=True) prof1d.add_fields("Density") prof1d.write_out('test.txt','%0.6e','left') ################################## It run well but returned a density profile equal to 0:
############################## [17:25:54] litai05:$ more test.txt # Radius Density 7.812500e-03 0.000000e+00 2.006836e-02 0.000000e+00 3.232422e-02 0.000000e+00 4.458008e-02 0.000000e+00 5.683594e-02 0.000000e+00 6.909180e-02 0.000000e+00 8.134766e-02 0.000000e+00 9.360352e-02 0.000000e+00 1.058594e-01 0.000000e+00 1.181152e-01 0.000000e+00 1.303711e-01 0.000000e+00 1.426270e-01 0.000000e+00 1.548828e-01 0.000000e+00 1.671387e-01 0.000000e+00 1.793945e-01 0.000000e+00 1.916504e-01 0.000000e+00 2.039063e-01 0.000000e+00 2.161621e-01 0.000000e+00 2.284180e-01 0.000000e+00 2.406738e-01 0.000000e+00 2.529297e-01 0.000000e+00 2.651855e-01 0.000000e+00 2.774414e-01 0.000000e+00 2.896973e-01 0.000000e+00 3.019531e-01 0.000000e+00 3.142090e-01 0.000000e+00 3.264648e-01 0.000000e+00 3.387207e-01 0.000000e+00 3.509766e-01 0.000000e+00 3.632324e-01 0.000000e+00 3.754883e-01 0.000000e+00 3.877441e-01 0.000000e+00 ############################## Could someone tell me what I am doing wrong ?
Thanks,
JC
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Jean-Claude Passy
-
Matthew Turk