kshana 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Ashforde OÜ
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,538 @@
1
+ <h1 align="center">
2
+ <img src="docs/assets/kshana-banner.svg" alt="Kshana — the precise instant. Open, reproducible hybrid quantum/classical PNT performance simulation." width="760">
3
+ </h1>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/ashfordeOU/kshana/actions/workflows/ci.yml"><img src="https://github.com/ashfordeOU/kshana/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
7
+ <a href="https://github.com/ashfordeOU/kshana/releases"><img src="https://img.shields.io/github/v/release/ashfordeOU/kshana?sort=semver" alt="Release"></a>
8
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="License: Apache-2.0"></a>
9
+ <a href="Cargo.toml"><img src="https://img.shields.io/badge/rust-1.75%2B-orange.svg" alt="Rust 1.75+"></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <strong>Kshana</strong> (क्षण, Sanskrit: <em>"the precise instant"</em>) is an open, reproducible
14
+ simulator for <strong>hybrid quantum/classical PNT</strong> — positioning, navigation, and timing.
15
+ </p>
16
+
17
+ It quantifies, in hard and reproducible numbers, what quantum clocks, quantum
18
+ inertial sensors, and optical time-transfer buy a navigation system over classical
19
+ PNT — scored against the operational figures of merit that matter for resilient
20
+ navigation. Every result is reproducible from `scenario + seed + engine version`,
21
+ and every sensor parameter is traceable to a published source.
22
+
23
+ *Free and open source under Apache-2.0, professionally developed and maintained by
24
+ Ashforde OÜ — commercial support, integration, and proprietary extensions available.*
25
+
26
+ > **Status: research-grade, v0.6.0.** Four sensor packs that each report all six
27
+ > operational figures of merit (including a clock-aided spoof-detection security
28
+ > score, with an active spoofing-attack demonstrator), a joint Kalman fusion
29
+ > estimator and an integrity bound, multi-constellation geometry-derived GNSS
30
+ > availability *and* position accuracy (dilution of precision) from orbits — synthetic
31
+ > Walker, Keplerian mean elements, or full two-line element sets propagated with
32
+ > **SGP4/SDP4** (validated against the AIAA 2006-6753 vectors) — a full IMU
33
+ > Allan-variance noise model, Monte Carlo confidence bands,
34
+ > trade-study parameter sweeps, and a shareable HTML scorecard — all calibrated to
35
+ > published data and validated against the standard relations, with optional Python and
36
+ > WebAssembly bindings and a browser playground. Read [`docs/VALIDATION.md`](docs/VALIDATION.md)
37
+ > before citing any number — each noise term is labelled `validated` or `not modeled`,
38
+ > and optical-clock figures are *space goals on ground hardware* (no strontium optical
39
+ > clock has flown).
40
+
41
+ > **Try it in your browser:** the [playground](web/) runs the engine client-side as
42
+ > WebAssembly — pick a scenario, edit the parameters, and see the result, with nothing
43
+ > uploaded. Build it locally with `./web/build.sh` (see [`web/README.md`](web/README.md)),
44
+ > or publish it to GitHub Pages via the `pages` workflow.
45
+
46
+ > **New to this?** In plain terms: GPS-style satellite signals tell things *where they
47
+ > are* and *what time it is*. When those signals are lost (jammed, blocked, or out of
48
+ > view in space), a system has to keep going on its own onboard clock and motion
49
+ > sensors — and they slowly drift. "Quantum" clocks and sensors drift far more slowly.
50
+ > Kshana measures, in honest numbers, **how much longer a quantum-equipped system can
51
+ > coast** before it exceeds its accuracy limits. New readers should start with the
52
+ > [plain-language primer](docs/CONCEPTS.md) and the [glossary](docs/GLOSSARY.md).
53
+
54
+ ---
55
+
56
+ ## Contents
57
+
58
+ - [Why](#why) · [What it is / is not](#what-it-is--is-not) · [Results](#results)
59
+ - [Install & build](#install--build) · [Usage](#usage) ([Python](#python), [WebAssembly](#webassembly))
60
+ - [Scenario format](#scenario-format) · [Output](#output) · [Architecture](#architecture)
61
+ - [Repository layout](#repository-layout) · [Validation & honesty](#validation-reproducibility--honesty)
62
+ - [Documentation](#documentation) · [FAQ](#faq) · [Troubleshooting](#troubleshooting)
63
+ - [Roadmap](#roadmap) · [Contributing](#contributing) · [Citing](#citing) · [License](#license)
64
+ - [Support & professional services](#support--professional-services) · [References](#key-references)
65
+
66
+ ## Why
67
+
68
+ Resilient PNT depends on holding position and time when GNSS is denied or jammed.
69
+ Quantum sensors promise far slower drift during those outages. There is no good
70
+ **open** tool to quantify that advantage honestly and reproducibly — so primes,
71
+ agencies, and labs each rebuild private one-offs. Kshana aims to be the neutral,
72
+ citable reference for exactly this question.
73
+
74
+ The engine knows nothing about "quantum" vs "classical": each sensor is an
75
+ **error model** plugged into a common pipeline, so a quantum and a classical
76
+ device are compared *apples-to-apples* on the same scenario, with independent
77
+ noise realizations.
78
+
79
+ ## What it is / is not
80
+
81
+ **It is:** a deterministic engine that runs a GNSS-outage scenario, evolves
82
+ calibrated sensor error models, runs a holdover/dead-reckoning estimator, and
83
+ scores the result against six figures of merit, emitting a JSON result and an SVG
84
+ chart.
85
+
86
+ **It is not:** flight hardware, a quantum-payload design, or a full GNSS receiver.
87
+ Quantum-hardware fidelity comes from published error models, not from this tool.
88
+
89
+ ## Results
90
+
91
+ Each scenario compares a quantum sensor against its classical counterpart through a
92
+ ~1.8 h GNSS outage. Numbers are reproducible (`scenario + seed + version`).
93
+
94
+ <p align="center">
95
+ <img src="docs/assets/inertial-deadreckoning.svg" alt="Inertial dead-reckoning: position error during a GNSS outage — the quantum (cold-atom) sensor stays near the spec line while the navigation-grade sensor diverges to tens of kilometres" width="80%">
96
+ <br><em>Dead-reckoning position error during a GNSS outage: the quantum sensor (blue)
97
+ stays flat near the spec; the classical sensor (red) diverges to tens of kilometres.
98
+ Generated by Kshana from <code>scenarios/imu-deadreckoning.toml</code>.</em>
99
+ </p>
100
+
101
+ | Pack | Scenario | Quantum | Classical |
102
+ |------|----------|---------|-----------|
103
+ | **1 — Clock holdover** | `clock-holdover.toml` (20 ns spec) | optical clock holds the full outage | CSAC breaches the spec mid-outage |
104
+ | **2 — Inertial dead-reckoning** | `imu-deadreckoning.toml` (100 m spec) | cold-atom: **~41 m**, holds full outage | nav-grade: breaches in **~350 s** → tens of km |
105
+ | **3 — Time transfer** (optical inter-satellite link) | `timetransfer.toml` | optical: **~0.3 mm** ranging | RF (TWSTFT): **~150 mm** ranging |
106
+ | **4 — Hybrid fusion** (capstone) | `hybrid-pnt.toml` | full position+timing for the whole outage | **position-limited at ~350 s** |
107
+
108
+ The capstone shows the fusion thesis: optical inter-satellite time-transfer keeps even
109
+ a classical *clock* locked, isolating the *inertial* sensor as the classical suite's
110
+ weak link — i.e. quantum inertial + optical timing together.
111
+
112
+ A further scenario, `orbit-gnss-challenged.toml`, derives GNSS availability from
113
+ **orbital geometry** rather than hand-authored windows: a spacecraft inside the GNSS
114
+ shell is propagated against a GPS-like Walker constellation, and the visible-satellite
115
+ count (line-of-sight, Earth-occultation, elevation mask) sets the fix state at each
116
+ step. Over a day the user is in fix only ~59% of the time; the quantum clock holds a
117
+ 5 ns timing solution through every gap (availability **1.0**), the chip-scale clock
118
+ only **~0.83**.
119
+
120
+ The constellation can also be given as real two-line element sets. A *full* TLE
121
+ (line 1 + line 2) is propagated with the full **SGP4/SDP4** model — including
122
+ atmospheric drag and the deep-space lunar-solar and 12 h / 24 h resonance terms that
123
+ matter for ~12 h GNSS orbits — validated against the official AIAA 2006-6753 vectors
124
+ to a worst-case ≈ 4 mm (`scenarios/orbit-sgp4-gps.toml`). A line-2-only block keeps
125
+ the analytic two-body propagation (`scenarios/orbit-real-tle.toml`); the two forms can
126
+ be mixed in one constellation.
127
+
128
+ ## Install & build
129
+
130
+ Requires a Rust toolchain (≥ 1.75; developed on 1.93).
131
+
132
+ ```bash
133
+ git clone https://github.com/AshfordeOU/kshana
134
+ cd kshana
135
+ cargo build --release
136
+ cargo test # all tests pass
137
+ ```
138
+
139
+ ## Usage
140
+
141
+ Run any scenario; the CLI dispatches on the scenario's `kind` field and writes a
142
+ `<scenario>.result.json` and a `<scenario>.chart.svg` next to it:
143
+
144
+ ```bash
145
+ cargo run -- scenarios/clock-holdover.toml
146
+ cargo run -- scenarios/imu-deadreckoning.toml
147
+ cargo run -- scenarios/timetransfer.toml
148
+ cargo run -- scenarios/hybrid-pnt.toml
149
+ cargo run -- scenarios/orbit-gnss-challenged.toml
150
+ cargo run -- scenarios/orbit-sgp4-gps.toml
151
+ ```
152
+
153
+ Example output (clock holdover — note the Integrity and Security figures of merit):
154
+
155
+ ```
156
+ scenario c827e5d40d25 | quantum holdover 6600s p95 0.0ns integrity 1.000 security 0.997 | classical holdover 2610s p95 19.7ns integrity 1.000 security 0.000
157
+ wrote scenarios/clock-holdover.result.json and scenarios/clock-holdover.chart.svg
158
+ ```
159
+
160
+ The optical clock's tight detection floor keeps `security 0.997`; the chip-scale
161
+ clock's own noise over the monitoring window exceeds the 20 ns spec, so it has no
162
+ spoof-detection margin (`security 0.000`). The orbit scenario additionally reports a
163
+ geometry block — fraction of samples with a fix, and best/median PDOP and position
164
+ accuracy — alongside the clock result.
165
+
166
+ ### Python
167
+
168
+ An optional Python extension (PyO3, abi3) wraps the same engine. Build and install
169
+ it with [maturin](https://www.maturin.rs/):
170
+
171
+ ```bash
172
+ pip install maturin
173
+ maturin develop --features python # or: maturin build --features python
174
+ ```
175
+
176
+ ```python
177
+ import json, kshana
178
+
179
+ result = json.loads(kshana.run(open("scenarios/clock-holdover.toml").read()))
180
+ print(result["quantum"]["fom"]["integrity"])
181
+
182
+ # json, svg, and a one-line summary at once:
183
+ result_json, chart_svg, summary = kshana.run_full(open("scenarios/orbit-gnss-challenged.toml").read())
184
+ print(kshana.version(), summary)
185
+ ```
186
+
187
+ Wheels are built for Linux, macOS, and Windows by the `wheels` workflow on each
188
+ release tag.
189
+
190
+ ### WebAssembly
191
+
192
+ The engine also runs in the browser via [wasm-pack](https://rustwasm.github.io/wasm-pack/):
193
+
194
+ ```bash
195
+ wasm-pack build --target web -- --features wasm
196
+ ```
197
+
198
+ ```js
199
+ import init, { run, chart_svg, version } from "./pkg/kshana.js";
200
+ await init();
201
+ const result = JSON.parse(run(tomlText));
202
+ console.log(version(), result.classical.fom.timing_p95_ns);
203
+ ```
204
+
205
+ ## Scenario format
206
+
207
+ Scenarios are declarative TOML. A top-level `kind` selects the pack
208
+ (`clock` is the default if omitted; `inertial`, `timetransfer`, `hybrid`, `orbit`).
209
+ Common fields: `seed`, a `[time]` grid, a `[gnss]` availability timeline (the outage
210
+ driver), and per-sensor blocks with `provenance` strings citing the source of every
211
+ figure. Example (clock):
212
+
213
+ ```toml
214
+ seed = 42
215
+ threshold_ns = 20.0
216
+ [time]
217
+ step_s = 10.0
218
+ duration_s = 7200.0
219
+ [gnss]
220
+ windows = [
221
+ { t0 = 0.0, t1 = 600.0, state = "nominal" }, # 10 min GNSS sync
222
+ { t0 = 600.0, t1 = 7200.0, state = "denied" }, # ~1.8 h outage
223
+ ]
224
+ [clock_quantum]
225
+ id = "optical-sr-lattice"
226
+ provenance = "Strontium optical lattice clock, space-oriented goal sigma_y(1s)=1e-15 (arXiv:1503.08457)"
227
+ y0 = 5.0e-17
228
+ q_wf = 1.0e-30 # white FM: q_wf = sigma_y(1s)^2
229
+ q_rw = 0.0 # random-walk FM
230
+ drift = 0.0 # linear aging (per second)
231
+ [clock_classical]
232
+ id = "csac-sa45s"
233
+ provenance = "Microchip SA65 / SA.45s CSAC datasheet sigma_y(1s)=3e-10"
234
+ y0 = 5.0e-10
235
+ q_wf = 9.0e-20
236
+ q_rw = 0.0
237
+ drift = 0.0
238
+ ```
239
+
240
+ Optional fields (off when absent): a clock may add `flicker_floor` (1/f FM Allan
241
+ floor); an inertial sensor may add `gyro_bias` and `q_arw` (gyro bias and angular
242
+ random walk), and `bias_instability` and `q_aa` (the Allan bias-instability floor and
243
+ acceleration random walk), completing the IMU Allan-variance noise model. A
244
+ clock-holdover scenario may add `runs` (> 1) to run a **Monte Carlo ensemble** — each
245
+ figure of merit is then reported as a mean with a 5th–95th-percentile spread and the
246
+ chart shades the error confidence band (see `scenarios/clock-ensemble.toml`).
247
+
248
+ A `fusion` scenario (same blocks as `hybrid`) runs a single joint Kalman filter as the
249
+ navigator — fusing the clock and position states, disciplined by GNSS and aided by
250
+ optical time transfer — and reports fused holdover with a joint-covariance integrity
251
+ (see `scenarios/fusion-pnt.toml`).
252
+
253
+ A `spoof` scenario injects a ramping false-time spoof (an `[attack]` block with
254
+ `start_s` and `rate_ns_per_s`) and runs each clock's integrity monitor, reporting
255
+ whether and when the spoof is detected and whether it reaches the spec undetected — a
256
+ concrete demonstration of the Security figure of merit (see `scenarios/spoof-attack.toml`).
257
+
258
+ A `sweep` scenario runs a **trade study**: it varies one `parameter` (`threshold_ns`,
259
+ `duration_s`, `quantum_q_wf`, or `classical_q_wf`) from `start` to `stop` over `steps`
260
+ points on a `lin` or `log` `scale`, records a `metric` (e.g. `holdover_s`) for both
261
+ clocks, and charts the two curves. The base scenario goes under `[base]` (see
262
+ `scenarios/sweep-clock-stability.toml`).
263
+
264
+ An `orbit` scenario derives the `[gnss]` timeline from geometry instead of authoring
265
+ it — give a `[user]` orbit, a `[constellation]`, an elevation `mask_deg`, and the two
266
+ clock blocks. It also reports position accuracy from the satellite geometry; the
267
+ optional `sigma_uere_m` (1-sigma user-equivalent range error, default 1 m) scales the
268
+ position dilution of precision into a position sigma. The user orbit may be made
269
+ **eccentric** with `eccentricity` and `argp_deg`, and `j2 = true` adds Earth-oblateness
270
+ secular drift (see `scenarios/orbit-molniya.toml`). The constellation can instead be a
271
+ **real one**: give `[constellation]` a `tle` block of two-line element sets and the
272
+ satellites are parsed from it (see `scenarios/orbit-real-tle.toml`). Add one or more
273
+ `[[constellations]]` blocks for **multi-GNSS** (e.g. GPS + Galileo; see
274
+ `scenarios/orbit-multignss.toml`):
275
+
276
+ ```toml
277
+ kind = "orbit"
278
+ seed = 7
279
+ threshold_ns = 5.0
280
+ mask_deg = 10.0
281
+ sigma_uere_m = 1.0 # optional; position sigma = position-DOP * this
282
+ [time]
283
+ step_s = 60.0
284
+ duration_s = 86400.0
285
+ [user] # spacecraft (altitude in km, angles in deg)
286
+ altitude_km = 8000.0
287
+ inclination_deg = 0.0
288
+ [constellation] # Walker-delta GNSS (GPS-like)
289
+ altitude_km = 20180.0
290
+ inclination_deg = 55.0
291
+ planes = 6
292
+ sats_per_plane = 4
293
+ phasing_f = 1.0
294
+ [clock_quantum] # ... as above
295
+ [clock_classical] # ... as above
296
+ ```
297
+
298
+ See `scenarios/` for one example of every kind.
299
+
300
+ ## Output
301
+
302
+ The result artifact is versioned, self-describing JSON: per-step time series, the
303
+ scored figures of merit, the active model specs (with provenance), the seed, and a
304
+ **scenario hash** — so any chart can be reproduced from the file. The figures of
305
+ merit follow the standard operational PNT figures of merit:
306
+
307
+ | Figure of merit | How Kshana computes it |
308
+ |-----------------|------------------------|
309
+ | Positioning / Timing Performance | RMS + 95th-percentile error over the outage |
310
+ | Autonomy | holdover duration — time in-spec after GNSS loss |
311
+ | Resilience | error-growth slope during the outage |
312
+ | Availability | fraction of the run with an in-spec solution |
313
+ | Integrity | protection-level containment — fraction of outage samples whose error stays inside the Kalman filter's k-sigma bound (clock pack) |
314
+ | Security | clock-aided spoof-detection score — how far below the timing spec a time-spoof can be flagged by cross-checking GNSS time against the clock's own coasted prediction (clock and orbit packs) |
315
+
316
+ New to these terms? Each is defined in plain language in the [glossary](docs/GLOSSARY.md).
317
+
318
+ ## Architecture
319
+
320
+ One engine; each sensor pack plugs in via a common error-model interface. See
321
+ [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for the full set of diagrams.
322
+
323
+ ```mermaid
324
+ flowchart LR
325
+ SCN["Scenario (.toml)<br/>seed · GNSS timeline · sensor params"] --> ENG
326
+ subgraph ENG["Engine (per step)"]
327
+ direction TB
328
+ M["Error model<br/>step(): evolve noise state"] --> E["Estimator<br/>GNSS-disciplined holdover"]
329
+ E --> F["FoM scoring<br/>vs the 6 figures of merit"]
330
+ end
331
+ ENG --> OUT["result.json + chart.svg<br/>(reproducible: scenario+seed+version)"]
332
+ ```
333
+
334
+ ```mermaid
335
+ flowchart TD
336
+ cli["CLI · Python · WebAssembly"] --> api["api — run_toml: dispatch by kind"]
337
+ subgraph shared["Shared core"]
338
+ types["types"]
339
+ scenario["scenario · GNSS timeline"]
340
+ allan["allan — Allan deviation"]
341
+ end
342
+ subgraph p1["Pack 1 · Clock"]
343
+ models["models — ClockModel (+ flicker)"]
344
+ estimator["estimator — holdover"]
345
+ kalman["kalman — Integrity bound"]
346
+ security["security — spoof-detection score"]
347
+ fom["fom · report · run"]
348
+ end
349
+ p2["Pack 2 · inertial — accel + gyro"]
350
+ p3["Pack 3 · timetransfer — optical/RF link"]
351
+ p4["Pack 4 · hybrid — fused PNT suite"]
352
+ orbit["orbit — geometry → GNSS timeline + DOP"]
353
+ api --> p1
354
+ api --> p2
355
+ api --> p3
356
+ api --> p4
357
+ p1 --> shared
358
+ p2 --> shared
359
+ p3 --> shared
360
+ orbit --> p1
361
+ p4 -. composes .-> p1
362
+ p4 -. composes .-> p2
363
+ p4 -. composes .-> p3
364
+ ```
365
+
366
+ ## Repository layout
367
+
368
+ ```
369
+ kshana/
370
+ ├── src/
371
+ │ ├── types.rs # Seconds, TimeGrid, ModelSpec
372
+ │ ├── scenario.rs # GNSS timeline, clock scenario config
373
+ │ ├── models.rs # ErrorModel trait, ClockModel (white FM, RWFM, aging)
374
+ │ ├── estimator.rs # HoldoverEstimator (quadratic offset+aging removal)
375
+ │ ├── fom.rs # figure-of-merit scoring
376
+ │ ├── allan.rs # overlapping Allan deviation
377
+ │ ├── kalman.rs # two-state Kalman clock estimator + integrity bound
378
+ │ ├── report.rs # result schema, scenario hash, SVG chart (clock)
379
+ │ ├── run.rs # clock + orbit-clock run pipelines
380
+ │ ├── inertial.rs # Pack 2: inertial dead-reckoning (accel + gyro) + FoMs
381
+ │ ├── timetransfer.rs # Pack 3: optical/RF time-transfer link
382
+ │ ├── hybrid.rs # Pack 4: combined PNT suite + ISL clock-aiding
383
+ │ ├── orbit.rs # orbit propagation + GNSS line-of-sight visibility
384
+ │ ├── api.rs # scenario dispatch shared by the CLI and bindings
385
+ │ ├── python.rs # optional PyO3 extension (feature = "python")
386
+ │ ├── wasm.rs # optional wasm-bindgen module (feature = "wasm")
387
+ │ └── main.rs # CLI
388
+ ├── scenarios/ # cited scenarios (one per pack + a geometry-driven one)
389
+ ├── scripts/ # reproducibility + repo-hygiene guards
390
+ ├── docs/ # CONCEPTS, ARCHITECTURE, VALIDATION, GLOSSARY, assets/
391
+ ├── .github/workflows/ # CI gate, release, and wheel-build pipelines
392
+ ├── pyproject.toml # Python packaging (maturin)
393
+ ├── CHANGELOG.md # Keep a Changelog + SemVer
394
+ └── CONTRIBUTING.md
395
+ ```
396
+
397
+ ## Documentation
398
+
399
+ | Document | For whom | What's in it |
400
+ |----------|----------|--------------|
401
+ | [Concepts primer](docs/CONCEPTS.md) | everyone, start here | what Kshana does and why, from zero to the physics |
402
+ | [Playground](web/README.md) | everyone | run the engine in your browser (WebAssembly); build &amp; deploy notes |
403
+ | [Glossary](docs/GLOSSARY.md) | everyone | plain-language definitions of every term |
404
+ | [Architecture](docs/ARCHITECTURE.md) | developers / reviewers | module map, engine pipeline, dispatch, and diagrams |
405
+ | [Validation status](docs/VALIDATION.md) | reviewers / citers | what is `validated` vs `not modeled`, with evidence |
406
+ | [Changelog](CHANGELOG.md) | everyone | released history (Keep a Changelog + SemVer) |
407
+ | [Contributing](CONTRIBUTING.md) | contributors | build, guards, test/citation discipline, DCO |
408
+ | [Code of Conduct](CODE_OF_CONDUCT.md) | community | expected conduct (Contributor Covenant) |
409
+ | [Security policy](SECURITY.md) | reporters | how to report a vulnerability; dual-use note |
410
+
411
+ ## Validation, reproducibility & honesty
412
+
413
+ - Every noise term is calibrated to a **published, cited** figure and validated
414
+ against the standard relation (Allan deviation for clocks; Groves' dead-reckoning
415
+ error growth for inertial; the timing→ranging conversion for time transfer). Status
416
+ per term is tracked in [`docs/VALIDATION.md`](docs/VALIDATION.md) as `validated` or
417
+ `not modeled` — nothing is presented as validated that is not.
418
+ - **Reproducible by construction:** `scenario + seed + engine version → identical
419
+ bits`. `scripts/check-reproducible.sh` enforces it; quantum and classical runs use
420
+ independent seeds so their noise is uncorrelated.
421
+ - Maturity is stated honestly: optical-clock and optical-link figures are *targets /
422
+ ground-demonstrator* results, not flown.
423
+
424
+ ## FAQ
425
+
426
+ **Do I need to understand quantum physics to use this?**
427
+ No. If you can run a command line you can run Kshana. Start with the
428
+ [plain-language primer](docs/CONCEPTS.md); look terms up in the [glossary](docs/GLOSSARY.md).
429
+
430
+ **Is this a quantum-hardware design or flight software?**
431
+ No. It is a performance *simulator*. Quantum-hardware fidelity comes from published
432
+ error models, not from this tool. See [What it is / is not](#what-it-is--is-not).
433
+
434
+ **Are the quantum results realistic, or marketing?**
435
+ Every parameter is cited to a datasheet or paper, every model is validated against a
436
+ textbook relation, and maturity is labelled honestly in
437
+ [VALIDATION.md](docs/VALIDATION.md) — including that no strontium optical clock has
438
+ flown. The engine is neutral: quantum and classical are the same code with different
439
+ published numbers.
440
+
441
+ **Can I trust two runs to agree?**
442
+ Yes — runs are deterministic: `scenario + seed + engine version → bit-identical output`,
443
+ enforced by `scripts/check-reproducible.sh`.
444
+
445
+ **Can I use it from Python or in a browser?**
446
+ Yes — see [Python](#python) and [WebAssembly](#webassembly). Both call the same engine.
447
+
448
+ **How do I model my own sensor?**
449
+ Write a scenario `.toml` with your sensor's published figures in the `provenance`
450
+ fields. See [Scenario format](#scenario-format) and the examples in `scenarios/`.
451
+
452
+ **Is it free for commercial use?**
453
+ Yes, under Apache-2.0. Optional commercial support and proprietary extensions are
454
+ available — see [Support](#support--professional-services).
455
+
456
+ ## Troubleshooting
457
+
458
+ **`cargo build` fails on an old toolchain.** Kshana needs Rust ≥ 1.75. Update with
459
+ `rustup update`.
460
+
461
+ **Building the Python extension fails to link on macOS** (`Undefined symbols … _Py…`).
462
+ A Python extension resolves its symbols at load time. `maturin` sets the right linker
463
+ flag automatically — use `maturin develop --features python` rather than a bare
464
+ `cargo build`.
465
+
466
+ **The Python build complains the interpreter is newer than PyO3 knows.** Set
467
+ `PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1` (abi3 wheels are forward-compatible across
468
+ CPython versions).
469
+
470
+ **WebAssembly build can't find the target.** Install it once with
471
+ `rustup target add wasm32-unknown-unknown`, then `wasm-pack build --target web -- --features wasm`.
472
+
473
+ **Where did my output go?** Each run writes `<scenario>.result.json` and
474
+ `<scenario>.chart.svg` next to the input `.toml`. These are git-ignored by design.
475
+
476
+ ## Roadmap
477
+
478
+ See [`CHANGELOG.md`](CHANGELOG.md) for released history and the `[Unreleased]`
479
+ section for what's next (higher-fidelity SGP4 orbit propagation). An active
480
+ spoofing-attack demonstrator, multi-constellation availability, a full IMU
481
+ Allan-variance noise model, a joint Kalman fusion estimator, real constellation
482
+ geometry from TLEs, an HTML scorecard report, a clock-aided spoof-detection Security
483
+ score across all four packs, geometry-derived GNSS availability *and* position
484
+ accuracy (dilution of precision) from Keplerian orbits with eccentricity and J2 drift,
485
+ Monte Carlo confidence bands, trade-study parameter sweeps, an in-browser WebAssembly
486
+ playground, and optional Python (PyO3) and WebAssembly (wasm-bindgen) bindings have
487
+ landed on `main`.
488
+
489
+ ## Contributing
490
+
491
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md). In short: tests pass (`cargo test`), the
492
+ two guard scripts pass, Conventional Commits, and a `CHANGELOG.md` `[Unreleased]`
493
+ entry for every user-visible change. Participation is governed by our
494
+ [Code of Conduct](CODE_OF_CONDUCT.md). To report a security issue, see the
495
+ [Security policy](SECURITY.md) — please do not open a public issue for vulnerabilities.
496
+
497
+ ## Citing
498
+
499
+ If you use Kshana in academic or technical work, please cite it. Machine-readable
500
+ metadata is in [`CITATION.cff`](CITATION.cff) (GitHub renders a "Cite this repository"
501
+ button from it); cite the version you used (e.g. `v0.6.0`).
502
+
503
+ ## License
504
+
505
+ Apache-2.0 — see [`LICENSE`](LICENSE). Contributions are accepted under the same
506
+ license (inbound = outbound); sign commits off per the Developer Certificate of
507
+ Origin with `git commit -s`.
508
+
509
+ **Trademark.** "Kshana" and its marks are trademarks of Ashforde OÜ. The license
510
+ covers the code, not the name — please rename forks and derivative distributions.
511
+
512
+ ## Support & professional services
513
+
514
+ Kshana is free and open source under Apache-2.0 and **professionally developed and
515
+ maintained by Ashforde OÜ** (Estonia). The open engine is complete and usable on its
516
+ own. For organisations that need more, Ashforde OÜ offers:
517
+
518
+ - **Commercial support & integration** — embedding Kshana in your toolchain, custom
519
+ scenarios, and priority fixes.
520
+ - **Custom sensor models** — calibrated to your hardware, including export-sensitive
521
+ resilience models maintained in a private overlay.
522
+ - **Kshana Pro** — proprietary model-based systems-engineering and programme tooling
523
+ that plugs into the open engine to complete the workflow.
524
+ - **Training & consulting** on quantum/classical PNT performance analysis.
525
+
526
+ This is the open-core model: the engine is, and stays, openly licensed; the sustaining
527
+ business is expertise, support, and the proprietary extensions — not license fees.
528
+ Contact **contact@ashforde.org**.
529
+
530
+ ## Key references
531
+
532
+ - Riley, *Handbook of Frequency Stability Analysis* — [NIST SP 1065](https://tf.nist.gov/general/pdf/2220.pdf) (Allan-deviation relations).
533
+ - Origlia, Schiller, Bongs et al. — [arXiv:1503.08457](https://arxiv.org/abs/1503.08457) (strontium optical lattice clock, space-oriented goal).
534
+ - Oelker et al., *Nature Photonics* (2019) — [JILA PDF](https://jila-pfc.colorado.edu/sites/default/files/2019-09/Oelker-Sr%20record%20stability_2019-Nature_Photonics.pdf) (laboratory Sr clock, 4.8×10⁻¹⁷).
535
+ - Templier et al., *Science Advances* (2022) — [arXiv:2209.13209](https://arxiv.org/abs/2209.13209) (hybrid quantum accelerometer triad).
536
+ - Groves, *Principles of GNSS, Inertial, and Multisensor Integrated Navigation* — [IEEE AESS tutorial (UCL Discovery)](https://discovery.ucl.ac.uk/id/eprint/1470141/) (dead-reckoning error growth).
537
+ - Giorgetta et al., *Nature Photonics* 7, 434 (2013) — [arXiv:1211.4902](https://arxiv.org/abs/1211.4902); Deschênes et al., *Phys. Rev. X* 6, 021016 (2016) — [APS](https://journals.aps.org/prx/abstract/10.1103/PhysRevX.6.021016) (optical two-way time-frequency transfer).
538
+ - Optical inter-satellite time-transfer concept — see Giorgetta and Deschênes above.
package/kshana.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Run a scenario and return its SVG chart.
6
+ */
7
+ export function chart_svg(toml: string): string;
8
+
9
+ /**
10
+ * Run a scenario given as a TOML string; returns the result document as a JSON
11
+ * string. Throws a JS error if the scenario is invalid.
12
+ */
13
+ export function run(toml: string): string;
14
+
15
+ /**
16
+ * Run a scenario and return its one-line human-readable summary.
17
+ */
18
+ export function summary(toml: string): string;
19
+
20
+ /**
21
+ * Engine version (the crate version).
22
+ */
23
+ export function version(): string;
24
+
25
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
26
+
27
+ export interface InitOutput {
28
+ readonly memory: WebAssembly.Memory;
29
+ readonly chart_svg: (a: number, b: number) => [number, number, number, number];
30
+ readonly run: (a: number, b: number) => [number, number, number, number];
31
+ readonly summary: (a: number, b: number) => [number, number, number, number];
32
+ readonly version: () => [number, number];
33
+ readonly __wbindgen_externrefs: WebAssembly.Table;
34
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
35
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
36
+ readonly __externref_table_dealloc: (a: number) => void;
37
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
38
+ readonly __wbindgen_start: () => void;
39
+ }
40
+
41
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
42
+
43
+ /**
44
+ * Instantiates the given `module`, which can either be bytes or
45
+ * a precompiled `WebAssembly.Module`.
46
+ *
47
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
48
+ *
49
+ * @returns {InitOutput}
50
+ */
51
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
52
+
53
+ /**
54
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
55
+ * for everything else, calls `WebAssembly.instantiate` directly.
56
+ *
57
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
58
+ *
59
+ * @returns {Promise<InitOutput>}
60
+ */
61
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/kshana.js ADDED
@@ -0,0 +1,300 @@
1
+ /* @ts-self-types="./kshana.d.ts" */
2
+
3
+ /**
4
+ * Run a scenario and return its SVG chart.
5
+ * @param {string} toml
6
+ * @returns {string}
7
+ */
8
+ export function chart_svg(toml) {
9
+ let deferred3_0;
10
+ let deferred3_1;
11
+ try {
12
+ const ptr0 = passStringToWasm0(toml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
13
+ const len0 = WASM_VECTOR_LEN;
14
+ const ret = wasm.chart_svg(ptr0, len0);
15
+ var ptr2 = ret[0];
16
+ var len2 = ret[1];
17
+ if (ret[3]) {
18
+ ptr2 = 0; len2 = 0;
19
+ throw takeFromExternrefTable0(ret[2]);
20
+ }
21
+ deferred3_0 = ptr2;
22
+ deferred3_1 = len2;
23
+ return getStringFromWasm0(ptr2, len2);
24
+ } finally {
25
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Run a scenario given as a TOML string; returns the result document as a JSON
31
+ * string. Throws a JS error if the scenario is invalid.
32
+ * @param {string} toml
33
+ * @returns {string}
34
+ */
35
+ export function run(toml) {
36
+ let deferred3_0;
37
+ let deferred3_1;
38
+ try {
39
+ const ptr0 = passStringToWasm0(toml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ const len0 = WASM_VECTOR_LEN;
41
+ const ret = wasm.run(ptr0, len0);
42
+ var ptr2 = ret[0];
43
+ var len2 = ret[1];
44
+ if (ret[3]) {
45
+ ptr2 = 0; len2 = 0;
46
+ throw takeFromExternrefTable0(ret[2]);
47
+ }
48
+ deferred3_0 = ptr2;
49
+ deferred3_1 = len2;
50
+ return getStringFromWasm0(ptr2, len2);
51
+ } finally {
52
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Run a scenario and return its one-line human-readable summary.
58
+ * @param {string} toml
59
+ * @returns {string}
60
+ */
61
+ export function summary(toml) {
62
+ let deferred3_0;
63
+ let deferred3_1;
64
+ try {
65
+ const ptr0 = passStringToWasm0(toml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
66
+ const len0 = WASM_VECTOR_LEN;
67
+ const ret = wasm.summary(ptr0, len0);
68
+ var ptr2 = ret[0];
69
+ var len2 = ret[1];
70
+ if (ret[3]) {
71
+ ptr2 = 0; len2 = 0;
72
+ throw takeFromExternrefTable0(ret[2]);
73
+ }
74
+ deferred3_0 = ptr2;
75
+ deferred3_1 = len2;
76
+ return getStringFromWasm0(ptr2, len2);
77
+ } finally {
78
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Engine version (the crate version).
84
+ * @returns {string}
85
+ */
86
+ export function version() {
87
+ let deferred1_0;
88
+ let deferred1_1;
89
+ try {
90
+ const ret = wasm.version();
91
+ deferred1_0 = ret[0];
92
+ deferred1_1 = ret[1];
93
+ return getStringFromWasm0(ret[0], ret[1]);
94
+ } finally {
95
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
96
+ }
97
+ }
98
+ function __wbg_get_imports() {
99
+ const import0 = {
100
+ __proto__: null,
101
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
102
+ throw new Error(getStringFromWasm0(arg0, arg1));
103
+ },
104
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
105
+ // Cast intrinsic for `Ref(String) -> Externref`.
106
+ const ret = getStringFromWasm0(arg0, arg1);
107
+ return ret;
108
+ },
109
+ __wbindgen_init_externref_table: function() {
110
+ const table = wasm.__wbindgen_externrefs;
111
+ const offset = table.grow(4);
112
+ table.set(0, undefined);
113
+ table.set(offset + 0, undefined);
114
+ table.set(offset + 1, null);
115
+ table.set(offset + 2, true);
116
+ table.set(offset + 3, false);
117
+ },
118
+ };
119
+ return {
120
+ __proto__: null,
121
+ "./kshana_bg.js": import0,
122
+ };
123
+ }
124
+
125
+ function getStringFromWasm0(ptr, len) {
126
+ return decodeText(ptr >>> 0, len);
127
+ }
128
+
129
+ let cachedUint8ArrayMemory0 = null;
130
+ function getUint8ArrayMemory0() {
131
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
132
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
133
+ }
134
+ return cachedUint8ArrayMemory0;
135
+ }
136
+
137
+ function passStringToWasm0(arg, malloc, realloc) {
138
+ if (realloc === undefined) {
139
+ const buf = cachedTextEncoder.encode(arg);
140
+ const ptr = malloc(buf.length, 1) >>> 0;
141
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
142
+ WASM_VECTOR_LEN = buf.length;
143
+ return ptr;
144
+ }
145
+
146
+ let len = arg.length;
147
+ let ptr = malloc(len, 1) >>> 0;
148
+
149
+ const mem = getUint8ArrayMemory0();
150
+
151
+ let offset = 0;
152
+
153
+ for (; offset < len; offset++) {
154
+ const code = arg.charCodeAt(offset);
155
+ if (code > 0x7F) break;
156
+ mem[ptr + offset] = code;
157
+ }
158
+ if (offset !== len) {
159
+ if (offset !== 0) {
160
+ arg = arg.slice(offset);
161
+ }
162
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
163
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
164
+ const ret = cachedTextEncoder.encodeInto(arg, view);
165
+
166
+ offset += ret.written;
167
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
168
+ }
169
+
170
+ WASM_VECTOR_LEN = offset;
171
+ return ptr;
172
+ }
173
+
174
+ function takeFromExternrefTable0(idx) {
175
+ const value = wasm.__wbindgen_externrefs.get(idx);
176
+ wasm.__externref_table_dealloc(idx);
177
+ return value;
178
+ }
179
+
180
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
181
+ cachedTextDecoder.decode();
182
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
183
+ let numBytesDecoded = 0;
184
+ function decodeText(ptr, len) {
185
+ numBytesDecoded += len;
186
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
187
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
188
+ cachedTextDecoder.decode();
189
+ numBytesDecoded = len;
190
+ }
191
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
192
+ }
193
+
194
+ const cachedTextEncoder = new TextEncoder();
195
+
196
+ if (!('encodeInto' in cachedTextEncoder)) {
197
+ cachedTextEncoder.encodeInto = function (arg, view) {
198
+ const buf = cachedTextEncoder.encode(arg);
199
+ view.set(buf);
200
+ return {
201
+ read: arg.length,
202
+ written: buf.length
203
+ };
204
+ };
205
+ }
206
+
207
+ let WASM_VECTOR_LEN = 0;
208
+
209
+ let wasmModule, wasmInstance, wasm;
210
+ function __wbg_finalize_init(instance, module) {
211
+ wasmInstance = instance;
212
+ wasm = instance.exports;
213
+ wasmModule = module;
214
+ cachedUint8ArrayMemory0 = null;
215
+ wasm.__wbindgen_start();
216
+ return wasm;
217
+ }
218
+
219
+ async function __wbg_load(module, imports) {
220
+ if (typeof Response === 'function' && module instanceof Response) {
221
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
222
+ try {
223
+ return await WebAssembly.instantiateStreaming(module, imports);
224
+ } catch (e) {
225
+ const validResponse = module.ok && expectedResponseType(module.type);
226
+
227
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
228
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
229
+
230
+ } else { throw e; }
231
+ }
232
+ }
233
+
234
+ const bytes = await module.arrayBuffer();
235
+ return await WebAssembly.instantiate(bytes, imports);
236
+ } else {
237
+ const instance = await WebAssembly.instantiate(module, imports);
238
+
239
+ if (instance instanceof WebAssembly.Instance) {
240
+ return { instance, module };
241
+ } else {
242
+ return instance;
243
+ }
244
+ }
245
+
246
+ function expectedResponseType(type) {
247
+ switch (type) {
248
+ case 'basic': case 'cors': case 'default': return true;
249
+ }
250
+ return false;
251
+ }
252
+ }
253
+
254
+ function initSync(module) {
255
+ if (wasm !== undefined) return wasm;
256
+
257
+
258
+ if (module !== undefined) {
259
+ if (Object.getPrototypeOf(module) === Object.prototype) {
260
+ ({module} = module)
261
+ } else {
262
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
263
+ }
264
+ }
265
+
266
+ const imports = __wbg_get_imports();
267
+ if (!(module instanceof WebAssembly.Module)) {
268
+ module = new WebAssembly.Module(module);
269
+ }
270
+ const instance = new WebAssembly.Instance(module, imports);
271
+ return __wbg_finalize_init(instance, module);
272
+ }
273
+
274
+ async function __wbg_init(module_or_path) {
275
+ if (wasm !== undefined) return wasm;
276
+
277
+
278
+ if (module_or_path !== undefined) {
279
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
280
+ ({module_or_path} = module_or_path)
281
+ } else {
282
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
283
+ }
284
+ }
285
+
286
+ if (module_or_path === undefined) {
287
+ module_or_path = new URL('kshana_bg.wasm', import.meta.url);
288
+ }
289
+ const imports = __wbg_get_imports();
290
+
291
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
292
+ module_or_path = fetch(module_or_path);
293
+ }
294
+
295
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
296
+
297
+ return __wbg_finalize_init(instance, module);
298
+ }
299
+
300
+ export { initSync, __wbg_init as default };
package/kshana_bg.wasm ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "kshana",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Chakshu Baweja <contact@ashforde.org>"
6
+ ],
7
+ "description": "Open hybrid quantum/classical PNT performance simulator",
8
+ "version": "0.7.0",
9
+ "license": "Apache-2.0",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/AshfordeOU/kshana"
13
+ },
14
+ "files": [
15
+ "kshana_bg.wasm",
16
+ "kshana.js",
17
+ "kshana.d.ts"
18
+ ],
19
+ "main": "kshana.js",
20
+ "homepage": "https://github.com/AshfordeOU/kshana",
21
+ "types": "kshana.d.ts",
22
+ "sideEffects": [
23
+ "./snippets/*"
24
+ ],
25
+ "keywords": [
26
+ "pnt",
27
+ "navigation",
28
+ "quantum",
29
+ "gnss",
30
+ "simulation"
31
+ ]
32
+ }