Closed ThorstenBASF closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 86.40%. Comparing base (
edb78c7
) to head (a0982fb
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Not sure, if units can ever be None, but _convert_scale_units also checks for None. Problem is, this would result in an error.
Another thing: it would be better to have a small test file (most likely need to make one for this specific purpose) but it this is not straightforward and may need some time, this is not a big deal and we can merge this PR without it.
/like this?
Yes, this is good. Can you add a changelog entry as explained in https://github.com/hyperspy/rosettasciio/blob/main/upcoming_changes/README.rst?
A file for the changelog has been added.
Thank you very much for your help and guidance.
*edit nvm, I was stupid.
Just found another incompatibility with matplotlib for SAD images (reciprocal scaling). Reciprocal unit strings are using whitespaces with the current format. For example "1/m" vs "1 / m". matplotlib wants the first one, but 2nd one is used.
This could be fixed by use the "short pretty" format instead of the "short" only. A single letter "P" would fix it.
converted_units = "{:~}".format(converted_v.units)
to
converted_units = "{:~P}".format(converted_v.units)
Should I add this to current pull request, or open another issue?
@ThorstenBASF: congratulation on your first pull request to rosettasciio! 🎉
I tweaked the release entry and simplify the code to make it more readable by avoid using list when not necessary.
Just found another incompatibility with matplotlib for SAD images (reciprocal scaling). Reciprocal unit strings are using whitespaces with the current format. For example "1/m" vs "1 / m". matplotlib wants the first one, but 2nd one is used.
This could be fixed by use the "short pretty" format instead of the "short" only. A single letter "P" would fix it.
converted_units = "{:~}".format(converted_v.units)
toconverted_units = "{:~P}".format(converted_v.units)
Should I add this to current pull request, or open another issue?
Yes, please, let's do this in a separate PR, I am not sure if I understand exactly what is the issue and generally it is easier to follow discussions when they are short and self-contain.
Yes, please, let's do this in a separate PR, I am not sure if I understand exactly what is the issue and generally it is easier to follow discussions when they are short and self-contain.
This issue seems fixed with 2.x (see below). I'm still working with 1.7x (stability reasons). But we'll change to 2.x soon. https://github.com/hyperspy/rosettasciio/blob/e3e76800baf2981b9c0b1248e94d7dfb7d14eca1/rsciio/image/_api.py#L191-L195
Thanks again, next time I'll will need less advice. I promise! :)
Description of the change
X and Y could have different units calculated by "_convert_scale_units" now the units itself is only set once and other axe values are set this unit. Different units results in an error of an sanity check of matplotlib sclaebar. And the offsets could be wrong. Changes:
Progress of the PR
upcoming_changes
folder (seeupcoming_changes/README.rst
),docs/readthedocs.org:rosettasciio
build of this PR (link in github checks)Minimal example of the bug fix or the new feature