| @@ 173-193 (lines=21) @@ | ||
| 170 | ||
| 171 | ||
| 172 | #split forward and backward sweping data, to make it easier for processing. |
|
| 173 | def split(vector): |
|
| 174 | """ |
|
| 175 | This function takes an array and splits it into equal two half. |
|
| 176 | ---------- |
|
| 177 | Parameters |
|
| 178 | ---------- |
|
| 179 | vector : Can be in any form of that can be turned into numpy array. |
|
| 180 | Normally, for the use of this function, it expects pandas DataFrame column. |
|
| 181 | For example, df['potentials'] could be input as the column of x data. |
|
| 182 | ------- |
|
| 183 | Returns |
|
| 184 | ------- |
|
| 185 | This function returns two equally splited vector. |
|
| 186 | The output then can be used to ease the implementation of peak detection and baseline finding. |
|
| 187 | """ |
|
| 188 | assert isinstance(vector, pd.core.series.Series), "Input should be pandas series" |
|
| 189 | split_top = int(len(vector)/2) |
|
| 190 | end = int(len(vector)) |
|
| 191 | vector1 = np.array(vector)[0:split] |
|
| 192 | vector2 = np.array(vector)[split_top:end] |
|
| 193 | return vector1, vector2 |
|
| 194 | ||
| 195 | ||
| 196 | def critical_idx(arr_x, arr_y): ## Finds index where data set is no longer linear |
|
| @@ 15-35 (lines=21) @@ | ||
| 12 | ||
| 13 | ||
| 14 | #split forward and backward sweping data, to make it easier for processing. |
|
| 15 | def split(vector): |
|
| 16 | """ |
|
| 17 | This function takes an array and splits it into equal two half. |
|
| 18 | ---------- |
|
| 19 | Parameters |
|
| 20 | ---------- |
|
| 21 | vector : Can be in any form of that can be turned into numpy array. |
|
| 22 | Normally, for the use of this function, it expects pandas DataFrame column. |
|
| 23 | For example, df['potentials'] could be input as the column of x data. |
|
| 24 | ------- |
|
| 25 | Returns |
|
| 26 | ------- |
|
| 27 | This function returns two equally splited vector. |
|
| 28 | The output then can be used to ease the implementation of peak detection and baseline finding. |
|
| 29 | """ |
|
| 30 | assert isinstance(vector, pd.core.series.Series), "Input should be pandas series" |
|
| 31 | split_top = int(len(vector)/2) |
|
| 32 | end = int(len(vector)) |
|
| 33 | vector1 = np.array(vector)[0:split] |
|
| 34 | vector2 = np.array(vector)[split_top:end] |
|
| 35 | return vector1, vector2 |
|
| 36 | ||
| 37 | ||
| 38 | def critical_idx(arr_x, arr_y): ## Finds index where data set is no longer linear |
|