Skip to content

Commit

Permalink
Merge pull request #61 from ssim/gui-fix
Browse files Browse the repository at this point in the history
gui fix
  • Loading branch information
ssim committed Dec 3, 2013
2 parents 98a6088 + 0cae061 commit e4f3406
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions tardis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ class LastLineInteraction(object):
@classmethod
def from_model(cls, model):
return cls(model.last_line_interaction_in_id, model.last_line_interaction_out_id,
model.last_line_interaction_shell_id, model.montecarlo_nu.value, model.atom_data.lines)
model.last_line_interaction_shell_id, model.last_line_interaction_angstrom, model.atom_data.lines)

def __init__(self, last_line_interaction_in_id, last_line_interaction_out_id, last_line_interaction_shell_id,
montecarlo_nu, lines, packet_filter_mode='packet_nu'):
last_line_interaction_angstrom, lines, packet_filter_mode='packet_nu'):
self.last_line_interaction_in_id = last_line_interaction_in_id
self.last_line_interaction_out_id = last_line_interaction_out_id
self.last_line_interaction_shell_id = last_line_interaction_shell_id
self.montecarlo_nu = montecarlo_nu * u.Hz
self.last_line_interaction_angstrom = self.montecarlo_nu[last_line_interaction_in_id != -1].to('angstrom',
u.spectral())
self.last_line_interaction_angstrom = last_line_interaction_angstrom
self.lines = lines

self._wavelength_start = 0 * u.angstrom
Expand Down Expand Up @@ -83,6 +81,7 @@ def update_last_interaction_filter(self):
packet_filter = (line_in_nu > self.wavelength_start.to(u.angstrom).value) & \
(line_in_nu < self.wavelength_end.to(u.angstrom).value)


self.last_line_in = self.lines.ix[self.last_line_interaction_in_id[packet_filter]]
self.last_line_out = self.lines.ix[self.last_line_interaction_out_id[packet_filter]]

Expand Down Expand Up @@ -352,4 +351,4 @@ def get_last_line_interaction(self, iteration=-1):
montecarlo_nu = hdf_store[model_string % 'montecarlo_nus'].values
hdf_store.close()
return LastLineInteraction(last_line_interaction_in_id, last_line_interaction_out_id, last_line_interaction_shell_id,
montecarlo_nu, self.lines)
montecarlo_nu, self.lines)
10 changes: 5 additions & 5 deletions tardis/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ def on_species_clicked(self, index):




class LineInfo(QtGui.QDialog):

def __init__(self, parent, wavelength_start, wavelength_end):
Expand All @@ -375,16 +374,17 @@ def __init__(self, parent, wavelength_start, wavelength_end):
self.setWindowTitle('Line Interaction: %.2f - %.2f (A) ' % (wavelength_start, wavelength_end,
))
self.layout = QtGui.QVBoxLayout()
packet_nu_line_interaction = analysis.LastLineInteraction(self.parent.model, packet_filter_mode="packet_nu")
packet_nu_line_interaction = analysis.LastLineInteraction.from_model(self.parent.model)
packet_nu_line_interaction.packet_filter_mode = 'packet_nu'
packet_nu_line_interaction.wavelength_start = wavelength_start * u.angstrom
packet_nu_line_interaction.wavelength_end = wavelength_end * u.angstrom

line_in_nu_line_interaction = analysis.LastLineInteraction(self.parent.model, packet_filter_mode="line_in_nu")

line_in_nu_line_interaction = analysis.LastLineInteraction.from_model(self.parent.model)
line_in_nu_line_interaction.packet_filter_mode = 'line_in_nu'
line_in_nu_line_interaction.wavelength_start = wavelength_start * u.angstrom
line_in_nu_line_interaction.wavelength_end = wavelength_end * u.angstrom



self.layout.addWidget(LineInteractionTables(packet_nu_line_interaction, self.parent.model.atom_data, 'filtered by frequency of packet'))
self.layout.addWidget(LineInteractionTables(line_in_nu_line_interaction, self.parent.model.atom_data, 'filtered by frequency of line interaction'))

Expand Down

0 comments on commit e4f3406

Please sign in to comment.