upd
This commit is contained in:
		
							parent
							
								
									6b66a2f3da
								
							
						
					
					
						commit
						d4983f45f2
					
				
					 2 changed files with 13 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
__version__ = '0.1.1'
 | 
			
		||||
__version__ = '0.1.2'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ from scipy.stats import linregress
 | 
			
		|||
from scipy.optimize import curve_fit
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def filter_signal_by_modes(time, signal, num_modes=1, bandwidth_factor=0.1):
 | 
			
		||||
def filter_signal_by_modes(time, signal, num_modes=1, bandwidth_factor=0.1, nyquist=False):
 | 
			
		||||
    """
 | 
			
		||||
    Filtre un signal pour extraire ses composantes fréquentielles dominantes.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -68,6 +68,7 @@ def filter_signal_by_modes(time, signal, num_modes=1, bandwidth_factor=0.1):
 | 
			
		|||
        lowcut = freq - bandwidth
 | 
			
		||||
        highcut = freq + bandwidth
 | 
			
		||||
 | 
			
		||||
        if nyquist:
 | 
			
		||||
            # Éviter les fréquences négatives ou supérieures à la fréquence de Nyquist
 | 
			
		||||
            nyq = 0.5 * fs
 | 
			
		||||
            if lowcut <= 0:
 | 
			
		||||
| 
						 | 
				
			
			@ -76,8 +77,8 @@ def filter_signal_by_modes(time, signal, num_modes=1, bandwidth_factor=0.1):
 | 
			
		|||
                highcut = nyq - 0.01
 | 
			
		||||
    
 | 
			
		||||
            # Créer le filtre Butterworth
 | 
			
		||||
        low = lowcut / nyq
 | 
			
		||||
        high = highcut / nyq
 | 
			
		||||
            lowcut = lowcut / nyq
 | 
			
		||||
            highcut = highcut / nyq
 | 
			
		||||
        b, a = butter(4, [low, high], btype='band')
 | 
			
		||||
 | 
			
		||||
        # Appliquer le filtre (filtfilt pour éviter le déphasage)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue