-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| ### Section 1: Imports ### | ||
|
|
||
| import sys, os | ||
| sys.path.append(r'C:/Users/hoodl/Documents/GitHub/Instruments/Andor/andorv2/andor') | ||
| from atmcd import * | ||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
| import win32event | ||
|
|
||
|
|
||
| seriesLength = 30; | ||
|
|
||
| cam = atmcd() | ||
|
|
||
| error = cam.Initialize("/usr/local/etc/andor") | ||
| print("Init",error) | ||
| if (error == cam.DRV_SUCCESS): | ||
| (err, sensorWidth, sensorHeight) = cam.GetDetector() | ||
| cam.SetTriggerMode(1); | ||
| cam.SetFastExtTrigger(1); | ||
| cam.SetReadMode(4); | ||
| cam.SetExposureTime(1); | ||
| cam.SetAcquisitionMode(3); | ||
| cam.SetNumberKinetics(seriesLength); | ||
| cam.SetShutter(1, 1, 0, 0); | ||
| cam.SetVSSpeed(0); | ||
| # (error, speed) = cam.GetVSSpeed(); | ||
| # print("VSS = %g usecs\n", speed); | ||
| cam.SetHSSpeed(0, 0); # check if first input right | ||
| # cam.GetHSSpeed(0, 0, 0, speed); | ||
| # print("HSS = %g MHz\n", speed); | ||
|
|
||
| cam.EnableKeepCleans(0); | ||
| cam.SetIsolatedCropMode(1, 30, 30, 1, 1); | ||
|
|
||
| cam.SetImage(1, 1, 1, 30, 1, 30); | ||
| cam.PrepareAcquisition(); | ||
| cam.SetShutter(1, 1, 0, 0); | ||
| # GetAcquisitionTimings(float(exp), float(acc), float(kin)); | ||
| # print("Cycle time = %g\n", kin); | ||
| # Set up events | ||
|
|
||
| print("pre") | ||
| event = 0#win32event.CreateEvent(None, False, False, None) | ||
| print(event) | ||
|
|
||
| x = cam.SetDriverEvent(event) | ||
|
|
||
| error = cam.StartAcquisition() | ||
| print("StartAcquisition returned", error); | ||
|
|
||
| # if (error == cam.DRV_SUCCESS): | ||
| # WaitStatus = np.uint64(0); | ||
| # first, last = 0, validFirst, validLast; | ||
| # while (last < seriesLength): | ||
| # # auto start = high_resolution_clock::now(); | ||
| # WaitStatus = cam.WaitForSingleObject(event, float('inf')); | ||
| # if (WaitStatus == WAIT_FAILED): | ||
| # continue | ||
| # if (WaitStatus == WAIT_OBJECT_0): | ||
| # cam.GetNumberAvailableImages(first, last); | ||
| print(cam.GetNumberAvailableImages()) | ||
|
|
||
|
|
||
| (ret, xpixels, ypixels) = cam.GetDetector() # Returns detector properties | ||
| imagesize = xpixels*ypixels # Set image size | ||
| (ret, fullFrameBuffer) = cam.GetMostRecentImage(imagesize) # Retrieves most recent image | ||
| image = np.reshape(fullFrameBuffer, (512,512)) #Converts c_long 262k array to 512x512 image numpy array | ||
| plt.imshow(image) # Plots image | ||
|
|
||
| cam.SetShutter(1, 2, 0, 0); | ||
| # print("ShutDown() returned %d\n", ShutDown()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
picomotor_repo/picomotor/__pycache__/picomotor_driver.cpython-38.pyc
Binary file not shown.