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

Adding in Y24 #228

Merged
merged 3 commits into from
Aug 16, 2024
Merged

Adding in Y24 #228

merged 3 commits into from
Aug 16, 2024

Conversation

karllark
Copy link
Owner

Add in Ysard et al. (2024) grain model curve.

Closes #223.

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.89%. Comparing base (a1cae59) to head (647cda8).
Report is 38 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #228   +/-   ##
=======================================
  Coverage   99.89%   99.89%           
=======================================
  Files           8        8           
  Lines         919      935   +16     
=======================================
+ Hits          918      934   +16     
  Misses          1        1           

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

Copy link

@mdecleir mdecleir 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!
Just one comment, as we discussed before, you need to make sure all models have a different color. I often use matplotlib's tab20 color map (https://matplotlib.org/stable/users/explain/colors/colormaps.html) if I need more than 10 colors.


class Y24(BaseExtGrainModel):
r"""
Ysard et al. (2024) Grain Model

Choose a reason for hiding this comment

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

Might be worth mentioning that this is THEMIS 2.0, to avoid confusion in the future.

@karllark
Copy link
Owner Author

Looks good! Just one comment, as we discussed before, you need to make sure all models have a different color. I often use matplotlib's tab20 color map (https://matplotlib.org/stable/users/explain/colors/colormaps.html) if I need more than 10 colors.

Can you share how you do this?

@mdecleir
Copy link

mdecleir commented Aug 16, 2024

Yes, first you create a color map:

colors = plt.get_cmap("tab20")

Then, you can use that map in your for loop, and loop through the 20 colors in that colormap with the modulo operator:

for i,model in enumerate(models): plt.plot(model[x],model[y],color=colors(i%20))

I believe "tab10" is the default that matplotlib uses if you do not specify the color, but if you have more than 10 models, you will run out of colors. "tab20" gives you 20 colors, so will last a little longer, at least until we have 20 extinction models ;)

@karllark
Copy link
Owner Author

Updated based on comments.

@karllark karllark merged commit d0d94cf into master Aug 16, 2024
31 checks passed
@karllark karllark deleted the add_y24 branch August 16, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New THEMIS grain model
2 participants