Skip to content

Commit

Permalink
fixed the mpb autonaming quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipDominec committed Jan 16, 2016
1 parent bfff9c1 commit 42ae252
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
Binary file modified example_1D_dielectric_slabs/EBars_eps100_R=10000_eps=1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example_1D_dielectric_slabs/EBars_eps100_R=10000_eps=10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example_1D_dielectric_slabs/EBars_eps100_R=10000_eps=2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions example_1D_dielectric_slabs/batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mkdir data -p
#for rr in 0 3000 10000 12000
rr=10000

#for ee in `seq 1 1 20`
for ee in `seq 1 1 20`
do
## Prepare and print the parameters that are used in IFC.ctl to define the structure
Expand All @@ -19,8 +20,8 @@ do
## Generate IFC and fields (at Gamma, X and M points)
mpb $param ../compute_dispersion_and_modes.ctl | grep kgrid > freq.csv
cp freq.csv data/freq_`echo $param | tr ' ' '_'`.csv
mpb-data -m 2 [eh].*h5
mpb-data -m 2 epsilon.h5
mpb-data -m 2 compute_dispersion_and_modes-*h5
mpb-data -m 2 compute_dispersion_and_modes-epsilon.h5

## Plot the results
python ../plot_dispersion_and_modes.py $param
Expand All @@ -29,7 +30,7 @@ do
#python ../HxHyEz_plot.py [e].*h5 [h].*h5 [h].*h5

## Clean up
rm -r [eh].*h5
rm -r compute_dispersion_and_modes-*h5
done


9 changes: 5 additions & 4 deletions plot_dispersion_and_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import matplotlib.cm as cm

filename = "freq.csv"
ctlscript = "compute_dispersion_and_modes-" ## what is prepended to *.h5 files; try empty if simulation fails to find them
bandnumber = 6
cellspacing = 100e-6
fcoef = c / cellspacing
Expand Down Expand Up @@ -76,16 +77,16 @@ def plot_IFC(Kx, Ky, freqs):#{{{
plt.grid(True)
#}}}
def generate_filenames(k=1, band=1, pol='tm'):#{{{
file_Ez = 'e.k%02d.b%02d.z.%s.h5' % (k, band, pol)
file_Hx = 'h.k%02d.b%02d.x.%s.h5' % (k, band, pol)
file_Hy = 'h.k%02d.b%02d.y.%s.h5' % (k, band, pol)
file_Ez = '%se.k%02d.b%02d.z.%s.h5' % (ctlscript, k, band, pol)
file_Hx = '%sh.k%02d.b%02d.x.%s.h5' % (ctlscript, k, band, pol)
file_Hy = '%sh.k%02d.b%02d.y.%s.h5' % (ctlscript, k, band, pol)
return file_Ez, file_Hx, file_Hy
#}}}
def plot_mode(file1, file2, file3, title='', plot_vectors=True):#{{{
#print "---------"
#print h5py.File('epsilon.h5', "r").keys()
#print h5py.File(file2, "r").keys()
eps = np.array(h5py.File('epsilon.h5', "r")['data-new'])
eps = np.array(h5py.File('%sepsilon.h5' % ctlscript, "r")['data-new'])
Ez_data = np.array(h5py.File(file1, "r")['z.i-new'])
Hx_data = np.array(h5py.File(file2, "r")['x.r-new'])
Hy_data = np.array(h5py.File(file3, "r")['y.r-new'])
Expand Down

0 comments on commit 42ae252

Please sign in to comment.