@@ -38,9 +38,10 @@ path to whatever the new name will be.
38
38
## Example of currently-implemented behavior:
39
39
40
40
``` julia
41
- julia> Pkg. add (" AxisArrays" )
41
+ julia> using Pkg; Pkg. add (" AxisArrays" )
42
42
julia> using AxisArrays, Unitful
43
43
julia> import Unitful: s, ms, µs
44
+ julia> using Random: MersenneTwister
44
45
45
46
julia> rng = MersenneTwister (123 ) # Seed a random number generator for repeatable examples
46
47
julia> fs = 40000 # Generate a 40kHz noisy signal, with spike-like stuff added for testing
@@ -237,8 +238,8 @@ headers.
237
238
238
239
``` julia
239
240
B = AxisArray (reshape (1 : 15 , 5 , 3 ), .1 : .1 : 0.5 , [:a , :b , :c ])
240
- B[Axis {:row} (Interval (. 2 ,. 4 ) )] # restrict the AxisArray along the time axis
241
- B[Interval ( 0. ,. 3 ) , [:a , :c ]] # select an interval and two of the columns
241
+ B[Axis {:row} (0.2 .. 0.4 )] # restrict the AxisArray along the time axis
242
+ B[0.0 .. 0.3 , [:a , :c ]] # select an interval and two of the columns
242
243
```
243
244
244
245
User-defined axis types can be added along with custom indexing
@@ -248,7 +249,8 @@ behaviors.
248
249
``` julia
249
250
B = AxisArray (randn (100 ,100 ,100 ), :x , :y , :z )
250
251
Itotal = sumz = 0.0
251
- for iter in CartesianRange (indices (B)) # traverses in storage order for cache efficiency
252
+ for iter in CartesianIndices (Base. axes (B)) # traverses in storage order for cache efficiency
253
+ global Itotal, sumz
252
254
I = B[iter] # intensity in a single voxel
253
255
Itotal += I
254
256
sumz += I * iter[axisdim (B, Axis{:z })] # axisdim "looks up" the z dimension
0 commit comments