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

refactoring of harmonic model code to apply as ufunc on xarray #206

Merged

Conversation

snath-xoc
Copy link
Contributor

@snath-xoc snath-xoc commented Sep 19, 2022

Thanks for the initial changes, I accepted them, I will get to the rest of your points on the list by Friday. As for strictness, as long as it's constructive I'm willing to learn (I'm definitely a beginner right now so no worries). I may need to read up over the linting stuff as well.

Copy link
Member

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Nice - thanks! I left some initial comments. Can you:

  • address those comments (see below)
  • remove the empty untitled file
  • run the linting (code auto-formatting) tools over your code (you may have to install them first)
    • isort .
    • black .
    • flake8 . (you may have to fix some stuff for this to run cleanly)
  • let me know how strict I should be with my review

To address my comments you can either commit them online ("add suggestion to batch" -> "commit suggestions") and then you need to git pull origin refactor_mesmer_m_harmonic_model so that you have the changes available locally. OR you can just address them manually on your laptop, create a new commit and then git push origin refactor_mesmer_m_harmonic_model.

Let me know if you need support!

mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
fit_to_bic_np,
X,
Y,
input_core_dims=[["time"],["time"]],
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice not to hard-code the dimension name here. See e.g.

def lowess(data, dim, *, frac, use_coords_as_x=False, it=0):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah O.K. will keep this in mind

mesmer_m/tests_harmonic_model.py Outdated Show resolved Hide resolved
@snath-xoc snath-xoc force-pushed the refactor_mesmer_m_harmonic_model branch from 79f91a0 to 85b3a5d Compare July 13, 2023 14:10
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (9b0b76b) to head (a9d948e).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #206      +/-   ##
==========================================
+ Coverage   87.90%   88.00%   +0.09%     
==========================================
  Files          40       40              
  Lines        1745     1750       +5     
==========================================
+ Hits         1534     1540       +6     
+ Misses        211      210       -1     
Flag Coverage Δ
unittests 88.00% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Looks good - some first comments.

mesmer_m/tests_harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/tests_harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved
mesmer_m/harmonic_model.py Outdated Show resolved Hide resolved

bic_score[i_n - 1] = calculate_bic(len(y), i_n, mse)

n_sel = np.argwhere(bic_score == bic_score.min())[0][0] + 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
n_sel = np.argwhere(bic_score == bic_score.min())[0][0] + 1
n_sel = np.argmin(bic_score) + 1

Copy link
Member

@mathause mathause left a comment

Choose a reason for hiding this comment

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

@veni-vidi-vici-dormivi

I reverted my changes and opened #410. I think we can merge this now.

@mathause mathause merged commit b29610b into MESMER-group:main Mar 4, 2024
7 checks passed
@mathause mathause mentioned this pull request Mar 4, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants