diff --git a/Andor/sdk2/Andor.py b/Andor/sdk2/Andor.py new file mode 100644 index 0000000..d874bea --- /dev/null +++ b/Andor/sdk2/Andor.py @@ -0,0 +1,133 @@ +from atmcd import * + +class Andor(): + def __init__(self): + print("Intialising Camera") + cam = atmcd() #load the atmcd library + (ret) = cam.Initialize("/usr/local/etc/andor") #initialise camera + print("Initialize returned",ret) + + if atmcd.DRV_SUCCESS==ret: + self.Initialize() + else: + print("Cannot continue, could not initialise camera") + + + def Initialize(self): + + #(ret, totalCameras) = cam.GetAvailableCameras() + + (ret, iSerialNumber) = cam.GetCameraSerialNumber() + print("GetCameraSerialNumber returned:",ret,"Serial No:",iSerialNumber) + + #configure the acquisition + (ret) = cam.CoolerON() + #(ret) = cam.CoolerOFF() + #(ret, iCoolerStatus) = IsCoolerOn() + print("Function CoolerON returned",ret) + + #(ret, temperature) = GetTemperature() + + (ret, gain) = cam.SetEMCCDGain() + #(ret, low, high) = cam.GetEMGainRange() + + #(ret, noGains) = cam.GetNumberPreAmpGains() + #(ret, gain) = GetPreAmpGain(index) + #ret = SetPreAmpGain(index) + #ret = SetShutter(typ, mode, closingtime, openingtime) + + (ret) = cam.SetAcquisitionMode(1) + print("Function SetAcquisitionMode returned",ret,"mode = Single Scan") + # Inputs: + # mode - the acquisition mode.: + # 1 - Single Scan + # 2 - Accumulate + # 3 - Kinetics + # 4 - Fast Kinetics + # 5 - Run till abort + + #ret = SetCameraLinkMode(mode) # 1 enables, 0 disables + + #ret = SetCropMode(active, cropHeight, reserved) + + #ret = SetFanMode(mode) + + # ret = SetCountConvertMode(Mode) + # Mode - : + # 0 - Data in Counts + # 1 - Data in Electrons + # 2 - Data in Photons + + #ret = SetHorizontalSpeed(index) + + + (ret) = cam.SetReadMode(4) + print("Function SetReadMode returned",ret,"mode = Image") + + (ret) = cam.SetTriggerMode(0) + print("Function SetTriggerMode returned",ret,"mode = Internal") + + #ret = SetFastExtTrigger(mode) + + (ret, xpixels, ypixels) = cam.GetDetector() + print("Function GetDetector returned",ret,"xpixels =",xpixels,"ypixels =",ypixels) + + (ret) = cam.SetImage(1, 1, 1, xpixels, 1, ypixels) + print("Function SetImage returned",ret,"hbin = 1 vbin = 1 hstart = 1 hend =",xpixels,"vstart = 1 vend =",ypixels) + # Inputs: + # hbin - number of pixels to bin horizontally. + # vbin - number of pixels to bin vertically. + # hstart - Start column (inclusive). + # hend - End column (inclusive). + # vstart - Start row (inclusive). + # vend - End row (inclusive). + # ret = SetFullImage(hbin, vbin) + + #ret = SetImageRotate(iRotate) + #ret = SetIsolatedCropMode(active, cropheight, cropwidth, vbin, hbin) + #SetPhotonCounting(self, state): + + (ret) = cam.SetExposureTime(0.01) # seconds + print("Function SetExposureTime returned",ret,"time = 0.01s") + + (ret, fminExposure, fAccumulate, fKinetic) = cam.GetAcquisitionTimings() + print("Function GetAcquisitionTimings returned",ret,"exposure =",fminExposure,"accumulate =",fAccumulate,"kinetic =",fKinetic) + + + + + def StartAcquisition(self): + + (ret) = cam.PrepareAcquisition() # reads current acquisition setup and allocates memory. Is called automatically by StartAcuiqision if not run, but can take a while. + print("Function PrepareAcquisition returned",ret) + + #Perform Acquisition + (ret) = cam.StartAcquisition() + print("Function StartAcquisition returned",ret) + #GetStatus() + + def WaitForAcquisition(self): + + (ret) = cam.WaitForAcquisition() # calling thread is put to sleep until Acquisition Event occurs. + print("Function WaitForAcquisition returned",ret) + #ret = WaitForAcquisitionTimeOut(iTimeOutMs) + + # def CancelWait(self): + # (ret) = cam.CancelWait() + # print("Cancel wait",ret) + + def GetImage(self): + + imageSize = xpixels*ypixels + (ret, fullFrameBuffer) = cam.GetMostRecentImage(imageSize) + print("Function GetMostRecentImage returned",ret,"first pixel =",fullFrameBuffer[0],"size =",imageSize) + + #(ret, arr, validfirst, validlast) = cam.GetImages(first, last, size) + #(ret, first, last) = cam.GetNumberNewImages() + #(ret, index) = GetTotalNumberImagesAcquired() + return fullFrameBuffer + + def ShutDown(self): + #Clean up + (ret) = cam.ShutDown() + print("Shutdown returned",ret) \ No newline at end of file diff --git a/Andor/sdk2/atmcd.py b/Andor/sdk2/atmcd.py index 6e62894..03a3281 100644 --- a/Andor/sdk2/atmcd.py +++ b/Andor/sdk2/atmcd.py @@ -9421,7 +9421,7 @@ def SetFanMode(self, mode): def SetFastExtTrigger(self, mode): ''' Description: - This function will enable fast external triggering. When fast external triggering is enabled the system will NOT wait until a Keep Clean cycle has been completed before accepting the next trigger. This setting will only have an effect if the trigger mode has been set to External via SetTriggerModeSetTriggerMode. + This function will enable fast external triggering. When fast external triggering is enabled the system will NOT wait until a Keep Clean cycle has been completed before accepting the next trigger. This setting will only have an effect if the trigger mode has been set to External via SetTriggerMode. Synopsis: ret = SetFastExtTrigger(mode)