Exemplo n.º 1
0
    def test_direct_transition(self):
        #        logger=ptplog.ptplog(level=logging.DEBUG)
        fobj = open("server/user_function.py")
        sequence_string = fobj.read()
        fobj.close()
        seq_list = sequence_string.split("#--1")
        exec(seq_list[1])

        command_string = generate_cmd_str("test_sequence.py", 4)
        chandler = handle_commands.CommandHandler()
        variable_dict = chandler.get_variables(command_string)
        user_api = userAPI(chandler, dds_count=3)

        incl_list = user_api.include_handler.generate_include_list()
        for file_name, cmd_str in incl_list:
            exec(cmd_str)

        global transitions
        transitions = chandler.transitions
        global sequence_var
        sequence_var = []
        transition1 = sequence_handler.transition("test1", {1: 1}, 200)
        pulse1 = TTLPulse(0, 10, "1", is_last=False)
        pulse2 = TTLPulse(0, 20, "1", is_last=False)
        pulse3 = TTLPulse(0, 30, "3")
        sequence_var.append(pulse1.sequence_var)
        sequence_var.append(pulse2.sequence_var)
        sequence_var.append(pulse3.sequence_var)
        rf_pulse(1, 0, 1, transition1)
        rf_pulse(1, 0, 1, "carrier2")
        transitions = chandler.transitions
        set_transition("carrier1", "729")
        set_transition("carrier2", "RF")
        user_api.init_sequence()
Exemplo n.º 2
0
    def test_conflict_handler2(self):
        """Test the TTL conflict handling of simultaneous pulses
        This test checks whether the server raises an error if TTL
        pulses which cannot be resolved are given"""
        command_string = generate_cmd_str("test_sequence.py", 9)

        chandler = handle_commands.CommandHandler()
        variable_dict = chandler.get_variables(command_string)
        user_api = user_function.userAPI(chandler, dds_count=3)

        incl_list = user_api.include_handler.generate_include_list()
        for file_name, cmd_str in incl_list:
            exec(cmd_str)
        transitions = chandler.transitions
        sequence_var = []
        pulse1 = TTLPulse(0, 10, "1", is_last=False)
        pulse2 = TTLPulse(0, 20, "1", is_last=False)
        pulse3 = TTLPulse(0, 30, "3")
        sequence_var.append(pulse1.sequence_var)
        sequence_var.append(pulse2.sequence_var)
        sequence_var.append(pulse3.sequence_var)
        try:
            user_api.final_array = user_api.get_sequence_array(sequence_var)
            self.fail("Program did not detect simulatnious TTL error")
        except RuntimeError:
            pass
Exemplo n.º 3
0
    def test_rf_on(self):
        """Testing RF_ON
        This test checks if the rf_on command works correct
        This test is doing nothing right now
        """
        #logger=ptplog.ptplog(level=logging.DEBUG)

        fobj = open("server/user_function.py")
        sequence_string = fobj.read()
        fobj.close()
        seq_list = sequence_string.split("#--1")
        exec(seq_list[1])

        command_string = generate_cmd_str("test_sequence.py", 4)
        chandler = handle_commands.CommandHandler()
        variable_dict = chandler.get_variables(command_string)
        user_api = userAPI(chandler, dds_count=3)

        incl_list = user_api.include_handler.generate_include_list()
        for file_name, cmd_str in incl_list:
            exec(cmd_str)

        global transitions
        transitions = chandler.transitions
        global sequence_var
        sequence_var = []
        pulse1 = RFOn(0, 200, -5, 0)
        sequence_var.append(pulse1.sequence_var)

        final_array = user_api.get_sequence_array(sequence_var)
        for instruction in final_array[0]:
            instruction.handle_instruction(user_api.api)
        self.fail("Need a test for the API commands")
Exemplo n.º 4
0
 def test_conflict_handler(self):
     """Test the conflict handler
     This test checks if conflicting TTL pulses are joined
     correctly."""
     command_string = generate_cmd_str("test_sequence.py", 9)
     chandler = handle_commands.CommandHandler()
     variable_dict = chandler.get_variables(command_string)
     user_api = user_function.userAPI(chandler, dds_count=0)
     incl_list = user_api.include_handler.generate_include_list()
     for file_name, cmd_str in incl_list:
         exec(cmd_str)
     transitions = chandler.transitions
     sequence_var = []
     pulse1 = TTLPulse(0, 10, "1", is_last=False)
     pulse2 = TTLPulse(0, 10, "2", is_last=False)
     pulse3 = TTLPulse(0, 30, "3")
     sequence_var.append(pulse1.sequence_var)
     sequence_var.append(pulse2.sequence_var)
     sequence_var.append(pulse3.sequence_var)
     user_api.final_array = user_api.get_sequence_array(sequence_var)
     ttl_ev1 = user_api.final_array[0][0]
     assert ttl_ev1.device_key == ["3", "2", "1"]
     ttl_ev2 = user_api.final_array[0][1]
Exemplo n.º 5
0
        data += ";SLOPE_TYPE,blackman;"
        data += "SLOPE_DUR,0;IONS,1:201,2:202,3:203"
        data += ";FREQ2,10;AMPL2,1;"
    return data


logger = ptplog.ptplog(level=logging.DEBUG)

fobj = open("server/user_function.py")
sequence_string = fobj.read()
fobj.close()
seq_list = sequence_string.split("#--1")
exec(seq_list[1])

command_string = generate_cmd_str("test_sequence.py", 4)
chandler = handle_commands.CommandHandler()
variable_dict = chandler.get_variables(command_string)
user_api = userAPI(chandler, dds_count=3)

incl_list = user_api.include_handler.generate_include_list()
for file_name, cmd_str in incl_list:
    exec(cmd_str)

global transitions
transitions = chandler.transitions
global sequence_var
sequence_var = []
#user_api.init_sequence()

# test_ipython.py ends here