GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 54-55 lines in 2 locations

voltcycle/functions_and_tests/core.py 1 location

@@ 350-404 (lines=55) @@
347
    return y_base
348
349
350
def peak_detection_fxn(data_y):
351
    """The function takes an input of the column containing the y variables in the dataframe,
352
    associated with the current. The function calls the split function, which splits the
353
    column into two arrays, one of the positive and one of the negative values.
354
    This is because cyclic voltammetry delivers negative peaks, but the peakutils function works
355
    better with positive peaks. The function also runs on the middle 80% of data to eliminate
356
    unnecessary noise and messy values associated with pseudo-peaks.The vectors are then imported
357
    into the peakutils.indexes function to determine the significant peak for each array.
358
    The values are stored in a list, with the first index corresponding to the top peak and the
359
    second corresponding to the bottom peak.
360
    Parameters
361
    ______________
362
    y column: must be a column from a pandas dataframe
363
364
    Returns
365
    _____________
366
    A list with the index of the peaks from the top curve and bottom curve.
367
    """
368
369
    # initialize storage list
370
    index_list = []
371
372
    # split data into above and below the baseline
373
    col_y1, col_y2 = split(data_y) # removed main. head.
374
375
    # detemine length of data and what 10% of the data is
376
    len_y = len(col_y1)
377
    ten_percent = int(np.around(0.1*len_y))
378
379
    # adjust both input columns to be the middle 80% of data
380
    # (take of the first and last 10% of data)
381
    # this avoid detecting peaks from electrolysis
382
    # (from water splitting and not the molecule itself,
383
    # which can form random "peaks")
384
    mod_col_y2 = col_y2[ten_percent:len_y-ten_percent]
385
    mod_col_y1 = col_y1[ten_percent:len_y-ten_percent]
386
387
    # run peakutils package to detect the peaks for both top and bottom
388
    peak_top = peakutils.indexes(mod_col_y2, thres=0.99, min_dist=20)
389
    peak_bottom = peakutils.indexes(abs(mod_col_y1), thres=0.99, min_dist=20)
390
391
    # detemine length of both halves of data
392
    len_top = len(peak_top)
393
    len_bot = len(peak_bottom)
394
395
    # append the values to the storage list
396
    # manipulate values by adding the ten_percent value back
397
    # (as the indecies have moved)
398
    # to detect the actual peaks and not the modified values
399
    index_list.append(peak_top[int(len_top/2)]+ten_percent)
400
    index_list.append(peak_bottom[int(len_bot/2)]+ten_percent)
401
402
    # return storage list
403
    # first value is the top, second value is the bottom
404
    return index_list
405
406
def peak_values(dataframe_x, dataframe_y):
407
    """Outputs x (potentials) and y (currents) values from data indices

voltcycle/functions_and_tests/peak_detection_fxn.py 1 location

@@ 12-65 (lines=54) @@
9
import core
10
11
12
def peak_detection_fxn(data_y):
13
    """The function takes an input of the column containing the y variables in the dataframe,
14
    associated with the current. The function calls the split function, which splits the
15
    column into two arrays, one of the positive and one of the negative values.
16
    This is because cyclic voltammetry delivers negative peaks, but the peakutils function works
17
    better with positive peaks. The function also runs on the middle 80% of data to eliminate
18
    unnecessary noise and messy values associated with pseudo-peaks.The vectors are then imported
19
    into the peakutils.indexes function to determine the significant peak for each array.
20
    The values are stored in a list, with the first index corresponding to the top peak and the
21
    second corresponding to the bottom peak.
22
    Parameters
23
    ______________
24
    y column: must be a column from a pandas dataframe
25
    Returns
26
    _____________
27
    A list with the index of the peaks from the top curve and bottom curve.
28
    """
29
30
    # initialize storage list
31
    index_list = []
32
33
    # split data into above and below the baseline
34
    col_y1, col_y2 = core.split(data_y)
35
36
    # detemine length of data and what 10% of the data is
37
    len_y = len(col_y1)
38
    ten_percent = int(np.around(0.1*len_y))
39
40
    # adjust both input columns to be the middle 80% of data
41
    # (take of the first and last 10% of data)
42
    # this avoid detecting peaks from electrolysis
43
    # (from water splitting and not the molecule itself,
44
    # which can form random "peaks")
45
    mod_col_y2 = col_y2[ten_percent:len_y-ten_percent]
46
    mod_col_y1 = col_y1[ten_percent:len_y-ten_percent]
47
48
    # run peakutils package to detect the peaks for both top and bottom
49
    peak_top = peakutils.indexes(mod_col_y2, thres=0.99, min_dist=20)
50
    peak_bottom = peakutils.indexes(abs(mod_col_y1), thres=0.99, min_dist=20)
51
52
    # detemine length of both halves of data
53
    len_top = len(peak_top)
54
    len_bot = len(peak_bottom)
55
56
    # append the values to the storage list
57
    # manipulate values by adding the ten_percent value back
58
    # (as the indecies have moved)
59
    # to detect the actual peaks and not the modified values
60
    index_list.append(peak_top[int(len_top/2)]+ten_percent)
61
    index_list.append(peak_bottom[int(len_bot/2)]+ten_percent)
62
63
    # return storage list
64
    # first value is the top, second value is the bottom
65
    return index_list
66