Quellcode durchsuchen

2d sweep plot init

Konstantin Ladutenko vor 6 Jahren
Ursprung
Commit
b284a5e985
8 geänderte Dateien mit 52 neuen und 11 gelöschten Zeilen
  1. 0 1
      create_hpc_bat.lsf
  2. 14 5
      efficiency-plasmon-plot.py
  3. 1 0
      hpc.bat
  4. 0 1
      main.lsf
  5. 0 1
      mat_save.lsf
  6. 3 2
      rsync.sh
  7. 0 1
      save_1D_monitor.lsf
  8. 34 0
      sweep-plot2d.py

+ 0 - 1
create_hpc_bat.lsf

@@ -1,4 +1,3 @@
-clear;
 redrawoff;
 status = layoutmode;
 slash = "/";

+ 14 - 5
efficiency-plasmon-plot.py

@@ -2,6 +2,7 @@
 # -*- coding: UTF-8 -*-
 import numpy as np
 import matplotlib.pyplot as plt
+import os
 c = 299792458
 pi = np.pi
 verbose = 6
@@ -146,7 +147,8 @@ def analyze(data, dist, z_vec, wl_idx):
     print(dirname)
     print("Power: plasmon %4.3g W of dipoles %4.3g W, efficiency %5.3g%%  from:"%(ppw, float(np.abs(dip_power[0])),float(np.abs( eta0))), ppw, eta0)
     plt.plot(lambd*1e9, plasmon_power/ dip_power)
-    plt.ylim(0,0.04)
+    np.save(dirname,np.real(plasmon_power/ dip_power))
+    #plt.ylim(0,0.04)
     plt.xlim(550,800)
 
     #plt.plot(lambd*1e9, np.real(eps2))
@@ -164,7 +166,7 @@ def analyze(data, dist, z_vec, wl_idx):
     plt.clf()
     plt.close()
     
-file_ext="pdf"
+file_ext="png"
 #dirname="template-dipole-on-sphere-on-surf-z.fsp.results"
 #dirname="Au-JC-R100-Au-JC.fsp.results"
 #dirname="Au-McPeak-R100-Si-Green.fsp.results"
@@ -180,7 +182,7 @@ file_ext="pdf"
 # dirname=""
 # dirname=""
 # dirname=""
-dirname="bg-Au-sub-Si-dipole-Au.fsp.results"
+#dirname="bg-Au-sub-Si-dipole-Au.fsp.results"
 #dirname="bg-Au-sub-dipole-Au.fsp.results"
 #dirname="bg-Au-sub-Au-dipole-Au.fsp.results"
 #dirname="Au-McPeak-R0.fsp.results"
@@ -191,7 +193,7 @@ dirname="bg-Au-sub-Si-dipole-Au.fsp.results"
 #dirname="Au-sub-dipole-W.fsp.results"
 #dirname="Au-sub-Au-dipole-W.fsp.results"
 #dirname="Au-sub-Si-dipole-W.fsp.results"
-def main ():
+def main (dirname):
     distance = [1,2,3,4,5,6,7,8,9,10] #mkm
     zshift = ["5","20"]
     # zshift = ["5","20","200","400","600"]
@@ -230,4 +232,11 @@ def main ():
     # plt.savefig(dirname+"_WLs."+file_ext)
     # plt.clf()
     # plt.close()
-main()
+
+from glob import glob
+paths = glob('*.results')
+for dirname in paths:
+    main(dirname)
+# dir_list = next(os.walk('.'))[1]
+# print(dir_list)
+#main()

+ 1 - 0
hpc.bat

@@ -1,5 +1,6 @@
 @echo off
 REM run on hpc
+
 setlocal EnableDelayedExpansion
 set "startTime=%time: =0%"
 

+ 0 - 1
main.lsf

@@ -1,4 +1,3 @@
-clear;
 #load("template-dipole-on-sphere-on-surf-z.fsp");
 status = layoutmode;
 if (status == 1) {

+ 0 - 1
mat_save.lsf

@@ -1,4 +1,3 @@
-clear;
 slash = "/";
 if (operatingsystem == "windows") {slash = "\\";}
 #########################################

+ 3 - 2
rsync.sh

@@ -1,6 +1,7 @@
 #!/bin/bash
-find . -type d -exec \cp -rf *.lsf {} \;
-find . -type d -exec \cp -rf *.bat {} \;
+find . -type d -exec rsync -auz  --no-perms --no-owner --no-group *.lsf  {} \;
+find . -type d -exec rsync -auz  --no-perms --no-owner --no-group *.bat {} \;
+find . -type d -exec rsync -auz  --no-perms --no-owner --no-group *.py {} \;
 #remote="/run/user/1000/gvfs/smb-share\:server\=192.168.5.18\,share\=hpc_d/k.ladutenko/0-tig-smuthi"
 #remote="/run/user/1000/gvfs/smb-share\:server\=192.168.5.30\,share\=users/z.ladutenko/0-tig-smuthi"
 echo $remote/setup.py

+ 0 - 1
save_1D_monitor.lsf

@@ -1,4 +1,3 @@
-clear;
 redrawoff;
 slash = "/";
 if (operatingsystem == "windows") {slash = "\\";}

+ 34 - 0
sweep-plot2d.py

@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+import numpy as np
+import matplotlib.pyplot as plt
+import os
+
+from glob import glob
+paths = glob('sweep_*.fsp.results.npy')
+import re
+
+def atoi(text):
+    return int(text) if text.isdigit() else text
+
+def natural_keys(text):
+    '''
+    alist.sort(key=natural_keys) sorts in human order
+    http://nedbatchelder.com/blog/200712/human_sorting.html
+    (See Toothy's implementation in the comments)
+    '''
+    return [ atoi(c) for c in re.split('(\d+)', text) ]
+paths.sort(key=natural_keys)
+
+a = np.load('sweep_1.fsp.results.npy')
+spectra_len = len(a)
+r_len = len(paths)
+data = np.zeros((r_len,spectra_len ))
+
+for dirname, i in zip(paths,range(len(paths))):
+    a = np.load(dirname)
+    data[i] = a
+
+# dir_list = next(os.walk('.'))[1]
+# print(dir_list)
+#main()