Giter VIP home page Giter VIP logo

Comments (8)

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 16, 2011 21:22:20
It seems like the problem is introduced when plotting the 'dsp' array. There are dispersion values for s['dsp'][i](when i is correct), so I'm not sure why it seems to die here...

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 16, 2011 21:55:32
It doesn't look to me like there are no particles in those white regions... more like they have been contaminated by a NaN or inf? This is suggested by the fact the regions are exactly square.

Could you generate the image through pynbody.sph.render_image and inspect the values in the 'white' regions?

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 16, 2011 22:17:43
If where returns an empty array, doesn't that mean it didn't find anything that matched the condition?

also, if I do a max() and min() on the gas 'mach' array, I get real numbers.

Anyway:
In [48]: a = pynbody.sph.render_image(s.g,qty='dsp')
In [63]: a[250][250]
Out[63]: nan

You're right that there are NaNs there... how do they get there? The 'dsp' array has all real numbers, as far as I can tell:

In [67]: i = where(s['dsp'] == float(nan))
In [68]: i
Out[68]: (SimArray([], dtype=int64),)

Same result for "inf."

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 17, 2011 08:59:49
Your nan test (in[67] above) won't work because nan!=nan by definition. You want something like where(s['dsp']!=s['dsp']).

Could you also check what the smoothing length for the affected particles is?

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 17, 2011 15:15:43
Ah, yep you're right as usual!

In [5]: i = where(s['dsp'] != s['dsp'])
In [6]: i
Out[6]: (SimArray([ 18618, 19851, 24200, ..., 7316807, 7316809, 7316856]),)
#there they are. This is before trying any plotting... though I'm not sure I understand why the particles are found and then not found in my original report.
In [9]: s['smooth'] = numpy.power(s['mass']/s['den'],1./3.)
In [11]: s['smooth'][i]
Out[11]:
SimArray([ 2.71418938e-08, 2.67177526e-08, 3.81532428e-08, ...,
1.38790972e-10, 1.12029037e-10, 1.58774446e-10])
In [12]: sm = s['smooth'][i]
In [13]: max(sm)
Out[13]: 0.012417326985919935
In [14]: min(sm)
Out[14]: 3.2986661680289594e-11

#And for the whole array:
In [15]: max(s['smooth'])
Out[15]: 0.019023386110121238
In [16]: min(s['smooth'])
Out[16]: 1.7852063890462095e-11

Is that ok for finding smoothing lengths?

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 17, 2011 18:23:15
The minimum smoothing length looks a bit tiny... is that physical units?

Incidentally you shouldn't need to explicitly calculated s['smooth'] as it is a @derived_array already.

However, if you do, then to maintain unit information you want:

s['smooth'] = (s['mass']/s['den'])**(1,3)

then s['smooth'] will have unit information

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 17, 2011 18:54:27
Sorry, those weren't in physical units. Here it is again:

In [78]: i = where(s.g['dsp'] !=s.g['dsp'])
In [80]: s.g['smooth'][i]
Out[80]:
SimArray([ 11.63911516, 10.02338895, 11.82276064, ..., 13.55228082,
10.60649354, 25.1879408 ], 'kpc')
In [81]: sm = s.g['smooth'][i]
In [82]: min(sm)
Out[82]: 0.0039075758281437454
In [83]: max(sm)
Out[83]: 25.187940795333986

Minimum is 4 pc??

from pynbody.

apontzen avatar apontzen commented on July 20, 2024

From [email protected] on March 23, 2011 18:35:02
We discussed this offline and agreed the particle losses were due to incorrect syntax.

The white rectangles have been confirmed due to NaNs.

I'm now closing the issue.

from pynbody.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.