cihologramas / pyoptools

Python tools for optical design
GNU General Public License v3.0
137 stars 46 forks source link

span works wrong in point_source_p #93

Open ldm78 opened 3 years ago

ldm78 commented 3 years ago

Using point_source_c the span parameter works like I would expect, i.e. if span=(0.1,0.1) the horizontal and vertical angles both go from -0.1 to +0.1. With point_source_p the real range depends on the num_rays parameter, e.g.:

R=point_source_p(origin=(0,0,0),direction=(0,0,0),span=1.pi/180.,num_rays=(4,4),wavelength=0.266,label="") for r in R: ... print(np.arctan(r.dir[0])180./pi) ... 0.0 0.0 0.24999762021038868 3.0616072830664826e-17 -0.24999762021038868 0.0 0.49998096249859053 6.123156277543506e-17 -0.49998096249859053 0.0 0.7499357530191801 9.184588695951347e-17 -0.7499357530191801

I believe the full angle span gets divided by num_rays instead of num_rays-1