ISD to Kernel support#116
Conversation
| import ctypes | ||
| import numpy as np | ||
| import os | ||
| import sys | ||
|
|
||
| def _find_lib(): | ||
| # Load library | ||
| try: | ||
| from . import _pyspiceql as mod |
There was a problem hiding this comment.
you mention you did this to avoid latency, which is valid, but how bad was the latency? It will be awkward having a single function exposed this way.
There was a problem hiding this comment.
The kernel would crash in a Jupyter Notebook but I'll check it out again.
There was a problem hiding this comment.
I updated the isd_to_kernel script to use writeCk() and tested with ALE's tests/pytest/data/isds/mexhrsc_isd.json which has ~1500 quats. It works randomly(?) and when it fails this is the error message RuntimeError: std::exception: Error Occured:SPICE(ZEROQUATERNION) The quaternion at index 1133 has magnitude zero.. The index value changes sometimes but the output seems inconsistent.
| namespace { | ||
| thread_local std::string g_writeCkFromBuffersLastError; | ||
|
|
||
| std::vector<std::string> split(const std::string& s, char delim) { | ||
| std::vector<std::string> out; | ||
| std::istringstream ss(s); | ||
| std::string part; | ||
| while (std::getline(ss, part, delim)) { | ||
| auto start = part.find_first_not_of(" \t"); | ||
| if (start == std::string::npos) continue; | ||
| auto end = part.find_last_not_of(" \t"); | ||
| out.push_back(part.substr(start, end == std::string::npos ? part.size() : end - start + 1)); | ||
| } | ||
| return out; | ||
| } | ||
| } |
There was a problem hiding this comment.
why an anonymous namespace?
There was a problem hiding this comment.
I think I was debating on a name and I just forgot, I can name it helper.
|
wrt to only having one time, I can't think of a better solution |
| vector<double> flatQuats; | ||
| flatQuats.reserve(quats.size() * 4); | ||
| for (const auto& q : quats) { | ||
| for (double d : q) { | ||
| flatQuats.push_back(d); | ||
| } | ||
| } |
There was a problem hiding this comment.
I would add a TODO to use std::move instead, will be faster but idk if it matters until we start using it.
| vector<double> flatAv; | ||
| if (!angularVelocities.empty()) { | ||
| flatAv.reserve(angularVelocities.size() * 3); | ||
| for (const auto& a : angularVelocities) { | ||
| for (double d : a) { | ||
| flatAv.push_back(d); | ||
| } | ||
| } | ||
| } |
Supports ALE's ISD to Kernel PR
A check was added to
writeSpk()to see if there is only one state, meaning the same start and stop time (e.g., tests/pytest/isds/mexsrc_isd.json). A padding of 1E-6 was added to create a valid stop time but let me know if the value should be different or this should be addressed another way.Licensing
This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words: