コード例 #1
0
def create_cemented_doublet(power=0., bending=0., th=None, sd=1.,
                            glasses=('N-BK7,Schott', 'N-F2,Schott'),
                            **kwargs):
    from opticalglass.spectral_lines import get_wavelength
    from opticalglass import glass
    wvls = np.array([get_wavelength(w) for w in ['d', 'F', 'C']])
    gla_a = gfact.create_glass(glasses[0])
    rndx_a = gla_a.calc_rindex(wvls)
    Va, PcDa = glass.calc_glass_constants(*rndx_a)
    gla_b = gfact.create_glass(glasses[1])
    rndx_b = gla_b.calc_rindex(wvls)
    Vb, PcDb = glass.calc_glass_constants(*rndx_b)

    power_a, power_b = achromat(power, Va, Vb)

    if th is None:
        th = sd/4
    t1 = 3*th/4
    t2 = th/4
    if power_a < 0:
        t1, t2 = t2, t1

    lens_a = lens_from_power(power=power_a, bending=bending, th=t1, sd=sd,
                              med=gla_a)
    cv1, cv2, t1, indx_a, sd = lens_a

    # cv1 = power_a/(rndx_a[0] - 1)
    # delta_cv = -cv1/2
    # cv1 += delta_cv
    # cv2 = delta_cv
    # cv3 = power_b/(1 - rndx_b[0]) + delta_cv
    indx_b = rndx_b[0]
    cv3 = (power_b/(indx_b-1) - cv2)/((t2*cv2*(indx_b-1)/indx_b) - 1)

    s1 = Surface(profile=Spherical(c=cv1), max_ap=sd,
                 delta_n=(rndx_a[0] - 1))
    s2 = Surface(profile=Spherical(c=cv2), max_ap=sd,
                 delta_n=(rndx_b[0] - rndx_a[0]))
    s3 = Surface(profile=Spherical(c=cv3), max_ap=sd,
                 delta_n=(1 - rndx_b[0]))

    g1 = Gap(t=t1, med=gla_a)
    g2 = Gap(t=t2, med=gla_b)

    g_tfrm = np.identity(3), np.array([0., 0., 0.])

    ifc_list = []
    ifc_list.append([0, s1, g1, 1, g_tfrm])
    ifc_list.append([1, s2, g2, 1, g_tfrm])
    ifc_list.append([2, s3, None, 1, g_tfrm])
    ce = CementedElement(ifc_list)
    tree = ce.tree()

    return [[s1, g1, None, rndx_a, 1],
            [s2, g2, None, rndx_b, 1],
            [s3, None, None, 1, 1]], [ce], tree
コード例 #2
0
ファイル: paraxialdesign.py プロジェクト: nheske/ray-optics
    def compute_principle_points(self, seq):
        """ Returns paraxial p and q rays, plus partial first order data.

        Args:
            seq: a sequence containing interfaces and gaps to be traced.
                  for each iteration, the sequence should return a
                  list containing: **Intfc, Gap, Trfm, Index, Z_Dir**

        Returns:
            (p_ray, q_ray, (efl, pp1, ppk, ffl, bfl))

            - p_ray: [ht, slp, aoi], [1, 0, -]
            - q_ray: [ht, slp, aoi], [0, 1, -]
            - efl: effective focal length
            - pp1: distance of front principle plane from 1st interface
            - ppk: distance of rear principle plane from last interface
            - ffl: front focal length
            - bfl: back focal length
        """
        n_0 = seq[0][mc.Indx]
        z_dir_before = seq[0][mc.Zdir]
        n_k = seq[-1][mc.Indx]
        z_dir_k = seq[-1][mc.Zdir]
        path = [[Surface(), Gap(), None, n_0, z_dir_before]]
        path.extend(seq[1:])
        pp_info = fo.compute_principle_points(iter(path),
                                              n_0=z_dir_before * n_0,
                                              n_k=z_dir_k * n_k)
        return pp_info
コード例 #3
0
 def compute_principle_points(self, node, seq):
     n_0 = seq[0][mc.Indx]
     z_dir_before = seq[0][mc.Zdir]
     n_k = seq[-1][mc.Indx]
     z_dir_k = seq[-1][mc.Zdir]
     path = [[Surface(), Gap(), None, n_0, z_dir_before]]
     path.extend(seq[1:])
     pp_info = fo.compute_principle_points(iter(path),
                                           n_0=z_dir_before * n_0,
                                           n_k=z_dir_k * n_k)
     return pp_info
コード例 #4
0
def create_lens(power=0., bending=0., th=None, sd=1., med=None, **kwargs):
    if med is None:
        med = Glass()
    lens = lens_from_power(power=power, bending=bending, th=th, sd=sd, med=med)
    cv1, cv2, th, rndx, sd = lens

    s1 = Surface(profile=Spherical(c=cv1), max_ap=sd, delta_n=(rndx - 1))
    s2 = Surface(profile=Spherical(c=cv2), max_ap=sd, delta_n=(1 - rndx))
    g = Gap(t=th, med=med)
    le = Element(s1, s2, g, sd=sd)
    tree = le.tree()

    return [[s1, g, None, rndx, 1], [s2, None, None, 1, 1]], [le], tree
コード例 #5
0
def create_lens(power=0., bending=0., th=None, sd=1., med=None):
    if med is None:
        med = Glass()
    rndx = med.rindex('d')
    cv1 = power / (2 * (rndx - 1))
    cv2 = -power / (2 * (rndx - 1))
    s1 = Surface(profile=Spherical(c=cv1), max_ap=sd, delta_n=(rndx - 1))
    s2 = Surface(profile=Spherical(c=cv2), max_ap=sd, delta_n=(1 - rndx))
    if th is None:
        th = sd / 5
    g = Gap(t=th, med=med)
    le = Element(s1, s2, g, sd=sd)
    return [[s1, g, None, rndx, 1], [s2, None, None, 1, 1]], [le]
コード例 #6
0
def create_air_gap(t=0., **kwargs):
    g = Gap(t=t)
    ag = AirGap(g, **kwargs)
    tree = ag.tree()
    return g, ag, tree
コード例 #7
0
def create_air_gap(t=0., ref_ifc=None):
    g = Gap(t=t)
    ag = AirGap(g, ref_ifc)
    return g, ag