
Hi yt gurus, I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap? thanks! Munier I've attached an image of what gets plotted, and the relevant bits of my script are: *from yt.mods import ** * * *fName = "DD0006/test_sim_0006"* *var = "star_density"* *axis = 0* * * *pf = load(fName)* *pf.h* * * *pc = PlotCollection(pf)* *p = pc.add_projection(var,axis)* *#p.modify["particles"](1.0)* * * *radius = .02;* * * *pc.set_xlim(.5-radius,.5+radius)* *pc.set_ylim(.5-radius,.5+radius)* * * *pc.save(fName)* -- Munier A. Salem // 845.489.6450

Hi Munier, I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar. I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here: http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t... Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection object by hand, extract the raw image buffer using an FRB, and then make the plot manually using matplotlib. There's an example in the yt docs that covers how to do this: http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%... In the latter case if you want the areas that project to zero to appear with a logarithmic colorbar, you'll need to manually set the regions in the FRB that are equal to zero to some small number. Cheers, Nathan On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
from yt.mods import *
fName = "DD0006/test_sim_0006" var = "star_density" axis = 0
pf = load(fName) pf.h
pc = PlotCollection(pf) p = pc.add_projection(var,axis) #p.modify["particles"](1.0)
radius = .02;
pc.set_xlim(.5-radius,.5+radius) pc.set_ylim(.5-radius,.5+radius)
pc.save(fName)
-- Munier A. Salem // 845.489.6450 <test_sim_0006_Projection_x_star_density.png>_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Nathan, Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command: *frb = proj.to_frb(width, res, center=c)* I get the error *Traceback (most recent call last):* * File "smllPlt.py", line 16, in <module>* * frb = proj.to_frb(width,res)* *AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'* I tried updating my version of yt and deleting any .yt files, but the error stuck. best, Munier On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum <nathan12343@gmail.com>wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here: http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t...
Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection object by hand, extract the raw image buffer using an FRB, and then make the plot manually using matplotlib. There's an example in the yt docs that covers how to do this: http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%...
In the latter case if you want the areas that project to zero to appear with a logarithmic colorbar, you'll need to manually set the regions in the FRB that are equal to zero to some small number.
Cheers,
Nathan
On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
*from yt.mods import ** * * *fName = "DD0006/test_sim_0006"* *var = "star_density"* *axis = 0* * * *pf = load(fName)* *pf.h* * * *pc = PlotCollection(pf)* *p = pc.add_projection(var,axis)* *#p.modify["particles"](1.0)* * * *radius = .02;* * * *pc.set_xlim(.5-radius,.5+radius)* *pc.set_ylim(.5-radius,.5+radius)* * * *pc.save(fName)*
-- Munier A. Salem // 845.489.6450 <test_sim_0006_Projection_x_star_density.png> _______________________________________________ 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
-- Munier A. Salem // 845.489.6450

Hi Munier, That's weird, it should be in there. What's the output of "yt instinfo", particularly the hash? -Matt On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Nathan,
Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command:
frb = proj.to_frb(width, res, center=c)
I get the error
Traceback (most recent call last): File "smllPlt.py", line 16, in <module> frb = proj.to_frb(width,res) AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
I tried updating my version of yt and deleting any .yt files, but the error stuck.
best, Munier
On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here: http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t...
Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection object by hand, extract the raw image buffer using an FRB, and then make the plot manually using matplotlib. There's an example in the yt docs that covers how to do this: http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%...
In the latter case if you want the areas that project to zero to appear with a logarithmic colorbar, you'll need to manually set the regions in the FRB that are equal to zero to some small number.
Cheers,
Nathan
On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
from yt.mods import *
fName = "DD0006/test_sim_0006" var = "star_density" axis = 0
pf = load(fName) pf.h
pc = PlotCollection(pf) p = pc.add_projection(var,axis) #p.modify["particles"](1.0)
radius = .02;
pc.set_xlim(.5-radius,.5+radius) pc.set_ylim(.5-radius,.5+radius)
pc.save(fName)
-- Munier A. Salem // 845.489.6450
<test_sim_0006_Projection_x_star_density.png>_______________________________________________ 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
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Matt, The command (on ranger, btw) gives *yt module located at:* * /share/home/01686/msalem/yt-x86_64/src/yt-hg* * * *The current version of the code is:* * * *---* *6f3c1cf6960d (stable)* *---* * * *This installation CAN be automatically updated.* *Updated successfully.* On Wed, Nov 28, 2012 at 3:30 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Munier,
That's weird, it should be in there. What's the output of "yt instinfo", particularly the hash?
-Matt
Hi Nathan,
Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command:
frb = proj.to_frb(width, res, center=c)
I get the error
Traceback (most recent call last): File "smllPlt.py", line 16, in <module> frb = proj.to_frb(width,res) AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
I tried updating my version of yt and deleting any .yt files, but
error stuck.
best, Munier
On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these
regions
to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here:
http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t...
Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection
object by
hand, extract the raw image buffer using an FRB, and then make the plot manually using matplotlib. There's an example in the yt docs that covers how to do this:
http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%...
In the latter case if you want the areas that project to zero to appear with a logarithmic colorbar, you'll need to manually set the regions in
On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote: the the
FRB that are equal to zero to some small number.
Cheers,
Nathan
On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen
colormap. >> Is there a way to paint these areas to follow the colormap? >> >> thanks! >> Munier >> >> I've attached an image of what gets plotted, and the relevant bits of my >> script are: >> >> from yt.mods import * >> >> fName = "DD0006/test_sim_0006" >> var = "star_density" >> axis = 0 >> >> pf = load(fName) >> pf.h >> >> pc = PlotCollection(pf) >> p = pc.add_projection(var,axis) >> #p.modify["particles"](1.0) >> >> radius = .02; >> >> pc.set_xlim(.5-radius,.5+radius) >> pc.set_ylim(.5-radius,.5+radius) >> >> pc.save(fName) >> >> >> -- >> Munier A. Salem // 845.489.6450 >> >> <test_sim_0006_Projection_x_star_density.png>_______________________________________________ >> 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 >> > > > > -- > Munier A. Salem // 845.489.6450 > > _______________________________________________ > 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
-- Munier A. Salem // 845.489.6450

Hi Munier, Ah, my mistake -- to_frb was added in the development branch since our last release, which was in September. You can either update to the development branch (hg up -C yt ; python2.7 setup.py develop ) or used a FixedResolutioBuffer manually (super easy to do). -Matt On Wed, Nov 28, 2012 at 4:18 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Matt,
The command (on ranger, btw) gives
yt module located at: /share/home/01686/msalem/yt-x86_64/src/yt-hg
The current version of the code is:
--- 6f3c1cf6960d (stable) ---
This installation CAN be automatically updated. Updated successfully.
On Wed, Nov 28, 2012 at 3:30 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Munier,
That's weird, it should be in there. What's the output of "yt instinfo", particularly the hash?
-Matt
On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Nathan,
Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command:
frb = proj.to_frb(width, res, center=c)
I get the error
Traceback (most recent call last): File "smllPlt.py", line 16, in <module> frb = proj.to_frb(width,res) AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
I tried updating my version of yt and deleting any .yt files, but the error stuck.
best, Munier
On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here:
http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t...
Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection object by hand, extract the raw image buffer using an FRB, and then make the plot manually using matplotlib. There's an example in the yt docs that covers how to do this:
http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%...
In the latter case if you want the areas that project to zero to appear with a logarithmic colorbar, you'll need to manually set the regions in the FRB that are equal to zero to some small number.
Cheers,
Nathan
On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
from yt.mods import *
fName = "DD0006/test_sim_0006" var = "star_density" axis = 0
pf = load(fName) pf.h
pc = PlotCollection(pf) p = pc.add_projection(var,axis) #p.modify["particles"](1.0)
radius = .02;
pc.set_xlim(.5-radius,.5+radius) pc.set_ylim(.5-radius,.5+radius)
pc.save(fName)
-- Munier A. Salem // 845.489.6450
<test_sim_0006_Projection_x_star_density.png>_______________________________________________ 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
-- Munier A. Salem // 845.489.6450
_______________________________________________ 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
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Thanks Matt, Manually creating the buffer seems to work (though John's approach of setting colormap values seems like it might be cleaner). The commands I ended up using are below. Thanks again! Munier *from yt.mods import ** *import matplotlib.pyplot as plt* *from numpy import log10 as log* * * *fName = "DD0006/test_sim_0006"* *var = "star_density"* *axis = 0* * * *pf = load(fName)* *pf.h* *proj = pf.h.proj(axis,var)* * * *res = [ 1000 , 1000 ]* *c = 0.5* *hw = .02* * * *frb = FixedResolutionBuffer(proj,(c-hw,c+hw,c-hw,c+hw),res,antialias=False) * *plt.imshow( log(frb['star_density'] + 1E-5 ) )* *plt.savefig('tmp')* On Wed, Nov 28, 2012 at 4:23 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Munier,
Ah, my mistake -- to_frb was added in the development branch since our last release, which was in September. You can either update to the development branch (hg up -C yt ; python2.7 setup.py develop ) or used a FixedResolutioBuffer manually (super easy to do).
-Matt
Hi Matt,
The command (on ranger, btw) gives
yt module located at: /share/home/01686/msalem/yt-x86_64/src/yt-hg
The current version of the code is:
--- 6f3c1cf6960d (stable) ---
This installation CAN be automatically updated. Updated successfully.
On Wed, Nov 28, 2012 at 3:30 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Munier,
That's weird, it should be in there. What's the output of "yt instinfo", particularly the hash?
-Matt
On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Nathan,
Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command:
frb = proj.to_frb(width, res, center=c)
I get the error
Traceback (most recent call last): File "smllPlt.py", line 16, in <module> frb = proj.to_frb(width,res) AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
I tried updating my version of yt and deleting any .yt files,
but
the error stuck.
best, Munier
On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum < nathan12343@gmail.com> wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear colorbar. You can do this following the instructions here:
http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-t...
Another option would be to make the plot by hand using a FixedResolutionBuffer. In this case you would make the projection object by hand, extract the raw image buffer using an FRB, and then make the
On Wed, Nov 28, 2012 at 4:18 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote: plot
manually using matplotlib. There's an example in the yt docs that covers how to do this:
http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%...
In the latter case if you want the areas that project to zero to
appear
with a logarithmic colorbar, you'll need to manually set the regions in the FRB that are equal to zero to some small number.
Cheers,
Nathan
On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
from yt.mods import *
fName = "DD0006/test_sim_0006" var = "star_density" axis = 0
pf = load(fName) pf.h
pc = PlotCollection(pf) p = pc.add_projection(var,axis) #p.modify["particles"](1.0)
radius = .02;
pc.set_xlim(.5-radius,.5+radius) pc.set_ylim(.5-radius,.5+radius)
pc.save(fName)
-- Munier A. Salem // 845.489.6450
<test_sim_0006_Projection_x_star_density.png>_______________________________________________
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
-- Munier A. Salem // 845.489.6450
_______________________________________________ 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
-- Munier A. Salem // 845.489.6450
_______________________________________________ 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
-- Munier A. Salem // 845.489.6450

Hi All, Once again having a few issues with projecting star particle density (from enzo outputs of a galaxy simulation). For a typical run, I can successfully project the first few printouts, up until appreciable formation happens. Then, in the process of projecting, yt reaches the highest resolution grid and throws this error: *Projecting level 5 / 6 100% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 00:00:00 * *Traceback (most recent call last):\ | ETA: 00:00:00 * * File "starPlot.py", line 39, in <module>* * proj = pf.h.proj(axis,var)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1528, in __init__* * self._refresh_data()* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 275, in _refresh_data* * self.get_data()* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1597, in get_data* * self._add_level_to_tree(tree, level, fields)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1687, in _add_level_to_tree* * self._add_grid_to_tree(tree, grid, fields, zero_out, dls)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1648, in _add_grid_to_tree* * for fd in self._get_data_from_grid(grid, fields)]* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 74, in save_state* * tr = func(self, grid, field)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1709, in _get_data_from_grid* * return [grid[field] * bad_points for field in fields]* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 149, in __getitem__* * self.get_data(key)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 192, in get_data* * self._generate_field(field)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 137, in _generate_field* * self[field] = self.pf.field_info[field](self)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 337, in __call__* * dd = self._function(self, data)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/frontends/enzo/fields.py", line 263, in _spdensity* * filter = data['creation_time'] > 0.0* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 149, in __getitem__* * self.get_data(key)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 192, in get_data* * self._generate_field(field)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line 127, in _generate_field* * self.pf.field_info[field].check_available(self)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 306, in check_available* * validator(data)* * File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 412, in __call__* * raise NeedsDataField(doesnt_have)* *yt.data_objects.field_info_container.NeedsDataField: (['creation_time'])* Is anyone aware of what the issue may be? I'm wondering if enzo itself is not printing something yt needs here. thanks again! Munier On Wed, Nov 28, 2012 at 5:03 PM, Munier Azzam Salem < msalem@astro.columbia.edu> wrote:
Thanks Matt,
Manually creating the buffer seems to work (though John's approach of setting colormap values seems like it might be cleaner). The commands I ended up using are below. Thanks again!
Munier
*from yt.mods import ** *import matplotlib.pyplot as plt* *from numpy import log10 as log* * * *fName = "DD0006/test_sim_0006"* *var = "star_density"* *axis = 0* * * *pf = load(fName)* *pf.h* *proj = pf.h.proj(axis,var)* * * *res = [ 1000 , 1000 ]* *c = 0.5* *hw = .02* * * *frb = FixedResolutionBuffer(proj,(c-hw,c+hw,c-hw,c+hw),res,antialias=False)* *plt.imshow( log(frb['star_density'] + 1E-5 ) )* *plt.savefig('tmp')*
On Wed, Nov 28, 2012 at 4:23 PM, Matthew Turk <matthewturk@gmail.com>wrote:
Hi Munier,
Ah, my mistake -- to_frb was added in the development branch since our last release, which was in September. You can either update to the development branch (hg up -C yt ; python2.7 setup.py develop ) or used a FixedResolutioBuffer manually (super easy to do).
-Matt
On Wed, Nov 28, 2012 at 4:18 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Matt,
The command (on ranger, btw) gives
yt module located at: /share/home/01686/msalem/yt-x86_64/src/yt-hg
The current version of the code is:
--- 6f3c1cf6960d (stable) ---
This installation CAN be automatically updated. Updated successfully.
On Wed, Nov 28, 2012 at 3:30 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Munier,
That's weird, it should be in there. What's the output of "yt instinfo", particularly the hash?
-Matt
On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hi Nathan,
Thanks for the tips. I think the fixed-resolution buffer is exactly what I need here. Unfortunately, when I run the command:
frb = proj.to_frb(width, res, center=c)
I get the error
Traceback (most recent call last): File "smllPlt.py", line 16, in <module> frb = proj.to_frb(width,res) AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
I tried updating my version of yt and deleting any .yt files,
but
the error stuck.
best, Munier
On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum < nathan12343@gmail.com> wrote:
Hi Munier,
I suspect that the projection of the particle field is zero in the locations that are colored white in your image. This causes these regions to 'fall off' the bottom end of the logarithmic color bar.
I think you have two options. One would be to use a linear
colorbar. >> >> You >> >> can do this following the instructions here: >> >> >> >> http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-takes-the-log-of-a-particular-field >> >> >> >> Another option would be to make the plot by hand using a >> >> FixedResolutionBuffer. In this case you would make the projection >> >> object by >> >> hand, extract the raw image buffer using an FRB, and then make the plot >> >> manually using matplotlib. There's an example in the yt docs that >> >> covers >> >> how to do this: >> >> >> >> http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%20plotting >> >> >> >> In the latter case if you want the areas that project to zero to appear >> >> with a logarithmic colorbar, you'll need to manually set the regions in >> >> the >> >> FRB that are equal to zero to some small number. >> >> >> >> Cheers, >> >> >> >> Nathan >> >> >> >> On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote: >> >> >> >> Hi yt gurus, >> >> >> >> I've been making projections of star_density from enzo output >> >> files >> >> and they seem to be working out fine. However, wherever particles do >> >> not >> >> exist the background remains white instead of following my chosen >> >> colormap. >> >> Is there a way to paint these areas to follow the colormap? >> >> >> >> thanks! >> >> Munier >> >> >> >> I've attached an image of what gets plotted, and the relevant bits of >> >> my >> >> script are: >> >> >> >> from yt.mods import * >> >> >> >> fName = "DD0006/test_sim_0006" >> >> var = "star_density" >> >> axis = 0 >> >> >> >> pf = load(fName) >> >> pf.h >> >> >> >> pc = PlotCollection(pf) >> >> p = pc.add_projection(var,axis) >> >> #p.modify["particles"](1.0) >> >> >> >> radius = .02; >> >> >> >> pc.set_xlim(.5-radius,.5+radius) >> >> pc.set_ylim(.5-radius,.5+radius) >> >> >> >> pc.save(fName) >> >> >> >> >> >> -- >> >> Munier A. Salem // 845.489.6450 >> >> >> >> >> >> <test_sim_0006_Projection_x_star_density.png>_______________________________________________ >> >> 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 >> >> >> > >> > >> > >> > -- >> > Munier A. Salem // 845.489.6450 >> > >> > _______________________________________________ >> > 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 >> > > > > -- > Munier A. Salem // 845.489.6450 > > _______________________________________________ > 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
-- Munier A. Salem // 845.489.6450
-- Munier A. Salem // 845.489.6450

Hi Munier,
File "/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 412, in __call__ raise NeedsDataField(doesnt_have) yt.data_objects.field_info_container.NeedsDataField: (['creation_time'])
Is anyone aware of what the issue may be? I'm wondering if enzo itself is not printing something yt needs here.
This last bit of your error message says what's going on - yt is trying to access the 'creation_time' particle field and can't find it. There are a few reasons for this - either the snapshot you're using has no stars, has only a few stars in a few grids and yt isn't finding it automatically, or perhaps the snapshot has a grid with no particles at all. All are easy to test with this simple example script: pf = load('snapshot') all_fields = set(pf.h.derived_field_list + pf.h.field_list) if 'creation_time' not in all_fields: print "creation_time is probably not in this simulation" ct_yes = 0 ct_no = 0 for g in pf.h.grids: try: ct = g['creation_time'] ct_yes+=1 except: ct_no += 1 print "From %d grids, %d have stars, and %d have no particles." % (ct_yes + ct_no, ct_yes, ct_no) Can you run this script (modified for your situation) and report back, please? Good luck! -- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice)

Hi Stephen, Thanks for the response. I ran your script on several of the files. For some of them it gave me an output like this: * * *creation_time is probably not in this simulation* *From 565 grids, 0 have stars, and 565 have no particles.* BUT for others the output was like *From 557 grids, 557 have stars, and 0 have no particles.* And odder still, the order of yes's and no's is not contiguous. I think this may be an issue with my run itself? thanks, Munier On Tue, Dec 4, 2012 at 4:10 PM, Stephen Skory <s@skory.us> wrote:
Hi Munier,
File
"/share/home/01686/msalem/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py",
line 412, in __call__ raise NeedsDataField(doesnt_have) yt.data_objects.field_info_container.NeedsDataField: (['creation_time'])
Is anyone aware of what the issue may be? I'm wondering if enzo itself is not printing something yt needs here.
This last bit of your error message says what's going on - yt is trying to access the 'creation_time' particle field and can't find it. There are a few reasons for this - either the snapshot you're using has no stars, has only a few stars in a few grids and yt isn't finding it automatically, or perhaps the snapshot has a grid with no particles at all. All are easy to test with this simple example script:
pf = load('snapshot') all_fields = set(pf.h.derived_field_list + pf.h.field_list)
if 'creation_time' not in all_fields: print "creation_time is probably not in this simulation"
ct_yes = 0 ct_no = 0 for g in pf.h.grids: try: ct = g['creation_time'] ct_yes+=1 except: ct_no += 1
print "From %d grids, %d have stars, and %d have no particles." % (ct_yes + ct_no, ct_yes, ct_no)
Can you run this script (modified for your situation) and report back, please?
Good luck!
-- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice) _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Munier A. Salem // 845.489.6450

