| @@ 38-79 (lines=42) @@ | ||
| 35 | return df |
|
| 36 | ||
| 37 | ||
| 38 | def read_file_dash(lines): |
|
| 39 | """This function is exactly similar to read_file, but it is for dash |
|
| 40 | ||
| 41 | Parameters |
|
| 42 | __________ |
|
| 43 | file: lines from dash input file |
|
| 44 | ||
| 45 | Returns: |
|
| 46 | ________ |
|
| 47 | dict_of_df: dictionary of dataframes with keys = cycle numbers and |
|
| 48 | values = dataframes for each cycle |
|
| 49 | n_cycle: number of cycles in the raw file |
|
| 50 | """ |
|
| 51 | dict_of_df = {} |
|
| 52 | h = 0 |
|
| 53 | l = 0 |
|
| 54 | n_cycle = 0 |
|
| 55 | number = 0 |
|
| 56 | #a = [] |
|
| 57 | #with open(file, 'rt') as f: |
|
| 58 | # print(file + ' Opened') |
|
| 59 | for line in lines: |
|
| 60 | record = 0 |
|
| 61 | if not (h and l): |
|
| 62 | if line.startswith('SCANRATE'): |
|
| 63 | scan_rate = float(line.split()[2]) |
|
| 64 | h = 1 |
|
| 65 | if line.startswith('STEPSIZE'): |
|
| 66 | step_size = float(line.split()[2]) |
|
| 67 | l = 1 |
|
| 68 | if line.startswith('CURVE'): |
|
| 69 | n_cycle += 1 |
|
| 70 | if n_cycle > 1: |
|
| 71 | number = n_cycle - 1 |
|
| 72 | df = read_cycle(a) |
|
| 73 | key_name = 'cycle_' + str(number) |
|
| 74 | #key_name = number |
|
| 75 | dict_of_df[key_name] = copy.deepcopy(df) |
|
| 76 | a = [] |
|
| 77 | if n_cycle: |
|
| 78 | a.append(line) |
|
| 79 | return dict_of_df, number |
|
| 80 | ||
| 81 | ||
| 82 | def read_file(file): |
|
| @@ 38-79 (lines=42) @@ | ||
| 35 | return df |
|
| 36 | ||
| 37 | ||
| 38 | def read_file_dash(lines): |
|
| 39 | """This function is exactly similar to read_file, but it is for dash |
|
| 40 | ||
| 41 | Parameters |
|
| 42 | __________ |
|
| 43 | file: lines from dash input file |
|
| 44 | ||
| 45 | Returns: |
|
| 46 | ________ |
|
| 47 | dict_of_df: dictionary of dataframes with keys = cycle numbers and |
|
| 48 | values = dataframes for each cycle |
|
| 49 | n_cycle: number of cycles in the raw file |
|
| 50 | """ |
|
| 51 | dict_of_df = {} |
|
| 52 | h = 0 |
|
| 53 | l = 0 |
|
| 54 | n_cycle = 0 |
|
| 55 | number = 0 |
|
| 56 | #a = [] |
|
| 57 | #with open(file, 'rt') as f: |
|
| 58 | # print(file + ' Opened') |
|
| 59 | for line in lines: |
|
| 60 | record = 0 |
|
| 61 | if not (h and l): |
|
| 62 | if line.startswith('SCANRATE'): |
|
| 63 | scan_rate = float(line.split()[2]) |
|
| 64 | h = 1 |
|
| 65 | if line.startswith('STEPSIZE'): |
|
| 66 | step_size = float(line.split()[2]) |
|
| 67 | l = 1 |
|
| 68 | if line.startswith('CURVE'): |
|
| 69 | n_cycle += 1 |
|
| 70 | if n_cycle > 1: |
|
| 71 | number = n_cycle - 1 |
|
| 72 | df = read_cycle(a) |
|
| 73 | key_name = 'cycle_' + str(number) |
|
| 74 | #key_name = number |
|
| 75 | dict_of_df[key_name] = copy.deepcopy(df) |
|
| 76 | a = [] |
|
| 77 | if n_cycle: |
|
| 78 | a.append(line) |
|
| 79 | return dict_of_df, number |
|
| 80 | ||
| 81 | ||
| 82 | def read_file(file): |
|
| @@ 34-75 (lines=42) @@ | ||
| 31 | return dataframe |
|
| 32 | ||
| 33 | ||
| 34 | def read_file_dash(lines): |
|
| 35 | """This function is exactly similar to read_file, but it is for dash |
|
| 36 | ||
| 37 | Parameters |
|
| 38 | __________ |
|
| 39 | file: lines from dash input file |
|
| 40 | ||
| 41 | Returns: |
|
| 42 | ________ |
|
| 43 | dict_of_df: dictionary of dataframes with keys = cycle numbers and |
|
| 44 | values = dataframes for each cycle |
|
| 45 | n_cycle: number of cycles in the raw file |
|
| 46 | """ |
|
| 47 | dict_of_df = {} |
|
| 48 | h_val = 0 |
|
| 49 | l_val = 0 |
|
| 50 | n_cycle = 0 |
|
| 51 | number = 0 |
|
| 52 | #a = [] |
|
| 53 | #with open(file, 'rt') as f: |
|
| 54 | # print(file + ' Opened') |
|
| 55 | for line in lines: |
|
| 56 | record = 0 |
|
| 57 | if not (h_val and l_val): |
|
| 58 | if line.startswith('SCANRATE'): |
|
| 59 | scan_rate = float(line.split()[2]) |
|
| 60 | h_val = 1 |
|
| 61 | if line.startswith('STEPSIZE'): |
|
| 62 | step_size = float(line.split()[2]) |
|
| 63 | l_val = 1 |
|
| 64 | if line.startswith('CURVE'): |
|
| 65 | n_cycle += 1 |
|
| 66 | if n_cycle > 1: |
|
| 67 | number = n_cycle - 1 |
|
| 68 | data = read_cycle(a_val) |
|
| 69 | key_name = 'cycle_' + str(number) |
|
| 70 | #key_name = number |
|
| 71 | dict_of_df[key_name] = copy.deepcopy(data) |
|
| 72 | a_val = [] |
|
| 73 | if n_cycle: |
|
| 74 | a_val.append(line) |
|
| 75 | return dict_of_df, number |
|
| 76 | ||
| 77 | ||
| 78 | def read_file(file): |
|