Skip to content
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
9 changes: 6 additions & 3 deletions aperoll/proseco_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def run_proseco(self):
"review_table": aca_review,
}
except Exception as exc:
logger.debug(f"ProsecoData failed calling proseco ({type(exc).__name__}): {exc}")
logger.debug(
f"ProsecoData failed calling proseco ({type(exc).__name__}): {exc}"
)
trace = traceback.extract_tb(exc.__traceback__)
for step in trace:
logger.debug(f" in {step.filename}:{step.lineno}/{step.name}:")
Expand All @@ -167,14 +169,15 @@ def run_sparkles(self):
)
return self._dir / "sparkles"
except Exception as exc:
logger.debug(f"ProsecoData failed calling sparkles ({type(exc).__name__}): {exc}")
logger.debug(
f"ProsecoData failed calling sparkles ({type(exc).__name__}): {exc}"
)
trace = traceback.extract_tb(exc.__traceback__)
for step in trace:
logger.debug(f" in {step.filename}:{step.lineno}/{step.name}:")
logger.debug(f" {step.line}")
raise Exception(f"ProsecoData failed calling sparkles: {exc}") from None


def open_export_proseco_dialog(self):
"""
Save the star catalog in a pickle file.
Expand Down
31 changes: 28 additions & 3 deletions aperoll/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

import maude
import numpy as np
from chandra_aca.drift import get_aca_offsets
from chandra_aca.transform import (
calc_aca_from_targ,
pixels_to_yagzag,
yagzag_to_pixels,
)
Expand Down Expand Up @@ -190,9 +192,32 @@ def get_parameters_from_yoshi(filename, obsid=None):
yoshi_params = contents[0] # assuming there is only one entry

yoshi_params["date"] = yoshi_params["obs_date"]
yoshi_params["ra"] = yoshi_params["ra_targ"]
yoshi_params["dec"] = yoshi_params["dec_targ"]
yoshi_params["roll"] = yoshi_params["roll_targ"]

# ra/dec/roll in yoshi files are the target atttitude,
# so need to transform to ACA attitude
aca_offset_y, aca_offset_z = get_aca_offsets(
yoshi_params["detector"],
yoshi_params["chip_id"],
yoshi_params["chipx"],
yoshi_params["chipy"],
yoshi_params["obs_date"],
-2.5,
)

aca_att = calc_aca_from_targ(
[
yoshi_params["ra_targ"],
yoshi_params["dec_targ"],
yoshi_params["roll_targ"],
],
y_off=yoshi_params["offset_y"] / 60 + aca_offset_y / 3600,
z_off=yoshi_params["offset_z"] / 60 + aca_offset_z / 3600,
)

yoshi_params["ra"], yoshi_params["dec"], yoshi_params["roll"] = (
aca_att.equatorial
)

yoshi_params["instrument"] = yoshi_params["detector"]
for key in [
"obs_date",
Expand Down
5 changes: 1 addition & 4 deletions aperoll/widgets/attitude_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,7 @@ def _set_attitude(self, attitude, emit=True):
if emit:
self.attitude_cleared.emit()
return
if (
not isinstance(attitude, Quat)
and len(attitude) == 4
):
if not isinstance(attitude, Quat) and len(attitude) == 4:
attitude = normalize(attitude)
# this check is to break infinite recursion because in the connections
q1 = None if attitude is None else Quat(attitude).q
Expand Down
1 change: 1 addition & 0 deletions aperoll/widgets/star_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ def set_centroids(self, centroids):
def include_slot(self, slot, include):
self.view.include_slot(slot, include)


def main():
from aperoll.utils import get_default_parameters

Expand Down
10 changes: 7 additions & 3 deletions ruff-base.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copied originally from pandas. This config requires ruff >= 0.2.
target-version = "py311"
target-version = "py312"

# fix = true
lint.unfixable = []
Expand Down Expand Up @@ -31,6 +30,7 @@ lint.extend-select = [
"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 = [
Expand All @@ -41,10 +41,13 @@ lint.ignore = [
"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
"PLC0415", # `import` should be at the top-level of a file
"PLW1641", # Class implements `__hash__` if `__eq__` is implemented
]

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

[lint.pycodestyle]
Expand All @@ -56,4 +59,5 @@ max-line-length = 100 # E501 reports lines that exceed the length of 100.
# - D205: Don't worry about test docstrings
# - ARG001: Unused function argument false positives for some fixtures
# - E501: Line-too-long
"**/tests/test_*.py" = ["D205", "ARG001", "E501"]
# - S101: Do not use assert
"**/tests/test_*.py" = ["D205", "ARG001", "E501", "S101"]