Hi Munier,
creation_time is probably not in this simulation From 565 grids, 0 have stars, and 565 have no particles.
BUT for others the output was like
From 557 grids, 557 have stars, and 0 have no particles.
And odder still, the order of yes's and no's is not contiguous. I think this may be an issue with my run itself?
It does look like some of your snapshots do not have star particles, or the data was not written to disk correctly/successfully, and this is why your script cannot find 'creation_time' for some of your snapshots. At this point it seems most likely you will need to figure out why that happened if you did in fact expect stars to be there. Good luck! -- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice)

Hi Munier, I've run into this problem before. You can set the color of any values above or below the colorbar range (or NaNs) to any color you want, using the set_bad, set_over, and set_under matplotlib commands. http://matplotlib.org/api/colors_api.html?highlight=set_bad#matplotlib.color... Here's an example. You have to manually set the colormap first, though. pc = PlotCollection(pf) p = pc.add_projection('Density',0) p.set_cmap('algae') p.cmap.set_under('k') # black p.cmap.set_bad('k') # black p.cmap.set_over('w') # white you can also use html hex colors or RGB tuples for your colors. Let us know if this works for you! Cheers, John On 11/28/2012 12:29 PM, Munier Azzam Salem wrote:
Hi yt gurus,
I've been making projections of star_density from enzo output files and they seem to be working out fine. However, wherever particles do not exist the background remains white instead of following my chosen colormap. Is there a way to paint these areas to follow the colormap?
thanks! Munier
I've attached an image of what gets plotted, and the relevant bits of my script are:
*from yt.mods import ** * * *fName = "DD0006/test_sim_0006"* *var = "star_density"* *axis = 0* * * *pf = load(fName)* *pf.h* * * *pc = PlotCollection(pf)* *p = pc.add_projection(var,axis)* *#p.modify["particles"](1.0)* * * *radius = .02;* * * *pc.set_xlim(.5-radius,.5+radius)* *pc.set_ylim(.5-radius,.5+radius)* * * *pc.save(fName)*
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- John Wise Assistant Professor of Physics Center for Relativistic Astrophysics, Georgia Tech
participants (5)
-
John Wise
-
Matthew Turk
-
Munier Azzam Salem
-
Nathan Goldbaum
-
Stephen Skory