Skip to content

Commit

Permalink
Added notebook duration (#79)
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
jcohenadad authored Jan 24, 2024
1 parent 04276c0 commit bb93679
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion data_processing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"source": [
"# Necessary imports\n",
"\n",
"from datetime import datetime, timedelta\n",
"import os\n",
"import re\n",
"import json\n",
Expand All @@ -102,8 +103,10 @@
"metadata": {},
"outputs": [],
"source": [
"# Checking where we are\n",
"# Start timer\n",
"start_time = datetime.now()\n",
"\n",
"# Check where we are\n",
"!pwd"
]
},
Expand Down Expand Up @@ -804,6 +807,30 @@
"cbar_ax.set_title('nT/V', size=12)\n",
"plt.show\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9128d799",
"metadata": {},
"outputs": [],
"source": [
"# Indicate duration of data processing\n",
"\n",
"end_time = datetime.now()\n",
"total_time = (end_time - start_time).total_seconds()\n",
"\n",
"# Convert seconds to a timedelta object\n",
"total_time_delta = timedelta(seconds=total_time)\n",
"\n",
"# Format the timedelta object to a string\n",
"formatted_time = str(total_time_delta)\n",
"\n",
"# Pad the string representation if less than an hour\n",
"formatted_time = formatted_time.rjust(8, '0')\n",
"\n",
"print(f\"Total Runtime [hour:min:sec]: {formatted_time}\")"
]
}
],
"metadata": {
Expand Down

0 comments on commit bb93679

Please sign in to comment.