Skip to content

Commit 17336c4

Browse files
committed
Updated XDE testing notebook
1 parent 084bef7 commit 17336c4

File tree

5 files changed

+29
-25
lines changed

5 files changed

+29
-25
lines changed

notebooks/Tricahue_XDE.ipynb

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 21,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -19,21 +19,21 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": 22,
22+
"execution_count": 2,
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
26-
"files = [\"C:/Users/smf12/SPUR/Tricahue/tests/test_files/ExpNOTs_GFP.xlsx\", \"C:/Users/smf12/SPUR/Tricahue/tests/test_files/ExpNOTs_GFP_trans.xlsx\"]\n",
26+
"files = [\"../tests/test_files/ExpNOTs_GFP.xlsx\", \"../tests/test_files/ExpNOTs_GFP_trans.xlsx\"]\n",
2727
"sheet_name = \"Table All Cycles\"\n",
2828
"time_col_name = \"Time\"\n",
29-
"data_cols_offset = 11\n",
29+
"data_cols_offset = 2\n",
3030
"\n",
31-
"XDC_file_name = \"C:/Users/smf12/SPUR/Tricahue/tests/test_files/xperimental_data_connector_template.xlsx\""
31+
"XDC_file_name = \"../tests/test_files/xperimental_data_connector_template.xlsx\""
3232
]
3333
},
3434
{
3535
"cell_type": "code",
36-
"execution_count": 23,
36+
"execution_count": 3,
3737
"metadata": {},
3838
"outputs": [],
3939
"source": [
@@ -43,49 +43,52 @@
4343
},
4444
{
4545
"cell_type": "code",
46-
"execution_count": 24,
46+
"execution_count": 4,
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
50+
"# get sample data from files\n",
5051
"sample_list = xde.generateSampleData(files, sheet_name, time_col_name, data_cols_offset)\n",
51-
"# sample_list"
52+
"# print(sample_list)"
5253
]
5354
},
5455
{
5556
"cell_type": "code",
56-
"execution_count": 25,
57+
"execution_count": 5,
5758
"metadata": {},
5859
"outputs": [
5960
{
6061
"name": "stdout",
6162
"output_type": "stream",
6263
"text": [
63-
"['C:/Users/smf12/SPUR/Tricahue/tests/test_files/ExpNOTs_GFP.xlsx', 'C:/Users/smf12/SPUR/Tricahue/tests/test_files/ExpNOTs_GFP_trans.xlsx']\n"
64+
"['../tests/test_files/ExpNOTs_GFP.xlsx', '../tests/test_files/ExpNOTs_GFP_trans.xlsx']\n"
6465
]
6566
}
6667
],
6768
"source": [
69+
"# build pandas DataFrame from the sample data\n",
6870
"output_df = xde.buildFinalDF(files,\n",
6971
" sample_list, \n",
7072
" time_col_name, \n",
7173
" data_cols_offset, \n",
7274
" num_rows_btwn_data=0, \n",
7375
" sheet_to_read_from=sheet_name)\n",
74-
"# output_df.head()"
76+
"# print(output_df.head())"
7577
]
7678
},
7779
{
7880
"cell_type": "code",
79-
"execution_count": 26,
81+
"execution_count": 6,
8082
"metadata": {},
8183
"outputs": [],
8284
"source": [
85+
"# write the DataFrame to the XDC file in the 'Measurement' sheet\n",
8386
"xde.writeToMeasurements(XDC_file_name, output_df)"
8487
]
8588
},
8689
{
8790
"cell_type": "code",
88-
"execution_count": 27,
91+
"execution_count": 7,
8992
"metadata": {},
9093
"outputs": [
9194
{
@@ -123,59 +126,60 @@
123126
" <td>Sample1</td>\n",
124127
" <td>Signal1</td>\n",
125128
" <td>0 h</td>\n",
126-
" <td>740</td>\n",
129+
" <td>30</td>\n",
127130
" </tr>\n",
128131
" <tr>\n",
129132
" <th>1</th>\n",
130133
" <td>Measurement1</td>\n",
131134
" <td>Sample1</td>\n",
132135
" <td>Signal1</td>\n",
133136
" <td>0 h 4 min</td>\n",
134-
" <td>754</td>\n",
137+
" <td>30</td>\n",
135138
" </tr>\n",
136139
" <tr>\n",
137140
" <th>2</th>\n",
138141
" <td>Measurement2</td>\n",
139142
" <td>Sample1</td>\n",
140143
" <td>Signal1</td>\n",
141144
" <td>0 h 8 min</td>\n",
142-
" <td>770</td>\n",
145+
" <td>28</td>\n",
143146
" </tr>\n",
144147
" <tr>\n",
145148
" <th>3</th>\n",
146149
" <td>Measurement3</td>\n",
147150
" <td>Sample1</td>\n",
148151
" <td>Signal1</td>\n",
149152
" <td>0 h 12 min</td>\n",
150-
" <td>773</td>\n",
153+
" <td>29</td>\n",
151154
" </tr>\n",
152155
" <tr>\n",
153156
" <th>4</th>\n",
154157
" <td>Measurement4</td>\n",
155158
" <td>Sample1</td>\n",
156159
" <td>Signal1</td>\n",
157160
" <td>0 h 16 min</td>\n",
158-
" <td>777</td>\n",
161+
" <td>30</td>\n",
159162
" </tr>\n",
160163
" </tbody>\n",
161164
"</table>\n",
162165
"</div>"
163166
],
164167
"text/plain": [
165168
" Measurement ID Sample ID Signal ID Time Value\n",
166-
"0 Measurement0 Sample1 Signal1 0 h 740\n",
167-
"1 Measurement1 Sample1 Signal1 0 h 4 min 754\n",
168-
"2 Measurement2 Sample1 Signal1 0 h 8 min 770\n",
169-
"3 Measurement3 Sample1 Signal1 0 h 12 min 773\n",
170-
"4 Measurement4 Sample1 Signal1 0 h 16 min 777"
169+
"0 Measurement0 Sample1 Signal1 0 h 30\n",
170+
"1 Measurement1 Sample1 Signal1 0 h 4 min 30\n",
171+
"2 Measurement2 Sample1 Signal1 0 h 8 min 28\n",
172+
"3 Measurement3 Sample1 Signal1 0 h 12 min 29\n",
173+
"4 Measurement4 Sample1 Signal1 0 h 16 min 30"
171174
]
172175
},
173-
"execution_count": 27,
176+
"execution_count": 7,
174177
"metadata": {},
175178
"output_type": "execute_result"
176179
}
177180
],
178181
"source": [
182+
"# for testing; read the 'Measurement' sheet from the XDC excel file\n",
179183
"xls = pd.ExcelFile(XDC_file_name)\n",
180184
"measurement = pd.read_excel(xls, 'Measurement')\n",
181185
"measurement.head()"
0 Bytes
Binary file not shown.

src/tricahue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def generateSampleData(self, file_list,sheet_to_read_from,time_col_name,data_col
334334
sample_data_list.append(temp_tuple)
335335

336336
with pd.ExcelWriter(file_list[0], mode='a', engine='openpyxl', if_sheet_exists='replace') as writer:
337-
result.to_excel(writer,'Sample',index=False)
337+
result.to_excel(writer,'Sample',index=False)
338338

339339
return sample_data_list
340340

tests/test_files/ExpNOTs_GFP.xlsx

164 Bytes
Binary file not shown.
66.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)