@@ -47,19 +47,20 @@ def generate_channel(time: Union[List[float], np.ndarray], data: Union[List[floa
47
47
Generate a channel object.
48
48
49
49
:param time: time series
50
- :type time: Union[ List[float], np.ndarray]
50
+ :type time: List[float] or np.ndarray
51
51
:param data: channel data
52
- :type data: Union[List[float], np.ndarray]
53
- :param label: channel label
54
- :type label: Optional[str]
55
- :param unit: channel unit
56
- :type unit: Optional[str]
57
- :param color: channel color
58
- :type color: Union[str, tuple, None]
59
- :param source: channel source
60
- :type source: Optional[str]
61
- :param linestyle: channel linestyle
62
- :type linestyle: Optional[str]
52
+ :type data: List[float] or np.ndarray
53
+ :param label: channel label (optional parameter)
54
+ :type label: str
55
+ :param unit: channel unit (optional parameter)
56
+ :type unit: str
57
+ :param color: channel color (optional parameter)
58
+ :type color: str or tuple
59
+ :param source: channel source (optional parameter)
60
+ :type source: str
61
+ :param linestyle: channel linestyle (optional parameter) e.g.'-' '--' '-.' ':'
62
+ see also https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html
63
+ :type linestyle: str
63
64
"""
64
65
# check time for a valid type, convert to numpy if necessary
65
66
if isinstance (time , List ):
@@ -143,28 +144,29 @@ def modify(channel: Channel, data_factor: Optional[float] = None, data_offset: O
143
144
144
145
:param channel: Scope channel object
145
146
:type channel: Channel
146
- :param data_factor: multiply self.data by data_factor
147
+ :param data_factor: multiply self.data by data_factor (optional parameter)
147
148
:type data_factor: float
148
- :param data_offset: add an offset to self.data
149
+ :param data_offset: add an offset to self.data (optional parameter)
149
150
:type data_offset: float
150
- :param label: label to add to the Channel-class
151
+ :param label: label to add to the Channel-class (optional parameter)
151
152
:type label: str
152
- :param unit: unit to add to the Channel-class
153
+ :param unit: unit to add to the Channel-class (optional parameter)
153
154
:type unit: str
154
- :param color: Color of a channel
155
- :type color: str
156
- :param source: Source of a channel, e.g. 'GeckoCIRCUITS', 'Numpy', 'Tektronix-Scope', ...
155
+ :param color: Color of a channel (optional parameter)
156
+ :type color: str or tuple
157
+ :param source: Source of a channel, e.g. 'GeckoCIRCUITS', 'Numpy', 'Tektronix-Scope', ... (optional parameter)
157
158
:type source: str
158
- :param time_shift: add time to the time base
159
+ :param time_shift: add time to the time base (optional parameter)
159
160
:type time_shift: float
160
161
:param time_shift_rotate: shifts a signal by the given time, but the end of the signal will
161
- come to the beginning of the signal. Only recommended for periodic signals!
162
+ come to the beginning of the signal. Only recommended for periodic signals! (optional parameter)
162
163
:type time_shift_rotate: float
163
- :param time_cut_min: removes all time units smaller than the given one
164
+ :param time_cut_min: removes all time units smaller than the given one (optional parameter)
164
165
:type time_cut_min: float
165
- :param time_cut_max: removes all time units bigger than the given one
166
+ :param time_cut_max: removes all time units bigger than the given one (optional parameter)
166
167
:type time_cut_max: float
167
- :param linestyle: channel linestyle, e.g. '--'
168
+ :param linestyle: channel linestyle (optional parameter)
169
+ for details see parameter description of method 'generate_channel'
168
170
:type linestyle: str
169
171
:return: Channel object
170
172
:rtype: Channel
@@ -548,11 +550,11 @@ def from_numpy(period_vector_t_i: np.ndarray, mode: str = 'rad', f0: Union[float
548
550
:type period_vector_t_i: npt.ArrayLike
549
551
:param mode: 'rad' [default], 'deg' or 'time'
550
552
:type mode: str
551
- :param f0: fundamental frequency in Hz
553
+ :param f0: fundamental frequency in Hz (optional parameter)
552
554
:type f0: float
553
- :param label: channel label
555
+ :param label: channel label (optional parameter)
554
556
:type label: str
555
- :param unit: channel unit
557
+ :param unit: channel unit (optional parameter)
556
558
:type unit: str
557
559
558
560
:Example:
@@ -595,7 +597,7 @@ def from_geckocircuits(txt_datafile: str, f0: Optional[float] = None) -> List['C
595
597
596
598
:param txt_datafile: path to text file, generated by geckoCIRCUITS
597
599
:type txt_datafile: str
598
- :param f0: fundamental frequency [ optional]
600
+ :param f0: fundamental frequency ( optional parameter)
599
601
:type f0: float
600
602
:return: List of Channels
601
603
:rtype: list[Channel]
@@ -652,7 +654,7 @@ def multiply(channel_1: 'Channel', channel_2: 'Channel', label: Optional[str] =
652
654
:type channel_1: Channel
653
655
:param channel_2: channel_2, e.g. current channel
654
656
:type channel_2: Channel
655
- :param label: label for new dataset_channel
657
+ :param label: label for new dataset_channel (optional parameter)
656
658
:type label: str
657
659
:return: Multiplication of two datasets, e.g. power from voltage and current
658
660
:rtype: Channel
@@ -677,7 +679,7 @@ def multiply(channel_1: 'Channel', channel_2: 'Channel', label: Optional[str] =
677
679
return channel_power
678
680
679
681
@staticmethod
680
- def integrate (channel : 'Channel' , label : Optional [str ] = None ):
682
+ def integrate (channel : 'Channel' , label : Optional [str ] = None ) -> 'Channel' :
681
683
"""
682
684
Integrate a channels signal.
683
685
@@ -686,8 +688,8 @@ def integrate(channel: 'Channel', label: Optional[str] = None):
686
688
687
689
:param channel: channel with power
688
690
:type channel: Channel
689
- :param label: channel label
690
- :type label: Optional[ str]
691
+ :param label: channel label (optional parameter)
692
+ :type label: str
691
693
:return: returns a Channel-class, what integrates the input values
692
694
:rtype: Channel
693
695
"""
@@ -823,9 +825,9 @@ def plot_channels(*channel: List['Channel'], timebase: str = 's', figure_size: O
823
825
:type channel: list[Channel]
824
826
:param timebase: timebase, can be 's', 'ms', 'us', 'ns' or 'ps'
825
827
:type timebase: str
826
- :param figure_size: None for auto-fit; fig_size for matplotlib (width, length in mm)
828
+ :param figure_size: None for auto-fit; fig_size for matplotlib (width, length in mm) (optional parameter)
827
829
:type figure_size: Tuple
828
- :param figure_directory: full path with file extension
830
+ :param figure_directory: full path with file extension (optional parameter)
829
831
:type figure_directory: str
830
832
831
833
:return: Plots
@@ -1237,14 +1239,21 @@ def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sam
1237
1239
1238
1240
:param channel_datasets: dataset according to Channel
1239
1241
:type channel_datasets: Channel
1240
- :param sample_calc_mode: keyword, which define the sampling rate calculation 'avg', 'max', 'min' 'user'
1242
+ :param sample_calc_mode: keyword, which define the sampling rate calculation
1243
+ possible keywords are 'avg', 'max', 'min' 'user'
1241
1244
:type sample_calc_mode: str
1242
- :param sampling_rate: sampling rate defined by the user (only valid, if sample_calc_mode is set to 'user'
1243
- :type sampling_rate: Optional[float]
1244
- :param shift: shift of the sample rate from origin. None corresponds to a shift to first time point of first channel
1245
- :type shift: Optional[float]
1246
- :param mastermode: Indicate, if only the first data set or all data sets are used for sampling rate calculation
1245
+ :param sampling_rate: sampling rate defined by the user (optional parameter)
1246
+ only valid, if sample_calc_mode is set to 'user'
1247
+ :type sampling_rate: float
1248
+ :param shift: shift of the sample rate from origin (optional parameter)
1249
+ None corresponds to a shift to first time point of first channel
1250
+ :type shift: float
1251
+ :param mastermode: Indicates the channels, which are used for sampling rate calculation (optional parameter)
1252
+ True (default): Only the first channel is used for sampling rate calculation
1253
+ False: All channels are used for sampling rate calculation
1247
1254
:type mastermode: bool
1255
+ :return: List of channels
1256
+ :rtype: list['Channel']
1248
1257
1249
1258
If the mastermode is 'True' (default), only the first data set is used for sampling rate calculation.
1250
1259
This parameter is ignored, if the sample_calc_mode approach is set to 'user'
@@ -1423,12 +1432,12 @@ def compare_channels(*channels: 'Channel', shift: Optional[List[Union[None, floa
1423
1432
1424
1433
:param channels: dataset according to Channel
1425
1434
:type channels: Channel
1426
- :param shift: phase shift in a list for every input dataset
1427
- :type shift: list[Union[None, float] ]
1428
- :param scale: channel scale factor in a list for every input dataset
1429
- :type scale: list[Union[None, float] ]
1430
- :param offset: channel offset in a list for every input dataset
1431
- :type offset: list[Union[None, float] ]
1435
+ :param shift: phase shift in a list for every input dataset (optional parameter)
1436
+ :type shift: list[float]
1437
+ :param scale: channel scale factor in a list for every input dataset (optional parameter)
1438
+ :type scale: list[float]
1439
+ :param offset: channel offset in a list for every input dataset (optional parameter)
1440
+ :type offset: list[float]
1432
1441
:param timebase: timebase, can be 's', 'ms', 'us', 'ns' or 'ps'
1433
1442
:type timebase: str
1434
1443
"""
@@ -1487,7 +1496,7 @@ def fft(channel: Channel, plot: bool = True):
1487
1496
1488
1497
:param channel: Scope channel object
1489
1498
:type channel: Channel
1490
- :param plot: True to show a figure
1499
+ :param plot: True (default) to show a figure (optional parameter)
1491
1500
:type plot: bool
1492
1501
:return: numpy-array [[frequency-vector],[amplitude-vector],[phase-vector]]
1493
1502
:rtype: npt.NDArray[list]
@@ -1515,11 +1524,11 @@ def short_to_period(channel: Channel, f0: Union[float, int, None] = None, time_p
1515
1524
1516
1525
:param channel: Scope channel object
1517
1526
:type channel: Channel
1518
- :param f0: frequency in Hz
1527
+ :param f0: frequency in Hz (optional parameter)
1519
1528
:type f0: float
1520
- :param time_period: time period in seconds
1529
+ :param time_period: time period in seconds (optional parameter)
1521
1530
:type time_period: float
1522
- :param start_time: start time in seconds
1531
+ :param start_time: start time in seconds (optional parameter)
1523
1532
:type start_time: float
1524
1533
"""
1525
1534
if not isinstance (f0 , (float , int )) != f0 is not None :
@@ -1554,9 +1563,10 @@ def low_pass_filter(channel: Channel, order: int = 1, angular_frequency_rad: flo
1554
1563
1555
1564
:param channel: Channel object
1556
1565
:type channel: Channel
1557
- :param order: filter order
1566
+ :param order: filter order with default = 1 (optional parameter)
1558
1567
:type order: int
1559
- :param angular_frequency_rad: angular frequency in rad. Valid for values 0...1. Smaller value means lower filter frequency.
1568
+ :param angular_frequency_rad: angular frequency in rad. Valid for values 0...1. (optional parameter)
1569
+ with default = 0.05. Smaller value means lower filter frequency.
1560
1570
:type angular_frequency_rad: float
1561
1571
:return: Channel object with filtered data
1562
1572
:rtype: Channel
@@ -1596,7 +1606,8 @@ def derivative(channel: Channel, order: int = 1) -> Channel:
1596
1606
1597
1607
:param channel: Channel object
1598
1608
:type channel: Channel
1599
- :param order: oder of derivative, e.g. 1st order, ...
1609
+ :param order: order of derivative with default = 1 (optional parameter)
1610
+ 1 corresponds to 1st order
1600
1611
:type order: int
1601
1612
:return: Channel object
1602
1613
:rtype: Channel
0 commit comments