In [ ]:
import batoid
from batoid.utils import normalized
import os
import yaml
import numpy as np
from IPython.display import display
from ipywidgets import interact, interactive_output
import ipywidgets as widgets
import matplotlib.pyplot as plt
%matplotlib inline
from mpl_toolkits.mplot3d import Axes3D
In [ ]:
telescope = batoid.Optic.fromYaml('donsoptikz1.yaml')
In [ ]:
fig1 = plt.figure(figsize=(12, 11))
ax1 = fig1.add_subplot(111)
telescope.draw2d(ax1, c='k')
fig2 = plt.figure(figsize=(12, 11))
ax2 = fig2.add_subplot(111, projection='3d')
telescope.draw3d(ax2, c='k')
p0_left = np.array([-0.035, 0, 0])
p0_right = np.array([0.035, 0, 0])
p0_lmid = np.array([-0.015, 0, 0])
p0_rmid = np.array([0.015, 0, 0])
v_left = normalized(np.array([-0.01, 0, -1]))
v_mid = normalized(np.array([0, 0, -1]))
v_right = normalized(np.array([0.01, 0, -1]))
traceFull = None
for v, c in zip([v_left, v_mid, v_right], ['#377eb8', '#ff7f00', '#4daf4a']):
rays = []
for p0 in [p0_left, p0_lmid, p0_rmid, p0_right]:
ray = batoid.Ray(p0, v, t=0, wavelength=500e-9)
p0 = ray.positionAtTime(-0.1)
rays.append(batoid.Ray(p0, v, t=0, wavelength=500e-9))
traceFull = telescope.traceFull(batoid.RayVector(rays))
batoid.drawTrace2d(ax1, traceFull, c=c)
batoid.drawTrace3d(ax2, traceFull, c=c)
# ax1.set_ylim(-0.6081, -0.608)
# ax1.set_xlim(-0.00001, 0.00001)
In [ ]: