@@ -828,7 +828,7 @@ def get_nyquist_frequency(obj: SignalObj) -> float:
828828 fs = float (obj .x .size - 1 ) / (obj .x [- 1 ] - obj .x [0 ])
829829 return fs / 2.0
830830
831- def update_from_signal (self , obj : SignalObj ) -> None :
831+ def update_from_obj (self , obj : SignalObj ) -> None :
832832 """Update the filter parameters from a signal object
833833
834834 Args:
@@ -919,19 +919,71 @@ def compute_filter(src: SignalObj, p: BaseHighLowBandParam) -> SignalObj:
919919 return dst
920920
921921
922+ def compute_lowpass (src : SignalObj , p : LowPassFilterParam ) -> SignalObj :
923+ """Compute low-pass filter with :py:func:`scipy.signal.filtfilt`
924+
925+ Args:
926+ src: source signal
927+ p: parameters
928+
929+ Returns:
930+ Result signal object
931+ """
932+ return compute_filter (src , p )
933+
934+
935+ def compute_highpass (src : SignalObj , p : HighPassFilterParam ) -> SignalObj :
936+ """Compute high-pass filter with :py:func:`scipy.signal.filtfilt`
937+
938+ Args:
939+ src: source signal
940+ p: parameters
941+
942+ Returns:
943+ Result signal object
944+ """
945+ return compute_filter (src , p )
946+
947+
948+ def compute_bandpass (src : SignalObj , p : BandPassFilterParam ) -> SignalObj :
949+ """Compute band-pass filter with :py:func:`scipy.signal.filtfilt`
950+
951+ Args:
952+ src: source signal
953+ p: parameters
954+
955+ Returns:
956+ Result signal object
957+ """
958+ return compute_filter (src , p )
959+
960+
961+ def compute_bandstop (src : SignalObj , p : BandStopFilterParam ) -> SignalObj :
962+ """Compute band-stop filter with :py:func:`scipy.signal.filtfilt`
963+
964+ Args:
965+ src: source signal
966+ p: parameters
967+
968+ Returns:
969+ Result signal object
970+ """
971+ return compute_filter (src , p )
972+
973+
922974class ZeroPadding1DParam (gds .DataSet ):
923975 """Zero padding parameters"""
924976
925977 def __init__ (self , * args , ** kwargs ) -> None :
926978 super ().__init__ (* args , ** kwargs )
927979 self .__obj : SignalObj | None = None
928980
929- def update_from_signal (self , obj : SignalObj ) -> None :
981+ def update_from_obj (self , obj : SignalObj ) -> None :
930982 """Update parameters from signal"""
931983 self .__obj = obj
932984 self .choice_callback (None , self .strategy )
933985
934- def choice_callback (self , item , value ):
986+ def choice_callback (self , item , value ): # pylint: disable=unused-argument
935987 """Callback for choice item"""
936988 size = self .__obj .x .size
937989 if value == "next_pow2" :
@@ -1176,6 +1228,17 @@ class ResamplingParam(InterpolationParam):
11761228 "display" , active = gds .FuncProp (_prop , lambda x : x == "nbpts" )
11771229 )
11781230
1231+ def update_from_obj (self , obj : SignalObj ) -> None :
1232+ """Update parameters from a signal object."""
1233+ if self .xmin is None :
1234+ self .xmin = obj .x [0 ]
1235+ if self .xmax is None :
1236+ self .xmax = obj .x [- 1 ]
1237+ if self .dx is None :
1238+ self .dx = obj .x [1 ] - obj .x [0 ]
1239+ if self .nbpts is None :
1240+ self .nbpts = len (obj .x )
1241+
11791242
11801243def compute_resampling (src : SignalObj , p : ResamplingParam ) -> SignalObj :
11811244 """Resample data with :py:func:`cdl.algorithms.signal.interpolate`
@@ -1229,7 +1292,7 @@ def compute_detrending(src: SignalObj, p: DetrendingParam) -> SignalObj:
12291292 return dst
12301293
12311294
1232- def compute_XY_mode (src1 : SignalObj , src2 : SignalObj ) -> SignalObj :
1295+ def compute_xy_mode (src1 : SignalObj , src2 : SignalObj ) -> SignalObj :
12331296 """Simulate the X-Y mode of an oscilloscope.
12341297
12351298 Use the first signal as the X-axis and the second signal as the Y-axis.
0 commit comments