Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

Adding stage-specific MetaClass objects and organizing default ECF values

Open taylorbell57 opened this issue 11 months ago • 5 comments

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.

taylorbell57 avatar Mar 06 '24 02:03 taylorbell57

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).

Files Patch % Lines
src/eureka/S1_detector_processing/s1_meta.py 6.00% 94 Missing :warning:
src/eureka/S4_generate_lightcurves/s4_meta.py 70.93% 25 Missing :warning:
src/eureka/S3_data_reduction/s3_meta.py 86.27% 21 Missing :warning:
src/eureka/S1_detector_processing/s1_process.py 4.76% 20 Missing :warning:
src/eureka/S4_generate_lightcurves/generate_LD.py 0.00% 13 Missing :warning:
src/eureka/S6_planet_spectra/s6_meta.py 76.92% 12 Missing :warning:
src/eureka/S3_data_reduction/miri.py 28.57% 10 Missing :warning:
src/eureka/S3_data_reduction/wfc3.py 65.38% 9 Missing :warning:
src/eureka/S2_calibrations/s2_calibrate.py 78.12% 7 Missing :warning:
src/eureka/S1_detector_processing/ramp_fitting.py 0.00% 6 Missing :warning:
... and 15 more
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.

codecov[bot] avatar Mar 06 '24 18:03 codecov[bot]

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

taylorbell57 avatar Jun 17 '24 18:06 taylorbell57

Alright, that tweak after Aarynn's PR is now taken care of and this PR is ready for review again

taylorbell57 avatar Jun 17 '24 23:06 taylorbell57

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.

kevin218 avatar Jul 03 '24 20:07 kevin218

Alright @kevin218, all comments have either been responded to above or have been addressed and resolved

taylorbell57 avatar Jul 10 '24 20:07 taylorbell57

@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

taylorbell57 avatar Aug 01 '24 18:08 taylorbell57

@kevin218, all comments aside from #632 (comment) (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

@taylorbell57 Let's open an issue.

kevin218 avatar Aug 01 '24 19:08 kevin218