-
Notifications
You must be signed in to change notification settings - Fork 31
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
AttributeError: module 'ChiantiPy.tools.data' has no attribute 'Abundance' #314
Comments
Hi, could you show me how you initiate your ion? I am not able to duplicate your error. Ken |
Thanks for the quick reply! Here's the block of code I'm using for this. Admittedly I'm not particularly experienced with Python, but I'm using essentially the same block of code that worked fine on a different laptop, which makes me think it could be an installation issue. Please let me know if you need anything else! `import ChiantiPy.core as ch T = [53420., 53420., 53420., 16320.] ions, popion_numer, popion_denom = [], [], [] |
I have coded this up and it all works. One thing you might try is this should give you a dictionary of all of the abundance data files or should give you the abundance of Carbon. let me know how it goes Ken |
sorry, the code needs to have a single line turned into 2 lines |
So, I tried these, but they both give the same error as before |
what happens when you do
are you working in straight interactive Python, an ipython shell, or a jupyter notebook? Ken |
Inputting just the first line goes smoothly, but the second line returns the error I had before. I'm using Spyder for this |
after importing chdata,
hopefully this returns True Ken |
Putting that in returns false |
or: |
sounds like you are not reading anything. to see if it is pointing to the top of the CHIANTI directory |
dir(chdata) returns ['Defaults', 'Xuvtop', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec', warningregistry', 'chio', 'glob', 'klnames', 'os', 'traceback', 'warnings'] os.environ['XUVTOP'] returns 'C:\Users\15405\ChiantiPy\dbase', as I set that manually in the line above the import line |
what I get is: and this is quite different try: this should give you a dictionary of the energy levels of c_4 with the following keys: dict_keys(['lvl', 'conf', 'term', 'label', 'spin', 'spd', 'l', 'j', 'mult', 'ecm', 'eryd', 'erydth', 'ecmth', 'ref', 'pretty', 'status', 'filename']) somehow I don't think you are reading the database correctly Ken |
Yes, that is definitely very different. Trying this new thing does give me a dictionary with those keys though |
what version of ChiantiPy are you using? |
I believe I'm using version 0.11.0 for ChiantiPy and 10.0.1 for the database. As a side note, I was trying to compare the dbase directory to the one on my old computer, and I noticed that the dbase on my new computer is missing the folder PaxHeader. Is that important? |
sounds like your versions are OK I think the paxheader is something you get when the tar file is made under MacOs. It is not necessary. since you were able to read the elvlc file, things should be OK but they are not. I am kind of baffled Ken |
are you using Python 3.X? Ken |
Yes, Python 3.8.5 |
when you do
what does elvlc['filename'] give you and does it match were you think it should be based on your XUVTOP |
When I do this, elvlc['filename'] gives me 'C:\Users\15405\ChiantiPy\dbase\c\c_4\c_4.elvlc'. 'C:\Users\15405\ChiantiPy\dbase' is indeed my XVUTOP directory |
Since I had some trouble installing this at first on Windows, I thought this might be the reason for this problem, so I tried installing it on a work computer that uses Linux. After an easy 4-line installation, I get the exact same error on the Linux machine |
Scratch that, it works fine on Linux, so I reinstalled it on Windows and it works fine there too. Must've been a problem with the installation. Thanks so much for trying to help figure this out, and sorry for the trouble! |
glad you got it working. |
Dear Sir |
I've read every comment that was made in 2021. With chianti-atomics, which stands for abundances of elements, I encountered the same issues. How can I fix the issue and move on to solving it on Windows 10 rather than in Lunix? I no longer use Linux; I use Windows. |
the problem that awalker has was that the environ variable XUVTOP was not set before the code was run. Make sure that XUVTOP points to the CHIANTI data. |
Hi, I just installed Chianti on Windows (I'm using Anaconda). When I try to run ch.ion, I get the error message
"AttributeError: module 'ChiantiPy.tools.data' has no attribute 'Abundance'"
What's tripping it up seems to be line 134 in [HOME]\anaconda3\lib\site-packages\ChiantiPy\core\Ion.py, which is
self.Abundance = chdata.Abundance[self.AbundanceName]['abundance'][self.Z-1]
I'm not sure how to fix this, and I haven't been able to find a solution for this problem anywhere else
The text was updated successfully, but these errors were encountered: