<div dir="ltr"><div><div><div><div><div><div>Ah, so this isn't actually a bug. There's even a comment in the code indicating that this is the intended behavior:<br><br><a href="https://github.com/yt-project/yt/blob/master/yt/data_objects/construction_data_containers.py#L373">https://github.com/yt-project/yt/blob/master/yt/data_objects/construction_data_containers.py#L373</a><br><br></div>So the choices about what to do here are, in my opinion:<br><br></div>* Change this behavior to fill the array with zeros instead of NaNs<br></div>* Improve the documentation to make this choice clearer<br><br></div>I'm not sure offhand what is the best approach, especially given that changing this behavior would be a backward compatibility break.<br><br></div>For the original question: your data aren't all NaNs I suspect. E.g. take a look at this example script:</div><div><br></div><div>import yt<br>import numpy as np<br>ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')<br>disk = ds.disk('c', [0, 0, 1], (1000, 'pc'), (100, 'pc'))<br>proj = ds.proj('density', axis='z', weight_field='density', data_source=disk,<br>               method='integrate')<br>dens_proj = proj['density']<br>print(dens_proj[np.isfinite(dens_proj)])<br>print(np.nanmax(dens_proj))<br>print(np.nanmin(dens_proj))</div><div><br></div><div>Which prints out values in regions where the projection isn't filled with NaNs.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 14, 2017 at 12:45 PM, José Mauricio Utreras <span dir="ltr"><<a href="mailto:jutreras@ug.uchile.cl" target="_blank">jutreras@ug.uchile.cl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone,<br>
<br>
I got the same result using the IsolatedGalaxy dataset<br>
<br>
ds=yt.load('IsolatedGalaxy/<wbr>galaxy0030/galaxy0030')<br>
disk = ds.disk('c',[0,0,1],(1000,'pc'<wbr>),(100,'pc'))<br>
<span class="">proj=ds.proj('density',axis='<wbr>z',weight_field='density',<wbr>data_source=disk,method='<wbr>integrate')<br>
</span>proj['density']<br>
>>> YTArray([ nan,  nan,  nan, ...,  nan,  nan,  nan]) g/cm**3<br>
<div class="HOEnZb"><div class="h5"><br>
2017-11-14 15:38 GMT-03:00, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>>:<br>
> Can I get one of you to open an issue?<br>
><br>
> <a href="https://github.com/yt-project/yt/issues/new" rel="noreferrer" target="_blank">https://github.com/yt-project/<wbr>yt/issues/new</a><br>
><br>
> If you can, please include a script to reproduce the problem, making use of<br>
> one of the public datasets on <a href="http://yt-project.org/data" rel="noreferrer" target="_blank">yt-project.org/data</a>.<br>
><br>
> -Nathan<br>
><br>
> On Tue, Nov 14, 2017 at 12:34 PM, Andrew James Emerick<br>
> <<a href="mailto:aje2123@columbia.edu">aje2123@columbia.edu</a><br>
>> wrote:<br>
><br>
>> Hello Matias and Nathan,<br>
>><br>
>> I was able to reproduce this error on my own Enzo data set(s) using<br>
>> similar code. I did a little more playing around and it looks like it<br>
>> only<br>
>> breaks when having a weight_field. weight_field = None seems to be O.K. .<br>
>> It also occurs for the "region" objects, in addition to the disk.<br>
>> Interestingly, as Matias pointed out, doing something like this works:<br>
>><br>
>> region = ds.region([0.5,0.5,0.5], [0.0, 0.0, 0.0], [1.0, 1.0, 1.0])<br>
>> proj=ds.proj('density',axis='<wbr>z',weight_field='density',<wbr>data_<br>
>> source=region,method='<wbr>integrate')<br>
>><br>
>> but this does not:<br>
>><br>
>> region = ds.region([0.5,0.5,0.5], [0.1,0.1,0.1], [0.9,0.9,0.9] )<br>
>> proj =ds.proj('density',axis='z',<wbr>weight_field='density',data_<br>
>> source=region,method='<wbr>integrate')<br>
>><br>
>> In short, this indeed appears to be a bug, and possibly not specific to a<br>
>> single dataset.<br>
>><br>
>><br>
>><br>
>><br>
>> Andrew<br>
>><br>
>><br>
>> On Tue, Nov 14, 2017 at 12:40 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> This sounds like a bug. I don't think you should ever get back NaNs from<br>
>>> a projection operation.<br>
>>><br>
>>> Is there any chance you can share the dataset that's triggering this<br>
>>> behavior?<br>
>>><br>
>>> On Tue, Nov 14, 2017 at 11:34 AM, Matias Enrique Suazo Campos <<br>
>>> <a href="mailto:matias.suazo@ug.uchile.cl">matias.suazo@ug.uchile.cl</a>> wrote:<br>
>>><br>
>>>> Dear YT users,<br>
>>>><br>
>>>> I'm trying to make a density projection, in the following lines I show<br>
>>>> you the lines that I have.<br>
>>>><br>
>>>> #Ramses output<br>
>>>> ds = yt.load(path+"output_%05d"%<wbr>snap+"/info_%05d.txt" %snap)<br>
>>>> disk = ds.disk('max',[0,0,1],(20,'pc'<wbr>),(5,'pc'))<br>
>>>> proj=ds.proj('density',axis='<wbr>z',weight_field='density',<wbr>data_<br>
>>>> source=disk,method='integrate'<wbr>)<br>
>>>><br>
>>>> However when I print proj["density"] I get a list of nan, however when<br>
>>>> I<br>
>>>> use the whole domain as my data_source I get reasonable numbers.<br>
>>>><br>
>>>> Thanks,<br>
>>>> Matías Suazo<br>
>>>> MSc student at Universidad de Chile<br>
>>>><br>
>>>> ______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
>>>><br>
>>>><br>
>>><br>
>>> ______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
>>><br>
>>><br>
>><br>
>><br>
>> --<br>
>> NSF Graduate Fellow<br>
>> Columbia University<br>
>> Department of Astronomy<br>
>><br>
>> ______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
>><br>
>><br>
><br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
</div></div></blockquote></div><br></div>