Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Cache Data
run: |
ASPIREDIR=${{ env.WORK_DIR }} python -c \
"import aspire; print(aspire.config['common']['cache_dir']); aspire.downloader.emdb_2660()"
"import aspire; print(aspire.config['common']['cache_dir']); import aspire.downloader; aspire.downloader.emdb_2660()"
- name: Cleanup
run: rm -rf ${{ env.WORK_DIR }}

Expand Down
14 changes: 12 additions & 2 deletions src/aspire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,18 @@

sys.excepthook = handle_exception

# Collect set of all module names in package
_modules = set(item[1] for item in pkgutil.iter_modules(aspire.__path__))

# Automatically add modules
__all__ = []
for _, modname, _ in pkgutil.iter_modules(aspire.__path__):
for modname in _modules:
__all__.append(modname) # Add module to __all_
importlib.import_module(f"aspire.{modname}") # Import the module


# Dynamically load and return attributes
def __getattr__(attr):
if attr in _modules:
return importlib.import_module(f"aspire.{attr}")
else:
raise AttributeError(f"module `{__name__}` has no attribute `{attr}`.")
4 changes: 3 additions & 1 deletion src/aspire/utils/bot_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from numpy.linalg import norm
from scipy.optimize import minimize

from aspire.operators import wemd_embed
from aspire.utils.rotation import Rotation

# Store parameters specific to each loss_type.
Expand Down Expand Up @@ -64,6 +63,9 @@ def align_BO(
Default `None` infers dtype from `vol_ref`.
:return: Rotation matrix R_init (without refinement) or (R_init, R_est) (with refinement).
"""
# Avoid utils/operators/utils circular import
from aspire.operators import wemd_embed

# Infer dtype
dtype = np.dtype(dtype or vol_ref.dtype)

Expand Down