def test_plotter(self): m = Model() m.use_default_mdl_params() m.use_test_sed_params(TestSediments.COARSE_SAND) plotter = ModelPlotter(mdl=m) plotter.plot()
def compare(self, use_300k: bool = False): root_folder = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)) testing = Testing(root_folder=root_folder) input_folder = testing.input_data_folder() jackson2_folder = os.path.join(input_folder, "jackson2") if use_300k: folder_freq = os.path.join(jackson2_folder, "300k") else: folder_freq = os.path.join(jackson2_folder, "20k") for sediment in TestSediments: mdl = Model() mdl.use_test_sed_params(sediment) mdl.use_default_mdl_params() if use_300k: mdl.mdl_params.f = 300000 mdl.run() mat_folder = os.path.join(folder_freq, str(sediment).split('.')[-1].lower()) mat_files = Testing.files(mat_folder, ext='.mat') mat_out = ModelOutput() for mat_file in mat_files: if "theta_g" in mat_file: mat_out.theta_g = scipy.io.loadmat(mat_file)['thetg'].flatten() self.assertTrue(np.isclose(mat_out.theta_g, mdl.out.theta_g).all()) elif "ss_tot" in mat_file: mat_out.ss_tot = scipy.io.loadmat(mat_file)['sstot'].flatten() self.assertTrue(np.isclose(mat_out.ss_tot, mdl.out.ss_tot).all()) elif "ss_rough" in mat_file: mat_out.ss_rough = scipy.io.loadmat(mat_file)['ssrough'].flatten() self.assertTrue(np.isclose(mat_out.ss_rough, mdl.out.ss_rough).all()) elif "ss_vol" in mat_file: mat_out.ss_vol = scipy.io.loadmat(mat_file)['ssvol'].flatten() self.assertTrue(np.isclose(mat_out.ss_vol, mdl.out.ss_vol).all()) elif "ref_loss" in mat_file: mat_out.ref_loss = scipy.io.loadmat(mat_file)['refloss'].flatten() self.assertTrue(np.isclose(mat_out.ref_loss, mdl.out.ref_loss).all())
def test__init__(self): _ = Model()
def test_run(self): m = Model() with self.assertRaises(RuntimeError): m.run() m.use_default_mdl_params() with self.assertRaises(RuntimeError): m.run() m.use_test_sed_params(TestSediments.COARSE_SAND) m.run()
def __init__(self, main_win, plot_params: Optional[PlotParams] = None): super().__init__(parent=main_win) if plot_params is None: self._pp = PlotParams() # plot parameters else: self._pp = plot_params self.jm2 = Model() self.jm2.use_test_sed_params(TestSediments.COARSE_SAND) self.jm2.use_default_mdl_params() self.setWindowTitle("Arch Tab") self.settings = QtCore.QSettings() self.main_win = main_win self.progress = QtProgress(parent=self) self.setContentsMargins(0, 0, 0, 0) canvas_frame = QtWidgets.QFrame(self) self.layout = QtWidgets.QVBoxLayout() canvas_frame.setLayout(self.layout) with rc_context(app_info.plot_rc_context): self.f = Figure() self.f.patch.set_alpha(0.0) self.c = FigureCanvas(self.f) self.c.setParent(self) # noinspection PyUnresolvedReferences self.c.setFocusPolicy( QtCore.Qt.ClickFocus) # key for press events!!! self.c.setFocus() self.layout.addWidget(self.c) # axes gs = gridspec.GridSpec(3, 3) self.up_ax = self.f.add_subplot(gs[0:2, :]) self.down_ax = self.f.add_subplot(gs[2, :]) # navigation self.nav = NavToolbar(canvas=self.c, parent=self) self.layout.addWidget(self.nav) self.setCentralWidget(canvas_frame) settings_dock = QtWidgets.QDockWidget("Settings") settings_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable) settings_dock.setMinimumWidth(200) settings_dock.setMaximumWidth(400) settings_frame = QtWidgets.QWidget() settings_dock.setWidget(settings_frame) self.process_layout = QtWidgets.QVBoxLayout() settings_frame.setLayout(self.process_layout) # sediment seds_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_label_layout) seds_label_layout.addStretch() seds_label = QtWidgets.QLabel("Sediment Type") seds_label_layout.addWidget(seds_label) seds_label_layout.addStretch() seds_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_layout) seds_layout.addStretch() self.seds = dict() for sed in TestSediments: self.seds[test_params[sed].name] = sed self.seds_list = QtWidgets.QComboBox() self.seds_list.addItems(list(self.seds.keys())) self.seds_list.setCurrentText( test_params[TestSediments.COARSE_SAND].name) # noinspection PyUnresolvedReferences self.seds_list.currentTextChanged.connect(self.on_draw) seds_layout.addWidget(self.seds_list) seds_layout.addStretch() # frequency freq_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_label_layout) freq_label_layout.addStretch() self.freq_label = QtWidgets.QLabel("Frequency [%.1f kHz]" % (self.jm2.mdl_params.f / 1000)) freq_label_layout.addWidget(self.freq_label) freq_label_layout.addStretch() freq_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_layout) freq_layout.addStretch() self.freq_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.freq_slider.setMinimumWidth(160) self.freq_slider.setMinimum(1) self.freq_slider.setMaximum(500) self.freq_slider.setTickInterval(1) self.freq_slider.setValue(self.jm2.mdl_params.f / 1000) # noinspection PyUnresolvedReferences self.freq_slider.valueChanged.connect(self.on_draw) freq_layout.addWidget(self.freq_slider) freq_layout.addStretch() self.process_layout.addSpacing(12) redraw_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(redraw_layout) redraw_layout.addStretch() redraw_btn = QtWidgets.QPushButton("Redraw") # noinspection PyUnresolvedReferences redraw_btn.clicked.connect(self.on_draw) redraw_layout.addWidget(redraw_btn) redraw_layout.addStretch() self.process_layout.addStretch() self.addDockWidget(QtCore.Qt.RightDockWidgetArea, settings_dock) self.on_draw()
class ArchTab(QtWidgets.QMainWindow): color_tot = '#57a3e5' color_rough = '#1f8e44' color_vol = '#8c0c54' color_loss = '#f99a25' color_grid = '#dddddd' color_comp = '#CC0000' def __init__(self, main_win, plot_params: Optional[PlotParams] = None): super().__init__(parent=main_win) if plot_params is None: self._pp = PlotParams() # plot parameters else: self._pp = plot_params self.jm2 = Model() self.jm2.use_test_sed_params(TestSediments.COARSE_SAND) self.jm2.use_default_mdl_params() self.setWindowTitle("Arch Tab") self.settings = QtCore.QSettings() self.main_win = main_win self.progress = QtProgress(parent=self) self.setContentsMargins(0, 0, 0, 0) canvas_frame = QtWidgets.QFrame(self) self.layout = QtWidgets.QVBoxLayout() canvas_frame.setLayout(self.layout) with rc_context(app_info.plot_rc_context): self.f = Figure() self.f.patch.set_alpha(0.0) self.c = FigureCanvas(self.f) self.c.setParent(self) # noinspection PyUnresolvedReferences self.c.setFocusPolicy( QtCore.Qt.ClickFocus) # key for press events!!! self.c.setFocus() self.layout.addWidget(self.c) # axes gs = gridspec.GridSpec(3, 3) self.up_ax = self.f.add_subplot(gs[0:2, :]) self.down_ax = self.f.add_subplot(gs[2, :]) # navigation self.nav = NavToolbar(canvas=self.c, parent=self) self.layout.addWidget(self.nav) self.setCentralWidget(canvas_frame) settings_dock = QtWidgets.QDockWidget("Settings") settings_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable) settings_dock.setMinimumWidth(200) settings_dock.setMaximumWidth(400) settings_frame = QtWidgets.QWidget() settings_dock.setWidget(settings_frame) self.process_layout = QtWidgets.QVBoxLayout() settings_frame.setLayout(self.process_layout) # sediment seds_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_label_layout) seds_label_layout.addStretch() seds_label = QtWidgets.QLabel("Sediment Type") seds_label_layout.addWidget(seds_label) seds_label_layout.addStretch() seds_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_layout) seds_layout.addStretch() self.seds = dict() for sed in TestSediments: self.seds[test_params[sed].name] = sed self.seds_list = QtWidgets.QComboBox() self.seds_list.addItems(list(self.seds.keys())) self.seds_list.setCurrentText( test_params[TestSediments.COARSE_SAND].name) # noinspection PyUnresolvedReferences self.seds_list.currentTextChanged.connect(self.on_draw) seds_layout.addWidget(self.seds_list) seds_layout.addStretch() # frequency freq_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_label_layout) freq_label_layout.addStretch() self.freq_label = QtWidgets.QLabel("Frequency [%.1f kHz]" % (self.jm2.mdl_params.f / 1000)) freq_label_layout.addWidget(self.freq_label) freq_label_layout.addStretch() freq_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_layout) freq_layout.addStretch() self.freq_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.freq_slider.setMinimumWidth(160) self.freq_slider.setMinimum(1) self.freq_slider.setMaximum(500) self.freq_slider.setTickInterval(1) self.freq_slider.setValue(self.jm2.mdl_params.f / 1000) # noinspection PyUnresolvedReferences self.freq_slider.valueChanged.connect(self.on_draw) freq_layout.addWidget(self.freq_slider) freq_layout.addStretch() self.process_layout.addSpacing(12) redraw_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(redraw_layout) redraw_layout.addStretch() redraw_btn = QtWidgets.QPushButton("Redraw") # noinspection PyUnresolvedReferences redraw_btn.clicked.connect(self.on_draw) redraw_layout.addWidget(redraw_btn) redraw_layout.addStretch() self.process_layout.addStretch() self.addDockWidget(QtCore.Qt.RightDockWidgetArea, settings_dock) self.on_draw() @property def plt_params(self): return self._pp @plt_params.setter def plt_params(self, params): if not isinstance(params, PlotParams): raise Exception("invalid type for passed Plot Parameters: %s" % type(params)) self._pp = params def on_draw(self): logger.debug("redraw") cur_sed = self.seds_list.currentText() cur_freq_khz = self.freq_slider.value() self.jm2.mdl_params.f = cur_freq_khz * 1000 self.jm2.use_test_sed_params(self.seds[cur_sed]) self.jm2.run() self.freq_label.setText("Frequency [%.1f kHz]" % (cur_freq_khz, )) self.up_ax.clear() self.down_ax.clear() with rc_context(app_info.plot_rc_context): self.f.suptitle( "APL-UW Elastic Scattering Model v.2017 - %s - %.1f kHz" % (cur_sed, cur_freq_khz)) self.up_ax.plot(self.jm2.out.theta_i, self.jm2.out.ss_tot, color=self.color_tot, linestyle='-', label="Total SS") self.up_ax.plot(self.jm2.out.theta_i, self.jm2.out.ss_rough, color=self.color_rough, linestyle='--', label="Roughness-only SS") self.up_ax.plot(self.jm2.out.theta_i, self.jm2.out.ss_vol, color=self.color_vol, linestyle=':', label="Volume-only SS") self.up_ax.set_xlim(0.0, 90.0) self.up_ax.set_ylim(self._pp.db_min, self._pp.db_max) self.up_ax.legend() self.up_ax.grid(color=self.color_grid) # self.up_ax.set_xticklabels([]) # self.up_ax.set_xlabel('Incidence Angle [deg]') self.up_ax.set_ylabel('Scattering Strength [dB]') self.down_ax.plot(self.jm2.out.theta_i, self.jm2.out.ref_loss, color=self.color_loss, linestyle='-', label="Model") self.down_ax.set_xlim(0.0, 90.0) self.down_ax.set_ylim(0.0, 50.0) # self.down_ax.legend() self.down_ax.grid(color=self.color_grid) self.down_ax.set_xlabel('Incidence Angle [deg]') self.down_ax.set_ylabel('Reflection Loss [dB]') self.c.draw() def redraw(self): """Redraw the canvases, update the locators""" with rc_context(app_info.plot_rc_context): for a in self.c.figure.get_axes(): xaxis = getattr(a, 'xaxis', None) yaxis = getattr(a, 'yaxis', None) locators = [] if xaxis is not None: locators.append(xaxis.get_major_locator()) locators.append(xaxis.get_minor_locator()) if yaxis is not None: locators.append(yaxis.get_major_locator()) locators.append(yaxis.get_minor_locator()) for loc in locators: loc.refresh() self.c.draw_idle() # ### ICON SIZE ### def toolbars_icon_size(self) -> int: return self.file_products_bar.iconSize().height() def set_toolbars_icon_size(self, icon_size: int) -> None: # self.file_products_bar.setIconSize(QtCore.QSize(icon_size, icon_size)) pass
root_folder = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir)) testing = Testing(root_folder=root_folder) input_folder = testing.input_data_folder() jackson2_folder = os.path.join(input_folder, "jackson2") if use_300k: folder_freq = os.path.join(jackson2_folder, "300k") else: folder_freq = os.path.join(jackson2_folder, "20k") logger.debug("mat folder: %s" % folder_freq) plt = None for sediment in TestSediments: mdl = Model() mdl.use_test_sed_params(sediment) mdl.use_default_mdl_params() if use_300k: mdl.mdl_params.f = 300000 mdl.run() logger.debug("theta_g: %s" % (mdl.out.theta_g.shape, )) mat_folder = os.path.join(folder_freq, str(sediment).split('.')[-1].lower()) logger.debug("mat folder: %s" % mat_folder) mat_files = Testing.files(mat_folder, ext='.mat') logger.debug("mat files: %d" % len(mat_files)) mat_out = ModelOutput()
class ArchTab3D(QtWidgets.QMainWindow): color_grid = '#dddddd' color_tot = '#0101ff' def __init__(self, main_win, plot_params: Optional[PlotParams] = None): super().__init__(parent=main_win) if plot_params is None: self._pp = PlotParams() # plot parameters else: self._pp = plot_params self.jm2 = Model() self.jm2.use_test_sed_params(TestSediments.COARSE_SAND) self.jm2.use_default_mdl_params() self.setWindowTitle("Arch Tab 3D") self.settings = QtCore.QSettings() self.main_win = main_win self.progress = QtProgress(parent=self) self.setContentsMargins(0, 0, 0, 0) canvas_frame = QtWidgets.QFrame(self) self.layout = QtWidgets.QVBoxLayout() canvas_frame.setLayout(self.layout) with rc_context(app_info.plot_rc_context): self.f = Figure() self.f.patch.set_alpha(0.0) self.c = FigureCanvas(self.f) self.c.setParent(self) # noinspection PyUnresolvedReferences self.c.setFocusPolicy( QtCore.Qt.ClickFocus) # key for press events!!! self.c.setFocus() self.layout.addWidget(self.c) # axes self.up_ax = self.f.add_subplot(111, projection='3d') # navigation self.nav = NavToolbar(canvas=self.c, parent=self) self.layout.addWidget(self.nav) self.setCentralWidget(canvas_frame) settings_dock = QtWidgets.QDockWidget("Settings") settings_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable) settings_dock.setMinimumWidth(200) settings_dock.setMaximumWidth(400) settings_frame = QtWidgets.QWidget() settings_dock.setWidget(settings_frame) self.process_layout = QtWidgets.QVBoxLayout() settings_frame.setLayout(self.process_layout) # sediment seds_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_label_layout) seds_label_layout.addStretch() seds_label = QtWidgets.QLabel("Sediment Type") seds_label_layout.addWidget(seds_label) seds_label_layout.addStretch() seds_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(seds_layout) seds_layout.addStretch() self.seds = dict() for sed in TestSediments: self.seds[test_params[sed].name] = sed self.seds_list = QtWidgets.QComboBox() self.seds_list.addItems(list(self.seds.keys())) self.seds_list.setCurrentText( test_params[TestSediments.COARSE_SAND].name) # noinspection PyUnresolvedReferences self.seds_list.currentTextChanged.connect(self.on_draw) seds_layout.addWidget(self.seds_list) seds_layout.addStretch() # frequency freq_label_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_label_layout) freq_label_layout.addStretch() self.freq_label = QtWidgets.QLabel("Frequency [%.1f kHz]" % (self.jm2.mdl_params.f / 1000)) freq_label_layout.addWidget(self.freq_label) freq_label_layout.addStretch() freq_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(freq_layout) freq_layout.addStretch() self.freq_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.freq_slider.setMinimumWidth(160) self.freq_slider.setMinimum(1) self.freq_slider.setMaximum(500) self.freq_slider.setTickInterval(1) self.freq_slider.setValue(self.jm2.mdl_params.f / 1000) # noinspection PyUnresolvedReferences self.freq_slider.valueChanged.connect(self.on_draw) freq_layout.addWidget(self.freq_slider) freq_layout.addStretch() # spectral SS spectral_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(spectral_layout) spectral_layout.addStretch() self.spectral_cb = QtWidgets.QCheckBox('Spectral SS') self.spectral_cb.setChecked(True) # noinspection PyUnresolvedReferences self.spectral_cb.stateChanged.connect(self.on_draw) spectral_layout.addWidget(self.spectral_cb) spectral_layout.addStretch() self.process_layout.addSpacing(12) redraw_layout = QtWidgets.QHBoxLayout() self.process_layout.addLayout(redraw_layout) redraw_layout.addStretch() redraw_btn = QtWidgets.QPushButton("Redraw") # noinspection PyUnresolvedReferences redraw_btn.clicked.connect(self.on_draw) redraw_layout.addWidget(redraw_btn) redraw_layout.addStretch() self.process_layout.addStretch() self.addDockWidget(QtCore.Qt.RightDockWidgetArea, settings_dock) self._last_sed = str() self._ss = None self.on_draw() @property def plt_params(self): return self._pp @plt_params.setter def plt_params(self, params): if not isinstance(params, PlotParams): raise Exception("invalid type for passed Plot Parameters: %s" % type(params)) self._pp = params def on_draw(self): logger.debug("redraw") cur_sed = self.seds_list.currentText() cur_freq_khz = self.freq_slider.value() plot_spectral = self.spectral_cb.isChecked() self.jm2.use_test_sed_params(self.seds[cur_sed]) self.jm2.mdl_params.f = cur_freq_khz * 1000 self.jm2.run() self.freq_label.setText("Frequency [%.1f kHz]" % (self.jm2.mdl_params.f / 1000)) self.up_ax.clear() freqs_khz = [ 1.0, 3.0, 5.0, 10.0, 15.0, 20.0, 30.0, 50.0, 75.0, 100.0, 130.0, 160.0, 200.0, 250.0, 300.0, 350.0, 400.0, 450.0, 500.0 ] thetas = self.jm2.out.theta_i x, y = np.meshgrid(thetas, freqs_khz) if (self._last_sed != cur_sed) and (plot_spectral): logger.debug("recalculating thetas, freqs, and ss ...") self._ss = np.full((len(freqs_khz), thetas.size), np.nan) for i, f_khz in enumerate(freqs_khz): jm2 = Model() jm2.use_test_sed_params(self.seds[cur_sed]) jm2.use_default_mdl_params() jm2.mdl_params.f = f_khz * 1000 jm2.run() for j, theta in enumerate(range(jm2.out.theta_i.size)): self._ss[i, j] = jm2.out.ss_tot[j] self._last_sed = cur_sed logger.debug("recalculating thetas, freqs, and ss: DONE") with rc_context(app_info.plot_rc_context): self.f.suptitle( "APL-UW Elastic Scattering Model v.2017 - %s - %.1f kHz" % (self.jm2.sed_params.name, cur_freq_khz)) if (self._ss is not None) and plot_spectral: ls = LightSource(135, 40) rgb = ls.shade(self._ss, cmap=cm.autumn, vert_exag=3.0, blend_mode='soft') self.up_ax.plot_surface(x, y, self._ss, rstride=1, cstride=1, alpha=0.4, cmap='Greys', edgecolor='none', shade=False, facecolors=rgb, label='Spectral SS') self.jm2.out.ss_tot += 0.2 freqs_khz = np.full_like(self.jm2.out.ss_tot, self.freq_slider.value()) self.up_ax.plot(self.jm2.out.theta_i, freqs_khz, self.jm2.out.ss_tot, color=self.color_tot, linestyle='-', linewidth=2.0, label="SS at %.1f kHz" % cur_freq_khz) self.up_ax.set_xlim(0.0, 90.0) self.up_ax.set_ylim(1.0, 500.0) self.up_ax.set_zlim(self._pp.db_min, self._pp.db_max) self.up_ax.grid(color=self.color_grid) self.up_ax.set_xlabel('Incidence Angle [deg]') self.up_ax.set_ylabel('Frequency [kHz]') self.up_ax.set_zlabel('Scattering Strength [dB]') # self.up_ax.legend() self.c.draw() def redraw(self): """Redraw the canvases, update the locators""" with rc_context(app_info.plot_rc_context): for a in self.c.figure.get_axes(): xaxis = getattr(a, 'xaxis', None) yaxis = getattr(a, 'yaxis', None) locators = [] if xaxis is not None: locators.append(xaxis.get_major_locator()) locators.append(xaxis.get_minor_locator()) if yaxis is not None: locators.append(yaxis.get_major_locator()) locators.append(yaxis.get_minor_locator()) for loc in locators: loc.refresh() self.c.draw_idle() # ### ICON SIZE ### def toolbars_icon_size(self) -> int: return self.file_products_bar.iconSize().height() def set_toolbars_icon_size(self, icon_size: int) -> None: # self.file_products_bar.setIconSize(QtCore.QSize(icon_size, icon_size)) pass
def on_draw(self): logger.debug("redraw") cur_sed = self.seds_list.currentText() cur_freq_khz = self.freq_slider.value() plot_spectral = self.spectral_cb.isChecked() self.jm2.use_test_sed_params(self.seds[cur_sed]) self.jm2.mdl_params.f = cur_freq_khz * 1000 self.jm2.run() self.freq_label.setText("Frequency [%.1f kHz]" % (self.jm2.mdl_params.f / 1000)) self.up_ax.clear() freqs_khz = [ 1.0, 3.0, 5.0, 10.0, 15.0, 20.0, 30.0, 50.0, 75.0, 100.0, 130.0, 160.0, 200.0, 250.0, 300.0, 350.0, 400.0, 450.0, 500.0 ] thetas = self.jm2.out.theta_i x, y = np.meshgrid(thetas, freqs_khz) if (self._last_sed != cur_sed) and (plot_spectral): logger.debug("recalculating thetas, freqs, and ss ...") self._ss = np.full((len(freqs_khz), thetas.size), np.nan) for i, f_khz in enumerate(freqs_khz): jm2 = Model() jm2.use_test_sed_params(self.seds[cur_sed]) jm2.use_default_mdl_params() jm2.mdl_params.f = f_khz * 1000 jm2.run() for j, theta in enumerate(range(jm2.out.theta_i.size)): self._ss[i, j] = jm2.out.ss_tot[j] self._last_sed = cur_sed logger.debug("recalculating thetas, freqs, and ss: DONE") with rc_context(app_info.plot_rc_context): self.f.suptitle( "APL-UW Elastic Scattering Model v.2017 - %s - %.1f kHz" % (self.jm2.sed_params.name, cur_freq_khz)) if (self._ss is not None) and plot_spectral: ls = LightSource(135, 40) rgb = ls.shade(self._ss, cmap=cm.autumn, vert_exag=3.0, blend_mode='soft') self.up_ax.plot_surface(x, y, self._ss, rstride=1, cstride=1, alpha=0.4, cmap='Greys', edgecolor='none', shade=False, facecolors=rgb, label='Spectral SS') self.jm2.out.ss_tot += 0.2 freqs_khz = np.full_like(self.jm2.out.ss_tot, self.freq_slider.value()) self.up_ax.plot(self.jm2.out.theta_i, freqs_khz, self.jm2.out.ss_tot, color=self.color_tot, linestyle='-', linewidth=2.0, label="SS at %.1f kHz" % cur_freq_khz) self.up_ax.set_xlim(0.0, 90.0) self.up_ax.set_ylim(1.0, 500.0) self.up_ax.set_zlim(self._pp.db_min, self._pp.db_max) self.up_ax.grid(color=self.color_grid) self.up_ax.set_xlabel('Incidence Angle [deg]') self.up_ax.set_ylabel('Frequency [kHz]') self.up_ax.set_zlabel('Scattering Strength [dB]') # self.up_ax.legend() self.c.draw()