Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Plio
Commits
03d046cd
Commit
03d046cd
authored
5 years ago
by
Jesse Mapel
Committed by
Jesse Mapel
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixed covariance clalculations
parent
592d0cf7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
plio/utils/covariance.py
+9
-5
9 additions, 5 deletions
plio/utils/covariance.py
plio/utils/tests/test_covariance.py
+4
-4
4 additions, 4 deletions
plio/utils/tests/test_covariance.py
with
13 additions
and
9 deletions
plio/utils/covariance.py
+
9
−
5
View file @
03d046cd
import
numpy
as
np
import
math
def
compute_covariance
(
lat
,
lon
,
rad
,
latsigma
=
10.
,
lonsigma
=
10.
,
radsigma
=
15.
,
semimajor_axis
=
1737400.0
):
def
compute_covariance
(
lat
,
lon
,
rad
,
latsigma
=
10.
,
lonsigma
=
10.
,
radsigma
=
15.
,
semimajor_axis
=
None
):
"""
Given geospatial coordinates, desired accuracy sigmas, and an equitorial radius, compute a 2x3
sigma covariange matrix.
...
...
@@ -27,7 +27,8 @@ def compute_covariance(lat, lon, rad, latsigma=10., lonsigma=10., radsigma=15.,
The desired radius accuracy in meters (Defualt: 15.0)
semimajor_axis : float
The semi-major or equitorial radius in meters (Default: 1737400.0 - Moon)
The semi-major or equitorial radius in meters. If not entered,
the local radius will be used.
Returns
-------
...
...
@@ -38,11 +39,14 @@ def compute_covariance(lat, lon, rad, latsigma=10., lonsigma=10., radsigma=15.,
lat
=
math
.
radians
(
lat
)
lon
=
math
.
radians
(
lon
)
if
semimajor_axis
is
None
:
semimajor_axis
=
rad
# SetSphericalSigmasDistance
scaled_lat_sigma
=
latsigma
/
semimajor_axis
# This is specific to each lon.
scaled_lon_sigma
=
lonsigma
*
math
.
cos
(
lat
)
/
semimajor_axis
scaled_lon_sigma
=
lonsigma
/
(
math
.
cos
(
lat
)
*
semimajor_axis
)
# SetSphericalSigmas
cov
=
np
.
eye
(
3
,
3
)
...
...
This diff is collapsed.
Click to expand it.
plio/utils/tests/test_covariance.py
+
4
−
4
View file @
03d046cd
...
...
@@ -14,6 +14,6 @@ def test_compute_covariance():
sigmarad
=
25.0
semimajor_rad
=
1737400.0
cov
=
covariance
.
compute_covariance
(
lat
,
lon
,
rad
,
sigmalat
,
sigmalon
,
sigmarad
,
semimajor_rad
)
expected
=
np
.
array
([[
132.97888775695
,
-
111.55453178747
,
-
20.08405416233
],
[
93.588991760138
,
16.848822261184
,
623.27512692323
]])
expected
=
np
.
array
([[
225.85120968
,
-
0.84930178
,
-
20.08405416233
],
[
225.55132129
,
16.848822261184
,
623.27512692323
]])
np
.
testing
.
assert_almost_equal
(
cov
,
expected
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment