chianti-atomic / ChiantiPy

ChiantiPy is a python package to calculate the radiative properties of astrophysical plasmas based on the CHIANTI atomic database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on running provided jupyter notebooks in the repo

MadFisa opened this issue · comments

Hi,

I was trying to run the jupyter notebooks in the repo, I am running into some issues while using it. In particular, trying to run fe_13_demo_make_model notebooks, while running
box = mdl.maker(specData, wghtFactor = 0.2, ionList=['fe_13'], verbose = True)
I get an error asking for temperature as an argument. I managed to run it by passing a temperature as an argument. But, on running the line

box.gofnt(temp, dens, verbose=True)

I am getting another error,
"AttributeError: 'maker' object has no attribute 'match'"

Here is the whole error in detail,

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_30471/2084597862.py in <module>
----> 1 box.gofnt(temp, dens, verbose=True)

~/adnocana/aed/lib/python3.8/site-packages/ChiantiPy/model/Maker.py in gofnt(self, temperature, density, verbose)
    538             print(' density     size:  %5i'%(self.EDensity.size))
    539         ionList = []
--> 540         for iwvl, amatch in enumerate(self.match):
    541             for someIon in amatch['ion']:
    542 #                print 'someIon = ', someIon

AttributeError: 'maker' object has no attribute 'match'

I am assuming that there has been changes to code after the notebooks were made. How can I correct this error?

I would like fit a spectrum created by chiantiPy to a spectrum data I have and the Maker module seems to have some capabilities in this regard. So far the only place I could find examples for the use of ChiantiPy.Maker module is in those notebooks. Is there other places where I could find example codes?

Edit:
Here is the first line I got the error along with error message:

box = mdl.maker(specData, wghtFactor = 0.2, ionList=['fe_13'], verbose = True)

with the error

TypeError: __init__() missing 1 required positional argument : 'specData'

I got it to run by editing it as following

box = mdl.maker(temperature = 1.78e6, specData=specData, wghtFactor = 0.2, ionList=['fe_13'], verbose = True)

That will be very much appreciated, Thank you. The 'fixed' version of the current notebooks should be sufficient, I believe, unless there are more capabilities added to the module that you would like to show.
Putting some examples in the docs showing the capabilities of the module will be helpful for anyone looking into it, since current documentation has nearly no info apart from the api documentation.

I have updated the README.txt file.

A basic notebook that needs to be run first is 1_fe_13_demo_make_match.ipynb

I am in the process of updating the others