Commit 91d67522 authored by Roberto Susino's avatar Roberto Susino
Browse files

Code improvements and optimizations

parent 7644e165
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
function fits_hdr2struct, string_hdr
    compile_opt idl2

    struct = !null
    n = n_elements(string_hdr)
+8 −7
Original line number Diff line number Diff line
function get_light_time, utc, target, observer, rad_velocity = rad_velocity
    compile_opt idl2

    ; convert the requested date into ephemeris time

+5 −3
Original line number Diff line number Diff line
pro json_write, struct, filename
    compile_opt idl2

    openw, unit, filename, /get_lun
    printf, unit, json_serialize(struct, /lower)
    free_lun, unit
+37 −35
Original line number Diff line number Diff line
pro load_spice_kernels, path, unload = unload, kernel_list = kernel_list, kernel_version = kernel_version
    compile_opt idl2

    if keyword_set(unload) then cspice_kclear else begin
        kernel_list = list()

@@ -8,11 +10,11 @@ pro load_spice_kernels, path, unload = unload, kernel_list = kernel_list, kernel
            readf, unit, line
            if line.contains('$KERNELS', /fold) then begin
                line = line.replace('$KERNELS', path)
				line = line.replace("'", '')
                line = line.replace('''', '')
                kernel_list.add, line.trim()
            endif
            if line.contains('SKD_VERSION', /fold) then begin
				fields = stregex(line, ".*'([a-z_0-9]*)'", /extract, /sub)
                fields = stregex(line, '.*''([a-z_0-9]*)''', /extract, /sub)
                kernel_version = fields[1]
            endif
        endwhile
@@ -24,11 +26,11 @@ pro load_spice_kernels, path, unload = unload, kernel_list = kernel_list, kernel
            readf, unit, line
            if line.contains('$KERNELS', /fold) then begin
                line = line.replace('$KERNELS', path)
				line = line.replace("'", '')
                line = line.replace('''', '')
                kernel_list.add, line.trim()
            endif
            if line.contains('SKD_VERSION', /fold) then begin
				fields = stregex(line, ".*'([a-z_0-9]*)'", /extract, /sub)
                fields = stregex(line, '.*''([a-z_0-9]*)''', /extract, /sub)
                kernel_version = fields[1]
            endif
        endwhile
+9 −1
Original line number Diff line number Diff line
function m_angle_uv, matrix
    compile_opt idl2

    a = mean(matrix[8 : 43, 8 : 43])
    b = mean(matrix[980 : 1015, 8 : 43])
    c = mean(matrix[8 : 43, 980 : 1015])
@@ -8,12 +10,16 @@ function m_angle_uv, matrix
end

function m_center_uv, matrix
    compile_opt idl2

    a = mean(matrix[452 : 571, 460 : 579])

    return, a
end

function normalize_dark, data, dark
    compile_opt idl2

    dark_bin = rebin(dark, 1024, 1024, /sample)
    data_bin = rebin(data, 1024, 1024, /sample)

@@ -28,6 +34,8 @@ function normalize_dark, data, dark
end

function metis_dark_uvda, data, header, cal_pack, err_info, quality_matrix = quality_matrix, history = history
    compile_opt idl2

    dark = cal_pack.uv_channel.dark

    dit = header.dit
Loading