<commit_before>from logging import getLogger
exception_logger = getLogger(__name__+":ERRORS")
from .enums import *
from .force import *
from .helpers import format_command

class SPGUSMU(object):
    def set_apply(self, channel):
        """ Applys the recently set configuration to SPGU, immediately staring to force
        base voltage"""
        self.parent.write("SPUPD {}".format(channel))

    def set_pulse_timing(
        self,
        channel,
        source,
        delay,
        width,
        leading,
     trailing):
        """ Sets up the timing parameters for the given signal and channel.
        Only Pulse parameters, the switch parameters(if enabled) are set separately,
        (self.set_pulse_switch) as is the period (self.set_pulse_period)"""
        return [self.parent.write(
            format_command("SPT",channel,s,d,w,l,t)) for
            s,d,w,l,t in zip(source,delay,width,leading,trailing)]

    def set_num_levels(self, channel, level_sources):
        """ Selects number of levels and signals used for the levels . Available:
            - 0 DC mode
            - 2 level pulse, using Signal 1 only
            - 2 level pulse, using Signal 2 only
            - 3 level pulse, using Signal 1 and 2
        If you set 3 level pulses, you need to explicitly set the timing and voltage seutps as len-2 tuples or lists
        """
        self.parent.write(format_command("SPM", channel, level_sources))

    def set_pulse_levels(self, channel,  base, peak, pulse_src):
        """ Sets the base and peak value for the pulse source in the specified channel"""
        if any([abs(v) > self.maxV for v in max(base+peak)]):
            raise ValueError("SPGU output must be in range -40V to 40V")
        return [self.parent.write(format_command("SPV", channel, src, b, p)) for src,b,p in zip(pulse_src,base,peak)]

    def set_loadimpedance(self, channel, loadZ):
        """ Sets the load impedance to a value between 0.1 Ohm to 1MOhm, default 50 O
        Setting the output resistance correctly ensures that the output voltage
        is as close as possible to the SPV value. Execute set_loadimpedance_auto to
        automatically set an estimated impedance"""
        if not(loadZ==SPGUOutputImpedance.full_auto or (loadZ<1e6 and loadZ>0.1)):
            raise ValueError("loadZ must be SPGUOutputImpedance.full_auto or between 0.1 - 1e6 Ohm")
        self.load_impedance[channel] = loadZ
        return self.parent.write(format_command("SER", channel, loadZ))

    def set_loadimpedance_auto(<commit_msg>fixed sequence error from when we switchted to 3pulse<commit_after>from logging import getLogger
exception_logger = getLogger(__name__+":ERRORS")
from .enums import *
from .force import *
from .helpers import format_command

class SPGUSMU(object):
    def set_apply(self, channel):
        """ Applys the recently set configuration to SPGU, immediately staring to force
        base voltage"""
        self.parent.write("SPUPD {}".format(channel))

    def set_pulse_timing(
        self,
        channel,
        source,
        delay,
        width,
        leading,
     trailing):
        """ Sets up the timing parameters for the given signal and channel.
        Only Pulse parameters, the switch parameters(if enabled) are set separately,
        (self.set_pulse_switch) as is the period (self.set_pulse_period)"""
        return [self.parent.write(
            format_command("SPT",channel,s,d,w,l,t)) for
            s,d,w,l,t in zip(source,delay,width,leading,trailing)]

    def set_num_levels(self, channel, level_sources):
        """ Selects number of levels and signals used for the levels . Available:
            - 0 DC mode
            - 2 level pulse, using Signal 1 only
            - 2 level pulse, using Signal 2 only
            - 3 level pulse, using Signal 1 and 2
        If you set 3 level pulses, you need to explicitly set the timing and voltage seutps as len-2 tuples or lists
        """
        self.parent.write(format_command("SPM", channel, level_sources))

    def set_pulse_levels(self, channel,  base, peak, pulse_src):
        """ Sets the base and peak value for the pulse source in the specified channel"""
        if any([abs(v) > self.maxV for v in base+peak]):
            raise ValueError("SPGU output must be in range -40V to 40V")
        return [self.parent.write(format_command("SPV", channel, src, b, p)) for src,b,p in zip(pulse_src,base,peak)]

    def set_loadimpedance(self, channel, loadZ):
        """ Sets the load impedance to a value between 0.1 Ohm to 1MOhm, default 50 O
        Setting the output resistance correctly ensures that the output voltage
        is as close as possible to the SPV value. Execute set_loadimpedance_auto to
        automatically set an estimated impedance"""
        if not(loadZ==SPGUOutputImpedance.full_auto or (loadZ<1e6 and loadZ>0.1)):
            raise ValueError("loadZ must be SPGUOutputImpedance.full_auto or between 0.1 - 1e6 Ohm")
        self.load_impedance[channel] = loadZ
        return self.parent.write(format_command("SER", channel, loadZ))

    def set_loadimpedance_auto(
{'fraction_non_alphanumeric': 0.08582016773941877, 'fraction_numerical': 0.010727520967427346, 'mean_word_length': 2.876039304610733, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '212081', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1442, 'n_words': 527}