Second step in an attempted cleanup of the CLI part - reverse the index order to make xyz the standard#378
Conversation
* Rename `loadXSF` to `loadXSFData` and `saveXSF` to `saveXSFData` to make the original names available for the furture new functions. * Add the `xyz_order` option to `saveXSFData` arguments. * Remove functions `loadVecFieldXsf`, `loadVecFieldNpy`, `saveVecFieldXsf`, `saveVecFieldNpy` to simplify the io.py code structure.
…on parts of the code.
* by removing array transpositions in ocl.field.TipDensity.subCores() * and reinterpreting nDim in common.getPos()
* by correcting the definition of `zpos` in ppafm/cli/generateElFF.py, * making `xyz_order` the default for loadCUBE in ppafm/io.py, * and fixing the `rotate` functionality in ppafm/cli/relaxed_scan.py
|
I have realized that I should add an |
|
Further notes (about writing and reading data files):
|
…ake some more fixes there.
NikoOinonen
left a comment
There was a problem hiding this comment.
Thanks Martin, everything looks fine to me except that I would rather not rename the PixPerAngstrome argument right now.
| def __init__( | ||
| self, | ||
| pixPerAngstrome=10, | ||
| pixPerAngstrom=10, |
There was a problem hiding this comment.
I think it's better not to change this right now. I have probably a hundred scripts all around that use the existing naming, and some of Adam's guys have been using it too, so breaking it without notice is not good. There is also another issue for overhauling the arguments here more thoroughly (#338), so I would leave this for later.
| if xyz_order: | ||
| data = data.transpose((2, 1, 0)) |
There was a problem hiding this comment.
The name of the argument xyz_order feels a bit unintuitive to me here. When I first read it, I expected it to mean that the output will be saved in xyz order, but actually it means that the input is expected in xyz order. Maybe a bit more explicit name like data_is_xyz_order would be better?
This PR is a follow-up to #376, another step to gradually address #198, and the main part of replacement for the failed #347.
[ix,iy,iz]index order (in C-like memory arrangement) for arrays that represent grid data in the CLI part of the code.ppafm/PPPlot.py, which need the[iz,iy,ix]order internally. These function now transpose the input array(s) at the beginning, so they still expect the new standard of the[ix,iy,iy]order on their input. Moreover, since the change in indexing has made it difficult to specify theslicesargument such that it would cover the whole array, a new default ofslices=Nonehas been implemented, which does exactly this:if slices is None:then plot all the slices.ppafm/PPPlot.pyfunctions can be suppressed by a newly added optionxyz_order=False(see also the next comment of mine).--rotateoption (with which that issue is concerned) for anything, so I have not tested it.pixPerAngstromewith the extra "e" at the end. So I have changed this topixPerAngstromeverywhere.Note: The bug that prevented the
oclversion from working in #347 was likely the index reordering byarray.Tin functionsubCoresofppafm/ocl/field.py, which I failed to remove here and here.