# Transform rays to intersection plane of optic.
trans.transform(rays, 0, 0, -z0, 0, 0, 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)
Esempio n. 2
0
    # Keep only the photons which interact with the actual size
    # of the mirror
    ind_rays = [r[ind] for r in ind_rays]

    # Reflect photons off of primary.
    trans.reflect(ind_rays)

    # # Add Beckmann + Gaussian scatter.
    # # ogre.beckmann_scatter(ind_rays, 0, 0, 2e-5)
    # ind_rays[4] = ind_rays[4] + np.random.normal(scale=1e-7, size=len(ind_rays[4]))
    # ind_rays[5] = ind_rays[5] + np.random.normal(scale=1e-6, size=len(ind_rays[5]))
    # ind_rays[6] = -np.sqrt(1. - ind_rays[5]**2 - ind_rays[4]**2)

    # Propagate photons to the secondary mirror.
    surfaces.woltersecondary(ind_rays, r_int[i], z0)

    # Find which photons will interact with hyperboloid.
    ind = np.where((ind_rays[3] < (z0 - mirror_sep / 2))
                   & (ind_rays[3] > (z0 - mirror_sep / 2 - mirror_length)))[0]

    # keep only photons which interact with mirror.
    ind_rays = [r[ind] for r in ind_rays]

    # Reflect the photons off of the secondary.
    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))
    ]