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

Rename DetectorArray ➡️ DetectorManager plus Docstrings and Refactoring #423

Merged
merged 7 commits into from
Jun 28, 2024

Conversation

teutoburg
Copy link
Contributor

@teutoburg teutoburg commented May 31, 2024

Rename class DetectorArray ➡️ DetectorManager and all corresponding file names.
Also rename variable names like detector_arrays ➡️ detector_managers and react to changes in test modules.

Rationale

I always found the existence of both DetectorList and DetectorArray quite confusing. The now-renamed class acts in a somewhat comparable way to the FOVManager and OpticsManager classes, thus I found it fitting to apply this naming convention also to this class.

This was done after brief discussion with @astronomyk a few weeks ago, now rebased and finalized.

Consequences

There are two occurrences in IRDB package tests where this change will need to be incorporated to avoid breaking those tests. Other than that, the things changed here are rather internal, so unlikely to break any existing scripts.

Other Changes along the Way

  • Some refactoring while already here.
  • Added some more documentation along the way, clarifying which "detector" class does what.
  • Make functions and attribute private that are not currently used outside the class anyway.

Version Change?

This (and other things coming soon) might be considered worth of a minor version bump (aka v0.9.0).

Copy link

codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 82.27848% with 14 lines in your changes missing coverage. Please review.

Project coverage is 75.32%. Comparing base (f798375) to head (b519aed).

Files Patch % Lines
scopesim/detector/detector_manager.py 83.87% 10 Missing ⚠️
scopesim/optics/optical_train.py 57.14% 3 Missing ⚠️
scopesim/detector/detector.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #423   +/-   ##
=======================================
  Coverage   75.32%   75.32%           
=======================================
  Files          56       56           
  Lines        7810     7823   +13     
=======================================
+ Hits         5883     5893   +10     
- Misses       1927     1930    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@teutoburg teutoburg self-assigned this May 31, 2024
@teutoburg teutoburg added the refactor Implementation improvement label May 31, 2024
@teutoburg teutoburg changed the title Fh/detectorcleanup Rename DetectorArray ➡️ DetectorManager plus Docstrings and Refactoring May 31, 2024
@teutoburg teutoburg marked this pull request as ready for review June 27, 2024 22:41
Also in all corresponding file names.
Also in variable names like detector_arrays -> detector_managers

Rationale: I always found the existance of both DetectorList and
DetectorArray quite confusing. The now-renamed class acts in a somewhat
comparable way to the FOVManager or OpticsManager, thus I found it fitting
to apply this naming convention also to this class.

There are two occurences in IRDB package tests where this change will need
to be incorporated to avoid breaking those tests.

Also, some refactoring

Make functions and attribute private that are not currently used outside
the class anyway.
Copy link
Collaborator

@hugobuddel hugobuddel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

I'm wondering, should we do the initialization of ._detectors earlier? Now they are only available after .readout() is called.

scopesim/detector/detector.py Outdated Show resolved Hide resolved
Co-authored-by: Hugo Buddelmeijer <hugo@buddelmeijer.nl>
@teutoburg
Copy link
Contributor Author

I'm wondering, should we do the initialization of ._detectors earlier? Now they are only available after .readout() is called.

Hmm, perhaps not a bad idea. I'll include that if it doesn't break anything (which would surprise me but I've been surprised many times by this codebase).

Had to catch the case where detector_list isn't passed, which happens in testing. Figured a warning wouldn't hurt, as this case shouldn't occur in regular operation.
@teutoburg teutoburg merged commit 91957f3 into main Jun 28, 2024
25 checks passed
@teutoburg teutoburg deleted the fh/detectorcleanup branch June 28, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Implementation improvement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants