示例#1
0
    def test_delete(self):

        idl.execute("test_delete = 5")
        idl.delete("test_delete")
        with self.assertRaises(idl._core.IDLValueError):

            idl.get("test_delete")
示例#2
0
    def test_delete(self):

        idl.execute("test_delete = 5")
        idl.delete("test_delete")
        with self.assertRaises(idl._core.IDLValueError):

            idl.get("test_delete")
示例#3
0
    def test_put_structure_array(self):

        v = {"a": np.array([1, 2, 3, 4, 5], dtype=np.int16), "b": np.array(["alpha", "beta"])}

        idl.put("test_put_structure_array", v)

        self.assertArrayEqual(v["a"], idl.get("test_put_structure_array")["a"], "Failed to put array structure (scalar array).")
        self.assertArrayEqual(v["b"], idl.get("test_put_structure_array")["b"], "Failed to put array structure (string array).")
示例#4
0
    def test_get_missing(self):

        # create and delete variable in idl to ensure it does not exist!
        idl.execute("test_get_missing = 1")
        idl.execute("delvar, test_get_missing")

        with self.assertRaises(idl._core.IDLValueError):

            idl.get("test_get_missing")
示例#5
0
    def test_get_string(self):

        # null string
        idl.execute("test_get_string_null = \"\"")
        self.assertEqual("", idl.get("test_get_string_null"), "Failed to get null string.")

        # normal string
        idl.execute("test_get_string_normal = \"this is a test string\"")
        self.assertEqual("this is a test string", idl.get("test_get_string_normal"), "Failed to get normal string.")
示例#6
0
    def test_get_missing(self):

        # create and delete variable in idl to ensure it does not exist!
        idl.execute("test_get_missing = 1")
        idl.execute("delvar, test_get_missing")

        with self.assertRaises(idl._core.IDLValueError):

            idl.get("test_get_missing")
示例#7
0
    def test_get_string(self):

        # null string
        idl.execute("test_get_string_null = \"\"")
        self.assertEqual("", idl.get("test_get_string_null"),
                         "Failed to get null string.")

        # normal string
        idl.execute("test_get_string_normal = \"this is a test string\"")
        self.assertEqual("this is a test string",
                         idl.get("test_get_string_normal"),
                         "Failed to get normal string.")
示例#8
0
    def test_put_structure_array(self):

        v = {
            "a": np.array([1, 2, 3, 4, 5], dtype=np.int16),
            "b": np.array(["alpha", "beta"])
        }

        idl.put("test_put_structure_array", v)

        self.assertArrayEqual(v["a"],
                              idl.get("test_put_structure_array")["a"],
                              "Failed to put array structure (scalar array).")
        self.assertArrayEqual(v["b"],
                              idl.get("test_put_structure_array")["b"],
                              "Failed to put array structure (string array).")
示例#9
0
    def test_get_array_ulong64(self):

        # 1D array, ulong64
        idl.execute("test_get_array_1d_ulong64 = ulong64([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_ulong64")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint64)
        self.assertArrayEqual(v, r, "Failed to get ulong64 array.")
示例#10
0
    def test_put_structure_basic(self):

        v = {"a": 1, "b": 1.0, "c": 1+2j, "d": "test"}

        idl.put("test_put_structure_basic", v)

        self.assertEqual(v, idl.get("test_put_structure_basic"), "Failed to put basic structure.")
示例#11
0
    def test_get_array_uint(self):

        # 1D array, uint
        idl.execute("test_get_array_1d_uint = uint([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_uint")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint16)
        self.assertArrayEqual(v, r, "Failed to get uint array.")
示例#12
0
    def test_get_array_long(self):

        # 1D array, long
        idl.execute("test_get_array_1d_long = long([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_long")
        r = np.array([1, 2, 3, 4, 5], dtype=np.int32)
        self.assertArrayEqual(v, r, "Failed to get long array.")
示例#13
0
    def test_get_array_float(self):

        # 1D array, float
        idl.execute("test_get_array_1d_float = float([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_float")
        r = np.array([1, 2, 3, 4, 5], dtype=np.float32)
        self.assertArrayEqual(v, r, "Failed to get float array.")
示例#14
0
    def test_get_structure_basic(self):

        idl.execute("test_get_structure_basic = {a:byte(1), b:fix(2), " +
                    "c:uint(3), d:long(4), e:ulong(5), f:long64(6), " +
                    "g:ulong64(7), h:float(1.0), i:double(2.0), " +
                    "j:complex(1.0, 2.0), k:dcomplex(1.0, 2.0)," +
                    "l:\"test\"}")

        r = idl.get("test_get_structure_basic")

        v = {
            "a": 1,
            "b": 2,
            "c": 3,
            "d": 4,
            "e": 5,
            "f": 6,
            "g": 7,
            "h": 1.0,
            "i": 2.0,
            "j": 1 + 2j,
            "k": 1 + 2j,
            "l": "test"
        }

        self.assertEqual(v, r, "Failed to get basic structure.")
示例#15
0
    def test_get_array_ulong64(self):

        # 1D array, ulong64
        idl.execute("test_get_array_1d_ulong64 = ulong64([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_ulong64")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint64)
        self.assertArrayEqual(v, r, "Failed to get ulong64 array.")
示例#16
0
    def test_get_array_double(self):

        # 1D array, double
        idl.execute("test_get_array_1d_double = double([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_double")
        r = np.array([1, 2, 3, 4, 5], dtype=np.float64)
        self.assertArrayEqual(v, r, "Failed to get double array.")
示例#17
0
    def test_get_array_float(self):

        # 1D array, float
        idl.execute("test_get_array_1d_float = float([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_float")
        r = np.array([1, 2, 3, 4, 5], dtype=np.float32)
        self.assertArrayEqual(v, r, "Failed to get float array.")
示例#18
0
    def test_put_structure_nested(self):

        v = {"s": {"a": 5, "b": 7}}

        idl.put("test_put_structure_nested", v)

        self.assertEqual(v, idl.get("test_put_structure_nested"), "Failed to put nested structure.")
示例#19
0
    def test_get_array_multidimensional(self):

        # ND array
        idl.execute("test_get_array_nd = indgen(8,7,6,5,4,3,2,1,/long)")
        v = np.arange(8*7*6*5*4*3*2*1, dtype=np.int32).reshape((1, 2, 3, 4, 5, 6, 7, 8))
        r = idl.get("test_get_array_nd")
        self.assertArrayEqual(v, r, "Failed to get multidimensional array.")
示例#20
0
    def test_get_array_string(self):

        # 1D array, string
        idl.execute("test_get_array_1d_string = [\"dog\", \"\", \"cat\", \"fish\"]")
        v = idl.get("test_get_array_1d_string")
        r = np.array(["dog", "", "cat", "fish"])
        self.assertArrayEqual(v, r, "Failed to get string array.")
示例#21
0
    def test_get_array_complex_double(self):

        # 1D array, complex double
        idl.execute("test_get_array_1d_dcomplex = dcomplex([1,2,3,4,5], [6,7,8,9,10])")
        v = idl.get("test_get_array_1d_dcomplex")
        r = np.array([1+6j, 2+7j, 3+8j, 4+9j, 5+10j], dtype=np.complex128)
        self.assertArrayEqual(v, r, "Failed to get complex double array.")
示例#22
0
    def test_get_array_complex_float(self):

        # 1D array, complex float
        idl.execute("test_get_array_1d_complex = complex([1,2,3,4,5], [6,7,8,9,10])")
        v = idl.get("test_get_array_1d_complex")
        r = np.array([1+6j, 2+7j, 3+8j, 4+9j, 5+10j], dtype=np.complex64)
        self.assertArrayEqual(v, r, "Failed to get complex float array.")
示例#23
0
    def test_put_list(self):

        # lists get converted to numpy arrays by put
        v = [1, 2, 3, 4, 5]
        idl.put("test_put_list", v)
        self.assertArrayEqual(np.array(v), idl.get("test_put_list"),
                              "Failed to put list.")
示例#24
0
    def test_get_array_uint(self):

        # 1D array, uint
        idl.execute("test_get_array_1d_uint = uint([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_uint")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint16)
        self.assertArrayEqual(v, r, "Failed to get uint array.")
示例#25
0
    def test_get_array_long(self):

        # 1D array, long
        idl.execute("test_get_array_1d_long = long([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_long")
        r = np.array([1, 2, 3, 4, 5], dtype=np.int32)
        self.assertArrayEqual(v, r, "Failed to get long array.")
示例#26
0
    def test_get_array_byte(self):

        # 1D array, byte
        idl.execute("test_get_array_1d_byte = byte([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_byte")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint8)
        self.assertArrayEqual(v, r, "Failed to get byte array.")
示例#27
0
    def test_get_array_byte(self):

        # 1D array, byte
        idl.execute("test_get_array_1d_byte = byte([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_byte")
        r = np.array([1, 2, 3, 4, 5], dtype=np.uint8)
        self.assertArrayEqual(v, r, "Failed to get byte array.")
示例#28
0
    def test_put_array_complex128(self):

        v = np.array([1 + 6j, 2 + 7j, 3 + 8j, 4 + 9j, 5 + 10j],
                     dtype=np.complex128)
        idl.put("test_put_array_1d_complex128", v)
        self.assertArrayEqual(v, idl.get("test_put_array_1d_complex128"),
                              "Failed to put complex128 array.")
示例#29
0
    def test_get_array_double(self):

        # 1D array, double
        idl.execute("test_get_array_1d_double = double([1,2,3,4,5])")
        v = idl.get("test_get_array_1d_double")
        r = np.array([1, 2, 3, 4, 5], dtype=np.float64)
        self.assertArrayEqual(v, r, "Failed to get double array.")
示例#30
0
    def test_get_pointer_structure(self):

        idl.execute("test_get_pointer_structure = {p: ptr_new(159)}")
        r = idl.get("test_get_pointer_structure")

        v = {"p": 159}

        self.assertEqual(v, r, "Failed to dereference pointer nested into structure.")
示例#31
0
    def test_get_structure_array(self):

        idl.execute("test_get_structure_array = {a:[1, 2, 3, 4, 5], s:{a:1, b:2, c:7}}")
        r = idl.get("test_get_structure_array")

        v = {"a": np.array([1, 2, 3, 4, 5], dtype=np.int16)}

        self.assertArrayEqual(v["a"], r["a"], "Failed to get array in structure.")
示例#32
0
    def test_put_array_multidimensional(self):

        # ND array
        v = np.arange(8 * 7 * 6 * 5 * 4 * 3 * 2 * 1, dtype=np.int32).reshape(
            (1, 2, 3, 4, 5, 6, 7, 8))
        idl.put("test_put_array_multidimensional", v)
        self.assertArrayEqual(v, idl.get("test_put_array_multidimensional"),
                              "Failed to put multidimensional array.")
示例#33
0
    def test_get_structure_nested(self):

        idl.execute("test_get_structure_nested = {a:{g:8, h:{s:\"hello\"}}, s:{a:1, b:2, c:7}}")
        r = idl.get("test_get_structure_nested")

        v = {"a": {"g": 8, "h": {"s": "hello"}}, "s": {"a": 1, "b": 2, "c": 7}}

        self.assertEqual(v, r, "Failed to get nested structure.")
示例#34
0
    def test_get_pointer_simple(self):

        idl.execute("test_get_pointer_simple = ptr_new(1234)")
        r = idl.get("test_get_pointer_simple")

        v = 1234

        self.assertEqual(v, r, "Failed to dereference pointer.")
示例#35
0
    def test_get_pointer_null(self):

        idl.execute("test_get_pointer_null = ptr_new()")
        r = idl.get("test_get_pointer_null")

        v = None

        self.assertEqual(v, r, "Failed to dereference null pointer.")
示例#36
0
    def test_put_structure_basic(self):

        v = {"a": 1, "b": 1.0, "c": 1 + 2j, "d": "test"}

        idl.put("test_put_structure_basic", v)

        self.assertEqual(v, idl.get("test_put_structure_basic"),
                         "Failed to put basic structure.")
示例#37
0
    def test_put_structure_nested(self):

        v = {"s": {"a": 5, "b": 7}}

        idl.put("test_put_structure_nested", v)

        self.assertEqual(v, idl.get("test_put_structure_nested"),
                         "Failed to put nested structure.")
示例#38
0
    def test_get_pointer_simple(self):

        idl.execute("test_get_pointer_simple = ptr_new(1234)")
        r = idl.get("test_get_pointer_simple")

        v = 1234

        self.assertEqual(v, r, "Failed to dereference pointer.")
示例#39
0
    def test_get_pointer_null(self):

        idl.execute("test_get_pointer_null = ptr_new()")
        r = idl.get("test_get_pointer_null")

        v = None

        self.assertEqual(v, r, "Failed to dereference null pointer.")
示例#40
0
    def test_get_array_multidimensional(self):

        # ND array
        idl.execute("test_get_array_nd = indgen(8,7,6,5,4,3,2,1,/long)")
        v = np.arange(8 * 7 * 6 * 5 * 4 * 3 * 2 * 1, dtype=np.int32).reshape(
            (1, 2, 3, 4, 5, 6, 7, 8))
        r = idl.get("test_get_array_nd")
        self.assertArrayEqual(v, r, "Failed to get multidimensional array.")
示例#41
0
    def test_get_array_string(self):

        # 1D array, string
        idl.execute(
            "test_get_array_1d_string = [\"dog\", \"\", \"cat\", \"fish\"]")
        v = idl.get("test_get_array_1d_string")
        r = np.array(["dog", "", "cat", "fish"])
        self.assertArrayEqual(v, r, "Failed to get string array.")
示例#42
0
    def test_get_pointer_structure(self):

        idl.execute("test_get_pointer_structure = {p: ptr_new(159)}")
        r = idl.get("test_get_pointer_structure")

        v = {"p": 159}

        self.assertEqual(
            v, r, "Failed to dereference pointer nested into structure.")
示例#43
0
    def test_get_pointer_chain(self):

        # 3 chained pointers
        idl.execute("test_get_pointer_chain = ptr_new(ptr_new(ptr_new(5678)))")
        r = idl.get("test_get_pointer_chain")

        v = 5678

        self.assertEqual(v, r, "Failed to dereference chained pointers.")
示例#44
0
    def test_get_pointer_chain(self):

        # 3 chained pointers
        idl.execute("test_get_pointer_chain = ptr_new(ptr_new(ptr_new(5678)))")
        r = idl.get("test_get_pointer_chain")

        v = 5678

        self.assertEqual(v, r, "Failed to dereference chained pointers.")
示例#45
0
    def test_get_array_complex_double(self):

        # 1D array, complex double
        idl.execute(
            "test_get_array_1d_dcomplex = dcomplex([1,2,3,4,5], [6,7,8,9,10])")
        v = idl.get("test_get_array_1d_dcomplex")
        r = np.array([1 + 6j, 2 + 7j, 3 + 8j, 4 + 9j, 5 + 10j],
                     dtype=np.complex128)
        self.assertArrayEqual(v, r, "Failed to get complex double array.")
示例#46
0
    def test_get_array_complex_float(self):

        # 1D array, complex float
        idl.execute(
            "test_get_array_1d_complex = complex([1,2,3,4,5], [6,7,8,9,10])")
        v = idl.get("test_get_array_1d_complex")
        r = np.array([1 + 6j, 2 + 7j, 3 + 8j, 4 + 9j, 5 + 10j],
                     dtype=np.complex64)
        self.assertArrayEqual(v, r, "Failed to get complex float array.")
示例#47
0
    def test_get_structure_nested(self):

        idl.execute(
            "test_get_structure_nested = {a:{g:8, h:{s:\"hello\"}}, s:{a:1, b:2, c:7}}"
        )
        r = idl.get("test_get_structure_nested")

        v = {"a": {"g": 8, "h": {"s": "hello"}}, "s": {"a": 1, "b": 2, "c": 7}}

        self.assertEqual(v, r, "Failed to get nested structure.")
