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

Unable to load ioneq #453

Closed
nawinnova opened this issue Nov 13, 2023 · 10 comments
Closed

Unable to load ioneq #453

nawinnova opened this issue Nov 13, 2023 · 10 comments

Comments

@nawinnova
Copy link

Hi all,

I have just recently install ChiantiPy (version 0.15.1) and try to follow the quickguide. However, I am unable to load the ion equilibrium data due to some error.

Here is the code I am using.

`import os
import ChiantiPy
import ChiantiPy.core as ch
import numpy as np
import matplotlib.pyplot as plt
import ChiantiPy.tools.data as chdata

os.environ['XUVTOP'] = '/Users/nawinngampoopun/Desktop/CHIANTI/CHIANTI_10.1_database/'

Ocharge = ch.ioneq(8)
Ocharge.load()
`

The return error is AttributeError: module 'ChiantiPy.tools.data' has no attribute 'Defaults'

Is there anyway to solve this issue?

Thank you,
Nawin

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

I am looking into this

Ken

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

Try:

defaults=chio.defaultsRead()

and see what you get for the values of the dict 'defaults'

one should be

'ioneqfile': 'chianti',

Ken

@nawinnova
Copy link
Author

Hi Ken,

Here is the values of dict

{'abundfile': 'sun_photospheric_2015_scott',
'ioneqfile': 'chianti',
'wavelength': 'angstrom',
'flux': 'energy',
'gui': True}

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

next thing to try:

import ChiantiPy.tools.data as chdata

then chdata.Defaults

should look like what you got with chio.defaultsRead()

so , theck that.

Ken

@nawinnova
Copy link
Author

I receive an error this time, similar to the original problem.

import ChiantiPy.tools.data as chdata
----> chdata.Defaults

AttributeError: module 'ChiantiPy.tools.data' has no attribute 'Defaults'

Also, I can add that I am running this in VSCode on macOS, and install ChiantiPy using pip

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

I have never tried VSCode.

can you try this in a Python console, or a jupyter notebook?

Ken

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

does chdata have any attributes such as
Xuvtop
Ip
MasterList
?
Ken

@nawinnova
Copy link
Author

Hi, I also try to run it using IPython

Here is some results

In [3]: import os

In [4]: os.environ['XUVTOP'] = '/Users/nawinngampoopun/Desktop/CHIANTI/CHIANTI_10.1_database/'

In [5]: import ChiantiPy.tools.data as chdata

In [6]: chdata.Defaults

AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 chdata.Defaults

AttributeError: module 'ChiantiPy.tools.data' has no attribute 'Defaults'

In [7]: dir(chdata)
Out[7]:
['builtins',
'cached',
'doc',
'file',
'loader',
'name',
'package',
'spec',
'warningregistry',
'chio',
'glob',
'klnames',
'os',
'traceback',
'warnings']

@nawinnova
Copy link
Author

Hi Ken,

I have found the problem now. It maybe because I import the ChiantiPy before define os.environ['XUVTOP']. Now the code is working now after I swap the code and restart the kernel and

Thank you for your help!
Nawin

@kdere
Copy link
Contributor

kdere commented Nov 13, 2023

glad you found your problem

Ken

@kdere kdere closed this as completed Nov 13, 2023
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