def test_el_z_inputs_same(): el_ioneq_input = ioneq(el) z_ioneq_input = ioneq(z) el_ioneq_input.load() z_ioneq_input.load() assert np.all(el_ioneq_input.Temperature == z_ioneq_input.Temperature) assert np.all(el_ioneq_input.Ioneq == z_ioneq_input.Ioneq)
def test_equlibrium_state_vs_chiantipy(natom=8): """ Test equilibrium states saved in EigenData2 and compare them with Outputs from ChiantiPy. Note: This test requires ChiantiPy to be installed (see details in: https://github.com/chianti-atomic/ChiantiPy). """ try: import ChiantiPy.core as ch except ImportError: warnings.warn('ChiantiPy is required in this test.', UserWarning) return temperatures = [1.0e4, 1.0e5, 1.0e6, 1.0e7, 1.0e8] eqi_ch = ch.ioneq(natom) eqi_ch.calculate(temperatures) conce = eqi_ch.Ioneq table_sta = nei.EigenData2(element=natom) for i in range(2): ch_conce = conce[:, i] table_conce = table_sta.equilibrium_state(T_e=temperatures[i]) assert ch_conce.all() == table_conce.all() return
import ChiantiPy.core as ch import numpy as np import ChiantiPy.tools.filters as chfilters import matplotlib.pyplot as plt t = 10.**(3.84 + 0.05 * np.arange(8.)) H1 = ch.ion('h_1', temperature=t, eDensity=1.e+14, em=1.e+27) H1.popPlot(top=10) H1.intensityPlot(wvlRange=[6564, 6565], linLog='log', index=4, top=10) H1.intensityList(wvlRange=[4000, 7000], index=4, top=10) plt.show(H1) H1a = ch.ioneq(1) H1a.load() H1a.plot() #plt.xlim(0,3e4) plt.tight_layout() plt.show(H1a)
def test_load_ioneq_alternate_file(): load_ioneq = ioneq(el) load_ioneq.load(ioneqName='chianti') assert hasattr(load_ioneq, 'Temperature') assert hasattr(load_ioneq, 'Ioneq')
def test_load_ioneq(): load_ioneq = ioneq(el) load_ioneq.load() assert hasattr(load_ioneq, 'Temperature') assert hasattr(load_ioneq, 'Ioneq')
def test_calculate_ioneq(): calc_ioneq = ioneq(el) calc_ioneq.calculate(temperature) assert hasattr(calc_ioneq, 'Temperature') assert hasattr(calc_ioneq, 'Ioneq') assert np.all(calc_ioneq.Temperature == temperature)
def test_z_input(): z_ioneq_input = ioneq(z)
def test_el_input(): el_ioneq_input = ioneq(el) assert el_ioneq_input.Z == util.el2z(el)