Skip to content

Commit

Permalink
update the example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
Dou Du committed Jul 17, 2024
1 parent c341a59 commit 4c579f1
Showing 1 changed file with 49 additions and 20 deletions.
69 changes: 49 additions & 20 deletions example/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,15 @@
"metadata": {},
"outputs": [],
"source": [
"with open('./data/Si_bands.json', 'r') as file:\n",
" band_Si = json.load(file)\n",
" \n",
"with open('./data/Si_dos.json', 'r') as file:\n",
" dos_Si = json.load(file)\n",
" \n",
"with open('./data/Co_bands.json', 'r') as file:\n",
" band_Co = json.load(file)\n",
" \n",
"with open('./data/Co_dos.json', 'r') as file:\n",
" dos_Co = json.load(file)\n",
" \n",
"with open('./data/Si_bands_Shifted.json', 'r') as file:\n",
" band_Si_shifted = json.load(file)"
"def load_file(filename):\n",
" with open(filename, 'r') as fhandle:\n",
" return json.load(fhandle)\n",
"\n",
"si_bands = load_file(\"./data/Si_bands.json\")\n",
"si_dos = load_file(\"./data/Si_dos.json\")\n",
"co_bands = load_file(\"./data/Co_bands.json\")\n",
"co_dos = load_file(\"./data/Co_dos.json\")\n",
"si_bands_shifted = load_file(\"./data/Si_bands_Shifted.json\")"
]
},
{
Expand All @@ -126,7 +121,15 @@
"metadata": {},
"outputs": [],
"source": [
"w1 = BandsPlotWidget(bands=[band_Si], dos=dos_Si, plot_fermilevel = True, show_legend = True, energy_range = [-10.0, 10.0])\n",
"w1 = BandsPlotWidget(\n",
" bands = [si_bands],\n",
" dos = si_dos,\n",
" energy_range = [-10.0, 10.0],\n",
" format_settings = {\n",
" \"showFermi\": True,\n",
" \"showLegend\": True,\n",
" }\n",
")\n",
"display(w1)"
]
},
Expand All @@ -143,7 +146,17 @@
"metadata": {},
"outputs": [],
"source": [
"w2 = BandsPlotWidget(bands=[band_Co], dos=dos_Co, plot_fermilevel = True, show_legend = True, energy_range = [-10.0, 10.0], bands_color = [[\"red\", \"blue\"]])\n",
"w2 = BandsPlotWidget(\n",
" bands=[co_bands],\n",
" dos=co_dos,\n",
" energy_range = [-10.0, 10.0],\n",
" bands_color = [[\"red\", \"blue\"]],\n",
" format_settings = {\n",
" \"showFermi\": True,\n",
" \"showLegend\": True,\n",
" }\n",
")\n",
"\n",
"display(w2)"
]
},
Expand All @@ -160,7 +173,15 @@
"metadata": {},
"outputs": [],
"source": [
"w3 = BandsPlotWidget(dos=dos_Co, plot_fermilevel = True, show_legend = True, energy_range = [-10,10])\n",
"w3 = BandsPlotWidget(\n",
" dos=co_dos,\n",
" energy_range = [-10.0, 10.0],\n",
" format_settings = {\n",
" \"showFermi\": True,\n",
" \"showLegend\": True,\n",
" } \n",
")\n",
"\n",
"display(w3)"
]
},
Expand All @@ -177,7 +198,10 @@
"metadata": {},
"outputs": [],
"source": [
"w4 = BandsPlotWidget(bands=[band_Si], plot_fermilevel = True, show_legend = True, energy_range = [-10.0, 10.0])\n",
"w4 = BandsPlotWidget(\n",
" bands=[si_bands],\n",
" energy_range = [-10.0, 10.0]\n",
")\n",
"display(w4)"
]
},
Expand All @@ -194,7 +218,12 @@
"metadata": {},
"outputs": [],
"source": [
"w5 = BandsPlotWidget(bands=[band_Si, band_Si_shifted], dos=dos_Si, plot_fermilevel = True, show_legend = True, energy_range = [-10.0, 10.0], bands_color=['red', 'yellow'])\n",
"w5 = BandsPlotWidget(\n",
" bands=[si_bands, si_bands_shifted],\n",
" dos=si_dos,\n",
" energy_range = [-10.0, 10.0],\n",
" bands_color=['red', 'yellow']\n",
")\n",
"display(w5)"
]
},
Expand Down Expand Up @@ -222,7 +251,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.11.5"
},
"voila": {
"authors": "Dou Du and Giovanni Pizzi"
Expand Down

0 comments on commit 4c579f1

Please sign in to comment.