-
Notifications
You must be signed in to change notification settings - Fork 33
Generating Test Kernels for an image
spiceinit from=EN1072174528M.cub
Group = Kernels
NaifIkCode = -236820
LeapSecond = $base/kernels/lsk/naif0012.tls
TargetAttitudeShape = $messenger/kernels/pck/pck00010_msgr_v23.tpc
TargetPosition = (Table, $messenger/kernels/tspk/de423s.bsp)
InstrumentPointing = (Table,
$messenger/kernels/ck/msgr_1504_v01.bc,
$messenger/kernels/ck/msgr_mdis_sc040812_1504-
30v1.bc,
$messenger/kernels/ck/msgr_mdis_gm040819_1504-
30v1.bc, $messenger/kernels/fk/msgr_v231.tf)
Instrument = $messenger/kernels/ik/msgr_mdis_v160.ti
SpacecraftClock = $messenger/kernels/sclk/messenger_2548.tsc
InstrumentPosition = (Table,
$messenger/kernels/spk/msgr_20040803_20150430-
_od431sc_2.bsp)
InstrumentAddendum = $messenger/kernels/iak/mdisAddendum009.ti
ShapeModel = Null
InstrumentPositionQuality = Reconstructed
InstrumentPointingQuality = Reconstructed
CameraVersion = 2
End_Group
Always use the SCLK string for the start time
For a framing instrument the stop time is start time + exposure duration. For a line scan instrument the stop time is the start time + exposure duration * number of lines
SpacecraftClockCount = 2/0072174528:989000
ExposureDuration = 1 <MS>
You will also need to account for light time correction. See this gist for an example and code: https://gist.github.com/jessemapel/d99db43cbf7fe9277d4def638532d053
CKs always end in the extension .bc
so look for those files.
Use the ckbrief
utility to see which frames are in each CK. The Object is the frame ID
(ale) igswzawglt1183:data jmapel$ ckbrief msgr_mdis_sc040812_150430v1.bc
CKBRIEF -- Version 6.1.0, June 27, 2014 -- Toolkit Version N0066
Summary for: msgr_mdis_sc040812_150430v1.bc
Object: -236000
Interval Begin ET Interval End ET AV
------------------------ ------------------------ ---
NEED LSK AND SCLK FILES NEED LSK AND SCLK FILES Y
For each frame in each CK extract the information for that frame for the image time. Use the ckslicer tool which you will need to download from NAIF's website. The ckslicer usage docs are quite good. Here's what to pass for the arguments:
- -LSK : your leapsecond file. It should look like
naif####.tls
- -SCLK : your sclk file. It should end in
.tsc
- -INPUTCK : the name of the CK you are extracting from
- -OUTPUTCK : The name of the file you are putting the information in
- -ID : The NAIF ID of the frame you are extracting the information for
- -TIMETYPE : SCLK
- -START : The starting SCLK string
- -STOP : The ending SCLK string
To get the stop time as an SCLK string use the following call in spiceypy:
spice.sce2s(<the ID code for your spacecraft>, spice.scs2e(<the ID code for your spacecraft>, '<your starting SCLK string>') + <the exposure duration for the image>)
You can look up your spacecraft's id here
The CKs can have really long comments so remove them with commnt -d <your new CK file>
. Next, write your new comment to a text file. I'd suggest something like:
This CK is for testing with the image <your image file name>
This CK was generated using the following command
<your ckslicer command>
Then, attach the new comment with commnt -a <your new CK file> <your text file>
.
Use the command toxfr <your new CK file>
to convert the files. They should come out with the extension .xc
.
You need to find the ID of your spacecraft and target. Look on Naif's website.
To slice the SPKs, use spkmerge with a config file. You will need two config files; one for the spacecraft and one for the target. The config files should look like this:
LEAPSECONDS_KERNEL = <Your LSK kernel>
SPK_KERNEL = <the SPK your are creating>
SOURCE_SPK_KERNEL = <the SPK your are extracting from>
INCLUDE_COMMENTS = no
BODIES = <the ID code of either your spacecraft or target>
BEGIN_TIME = <the start time of your image as a UTC string>
END_TIME = <the stop time of your image as a UTC stirng>
To get the UTC strings use the following line in spiceypy:
spice.et2utc(spice.scs2e(<your spacecraft ID>, '<your SCLK string>'), 'c', <How many decimals past the second you want>)
I recommend at least 3 decimals past the second. IE:
>>> spice.et2utc(spice.scs2e(-236, '2/0072174528:989000'), 'c', 3)
'2015 APR 24 04:42:19.666'
Use the command toxfr <your new SPK file>
to convert the files. They should come out with the extension .xsp
.