JuliaArrays / AxisArrays.jl

Performant arrays where each dimension can have a named axis with values
http://JuliaArrays.github.io/AxisArrays.jl/latest/
Other
200 stars 41 forks source link

Question: How to change axis? #100

Open mdhe1248 opened 7 years ago

mdhe1248 commented 7 years ago

Hi, I am wondering if there is a way to change axes. For example,

using Unitful
using AxisArrays
const μm = u"μm"
const s = u"s"

tmp = AxisArray(rand(1000,1000,2,2), (:x, :y, :z, :t), (0.577μm, 0.577μm, 5μm, 2s))

I would like to change 0.577μm of :x to some other values. Is there easy with to change it (without generating a new array)? I tried several things. All didn't work.

# All below do not work.
tmp[Axis{:x}] = 1:1000 
tmp = AxisArray(tmp, (:x), (1))
tmp = AxisArray(tmp, (:x, :y, :z, :t), (1, 0.577μm, 5μm, 2s)) # This generates additional axis.

Best,