Exemplo n.º 1
0
def test_ne():
    objs = [
        batoid.Paraboloid(1.0),
        batoid.Paraboloid(2.0),
        batoid.Plane()
    ]
    all_obj_diff(objs)
Exemplo n.º 2
0
def test_ne():
    objs = [
        batoid.Sphere(1.0),
        batoid.Sphere(2.0),
        batoid.Plane()
    ]
    all_obj_diff(objs)
Exemplo n.º 3
0
def test_ne():
    objs = [
        batoid.Ray((0, 0, 0), (0, 0, 0)),
        batoid.Ray((0, 0, 0), (0, 0, 0), coordSys=batoid.CoordSys((0, 0, 1))),
        batoid.Ray((0, 0, 1), (0, 0, 0)),
        batoid.Ray((0, 1, 0), (0, 0, 0)),
        batoid.Ray((0, 0, 0), (0, 0, 0), t=1),
        batoid.Ray((0, 0, 0), (0, 0, 0), wavelength=500e-9),
        batoid.Ray((0, 0, 0), (0, 0, 0), wavelength=500e-9, flux=1.2),
        batoid.Ray((0, 0, 0), (0, 0, 0), vignetted=True),
        batoid.Ray(failed=True), (0, 0, 0),
        batoid.RayVector([
            batoid.Ray((0, 0, 1), (0, 0, 0)),
            batoid.Ray((0, 0, 0), (0, 0, 0))
        ]),
        batoid.RayVector([
            batoid.Ray((0, 0, 1), (0, 0, 0),
                       coordSys=batoid.CoordSys((0, 0, 1))),
            batoid.Ray((0, 0, 0), (0, 0, 0),
                       coordSys=batoid.CoordSys((0, 0, 1)))
        ]),
        batoid.RayVector([
            batoid.Ray((0, 0, 0), (0, 0, 0)),
            batoid.Ray((0, 0, 1), (0, 0, 0))
        ]),
        batoid.RayVector([batoid.Ray((0, 0, 0), (0, 0, 0))])
    ]
    all_obj_diff(objs)
Exemplo n.º 4
0
def test_ne():
    xs1 = np.linspace(0, 1, 10)
    xs2 = np.linspace(0, 1, 11)
    ys1 = np.linspace(0.1, 1, 10)
    ys2 = np.linspace(0.1, 0.9, 11)

    def f1(x, y):
        return x + y

    def f2(x, y):
        return x - y

    zs1 = f1(*np.meshgrid(xs1, ys1))
    zs2 = f2(*np.meshgrid(xs1, ys1))

    objs = [
        batoid.Bicubic(xs1, ys1, zs1),
        batoid.Bicubic(xs1, ys1, zs2),
        batoid.Bicubic(xs2, ys1, zs1),
        batoid.Bicubic(xs1, ys2, zs1),
        batoid.Bicubic(xs1, ys2, zs1, zs1, zs1, zs1),
        batoid.Bicubic(xs1, ys2, zs1, zs1, zs1, zs2),
        batoid.Bicubic(xs1, ys2, zs1, zs1, zs2, zs2),
        batoid.Bicubic(xs1, ys2, zs1, zs2, zs2, zs2)
    ]
    all_obj_diff(objs)
Exemplo n.º 5
0
def test_ne():
    objs = [
        batoid.Plane(),
        batoid.Tilted(0.0, 0.1),
        batoid.Tilted(0.1, 0.1),
    ]
    all_obj_diff(objs)
Exemplo n.º 6
0
def test_ne():
    objs = [
        batoid.ConstMedium(1.0),
        batoid.ConstMedium(1.1),
        batoid.TableMedium([1, 2, 3], [3, 4, 3]),
        batoid.SellmeierMedium([
            0.6961663, 0.4079426, 0.8974794, 0.0684043**2, 0.1162414**2,
            9.896161**2
        ]),
        batoid.SellmeierMedium([
            0.4079426, 0.6961663, 0.8974794, 0.0684043**2, 0.1162414**2,
            9.896161**2
        ]),
        batoid.SumitaMedium([
            2.2705778, -0.010059376, 0.010414999, 0.00028872517, -2.2214495e-5,
            1.4258559e-6
        ]),
        batoid.SumitaMedium([
            -0.010059376, 2.2705778, 0.010414999, 0.00028872517, -2.2214495e-5,
            1.4258559e-6
        ]),
        batoid.Air(),
        batoid.Air(pressure=100)
    ]
    all_obj_diff(objs)
Exemplo n.º 7
0
def test_ne():
    objs = [
        batoid.Plane(),
        batoid.Plane(allowReverse=True),
        batoid.Paraboloid(2.0),
    ]
    all_obj_diff(objs)
