Skip to content

Adds Magnetite trace element classification and discriminant diagram - #129

Merged
morganjwilliams merged 4 commits into
morganjwilliams:developfrom
jarrod-burges:main
Nov 13, 2026
Merged

morganjwilliams merged 4 commits into
morganjwilliams:developfrom
jarrod-burges:main

Conversation

@jarrod-burges

Copy link
Copy Markdown

Description

Adds the feature requested in #106, creates "Ca + Al + Mn vs Ti + V" and "Ni/(Cr + Mn) vs Ti + V" plots. Pyrolite did not have a log-log plot, so that was added.

Related Issue

Related issue #106

Motivation and Context

This solves analyzing and plotting magnetite trace element data for ore geology studies.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
image image image

@morganjwilliams

Copy link
Copy Markdown
Owner

Thanks for putting this through, @jarrod-burges! Away from the desk at the moment but will have a read through in the next day or two. Also appreciate that you've followed the style of what was there already, should make for an easy merge.

@jarrod-burges

Copy link
Copy Markdown
Author

Thanks, @morganjwilliams. I'd also like to do some other diagrams, like the IOCG one that was mostly completed but never merged. Let me know if there are other issues or things to fix.

@morganjwilliams
morganjwilliams changed the base branch from main to develop November 11, 2026 03:44

@morganjwilliams morganjwilliams left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hey @jarrod-burges, a few comments here and there - main open question is around the log-log plot accessor, I think we can accommodate it in a more general way via init_axes(). Have a quick read as suits and let me know your thoughts.

Comment thread pyrolite/util/classification.py Resolved
Comment thread pyrolite/plot/__init__.py Resolved
Comment thread pyrolite/plot/__init__.py Outdated
data = data.loc[mask]

size = data.index.size
kw = process_color(size=size, **kwargs)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Using on the return of this in the scatter call will strip e.g. marker sizes and anything which isn't processed by process_color explicitly

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Planning to address a few more issues in process_color to make it work more nicely with modern matplotlib yet (some of the reasons it existed they've since addressed).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Since the code now uses the base plot and passes either linear or log scaling this shouldn't be an issue now right?

Comment thread pyrolite/util/classification.py Resolved
Comment thread pyrolite/util/classification.py Resolved
Comment thread pyrolite/util/classification.py Resolved
Comment thread pyrolite/plot/templates/magnetite.py Resolved
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 43090573181

Coverage decreased (-0.2%) to 90.543%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 22 uncovered changes across 1 file (39 of 61 lines covered, 63.93%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
pyrolite/util/classification.py 40 18 45.0%
Total (4 files) 61 39 63.93%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 7011
Covered Lines: 6348
Line Coverage: 90.54%
Coverage Strength: 8.15 hits per line

💛 - Coveralls

@jarrod-burges

Copy link
Copy Markdown
Author

@morganjwilliams The comments have been addressed. The plots still result in the previous images. The log-log plot has been removed and adjusted to use init_axes() and passes either 'linear' (default) or 'log'. So the other plots still work as expected too.

import matplotlib.text
import numpy as np
import pandas as pd
from jinja2.nodes import Literal

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Think this was an autoimport which went awry (had lots of these when I introduced more typing) - I'll fix this up after merging.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah I was going to do Literals for the linear or log selection to force either or without declaring enumeration. however it would’ve limited the python version and matplotlib just checks static strings, so I figured that would be enough.

@morganjwilliams

morganjwilliams commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Thanks @jarrod-burges, I'll merge over to develop now; let me know if you're happy for me to add you to the contributors and link to your GH account.

@jarrod-burges

Copy link
Copy Markdown
Author

GH account

That sounds good. Thanks!

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.

3 participants