numpy
borgWarp
ADDA
listOperation
#migrated

numpy > 1.45を含む、プラスマイナス0.05の数値列を取得する > 線形スケール版:range=0.05; np.linspace(1.45 - range, 1.45 + range, 51) | 対数スケール版

動作環境
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.1.0
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
import numpy as np

しておく

リンク

https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html

線形スケール版

>>> range=0.05; np.linspace(1.45 - range, 1.45 + range, 51)
array([ 1.4  ,  1.402,  1.404,  1.406,  1.408,  1.41 ,  1.412,  1.414,
        1.416,  1.418,  1.42 ,  1.422,  1.424,  1.426,  1.428,  1.43 ,
        1.432,  1.434,  1.436,  1.438,  1.44 ,  1.442,  1.444,  1.446,
        1.448,  1.45 ,  1.452,  1.454,  1.456,  1.458,  1.46 ,  1.462,
        1.464,  1.466,  1.468,  1.47 ,  1.472,  1.474,  1.476,  1.478,
        1.48 ,  1.482,  1.484,  1.486,  1.488,  1.49 ,  1.492,  1.494,
        1.496,  1.498,  1.5  ])

対数スケール版

bashでの参考: http://qiita.com/7of9/items/55917024364098851feb#comment-0293af032c91575cd935

>>> range=1; 10**np.linspace(3 - range, 3 + range, 51)
array([   100.        ,    109.64781961,    120.22644346,    131.82567386,
          144.54397707,    158.48931925,    173.78008287,    190.5460718 ,
          208.92961309,    229.08676528,    251.18864315,    275.42287033,
          301.99517204,    331.13112148,    363.07805477,    398.10717055,
          436.51583224,    478.63009232,    524.80746025,    575.43993734,
          630.95734448,    691.83097092,    758.57757503,    831.7637711 ,
          912.01083936,   1000.        ,   1096.47819614,   1202.26443462,
         1318.25673856,   1445.43977075,   1584.89319246,   1737.80082875,
         1905.46071796,   2089.29613085,   2290.86765277,   2511.88643151,
         2754.22870334,   3019.9517204 ,   3311.31121483,   3630.7805477 ,
         3981.07170553,   4365.1583224 ,   4786.30092323,   5248.0746025 ,
         5754.39937337,   6309.5734448 ,   6918.30970919,   7585.77575029,
         8317.63771103,   9120.10839356,  10000.        ])

code

group_run_adda_170819.py
import subprocess as sb
import numpy as np
import sys

# on Python 3.5.2

# codingrule: PEP8

RUN_PARAM = "-store_int_field -grid 26"
# RUN_PARAM = "-store_int_field"  # for test

# real part of refractive index (linear scale)
R_RANGE = 0.05  # linear
R_NUM = 21
R_CENTER = 1.45
mrs = np.linspace(R_CENTER - R_RANGE, R_CENTER + R_RANGE, R_NUM)
# imaginary part of refractive index (logarithmic scale)
I_RANGE = 1  # linear
I_NUM = 21
I_CENTER = -4
mis = 10**np.linspace(I_CENTER - I_RANGE, I_CENTER + I_RANGE, I_NUM)

# debug
print(mrs)
print(mis)
sys.exit()

for amr in mrs:
    for ami in mis:
        cmd = "./adda -m %f %f %s" % (amr, ami, RUN_PARAM)
        print(cmd)
        sb.run(cmd.split(), stdout=sb.DEVNULL)

run
$ python3 group_run_adda_170819.py 
[ 1.4    1.405  1.41   1.415  1.42   1.425  1.43   1.435  1.44   1.445
  1.45   1.455  1.46   1.465  1.47   1.475  1.48   1.485  1.49   1.495  1.5  ]
[  1.00000000e-05   1.25892541e-05   1.58489319e-05   1.99526231e-05
   2.51188643e-05   3.16227766e-05   3.98107171e-05   5.01187234e-05
   6.30957344e-05   7.94328235e-05   1.00000000e-04   1.25892541e-04
   1.58489319e-04   1.99526231e-04   2.51188643e-04   3.16227766e-04
   3.98107171e-04   5.01187234e-04   6.30957344e-04   7.94328235e-04
   1.00000000e-03]

検索用キーワード

  • 中心
  • 中央