Minor bug fixes. Fixes #16

This commit is contained in:
Kaan Cökerim 2021-08-12 14:24:05 +02:00
parent ca56139922
commit a738dc57ec
3 changed files with 9 additions and 18 deletions

View File

@ -104,8 +104,6 @@ class Array_map(QtWidgets.QWidget):
self.plotWidget = FigureCanvas(self.canvas.fig)
else:
self.canvas = MplCanvas(self, extern_axes=self.extern_plot_axes)
#self.canvas.axes = self.extern_plot_axes
#self.canvas.fig = self.extern_plot_axes.figure
self.plotWidget = FigureCanvas(self.canvas.fig)
# initialize GUI elements
@ -153,9 +151,7 @@ class Array_map(QtWidgets.QWidget):
self.top_row.addWidget(self.refresh_button)
self.main_box.addWidget(self.plotWidget, 1)
# self.main_box.addWidget(self.map_reset_button, 0)
# self.main_box.addWidget(NavigationToolbar(self.plotWidget, self), 0)
# self.main_box.addWidget(self.status_label, 0)
self.bot_row = QtWidgets.QHBoxLayout()
self.main_box.addLayout(self.bot_row, 0.3)
@ -163,7 +159,6 @@ class Array_map(QtWidgets.QWidget):
self.bot_row.addWidget(self.go2eq_button)
self.bot_row.addWidget(self.save_map_button)
self.bot_row.addWidget(self.status_label)
# self.connectSignals()
def init_colormap(self):
self.init_lat_lon_dimensions()
@ -187,7 +182,7 @@ class Array_map(QtWidgets.QWidget):
# self.plotWidget.draw_idle()
def add_merid_paral(self):
self.gridlines = self.canvas.axes.gridlines(draw_labels=False, alpha=0.8, color='dimgray', linewidth=self.linewidth, zorder=7)
self.gridlines = self.canvas.axes.gridlines(draw_labels=False, alpha=0.8, color='gray', linewidth=self.linewidth/2, zorder=7)
# current cartopy version does not support label removal. Devs are working on it.
# Should be fixed with next cartopy version
# self.gridlines.xformatter = LONGITUDE_FORMATTER
@ -526,22 +521,18 @@ class Array_map(QtWidgets.QWidget):
print(message, e)
print(traceback.format_exc())
def draw_contour_filled(self, nlevel=100):
# self.test_gradient()
def draw_contour_filled(self, nlevel=50):
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
self.contourf = self.canvas.axes.contourf(self.longrid, self.latgrid, self.picksgrid_active, levels,
linewidths=self.linewidth, transform=ccrs.PlateCarree(),
alpha=0.7, zorder=8, cmap=self.get_colormap())
linewidths=self.linewidth*4, transform=ccrs.PlateCarree(),
alpha=0.4, zorder=8, cmap=self.get_colormap())
def get_colormap(self):
return plt.get_cmap(self.cmaps_box.currentText())
def scatter_all_stations(self):
stations, lats, lons = self.get_st_lat_lon_for_plot()
# self.sc = self.basemap.scatter(lons, lats, s=self.pointsize, facecolor='none', latlon=True, marker='.',
# zorder=10, picker=True, edgecolor='0.5', label='Not Picked')
self.sc = self.canvas.axes.scatter(lons, lats, s=self.pointsize * 3, facecolor='none', marker='.',
zorder=10, picker=True, edgecolor='0.5', label='Not Picked',
@ -593,6 +584,7 @@ class Array_map(QtWidgets.QWidget):
linewidth=self.pointsize / 15., foreground='k')]))
self.legend = self.canvas.axes.legend(loc=1, framealpha=1)
self.legend.set_zorder(100)
self.legend.get_frame().set_facecolor((1, 1, 1, 0.95))
def add_cbar(self, label):

View File

@ -79,11 +79,9 @@ if __name__ == '__main__':
cl = argparse.ArgumentParser()
cl.add_argument('--dataroot', help='Directory containing the PyLoT .plp file', type=str)
cl.add_argument('--infiles', help='.plp files to use', nargs='+')
cl.add_argument('--ncores', hepl='Specify number of parallel processes', type=int, default=1)
args = cl.parse_args()
#dataroot = '/home/kaan/master_thesis/waveformData/dmt_dir_proj'
#infiles = ['mag_8_sym_proj.plp']
for infile in args.infiles:
main(os.path.join(args.dataroot, infile), f_ext='_correlated_0.03-0.1', ncores=1)
# main('E:\Shared\AlpArray\\test_aa.plp', f_ext='_correlated_0.5Hz', ncores=1)
# main('/home/marcel/alparray_m6.5-6.9_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz')
main(os.path.join(args.dataroot, infile), f_ext='_correlated_0.03-0.1', ncores=args.ncores)

View File

@ -1988,6 +1988,7 @@ class PickDlg(QDialog):
settings = QtCore.QSettings()
p_phases = settings.value('p_phases')
s_phases = settings.value('s_phases')
phases = ''
if not p_phases and not s_phases:
print('No phases for TauPy selected in Preferences.')
if p_phases and s_phases: