[add] finished remove picks feature, testing needed
This commit is contained in:
parent
dbb3fab6d0
commit
37875d5c87
@ -1751,7 +1751,7 @@ class MainWindow(QMainWindow):
|
||||
autopicks=self.getPicksOnStation(station, 'auto'))
|
||||
pickDlg.nextStation.setChecked(nextStation)
|
||||
if pickDlg.exec_():
|
||||
if pickDlg.getPicks():
|
||||
if pickDlg._dirty:
|
||||
self.setDirty(True)
|
||||
self.update_status('picks accepted ({0})'.format(station))
|
||||
replot = self.addPicks(station, pickDlg.getPicks())
|
||||
@ -1864,12 +1864,12 @@ class MainWindow(QMainWindow):
|
||||
|
||||
def addPicks(self, station, picks, type='manual'):
|
||||
stat_picks = self.getPicksOnStation(station, type)
|
||||
if not stat_picks:
|
||||
if not stat_picks and picks:
|
||||
rval = False
|
||||
else:
|
||||
# set picks (ugly syntax?)
|
||||
self.getPicks(type=type)[station] = picks
|
||||
rval = True
|
||||
# set picks (ugly syntax?)
|
||||
self.getPicks(type=type)[station] = picks
|
||||
return rval
|
||||
# if not stat_picks:
|
||||
# stat_picks = picks
|
||||
|
@ -1 +1 @@
|
||||
1918-dirty
|
||||
dbb3-dirty
|
||||
|
@ -83,6 +83,11 @@ class Event(ObsPyEvent):
|
||||
def setPick(self, station, pick):
|
||||
if pick:
|
||||
self.pylot_picks[station] = pick
|
||||
else:
|
||||
try:
|
||||
self.pylot_picks.pop(station)
|
||||
except Exception as e:
|
||||
print('Could not remove pick {} from station {}: {}'.format(pick, station, e))
|
||||
self.picks = picks_from_picksdict(self.pylot_picks)
|
||||
|
||||
def setPicks(self, picks):
|
||||
|
@ -370,7 +370,7 @@ def key_for_set_value(d):
|
||||
return r
|
||||
|
||||
|
||||
def prepTimeAxis(stime, trace):
|
||||
def prepTimeAxis(stime, trace, verbosity=0):
|
||||
'''
|
||||
takes a starttime and a trace object and returns a valid time axis for
|
||||
plotting
|
||||
@ -384,16 +384,18 @@ def prepTimeAxis(stime, trace):
|
||||
etime = stime + nsamp / srate
|
||||
time_ax = np.arange(stime, etime, tincr)
|
||||
if len(time_ax) < nsamp:
|
||||
print('elongate time axes by one datum')
|
||||
if verbosity:
|
||||
print('elongate time axes by one datum')
|
||||
time_ax = np.arange(stime, etime + tincr, tincr)
|
||||
elif len(time_ax) > nsamp:
|
||||
print('shorten time axes by one datum')
|
||||
if verbosity:
|
||||
print('shorten time axes by one datum')
|
||||
time_ax = np.arange(stime, etime - tincr, tincr)
|
||||
if len(time_ax) != nsamp:
|
||||
print('Station {0}, {1} samples of data \n '
|
||||
'{2} length of time vector \n'
|
||||
'delta: {3}'.format(trace.stats.station,
|
||||
nsamp, len(time_ax), tincr))
|
||||
'{2} length of time vector \n'
|
||||
'delta: {3}'.format(trace.stats.station,
|
||||
nsamp, len(time_ax), tincr))
|
||||
time_ax = None
|
||||
return time_ax
|
||||
|
||||
|
@ -753,6 +753,7 @@ class PickDlg(QDialog):
|
||||
settings = QSettings()
|
||||
pylot_user = getpass.getuser()
|
||||
self._user = settings.value('user/Login', pylot_user)
|
||||
self._dirty = False
|
||||
if picks:
|
||||
self.picks = picks
|
||||
self._init_picks = copy.deepcopy(picks)
|
||||
@ -952,6 +953,9 @@ class PickDlg(QDialog):
|
||||
self.setLayout(_outerlayout)
|
||||
self.resize(1280, 720)
|
||||
|
||||
def setDirty(self, bool):
|
||||
self._dirty = bool
|
||||
|
||||
def get_arrivals(self):
|
||||
phases = self.prepare_phases()
|
||||
station_id = self.data.traces[0].get_id()
|
||||
@ -1558,6 +1562,7 @@ class PickDlg(QDialog):
|
||||
self.zoomAction.setEnabled(True)
|
||||
self.pick_block = self.togglePickBlocker()
|
||||
self.leave_picking_mode()
|
||||
self.setDirty(True)
|
||||
|
||||
def drawAllPicks(self):
|
||||
self.removePhaseText()
|
||||
@ -1654,6 +1659,7 @@ class PickDlg(QDialog):
|
||||
# information output
|
||||
msg = 'Deleted pick for phase {}, {}[s] from starttime {}'
|
||||
print(msg.format(phase, pick_rel, starttime))
|
||||
self.setDirty(True)
|
||||
|
||||
def drawPhaseText(self):
|
||||
return self.drawPicks(picktype='manual', textOnly=True)
|
||||
|
Loading…
Reference in New Issue
Block a user