-
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
47 changed files
with
1,001 additions
and
3 deletions.
There are no files selected for viewing
File renamed without changes.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
2 changes: 1 addition & 1 deletion
2
Andor/andorv1.0/andor/driver.py → Andor/andorv1/andor/andor_driver.py
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
File renamed without changes.
File renamed without changes.
Empty file.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
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,86 @@ | ||
| #!/usr/bin/env python | ||
| 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 time | ||
|
|
||
|
|
||
| print("Single Scan Example") | ||
|
|
||
| print("Intialising Camera") | ||
| sdkObject = atmcd() #load the atmcd library | ||
| (ret) = sdkObject.Initialize("/usr/local/etc/andor") #initialise camera # C:\Program Files\Andor SDK | ||
| print("Initialize returned",ret) | ||
|
|
||
|
|
||
|
|
||
| if atmcd.DRV_SUCCESS==ret: | ||
|
|
||
| (ret, iSerialNumber) = sdkObject.GetCameraSerialNumber() | ||
| # print("GetCameraSerialNumber returned:",ret,"Serial No:",iSerialNumber) | ||
|
|
||
| #configure the acquisition | ||
| (ret) = sdkObject.CoolerON() | ||
| # print("Function CoolerON returned",ret) | ||
|
|
||
| (ret) = sdkObject.SetTemperature(-40) | ||
| # print("Function CoolerON returned",ret) | ||
|
|
||
|
|
||
| (ret) = sdkObject.SetAcquisitionMode(1) | ||
| # print("Function SetAcquisitionMode returned",ret,"mode = Single Scan") | ||
|
|
||
| (ret) = sdkObject.SetReadMode(4) | ||
| # print("Function SetReadMode returned",ret,"mode = Image") | ||
|
|
||
| (ret) = sdkObject.SetShutter(0,1,50,50) # (0,1,50,50) opens shutter. (0,2,50,50) closes shutter. | ||
|
|
||
| (ret) = sdkObject.SetExposureTime(1) | ||
| # print("Function SetExposureTime returned",ret,"time = 0.5s") | ||
|
|
||
| (ret) = sdkObject.SetTriggerMode(0) | ||
| # print("Function SetTriggerMode returned",ret,"mode = Internal") | ||
|
|
||
| (ret) = sdkObject.SetVSSpeed(3) | ||
| # print(sdkObject.GetAcquiredData()VSSpeed(0,0,0)) | ||
|
|
||
| (ret, xpixels, ypixels) = sdkObject.GetDetector() | ||
| # print("Function GetDetector returned",ret,"xpixels =",xpixels,"ypixels =",ypixels) | ||
|
|
||
| (ret) = sdkObject.SetImage(1, 1, 1, xpixels, 1, ypixels) | ||
| # print("Function SetImage returned",ret,"hbin = 1 vbin = 1 hstart = 1 hend =",xpixels,"vstart = 1 vend =",ypixels) | ||
|
|
||
| (ret, fminExposure, fAccumulate, fKinetic) = sdkObject.GetAcquisitionTimings() | ||
| # print("Function GetAcquisitionTimings returned",ret,"exposure =",fminExposure,"accumulate =",fAccumulate,"kinetic =",fKinetic) | ||
|
|
||
| (ret) = sdkObject.PrepareAcquisition() | ||
| # print("Function PrepareAcquisition returned",ret) | ||
|
|
||
| #Perform Acquisition | ||
| (ret) = sdkObject.StartAcquisition() | ||
| # print("Function StartAcquisition returned",ret) | ||
|
|
||
| (ret) = sdkObject.WaitForAcquisition() | ||
| # print("Function WaitForAcquisition returned",ret) | ||
|
|
||
| imageSize = xpixels*ypixels | ||
| (ret, fullFrameBuffer) = sdkObject.GetMostRecentImage(imageSize) | ||
| # print("Function GetMostRecentImage returned",ret,"first pixel =",fullFrameBuffer[0],"size =",imageSize) | ||
|
|
||
| #David's addition | ||
| image = np.reshape(fullFrameBuffer, (512,512)) #Converts c_long 262k array to 512x512 image numpy array | ||
| print(np.sum(image),(np.max(image))) | ||
| plt.imshow(image) | ||
|
|
||
| #Clean up | ||
| # (ret) = sdkObject.SetShutter(0,2,50,50) | ||
| (ret) = sdkObject.ShutDown() | ||
| # print("Shutdown returned",ret) | ||
|
|
||
| # else: | ||
| # print("Cannot continue, could not initialise camera") | ||
|
|
Empty file.
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,92 @@ | ||
| #!/usr/bin/env python | ||
| from atmcd import * | ||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
|
|
||
|
|
||
|
|
||
| class ANDOR: | ||
| """Driver for ANDOR camera """ | ||
| def __init__(self): | ||
| self.cam = atmcd() #load the atmcd library | ||
|
|
||
|
|
||
| (ret) = self.cam.Initialize("/usr/local/etc/andor") #initialise camera # C:\Program Files\Andor SDK | ||
| (ret, iSerialNumber) = self.cam.GetCameraSerialNumber() | ||
| (ret) = self.cam.CoolerON() | ||
|
|
||
|
|
||
| (ret) = self.cam.SetTemperature(-40) #David added this | ||
| (ret) = self.cam.SetVSSpeed(3.3) #David added this | ||
| (ret) = self.cam.SetVSAmplitude(Normal) #David added this | ||
| (ret) = self.cam.SetPreAmpGain(3) #David added this | ||
| (ret) = self.cam.SetOutputAmplifier(0) # 0 is EMCCD. David added this | ||
| (ret) = self.cam.SetEMCCDGain(2) # Max is 300? David added this | ||
| #The only setting I have missed is the readout rate which I could not find. might be SetHSSpeed and SetHorizontalSpeed | ||
|
|
||
| (ret) = self.cam.SetAcquisitionMode(1) | ||
| (ret) = self.cam.SetReadMode(4) | ||
| (ret) = self.cam.SetTriggerMode(0) # 0 is internal, 1 is external, 6 is external start? | ||
| (ret, self.xpixels, self.ypixels) = self.cam.GetDetector() | ||
| self.imageSize = self.xpixels*self.ypixels | ||
| (ret) = self.cam.SetImage(1, 1, 1, self.xpixels, 1, self.ypixels) | ||
| (ret) = self.cam.SetExposureTime(0.01) # Set exposure time here! | ||
| (ret, self.fminExposure, self.fAccumulate, self.fKinetic) = self.cam.GetAcquisitionTimings() | ||
| (ret) = self.cam.PrepareAcquisition() | ||
| (ret) = self.cam.StartAcquisition() | ||
|
|
||
| if atmcd.DRV_SUCCESS==ret: | ||
| print("_init_() was successful...") | ||
| else: | ||
| print("_init_() failed...Try restarting Artiq and/or powercycling camera") | ||
|
|
||
|
|
||
| #Settings we still need: temperature(-40), shift speed (3.3), Vertical Clock Voltage Amplitude (Normal/+0), Readout Rate (17MHz at 16-bit) | ||
| # ,Pre-Amp Gain (Gain 3), Output Amplifier (Electron Multiplying), Electron Multiplier (EM) Gain (Enabled->2) | ||
|
|
||
|
|
||
| def await_trigger(self): | ||
| try: | ||
| (ret) = self.cam.WaitForAcquisition() | ||
|
|
||
| print("Awaiting trigger...") | ||
|
|
||
| except: | ||
| try: | ||
| (ret) = self.cam.ShutDown() | ||
| except: | ||
| pass | ||
| print("Error in await_trigger(), try restarting artiq...") | ||
|
|
||
|
|
||
|
|
||
| def convert_image(self): | ||
|
|
||
| try: | ||
| (ret, fullFrameBuffer) = self.cam.GetMostRecentImage(self.imageSize) # GetImages(somethinghere) might be a better command if we want to do background subtraction | ||
| image = np.reshape(fullFrameBuffer, (512,512)) #Converts c_long 262k array to 512x512 image numpy array | ||
| # plt.imshow(image) | ||
|
|
||
|
|
||
| # try: | ||
| ##Acquire images | ||
| # images=[] | ||
| # for i in range(num_of_im): | ||
| # 1. Get image from buffer (c_long | ||
| # 2. Convert c_long to numpy array | ||
| # 3. Wipe image from buffer | ||
|
|
||
| # 1. end acquisition | ||
| # return images | ||
| except: | ||
| try: | ||
| (ret) = self.cam.ShutDown() | ||
| except: | ||
| pass | ||
| print("Error in convert_image(), try restarting artiq...") | ||
|
|
||
|
|
||
|
|
||
| def reset(self): | ||
| (ret) = self.cam.ShutDown() | ||
| print("Shutdown successful...") |
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,64 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| # Written by Joe Britton, 2015 | ||
|
|
||
| import argparse | ||
| import logging | ||
| import sys | ||
| import os | ||
| import asyncio | ||
|
|
||
| sys.path.append(r'C:\Users\hoodl\Documents\GitHub\Instruments\andor_repo') | ||
|
|
||
| from andor.andor_driver import ANDOR | ||
| from sipyco.pc_rpc import simple_server_loop | ||
| from sipyco import common_args | ||
|
|
||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| def get_argparser(): | ||
| parser = argparse.ArgumentParser( | ||
| description="ARTIQ controller for the ANDOR camera") | ||
| common_args.simple_network_args(parser, 3210) | ||
| parser.add_argument( | ||
| "-d", "--device", default=None, | ||
| help="serial port.") | ||
| parser.add_argument( | ||
| "--softtrig", default=False, action="store_true", | ||
| help="Sets trigger to software. Default is hardware") | ||
| parser.add_argument( | ||
| "--num", default=1, | ||
| help="Sets number of images. Default is hardware") | ||
| parser.add_argument( | ||
| "--simulation", action="store_true", | ||
| help="Put the driver in simulation mode, even if --device is used.") | ||
| common_args.verbosity_args(parser) | ||
| return parser | ||
|
|
||
|
|
||
| def main(): | ||
| args = get_argparser().parse_args() | ||
| common_args.init_logger_from_args(args) | ||
| if os.name == "nt": | ||
| asyncio.set_event_loop(asyncio.ProactorEventLoop()) | ||
| # if args.device is None: | ||
| # print("Starting in Simulation mode...") | ||
| # dev = ANDOR(args.device if not args.simulation else None) | ||
|
|
||
| dev = ANDOR() | ||
| #asyncio.get_event_loop().run_until_complete(dev.setup()) | ||
| try: | ||
| print("ANDOR server startup on port",args.port,"successful...") | ||
| simple_server_loop( | ||
| {"ANDOR": dev}, common_args.bind_address_from_args(args), args.port) | ||
| truthcounter=1 | ||
| finally: | ||
| print("Closing server...") | ||
| #dev.close() | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Binary file renamed
BIN
+418 KB
....0/andor/__pycache__/atmcd.cpython-38.pyc → Andor/andorv2/andor/atmcd.py
Binary file not shown.
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,19 @@ | ||
| # Minimal makefile for Sphinx documentation | ||
| # | ||
|
|
||
| # You can set these variables from the command line. | ||
| SPHINXOPTS = | ||
| SPHINXBUILD = sphinx-build | ||
| SOURCEDIR = . | ||
| BUILDDIR = _build | ||
|
|
||
| # Put it first so that "make" without argument is like "make help". | ||
| help: | ||
| @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
|
||
| .PHONY: help Makefile | ||
|
|
||
| # Catch-all target: route all unknown targets to Sphinx using the new | ||
| # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| %: Makefile | ||
| @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Oops, something went wrong.