Exemplo n.º 8
0
def test_ne():
    objs = [
        batoid.Mirror(batoid.Plane()),
        batoid.Detector(batoid.Plane()),
        batoid.Baffle(batoid.Plane()),
        batoid.RefractiveInterface(batoid.Plane()),
        batoid.Mirror(batoid.Paraboloid(0.1)),
        batoid.Detector(batoid.Paraboloid(0.1)),
        batoid.Baffle(batoid.Paraboloid(0.1)),
        batoid.RefractiveInterface(batoid.Paraboloid(0.1)),
        batoid.Mirror(batoid.Plane(), obscuration=batoid.ObscCircle(0.1)),
        batoid.Mirror(batoid.Plane(), inMedium=batoid.ConstMedium(1.1)),
        batoid.Mirror(batoid.Plane(), outMedium=batoid.ConstMedium(1.1)),
        batoid.Mirror(batoid.Plane(), coordSys=batoid.CoordSys([0, 0, 1])),
        batoid.CompoundOptic(
            [batoid.Mirror(batoid.Plane()),
             batoid.Mirror(batoid.Plane())]),
        batoid.CompoundOptic(
            [batoid.Mirror(batoid.Plane()),
             batoid.Baffle(batoid.Plane())]),
        batoid.CompoundOptic([
            batoid.RefractiveInterface(batoid.Plane()),
            batoid.RefractiveInterface(batoid.Plane())
        ]),
        batoid.Lens([
            batoid.RefractiveInterface(batoid.Plane()),
            batoid.RefractiveInterface(batoid.Plane())
        ]),
    ]
    all_obj_diff(objs)
Exemplo n.º 9
0
def test_ne():
    objs = [
        batoid.Table([0, 1], [1, 2], 'linear'),
        batoid.Table([0, 1], [1, 2], 'ceil'),
        batoid.Table([0, 1], [2, 1], 'linear'),
        batoid.Table([], [], 'linear')
    ]
    all_obj_diff(objs)
Exemplo n.º 10
0
def test_ne():
    objs = [
        batoid.CoordSys(),
        batoid.CoordTransform(batoid.CoordSys(), batoid.CoordSys()),
        batoid.CoordTransform(batoid.CoordSys(),
                              batoid.CoordSys(origin=(0, 0, 1)))
    ]
    all_obj_diff(objs)
Exemplo n.º 11
0
def test_ne():
    objs = [
        batoid.Table([0, 1], [1, 2], batoid.Table.Interpolant.linear),
        batoid.Table([0, 1], [1, 2], batoid.Table.Interpolant.ceil),
        batoid.Table([0, 1], [2, 1], batoid.Table.Interpolant.linear),
        batoid.Table([], [], batoid.Table.Interpolant.linear)
    ]
    all_obj_diff(objs)
Exemplo n.º 12
0
def test_ne():
    objs = [
        batoid.Quadric(10.0, 1.0),
        batoid.Quadric(11.0, 1.0),
        batoid.Quadric(10.0, 1.1),
        batoid.Sphere(10.0)
    ]
    all_obj_diff(objs)
Exemplo n.º 13
0
def test_ne():
    objs = [
        batoid.SimpleCoating(0.0, 1.0),
        batoid.SimpleCoating(0.0, 0.1),
        batoid.SimpleCoating(0.1, 0.1),
        batoid.CoordSys()
    ]
    all_obj_diff(objs)
Exemplo n.º 14
0
def test_ne():
    objs = [
        batoid.Zernike([0,0,0,0,1]),
        batoid.Zernike([0,0,0,1]),
        batoid.Zernike([0,0,0,0,1], R_outer=1.1),
        batoid.Zernike([0,0,0,0,1], R_inner=0.8),
        batoid.Zernike([0,0,0,0,1], R_outer=1.1, R_inner=0.8),
        batoid.Quadric(10.0, 1.0)
    ]
    all_obj_diff(objs)
Exemplo n.º 15
0
def test_ne():
    objs = [
        batoid.CoordSys(),
        batoid.CoordSys([0,0,1]),
        batoid.CoordSys([0,1,0]),
        batoid.CoordSys(batoid.RotX(0.1)),
        batoid.CoordTransform(batoid.CoordSys(), batoid.CoordSys()),
        batoid.CoordTransform(batoid.CoordSys(), batoid.CoordSys([0,0,1])),
        batoid.CoordTransform(batoid.CoordSys(), batoid.CoordSys(batoid.RotX(0.1)))
    ]
    all_obj_diff(objs)
Exemplo n.º 16
0
def test_ne():
    objs = [
        batoid.Asphere(10.0, 1.0, []),
        batoid.Asphere(10.0, 1.0, [0]),
        batoid.Asphere(10.0, 1.0, [0,1]),
        batoid.Asphere(10.0, 1.0, [1,0]),
        batoid.Asphere(10.0, 1.1, []),
        batoid.Asphere(10.1, 1.0, []),
        batoid.Quadric(10.0, 1.0)
    ]
    all_obj_diff(objs)
Exemplo n.º 17
0
def test_ne():
    objs = [
        batoid.ObscCircle(1.0),
        batoid.ObscCircle(2.0),
        batoid.ObscCircle(1.0, 0.1, 0.1),
        batoid.ObscAnnulus(0.0, 1.0),
        batoid.ObscAnnulus(0.1, 1.0),
        batoid.ObscAnnulus(0.1, 1.0, 0.1, 0.1),
        batoid.ObscRectangle(1.0, 2.0),
        batoid.ObscRectangle(1.0, 2.0, 0.1, 0.1),
        batoid.ObscRectangle(1.0, 2.0, 0.1, 0.1, 1.0),
        batoid.ObscRay(1.0, 2.0),
        batoid.ObscRay(1.0, 2.0, 0.1, 0.1),
        batoid.ObscNegation(batoid.ObscCircle(1.0)),
        batoid.ObscPolygon([0,1,1,0],[0,0,1,1]),
        batoid.ObscUnion([batoid.ObscCircle(1.0)]),
        batoid.ObscUnion([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.0)
        ]),
        batoid.ObscUnion([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.2)
        ]),
        batoid.ObscUnion([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.2),
            batoid.ObscAnnulus(1.0, 2.0)
        ]),
        batoid.ObscIntersection([batoid.ObscCircle(1.0)]),
        batoid.ObscIntersection([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.0)
        ]),
        batoid.ObscIntersection([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.2)
        ]),
        batoid.ObscIntersection([
            batoid.ObscCircle(1.0),
            batoid.ObscCircle(2.2),
            batoid.ObscAnnulus(1.0, 2.0)
        ]),
    ]
    all_obj_diff(objs)
Exemplo n.º 18
0
def test_ne():
    rng = np.random.default_rng(57)

    N1 = rng.integers(1, 5)
    N2 = rng.integers(1, 5)
    N3 = rng.integers(1, 5)
    arr = np.ones((N1, N2, N3))
    pv1 = rng.uniform(-1.0, 1.0, size=3)
    pv2 = rng.uniform(-1.0, 1.0, size=3)
    pv3 = rng.uniform(-1.0, 1.0, size=3)

    lattice1 = batoid.Lattice(arr, np.vstack([pv1, pv2, pv3]))
    lattice2 = batoid.Lattice(arr[..., 0], np.vstack([pv1, pv2, pv3])[:2, :2])
    lattice3 = batoid.Lattice(arr, 2 * np.vstack([pv1, pv2, pv3]))
    lattice4 = batoid.Lattice(2 * arr, np.vstack([pv1, pv2, pv3]))

    objs = [batoid.CoordSys(), lattice1, lattice2, lattice3, lattice4]
    all_obj_diff(objs)
Exemplo n.º 19
0
def test_ne():
    filename = os.path.join(batoid.datadir, "media", "silica_dispersion.txt")
    wave, n = np.genfromtxt(filename).T
    wave *= 1e-6  # microns -> meters
    table = batoid.Table(wave, n, batoid.Table.Interpolant.linear)
    table2 = batoid.Table(wave * 1.01, n, batoid.Table.Interpolant.linear)

    objs = [
        batoid.ConstMedium(1.0),
        batoid.ConstMedium(1.1),
        batoid.TableMedium(table),
        batoid.TableMedium(table2),
        batoid.SellmeierMedium(0.6961663, 0.4079426, 0.8974794, 0.0684043**2,
                               0.1162414**2, 9.896161**2),
        batoid.SellmeierMedium(0.4079426, 0.6961663, 0.8974794, 0.0684043**2,
                               0.1162414**2, 9.896161**2),
        batoid.Air(),
        batoid.Air(pressure=100)
    ]
    all_obj_diff(objs)
Exemplo n.º 20
0
def test_ne():
    objs = [
        batoid.Ray((0, 0, 0), (0, 0, 0)),
        batoid.Ray((0, 0, 1), (0, 0, 0)),
        batoid.Ray((0, 1, 0), (0, 0, 0)),
        batoid.Ray((0, 0, 0), (0, 0, 0), t=1),
        batoid.Ray((0, 0, 0), (0, 0, 0), wavelength=500e-9),
        batoid.Ray((0, 0, 0), (0, 0, 0), wavelength=500e-9, flux=1.2),
        batoid.Ray((0, 0, 0), (0, 0, 0), vignetted=True),
        # Should really get a failed Ray to test here...
        (0, 0, 0),
        batoid.RayVector(),
        batoid.RayVector([
            batoid.Ray((0, 0, 1), (0, 0, 0)),
            batoid.Ray((0, 0, 0), (0, 0, 0))
        ]),
        batoid.RayVector([
            batoid.Ray((0, 0, 0), (0, 0, 0)),
            batoid.Ray((0, 0, 1), (0, 0, 0))
        ]),
        batoid.RayVector([batoid.Ray((0, 0, 0), (0, 0, 0))])
    ]
    all_obj_diff(objs)