Пример #1
0
 def enableDevice(self, deviceTypeStr, enable):
     if deviceTypeStr is "Spect":
         if enable:
             self.Spect = Spect()
         else:
             self.Spect.close()
     if deviceTypeStr is "Keysight":
         if enable:
             self.Keys = Keysight()
             self.testVars.keysight.enable = True
         else:
             self.Keys.close()
             self.testVars.keysight.enable = False
Пример #2
0
bias_voltage = 5

time_s = 10  # how long to stream for

max_amps = 2e-10

save_file = False

file_suffix = "PD"
"""
Code
"""

t = time.time()

keys = Keysight()

diode = diodeCal()

try:
    """ Initialize """
    keys.set_range(
        max_amps)  # experiment with different ranges for best performance.
    keys.set_output_voltage(
        bias_voltage)  # Bit of an arbitrary choice. Shouldn't matter much.
    keys.auto_aper(True)

    time.sleep(1)

    curr_array = np.array([])
    temp_array = np.array([])
Пример #3
0
file_suffix = "trial"

middle_range = 0.2
num_pixels = 2048

reps = 2
"""
Code
"""
t = time.time()

roi_ind1 = int(num_pixels * (0.5 - 0.5 * middle_range))
roi_ind2 = int(num_pixels * (0.5 + 0.5 * middle_range))

sens = sensor(port="COM7", print_out=False)
keys = Keysight()
newp = TLS()


def closeall():
    sens.close()
    keys.close()
    newp.close()


try:
    """
    Initialize devices
    """
    keys.set_output_voltage(bias_voltage)
    keys.set_range(max_amps)
Пример #4
0
maximum = 4.5

sleeptime = 3

# range of SMU. Resolution is approximately 0.5*10^-6 of maximum
max_amps = 2e-8

save_file = False

file_suffix = "bare"

"""
Code
"""

keys = Keysight()
dac = Labjack()

try:    
    keys.set_range(max_amps) # experiment with different ranges for best performance.
    keys.set_output_voltage(5) # Bit of an arbitrary choice. Shouldn't matter much.
    keys.set_aper(0.1)

    # Build an array of the test frequencies
    test_volt = np.array(range(steps+1))
    test_volt = test_volt*(maximum-minimum)/steps+minimum
    actualV = np.zeros_like(test_volt)
    
    curr_av = np.array([])
    average_points = 2
    aper_time = 0.05
auto_range = False
max_amps = 2e-10

save_file = False

file_suffix = "diffuser"
"""
Code
"""

sens = sensor(port="COM7", print_out=False)

newp = TLS()

keys = Keysight()

try:
    """ Initialize """
    # Initilize SMU
    keys.set_output_voltage(
        bias_voltage)  # Bit of an arbitrary choice. Shouldn't matter much.
    newp.filterW(1)
    keys.set_aper(aper_time)

    # Initialize TLS
    newp.set_lambda(peak_lam)
    TLS_lam = newp.get_lambda()
    print("Wavelength: ", TLS_lam)

    # Initialize sensor
