karllark / dust_extinction

Astronomical Dust Extinction
http://dust-extinction.readthedocs.io
BSD 3-Clause "New" or "Revised" License
37 stars 23 forks source link

Adding in Y24 #228

Closed karllark closed 1 month ago

karllark commented 1 month ago

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

Closes #223.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

karllark commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Updated based on comments.