示例#48
0
    def test_get_structure_array(self):

        idl.execute(
            "test_get_structure_array = {a:[1, 2, 3, 4, 5], s:{a:1, b:2, c:7}}"
        )
        r = idl.get("test_get_structure_array")

        v = {"a": np.array([1, 2, 3, 4, 5], dtype=np.int16)}

        self.assertArrayEqual(v["a"], r["a"],
                              "Failed to get array in structure.")
示例#49
0
    def test_get_structure_basic(self):

        idl.execute("test_get_structure_basic = {a:byte(1), b:fix(2), "
                    + "c:uint(3), d:long(4), e:ulong(5), f:long64(6), "
                    + "g:ulong64(7), h:float(1.0), i:double(2.0), "
                    + "j:complex(1.0, 2.0), k:dcomplex(1.0, 2.0),"
                    + "l:\"test\"}")

        r = idl.get("test_get_structure_basic")

        v = {"a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6,
             "g": 7, "h": 1.0, "i": 2.0, "j": 1+2j, "k": 1+2j,
             "l": "test"}

        self.assertEqual(v, r, "Failed to get basic structure.")
示例#50
0
def _setup_idl():

    import idlbridge as idl

    module_path = os.path.abspath(os.path.dirname(__file__))

    idl.execute('searchpath = !PATH')
    searchpath = idl.get('searchpath')

    if searchpath.find(module_path) == -1:
        idl.execute("!PATH=!PATH + ':' + '{}'".format(module_path))

    if searchpath.find('cxs/ks6read') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/ks6read/' )")

    if searchpath.find('cxs/ktread') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/ktread/' )")

    if searchpath.find('cxs/kx1read') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/kx1read/' )")

    if searchpath.find('cxs/idl_spectro/kt3d') == -1:
        idl.execute(
            "!PATH=!PATH + ':' + expand_path( '+~cxs/idl_spectro/kt3d' )")

    if searchpath.find('cxs/utc') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/utc' )")

    if searchpath.find('cxs/instrument_data') == -1:
        idl.execute(
            "!PATH=!PATH + ':' + expand_path( '+~cxs/instrument_data' )")

    if searchpath.find('cxs/calibration') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/calibration' )")

    if searchpath.find('cxs/utilities') == -1:
        idl.execute("!PATH=!PATH + ':' + expand_path( '+~cxs/utilities' )")

    if searchpath.find('cxs/idl/ks457_0/programs') == -1:
        idl.execute(
            "!PATH=!PATH + ':' + expand_path( '+~cxs/idl/ks457_0/programs/')")
示例#51
0
def get_pini_alignment(pulse, oct8_pini):

    import idlbridge as idl

    global _idl_was_setup
    if not _idl_was_setup:
        _setup_idl()
        _idl_was_setup = True

    # Note: array index starts at zero, so actual pini index equals pini number - 1/.
    oct8_pini -= 1

    idl.execute("ret = get_cherab_pinialignment(pulse={})".format(pulse))
    ret = idl.get("ret")

    # Pull out the origin points from the IDL structure, convert to Point3D
    origin = Point3D(ret['origin'][oct8_pini][0] / 1000,
                     ret['origin'][oct8_pini][1] / 1000,
                     ret['origin'][oct8_pini][2] / 1000)

    # Pull out the direction vector from the IDL structure, convert to Vector3D
    direction = Vector3D(ret['vector'][oct8_pini][0],
                         ret['vector'][oct8_pini][1],
                         ret['vector'][oct8_pini][2])

    # TODO - note divergence numbers are different between Carine and Corentin.
    div_u = ret['divu'][oct8_pini] / (2 * PI) * 360
    div_v = ret['divv'][oct8_pini] / (2 * PI) * 360
    divergence = (div_u, div_v)

    # Minimal 1/e width (at the source) of the beam (scalar in meters)
    initial_width = 0.001  # Approximate with 1mm as an effective point source.

    pini_length = PINI_LENGTHS[oct8_pini]

    pini_geometry = (origin, direction, divergence, initial_width, pini_length)

    return pini_geometry
示例#52
0
    def test_get_scalar_long64(self):

        # signed long64
        idl.execute("test_get_long64 = long64(-16000000096790)")
        self.assertEqual(-16000000096790, idl.get("test_get_long64"), "Failed to get signed long64.")
示例#53
0
    def test_get_scalar_int(self):

        # signed integer
        idl.execute("test_get_int = fix(-3485)")
        self.assertEqual(-3485, idl.get("test_get_int"), "Failed to get signed integer.")
示例#54
0
    def test_get_scalar_long(self):

        # signed long
        idl.execute("test_get_long = long(-1633485)")
        self.assertEqual(-1633485, idl.get("test_get_long"), "Failed to get signed long.")
示例#55
0
    def test_get_scalar_uint(self):

        # unsigned integer
        idl.execute("test_get_uint = uint(36640)")
        self.assertEqual(36640, idl.get("test_get_uint"), "Failed to get unsigned integer.")
示例#56
0
    def test_get_scalar_ulong(self):

        # unsigned long
        idl.execute("test_get_ulong = ulong(3267987588)")
        self.assertEqual(3267987588, idl.get("test_get_ulong"), "Failed to get unsigned long.")
示例#57
0
    def test_get_scalar_ulong64(self):

        # unsigned long64
        idl.execute("test_get_ulong64 = ulong64(18446728073709454827)")
        self.assertEqual(18446728073709454827, idl.get("test_get_ulong64"),
                         "Failed to get unsigned long64.")
示例#58
0
    def test_get_scalar_ulong64(self):

        # unsigned long64
        idl.execute("test_get_ulong64 = ulong64(18446728073709454827)")
        self.assertEqual(18446728073709454827, idl.get("test_get_ulong64"), "Failed to get unsigned long64.")
示例#59
0
def load_ks5_sightlines(pulse, spectrometer, parent=None,
                        fibre_names=None,
                        min_wavelength = 526,
                        max_wavelength = 532,
                        spectral_bins = 500):

    if not pulse >= 76666:
        raise ValueError("Only shots >= 76666 are supported at this time.")

    if spectrometer not in ["ks5c", "ks5d"]:
        raise ValueError("Only spectrometers ['ks5c', 'ks5d'] are supported at this time.")

    import idlbridge as idl
    idl.execute('searchpath = !PATH')

    global _idl_was_setup
    if not _idl_was_setup:
        _setup_idl()
        _idl_was_setup = True

    idl.execute("ret = get_ks5_alignment(pulse={}, spec='{}')".format(pulse, spectrometer))

    # Pull out data
    cg_align = idl.get("ret")

    # Process fibres in the order that CXSfit uses.
    cxsfit_order = [i[0] for i in sorted(enumerate(cg_align['cxsfit_track']), key=lambda x:x[1], reverse=True)]

    sightline_group = LineOfSightGroup(parent=parent, name=spectrometer)

    for icg in cxsfit_order:

        fibre_name = str(cg_align['fibre_name'][icg])

        # Some fibre names are blank, meaning ignore them.
        if not fibre_name.strip():
            continue

        if fibre_names and fibre_name not in fibre_names:
             print('Skipped', fibre_name)
             continue

        # Extract the fibres origin and direction
        xi = cg_align['origin_cart']['x'][icg]/1000
        yi = cg_align['origin_cart']['y'][icg]/1000
        zi = cg_align['origin_cart']['z'][icg]/1000

        pini6 = 5
        xj = cg_align['pos_activevol_cart']['x'][pini6][icg]/1000
        yj = cg_align['pos_activevol_cart']['y'][pini6][icg]/1000
        zj = cg_align['pos_activevol_cart']['z'][pini6][icg]/1000

        los_origin = Point3D(xi, yi, zi)
        los_vec = Vector3D(xj-xi, yj-yi, zj-zi).normalise()

        sight_line = SpectroscopicSightLine(los_origin, los_vec, name=fibre_name, parent=sightline_group)
        sight_line.min_wavelength = min_wavelength
        sight_line.max_wavelength = max_wavelength
        sight_line.spectral_bins = spectral_bins

        sightline_group.add_sight_line(sight_line)

    return sightline_group
示例#60
0
    def test_get_scalar_float(self):

        # float
        idl.execute("test_get_float = float(-2.0)")
        self.assertEqual(-2.0, idl.get("test_get_float"), "Failed to get float.")