Пример #6
0
class testGui(object):
    
    def __init__(self):
        self.root = tk.Tk()
        
        # font to use for titles
        uline = font.Font(underline = True)
        
        # test variables object contains all information needed to run a test.
        self.testVars = testVars()
        
        ## top frame
        self.masterFrame = tk.Frame(self.root, relief = tk.GROOVE, bd = 4, width = 666)
        # self.masterFrame.grid(sticky = tk.N)
        self.masterFrame.grid(sticky = tk.E+tk.W+tk.N+tk.S)
        self.root.title("Imagica Test Suite")
        self.label = tk.Label(self.masterFrame, text = "All Devices", justify = 'center', font = uline)
        self.label.grid(sticky=tk.N)
        
        """
        electrometer frame
        """
        
        subframe = tk.Frame(self.masterFrame, relief = tk.RIDGE, bd = 2)
        subframe.grid(sticky=tk.N+tk.E+tk.W)
        
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.W)
        label = tk.Label(subsubframe, text = "Keysight Electrometer", font = uline)
        label.grid(sticky = tk.W)

        self.enableKeysight = tk.IntVar()
        command = lambda: self.enableDevice("Keysight", self.enableKeysight.get())
        enable = tk.Checkbutton(subsubframe, text = "Enable", variable = self.enableKeysight, command = command)
        enable.grid(sticky = tk.W, row = 0, column = 1)
        
        # This little frame contains the entry and label field. It is easier to organize.
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.N)
        # the maximum current defines the range
        self.maxCurrBox = tk.Entry(subsubframe)
        self.maxCurrBox.insert(0, "0")
        label = tk.Label(subsubframe, text = "Maximum Current Readout (ex. 2E-10): ")
        label.grid(sticky = tk.W)
        self.maxCurrBox.grid(row = 0, column = 1, sticky = tk.W)
        
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.N)
        # the maximum current defines the range
        self.timeCurrBox = tk.Entry(subsubframe)
        label = tk.Label(subsubframe, text = "Averageing time (ms : 0 for automatic): ")
        label.grid(sticky = tk.W)
        self.timeCurrBox.grid(row = 0, column = 1, sticky = tk.W)

        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.NW)
        # the maximum current defines the range
        self.startBiasBox = tk.Entry(subsubframe)
        label = tk.Label(subsubframe, text = "Start Output Voltage (V): ")
        label.grid(sticky = tk.W)
        self.startBiasBox.grid(row = 0, column = 1, sticky = tk.W)
        
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.NW)
        # the maximum current defines the range
        self.endBiasBox = tk.Entry(subsubframe)
        label = tk.Label(subsubframe, text = "End Output Voltage (V): ")
        label.grid(sticky = tk.W)
        self.endBiasBox.grid(row = 0, column = 1, sticky = tk.W)
        
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.NW)
        # the maximum current defines the range
        self.sweepStepsBox = tk.Entry(subsubframe)
        label = tk.Label(subsubframe, text = "Voltage Sweep Steps: ")
        label.grid(sticky = tk.W)
        self.sweepStepsBox.grid(row = 0, column = 1, sticky = tk.W)
        
        self.sweepBool = tk.IntVar()
        command = lambda: self.enableEntry([self.endVoltBox, self.sweepStepsBox], self.sweepBool.get())
        self.sweepSwitch = tk.Checkbutton(subframe, text = "Voltage sweep?", variable = self.sweepBool, command = command)
        self.sweepSwitch.select()
        self.sweepSwitch.grid(sticky = tk.W)
        
        self.goBut = tk.Button(subframe, text = "Save", command = self.saveElec)
        self.goBut.grid(sticky = tk.N)
        
        """
        spectrometer frame
        """
        subframe = tk.Frame(self.masterFrame, relief = tk.RIDGE, bd = 2, width = 666)
        subframe.grid(sticky=tk.E+tk.W)
        
        subsubframe = tk.Frame(subframe)
        subsubframe.grid(sticky = tk.N)
        label = tk.Label(subsubframe, text = "Jaz Spectrometer", justify = 'center', font = uline)
        label.grid(sticky = tk.W)
        
        self.enableSpect = tk.IntVar()
        command = lambda: self.enableDevice("Spect", self.enableSpect.get())
        enable = tk.Checkbutton(subsubframe, text = "Enable", variable = self.enableSpect, command = command)
        enable.grid(sticky = tk.E, row = 0, column = 1)
        
        command = lambda: self.spect.get_intentities()
        self.frame_But = tk.Button(subframe, text = "Get Spectrum", command = self.get_sensor_frame)
        self.frame_But.grid(sticky = tk.N)
        
        
        """
        TLS frame
        """        
        subframe = tk.Frame(self.masterFrame, relief = tk.RIDGE, bd = 2)
        subframe.grid(sticky=tk.N)
        label = tk.Label(subframe, text = "Newport TLS", font = uline)
        label.grid(sticky = tk.N)
        
        self.enableTLS = tk.IntVar()
        command = lambda: self.enableDevice("TLS", self.enableTLS.get())
        enable = tk.Checkbutton(subframe, text = "Enable", variable = self.enableTLS, command = command)
        enable.grid(sticky = tk.E, row = 0)
        
        """
        Sensor frame
        """
        title = "Sony Sensor"
        
        self.Frame = tk.Frame(self.masterFrame, relief = tk.RIDGE, bd = 2)
        self.Frame.grid(sticky=tk.N)
        Lab = tk.Label(self.Frame, text = title, font = uline)
        Lab.grid(sticky = tk.N)
        
        self.frame_But = tk.Button(self.Frame, text = "Grab Frame", command = self.get_sensor_frame)
        self.frame_But.grid(sticky = tk.N)
        
        
        """ Button to run the test """
        runBut = tk.Button(self.masterFrame, text = "Run Test", command = lambda: self.runTest())
#        runBut.grid(row=frame_row_ind, column = 0)
        runBut. grid(sticky = tk.N)
        
        
    def run(self):
        self.root.mainloop()
    
    """ Gui functions """
    # Right now it just prints the max current.
    def saveElec(self):
        self.testVars.keysight.curr_range = float(self.maxCurrBox.get())
        self.testVars.keysight.aperature_time = float(self.timeCurrBox.get())
        self.testVars.keysight.start = float(self.startBiasBox.get())
        self.testVars.keysight.end = float(self.endBiasBox.get())
        self.testVars.keysight.steps = float(self.stepBiasBox.get())
        print(self.testVars.keysight.curr_range)
        
    def enableEntry(self, entry_boxes, enable = True):
        if enable:
            state = "normal"
        else:
            state = "disabled"
            
        for box in entry_boxes:
            box.configure(state = state)
            
    def enableDevice(self, deviceTypeStr, enable):
        if deviceTypeStr is "Spect":
            if enable:
                self.Spect = Spect()
            else:
                self.Spect.close()
        if deviceTypeStr is "Keysight":
            if enable:
                self.Keys = Keysight()
                self.testVars.keysight.enable = True
            else:
                self.Keys.close()
                self.testVars.keysight.enable = False
    
    def get_sensor_frame(self):
        try:
            from _FTDI_Sensor import sensor
            sens = sensor()
            sens.print_frame()
        except SerialException as e:
            print("Unable to connect to the sensor.\n",e)
            
    def runTest(self):
        print("running!")
        print(self.testVars)
Пример #7
0
minimum = 350
maximum = 1000

# range of SMU. Resolution is approximately 0.5*10^-6 of maximum
max_amps = 2e-9

save_file = True

file_suffix = "bare"
"""
Code
"""

newp = TLS()

keys = Keysight()

try:
    keys.set_range(
        max_amps)  # experiment with different ranges for best performance.
    keys.set_output_voltage(
        5)  # Bit of an arbitrary choice. Shouldn't matter much.

    newp.filterW(filterW)

    # Build an array of the test frequencies
    test_lam = np.array(range(steps + 1))
    test_lam = test_lam * (maximum - minimum) / steps + minimum

    TLS_lam = np.array([])
    curr_av = np.array([])