def scan(self):
for iteration in range(<NUM_LIT:0>, self.global_iterations):  <EOL><INDENT>if self.stop_run.is_set():<EOL><INDENT>break<EOL><DEDENT>logging.info("<STR_LIT>", iteration + <NUM_LIT:1>, self.global_iterations)<EOL>self.set_scan_parameters(global_step=self.scan_parameters.global_step + <NUM_LIT:1>)<EOL>GdacTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>"]))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL>if self.stop_run.is_set():<EOL><INDENT>break<EOL><DEDENT>self.set_scan_parameters(global_step=self.scan_parameters.global_step + <NUM_LIT:1>)<EOL>FeedbackTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL><DEDENT>if self.global_iterations >= <NUM_LIT:0> and not self.stop_run.is_set():<EOL><INDENT>self.set_scan_parameters(global_step=self.scan_parameters.global_step + <NUM_LIT:1>)<EOL>GdacTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>"]))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL>Vthin_AC = self.register.get_global_register_value("<STR_LIT>")<EOL>Vthin_AF = self.register.get_global_register_value("<STR_LIT>")<EOL>PrmpVbpf = self.register.get_global_register_value("<STR_LIT>")<EOL>logging.info("<STR_LIT>", Vthin_AC, Vthin_AF)<EOL>logging.info("<STR_LIT>", PrmpVbpf)<EOL><DEDENT>for iteration in range(<NUM_LIT:0>, self.local_iterations):<EOL><INDENT>if self.stop_run.is_set():<EOL><INDENT>break<EOL><DEDENT>logging.info("<STR_LIT>", iteration + <NUM_LIT:1>, self.local_iterations)<EOL>self.set_scan_parameters(local_step=self.scan_parameters.local_step + <NUM_LIT:1>)<EOL>TdacTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", same_mask_for_all_dc=False, name="<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL>if self.stop_run.is_set():<EOL><INDENT>break<EOL><DEDENT>self.set_scan_parameters(local_step=self.scan_parameters.local_step + <NUM_LIT:1>)<EOL>FdacTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", same_mask_for_all_dc=False, name="<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL><DEDENT>if self.local_iterations >= <NUM_LIT:0> and not self.stop_run.is_set():<EOL><INDENT>self.set_scan_parameters(local_step=self.scan_parameters.local_step + <NUM_LIT:1>)<EOL>TdacTuning.scan(self)<EOL>commands = []<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>", same_mask_for_all_dc=False, name="<STR_LIT>"))<EOL>commands.extend(self.register.get_commands("<STR_LIT>"))<EOL>self.register_utils.send_commands(commands)<EOL><DEDENT>
Metascript that calls other scripts to tune the FE.

        Parameters
        ----------
        cfg_name : string
            Name of the config to be created. This config holds the tuning results.
        target_threshold : int
            The target threshold value in PlsrDAC.
        target_charge : int
            The target charge in PlsrDAC value to tune to.
        target_tot : float
            The target tot value to tune to.
        global_iterations : int
            Defines how often global threshold (GDAC) / global feedback (PrmpVbpf) current tuning is repeated.
            -1 or None: Global tuning is disabled
            0: Only global threshold tuning
            1: GDAC -> PrmpVbpf -> GDAC
            2: GDAC -> PrmpVbpf -> GDAC -> PrmpVbpf -> GDAC
            ...
        local_iterations : int
            Defines how often local threshold (TDAC) / feedback current (FDAC) tuning is repeated.
            -1 or None: Local tuning is disabled
            0: Only local threshold tuning
            1: TDAC -> FDAC -> TDAC
            2: TDAC -> FDAC -> TDAC -> FDAC -> TDAC
            ...