# Rotate 90 degrees so that diffraction occurs in x-axis.
trans.transform(rays, 0, 0, 0, 0, 0, -np.radians(90.))

# Pass through primary.
surfaces.wolterprimary(rays, r0, z0)
trans.reflect(rays)

# # Add some scatter.
ogre.beckmann_scatter(rays, 0, 0, 1.48e-5)

# Pass through secondary.
surfaces.woltersecondary(rays, r0, z0)
trans.reflect(rays)

# Go to optic focus.
surfaces.focusX(rays)

# Define grating parameters.
d = 160.  # Groove period @ 3300 mm [nm]
L = 3250.  # Center of grating [mm]
d *= L / 3300  # Find groove period at center of grating.
gammy = np.radians(1.5)  # Incidence angle.
wave = 0.83401  # [nm] Al-K wavelength.
yaw = np.radians(0.87)  # Approx. yaw in OGRE geometry.

# Create copy if you need to reference later.
optic_rays = deepcopy(rays)

# Establish starting coordinates.
glob_coords = [trans.tr.identity_matrix()] * 4
Exemplo n.º 2
0
def bring_rays_to_disp_focus(ray_object):
    manipulated_rays = copy.deepcopy(ray_object)
    prays = manipulated_rays.yield_prays()
    dz = surf.focusX(prays)
    manipulated_rays.set_prays(prays)
    return manipulated_rays, dz
Exemplo n.º 3
0
# Rotate 90 degrees so that diffraction occurs in x-axis.
trans.transform(rays, 0, 0, 0, 0, 0, -np.radians(90.))

# Pass through primary.
surfaces.wolterprimary(rays, r0, z0)
trans.reflect(rays)

# Add some scatter.
ogre.beckmann_scatter(rays, 0, 0, 1.48e-5)

# Pass through secondary.
surfaces.woltersecondary(rays, r0, z0)
trans.reflect(rays)

# Go to optic focus.
surfaces.focusX(rays)

# Define grating parameters.
d = 160.  # Groove period @ 3300 mm [nm]
L = 3250.  # Center of grating [mm]
d *= L / 3300  # Find groove period at center of grating.
gammy = np.radians(1.5)  # Incidence angle.
wave = 0.83401  # [nm] Al-K wavelength.
yaw = np.radians(0.87)  # Approx. yaw in OGRE geometry.

# Create copy if you need to reference later.
optic_rays = deepcopy(rays)

# Establish starting coordinates.
glob_coords = [trans.tr.identity_matrix()] * 4
# Pass rays through secondary mirror.
# surfaces.wsSecondary(rays,r0,z0,psi=1) # Testing
surfaces.woltersecondary(rays, r0, z0)
trans.reflect(rays)

# Add Gaussian scatter to ray direction cosines.
rays[4] = rays[4] + np.random.normal(scale=2.e-6, size=len(rays[4]))
rays[5] = rays[5] + np.random.normal(scale=1.5e-5, size=len(rays[5]))
# errorl = np.loadtxt('errorl')
# rays[4] += errorl
# errorm = np.loadtxt('errorm')
# rays[5] += errorm
rays[6] = -np.sqrt(1. - rays[5]**2 - rays[4]**2)

# Go to focal plane of optic.
f0 = surfaces.focusX(rays)
eff_f0 = z0 - f0

print('Effective focal length: ' + str(eff_f0 / 1000) + ' m')
#
# # Move such that centroid of focus is (0,0).
cen_focus = analyses.centroid(rays)
trans.transform(rays, cen_focus[0], cen_focus[1], 0, 0, 0, 0)
#
# # Plot optic focus.
# # plt.figure()
# # plt.scatter(rays[1], rays[2], s=0.5, c='k')
# # plt.axis('equal')
# # plt.xlabel('X [mm]')
# # plt.ylabel('Y [mm]')
#
Exemplo n.º 5
0
    trans.reflect(ind_rays)

    # Add to 'master' PyXFocus ray object.
    new_rays = [
        np.append(new_rays[i], ind_rays[i]) for i in range(len(new_rays))
    ]

# Copy rays.
rays = trans.copy_rays(new_rays)

# With rays propagated through optic, we can now go to the focus.

# In[5]:

# Go to the X-ray focus.
f0 = surfaces.focusX(rays)

# Put optic focus at y=0.
cen_y = np.mean(rays[2])
trans.transform(rays, 0, cen_y, 0, 0, 0, 0)

# Copy rays to reference later.
of_rays = deepcopy(rays)

# # Plot rays.
# plt.figure()
# plt.scatter(rays[1], rays[2], s=0.5, c='k')
# plt.axis('equal')
# plt.xlabel('X [mm]')
# plt.ylabel('Y [mm]')
# plt.title('Rays @ Optic Focus [Z=' + str(round(f0, 2)) + ' mm]')