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

No module named plasma / BasePlasmaArray AttributeError #108

Closed
jhmatthews opened this issue Mar 25, 2014 · 4 comments
Closed

No module named plasma / BasePlasmaArray AttributeError #108

jhmatthews opened this issue Mar 25, 2014 · 4 comments

Comments

@jhmatthews
Copy link

I'm pretty sure this is just a documentation issue, but I thought I would flag anyway.

The documentation on readthedocs says to do the following to create a simple plasma:

>>> from tardis import atomic, plasma
>>> atom_data = atomic.AtomData.from_hdf5()
>>> my_plasma = plasma.BasePlasma({'Fe':0.5, 'Ni':0.5}, 10000, 1e-13, atom_data)
>>> print my_plasma.abundances
atomic_number abundance_fraction number_density
------------- ------------------ --------------
           28                0.5  513016973.936
           26                0.5  539183641.472

However, there I cannot import plasma (it does not exist):

>>> from tardis import plasma
ImportError                               Traceback (most recent call last)
<ipython-input-18-0dbefda4ca15> in <module>()
----> 1 from tardis import plasma

ImportError: cannot import name plasma

There is however, a module called plasma_array, containing the BasePlasmaArray class. I tried an analogous command:

>>>from tardis import plasma_array, atomic
>>> atom_data = atomic.AtomData.from_hdf5()
>>> my_plasma = plasma_array.BasePlasmaArray({'Fe':0.5, 'Ni':0.5}, 10000, 1e-13, atom_data)
AttributeError                            Traceback (most recent call last)
<ipython-input-24-a42101f19f8c> in <module>()
----> 1 my_plasma = plasma_array.BasePlasmaArray({'He':1.0}, 10000, 1e-13, atom_data)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tardis/plasma_array.pyc in __init__(self, number_densities, atom_data, time_explosion, delta_treatment, nlte_config, ionization_mode, excitation_mode)
    141         self.nlte_config = nlte_config
    142         self.delta_treatment = delta_treatment
--> 143         self.electron_densities = self.number_densities.sum(axis=0)
    144 
    145         self.level_populations = pd.DataFrame(index=self.atom_data.levels.index, columns=number_densities.columns,

AttributeError: 'dict' object has no attribute 'sum'

This may be a separate issue, or perhaps the docs just need updating and I am running the wrong commands. Probably wants fixing regardless.

Also, please tell me if you'd rather I flagged issues like this somewhere else e.g. a user's group.

@jhmatthews
Copy link
Author

System info:
OSX 10.8.2
Tardis 0.9.1
Cython 0.20
h5py 2.2.1
Numpy 1.8.0
Scipy 0.13.0
Astropy 0.3.1
Pandas 0.13.0

Also tested this on another Tardis user's machine here at Soton, same result.

@jhmatthews
Copy link
Author

And this issue also applies to the documentation on Calculating zeta here

@ssim
Copy link
Contributor

ssim commented Mar 26, 2014

Thanks, James.
I think the problem is that the documentation is out of date - sorry.
@wkerzendorf - do you agree? If so can we just remove the offending documentation pages (unless you are able to update them)?

@ssim
Copy link
Contributor

ssim commented Jun 17, 2015

I think that this was resolved, so I'm closing this now.

@ssim ssim closed this as completed Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants