Skip to content
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

Add fit_aimpoint notebook for 2025-03 #30

Merged
merged 6 commits into from
Mar 20, 2025
Merged
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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Chandra aimpoint monitor

This repo has content related to monitoring and correcting for the drift of
the Chandra observing aimpoint related to the temperature-driven alignment
changes of the ACA.

The key elements in this repo are:

- `aimpoint_mon` package which provides tools to monitor the aimpoint drift
on a daily basis and update a web page which gets reviewed by the SS&AWG.
- `fit_aimpoint_drift_*.ipynb` notebooks which are used to fit discrete jumps
in the aimpoint following a prolonged dwell at hot temperature (typically
normal sun).
- Scripts and notebooks that were used in the analysis of aimpoint offsets
and development of the production tools used to implement dynamical aimpoint
offsets.
- `update_characteristics.py` script that was used for an interim period to
generate a modified version of the OFLS characteristics file. This was used
to remove ACA alignment drift from the target X-ray aimpoint.
2 changes: 1 addition & 1 deletion aimpoint_mon/plot_aimpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

def get_opt(args=None):
parser = argparse.ArgumentParser(
description="Plot aimpoint drift data " "from aspect solution files"
description="Plot aimpoint drift data from aspect solution files"
)
parser.add_argument(
"--start", default="2000:001", help="Processing start date (default=2000:001)"
Expand Down
2 changes: 1 addition & 1 deletion aimpoint_mon/update_aimpoint_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

def get_opt():
parser = argparse.ArgumentParser(
description="Get aimpoint drift data " "from aspect solution files"
description="Get aimpoint drift data from aspect solution files"
)
parser.add_argument(
"--data-root", default=".", help="Root directory for asol and index files"
Expand Down
3 changes: 2 additions & 1 deletion aimpoint_mon/update_observed_aimpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
offset from the planned value. This also makes a plot (default 6-months of data) for
inspection.
"""

import argparse
import functools
import glob
Expand Down Expand Up @@ -73,7 +74,7 @@ class NoObsidError(ValueError):

def get_opt(args=None):
parser = argparse.ArgumentParser(
description="Plot aimpoint drift data " "from aspect solution files"
description="Plot aimpoint drift data from aspect solution files"
)
parser.add_argument("--start", help="Processing start date (default=NOW - 14 days)")
parser.add_argument("--stop", help="Processing stop date (default=NOW)")
Expand Down
1,682 changes: 1,682 additions & 0 deletions fit_aimpoint_drift-2025-03.ipynb

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions pyrightconfig.json

This file was deleted.

61 changes: 61 additions & 0 deletions ruff-base.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
target-version = "py312"

# fix = true
lint.unfixable = []

lint.select = [
"I", # isort
"F", # pyflakes
"E", "W", # pycodestyle
"YTT", # flake8-2020
"B", # flake8-bugbear
"Q", # flake8-quotes
"T10", # flake8-debugger
"INT", # flake8-gettext
"PLC", "PLE", "PLR", "PLW", # pylint
"PIE", # misc lints
"PYI", # flake8-pyi
"TID", # tidy imports
"ISC", # implicit string concatenation
"TCH", # type-checking imports
"C4", # comprehensions
"PGH" # pygrep-hooks
]

# Some additional rules that are useful
lint.extend-select = [
"UP009", # UTF-8 encoding declaration is unnecessary
"SIM118", # Use `key in dict` instead of `key in dict.keys()`
"D205", # One blank line required between summary line and description
"ARG001", # Unused function argument
"RSE102", # Unnecessary parentheses on raised exception
"PERF401", # Use a list comprehension to create a transformed list
"S101", # Use of `assert` detected
]

lint.ignore = [
"ISC001", # Disable this for compatibility with ruff format
"E402", # module level import not at top of file
"E731", # do not assign a lambda expression, use a def
"PLR2004", # Magic number
"B028", # No explicit `stacklevel` keyword argument found
"PLR0913", # Too many arguments to function call
"PLR1730", # Checks for if statements that can be replaced with min() or max() calls
]

extend-exclude = [
"docs",
"build",
]

[lint.pycodestyle]
max-line-length = 100 # E501 reports lines that exceed the length of 100.

[lint.extend-per-file-ignores]
"__init__.py" = ["E402", "F401", "F403"]
# For tests:
# - D205: Don't worry about test docstrings
# - ARG001: Unused function argument false positives for some fixtures
# - E501: Line-too-long
# - S101: Do not use assert
"**/tests/test_*.py" = ["D205", "ARG001", "E501", "S101"]
103 changes: 32 additions & 71 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,80 +1,41 @@
# Copied originally from pandas. This config requires ruff >= 0.2.
target-version = "py310"

# fix = true
lint.unfixable = []

lint.select = [
"I", # isort
"F", # pyflakes
"E", "W", # pycodestyle
"YTT", # flake8-2020
"B", # flake8-bugbear
"Q", # flake8-quotes
"T10", # flake8-debugger
"INT", # flake8-gettext
"PLC", "PLE", "PLR", "PLW", # pylint
"PIE", # misc lints
"PYI", # flake8-pyi
"TID", # tidy imports
"ISC", # implicit string concatenation
"TCH", # type-checking imports
"C4", # comprehensions
"PGH" # pygrep-hooks
]

# Some additional rules that are useful
lint.extend-select = [
"UP009", # UTF-8 encoding declaration is unnecessary
"SIM118", # Use `key in dict` instead of `key in dict.keys()`
"D205", # One blank line required between summary line and description
"ARG001", # Unused function argument
"RSE102", # Unnecessary parentheses on raised exception
"PERF401", # Use a list comprehension to create a transformed list
]

lint.ignore = [
"ISC001", # Disable this for compatibility with ruff format
"B028", # No explicit `stacklevel` keyword argument found
"B905", # `zip()` without an explicit `strict=` parameter
"E402", # module level import not at top of file
"E731", # do not assign a lambda expression, use a def
"PLC1901", # compare-to-empty-string
"PLR0911", # Too many returns
"PLR0912", # Too many branches
"PLR0913", # Too many arguments to function call
"PLR0915", # Too many statements
"PLR2004", # Magic number
]

# TODO : fix these and stop ignoring. Commented out ones are common and OK to except.
lint.extend-ignore = [
"PGH004", # Use specific rule codes when using `noqa`
"D205",
"PLW0603",
# "C401", # Unnecessary generator (rewrite as a `set` comprehension)
# "C402", # Unnecessary generator (rewrite as a dict comprehension)
# "C405", # Unnecessary `list` literal (rewrite as a `set` literal)
# "C408", # Unnecessary `dict` call (rewrite as a literal)
# "C416", # Unnecessary `dict` comprehension (rewrite using `dict()`)
# "G010", # warn is deprecated in favor of warning
# "PYI056", # Calling `.append()` on `__all__` may not be supported by all type checkers
]
extend = "ruff-base.toml"

# These are files to exclude for this project.
extend-exclude = [
# "**/*.ipynb", # commonly not ruff-compliant
"docs",
"update_characteristics.py",
"calc_si_align.py",
"derive_via_ofls_eqns.py",
"pog_absolute_pointing.py",
"absolute_pointing_uncertainty.ipynb",
"aimpoint_jumps.ipynb",
"asol_to_chip_transforms.ipynb",
"testing/**/*.ipynb",
"fit_aimpoint_drift.ipynb",
"fit_aimpoint_drift-2018-11.ipynb",
"fit_aimpoint_drift-2021-01.ipynb",
"fit_aimpoint_drift-2021-03.ipynb",
"fit_aimpoint_drift-2022-11.ipynb",
]

[lint.pycodestyle]
max-line-length = 100 # E501 reports lines that exceed the length of 100.

[lint.extend-per-file-ignores]
"__init__.py" = ["E402", "F401", "F403"]
# For tests:
# - D205: Don't worry about test docstrings
# - ARG001: Unused function argument false positives for some fixtures
"**/tests/test_*.py" = ["D205", "ARG001"]
# These are rules that commonly cause many ruff warnings. Code will be improved by
# incrementally fixing code to adhere to these rules, but for practical purposes they
# can be ignored by uncommenting each one. You can also add to this list as needed.
lint.extend-ignore = [
"B905", # `zip()` without an explicit `strict=` parameter
# "PLC1901", # compare-to-empty-string
# "PLR0911", # Too many returns
# "PLR0912", # Too many branches
"PLW0603", # Global statement
"D205", # Missing blank line after summary
"PLR0915", # Too many statements
# "PGH004", # Use specific rule codes when using `noqa`
# "C401", # Unnecessary generator (rewrite as a `set` comprehension)
# "C402", # Unnecessary generator (rewrite as a dict comprehension)
# "C405", # Unnecessary `list` literal (rewrite as a `set` literal)
# "C408", # Unnecessary `dict` call (rewrite as a literal)
# "C416", # Unnecessary `dict` comprehension (rewrite using `dict()`)
# "G010", # warn is deprecated in favor of warning
# "PYI056", # Calling `.append()` on `__all__` may not be supported by all type checkers
]