GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.2.1
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)
scipy v0.19.1
geopandas v0.3.0
MATLAB R2017b (Home Edition)
ADDA v.1.3b6
This article is related to ADDA (light scattering simulator based on the discrete dipole approximation).
Link
- ADDA > tool > loop_beta_gamma_171216.py > v0.1-v0.3 > run sequentially ADDA for different values of [beta] and [gamma] for orientations by Euler angles ([alpha] is fixed as 0.0)
- ADDA > tool > ADDA_pySpherepts_171217 > to obtain [beta_gamma.tbl]
- geometry > calculate polar and azimuth angles from (x,y,z) vector > Equations and Numpy Implementation > polarAzimuthCalc_171209.py > v0.1..v0.3
About
A Python script to make table for [Icosahedral nodes] and [Hammersley nodes] by using pySpherepts_171126.
The output file can be used with loop_beta_gamma_171216.py to run sequentially ADDA for different values of [beta] and [gamma] for orientations by Euler angles (Note: [alpha] is fixed as 0.0).
This is a script written on the package [ADDA_pySpherepts_171217] on GitHub.
Requirements
- Python3 (tested on Python 3.5.2)
- Numpy (tested on Numpy v1.13.1)
- pySpherepts_171126 (tested on v0.2)
- polarAzimuthCalc_171209.py (tested using v0.3)
Code v0.1
import numpy as np
import polarAzimuthCalc_171209 as pAC
import getIcosNodes_171126 as gIN
import getHammersleyNodes_171203 as gHN
import sys
'''
Dec. 17, 2017
This script requires the setup of [pySpherepts_171126] package shown at
https://github.com/yasokada/pySpherepts_171126
for [getIcosNodes_171126]
'''
'''
v0.1 Dec. 17, 2017
- add Test_run_getIcosNodes()
- add make_beta_gamma_tbl_gIN()
'''
kFile_output_gIN = 'beta_gamma_gIN.tbl'
kFile_output_gHN = 'beta_gamma_gHN.tbl'
def output_file(outlst, filename):
hdrtxt = 'beta(deg),gamma(deg)'
np.savetxt(filename, outlst, fmt='%.3f',
delimiter=",", header=hdrtxt)
msg = "[{0}] is created".format(filename)
print(msg)
def make_beta_gamma_tbl_gIN(kIndex, typeIndex):
xs, tris = gIN.getIcosNodes(kIndex, typeIndex)
outlst = []
for elem in xs:
beta_rad = pAC.calc_beta_rad(elem)
gamma_rad = pAC.calc_gamma_rad(elem)
beta_deg = np.rad2deg(beta_rad)
gamma_deg = np.rad2deg(gamma_rad)
outlst += [[beta_deg, gamma_deg]]
output_file(outlst, kFile_output_gIN)
def make_beta_gamma_tbl_gHN(nodeNumber):
xs = gHN.getHammersleyNodes(nodeNumber)
outlst = []
for elem in xs:
beta_rad = pAC.calc_beta_rad(elem)
gamma_rad = pAC.calc_gamma_rad(elem)
beta_deg = np.rad2deg(beta_rad)
gamma_deg = np.rad2deg(gamma_rad)
outlst += [[beta_deg, gamma_deg]]
output_file(outlst, kFile_output_gHN)
def Test_run_gIN():
# make_beta_gamma_tbl_gIN(0, typeIndex=0) # 12 points
# make_beta_gamma_tbl_gIN(1, typeIndex=0) # 42 points
# make_beta_gamma_tbl_gIN(2, typeIndex=0) # 162 points
# make_beta_gamma_tbl_gIN(3, typeIndex=0) # 642 points
make_beta_gamma_tbl_gIN(4, typeIndex=0) # 2562 points
def Test_run_gHN():
make_beta_gamma_tbl_gHN(60)
if __name__ == '__main__':
Test_run_gIN()
Test_run_gHN()
Run example
$ python3 make_beta_gamma_tbl_pySphere_171217.py
[beta_gamma_gIN.tbl] is created
[beta_gamma_gHN.tbl] is created
Tables for [Icosahedral nodes (noted as gIN)] and [Hammersley nodes (noted as gHN)] are created.
In the above code, the [Icosahedral nodes] is configured to take kindex of 4 and typeIndex of 0, resulting in N=2562 points.
On the other hand, the [Hammersley nodes] is configured to have N=60 points.
By changing the parameters in Test_run_gIN()
and Test_run_gHN()
, different numbers of the point sets for both cases can be obtained.
Example of the output
Below, the file is renamed from beta_gamma_gHN.tbl
.
# beta(deg),gamma(deg)
180.000,0.000
90.000,18.000
120.000,30.000
60.000,42.000
138.590,54.000
75.522,66.000
104.478,78.000
41.410,90.000
151.045,102.000
82.819,114.000
112.024,126.000
51.318,138.000
128.682,150.000
67.976,162.000
97.181,174.000
28.955,186.000
159.636,198.000
86.417,210.000
115.944,222.000
55.771,234.000
133.433,246.000
71.790,258.000
100.807,270.000
35.659,282.000
144.341,294.000
79.193,306.000
108.210,318.000
46.567,330.000
124.229,342.000
64.056,354.000