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 = 46-46 lines in 2 locations

voltcycle/core.py 1 location

@@ 82-127 (lines=46) @@
79
    return dict_of_df, number
80
81
82
def read_file(file):
83
    """This function reads the raw data file, gets the scanrate and stepsize
84
    and then reads the lines according to cycle number. Once it reads the data
85
    for one cycle, it calls read_cycle function to generate a dataframe. It
86
    does the same thing for all the cycles and finally returns a dictionary,
87
    the keys of which are the cycle numbers and the values are the
88
    corresponding dataframes.
89
90
    Parameters
91
    __________
92
    file: raw data file
93
94
    Returns:
95
    ________
96
    dict_of_df: dictionary of dataframes with keys = cycle numbers and
97
    values = dataframes for each cycle
98
    n_cycle: number of cycles in the raw file
99
    """
100
    dict_of_df = {}
101
    h = 0
102
    l = 0
103
    n_cycle = 0
104
    #a = []
105
    with open(file, 'rt') as f:
106
        print(file + ' Opened')
107
        for line in f:
108
            record = 0
109
            if not (h and l):
110
                if line.startswith('SCANRATE'):
111
                    scan_rate = float(line.split()[2])
112
                    h = 1
113
                if line.startswith('STEPSIZE'):
114
                    step_size = float(line.split()[2])
115
                    l = 1
116
            if line.startswith('CURVE'):
117
                n_cycle += 1
118
                if n_cycle > 1:
119
                    number = n_cycle - 1
120
                    df = read_cycle(a)
121
                    key_name = 'cycle_' + str(number)
122
                    #key_name = number
123
                    dict_of_df[key_name] = copy.deepcopy(df)
124
                a = []
125
            if n_cycle:
126
                a.append(line)
127
    return dict_of_df, number
128
129
130
#df = pd.DataFrame(list(dict1['df_1'].items()))

voltcycle/functions_and_tests/file_read.py 1 location

@@ 30-75 (lines=46) @@
27
    return df
28
29
30
def read_file(file):
31
    """This function reads the raw data file, gets the scanrate and stepsize
32
    and then reads the lines according to cycle number. Once it reads the data
33
    for one cycle, it calls read_cycle function to denerate a dataframe. It 
34
    does the same thing for all the cycles and finally returns a dictionary,
35
    the keys of which are the cycle numbers and the values are the 
36
    corresponding dataframes.
37
38
    Parameters
39
    __________
40
    file: raw data file
41
42
    Returns:
43
    ________
44
    dict_of_df: dictionary of dataframes with keys = cycle numbers and
45
    values = dataframes for each cycle
46
    n_cycle: number of cycles in the raw file  
47
    """   
48
    dict_of_df = {} 
49
    h = 0
50
    l = 0
51
    n_cycle = 0
52
    #a = []
53
    with open(file, 'rt') as f:
54
        print(file + ' Opened')
55
        for line in f:
56
            record = 0
57
            if not (h and l):
58
                if line.startswith('SCANRATE'):
59
                    scan_rate = float(line.split()[2])
60
                    h = 1
61
                if line.startswith('STEPSIZE'):
62
                    step_size = float(line.split()[2])
63
                    l = 1
64
            if line.startswith('CURVE'):
65
                n_cycle += 1
66
                if n_cycle > 1:
67
                    number = n_cycle - 1
68
                    df = read_cycle(a)
69
                    key_name = 'cycle_' + str(number)
70
                    #key_name = number
71
                    dict_of_df[key_name] = copy.deepcopy(df)
72
                a = []
73
            if n_cycle:
74
                a.append(line)
75
    return dict_of_df, number
76
77
78
#df = pd.DataFrame(list(dict1['df_1'].items()))