ootk 3.0.0 → 4.0.0-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/.eslintrc.json +10 -10
- package/CHANGELOG.md +122 -0
- package/README.md +27 -40
- package/lib/coordinate/Hill.d.ts +50 -0
- package/lib/coordinate/Hill.js +214 -0
- package/lib/coordinate/Hill.js.map +1 -0
- package/lib/coordinate/index.d.ts +1 -0
- package/lib/coordinate/index.js +2 -0
- package/lib/coordinate/index.js.map +1 -0
- package/lib/covariance/CovarianceSample.d.ts +44 -0
- package/lib/covariance/CovarianceSample.js +146 -0
- package/lib/covariance/CovarianceSample.js.map +1 -0
- package/lib/covariance/StateCovariance.d.ts +41 -0
- package/lib/covariance/StateCovariance.js +62 -0
- package/lib/covariance/StateCovariance.js.map +1 -0
- package/lib/force/AtmosphericDrag.d.ts +32 -0
- package/lib/force/AtmosphericDrag.js +66 -0
- package/lib/force/AtmosphericDrag.js.map +1 -0
- package/lib/force/EarthGravity.d.ts +28 -0
- package/lib/force/EarthGravity.js +115 -0
- package/lib/force/EarthGravity.js.map +1 -0
- package/{dist/ootk.d.ts → lib/force/Force.d.ts} +10 -10
- package/lib/force/Force.js +30 -0
- package/lib/force/Force.js.map +1 -0
- package/lib/force/ForceModel.d.ts +38 -0
- package/lib/force/ForceModel.js +71 -0
- package/lib/force/ForceModel.js.map +1 -0
- package/lib/force/Gravity.d.ts +41 -0
- package/lib/force/Gravity.js +48 -0
- package/lib/force/Gravity.js.map +1 -0
- package/lib/force/SolarRadiationPressure.d.ts +27 -0
- package/lib/force/SolarRadiationPressure.js +42 -0
- package/lib/force/SolarRadiationPressure.js.map +1 -0
- package/lib/force/ThirdBodyGravity.d.ts +27 -0
- package/lib/force/ThirdBodyGravity.js +56 -0
- package/lib/force/ThirdBodyGravity.js.map +1 -0
- package/lib/force/Thrust.d.ts +35 -0
- package/lib/force/Thrust.js +53 -0
- package/lib/force/Thrust.js.map +1 -0
- package/lib/interpolator/ChebyshevCoefficients.d.ts +54 -0
- package/lib/interpolator/ChebyshevCoefficients.js +90 -0
- package/lib/interpolator/ChebyshevCoefficients.js.map +1 -0
- package/lib/interpolator/ChebyshevInterpolator.d.ts +39 -0
- package/lib/interpolator/ChebyshevInterpolator.js +71 -0
- package/lib/interpolator/ChebyshevInterpolator.js.map +1 -0
- package/lib/interpolator/CubicSpline.d.ts +36 -0
- package/lib/interpolator/CubicSpline.js +64 -0
- package/lib/interpolator/CubicSpline.js.map +1 -0
- package/lib/interpolator/CubicSplineInterpolator.d.ts +37 -0
- package/lib/interpolator/CubicSplineInterpolator.js +78 -0
- package/lib/interpolator/CubicSplineInterpolator.js.map +1 -0
- package/lib/interpolator/FieldInterpolator.d.ts +26 -0
- package/lib/interpolator/FieldInterpolator.js +31 -0
- package/lib/interpolator/FieldInterpolator.js.map +1 -0
- package/lib/interpolator/Interpolator.d.ts +23 -0
- package/lib/interpolator/Interpolator.js +48 -0
- package/lib/interpolator/Interpolator.js.map +1 -0
- package/lib/interpolator/LagrangeInterpolator.d.ts +42 -0
- package/lib/interpolator/LagrangeInterpolator.js +156 -0
- package/lib/interpolator/LagrangeInterpolator.js.map +1 -0
- package/lib/interpolator/StateInterpolator.d.ts +29 -0
- package/lib/interpolator/StateInterpolator.js +37 -0
- package/lib/interpolator/StateInterpolator.js.map +1 -0
- package/lib/interpolator/VerletBlendInterpolator.d.ts +44 -0
- package/lib/interpolator/VerletBlendInterpolator.js +115 -0
- package/lib/interpolator/VerletBlendInterpolator.js.map +1 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.d.ts +43 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.js +62 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.js.map +1 -0
- package/lib/maneuver/Waypoint.d.ts +66 -0
- package/lib/maneuver/Waypoint.js +152 -0
- package/lib/maneuver/Waypoint.js.map +1 -0
- package/lib/objects/DetailedSatellite.d.ts +94 -0
- package/lib/objects/DetailedSatellite.js +140 -0
- package/lib/objects/DetailedSatellite.js.map +1 -0
- package/lib/objects/DetailedSensor.d.ts +43 -0
- package/lib/objects/DetailedSensor.js +45 -0
- package/lib/objects/DetailedSensor.js.map +1 -0
- package/{dist/objects/space-object.d.ts → lib/objects/LandObject.d.ts} +19 -21
- package/lib/objects/LandObject.js +28 -0
- package/lib/objects/LandObject.js.map +1 -0
- package/lib/objects/Marker.d.ts +21 -0
- package/lib/objects/Marker.js +25 -0
- package/lib/objects/Marker.js.map +1 -0
- package/lib/objects/index.d.ts +5 -4
- package/lib/objects/index.js +5 -4
- package/lib/objects/index.js.map +1 -1
- package/lib/observation/Observation.d.ts +51 -0
- package/lib/observation/Observation.js +71 -0
- package/lib/observation/Observation.js.map +1 -0
- package/lib/observation/ObservationOptical.d.ts +47 -0
- package/lib/observation/ObservationOptical.js +101 -0
- package/lib/observation/ObservationOptical.js.map +1 -0
- package/lib/observation/ObservationRadar.d.ts +43 -0
- package/lib/observation/ObservationRadar.js +90 -0
- package/lib/observation/ObservationRadar.js.map +1 -0
- package/lib/observation/ObservationUtils.d.ts +21 -0
- package/lib/observation/ObservationUtils.js +33 -0
- package/lib/observation/ObservationUtils.js.map +1 -0
- package/lib/observation/PropagatorPairs.d.ts +31 -0
- package/lib/observation/PropagatorPairs.js +40 -0
- package/lib/observation/PropagatorPairs.js.map +1 -0
- package/lib/ootk.d.ts +10 -8
- package/lib/ootk.js +10 -8
- package/lib/ootk.js.map +1 -1
- package/lib/operations/BoxMuller.d.ts +41 -0
- package/lib/operations/BoxMuller.js +66 -0
- package/lib/operations/BoxMuller.js.map +1 -0
- package/lib/operations/EulerAngles.d.ts +50 -0
- package/lib/operations/EulerAngles.js +111 -0
- package/lib/operations/EulerAngles.js.map +1 -0
- package/lib/operations/Quaternion.d.ts +57 -0
- package/lib/operations/Quaternion.js +164 -0
- package/lib/operations/Quaternion.js.map +1 -0
- package/lib/operations/RandomGaussianSource.d.ts +25 -0
- package/lib/operations/RandomGaussianSource.js +43 -0
- package/lib/operations/RandomGaussianSource.js.map +1 -0
- package/lib/operations/index.d.ts +4 -0
- package/lib/operations/index.js +5 -0
- package/lib/operations/index.js.map +1 -0
- package/lib/optimize/ChebyshevCompressor.d.ts +31 -0
- package/lib/optimize/ChebyshevCompressor.js +80 -0
- package/lib/optimize/ChebyshevCompressor.js.map +1 -0
- package/lib/optimize/DownhillSimplex.d.ts +50 -0
- package/lib/optimize/DownhillSimplex.js +168 -0
- package/lib/optimize/DownhillSimplex.js.map +1 -0
- package/lib/optimize/GoldenSection.d.ts +33 -0
- package/lib/optimize/GoldenSection.js +49 -0
- package/lib/optimize/GoldenSection.js.map +1 -0
- package/lib/optimize/PolynomialRegression.d.ts +37 -0
- package/lib/optimize/PolynomialRegression.js +66 -0
- package/lib/optimize/PolynomialRegression.js.map +1 -0
- package/lib/optimize/PolynomicalRegressionResult.d.ts +28 -0
- package/lib/optimize/PolynomicalRegressionResult.js +32 -0
- package/lib/optimize/PolynomicalRegressionResult.js.map +1 -0
- package/lib/optimize/SimpleLinearRegression.d.ts +41 -0
- package/lib/optimize/SimpleLinearRegression.js +107 -0
- package/lib/optimize/SimpleLinearRegression.js.map +1 -0
- package/lib/optimize/SimplexEntry.d.ts +33 -0
- package/lib/optimize/SimplexEntry.js +39 -0
- package/lib/optimize/SimplexEntry.js.map +1 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.d.ts +54 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.js +118 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.js.map +1 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.d.ts +29 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.js +31 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.js.map +1 -0
- package/lib/orbit_determination/GibbsIOD.d.ts +33 -0
- package/lib/orbit_determination/GibbsIOD.js +70 -0
- package/lib/orbit_determination/GibbsIOD.js.map +1 -0
- package/lib/orbit_determination/GoodingIOD.d.ts +52 -0
- package/lib/orbit_determination/GoodingIOD.js +244 -0
- package/lib/orbit_determination/GoodingIOD.js.map +1 -0
- package/lib/{objects/space-object.d.ts → orbit_determination/HerrickGibbsIOD.d.ts} +17 -22
- package/lib/orbit_determination/HerrickGibbsIOD.js +49 -0
- package/lib/orbit_determination/HerrickGibbsIOD.js.map +1 -0
- package/lib/orbit_determination/LambertIOD.d.ts +46 -0
- package/lib/orbit_determination/LambertIOD.js +199 -0
- package/lib/orbit_determination/LambertIOD.js.map +1 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.d.ts +41 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.js +82 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.js.map +1 -0
- package/lib/propagator/DormandPrince54Propagator.d.ts +29 -0
- package/lib/propagator/DormandPrince54Propagator.js +68 -0
- package/lib/propagator/DormandPrince54Propagator.js.map +1 -0
- package/lib/propagator/KeplerPropagator.d.ts +36 -0
- package/lib/propagator/KeplerPropagator.js +81 -0
- package/lib/propagator/KeplerPropagator.js.map +1 -0
- package/lib/propagator/Propagator.d.ts +35 -0
- package/lib/propagator/Propagator.js +163 -0
- package/lib/propagator/Propagator.js.map +1 -0
- package/lib/propagator/RkCheckpoint.d.ts +23 -0
- package/lib/propagator/RkCheckpoint.js +26 -0
- package/lib/propagator/RkCheckpoint.js.map +1 -0
- package/lib/propagator/RkResult.d.ts +24 -0
- package/lib/propagator/RkResult.js +28 -0
- package/lib/propagator/RkResult.js.map +1 -0
- package/lib/propagator/RungeKutta4Propagator.d.ts +46 -0
- package/lib/propagator/RungeKutta4Propagator.js +132 -0
- package/lib/propagator/RungeKutta4Propagator.js.map +1 -0
- package/lib/propagator/RungeKutta89Propagator.d.ts +29 -0
- package/lib/propagator/RungeKutta89Propagator.js +130 -0
- package/lib/propagator/RungeKutta89Propagator.js.map +1 -0
- package/lib/propagator/RungeKuttaAdaptive.d.ts +52 -0
- package/lib/propagator/RungeKuttaAdaptive.js +152 -0
- package/lib/propagator/RungeKuttaAdaptive.js.map +1 -0
- package/lib/propagator/Sgp4Propagator.d.ts +35 -0
- package/lib/propagator/Sgp4Propagator.js +55 -0
- package/lib/propagator/Sgp4Propagator.js.map +1 -0
- package/lib/smoothing/ExponentialSmoothing.d.ts +24 -0
- package/lib/smoothing/ExponentialSmoothing.js +82 -0
- package/lib/smoothing/ExponentialSmoothing.js.map +1 -0
- package/lib/types/types.d.ts +65 -584
- package/lib/types/types.js +21 -33
- package/lib/types/types.js.map +1 -1
- package/package.json +16 -14
- package/.prettierrc +0 -17
- package/babel.config.js +0 -16
- package/codecov.yml +0 -21
- package/dist/objects/base-object.d.ts +0 -40
- package/dist/objects/detailed-sat.d.ts +0 -66
- package/dist/objects/index.d.ts +0 -4
- package/dist/objects/sat.d.ts +0 -92
- package/dist/objects/sensor.d.ts +0 -93
- package/dist/objects/star.d.ts +0 -46
- package/dist/ootk.js +0 -2
- package/dist/ootk.js.LICENSE.txt +0 -77
- package/dist/sgp4/sgp4.d.ts +0 -82
- package/dist/tle/tle-format-data.d.ts +0 -6
- package/dist/tle/tle.d.ts +0 -375
- package/dist/transforms/transforms.d.ts +0 -94
- package/dist/types/types.d.ts +0 -605
- package/dist/utils/constants.d.ts +0 -34
- package/dist/utils/moon-math.d.ts +0 -113
- package/dist/utils/sun-math.d.ts +0 -230
- package/dist/utils/utils.d.ts +0 -39
- package/lib/objects/base-object.d.ts +0 -40
- package/lib/objects/base-object.js +0 -79
- package/lib/objects/base-object.js.map +0 -1
- package/lib/objects/detailed-sat.d.ts +0 -66
- package/lib/objects/detailed-sat.js +0 -149
- package/lib/objects/detailed-sat.js.map +0 -1
- package/lib/objects/sat.d.ts +0 -92
- package/lib/objects/sat.js +0 -188
- package/lib/objects/sat.js.map +0 -1
- package/lib/objects/sensor.d.ts +0 -93
- package/lib/objects/sensor.js +0 -273
- package/lib/objects/sensor.js.map +0 -1
- package/lib/objects/space-object.js +0 -60
- package/lib/objects/space-object.js.map +0 -1
- package/lib/objects/star.d.ts +0 -46
- package/lib/objects/star.js +0 -91
- package/lib/objects/star.js.map +0 -1
- package/lib/sgp4/sgp4.d.ts +0 -82
- package/lib/sgp4/sgp4.js +0 -3262
- package/lib/sgp4/sgp4.js.map +0 -1
- package/lib/tle/tle-format-data.d.ts +0 -6
- package/lib/tle/tle-format-data.js +0 -10
- package/lib/tle/tle-format-data.js.map +0 -1
- package/lib/tle/tle.d.ts +0 -375
- package/lib/tle/tle.js +0 -611
- package/lib/tle/tle.js.map +0 -1
- package/lib/transforms/transforms.d.ts +0 -94
- package/lib/transforms/transforms.js +0 -308
- package/lib/transforms/transforms.js.map +0 -1
- package/lib/utils/constants.d.ts +0 -34
- package/lib/utils/constants.js +0 -35
- package/lib/utils/constants.js.map +0 -1
- package/lib/utils/moon-math.d.ts +0 -113
- package/lib/utils/moon-math.js +0 -387
- package/lib/utils/moon-math.js.map +0 -1
- package/lib/utils/sun-math.d.ts +0 -230
- package/lib/utils/sun-math.js +0 -422
- package/lib/utils/sun-math.js.map +0 -1
- package/lib/utils/utils.d.ts +0 -39
- package/lib/utils/utils.js +0 -102
- package/lib/utils/utils.js.map +0 -1
- package/sandbox.html +0 -8
- package/tsconfig.base.json +0 -31
- package/tsconfig.build.json +0 -14
- /package/{LICENSE.MD → LICENSE.md} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Propagator } from './Propagator';
|
|
19
|
+
// / SGP4 propagator.
|
|
20
|
+
export class Sgp4Propagator extends Propagator {
|
|
21
|
+
// / Create a new [Sgp4Propagator] object from a [TLE].
|
|
22
|
+
constructor(tle) {
|
|
23
|
+
super();
|
|
24
|
+
this.tle = tle;
|
|
25
|
+
this._checkpoints = [];
|
|
26
|
+
this._cacheState = tle.state.toJ2000();
|
|
27
|
+
}
|
|
28
|
+
get state() {
|
|
29
|
+
return this._cacheState;
|
|
30
|
+
}
|
|
31
|
+
ephemerisManeuver(start, finish, maneuvers, interval = 60.0) {
|
|
32
|
+
throw new Error('Maneuvers cannot be modelled with SGP4.');
|
|
33
|
+
}
|
|
34
|
+
maneuver(maneuver, interval = 60.0) {
|
|
35
|
+
throw new Error('Maneuvers cannot be modelled with SGP4.');
|
|
36
|
+
}
|
|
37
|
+
propagate(epoch) {
|
|
38
|
+
this._cacheState = this.tle.propagate(epoch).toJ2000();
|
|
39
|
+
return this._cacheState;
|
|
40
|
+
}
|
|
41
|
+
reset() {
|
|
42
|
+
this._cacheState = this.tle.state.toJ2000();
|
|
43
|
+
}
|
|
44
|
+
checkpoint() {
|
|
45
|
+
this._checkpoints.push(this._cacheState);
|
|
46
|
+
return this._checkpoints.length - 1;
|
|
47
|
+
}
|
|
48
|
+
clearCheckpoints() {
|
|
49
|
+
this._checkpoints = [];
|
|
50
|
+
}
|
|
51
|
+
restore(index) {
|
|
52
|
+
this._cacheState = this._checkpoints[index];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=Sgp4Propagator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sgp4Propagator.js","sourceRoot":"","sources":["../../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IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { EpochUTC } from 'ootk-core';
|
|
19
|
+
export declare class ExponentialSmoothing {
|
|
20
|
+
private constructor();
|
|
21
|
+
static smooth(xs: number[], alpha: number): number[];
|
|
22
|
+
static smoothDouble(xs: number[], alpha: number, beta: number): number[];
|
|
23
|
+
static smoothTime(epochs: EpochUTC[], xs: number[], timeConstant: number): number[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
// / Exponential data smoothing methods.
|
|
19
|
+
export class ExponentialSmoothing {
|
|
20
|
+
constructor() {
|
|
21
|
+
// disable constructor
|
|
22
|
+
}
|
|
23
|
+
/*
|
|
24
|
+
* Perform exponential smoothing on data set [xs] using the provided
|
|
25
|
+
* data smoothing factor [alpha] _(0.0 <= alpha <= 1.0)_.
|
|
26
|
+
*/
|
|
27
|
+
static smooth(xs, alpha) {
|
|
28
|
+
const ss = [];
|
|
29
|
+
for (let i = 0; i < xs.length; i++) {
|
|
30
|
+
if (i === 0) {
|
|
31
|
+
ss.push(xs[0]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
ss.push(alpha * xs[i] + (1 - alpha) * ss[i - 1]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return ss;
|
|
38
|
+
}
|
|
39
|
+
/*
|
|
40
|
+
* Perform exponential smoothing on data set [xs] using the provided data
|
|
41
|
+
* smoothing factor [alpha] _(0.0 <= alpha <= 1.0)_ and trend smoothing
|
|
42
|
+
* factor [beta] _(0.0 <= beta <= 1.0)_.
|
|
43
|
+
*/
|
|
44
|
+
static smoothDouble(xs, alpha, beta) {
|
|
45
|
+
const bs = [];
|
|
46
|
+
const ss = [];
|
|
47
|
+
for (let i = 0; i < xs.length; i++) {
|
|
48
|
+
if (i === 0) {
|
|
49
|
+
ss.push(xs[0]);
|
|
50
|
+
bs.push(xs[1] - xs[0]);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
ss.push(alpha * xs[i] + (1 - alpha) * (ss[i - 1] + bs[i - 1]));
|
|
54
|
+
bs.push(beta * (ss[i] - ss[i - 1]) + (1 - beta) * bs[i - 1]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return ss;
|
|
58
|
+
}
|
|
59
|
+
/*
|
|
60
|
+
* Perform exponential smoothing on time series data set [xs] correlated
|
|
61
|
+
* with the [epochs] array using the provided [timeConstant]
|
|
62
|
+
* value _(seconds)_.
|
|
63
|
+
*
|
|
64
|
+
* Note: the [timeConstant] is the amount of time for the smoothed response
|
|
65
|
+
* of a unit step function to reach ~63.2% of the original signal.
|
|
66
|
+
*/
|
|
67
|
+
static smoothTime(epochs, xs, timeConstant) {
|
|
68
|
+
const ts = epochs.map((e) => e.posix);
|
|
69
|
+
const ss = [];
|
|
70
|
+
for (let i = 0; i < xs.length; i++) {
|
|
71
|
+
if (i === 0) {
|
|
72
|
+
ss.push(xs[0]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const a = 1 - Math.exp(-(ts[i] - ts[i - 1]) / timeConstant);
|
|
76
|
+
ss.push(a * xs[i] + (1 - a) * ss[i - 1]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return ss;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ExponentialSmoothing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExponentialSmoothing.js","sourceRoot":"","sources":["../../src/smoothing/ExponentialSmoothing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,wCAAwC;AACxC,MAAM,OAAO,oBAAoB;IAC/B;QACE,sBAAsB;IACxB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,EAAY,EAAE,KAAa;QACvC,MAAM,EAAE,GAAa,EAAE,CAAC;QAExB,KAAK,IAAI,CAAC,GAAG,CAA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