8000 Periscope drift refactor by javierggt · Pull Request #13 · sot/ska_trend · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Periscope drift refactor #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.eggs
.vscode
__pycache__
8 changes: 0 additions & 8 deletions pyrightconfig.json

This file was deleted.

9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"console_scripts": [
"ska_trend_wrong_box_updates=ska_trend.wrong_box_anom.wrong_box_anom:main",
"ska_trend_bad_periscope=ska_trend.bad_periscope_gradient.periscope_update:main",
"ska_trend_periscope_drift=ska_trend.periscope_drift.scripts.periscope_drift_reports:main",
]
}

Expand All @@ -26,12 +27,18 @@
"ska_trend",
"ska_trend.wrong_box_anom",
"ska_trend.bad_periscope_gradient",
"ska_trend.periscope_drift",
"ska_trend.periscope_drift.scripts",
],
package_data={
"ska_trend": [
"wrong_box_anom/index_template.html",
"wrong_box_anom/task_schedule.cfg",
"bad_periscope_gradient/task_schedule.cfg",
]
],
"ska_trend.periscope_drift": [
"task_schedule.cfg",
"templates/periscope_drift/index.html",
],
},
)
Empty file.
59 changes: 59 additions & 0 deletions ska_trend/periscope_drift/correction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
Periscope Drift Correction

This module contains the function and constants used to correct the periscope drift.
"""

import numpy as np
import scipy

__all__ = [
"GRADIENTS",
"get_expected_correction",
]

< ACF8 /td> GRADIENTS = {
"OOBAGRD3": {
"yag": 6.98145650e-04,
"zag": 9.51578351e-05,
},
"OOBAGRD6": {
"yag": -1.67009240e-03,
"zag": -2.79084775e-03,
},
}


def get_expected_correction(telem):
"""
Calculate the expected periscope drift correction.

Parameters
----------
telem : dict
Dictionary containing the telemetry data.
Required keys are "OOBAGRD3" and "OOBAGRD6".
"""
corr = {
"ang_y_corr": np.zeros_like(telem["OOBAGRD6"]),
"ang_z_corr": np.zeros_like(telem["OOBAGRD6"]),
}

msids = [key for key in telem if key != "time"]
for msid in msids:
if msid not in GRADIENTS:
continue
mean_gradient = np.mean(telem[msid])
corr["ang_y_corr"] -= (telem[msid] - mean_gradient) * GRADIENTS[msid]["yag"]
corr["ang_z_corr"] -= (telem[msid] - mean_gradient) * GRADIENTS[msid]["zag"]

corr["ang_y_corr"] *= 3600
corr["ang_z_corr"] *= 3600

covariance = np.cov([telem["OOBAGRD3"], telem["OOBAGRD6"]])
eig_vals, eig_vec = scipy.linalg.eig(covariance)
vec = eig_vec[:, np.argmax(eig_vals)]
corr_angle = np.arctan2(vec[1], vec[0])
corr["OOBAGRD_corr_angle"] = corr_angle

return corr
Loading
Loading
0