def update_response(self): """ Update the response plot """ speaker = VentedSpeaker(self.current_driver, self.current_box) freqs, amplitude = speaker.frequency_response() self.amplitude_line.set_xdata(freqs) self.amplitude_line.set_ydata(amplitude) manufacturer = self.current_driver.manufacturer model = self.current_driver.model box_volume = 1e3*self.current_box.Vab box_tuning = self.current_box.fb label = '{0} {1} in {2:2g}l / {3}Hz'.format( manufacturer, model, box_volume, box_tuning) self.amplitude_line.set_label(label) self.amplitude_axes.legend(loc='lower right') self.canvas.draw()
def add_new_response(self): """ Add an additional response to the plot """ speaker = VentedSpeaker(self.current_driver, self.current_box) freqs, amplitude = speaker.frequency_response() self.amplitude_line, = self.amplitude_axes.semilogx( freqs, amplitude) manufacturer = self.current_driver.manufacturer model = self.current_driver.model box_volume = 1e3*self.current_box.Vab box_tuning = self.current_box.fb label = '{0} {1} in {2:2g}l / {3}Hz'.format( manufacturer, model, box_volume, box_tuning) self.amplitude_line.set_label(label) self.amplitude_axes.legend(loc='lower right') self.set_plot_options() self.canvas.draw()