Problems with spectrum class in 0.8.5
svaberg opened this issue · comments
Hello ChiantiPy Developers,
I have been trying out ChiantiPy for my research on stellar and solar winds and I have found it very helpful for understanding radiative losses.
I notice that with the latest version update 0.8.5 some things are no longer working for me. For example the code in Readthedocs "Spectra of multiple ions and continuum" works for me in 0.8.4 but not in 0.8.5. I provide below an example of code that ran in 0.8.4 but does not work in 0.8.5.
import numpy as np
import matplotlib.pyplot as plt
import ChiantiPy.core as ch
import ChiantiPy.tools.filters as chfilters
temperature = [1.e+6, 2.e+6]
density = 1.e+9
wvl = 200. + .05 * np.arange(2001)
emeasure = [1.e+27 ,1.e+27]
s = ch.spectrum(temperature,
density, wvl,
filter = (chfilters.gaussian,0.2),
em = emeasure,
doContinuum=0,
minAbund=1.e-4,
verbose=True)
This code now raises a ValueError: could not broadcast input array from shape (19) into shape (2)
.
In the same way, when temperature, density and emission measure are all scalars, like this
temperature = 1.e+6 # Now a scalar
density = 1.e+9
wvl = 200. + .05 * np.arange(2001)
emeasure = 1.e+27 # Now a scalar
s = ch.spectrum(temperature,
density, wvl,
filter = (chfilters.gaussian,0.2),
em = emeasure,
doContinuum=0,
minAbund=1.e-4,
verbose=True)
an AttributeError: 'ion' object has no attribute 'NTempDen'
is now raised, while this was working in 0.8.4.
I would be interested to hear if these examples work for you.
Best wishes,
Dag Evensberget
Hi Dag,
thanks for pointing this out. I will check on this ASAP
Ken
I have fixed the problems that you have run into. I will not yet make a new release because there may be similar bugs hanging around. If you just use the current repo, you should be OK. If not, please let me know.
regards,
Ken
Hi Ken,
Thanks for getting back to me so quickly! I have pulled the latest revision and the two examples above are now running.
Best wishes,
Dag