Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()
        self.experiment_finished = False
        self._name = 'BaseOptogeneticExperiment'

        #loading settings
        self._exp_parameter_dict = dict(TRIGGER='str',
                                        INTERTRIAL_TIME='int',
                                        MAX_STIM_TIME='int',
                                        MIN_STIM_TIME='int',
                                        MAX_TOTAL_STIM_TIME='int',
                                        EXP_TIME='int',
                                        PROCESS='str')
        self._settings_dict = get_experiment_settings(self._name,
                                                      self._exp_parameter_dict)
        self._process = setup_process(self._settings_dict['PROCESS'])
        self._intertrial_timer = Timer(self._settings_dict['INTERTRIAL_TIME'])
        self._exp_timer = Timer(self._settings_dict['EXP_TIME'])
        self._event = False
        self._event_start = None

        #setting limits
        self._max_trial_time = self._settings_dict['MAX_STIM_TIME']
        self._min_trial_time = self._settings_dict['MIN_STIM_TIME']
        self._max_total_time = self._settings_dict['MAX_TOTAL_STIM_TIME'] if self._settings_dict['MAX_TOTAL_STIM_TIME']\
                                                                     is not None else self._settings_dict['EXP_TIME'] + 1

        #keeping count
        self._results = []
        self._total_time = 0
        self._trial_time = 0
        #trigger
        self._trigger = setup_trigger(self._settings_dict['TRIGGER'])
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()
        self._name = 'BaseTrialExperiment'
        self.experiment_finished = False
        self._event = None
        self._print_check = False
        self._current_trial = None
        self._result_list = []
        self._success_count = 0

        self._parameter_dict = dict(TRIGGER='str',
                                    PROCESS='str',
                                    INTERTRIAL_TIME='int',
                                    TRIAL_NAME='str',
                                    TRIAL_TRIGGER='str',
                                    TRIAL_TIME='int',
                                    STIMULUS_TIME='int',
                                    RESULT_FUNC='str',
                                    EXP_LENGTH='int',
                                    EXP_COMPLETION='int',
                                    EXP_TIME='int')

        self._settings_dict = get_experiment_settings(self._name,
                                                      self._parameter_dict)
        self._process = setup_process(self._settings_dict['PROCESS'])
        self._init_trigger = setup_trigger(self._settings_dict['TRIGGER'])
        self._trials_list = self.generate_trials_list(
            self._trials, self._settings_dict['EXP_LENGTH'])
        self._trial_timer = Timer(self._settings_dict['TRIAL_TIME'])
        self._exp_timer = Timer(self._settings_dict['EXP_TIME'])
        self._intertrial_timer = Timer(self._settings_dict['INTERTRIAL_TIME'])
Ejemplo n.º 3
0
    def __init__(self):
        super().__init__()
        self._name = "BaseTrialExperiment"
        self.experiment_finished = False
        self._event = None
        self._print_check = False
        self._current_trial = None
        self._result_list = []
        self._success_count = 0

        self._parameter_dict = dict(
            TRIGGER="str",
            PROCESS="str",
            INTERTRIAL_TIME="int",
            TRIAL_NAME="str",
            TRIAL_TRIGGER="str",
            TRIAL_TIME="int",
            STIMULUS_TIME="int",
            RESULT_FUNC="str",
            EXP_LENGTH="int",
            EXP_COMPLETION="int",
            EXP_TIME="int",
        )

        self._settings_dict = get_experiment_settings(self._name,
                                                      self._parameter_dict)
        self._process = setup_process(self._settings_dict["PROCESS"])
        self._init_trigger = setup_trigger(self._settings_dict["TRIGGER"])
        self._trials_list = self.generate_trials_list(
            self._trials, self._settings_dict["EXP_LENGTH"])
        self._trial_timer = Timer(self._settings_dict["TRIAL_TIME"])
        self._exp_timer = Timer(self._settings_dict["EXP_TIME"])
        self._intertrial_timer = Timer(self._settings_dict["INTERTRIAL_TIME"])
Ejemplo n.º 4
0
    def __init__(self):
        super().__init__()
        self._name = 'BaseConditionalExperiment'
        self._parameter_dict = dict(TRIGGER='str',
                                    PROCESS='str',
                                    INTERTRIAL_TIME='int',
                                    EXP_LENGTH='int',
                                    EXP_TIME='int')
        self._settings_dict = get_experiment_settings(self._name,
                                                      self._parameter_dict)
        self.experiment_finished = False
        self._process = setup_process(self._settings_dict['PROCESS'])
        self._event = None
        self._event_count = 0
        self._current_trial = None

        self._exp_timer = Timer(self._settings_dict['EXP_TIME'])
        self._intertrial_timer = Timer(self._settings_dict['INTERTRIAL_TIME'])

        self._trigger = setup_trigger(self._settings_dict['TRIGGER'])
Ejemplo n.º 5
0
    def _trials(self):

        trigger = setup_trigger(self._settings_dict['TRIAL_TRIGGER'])
        if self._settings_dict['RESULT_FUNC'] == 'all':
            result_func = all
        elif self._settings_dict['RESULT_FUNC'] == 'any':
            result_func = any
        else:
            raise ValueError(
                f'Result function can only be "all" or "any", not {self._settings_dict["RESULT_FUNC"]}.'
            )
        trials = {
            self._settings_dict['TRIAL_NAME']:
            dict(stimulus_timer=Timer(self._settings_dict['STIMULUS_TIME']),
                 success_timer=Timer(self._settings_dict['TRIAL_TIME']),
                 trigger=trigger,
                 result_func=result_func)
        }

        return trials
Ejemplo n.º 6
0
    def __init__(self):
        super().__init__()
        self._name = "BaseConditionalExperiment"
        self._parameter_dict = dict(
            TRIGGER="str",
            PROCESS="str",
            INTERTRIAL_TIME="int",
            EXP_LENGTH="int",
            EXP_TIME="int",
        )
        self._settings_dict = get_experiment_settings(self._name,
                                                      self._parameter_dict)
        self.experiment_finished = False
        self._process = setup_process(self._settings_dict["PROCESS"])
        self._event = None
        self._event_count = 0
        self._current_trial = None

        self._exp_timer = Timer(self._settings_dict["EXP_TIME"])
        self._intertrial_timer = Timer(self._settings_dict["INTERTRIAL_TIME"])

        self._trigger = setup_trigger(self._settings_dict["TRIGGER"])
Ejemplo n.º 7
0
    def __init__(self):
        super().__init__()
        self.experiment_finished = False
        self._name = "BaseOptogeneticExperiment"

        # loading settings
        self._exp_parameter_dict = dict(
            TRIGGER="str",
            INTERTRIAL_TIME="int",
            MAX_STIM_TIME="int",
            MIN_STIM_TIME="int",
            MAX_TOTAL_STIM_TIME="int",
            EXP_TIME="int",
            PROCESS="str",
        )
        self._settings_dict = get_experiment_settings(self._name,
                                                      self._exp_parameter_dict)
        self._process = setup_process(self._settings_dict["PROCESS"])
        self._intertrial_timer = Timer(self._settings_dict["INTERTRIAL_TIME"])
        self._exp_timer = Timer(self._settings_dict["EXP_TIME"])
        self._event = False
        self._event_start = None

        # setting limits
        self._max_trial_time = self._settings_dict["MAX_STIM_TIME"]
        self._min_trial_time = self._settings_dict["MIN_STIM_TIME"]
        self._max_total_time = (self._settings_dict["MAX_TOTAL_STIM_TIME"]
                                if self._settings_dict["MAX_TOTAL_STIM_TIME"]
                                is not None else
                                self._settings_dict["EXP_TIME"] + 1)

        # keeping count
        self._results = []
        self._total_time = 0
        self._trial_time = 0
        # trigger
        self._trigger = setup_trigger(self._settings_dict["TRIGGER"])