def update_ui(co_wgt): if not co_wgt.hack: if co_wgt.current_gindex == 0: co_wgt.button_list[0].setEnabled(False) else: co_wgt.button_list[0].setEnabled(True) if co_wgt.current_gindex == len(co_wgt.gid_list) - 1: co_wgt.button_list[1].setEnabled(False) else: co_wgt.button_list[1].setEnabled(True) #TODO Either integrate this into utool or check if it's already there def extract_tuple(li, idx): return list(zip(*li)[idx]) # Update option setting, assume datetime has been updated co_wgt.combo_list[1].setCurrentIndex(extract_tuple(co_wgt.opt_list['year'], 1).index(co_wgt.dtime.year)) co_wgt.combo_list[3].setCurrentIndex(extract_tuple(co_wgt.opt_list['month'], 1).index(co_wgt.dtime.month)) co_wgt.combo_list[5].setCurrentIndex(extract_tuple(co_wgt.opt_list['day'], 1).index(co_wgt.dtime.day)) co_wgt.combo_list[7].setCurrentIndex(extract_tuple(co_wgt.opt_list['hour'], 1).index(co_wgt.dtime.hour)) co_wgt.combo_list[9].setCurrentIndex(extract_tuple(co_wgt.opt_list['minute'], 1).index(co_wgt.dtime.minute)) co_wgt.combo_list[11].setCurrentIndex(extract_tuple(co_wgt.opt_list['second'], 1).index(co_wgt.dtime.second)) # Redraw image if not co_wgt.hack: if co_wgt.imfig is not None: close_figure(co_wgt.imfig) image = co_wgt.ibs.get_images(co_wgt.gid_list[co_wgt.current_gindex]) figtitle = "Time Synchronization Picture" co_wgt.imfig, co_wgt.imax = imshow(image, fnum=co_wgt.fnum, title=figtitle) co_wgt.imfig.show()
def next_query_slot(self): """ callback used when all interactions are completed. Generates the next incremental query and then tries the automatic interactions """ try: # Generate the query result item = six.next(self.inc_query_gen) (ibs, cm, qreq_, incinfo) = item # update incinfo self.cm = cm self.qreq_ = qreq_ self.incinfo = incinfo incinfo['count'] += 1 automatch.run_until_name_decision_signal(ibs, cm, qreq_, incinfo=incinfo) #import plottool as pt #pt.present() except StopIteration: #TODO: close this figure # incinfo['fnum'] print('NO MORE QUERIES. CLOSE DOWN WINDOWS AND DISPLAY DONE MESSAGE') import plottool as pt fig1 = pt.figure(fnum=511) fig2 = pt.figure(fnum=512) pt.close_figure(fig1) pt.close_figure(fig2) if 'finish_callback' in self.incinfo: self.incinfo['update_callback']() if 'finish_callback' in self.incinfo: self.incinfo['finish_callback']() pass
def plot_annotaiton_gps(X_data): """ Plots gps coordinates on a map projection InstallBasemap: sudo apt-get install libgeos-dev pip install git+https://github.com/matplotlib/basemap Ignore: pip install git+git://github.com/myuser/foo.git@v123 """ import plottool as pt from mpl_toolkits.basemap import Basemap # lat = X_data[1:5, 1] # lon = X_data[1:5, 2] lat = X_data[:, 1] # NOQA lon = X_data[:, 2] # NOQA fnum = pt.ensure_fnum(None) fig = pt.figure(fnum=fnum, doclf=True, docla=True) # NOQA pt.close_figure(fig) fig = pt.figure(fnum=fnum, doclf=True, docla=True) # setup Lambert Conformal basemap. m = Basemap( llcrnrlon=lon.min(), urcrnrlon=lon.max(), llcrnrlat=lat.min(), urcrnrlat=lat.max(), projection="cea", resolution="h", ) # draw coastlines. # m.drawcoastlines() # m.drawstates() # draw a boundary around the map, fill the background. # this background will end up being the ocean color, since # the continents will be drawn on top. # m.bluemarble() m.drawmapboundary(fill_color="aqua") m.fillcontinents(color="coral", lake_color="aqua") # Convert GPS to projected coordinates x1, y1 = m(lon, lat) # convert to meters # lon==X, lat==Y m.plot(x1, y1, "o") fig.show()
def accept(co_wgt): # Calculate offset # Get current image's actual time image_time = co_wgt.ibs.get_image_unixtime( co_wgt.gid_list[co_wgt.current_gindex]) # Get unixtime from current dtime input_time = mktime(co_wgt.dtime.timetuple()) # Go through gid list, and add that offset to every unixtime offset = input_time - image_time print("[co_gui] Unixtime offset is %d" % offset) # Set the unixtimes with the new ones utimes = co_wgt.ibs.get_image_unixtime(co_wgt.gid_list) new_utimes = [time + offset for time in utimes] # SHOULD WE BE USING image_timedelta_posix INSTEAD OF THIS? co_wgt.ibs.set_image_unixtime(co_wgt.gid_list, new_utimes) # Close if not co_wgt.hack: pt.close_figure(co_wgt.imfig) co_wgt.close()
def accept(co_wgt): # Calculate offset # Get current image's actual time image_time = co_wgt.ibs.get_image_unixtime(co_wgt.gid_list[co_wgt.current_gindex]) # Get unixtime from current dtime #TODO put into utool input_time = mktime(co_wgt.dtime.timetuple()) # Go through gid list, and add that offset to every unixtime offset = input_time - image_time print("[co_gui] Unixtime offset is %d" % offset) # Set the unixtimes with the new ones utimes = co_wgt.ibs.get_image_unixtime(co_wgt.gid_list) new_utimes = [time + offset for time in utimes] # SHOULD WE BE USING image_timedelta_posix INSTEAD OF THIS? co_wgt.ibs.set_image_unixtime(co_wgt.gid_list, new_utimes) # Close if not co_wgt.hack: close_figure(co_wgt.imfig) co_wgt.close()
def next_query_slot(self): """ callback used when all interactions are completed. Generates the next incremental query and then tries the automatic interactions """ try: # Generate the query result item = six.next(self.inc_query_gen) (ibs, cm, qreq_, incinfo) = item # update incinfo self.cm = cm self.qreq_ = qreq_ self.incinfo = incinfo incinfo['count'] += 1 automatch.run_until_name_decision_signal(ibs, cm, qreq_, incinfo=incinfo) #import plottool as pt #pt.present() except StopIteration: #TODO: close this figure # incinfo['fnum'] print( 'NO MORE QUERIES. CLOSE DOWN WINDOWS AND DISPLAY DONE MESSAGE') import plottool as pt fig1 = pt.figure(fnum=511) fig2 = pt.figure(fnum=512) pt.close_figure(fig1) pt.close_figure(fig2) if 'finish_callback' in self.incinfo: self.incinfo['update_callback']() if 'finish_callback' in self.incinfo: self.incinfo['finish_callback']() pass
def cancel(co_wgt): # Just close pt.close_figure(co_wgt.imfig) co_wgt.close()
def cancel(co_wgt): # Just close close_figure(co_wgt.imfig) co_wgt.close()