-
Notifications
You must be signed in to change notification settings - Fork 8
Finalize Imodmodel writing + documentation #33
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR finalizes writing support for IMOD models and updates the associated documentation and tests.
- Adds a write function and corresponding tests for writing IMOD models from pandas DataFrames.
- Introduces a new class method from_dataframe in the models to construct a model from DataFrame input.
- Updates documentation, pyproject settings, and CI configuration to reflect these new features.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_functional_api.py | Adds tests for writing and reading back an IMOD model file. |
| src/imodmodel/models.py | Adds from_dataframe method for constructing models from DataFrames. |
| src/imodmodel/functions.py | Implements a write function that utilizes the new from_dataframe method. |
| src/imodmodel/init.py | Exposes the write function in the public API. |
| pyproject.toml | Updates Python version requirements and target version for linting. |
| docs/*.md | Updates documentation to include write support and adjustments to links. |
| .github/workflows/test_and_deploy.yml | Updates CI configuration with additional python versions. |
Comments suppressed due to low confidence (1)
src/imodmodel/models.py:499
- [nitpick] Consider renaming the parameter 'type' to avoid shadowing Python's built-in function, for example to 'contour_type'.
def from_dataframe(cls, dataframe: pd.DataFrame, type: ContourType = ContourType.SCATTERED):
alisterburt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
about to jump on a plane but here are some first comments - please merge when you're happy and push a release when it works for you! 🙂 ping if you need any guidance on that process
| def test_write(two_contour_model_file,tmp_path): | ||
| """Check that a model can be written to a file.""" | ||
| # Read the original model | ||
| original_model = imodmodel.read(two_contour_model_file) | ||
| # Write the model to a new file | ||
| imodmodel.write(original_model, tmp_path / "test_model.imod") | ||
| # Read the new model | ||
| new_model = imodmodel.read(tmp_path / "test_model.imod") | ||
| # Check that the new model matches the original | ||
| assert original_model.equals(new_model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
Co-authored-by: alisterburt <alisterburt@gmail.com>
Co-authored-by: alisterburt <alisterburt@gmail.com>
Co-authored-by: alisterburt <alisterburt@gmail.com>
These are some minor things to finish up the Imodmodel write support + documentation, addressing #9, #21, and #25.
I decided on a very simple write method for now, mostly mirroring the simplicity of the writing.
Would be good for someone to double-check the note I wrote on the coordinate system origin that IMOD uses (at least for point annotation). Maybe everybody was already aware of that, but I've stumbled there a few times.
Maybe we can make a 0.1.0 or 1.0.0 release soon?