From 0cae061f58523a2532c0f367d8591fa008b765f2 Mon Sep 17 00:00:00 2001 From: Stuart Sim Date: Tue, 3 Dec 2013 19:25:51 +0000 Subject: [PATCH] gui fix --- tardis/analysis.py | 11 +++++------ tardis/gui.py | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tardis/analysis.py b/tardis/analysis.py index 0bb480c2b87..e6e4d5b33c4 100644 --- a/tardis/analysis.py +++ b/tardis/analysis.py @@ -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 @@ -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]] @@ -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) \ No newline at end of file + montecarlo_nu, self.lines) diff --git a/tardis/gui.py b/tardis/gui.py index 514659fc696..0b55d3f382b 100644 --- a/tardis/gui.py +++ b/tardis/gui.py @@ -365,7 +365,6 @@ def on_species_clicked(self, index): - class LineInfo(QtGui.QDialog): def __init__(self, parent, wavelength_start, wavelength_end): @@ -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'))