def main(): go = GoniometerObject() #print(go.sample_angle) go.roll_angle = 15 go.done_moving(go.ROLL) print("done") go.BP.reset_all()
def main(): go = GoniometerObject() #print(go.led_angle) go.scatter_angle = -5 go.done_moving(go.SCATTER) print("done") go.BP.reset_all()
def main(): angle = 2 go = GoniometerObject() print(go.stage_angle) print(go.angle_2_motorpos(angle, go.STAGE)) go.stage_angle = angle print(go.stage_angle) print("done stage\n") print(go.sample_angle) print(go.angle_2_motorpos(angle, go.SAMPLE)) go.sample_angle = angle print(go.sample_angle) print("done sample\n") print(go.led_angle) go.led_angle = -5 print(go.led_angle)
def consumer_thread(self, stop): # print("in thread") temp = 0 while not stop(): start_time = time.time() temp += 1 #print("stop is {}".format(stop())) i = 0 images = [] if self.measuring_label["text"]: if self.protocol_nbr_rows is None: print("START MEASURING") self.controller.bc.copy_nodemap() self.protocol = GoniometerObject.read_csv( self.protocol_filename) self.go = GoniometerObject() self.protocol_nbr_rows = len(self.protocol) self.protocol_index = -1 if self.protocol_index == self.protocol_nbr_rows - 1: self.measuring_label["text"] = "" self.save_cb.set(0) #done with protocol else: self.protocol_index = self.protocol_index + 1 self.move_1(self.protocol[self.protocol_index]) #for d in protocol: while (self.controller.q.qsize()) % 9 != 0: #time.sleep(0.001) pass #with self.controller.q.mutex: #print((self.controller.q.qsize())) print("CLEARING QUEUE") self.controller.q.queue.clear() #TODO: this is a little dangerous if an element is added before clearing.. # instead clear 9*x times untill all are removed.. self.save_cb.set(1) while i < 9: #img = plt.imread("sample_imgs/{}.tiff".format(i)) try: img = self.controller.q.get(timeout=3) except Empty: print("timeout reached, i is {}".format(i)) if stop(): break else: # images.append(img.astype('int16')) self.controller.q.task_done() i += 1 #self.canvas.draw() #print("show images now") #print("display checkbox is --------------- {}".format(self.display_cb.get())) #print("save checkbox is --------------- {}".format(self.save_cb.get())) self.show_color_image(images, temp) end_time = time.time() new_interval = int((end_time - start_time) * 1000) print("updating interval to {}".format(new_interval)) self.ani.event_source.interval = new_interval print("bottom")
def main(): go = GoniometerObject() go.yaw_angle = 15 go.done_moving(go.YAW) print("done") go.BP.reset_all()
def main(): #folder_path = "/media/pi/DAPHNIA/goniometer/" + time.strftime("%Y%m%d-%H%M%S/") folder_path = "/media/pi/DAPHNIA/goniometer/" + time.strftime( "%Y%m%d-%H_%M_%S/") bc = BaslerController(folder_path) bc.open_camera() bc.update_nodemap() bc.cont_acq() protocol_filename = "protocol_test.csv" protocol = GoniometerObject.read_csv(protocol_filename) go = GoniometerObject() go.copy_csv(protocol_filename, folder_path) time.sleep(10) bc.stop_cont_acq() d = [0, 0, 0] bc.nbr_im = 1 #for d in protocol: for i in range(0, 3): print("led:", d[0]) go.led_angle = int(d[0]) print("stage:", d[1]) go.stage_angle = int(d[1]) print("sample:", d[2]) go.sample_angle = int(d[2]) go.done_moving(go.LED) go.done_moving(go.STAGE) go.done_moving(go.SAMPLE) #bc.stop_cont_acq() bc.save_images() print("--------------counter at {} mod {}".format( bc.counter, bc.counter % 9)) #bc.cont_acq() # before move im to make continuous # #tmp = d #tmp[0] = i bc.move_images([i, i, i]) time.sleep(2) #bc.cont_acq() #go.led_angle = 15 #go.done_moving(go.LED) print("done main") go.BP.reset_all()