Open Cody-G opened 7 years ago
Isn't Axis{:x}(linspace(0u"m",10u"m",11))
what you are looking for?
Looking at this again, one can't do this in-place because the Axis
object's type includes the type of the range. So you'd have to create a new "wrapper." I think it could be something like
A = AxisArray(A.data, map(*, axes(A), (u"m", u"s"))
except that we don't currently define ::Axis * ::Units
. If that seems reasonable to you, perhaps a pull request?
Is there any interest in having a convenience function for setting units for an existing
Axis
orAxisArray
that is currently unitless? I found this useful when loading someone else'sNRRD
image using NRRD.jl. With this format it seems common to save images with meaningful spacings but without units, and units are basically communicated by word of mouth since the format doesn't standardize them anyway. I've been manually re-creating the axes after I load the images and am looking for something more convenient. Am I missing something in the API? What if we overload arithmetic like this?