Esempio n. 1
0
import microscope
m=microscope.Microscope(port="COM4", debug=True)

def take_mosaic(microscope, rows, columns, abc=False):
  x_fov=m.fov()[0]
  y_fov=m.fov()[1]
  overlap=0.9
  x_move=x_fov*overlap
  y_move=y_fov*overlap
  start_x=m.get_x_position()
  start_y=m.get_y_position()
  x=start_x
  y=start_y
  microscope.enable_raster_rotation()
  # Empirically determined on my scope as the delta between the stage xy and image xy -JK
  microscope.set_raster_rotation(3)
  photo=0
  for row in range(0,rows):
    for column in range(0,columns):
      if photo == 14:
        ack = raw_input('Please save buffered images and hit any key to continue...')
        photo=0
      microscope.trigger_abc()
      microscope.take_photo()
      photo+=1
      microscope.set_x_position(microscope.get_x_position() + x_move)
    microscope.set_y_position(microscope.get_y_position() + y_move)
    microscope.set_x_position(start_x)
  microscope.disable_raster_rotation()

def take_series(microscope, af=False, abc=False):
Esempio n. 2
0
    with picamera.PiCamera(resolution=(
            640, 480)) as camera, OpenFlexureStage('/dev/ttyUSB0') as stage:

        #authorises the program to acces the twitter account
        auth = tweepy.OAuthHandler(twitter_keys.consumer_key,
                                   twitter_keys.consumer_secret)
        auth.set_access_token(twitter_keys.access_token,
                              twitter_keys.access_token_secret)
        api = tweepy.API(auth)

        N_frames = 100
        counter = 0

        #loads camera from picamera and set the stage as the arduino, lower resolution can speed up the programme
        ms = microscope.Microscope(camera, stage)
        ms.freeze_camera_settings()
        frame = get_numpy_image(camera, True)

        df = data_file.Datafile(filename="drift_81217.hdf5"
                                )  #creates the .hdf5 file to save the data
        data_gr = df.new_group(
            "test_data", "A file of data collected to test this code works")
        #puts the data file into a group with description

        image = get_numpy_image(camera, greyscale=True)  #takes template photo
        templ8 = image[100:-100, 100:-100]  #crops image

        loop = True
        tweet = True
Esempio n. 3
0
import microscope
import picamera
import numpy as np
import matplotlib.pyplot as plt
import time
#resolution=(3280,2464)
#m = microscope.Microscope(picamera.PiCamera(resolution=(640,480)), None)
m = microscope.Microscope(picamera.PiCamera(resolution=(3280 / 1, 2464 / 1)),
                          None)
m.cam.start_preview()
time.sleep(2)
image = m.rgb_image()
m.cam.stop_preview()

plt.figure()
plt.imshow(image)
plt.figure()
plt.imshow(microscope.decimate_to((100, 100), image))
plt.show()