Skip to content

Commit

Permalink
attempt to fix tardis-sn#455
Browse files Browse the repository at this point in the history
  • Loading branch information
yeganer committed Jan 19, 2016
1 parent 41d8fcd commit ed7639a
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tardis/plasma/properties/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,15 @@ def _set_index(self, levels):
return (levels.index, levels['energy'], levels['metastable'],
levels['g'])

class Lines(BaseAtomicDataProperty):
class Lines(ProcessingPlasmaProperty):
"""
Outputs:
lines : Pandas DataFrame
Lines data needed for particular simulation
"""
outputs = ('lines', 'nu', 'f_lu', 'wavelength_cm')

def _filter_atomic_property(self, lines, selected_atoms):
return lines[lines.atomic_number.isin(selected_atoms)]

def _set_index(self, lines):
# Filtering process re-arranges the index. This re-orders it.
# It seems to be important that the lines stay indexed in the correct order
# so that the tau_sobolevs values are in the right order for the montecarlo
# code, or it returns the wrong answer.
try:
reindexed = lines.reindex(lines.index)
except:
reindexed = lines.reindex(lines.index)
lines = reindexed.dropna(subset=['atomic_number'])
return lines, lines['nu'], lines['f_lu'], lines['wavelength_cm']
def calculate(self, atomic_data):
return atomic_data.lines, atomic_data.lines.nu, atomic_data.lines.f_lu, atomic_data.lines.wavelength_cm

class LinesLowerLevelIndex(ProcessingPlasmaProperty):
"""
Expand Down

0 comments on commit ed7639a

Please sign in to comment.