[yt-users] Star Projections
Munier Azzam Salem
msalem at astro.columbia.edu
Tue Dec 4 12:26:23 PST 2012
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 at 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 at 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 at 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 at 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 at 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 at 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 at lists.spacepope.org
>> >> >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >> >>
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> yt-users mailing list
>> >> >> yt-users at 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 at lists.spacepope.org
>> >> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >> >
>> >> _______________________________________________
>> >> yt-users mailing list
>> >> yt-users at 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 at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >
>> _______________________________________________
>> yt-users mailing list
>> yt-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121204/a7fd43a4/attachment.htm>
More information about the yt-users
mailing list