예제 #1
0
def woltersinetan(rays,r0,z0,amp,freq):
    """Wrapper for Wolter sinusoidal surface -
    place at surface tangent point
    +z is surface normal
    +y is toward sky
    +x is azimuthal direction
    """
    opd,x,y,z,l,m,n,ux,uy,uz = rays
    #Compute Wolter parameters
    alpha,p,d,e = con.woltparam(r0,z0)
    transform(0,0,0,-np.pi/2-alpha,0,0)
    #Go to Wolter focus minus gap and half mirror length
    transform(0,con.primrad(z0+75.,r0,z0),-z0-75.,0,0,0)
    #Place Wolter surface
    woltersine(r0,z0,amp,freq)
    #Go back to original coordinate system
    transform(0,-con.primrad(z0+75.,r0,z0),z0+75.,0,0,0)
    transform(0,0,0,np.pi/2+alpha,0,0)
    return
    return ((x - xs[0]) * sep_slope) + initial_sep


xs1 = np.load('positions_5.npy')
periods1 = np.load('Probabilities_5.npy')
xs2 = np.load('positions_3.npy')
periods2 = np.load('Probabilities_3.npy')

# Define Wolter-I parameters.
r0 = 165.  # Radius at the intersection plane of primary/secondary.
z0 = 3500.  #
mirror_len = 100.
mirror_sep = 5.

# Define inner & outer radii to create rays.
rp_front = conic.primrad(z0 + mirror_sep / 2 + mirror_len, r0, z0)
rp_back = conic.primrad(z0 + mirror_sep / 2, r0, z0)

# Define initial rays in subannulus.
rays = sources.subannulus(rp_back, rp_front, np.radians(30.), 100000)

# 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)
# Long Cell Parameters
# L = 48000.  # [mm] Distance from source to end of test chamber (from E. Bray).
L = 48300.
L -= 12750.  # [mm] Accounts for focal length of optic in the finite conjugate.
# wave = 0.98903  # [nm] Mg-K wavelength.
wave = 0.83401  # [nm] Al-K wavelength.

# We begin by defining some rays from a source at the end of the test chamber.

# In[15]:

# Define inner and outer subannulus radii.
z_in = z0 + mirror_sep / 2
z_out = z_in + mirror_len

r_in = conic.primrad(z_in, r0, z0)
r_out = conic.primrad(z_out, r0, z0)

# Define full angular width of subannulus.
dphi = np.radians(30.)

# # Define subannulus of rays.
rays = sources.subannulus(r_in, r_out, dphi, 1000000)

# rays = np.loadtxt('rays.txt')

# Rotate so that dispersion direction is in the x-dimension.
trans.transform(rays, 0, 0, 0, 0, 0, -np.pi / 2)

# Find centroid of rays and move rays down to center of beamline.
cen_optic = analyses.centroid(rays)
예제 #4
0
mirror_sep = 5.  # [mm] Separation between primary and secondary mirrors.

# Long Cell Parameters
# L = 48000.  # [mm] Distance from source to end of test chamber (from E. Bray).
L = 48300.
L -= 4500.  # [mm] Accounts for focal length of optic in the finite conjugate.
# wave = 0.98903  # [nm] Mg-K wavelength.
wave = 0.83401  # [nm] Al-K wavelength.

# In[3]:

# Define inner and outer subannulus radii.
z_in = z0 + mirror_sep / 2
z_out = z_in + mirror_length

r_in = conic.primrad(z_in, r_int[0], z0)
r_out = conic.primrad(z_out, r_int[-1], z0)

# Define full angular width of subannulus.
dphi = np.radians(30.)

# Define subannulus of rays.
rays = sources.subannulus(r_in, r_out, dphi, num)

np.save('originalpyxfrays.npy', rays)

# Rotate so that dispersion direction is in the x-dimension.
trans.transform(rays, 0, 0, 0, 0, 0, -np.pi / 2)

# Find centroid of rays and move rays down to center of beamline.
cen_optic = analyses.centroid(rays)