<div dir="ltr">Can you guys take a look at this?<div><br></div><div><a href="https://bitbucket.org/yt_analysis/yt/pull-request/1292/ensure-profiled-data-are-in-the-correct/diff">https://bitbucket.org/yt_analysis/yt/pull-request/1292/ensure-profiled-data-are-in-the-correct/diff</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 4, 2014 at 11:44 AM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nathan,<br><br>Ah, usually what we do is, on the way in to Cython, call convert_to_units(field.units).  I think this will fix it here.<br><div><br></div><div>-Matt</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote">On Tue Nov 04 2014 at 1:42:49 PM Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dug into this a little bit.<div><br></div><div>The issue is that querying the particle_mass field returns CGS values, but the field_info for particle_mass says it should be in code_mass. This is illustrated by the following script: <a href="https://bpaste.net/show/6ee56ae61fa6" target="_blank">https://bpaste.net/show/6ee56ae61fa6</a></div><div><br></div><div>Does anyone remember why this is the case?</div><div><br></div><div>The reason this is coming up here is because the profiling code passes raw numpy arrays to the cython parallel profiling machinery, so the units that are attached to the data when we query the data source are stripped off.  We're relying on the field_info units entry for all fields being identical to the units that get appended to the results of a field access on a data object.</div><div><br></div><div>Unfortunately I don't have time right now to figure out where this inconsistency is coming from...</div></div><div dir="ltr"><div><br></div><div>-Nathan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 4, 2014 at 10:42 AM, John Regan <span dir="ltr"><<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Nathan,<br><br></div>Sure. Using the enzo_tiny_cosmology I see the same problem. Script attached. <br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 4, 2014 at 6:29 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi John,<div><br></div><div>Do you have a short script using one of the test datasets on <a href="http://yt-project.org/data" target="_blank">yt-project.org/data</a> that reproduces this behavior?</div><span><font color="#888888"><div><br></div><div>-Nathan</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 4, 2014 at 10:26 AM, John Regan <span dir="ltr"><<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Matt, <br><br></div>It looks like the particle mass is in grams but the unit assignment sets it to code_mass. Then when the units is set to Msun the numbers get crazy. I can't see easily where the units for the particle mass get set in the create_profile routine (in field/particle_fields the mass is set to g in particle_mass()). Any idea where this might be getting all mixed up or how to force the mass units to be grams in create_profile()?<br><br></div>Cheers,<br>John<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 5:18 PM, John Regan <span dir="ltr"><<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Yeah that's what I thought first but 1 Msun = 10^33 g. So that would put the inner DM mass at ~ 10^14 right? <br><br></div>The total mass inside the sphere of 1kpc is only about 10^7 though. Something is not quite correct somewhere in the profiling calculation. <br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 5:16 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yup, those sure are weird!  Looks to me like a units issue -- any chance those could be in grams but reported in Msun?<div><div><br><br><div class="gmail_quote">On Mon Nov 03 2014 at 11:15:23 AM John Regan <<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Matt, <br><br></div>Ah I see what you mean now. Changing 'radius' to 'particle_radius' worked nicely. However, the results are bit weird. <br><br>rpm = yt.create_profile(sp, ['particle_radius'],  ['particle_mass'],<br>                        units = {'particle_radius': 'pc', 'particle_mass' : 'Msun'}, <br>                        n_bins=20, weight_field=None, accumulation=True, fractional=False)<br>print "Particle Mass = ", rpm["particle_mass"]<br><br>Particle Mass =  [  0.00000000e+00   0.00000000e+00   0.00000000e+00   2.17730865e+47<br>   2.39503952e+48   5.00780990e+48   9.36242721e+48   2.87404742e+49<br>   8.03426893e+49   1.91385431e+50   4.44824158e+50   1.02681876e+51<br>   2.28900459e+51   4.74174278e+51   1.05066029e+52   2.07602025e+52<br>   3.49614805e+52   4.89060538e+52   6.82621100e+52   1.08907237e+53] Msun<br><br></div>Any idea what is causing the crazy values?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 4:23 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<div><br></div><div>It was exactly the same error, when you used particle_radius in both places that "radius" was used before?</div><div><br></div><div>-Matt<div><div><br><br><div class="gmail_quote">On Mon Nov 03 2014 at 7:06:44 AM John Regan <<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Kacper,<br><br></div>Of course - I should have noticed that. Thanks for finding that. <br></div>However, I notice that when I try to create a profile for the Dark (particle) matter I run into some trouble as well. <br><br>rpm = yt.create_profile(sp, 'radius',  ['particle_mass'],<br>                        units = {'radius': 'pc', 'particle_mass' : 'Msun'}, <br>                        n_bins=20, weight_field=None, accumulation=True, fractional=False)<br><br></div>This gives the following error:<br><br>Traceback (most recent call last):<br>  File "EnclosedMass.py", line 35, in <module><br>    n_bins=20, weight_field=None, accumulation=True, fractional=False)<br>  File "/homeappl/home/regan/appl_taito/YT/Dev-3.0/yt/yt/data_objects/profiles.py", line 1361, in create_profile<br>    obj.add_fields([field for field in fields])<br>  File "/homeappl/home/regan/appl_taito/YT/Dev-3.0/yt/yt/data_objects/profiles.py", line 782, in add_fields<br>    self._bin_chunk(chunk, fields, temp_storage)<br>  File "/homeappl/home/regan/appl_taito/YT/Dev-3.0/yt/yt/data_objects/profiles.py", line 979, in _bin_chunk<br>    rv = self._get_data(chunk, fields)<br>  File "/homeappl/home/regan/appl_taito/YT/Dev-3.0/yt/yt/data_objects/profiles.py", line 910, in _get_data<br>    arr[:,i] = chunk[field][filter]<br>  File "/homeappl/home/regan/appl_taito/YT/Dev-3.0/yt/yt/units/yt_array.py", line 963, in __getitem__<br>    ret = super(YTArray, self).__getitem__(item)<br>ValueError: too many boolean indices<br><br><br></div>Has anyone seen this before? For the 'cell_mass' everything works fine. <br><br></div>Cheers,<br>John<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 1, 2014 at 6:49 PM, Kacper Kowalik <span dir="ltr"><<a href="mailto:xarthisius.kk@gmail.com" target="_blank">xarthisius.kk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<br>I think that if you want to compute "total" instead of mean you need to set weight_field to None in create_profile.<div>Cheers,</div><div>Kacper</div><br><div class="gmail_quote"><div><div>On Sat Nov 01 2014 at 6:10:50 AM John Regan <<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi All, <div><br></div><div>Is the accumulation flag working in 3.0? </div><div>I tried to plot the enclosed mass in a sphere and I got some funny results. </div><div><br></div><div><div>rpm = yt.create_profile(sp, 'radius',  'cell_mass',</div><div>                        units = {'radius': 'pc', 'cell_mass' : 'Msun'}, </div><div>                        weight_field='density', accumulation=True, fractional=False)</div></div><div><br></div><div>print "Mass = ", rpm["gas", "cell_mass"]<br></div><div><br></div><div>In this case bin[n-1] gives a mass of something like 0.5 Msun but when I print the totals quantity I get a value of several orders of magnitude higher and closer to what I would expect.</div><div><br></div><div>sp.quantities.total_quantity(["cell_mass", "particle_mass"])<br></div><div><br></div><div>Cheers,</div><div>John</div></div></div></div>
______________________________<u></u>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-users-<u></u>spacepope.org</a><br>
</blockquote></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
______________________________<u></u>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-users-<u></u>spacepope.org</a><br>
</blockquote></div></div></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
______________________________<u></u>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-users-<u></u>spacepope.org</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
______________________________<u></u>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-users-<u></u>spacepope.org</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>