Esempio n. 1
0
                        default=1.0,
                        help="Time (in seconds) to wait at each point")
    parser.add_argument(
        "--return_to_start",
        dest="return_to_start",
        action="store_true",
        help="Return to the origin at the beginning of each run")
    parser.add_argument("--output",
                        help="HDF5 file to save to",
                        default="linear_motion.hdf5")
    parser.add_argument("--settings_file",
                        help="File where the microscope settings are stored.",
                        default="microscope_settings.npz")
    args = parser.parse_args()

    with load_microscope(args.settings_file, dummy_stage = False) as ms, \
         closing(data_file.Datafile(filename = args.output)) as df:

        assert picamera_supports_lens_shading(
        ), "You need the updated picamera module with lens shading!"

        camera = ms.camera
        stage = ms.stage

        N_frames = args.n_frames
        N_repeats = args.n_repeats
        step = args.step
        framerate = args.framerate
        dwell_time = args.dwell_time
        backlash = 256
        return_to_start = args.return_to_start
Esempio n. 2
0
                                      return_corr=True,
                                      fraction=0.5)
    return data


def random_point(move_dist):
    angle = random.randrange(0, 360) * np.pi / 180
    vector = np.array(
        [move_dist * np.cos(angle), 0, move_dist * np.sin(angle)])
    vector = np.rint(vector)
    return vector


if __name__ == "__main__":

    with load_microscope("microscope_settings.npz", dummy_stage = False) as ms, \
         closing(data_file.Datafile(filename = "repeat.hdf5")) as df:

        assert picamera_supports_lens_shading(
        ), "You need the updated picamera module with lens shading!"

        camera = ms.camera
        stage = ms.stage

        backlash = 256

        camera.resolution = (640, 480)
        stage.backlash = backlash

        n_moves = 10
Esempio n. 3
0
import queue

def image_capture(start_t, event, ms, q):
    while event.is_set():
        frame = ms.rgb_image().astype(np.float32)
        capture_t = time.time()
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        q.put(frame)
        tim = capture_t - start_t
        q.put(tim)
        print('Number of itms in the queue: {}'.format(q.qsize()))
        time.sleep(0.2)

if __name__ == "__main__":

    with load_microscope("microscope_settings.npz") as ms, \
         closing(data_file.Datafile(filename = "drift.hdf5")) as df:

        assert picamera_supports_lens_shading(), "You need the updated picamera module with lens shading!"

        camera = ms.camera
        stage = ms.stage

        camera.resolution=(640,480)

        cam_pos = df.new_group("data", "drift")

        N_frames = 500
        #need to be consistant between drift.py and drift_plot.py

        camera.start_preview(resolution=(640,480))