Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:46

0001 #!/usr/bin/env python
0002 """
0003 aoi.py
0004 =========
0005 
0006 * see ~/j/Layr/Layr.h 
0007 
0008 HMM: more physical to use dot(photon_momentum,outward_surface_normal) 
0009 as "angle" parameter to TMM calculations, the dot product is -cos(aoi)
0010 
0011 1. -1 at normal incidence against surface_normal, inwards going, aoi = 0 
0012 2. +1 at normal incidence with the surface_normal, outwards going  
0013 3.  0 at glancing incidence (90 deg AOI) : potential for math blowouts here 
0014 4. sign of dot product indicates when must flip the stack of parameters
0015 5. angle scan plots can then use aoi 0->180 deg, which is -cos(aoi) -1->1   
0016    (will there be continuity across the turnaround ?)
0017 
0018 """
0019 
0020 import os, numpy as np, matplotlib as mp
0021 SIZE = np.array([1280, 720]) 
0022 
0023 if __name__ == '__main__':
0024 
0025     fig, ax = mp.pyplot.subplots(figsize=SIZE/100.)
0026 
0027     #aoi = np.linspace(0, np.pi/2, 91 )
0028     aoi = np.linspace(0,  np.pi, 181 )
0029 
0030     aoi_deg = aoi*180/np.pi 
0031 
0032     ax.plot( aoi_deg, -np.cos(aoi), label="-cos(aoi) vs aoi_deg" ) 
0033     ax.plot( aoi_deg, np.cos(aoi), label="cos(aoi) vs aoi_deg" ) 
0034     ax.plot( aoi_deg, np.sin(aoi), label="sin(aoi) vs aoi_deg" ) 
0035 
0036     # upper/center/lower right/left 
0037     ax.legend(loc=os.environ.get("LOC", "lower center"))
0038     fig.show()
0039 
0040