Skip to content

Commit

Permalink
routine
Browse files Browse the repository at this point in the history
  • Loading branch information
dpeana committed Jun 17, 2022
1 parent d059e58 commit cf110d7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 34 deletions.
63 changes: 35 additions & 28 deletions andor_repo/andor/andor_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,34 @@ def __init__(self):

(ret) = self.cam.CoolerON()
(ret) = self.cam.SetCoolerMode(1)
(ret) = self.cam.SetTemperature(-60) #David added this
(ret) = self.cam.SetHSSpeed(0,0) #David added this 0
(ret) = self.cam.SetVSSpeed(4)#.3) #David added this
(ret) = self.cam.SetVSAmplitude(0) #David added this
(ret) = self.cam.SetPreAmpGain(2) #David added this
(ret) = self.cam.SetTemperature(-60)
(ret) = self.cam.SetADChannel(0) # Added 4/6/22
(ret) = self.cam.SetHSSpeed(0,0) # 0 corresponds to 17MHz on AD channel 0 (the only channel for our camera) in EM Gain mode
print("HSSpeed",self.cam.GetHSSpeed(0, 0, 0))
(ret) = self.cam.SetVSSpeed(4) # 4 corresponds to 3.3us. 0 is .3
print("VSSpeed",self.cam.GetVSSpeed(4))
(ret) = self.cam.SetVSAmplitude(0) # 0 corresponds to 'Normal' 3 required for good image at 0.3 usec VSSpeed
print("Number VSAmplitudes is",self.cam.GetNumberVSAmplitudes())
(ret) = self.cam.SetPreAmpGain(2) # 2 corresponds to a gain of 3.0
print("PreAmpGain", self.cam.GetPreAmpGain(2))
(ret) = self.cam.SetBaselineClamp(1)
(ret) = self.cam.SetOutputAmplifier(0) # 0 is EMCCD. David added this
(ret) = self.cam.SetEMGainMode(3) # Max is 300? David added this
(ret) = self.cam.SetEMCCDGain(50) # Max is 300? David added this
(ret) = self.cam.SetCountConvertMode(1) # 1 is electron, 2 is photon
(ret) = self.cam.SetFrameTransferMode(0)
# (ret) = self.cam.SetCountConvertWavelength(float(852))

#The only setting I have missed is the readout rate which I could not find. might be SetHorizontalSpeed


(ret) = self.cam.SetShutter(0,1,50,50) # (0,1,50,50) opens shutter. (0,2,50,50) closes shutter.
# (ret) = self.cam.SetAcquisitionMode(1)

##############################################################
(ret) = self.cam.SetFastExtTrigger(1)
(ret) = self.cam.SetAcquisitionMode(3)
(ret) = self.cam.SetNumberKinetics(2)
(ret) = self.cam.SetFastExtTrigger(1) #when FastExtTrigger is active, set to 1, camera will NOT wait until a Keep Clean cycle is complete before taking an image
(ret) = self.cam.SetAcquisitionMode(3) #3 is Kinetics
(ret) = self.cam.SetNumberKinetics(2) #number of images taken in an acquisition
(ret) = self.cam.EnableKeepCleans(1)
(ret) = self.cam.SetNumberAccumulations(1) #Default value is 1. Excplicitly stating this is probably unnecessary.
(ret) = self.cam.SaveEEPROMToFile(r'C:\Users\hoodl\Desktop\EEPROM.txt')
#(ret) = SetIsolatedCropMode(1, 30, 30, 1, 1)
##############################################################

Expand All @@ -48,33 +54,34 @@ def __init__(self):
(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.001) # Set exposure time here! 0.012
(ret) = self.cam.SetExposureTime(0.012) # Set exposure time here! 0.012
(ret, self.fminExposure, self.fAccumulate, self.fKinetic) = self.cam.GetAcquisitionTimings()

##############################################################
(ret) = self.cam.PrepareAcquisition()
##############################################################

if atmcd.DRV_SUCCESS==ret:
print("Andor Initializiation was successful...")
else:
print("Andor Initializiation 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 shift_speed_change(self, HSSpeed1 = 0, HSSpeed2 = 0, VSSpeed = 4, VSAmplitude = 0, PreAmpGain = 2):
# # # def shift_speed_change(self, x, HSSpeed = 0, VSSpeed = 4, VSAmplitude = 0, PreAmpGain = 2):

(ret) = self.cam.SetHSSpeed(HSSpeed1, HSSpeed2) #David added this 0
(ret) = self.cam.SetVSSpeed(VSSpeed)#.3) #David added this
(ret) = self.cam.SetVSAmplitude(VSAmplitude) #David added this
(ret) = self.cam.SetPreAmpGain(PreAmpGain) #David added this

if atmcd.DRV_SUCCESS==ret:
print("shift success")
else:
print("shift_speed_change failed")
# # # (ret) = self.cam.SetHSSpeed(0, HSSpeed) # The first 0 declares electron multiplication
#print("HSSpeed",self.cam.GetHSSpeed(0,0,HSSpeed))
# # # (ret) = self.cam.SetVSSpeed(VSSpeed)
#print("VSSpeed",self.cam.GetVSSpeed(VSSpeed))
# # # (ret) = self.cam.SetVSAmplitude(VSAmplitude)
# # # (ret) = self.cam.SetPreAmpGain(PreAmpGain)
#print("PreAmpGain", self.cam.GetPreAmpGain(PreAmpGain))

# # # (ret) = self.cam.SetEMCCDGain(50) # Max is 300? David added this
# # # (ret) = self.cam.SetExposureTime(0.012) # Set exposure time here! 0.012

# # # (ret) = self.cam.PrepareAcquisition()
# # # if atmcd.DRV_SUCCESS==ret:
# # # print("shift success")
# # # else:
# # # print("shift_speed_change failed")

def retrieve_trigger(self,images=1,timeout = 0): # Time out time in seconds
# print("Retrieving trigger...")
Expand Down
2 changes: 1 addition & 1 deletion flir_repo/build/lib/flir/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
# try:

# Set camera serial numbers
serial_1 = '20343286'
serial_1 = '20409335' # 20343286 for 1st camera

# Get system
self.system = PySpin.System.GetInstance()
Expand Down
Binary file modified flir_repo/flir/__pycache__/driver.cpython-38.pyc
Binary file not shown.
10 changes: 5 additions & 5 deletions flir_repo/flir/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# MOT_OFFSET_HEIGHT = 0 #These corrections are for a MOT that is not at the center of the frame
# MOT_OFFSET_WIDTH = 0
#OFFSET = 964 #52 #652 #This will be the pixel width and height of the roi
IMAGE_HEIGHT = 964 #964 #OFFSET #964 pixels default
IMAGE_WIDTH = 1288 #1288 #OFFSET #1288 pixels default
IMAGE_HEIGHT = 960 #964 #OFFSET #964 pixels default
IMAGE_WIDTH = 1280 #1288 #OFFSET #1288 pixels default
# HEIGHT_OFFSET = round((964+1-IMAGE_HEIGHT-MOT_OFFSET_HEIGHT)/2)#(964-IMAGE_HEIGHT)/2) # Y, to keep in middle of sensor
# WIDTH_OFFSET = round((1288+1-IMAGE_WIDTH-MOT_OFFSET_WIDTH)/2)#(1288-IMAGE_WIDTH)/2) # X, to keep in middle of sensor

Expand Down Expand Up @@ -53,7 +53,7 @@ def __init__(self):
# try:

# Set camera serial numbers
serial_1 = '20409335' # 20343286' # abs camera (286 was the original abs camera and 335 is the new one)
serial_1 = '20409335' #'20409335' # abs camera (286 was the original abs camera (the one Karl is currently using for fluorescence imaging) and 335 is the new one (the one we tried to do abs. imaging of Lithium with)) , 20343286 for 1st

# Get system
self.system = PySpin.System.GetInstance()
Expand Down Expand Up @@ -82,8 +82,8 @@ def __init__(self):
#cam.AdcBitDepth.SetValue(PySpin.AdcBitDepth_Bit16) #always fails?

cam.PixelFormat.SetValue(PySpin.PixelFormat_Mono16)
cam.Width.SetValue(1288)
cam.Height.SetValue(964)
cam.Width.SetValue(1280)
cam.Height.SetValue(960)
# cam.OffsetX.SetValue(WIDTH_OFFSET)
# cam.OffsetY.SetValue(HEIGHT_OFFSET)

Expand Down

0 comments on commit cf110d7

Please sign in to comment.