<commit_before>from abc import ABC, abstractmethod
from ..frequency import *
from ..network import *

class Deembedding(object):
    '''
    Base Class for all de-embedding objects
    '''
    def __init__(self, dummy, name=None, *args, **kwargs):
        '''
        De-embedding Initializer

        Notes
        -----
        Parameters
        ----------
        dummies: network objects of dummy structures used for de-embedding 
        '''

        # fill dummy with copied lists of input
        self.dummy = [ntwk.copy() for ntwk in dummy]

       # ensure all the dummy Networks' frequency's are the same
        for dmyntwk in self.dummy:
            if self.dummy[0].frequency != dmyntwk.frequency:
                raise(ValueError('Dummy Networks dont have matching frequencies.')) 

        # may attempt to interpolate if frequencies do not match

        self.kwargs = kwargs
        self.name = name

    def __str__():
        pass

    def __repr_():
        pass
    
    @abstractmethod
    def apply_cal(self,ntwk):
        '''
        Apply correction to a Network
        '''
        raise NotImplementedError('The Subclass must implement this')

class OpenShort(Deembedding):
    '''
    2-step open-short de-embedding [1]_

    [1] <NAME>, <NAME> and <NAME>, "An improved 
    de-embedding technique for on-wafer high frequency characterization", 
    IEEE 1991 Bipolar Circuits and Technology Meeting, pp. 188-191, Sep. 1991.
    '''
    def __init__(self, measured, *args, **kwargs):
        '''
        Docstring
        '''
        Deembedding.__init__(self, measured, *args, *kwargs)

    def apply_cal(self, ntwk):
        '''
        Docstring
        '''
       
        # first measured ntwk is open dummy
        open = self.dummy[0].copy()

        # second measured ntwk is short dummy
        short = self.dummy[1].copy()
        
        # check if the frequencies match with dummy frequencies
        if ntwk.frequency != open.frequency:
            raise(ValueError('Network frequencies dont match dummy frequencies.')) 

        caled = ntwk.copy()

        # remove open parasitics
        caled.y = ntwk.y - open.y
        # remove short parasitics
        caled.z = caled.z - short.z

        return caled<commit_msg>add named keywords for open/short<commit_after>from abc import ABC, abstractmethod
from ..frequency import *
from ..network import *

class Deembedding(ABC):
    '''
    Abstract Base Class for all de-embedding objects
    '''
    def __init__(self, dummies, name=None, *args, **kwargs):
        '''
        De-embedding Initializer

        Notes
        -----
        Parameters
        ----------
        '''

       # ensure all the dummy Networks' frequency's are the same
        for dmyntwk in dummies:
            if dummies[0].frequency != dmyntwk.frequency:
                raise(ValueError('Dummy Networks dont have matching frequencies.')) 

        # TODO: attempt to interpolate if frequencies do not match

        self.kwargs = kwargs
        self.name = name

    def __str__():
        pass

    def __repr_():
        pass
    
    @abstractmethod
    def apply_cal(self, ntwk):
        '''
        Apply correction to a Network
        '''
        pass

class OpenShort(Deembedding):
    '''
    2-step open-short de-embedding [1]_

    [1] <NAME>, <NAME> and <NAME>, "An improved 
    de-embedding technique for on-wafer high frequency characterization", 
    IEEE 1991 Bipolar Circuits and Technology Meeting, pp. 188-191, Sep. 1991.
    '''
    def __init__(self, dummy_open, dummy_short, name=None, *args, **kwargs):
        '''
        Docstring
        '''
        self.open = dummy_open.copy()
        self.short = dummy_short.copy()
        dummies = [self.open, self.short]

        Deembedding.__init__(self, dummies, name, *args, **kwargs)

    def apply_cal(self, ntwk):
        '''
        Docstring
        '''
        
        # check if the frequencies match with dummy frequencies
        if ntwk.frequency != self.open.frequency:
            raise(ValueError('Network frequencies dont match dummy frequencies.')) 
        
        # TODO: attempt to interpolate if frequencies do not match

        caled = ntwk.copy()

        # remove open parasitics
        caled.y = ntwk.y - self.open.y
        # remove short parasitics
        caled.z = caled.z - self.short.z

        return caled
{'fraction_non_alphanumeric': 0.10022779043280182, 'fraction_numerical': 0.008656036446469248, 'mean_word_length': 1.9850441876274643, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7035549', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1196, 'n_words': 381}