Skip to content

Commit c311bdf

Browse files
committed
fix
1 parent 7f02890 commit c311bdf

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

pysignalscope/scope.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ def plot_shiftchannels(channels: List['Channel'], shiftstep_x: Optional[float] =
12241224

12251225
@staticmethod
12261226
def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sampling_rate: Optional[float] = None,
1227-
shift: Optional[float] = None, master_mode: bool = True) -> list['Channel']:
1227+
shift: Optional[float] = None, mastermode: bool = True) -> list['Channel']:
12281228
"""
12291229
Unifies the sampling rate of datasets.
12301230
@@ -1248,14 +1248,14 @@ def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sam
12481248
:param shift: shift of the sample rate from origin (optional parameter)
12491249
None corresponds to a shift to first time point of first channel
12501250
:type shift: float
1251-
:param master_mode: Indicates the channels, which are used for sampling rate calculation (optional parameter)
1251+
:param mastermode: Indicates the channels, which are used for sampling rate calculation (optional parameter)
12521252
True (default): Only the first channel is used for sampling rate calculation
12531253
False: All channels are used for sampling rate calculation
1254-
:type master_mode: bool
1254+
:type mastermode: bool
12551255
:return: List of channels
12561256
:rtype: list['Channel']
12571257
1258-
If the mastermode is 'True' (default), only the first data set is used for sampling rate calculation.
1258+
If the master mode is 'True' (default), only the first data set is used for sampling rate calculation.
12591259
This parameter is ignored, if the sample_calc_mode approach is set to 'user'
12601260
For the calculation of the data rate following approaches can be select by parameter 'sample_calc_mode':
12611261
@@ -1328,7 +1328,7 @@ def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sam
13281328
delta_time = (ch_range[0][1] - ch_range[0][0])
13291329
counts = len(channel_datasets[0].time) - 1
13301330
# in case of master mode is true calculate the minimum of the remaining channels
1331-
if not master_mode:
1331+
if not mastermode:
13321332
# overtake total delta time
13331333
delta_time = delta_time_tot
13341334
# for loop over remaining channels to add the samples
@@ -1343,7 +1343,7 @@ def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sam
13431343
# initialize local parameters
13441344
period = np.min(np.diff(channel_datasets[0].time))
13451345
# in case of master mode is true calculate the minimum of the remaining channels
1346-
if not master_mode:
1346+
if not mastermode:
13471347
# for loop over remaining channels
13481348
for channel_dataset in channel_datasets[1:]:
13491349
# minimum time between 2 sample points
@@ -1354,7 +1354,7 @@ def unify_sampling_rate(*channel_datasets: 'Channel', sample_calc_mode: str, sam
13541354
# initialize local parameters
13551355
period = np.max(np.diff(channel_datasets[0].time))
13561356
# in case of master mode is true calculate the minimum of the remaining channels
1357-
if not master_mode:
1357+
if not mastermode:
13581358
# for loop over all channels
13591359
for channel_dataset in channel_datasets[1:]:
13601360
# minimum time between 2 sample points

tests/test_scope.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def test_derivative(tst_vector, tst_order, exp_result_or_error, error_flag: bool
351351
[13, 14, 16, 20, 17, 14, 9, 1])
352352
ch4 = pss.Scope.generate_channel([10], [1.4])
353353

354-
# min master_mode is false
354+
# min mastermode is false
355355
uch11 = pss.Scope.generate_channel([-1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5,
356356
6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0],
357357
[-8.0, -5.0, -2.0, 4.25, 10.5, 10.75, 11.0, 12.0, 13.0, 13.5, 14.0,
@@ -364,32 +364,32 @@ def test_derivative(tst_vector, tst_order, exp_result_or_error, error_flag: bool
364364
[13.0, 13.5, 14.0, 15.0, 16.0, 18.0, 20.0, 18.5, 17.0, 15.5, 14.0, 11.5,
365365
9.0, 7.0, 5.0, 3.0, 1.0])
366366

367-
# max master_mode is false
367+
# max mastermode is false
368368
uch21 = pss.Scope.generate_channel([-1, 1, 3, 5, 7, 9], [-8, 10.5, 13, 16, 17, 9])
369369
uch22 = pss.Scope.generate_channel([1.0, 3.0], [-2.5, 10.0])
370370
uch23 = pss.Scope.generate_channel([13, 15, 17, 19, 21], [13, 16, 17, 9, 1])
371371

372-
# avg master_mode is true
372+
# avg mastermode is true
373373
uch31 = pss.Scope.generate_channel([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
374374
[-8, -2, 10.5, 11, 13, 14, 16, 20, 17, 14, 9, 1])
375375

376376
uch32 = pss.Scope.generate_channel([0, 1, 2, 3, 4], [2, -2.5, 8, 10, 20])
377377
uch33 = pss.Scope.generate_channel([13, 14, 15, 16, 17, 18, 19, 20, 21],
378378
[13, 14, 16, 20, 17, 14, 9, 5.0, 1])
379379

380-
# avg + shift= 0.5 master_mode is true
380+
# avg + shift= 0.5 mastermode is true
381381
uch41 = pss.Scope.generate_channel([-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5],
382382
[-5.0, 4.25, 10.75, 12.0, 13.5, 15.0, 18.0, 18.5, 15.5, 11.5, 5.0])
383383
uch42 = pss.Scope.generate_channel([-0.5, 0.5, 1.5, 2.5, 3.5, 4.5], [10.0, 7.5, 4.0, 4.0, 2.0, 5.0])
384384
uch43 = pss.Scope.generate_channel([13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5],
385385
[13.5, 15.0, 18.0, 18.5, 15.5, 11.5, 7.0, 3.0])
386386

387-
# user sample rate=1/3 shift= -0.5 master_mode is true
387+
# user sample rate=1/3 shift= -0.5 mastermode is true
388388
uch51 = pss.Scope.generate_channel([1.5, 4.5, 7.5], [10.75, 15.0, 15.5])
389389
uch52 = pss.Scope.generate_channel([1.5, 4.5], [4., 5.])
390390
uch53 = pss.Scope.generate_channel([13.5, 16.5, 19.5], [13.5, 18.5, 7.0])
391391

392-
# avg master_mode is False shift=-0.5
392+
# avg mastermode is False shift=-0.5
393393
uch61 = pss.Scope.generate_channel([-0.64285714, 0.21428571, 1.07142857, 1.92857143, 2.78571429, 3.64285714,
394394
4.5, 5.35714286, 6.21428571, 7.07142857, 7.92857143, 8.78571429, 9.64285714],
395395
[-5.85714286, 0.67857143, 10.53571429, 10.96428571, 12.57142857,
@@ -409,17 +409,17 @@ def test_derivative(tst_vector, tst_order, exp_result_or_error, error_flag: bool
409409
tst_vector2 = [ch1, 2, ch3]
410410
tst_vector3 = [ch1, ch2, ch4]
411411
# resultvectors
412-
# min master_mode is false
412+
# min mastermode is false
413413
result_vec1 = [uch11, uch12, uch13]
414-
# max master_mode is false
414+
# max mastermode is false
415415
result_vec2 = [uch21, uch22, uch23]
416-
# avg master_mode is true
416+
# avg mastermode is true
417417
result_vec3 = [uch31, uch32, uch33]
418-
# avg + shift= 0.5 master_mode is true
418+
# avg + shift= 0.5 mastermode is true
419419
result_vec4 = [uch41, uch42, uch43]
420-
# user sample rate=1/3 shift= -0.5 master_mode is true
420+
# user sample rate=1/3 shift= -0.5 mastermode is true
421421
result_vec5 = [uch51, uch52, uch53]
422-
# avg master_mode is False shift=-5.5
422+
# avg mastermode is False shift=-5.5
423423
result_vec6 = [uch61, uch62, uch63]
424424

425425
# parameterset for values
@@ -472,14 +472,14 @@ def test_of_unify_sampling_rate(tst_vector, tst_sample_calc_mode, tst_sampling_r
472472
if error_flag is False:
473473
# channel_time: non-equidistant values and negative valid values
474474
result_list = pss.Scope.unify_sampling_rate(*tst_vector, sample_calc_mode=tst_sample_calc_mode,
475-
sampling_rate=tst_sampling_rate, shift=tst_shift, master_mode=tst_mastermode)
475+
sampling_rate=tst_sampling_rate, shift=tst_shift, mastermode=tst_mastermode)
476476
for count, result in enumerate(result_list):
477477
numpy.testing.assert_array_almost_equal(result.time, exp_scope_obj_or_err[count].time)
478478
numpy.testing.assert_array_almost_equal(result.data, exp_scope_obj_or_err[count].data)
479479
else: # generate_channel raises an error
480480
with pytest.raises(exp_scope_obj_or_err):
481481
pss.Scope.unify_sampling_rate(*tst_vector, sample_calc_mode=tst_sample_calc_mode,
482-
sampling_rate=tst_sampling_rate, shift=tst_shift, master_mode=tst_mastermode)
482+
sampling_rate=tst_sampling_rate, shift=tst_shift, mastermode=tst_mastermode)
483483

484484

485485
#########################################################################################################

0 commit comments

Comments
 (0)