-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f4666b
commit 1bf9faa
Showing
2 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "394a0a06-5f68-49a3-8358-fdd42ee2be2f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import tensorflow as tf" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "c37b749e-5bc8-4a94-b7db-0eb123970a8a", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Num GPUs Available: 0\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Num GPUs Available: \", len(tf.config.experimental.list_physical_devices('GPU')))\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "4adf839f-d9f5-4adc-887b-20cbf7376d12", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "ModuleNotFoundError", | ||
"evalue": "No module named 'matplotlib'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", | ||
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m\n\u001b[0;32m 2\u001b[0m get_ipython()\u001b[38;5;241m.\u001b[39mrun_line_magic(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmatplotlib\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124minline\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Battery types and their power density ranges\u001b[39;00m\n", | ||
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'matplotlib'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"%matplotlib inline\n", | ||
"\n", | ||
"# Battery types and their power density ranges\n", | ||
"batteries = [\n", | ||
" \"Lead-Acid\",\n", | ||
" \"Nickel-Cadmium (NiCd)\",\n", | ||
" \"Nickel-Metal Hydride (NiMH)\",\n", | ||
" \"Lithium-Ion (Li-ion)\",\n", | ||
" \"Lithium Polymer (LiPo)\",\n", | ||
" \"Lithium Iron Phosphate (LiFePO4)\",\n", | ||
" \"Ultracapacitors\"\n", | ||
"]\n", | ||
"\n", | ||
"power_density_min = [30, 150, 200, 250, 200, 300, 1000]\n", | ||
"power_density_max = [50, 300, 300, 340, 400, 1000, 10000]\n", | ||
"\n", | ||
"# Create the figure and axis\n", | ||
"fig, ax = plt.subplots()\n", | ||
"\n", | ||
"# Plotting the power density ranges as bar chart\n", | ||
"for i in range(len(batteries)):\n", | ||
" ax.barh(batteries[i], power_density_max[i], color='skyblue')\n", | ||
" ax.barh(batteries[i], power_density_min[i], color='navy')\n", | ||
"\n", | ||
"# Add labels and title\n", | ||
"ax.set_xlabel('Power Density (W/kg)')\n", | ||
"ax.set_title('Power Density Comparison of Different Battery Types')\n", | ||
"\n", | ||
"# Show the chart\n", | ||
"plt.show()\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "81fe010e-b0e7-4cfb-8ed2-7bb3aefe8234", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import sys\n", | ||
"print(sys.version)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1b94ee58-384d-4e40-8f0d-e96f8c595398", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Chapter 6 Manipulating Strings"]},{"cell_type":"markdown","metadata":{},"source":[]}],"metadata":{"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":2} |