DOI-USGS / ale

Abstraction Layer for Ephemerides (ALE)
Other
13 stars 33 forks source link

Mystery with MSL camera generation #588

Closed oleg-alexandrov closed 10 months ago

oleg-alexandrov commented 10 months ago

I found a very strange issue that defies any explanation, and no attempt at debugging offers any clues. With no changes whatsoever to the ale code, kernels, spice, etc, CSM cameras produced by ALE are now wrong.

One notable change in the produced .json camera files is that instead of:

"instrument_pointing": { "time_dependent_frames": [ -76000, -76910, -76900, 10014, 1 ],

there is now:

"instrument_pointing": { "time_dependent_frames": [ -76000, 1 ],

Some frames just went missing.

I would like to ask @acpaquette, if possible, to see if file NLB_450492465EDR_F0310634NCAM00357M1.json is produced as it used to be from the LBL file. This is part of the MSL dataset that was shared around, so a prior copy of this exists.

The LBL file is here: https://pds-imaging.jpl.nasa.gov/data/msl/MSLNAV_0XXX/DATA/SOL00597/NLB_450492465EDR_F0310634NCAM00357M1.LBL

Anybody encountered anything like that?

acpaquette commented 10 months ago

@oleg-alexandrov I will double check the ISD/generation. If this is the ISD I sent you it's possible that I generated it using some weird parameters

oleg-alexandrov commented 10 months ago

It is not something you did though. I can't reproduce what I did myself.

I will debug this. My request would be only for you to try to create an ISD, without overwriting the old one, and seeing if there are frames missing. (To ensure I am not hallucinating. :)

On Fri, Jan 12, 2024 at 8:47 AM acpaquette @.***> wrote:

@oleg-alexandrov https://github.com/oleg-alexandrov I will double check the ISD/generation. If this is the ISD I sent you it's possible that I generated it using some weird parameters

— Reply to this email directly, view it on GitHub https://github.com/DOI-USGS/ale/issues/588#issuecomment-1889632045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDU3DEOGTXFUA2GGA56P3YOFSJJAVCNFSM6AAAAABBXT5ZWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBZGYZTEMBUGU . You are receiving this because you were mentioned.Message ID: @.***>

acpaquette commented 10 months ago

@oleg-alexandrov It looks like the ISD I sent and the new one I made from main both have the expected frame chains from ther ISD:

  "instrument_pointing": {
    "time_dependent_frames": [
      -76000,
      -76910,
      -76900,
      10014,
      1
    ],

What you produced is usually what happens if you just compute from source to destination using spice rather than the ALE FrameChain class but I am not sure why you are getting that.

acpaquette commented 10 months ago

What did you do to write the ISD? More importantly are the quaternions the same or are they different?

oleg-alexandrov commented 10 months ago

The quaternions changed too.

All I did to create that ISD is the following:

import os, sys, json, ale

labelFile = sys.argv[1]
prefix = os.path.splitext(labelFile)[0]
usgscsm_str = ale.loads(labelFile, formatter = "ale",
                        verbose = True)

csm_isd = prefix + '.json'
print("Saving: " + csm_isd)
with open(csm_isd, 'w') as isd_file:
  isd_file.write(usgscsm_str)

Good to know the problem is on my side.

acpaquette commented 10 months ago

Huh, weird. You should need some form of kernels in the loads call unless they are already loaded. What kernels are you loading?

oleg-alexandrov commented 10 months ago

Good point. Aren't kernels loaded explicitly only from .cub files? This uses the spice data, so I assumed there's no need for kernels.

Should this invocation be modified somehow?

acpaquette commented 10 months ago

Yes, but if you are passing a PDS3 label you should have to provide a kernel set to get the spice data from. To get the loads call you posted working on my end I have to add the following:

kernels = "/Users/acpaquette/msl_data/msl/kernels/mk/msl_2017_v01.tm"
usgscsm_str = ale.loads(labelFile, formatter = "ale", verbose = True, props = {"kernels": [kernels]})

I am not sure how you are getting an ISD out from the loads call without kernels.

oleg-alexandrov commented 10 months ago

I looked very carefully at what you do and what I do, and found the source of the problem. I had "props={'nadir': True}" in the actual script I was using, but was instead trying to debug based on the documented script.

Sorry. One of those crazy things.

Thanks a lot. I could have figured it out without your help.

acpaquette commented 10 months ago

Sweet! Glad that was solved. Good to close?

oleg-alexandrov commented 10 months ago

Yay. I will close myself.