Commit 57bad12a authored by Roberto Susino's avatar Roberto Susino
Browse files

Version 0.0

parents
Loading
Loading
Loading
Loading

decode_obt.pro

0 → 100644
+5 −0
Original line number Diff line number Diff line
function decode_obt, t_coarse, t_fine, to_decimal = to_decimal, from_decimal = from_decimal
	if keyword_set(to_decimal) then return, double(t_coarse) + double(t_fine)/65536.D0
	if keyword_set(from_decimal) then obt = [ulong(t_coarse), uint((t_coarse - ulong(t_coarse)) * 65536)] else obt = [t_coarse, t_fine]
	return, (obt.tostring()).join(':')
end

fits_hdr2struct.pro

0 → 100644
+15 −0
Original line number Diff line number Diff line
function fits_hdr2struct, string_hdr

	struct = !null
	n = n_elements(string_hdr)
	for i = 0, n - 1 do begin
		tag = string_hdr[i].substring(0, 7)
		tag = tag.trim()
		if tag eq '' then continue
		if tag.startswith('end', /fold) or tag.contains('continue', /fold) then continue
		if isa(struct) then if where(tag_names(struct) eq tag) ge 0 then continue
		struct = create_struct(struct, tag.replace('-', ' '), fxpar(string_hdr, tag))
	endfor

	return, struct
end

get_light_time.pro

0 → 100644
+16 −0
Original line number Diff line number Diff line
function get_light_time, utc, body, target, radvel = radvel

	; convert the requested date into ephemeris time

	cspice_str2et, utc, et

	; coordinates of the body wrt the target in the j2000 system

	cspice_spkezr, body, et, 'J2000', 'NONE', target, state, ltime

	; radial component of the velocity

	radvel = 1000.d0 * total(state[0 : 2] * state[3 : 5]) / sqrt(total(state[0 : 2]^2))

	return, ltime
end

json_write.pro

0 → 100644
+5 −0
Original line number Diff line number Diff line
pro json_write, struct, filename
	openw, unit, filename, /get_lun
	printf, unit, struct, /implied_print
	free_lun, unit
end

load_spice_kernels.pro

0 → 100644
+22 −0
Original line number Diff line number Diff line
pro load_spice_kernels, path, unload = unload, kernel_list = kernel_list, kernel_version = kernel_version
	if keyword_set(unload) then cspice_kclear else begin
		metakernel = path + '/mk/solo_ANC_soc-flown-mk.tm'
		openr, in, metakernel, /get_lun
		kernel_list = list()
		while ~ eof(in) do begin
			line = ''
			readf, in, line
			if line.contains('$KERNELS', /fold) then begin
				line = line.replace('$KERNELS', path)
				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)
				kernel_version = fields[1]
			endif
		endwhile
		close, /all
		foreach item, kernel_list do cspice_furnsh, item
	endelse
end