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

Implemented Model Reader for CMFGen example (Also refactored Stella Reader) #2349

Merged
merged 6 commits into from
Mar 22, 2024

Conversation

xansh
Copy link
Member

@xansh xansh commented Jul 8, 2023

📝 Description

Type: 🚀 feature

Created a simple Model reader for CFMGen files, which segregates the input into data and metadata. Also refactored Stella Reader from #2327 .

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@xansh xansh self-assigned this Jul 8, 2023
@xansh xansh force-pushed the stella-cmfgen-reader branch from ced4d01 to d4b4cd8 Compare July 8, 2023 03:17
@andrewfullard andrewfullard enabled auto-merge (squash) July 11, 2023 13:21
raise ValueError(
'"mass of cell" is required in the Stella input file to infer columns'
)
elif i + 1 == DATA_START_ROW:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you checking i+1 in a loop? Won't the loop reach i+1 in the next iteration anyway?

@@ -74,7 +75,7 @@ def read_stella_model(fname):
data = pd.read_csv(
fname,
delim_whitespace=True,
skiprows=DATA_START_ROW,
skiprows=DATA_START_ROW + 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that DATA_START_ROW should start with +1 to begin with?

Copy link
Member

Choose a reason for hiding this comment

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

what's with this?

header_re_match = header_re[i].match(line)

metadata[HEADER_RE_STR[i][1]] = header_re_match.group(1)
elif i + 1 == DATA_START_ROW:
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment on Stella parser

data = pd.read_csv(
fname,
delim_whitespace=True,
skiprows=DATA_START_ROW + 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment on Stella parser

Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid, looking at the code, I think this has to be this way, or somewhere there has to be a +1 or -1. But I've eliminated this from other places. Perhaps because there are empty lines between sections.

@andrewfullard
Copy link
Contributor

@wkerzendorf this should be reviewed and merged alongside the work you have been doing I think

@andrewfullard
Copy link
Contributor

@atharva-2001 needs the stella changes removed and comments addressed (ideally). Tests would also be great.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 96.72131% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 68.18%. Comparing base (f515d16) to head (21a5772).
Report is 3 commits behind head on master.

Files Patch % Lines
tardis/io/model/cmfgen.py 97.43% 1 Missing ⚠️
tardis/io/model/readers/stella.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2349      +/-   ##
==========================================
- Coverage   68.73%   68.18%   -0.56%     
==========================================
  Files         165      168       +3     
  Lines       14001    14216     +215     
==========================================
+ Hits         9624     9693      +69     
- Misses       4377     4523     +146     

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

@atharva-2001 atharva-2001 force-pushed the stella-cmfgen-reader branch 2 times, most recently from 320858b to fdb51b8 Compare March 12, 2024 05:29
@wkerzendorf wkerzendorf disabled auto-merge March 22, 2024 14:46
@wkerzendorf wkerzendorf merged commit 1718002 into tardis-sn:master Mar 22, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants