ttricco / sarracen

A Python library for smoothed particle hydrodynamics (SPH) analysis and visualization.
https://sarracen.readthedocs.io
GNU General Public License v3.0
15 stars 18 forks source link

list object has no attribute 'render' #39

Closed casshall closed 2 years ago

casshall commented 2 years ago

Different issue in interactive vs non interactive, data frame loads as expected but:

python3 plot.py Traceback (most recent call last): File "/Users/cass/work/backreaction_selfgravity/catherine_exact_conditions/const-grains-d2g-0.1/plot.py", line 9, in sdf.render('rho', xsec=0.0) AttributeError: 'list' object has no attribute 'render'.

Maybe update the documentation to state that a list is returned - one for particles and one for sinks, if I have understood?

ttricco commented 2 years ago

You're right that if the data contains both particles and sinks, then there are multiple return values. read_phantom() will separate the sinks into their own data frame by default. You can alter this behaviour using the 'separate_types=' argument, which accepts None, 'sinks', or 'all'.

See also https://sarracen.readthedocs.io/en/latest/api/sarracen.read_phantom.html#sarracen.read_phantom.

Also an easy way to unpack the list when loading the data is to do something like the following.

sdf_gas, sdf_sinks = sarracen.read_phantom('dumpfile')