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

Include subclasses in sidereal container map #298

Merged
merged 1 commit into from
Nov 5, 2024
Merged
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
15 changes: 14 additions & 1 deletion draco/analysis/sidereal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
:class:`SiderealStacker` if you want to combine the different days.
"""

import inspect

import numpy as np
import scipy.linalg as la
from caput import config, mpiarray, tod
Expand Down Expand Up @@ -520,7 +522,18 @@ def process(self, data):
containers.HybridVisStream: containers.HybridVisStream,
}

OutputContainer = container_map[data.__class__]
# We need to be able to check for subclasses in the container map
for cls in inspect.getmro(data.__class__):
OutputContainer = container_map.get(cls)

if OutputContainer is not None:
break

if OutputContainer is None:
raise TypeError(
f"No valid container mapping.\nGot {data.__class__}.\n"
f"Mappings exist for {list(container_map.keys())}."
)

# Redistribute if needed too
data.redistribute("freq")
Expand Down