Eureka
Eureka copied to clipboard
Adding stage-specific MetaClass objects and organizing default ECF values
This draft PR introduces the S1MetaClass
which is a child of the original readECF.MetaClass
object.
This new class holds Stage 1 specific defaults for different instruments. This will allow for cleaner ECFs where values can be left at their defaults without specifying them in the ECF. For cases where a value is must be specified because there is no safe default value, an AttributeError
will be raised (if desired, I can catch those exceptions and re-raise them with an explicit reminder to set those variables in their ECF). I also only raise these exceptions when I must (e.g., only require the specification of superbias_file
if custom_bias
is True).
This new addition will also allow for cleaner code with fewer instances of if hasattr(meta, ...)
scattered throughout the code. I make frequent use of getattr
within this new class which allows attributes to be set to a default value if the value hasn't been previously set while minimizing the lines of code. As I continue on to additional stages, I will move any default values scattered throughout the code to their stage-specific MetaClass
which will further tidy the code. This will also make maintenance and backwards compatibility easier as new ECF settings can just have their defaults specified in a single, stage-specific location.
I'd like @kevin218's feedback (just a quick "Format looks fine, please continue", or "I don't like this format, let's discuss") at this stage before I work through all six stages to check that you're happy with the overall format in which I'm writing these classes. I know I'm not flake8 compliant right now, I'll fix that before I mark the PR as ready for review.
Codecov Report
Attention: Patch coverage is 68.73479%
with 257 lines
in your changes missing coverage. Please review.
Project coverage is 54.81%. Comparing base (
56973c1
) to head (f36a8bb
).
Additional details and impacted files
@@ Coverage Diff @@
## main #632 +/- ##
==========================================
+ Coverage 53.95% 54.81% +0.85%
==========================================
Files 101 107 +6
Lines 12953 13336 +383
==========================================
+ Hits 6989 7310 +321
- Misses 5964 6026 +62
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm going to approve and merge Aarynn's PR now, so I'm reminding myself here that I will need to move the non-Eureka defaults from the following lines https://github.com/kevin218/Eureka/blob/ab7a32aaa2b0f18221fa42e478e1f1c19997b8b1/src/eureka/S4_generate_lightcurves/s4_genLC.py#L107-L139 to the S4MetaClass
Alright, that tweak after Aarynn's PR is now taken care of and this PR is ready for review again
As a general comment, I think we can pare down the S1 and S2 templates by removing many of the skip_pipeline_step keywords that never change.
Alright @kevin218, all comments have either been responded to above or have been addressed and resolved
@kevin218, all comments aside from https://github.com/kevin218/Eureka/pull/632#discussion_r1660427023 (in response to my comment that bg_disp
(now called bg_row_by_row
), bg_dir
, and isrotate
all seem to control the same thing) have now been addressed. Do you want to tackle that comment with this PR - if not, I can open a new issue based on that comment to make sure we remember to look into it
@kevin218, all comments aside from #632 (comment) (in response to my comment that
bg_disp
(now calledbg_row_by_row
),bg_dir
, andisrotate
all seem to control the same thing) have now been addressed. Do you want to tackle that comment with this PR - if not, I can open a new issue based on that comment to make sure we remember to look into it
@taylorbell57 Let's open an issue.