ECIS Data Solver



In [17]:
import pandas as pd
import numpy as np

time_zero = 0

filename = input("Filename? ")
df =pd.read_csv(filename, header = 2)
array_num = int(input("Did you use 1 array or 2?"))
if array_num== 1:
    columns = np.arange(0,32)
    df.columns = columns
if array_num == 2: 
    columns = np.arange(0,64)
    df.columns = columns
print(df)


Filename? df8.csv
Did you use 1 array or 2?1
           0       1       2      3          4       5      6      7   \
0   46.072081  1194.1   941.8  27.10  46.075994  1178.1  925.2  27.28   
1   46.135261  1196.5   945.4  27.13  46.139183  1178.5  926.1  27.29   
2   46.198433  1191.8   940.0  27.15  46.202346  1177.4  926.5  27.38   
3   46.261639  1194.2   943.5  27.17  46.265569  1180.1  928.0  27.29   
4   46.324854  1197.9   946.0  27.07  46.328780  1179.1  926.0  27.25   
5   46.388051  1187.0   934.5  27.18  46.391995  1184.2  931.7  27.22   
6   46.451214  1180.8   928.5  27.27  46.455149  1187.7  936.0  27.21   
7   46.514394  1187.5   936.0  27.22  46.518333  1191.7  940.9  27.20   
8   46.578892  1268.2  1013.4  26.09  46.582822  1209.7  960.1  27.04   
9   46.647350  1225.5   972.0  26.65  46.651263  1197.7  947.6  27.16   
10  46.713264  1195.0   939.7  26.95  46.717177  1195.0  943.5  27.13   
11  46.777853  1189.4   933.1  26.97  46.781787  1183.5  931.7  27.26   
12  46.842133  1182.3   923.3  26.94  46.846072  1175.4  921.9  27.28   
13  46.906206  1176.0   916.0  26.98  46.910132  1175.7  922.1  27.27   
14  46.970335  1166.4   904.5  27.02  46.974261  1177.4  923.8  27.25   
15  47.034612  1164.3   901.5  27.00  47.038555  1181.9  928.8  27.21   
16  47.098719  1158.1   895.1  27.07  47.102649  1188.7  937.0  27.20   
17  47.163186  1156.1   894.0  27.14  47.167130  1194.6  943.2  27.14   
18  47.227450  1159.4   896.9  27.08  47.231363  1190.7  940.3  27.24   
19  47.291856  1161.1   900.1  27.12  47.295787  1195.1  944.2  27.15   
20  47.356007  1163.7   903.3  27.12  47.359963  1192.3  939.8  27.11   
21  47.420114  1165.9   905.6  27.09  47.424053  1193.7  942.5  27.16   
22  47.484399  1164.9   905.8  27.16  47.488317  1192.7  941.5  27.17   
23  47.548507  1166.6   907.3  27.13  47.552433  1193.3  941.9  27.16   
24  47.612619  1164.7   906.8  27.22  47.616541  1198.9  948.3  27.12   
25  47.676731  1165.8   907.7  27.19  47.680669  1199.8  947.2  27.02   
26  47.741011  1163.4   904.4  27.18  47.744946  1200.8  949.0  27.04   
27  47.805266  1164.5   905.7  27.18  47.809188  1204.5  953.1  27.01   
28  47.869573  1163.8   907.0  27.28  47.873490  1204.5  953.1  27.01   
29  47.933979  1157.9   901.5  27.38  47.937918  1198.9  948.4  27.12   
..        ...     ...     ...    ...        ...     ...    ...    ...   
57  49.730934  1135.6   875.4  27.50  49.734868  1196.8  948.7  27.27   
58  49.795158  1129.2   869.7  27.62  49.799084  1198.6  947.3  27.09   
59  49.859309  1134.0   874.0  27.53  49.863230  1202.0  949.8  27.01   
60  49.923429  1133.2   874.4  27.60  49.927346  1212.3  960.2  26.88   
61  49.987736  1126.5   867.7  27.70  49.991675  1206.4  954.0  26.94   
62  50.051861  1125.8   867.9  27.74  50.055804  1199.2  946.7  27.03   
63  50.115942  1126.8   868.0  27.69  50.119855  1193.3  941.1  27.11   
64  50.180024  1129.8   870.0  27.60  50.183958  1198.7  946.1  27.03   
65  50.244166  1129.3   869.3  27.60  50.248100  1196.3  943.4  27.04   
66  50.308282  1127.5   867.2  27.61  50.312217  1203.3  949.9  26.93   
67  50.372359  1121.8   862.8  27.75  50.376281  1200.3  946.9  26.97   
68  50.436501  1124.4   865.4  27.71  50.440414  1200.0  945.5  26.93   
69  50.500739  1134.1   877.2  27.68  50.504647  1203.7  948.4  26.84   
70  50.565054  1132.0   874.3  27.66  50.568971  1206.4  952.1  26.85   
71  50.629153  1132.8   874.5  27.63  50.633087  1197.7  944.1  26.99   
72  50.693447  1128.6   869.8  27.66  50.697368  1199.2  945.6  26.97   
73  50.757554  1128.0   868.7  27.65  50.761493  1196.8  939.7  26.84   
74  50.821718  1133.6   873.8  27.55  50.825652  1193.7  936.6  26.88   
75  50.886081  1125.4   865.1  27.64  50.890011  1198.8  939.2  26.70   
76  50.950245  1116.5   856.0  27.75  50.954184  1200.5  942.1  26.73   
77  51.014356  1118.1   856.2  27.66  51.018300  1198.5  939.9  26.75   
78  51.078481  1113.9   852.3  27.74  51.082433  1201.8  942.7  26.69   
79  51.142597  1117.6   855.9  27.68  51.146532  1208.3  948.1  26.56   
80  51.206709  1114.1   852.5  27.74  51.210635  1208.6  949.1  26.59   
81  51.270825  1115.1   852.9  27.70  51.274760  1212.9  952.9  26.51   
82  51.335089  1114.0   851.6  27.70  51.339002  1214.5  956.3  26.58   
83  51.399235  1101.4   840.5  27.95  51.403178  1215.4  957.2  26.56   
84  51.463334  1103.4   841.3  27.86  51.467256  1221.1  960.4  26.38   
85  51.527623  1103.7   842.2  27.89  51.531541  1221.8  959.2  26.29   
86  51.591744  1107.8   848.8  27.95  51.595674  1224.6  961.6  26.24   

           8       9   ...       22     23         24      25     26     27  \
0   46.079921  1241.1  ...    922.7  27.10  46.095728  1205.9  929.0  25.88   
1   46.143105  1251.4  ...    920.1  27.14  46.158943  1208.3  930.6  25.81   
2   46.206289  1246.3  ...    929.2  27.09  46.222093  1210.2  932.2  25.78   
3   46.269504  1248.0  ...    930.7  27.12  46.285325  1203.7  926.5  25.89   
4   46.332723  1255.4  ...    930.1  27.15  46.348509  1204.0  926.1  25.86   
5   46.395903  1255.0  ...    931.4  27.10  46.411703  1198.8  921.2  25.93   
6   46.459092  1257.2  ...    929.0  27.14  46.474909  1191.0  913.5  26.03   
7   46.522259  1141.9  ...    877.8  27.93  46.538241  1117.2  843.8  27.17   
8   46.586739   798.8  ...    643.7  31.51  46.604450   834.3  572.7  32.79   
9   46.655180   654.3  ...    472.0  35.55  46.672284   710.6  452.3  36.30   
10  46.721086   634.2  ...    422.5  36.73  46.737254   684.3  420.7  36.87   
11  46.785700   639.7  ...    416.7  36.28  46.801829   694.6  422.0  36.06   
12  46.849973   651.4  ...    423.4  35.45  46.866123   716.4  432.8  34.85   
13  46.914054   668.1  ...    432.8  34.58  46.930209   739.7  445.3  33.68   
14  46.978179   685.4  ...    446.3  33.71  46.994329   767.7  462.7  32.48   
15  47.042473   705.3  ...    463.3  32.83  47.058601   794.0  479.5  31.43   
16  47.106567   724.8  ...    482.3  31.93  47.122899   814.5  493.4  30.70   
17  47.171043   740.1  ...    500.4  31.09  47.187176   837.1  509.1  29.94   
18  47.235284   755.7  ...    518.5  30.36  47.251626   856.0  523.3  29.37   
19  47.299721   771.5  ...    537.2  29.75  47.315872   874.3  537.0  28.83   
20  47.363876   786.8  ...    553.9  29.19  47.379966   890.2  549.2  28.40   
21  47.427971   803.2  ...    569.9  28.71  47.444112   906.3  561.9  27.98   
22  47.492234   819.7  ...    582.2  28.37  47.508350   920.0  573.9  27.67   
23  47.556389   836.7  ...    598.2  27.96  47.572501   934.8  586.6  27.33   
24  47.620458   850.0  ...    614.7  27.57  47.636604   949.7  598.3  26.97   
25  47.684574   868.6  ...    628.1  27.32  47.700724   964.5  610.5  26.64   
26  47.748898   886.8  ...    640.6  27.05  47.765204   973.0  618.9  26.50   
27  47.813092   902.1  ...    654.4  26.79  47.829256   978.4  624.7  26.42   
28  47.877403   917.0  ...    670.2  26.54  47.893545   991.4  635.8  26.15   
29  47.941849   931.5  ...    683.7  26.31  47.958038  1001.8  646.8  26.01   
..        ...     ...  ...      ...    ...        ...     ...    ...    ...   
57  49.738773  1027.7  ...    708.0  26.97  49.754901  1045.4  710.9  25.96   
58  49.803006  1033.8  ...    709.2  26.99  49.819165  1047.5  714.2  25.97   
59  49.867130  1039.2  ...    707.0  27.03  49.883281  1042.9  709.7  26.04   
60  49.931251  1039.5  ...    701.4  27.18  49.947579  1039.0  707.7  26.15   
61  49.995592  1038.7  ...    693.0  27.40  50.011734  1037.1  707.3  26.23   
62  50.059739  1037.3  ...    694.4  27.36  50.075919  1035.9  707.9  26.31   
63  50.123759  1037.4  ...    693.7  27.44  50.139914  1029.3  703.2  26.47   
64  50.187897  1040.7  ...    694.6  27.38  50.204043  1028.7  702.0  26.46   
65  50.252035  1043.0  ...    697.2  27.39  50.268181  1034.0  707.0  26.37   
66  50.316125  1036.5  ...    700.2  27.39  50.332219  1032.7  706.1  26.40   
67  50.380211  1037.4  ...    701.7  27.31  50.396344  1032.2  705.0  26.39   
68  50.444344  1042.3  ...    704.3  27.23  50.460516  1033.6  705.3  26.33   
69  50.508604  1041.7  ...    705.0  27.22  50.524754  1035.7  706.8  26.28   
70  50.572880  1043.7  ...    705.7  27.20  50.589039  1033.7  704.6  26.31   
71  50.637001  1038.9  ...    705.2  27.24  50.653133  1033.0  704.5  26.33   
72  50.701277  1035.9  ...    705.9  27.25  50.717423  1034.0  705.2  26.31   
73  50.765441  1035.2  ...    709.0  27.24  50.781548  1034.5  706.6  26.33   
74  50.829600  1035.2  ...    712.1  27.16  50.845876  1033.6  706.1  26.36   
75  50.893959  1035.4  ...    712.4  27.07  50.910092  1035.9  707.8  26.30   
76  50.958101  1033.2  ...    712.1  27.17  50.974186  1036.9  708.5  26.28   
77  51.022230  1036.1  ...    714.8  27.25  51.038337  1036.3  709.2  26.33   
78  51.086346  1036.9  ...    716.9  27.22  51.102492  1041.4  714.6  26.26   
79  51.150449  1036.5  ...    713.5  27.31  51.166591  1042.7  716.0  26.25   
80  51.214578  1040.8  ...    714.3  27.31  51.230711  1046.5  719.4  26.18   
81  51.278673  1045.4  ...    715.9  27.30  51.294802  1052.1  723.4  26.04   
82  51.342936  1039.6  ...    714.7  27.33  51.359100  1053.6  726.1  26.06   
83  51.407091  1037.1  ...    715.0  27.34  51.423207  1052.8  726.4  26.10   
84  51.471160  1034.4  ...    710.9  27.44  51.487336  1058.2  731.6  26.02   
85  51.535462  1029.9  ...    706.7  27.58  51.551591  1059.3  732.8  26.01   
86  51.599583  1030.2  ...    711.6  27.52  51.615742  1052.7  727.4  26.14   

           28      29     30     31  
0   46.099654  1267.4  964.6  24.20  
1   46.162865  1271.8  967.8  24.11  
2   46.226036  1274.1  970.9  24.11  
3   46.289268  1273.8  971.6  24.15  
4   46.352444  1273.7  973.8  24.23  
5   46.415659  1276.1  977.5  24.25  
6   46.478826  1277.4  979.8  24.27  
7   46.542145  1143.9  857.6  26.28  
8   46.608969   845.2  567.4  31.76  
9   46.676305   758.1  479.5  33.88  
10  46.741271   755.9  466.7  33.46  
11  46.805838   769.2  468.3  32.60  
12  46.870140   789.0  476.5  31.63  
13  46.934234   814.1  490.5  30.62  
14  46.998346   840.6  507.3  29.68  
15  47.062609   869.2  527.0  28.78  
16  47.126908   895.2  545.7  28.04  
17  47.191167   920.7  564.9  27.36  
18  47.255638   938.0  579.2  26.97  
19  47.319876   955.4  593.6  26.58  
20  47.383983   971.0  606.5  26.23  
21  47.448121   984.0  616.7  25.95  
22  47.512384   997.8  627.9  25.65  
23  47.576500  1005.6  636.0  25.54  
24  47.640604  1010.9  640.9  25.45  
25  47.704720  1015.7  646.2  25.39  
26  47.769208  1023.2  653.9  25.28  
27  47.833268  1034.9  663.7  25.06  
28  47.897557  1048.3  675.7  24.82  
29  47.962051  1058.5  685.6  24.67  
..        ...     ...    ...    ...  
57  49.758927  1060.8  718.9  25.51  
58  49.823160  1061.3  719.5  25.50  
59  49.887285  1058.7  716.9  25.54  
60  49.951574  1059.7  718.7  25.55  
61  50.015725  1063.0  722.2  25.51  
62  50.079871  1062.2  722.2  25.54  
63  50.143909  1063.0  724.1  25.56  
64  50.208043  1057.3  718.5  25.65  
65  50.272189  1061.2  721.3  25.56  
66  50.336210  1067.5  728.7  25.50  
67  50.400352  1072.2  734.1  25.46  
68  50.464533  1075.5  737.9  25.43  
69  50.528758  1084.0  745.6  25.28  
70  50.593078  1085.0  746.5  25.27  
71  50.657168  1087.5  749.3  25.24  
72  50.721440  1090.2  752.1  25.21  
73  50.785552  1090.7  752.2  25.19  
74  50.849880  1088.0  750.4  25.25  
75  50.914100  1090.8  752.6  25.19  
76  50.978173  1094.2  756.7  25.17  
77  51.042363  1097.1  760.1  25.15  
78  51.106501  1100.8  764.3  25.11  
79  51.170608  1100.0  763.0  25.11  
80  51.234720  1099.8  763.4  25.13  
81  51.298819  1097.3  761.5  25.18  
82  51.363121  1095.8  761.7  25.25  
83  51.427211  1098.4  764.6  25.23  
84  51.491375  1094.6  761.6  25.30  
85  51.555599  1090.3  759.7  25.44  
86  51.619759  1093.9  763.2  25.38  

[87 rows x 32 columns]

In [18]:
#determine the zero time point and subtract it from the entire column
time_zero = float(input("Which time would you like to be set to 0?  (Must be a valid time)"))
df[0]= df[0]-time_zero


Which time would you like to be set to 0?  (Must be a valid time)46.6

In [19]:
#Where is the index value for the zero location?
zero_location_series = df[df[0] == min(filter(lambda x:x>0, df[0]))]

if array_num ==2:#using that index, divide each row by the value at that index to normalize the data to 1
    r1 = zero_location_series[2]
    df["Res1"] = df[2].apply(lambda x: x/r1, 0)
    df["Res1"]

    r2 = zero_location_series[6]
    df["Res2"] = df[6].apply(lambda x: x/r2, 0)


    r3 = zero_location_series[10]
    df["Res3"] = df[10].apply(lambda x: x/r3, 0)

    r4 = zero_location_series[14]
    df["Res4"] = df[14].apply(lambda x: x/r4, 0)

    r5 = zero_location_series[18]
    df["Res5"] = df[18].apply(lambda x: x/r5, 0)

    r6 = zero_location_series[22]
    df["Res6"] = df[22].apply(lambda x: x/r6, 0)

    r7 = zero_location_series[26]
    df["Res7"] = df[26].apply(lambda x: x/r7, 0)

    r8 = zero_location_series[30]
    df["Res8"] = df[30].apply(lambda x: x/r8, 0)

    r9 = zero_location_series[34]
    df["Res9"] = df[34].apply(lambda x: x/r9, 0)

    r10 = zero_location_series[38]
    df["Res10"] = df[38].apply(lambda x: x/r10, 0)

    r11 = zero_location_series[42]
    df["Res11"] = df[42].apply(lambda x: x/r11, 0)

    r12 = zero_location_series[46]
    df["Res12"] = df[46].apply(lambda x: x/r12, 0)

    r13 = zero_location_series[50]
    df["Res13"] = df[50].apply(lambda x: x/r13, 0)

    r14 = zero_location_series[54]
    df["Res14"] = df[54].apply(lambda x: x/r14, 0)

    r15 = zero_location_series[58]
    df["Res15"] = df[58].apply(lambda x: x/r15, 0)

    r16 = zero_location_series[62]
    df["Res16"] = df[62].apply(lambda x: x/r16, 0)
if array_num ==1:
    r1 = zero_location_series[2]
    df["Res1"] = df[2].apply(lambda x: x/r1, 0)
    df["Res1"]

    r2 = zero_location_series[6]
    df["Res2"] = df[6].apply(lambda x: x/r2, 0)


    r3 = zero_location_series[10]
    df["Res3"] = df[10].apply(lambda x: x/r3, 0)

    r4 = zero_location_series[14]
    df["Res4"] = df[14].apply(lambda x: x/r4, 0)

    r5 = zero_location_series[18]
    df["Res5"] = df[18].apply(lambda x: x/r5, 0)

    r6 = zero_location_series[22]
    df["Res6"] = df[22].apply(lambda x: x/r6, 0)

    r7 = zero_location_series[26]
    df["Res7"] = df[26].apply(lambda x: x/r7, 0)

    r8 = zero_location_series[30]
    df["Res8"] = df[30].apply(lambda x: x/r8, 0)

In [20]:
#get rid of all the extraneous data we don't need now
if array_num ==2:
    dropcolumns = np.arange(1,64)
if array_num==1:
    dropcolumns = np.arange(1,32)
    
df.drop(dropcolumns, axis = 1, inplace = True)

In [21]:
#output the data to a filename - can use excel and probably should in the future who likes csv files anyway
output = input("Filename to export to? ")
df.to_csv(output)


Filename to export to? df8out.csv

In [ ]: