In [1]:
import pyneb as pn
import numpy as np
To determine the ionic abundance, one can use the Atom object:
In [2]:
O3 = pn.Atom('O',3)
Opp_abund = O3.getIonAbundance(int_ratio=3239.4, tem=1.5e4, den=110., to_eval='L(5007)+L(4959)', Hbeta=100.0)
print('O++/O = {:5.2e}'.format(Opp_abund))
One can also use the observations from the Observation object:
In [3]:
obs = pn.Observation()
obs.readData('observations1.dat', fileFormat='lines_in_rows', err_default=0.05) # fill obs with data read from observations1.dat
obs.def_EBV(label1="H1r_6563A", label2="H1r_4861A", r_theo=2.85)
obs.correctData(normWave=4861.)
In [4]:
obs.printIntens()
In [5]:
all_atoms = pn.getAtomDict(atom_list=obs.getUniqueAtoms())
line_ab = {}
ion_ab = {}
temp = 12000.
dens = 1e4
for line in obs.getSortedLines():
if line.atom != 'H1' and line.atom != 'He1' and line.atom != 'He2':
line_ab[line.label] = all_atoms[line.atom].getIonAbundance(line.corrIntens, temp, dens,
to_eval=line.to_eval)
if line.atom not in ion_ab:
ion_ab[line.atom] = []
ion_ab[line.atom].append(line_ab[line.label][0])
for line in sorted(line_ab):
print('{:10} {:.2f}'.format(line, 12+np.log10(line_ab[line][0])))
In [6]:
for ion in sorted(ion_ab):
print(ion, ion_ab[ion])
In [7]:
for atom in ion_ab:
mean = np.mean(np.asarray(ion_ab[atom]))
ion_ab[atom] = mean
print('{:4s}: {:4.2f}'.format(atom, 12+np.log10(mean)))