-
Notifications
You must be signed in to change notification settings - Fork 1
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
Scaling JPK data values correctly #118
base: main
Are you sure you want to change the base?
Conversation
I am working on improving the documentation however I think the test failure is due to the nature of the bug and the test itself is incorrect. The |
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 Pull Request @derollins
I've left some suggestions on style in place.
I'm wondering if the tags should be parameterised rather than hard coded so that if they change in the future it is easier to update them.
The values I've seen are...
JPK_TAGS = {
"n_slots": 32896,
"default": 32897,
"tag_name": 32912,
"scaling_type": 32931,
"scaling_name": 32932,
"offset_name": 32933,
}
This could be a dictionary passed in, although the default should be tags: dict[str: int] | None = None
as setting the default to be a dictionary falls foul of a linting error.
The dictionary could be define globally and passed as an argument when calling on line 150.
Co-authored-by: Neil Shephard <n.shephard@sheffield.ac.uk>
The correct sum for the |
Thanks for the suggestion @ns-rse, the tags are certainly the most confusing aspect of reading these files. I'm uncertain of the best approach as many of the tags are 'relative' and found by adding multiples of 48 depending on the slot. Some are used as stings while others are used as integers. |
Thanks for the prompt work @derollins 👍 Looked through and noticed one small thing, and also that
Always a tricky one when you have to go back and forth, thankfully they're not floats or large integers so precision won't be a problem. I'd let the balance of how they are most frequently used determine their default type.
I'd define it near the top of the |
Hi @ns-rse I kept
In that case I think storing them as strings makes sence as that is how they are primarily used.
Great, I'll have a go at this. |
Thanks @derollins I think this is much easier to understand now than with the numbers hard coded. One final suggestion on naming conventions made in-line, I'd be inclined to use the There are some notes on this in the AFMReader Documentation if inclined to do so. |
That was quick @derollins 👍 😁 You might want to check out the magic of |
I went with
I was using this but the company security settings on the work laptop I was using was blocking it from running. I might try making a commit on a personal computer before I push in the future. |
Thanks! I will do that, I had just forgotten to pull the changes that pre-commit had made |
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 your patience and for taking the time to provide a solution @derollins
This will be merged and available, not sure when we'll make a new release just yet though but you can install from main
branch to get these changes if you start a new env or a colleague does.
As described in issue #116, currently the data (z values) scaling factors used for most channels in JPK images are incorrect and some channels cannot be read.
This pull request creates the fucntion
_get_z_scaling()
that extracts the correct scaling factor for each channel and uses these to scale the image.Additonally corrects a typo in the example notebook.
This fixes #116