PLaSK library
Loading...
Searching...
No Matches
bands4-plot.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3# Copyright (c) 2022 Lodz University of Technology
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13
14
15import numpy as np
16import matplotlib.pyplot as plt
17
18data = np.loadtxt('bands4.out', unpack=True)
19
20plt.figure()
21plt.plot(data[0], np.sqrt(np.sum(data[1:3,:]**2, 0)), 'k--', lw=0.7)
22
23try:
24 reference = np.loadtxt('bands6.dat', unpack=True)
25except IOError:
26 pass
27else:
28 plt.plot(reference[0], reference[3], '.', color='0.7')
29
30plt.plot(data[0], data[3], '.', color='maroon', ms=2)
31
32plt.xticks([0., np.pi, 2*np.pi, np.pi*(2+2**0.5)], ['$\\Gamma$', 'X', 'M', '$\\Gamma$'])
33plt.xlim(0., np.pi*(2+2**0.5))
34plt.grid(axis='x')
35
36plt.ylabel("$\\omega/c$")
37
38plt.tight_layout()
39# plt.window_title('Photonic Bands')
40
41plt.savefig('bands4.png')
42
43plt.show()