-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add inheritance #91
Add inheritance #91
Conversation
Thanks for this! I didn't manage to get to this this week, but I will have a look next week! |
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.
Thanks for the careful refactoring and adding the base classes! This helps a lot to make the code more consistent! The additional tests are also very welcome.
A few things I want to point out:
- Have you tried running the code on a live microscope? This continues to be my biggest fear when making sweeping changes and that is that I'd break something.
- The code uses some typing features that are not supported by python 3.7. Some of these may be fixed by prepending
from __future__ import annotations
. It's important that the code is compatible with older versions of Python, because older microscopes may still run Windows 7 where 3.7 is the last supported version. See failing tests. - Just a heads-up, this code is configured to use autopep8 for code formatting (ruff didn't exist when this code was written 😅), please use that instead of ruff. You can use
pre-commit run --files filename.py
to run all the linting/formatting tools.
I fixed a bug in #92 that fixes the comtypes install in the tests. If you sort out the typing, and the tests pass I'm happy to merge this PR.
Completely agree. The code base is somewhat dated and there is a lot of opportunity to streamline and improve the quality of the code. I'm happy to discuss any ideas in an issue. |
192d1d7
to
f392282
Compare
I have not, no. I could try to look into it, but I don't have training on our microscopes yet, and I have not looked into how instamatic is installed ect. My aim was to entirely avoid doing any changes that actually affected how the code was run, but I agree that it should be tested properly first
Done. A bit frustrating, but understandable, that the microscope computers don't keep up with updates, especially now as even 3.8 has reached end-of-life.
Will do moving forward. It did not work in python 3.7 unfortunately, seemingly due to some newer features introduced in versions without 3.7 support. I ran the hooks manually in 3.12 instead.
I rebased on the newest |
Thanks, I also don't think the changes will affect anything, but it's always good to test it. Unfortunately, I don't have access to a TEM and it's impossible to test all configurations anyway. I'm happy to switch to code formatting to ruff at some point, and add mypy for testing. I actually did a mypy run for fun just now and there are over 700 issues 😅 |
Hello,
as per #90, this implements some basic base classes for a couple cases where they were appropriate.
I also expanded the testing suite slightly, although it was difficult to come up with ways to test things without an actual microscope available. Mock versions of the cameras could be useful for more testing, although a mock version of every camera might not be necessary. My idea was to make the cameras instantiable by overriding the connection to an actual camera.
I feel like the structure and expandability of the code could be improved further, but I would like to think and plan a little first. This will come later, and I am very open to suggestions/thoughts on this matter. I presume you might have ideas for this, @stefsmeets?