Skip to content

Commit

Permalink
Change the way AtomData quantities are initialized
Browse files Browse the repository at this point in the history
Quantities are initialized as units.Quantity instead of constructing a
Quantity by multiplicating with a unit.
  • Loading branch information
yeganer committed May 18, 2016
1 parent cf8e7a3 commit 5e8da02
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tardis/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import numpy as np
import pandas as pd
from scipy import interpolate
from astropy import table, units
import astropy
from astropy import table, units, constants
from pandas import DataFrame


Expand Down Expand Up @@ -415,19 +416,18 @@ def __init__(self, atom_data, ionization_data, levels_data, lines_data, macro_at

self.atom_data = DataFrame(atom_data.__array__())
self.atom_data.set_index('atomic_number', inplace=True)
self.atom_data.mass = units.Unit('u').to('g', self.atom_data.mass.values)
self.atom_data.mass = units.Quantity(self.atom_data.mass.values, 'u').cgs

self.ionization_data = DataFrame(ionization_data.__array__())
self.ionization_data.set_index(['atomic_number', 'ion_number'], inplace=True)
self.ionization_data.ionization_energy = units.Unit('eV').to('erg',
self.ionization_data.ionization_energy.values)
self.ionization_data.ionization_energy = units.Quantity(self.ionization_data.ionization_energy.values, 'eV').cgs

self.levels = DataFrame(levels_data.__array__())
self.levels.energy = units.Unit('eV').to('erg', self.levels.energy.values)
self.levels.energy = units.Quantity(self.levels.energy.values, 'eV').cgs

self.lines = DataFrame(lines_data.__array__())
self.lines['nu'] = units.Unit('angstrom').to('Hz', self.lines['wavelength'], units.spectral())
self.lines['wavelength_cm'] = units.Unit('angstrom').to('cm', self.lines['wavelength'])
self.lines['nu'] = units.Quantity(self.lines['wavelength'], 'angstrom').to('Hz', units.spectral())
self.lines['wavelength_cm'] = units.Quantity(self.lines['wavelength'], 'angstrom').cgs



Expand Down

0 comments on commit 5e8da02

Please sign in to comment.