Git Product home page Git Product logo

Comments (27)

kdere avatar kdere commented on August 20, 2024

Hi,

could you show me how you initiate your ion?

I am not able to duplicate your error.

Ken

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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.]
logne = list(np.linspace(2.5, 6.6, 500))
ne = 10.**np.array(logne)
statename = ['o_5','ca_8','ca_7','o_4']
state = [[2,1],[1,0],[1,0],[1,0]]

ions, popion_numer, popion_denom = [], [], []
for i in range(len(statename)):
ions.append(ch.ion(statename[i],temperature=T[i],eDensity=ne))
ions[i].populate()
popion_numer.append(ions[i].Population['population'][:,state[i][0]])
popion_denom.append(ions[i].Population['population'][:,state[i][1]])`

from chiantipy.

kdere avatar kdere commented on August 20, 2024

I have coded this up and it all works.

One thing you might try is
import ChiantiPy.tools.data as chdata chdata.Abundance

this should give you a dictionary of all of the abundance data files

or
c4=ch.ion(T, ne) c4.Abundance

should give you the abundance of Carbon.

let me know how it goes

Ken

from chiantipy.

kdere avatar kdere commented on August 20, 2024

sorry, the code needs to have a single line turned into 2 lines

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

So, I tried these, but they both give the same error as before

from chiantipy.

kdere avatar kdere commented on August 20, 2024

what happens when you do

import ChiantiPy.tools.data as chdata

chdata.Abundance

are you working in straight interactive Python, an ipython shell, or a jupyter notebook?

Ken

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

Inputting just the first line goes smoothly, but the second line returns the error I had before. I'm using Spyder for this

from chiantipy.

kdere avatar kdere commented on August 20, 2024

after importing chdata,
try:

hasattr(chdata,'Abundance')

hopefully this returns True

Ken

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

Putting that in returns false

from chiantipy.

kdere avatar kdere commented on August 20, 2024

or:
dir(chdata)

from chiantipy.

kdere avatar kdere commented on August 20, 2024

sounds like you are not reading anything.
try
os.environ('XUVTOP')

to see if it is pointing to the top of the CHIANTI directory

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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

from chiantipy.

kdere avatar kdere commented on August 20, 2024

what I get is:
dir(chdata) ['Abundance', 'AbundanceDefault', 'AbundanceList', 'ChiantiVersion', 'Defaults', 'GrndLevels', 'IoneqAll', 'Ip', 'Klgbfn', 'MasterList', 'Xuvtop', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'aname', 'chio', 'filename', 'fname', 'glob', 'keywordArgs', 'kl', 'klnames', 'os', 'traceback', 'warnings']

and this is quite different

try:
import ChiantiPy.tools.io as chio elvlc = chio.elvlcRead('c_4')

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

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

Yes, that is definitely very different. Trying this new thing does give me a dictionary with those keys though

from chiantipy.

kdere avatar kdere commented on August 20, 2024

what version of ChiantiPy are you using?
what version of the CHIANTI database are you using?

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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?

from chiantipy.

kdere avatar kdere commented on August 20, 2024

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

from chiantipy.

kdere avatar kdere commented on August 20, 2024

are you using Python 3.X?

Ken

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

Yes, Python 3.8.5

from chiantipy.

kdere avatar kdere commented on August 20, 2024

when you do

import ChiantiPy.tools.io as chio elvlc = chio.elvlcRead('c_4')

what does elvlc['filename'] give you and does it match were you think it should be based on your XUVTOP

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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

from chiantipy.

awalker4314 avatar awalker4314 commented on August 20, 2024

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!

from chiantipy.

kdere avatar kdere commented on August 20, 2024

glad you got it working.

from chiantipy.

belay221 avatar belay221 commented on August 20, 2024

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.

from chiantipy.

belay221 avatar belay221 commented on August 20, 2024

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.

from chiantipy.

kdere avatar kdere commented on August 20, 2024

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.

from chiantipy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.