<commit_before>import numpy as np
'''
#---------------------------------------------------------# 
#--- Filter_WS             -------------------------#
#---------------------------------------------------------# 
# autor      : <NAME> 
# last update: 26.05.2014
# version    : 0.005
#---------------------------------------------------------# 
# Taken from:
# The Scientist and Engineer's Guide to Digital Signal Processing
# By <NAME>, Ph.D.
# Chapter 16: Window-Sinc Filter
# http://www.dspguide.com/ch16.htm
#---------------------------------------------------------# 
#
# from filter_ws import Filter_WS
#
# filter_type = 'bp'
# fcut1       = 1.0
# fcut2       = 45.0
# sampling_frequency = 1017.25
#
# fiws = Filter_WS()
#--- parameter
# fiws.sampling_frequency = sampling_frequency
# fiws.filter_type        = filter_type  # bp hp lp notch
# fiws.fcut1              = fcut1
# fiws.fcut2              = fcut2
#
# fiws.init_filter_kernel(signal.size)
# fiws.init_filter(signal.size)
# fiws.dcoffset           = True or False
#
#--- filter run 
#   fiws.apply_filter(signal)
#--> this works inplace input data will be change
'''


class Filter_WS:
     def __init__ (self):
         self._sampling_frequency          = 1017.25
         self._filter_type                 = 'bp' #lp, bp, hp
         self._filter_attenuation_factor   = 1.0  # 1, 2
         self._filter_window               = 'blackmann' # hamming, blackmann
         self._fcut1                       = 1
         self._fcut2                       = 200
#---
         self._filter_kernel_length_factor = 16.0
         self._settling_time_factor        = 5.0
         self._data_mean                   = 0.0
         self._dcoffset                    = 0


#--- dcoffset    
     def set_dcoffset(self,value):
         self._dcoffset = value

     def get_dcoffset(self):
         return self._dcoffset
       
     dcoffset = property(get_dcoffset, set_dcoffset)
                       
#---  settling_time_factor   
     def set_settling_time_factor(self,value):
         self._settling_time_factor = value

     def get_settling_time_factor(self):
         return self._settling_time_factor

     settling_time_factor = property(get_settling_time_factor, set_settling_time_factor)

#--- sampling_frequency  
     def set_sampling_frequency(self, value):
         self._sampling_frequency = value

     def get_sampling_frequency(self):
         return self._sampling_frequency

     sampling_frequency = property(get_sampling_frequency, set_sampling_frequency)

#--- filter_kernel_length_factor    
     def set_filter_kernel_length_factor(self, value):
         self._filter_kernel_length_factor = value

     def get_filter_kernel_length_factor(self):
         return self._filter_kernel_length_factor

     filter_kernel_length_factor = property(get_filter_kernel_length_factor, set_filter_kernel_length_factor)

#--- filter_kernel_length
     def get_filter_kernel_length(self):
         try:
            self._filter_kernel_length = self.sampling_frequency * self.filter_kernel_length_factor
         finally: 
               return self._filter_kernel_length

     filter_kernel_length = property(get_filter_kernel_length)

#--- filter_type    
     def set_filter_type(self,value):
         self._filter_type = value

     def get_filter_type(self):
         return self._filter_type
       
     filter_type = property(get_filter_type, set_filter_type)

#--- fcut1    
     def set_fcut1(self,value):
         self._fcut1 = value
    
     def get_fcut1(self):
         return self._fcut1
    
     fcut1 = property(get_fcut1, set_fcut1)

#--- fcut2    
     def set_fcut2(self,value):
         self._fcut2 = value
    
     def get_fcut2(self):
         return self._fcut2
    
     fcut1 = property(get_fcut2, set_fcut2)

#--- filter_window   
     def set_filter_window(self,value):
         self._filter_window = value
 
     def get_filter_window(self):
         return self._filter_window
   
     filter_window = property(get_filter_window,set_filter_window)
     
#--- filter_kernel_data   
     def set_filter_kernel_data(self,d):
         self._filter_kernel_data = d
     
     def get_filter_kernel_data(self):
         return self._filter_kernel_data
   
     filter_kernel_data = property(get_filter_kernel_data,set_filter_kernel_data)

#--- filter_kernel_data_cplx     
     def get_filter_kernel_data_cplx(self):
         return self._filter_kernel_data_cplx

     filter_kernel_data_cplx = property(get_filter_kernel_data_cplx)

#---- filter_data_length
     def calc_filter_data_length(self,dl):
         self._filter_data_length = self.calc_zero_padding( dl + self.filter_kernel_data.size * self.settling_time_factor * 2 +1)<commit_msg>Change fcut2 and prepare for merge.<commit_after>import numpy as np
'''
#---------------------------------------------------------# 
#--- Filter_WS             -------------------------#
#---------------------------------------------------------# 
# autor      : <NAME> 
# last update: 26.05.2014
# version    : 0.005
#---------------------------------------------------------# 
# Taken from:
# The Scientist and Engineer's Guide to Digital Signal Processing
# By <NAME>, Ph.D.
# Chapter 16: Window-Sinc Filter
# http://www.dspguide.com/ch16.htm
#---------------------------------------------------------# 
#
# from filter_ws import Filter_WS
#
# filter_type = 'bp'
# fcut1       = 1.0
# fcut2       = 45.0
# sampling_frequency = 1017.25
#
# fiws = Filter_WS()
#--- parameter
# fiws.sampling_frequency = sampling_frequency
# fiws.filter_type        = filter_type  # bp hp lp notch
# fiws.fcut1              = fcut1
# fiws.fcut2              = fcut2
#
# fiws.init_filter_kernel(signal.size)
# fiws.init_filter(signal.size)
# fiws.dcoffset           = True or False
#
#--- filter run 
#   fiws.apply_filter(signal)
#--> this works inplace input data will be change
'''


class Filter_WS:
     def __init__ (self):
         self._sampling_frequency          = 1017.25
         self._filter_type                 = 'bp' #lp, bp, hp
         self._filter_attenuation_factor   = 1.0  # 1, 2
         self._filter_window               = 'blackmann' # hamming, blackmann
         self._fcut1                       = 1
         self._fcut2                       = 200
#---
         self._filter_kernel_length_factor = 16.0
         self._settling_time_factor        = 5.0
         self._data_mean                   = 0.0
         self._dcoffset                    = 0


#--- dcoffset    
     def set_dcoffset(self,value):
         self._dcoffset = value

     def get_dcoffset(self):
         return self._dcoffset
       
     dcoffset = property(get_dcoffset, set_dcoffset)
                       
#---  settling_time_factor   
     def set_settling_time_factor(self,value):
         self._settling_time_factor = value

     def get_settling_time_factor(self):
         return self._settling_time_factor

     settling_time_factor = property(get_settling_time_factor, set_settling_time_factor)

#--- sampling_frequency  
     def set_sampling_frequency(self, value):
         self._sampling_frequency = value

     def get_sampling_frequency(self):
         return self._sampling_frequency

     sampling_frequency = property(get_sampling_frequency, set_sampling_frequency)

#--- filter_kernel_length_factor    
     def set_filter_kernel_length_factor(self, value):
         self._filter_kernel_length_factor = value

     def get_filter_kernel_length_factor(self):
         return self._filter_kernel_length_factor

     filter_kernel_length_factor = property(get_filter_kernel_length_factor, set_filter_kernel_length_factor)

#--- filter_kernel_length
     def get_filter_kernel_length(self):
         try:
            self._filter_kernel_length = self.sampling_frequency * self.filter_kernel_length_factor
         finally: 
               return self._filter_kernel_length

     filter_kernel_length = property(get_filter_kernel_length)

#--- filter_type    
     def set_filter_type(self,value):
         self._filter_type = value

     def get_filter_type(self):
         return self._filter_type
       
     filter_type = property(get_filter_type, set_filter_type)

#--- fcut1    
     def set_fcut1(self,value):
         self._fcut1 = value
    
     def get_fcut1(self):
         return self._fcut1
    
     fcut1 = property(get_fcut1, set_fcut1)

#--- fcut2    
     def set_fcut2(self,value):
         self._fcut2 = value
    
     def get_fcut2(self):
         return self._fcut2
    
     fcut2 = property(get_fcut2, set_fcut2)

#--- filter_window   
     def set_filter_window(self,value):
         self._filter_window = value
 
     def get_filter_window(self):
         return self._filter_window
   
     filter_window = property(get_filter_window,set_filter_window)
     
#--- filter_kernel_data   
     def set_filter_kernel_data(self,d):
         self._filter_kernel_data = d
     
     def get_filter_kernel_data(self):
         return self._filter_kernel_data
   
     filter_kernel_data = property(get_filter_kernel_data,set_filter_kernel_data)

#--- filter_kernel_data_cplx     
     def get_filter_kernel_data_cplx(self):
         return self._filter_kernel_data_cplx

     filter_kernel_data_cplx = property(get_filter_kernel_data_cplx)

#---- filter_data_length
     def calc_filter_data_length(self,dl):
         self._filter_data_length = self.calc_zero_padding( dl + self.filter_kernel_data.size * self.settling_time_factor * 2 +1)
{'fraction_non_alphanumeric': 0.13242730720606827, 'fraction_numerical': 0.015908133164770334, 'mean_word_length': 2.0475120385232746, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3336158', 'n_tokens_mistral': 3044, 'n_tokens_neox': 2876, 'n_words': 492}