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.
Passed
Push — master ( 99a1bc...f9fdb5 )
by Sabiha
01:28
created

VoltCycle.submodule.calculations.del_potential()   A

Complexity

Conditions 1

Size

Total Lines 20
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 2
dl 0
loc 20
rs 10
c 0
b 0
f 0
1
import numpy as np
2
import pandas as pd
3
4
5 View Code Duplication
def peak_values(DataFrame_x, DataFrame_y):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6
    """Outputs x (potentials) and y (currents) values from data indices
7
        given by peak_detection function.
8
9
       ----------
10
       Parameters
11
       ----------
12
       DataFrame_x : should be in the form of a pandas DataFrame column.
13
         For example, df['potentials'] could be input as the column of x
14
         data.
15
16
        DataFrame_y : should be in the form of a pandas DataFrame column.
17
          For example, df['currents'] could be input as the column of y
18
          data.
19
20
       Returns
21
       -------
22
       Result : numpy array of coordinates at peaks in the following order:
23
         potential of peak on top curve, current of peak on top curve,
24
         potential of peak on bottom curve, current of peak on bottom curve"""
25
    index = peak_detection(DataFrame_y)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable peak_detection does not seem to be defined.
Loading history...
26
    potential1, potential2 = split(DataFrame_x)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable split does not seem to be defined.
Loading history...
27
    current1, current2 = split(DataFrame_y)
28
    Peak_values = []
29
    Peak_values.append(potential2[(index[0])])  # TOPX (bottom part of curve is
30
    # the first part of DataFrame)
31
    Peak_values.append(current2[(index[0])])  # TOPY
32
    Peak_values.append(potential1[(index[1])])  # BOTTOMX
33
    Peak_values.append(current1[(index[1])])  # BOTTOMY
34
    Peak_array = np.array(Peak_values)
35
    return Peak_array
36
37
38
def del_potential(DataFrame_x, DataFrame_y):
39
    """Outputs the difference in potentials between anoidc and
40
       cathodic peaks in cyclic voltammetry data.
41
42
       Parameters
43
       ----------
44
       DataFrame_x : should be in the form of a pandas DataFrame column.
45
         For example, df['potentials'] could be input as the column of x
46
         data.
47
48
        DataFrame_y : should be in the form of a pandas DataFrame column.
49
          For example, df['currents'] could be input as the column of y
50
          data.
51
52
        Returns
53
        -------
54
        Results: difference in peak potentials."""
55
    del_potentials = (peak_values(DataFrame_x, DataFrame_y)[0] -
56
                      peak_values(DataFrame_x, DataFrame_y)[2])
57
    return del_potentials
58
59
60
def half_wave_potential(DataFrame_x, DataFrame_y):
61
    """Outputs the half wave potential(redox potential) from cyclic
62
       voltammetry data.
63
64
       Parameters
65
       ----------
66
       DataFrame_x : should be in the form of a pandas DataFrame column.
67
         For example, df['potentials'] could be input as the column of x
68
         data.
69
70
        DataFrame_y : should be in the form of a pandas DataFrame column.
71
          For example, df['currents'] could be input as the column of y
72
          data.
73
74
       Returns
75
       -------
76
       Results : the half wave potential."""
77
    half_wave_potential = (del_potential(DataFrame_x, DataFrame_y))/2
78
    return half_wave_potential
79
80
81 View Code Duplication
def peak_heights(DataFrame_x, DataFrame_y):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
82
    """Outputs heights of minimum peak and maximum
83
         peak from cyclic voltammetry data.
84
85
       Parameters
86
       ----------
87
       DataFrame_x : should be in the form of a pandas DataFrame column.
88
         For example, df['potentials'] could be input as the column of x
89
         data.
90
91
        DataFrame_y : should be in the form of a pandas DataFrame column.
92
          For example, df['currents'] could be input as the column of y
93
          data.
94
95
        Returns
96
        -------
97
        Results: height of maximum peak, height of minimum peak
98
          in that order in the form of a list."""
99
    current_max = peak_values(DataFrame_x, DataFrame_y)[1]
100
    current_min = peak_values(DataFrame_x, DataFrame_y)[3]
101
    x1, x2 = split(DataFrame_x)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable split does not seem to be defined.
Loading history...
102
    y1, y2 = split(DataFrame_y)
103
    line_at_min = linear_background(x1, y1)[peak_detection(DataFrame_y)[1]]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable peak_detection does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable linear_background does not seem to be defined.
Loading history...
104
    line_at_max = linear_background(x2, y2)[peak_detection(DataFrame_y)[0]]
105
    height_of_max = current_max - line_at_max
106
    height_of_min = abs(current_min - line_at_min)
107
    return [height_of_max, height_of_min]
108
109
110
def peak_ratio(DataFrame_x, DataFrame_y):
111
    """Outputs the peak ratios from cyclic voltammetry data.
112
113
       Parameters
114
       ----------
115
       DataFrame_x : should be in the form of a pandas DataFrame column.
116
         For example, df['potentials'] could be input as the column of x
117
         data.
118
119
        DataFrame_y : should be in the form of a pandas DataFrame column.
120
          For example, df['currents'] could be input as the column of y
121
          data.
122
123
       Returns
124
       -------
125
       Result : returns a the peak ratio."""
126
    ratio = (peak_heights(DataFrame_x, DataFrame_y)[0] /
127
             peak_heights(DataFrame_x, DataFrame_y)[1])
128
    return ratio
129