Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for pynbody import error #20

Merged
merged 1 commit into from
Nov 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/amuse/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def stub(self, *args, **kwargs):
import numpy
try:
from pynbody.array import SimArray
from pynbody.snapshot import SimSnap, _new
from pynbody.snapshot import SimSnap
try:
from pynbody.snapshot import new
except:
from pynbody.snapshot import _new as new
import pynbody.plot.sph as pynbody_sph
HAS_PYNBODY = True
except ImportError:
Expand Down Expand Up @@ -442,9 +446,9 @@ def convert_particles_to_pynbody_data(particles, length_unit=units.kpc, pynbody_
raise AmuseException("Couldn't find pynbody")

if hasattr(particles, "u"):
pynbody_data = _new(gas=len(particles))
pynbody_data = new(gas=len(particles))
else:
pynbody_data = _new(dm=len(particles))
pynbody_data = new(dm=len(particles))
pynbody_data._filename = "AMUSE"
if hasattr(particles, "mass"):
pynbody_data['mass'] = SimArray(particles.mass.value_in(units.MSun), "Msol")
Expand Down