@@ -51,12 +51,13 @@ julia> for spk = (sin.(0.8:0.2:8.6) .* [0:0.01:.1; .15:.1:.95; 1:-.05:.05] .* 50
51
51
52
52
``` jldoctest
53
53
julia> A = AxisArray([y 2y], Axis{:time}(0s:1s/fs:60s), Axis{:chan}([:c1, :c2]))
54
+
54
55
2-dimensional AxisArray{Float64,2,...} with axes:
55
56
:time, 0.0 s:2.5e-5 s:60.0 s
56
57
:chan, Symbol[:c1, :c2]
57
58
And data, a 2400001×2 Array{Float64,2}:
58
59
3.5708 7.14161
59
- 6.14454 12.2891
60
+ 6.14454 12.2891
60
61
3.42795 6.85591
61
62
1.37825 2.75649
62
63
-1.19004 -2.38007
@@ -65,16 +66,17 @@ And data, a 2400001×2 Array{Float64,2}:
65
66
-0.226449 -0.452898
66
67
0.821446 1.64289
67
68
-0.582687 -1.16537
68
- ⋮
69
+ ⋮
69
70
-3.50593 -7.01187
70
71
2.26783 4.53565
71
72
-0.16902 -0.33804
72
73
-3.84852 -7.69703
73
74
0.226457 0.452914
74
75
0.560809 1.12162
75
76
4.67663 9.35326
76
- -2.41005 -4.8201
77
+ -2.41005 -4.8201
77
78
-3.71612 -7.43224
79
+
78
80
```
79
81
80
82
AxisArrays behave like regular arrays, but they additionally use the axis
@@ -98,6 +100,7 @@ And data, a 5-element Array{Float64,1}:
98
100
6.85591
99
101
2.75649
100
102
-2.38007
103
+
101
104
```
102
105
103
106
We can also index by the * values* of each axis using an ` Interval ` type that
@@ -114,12 +117,13 @@ And data, a 7-element Array{Float64,1}:
114
117
1.37825
115
118
-1.19004
116
119
-1.99414
117
- 2.9429
120
+ 2.9429
118
121
-0.226449
119
122
0.821446
120
123
121
124
julia> axes(ans, 1)
122
125
AxisArrays.Axis{:time,StepRangeLen{Quantity{Float64, Dimensions:{𝐓}, Units:{s}},Base.TwicePrecision{Quantity{Float64, Dimensions:{𝐓}, Units:{s}}},Base.TwicePrecision{Quantity{Float64, Dimensions:{𝐓}, Units:{s}}}}}(5.0e-5 s:2.5e-5 s:0.0002 s)
126
+
123
127
```
124
128
125
129
You can also index by a single value on an axis using ` atvalue ` . This will drop
@@ -135,6 +139,7 @@ julia> A[2.5e-5s..2.5e-5s, :c1]
135
139
:time, 2.5e-5 s:2.5e-5 s:2.5e-5 s
136
140
And data, a 1-element Array{Float64,1}:
137
141
6.14454
142
+
138
143
```
139
144
140
145
You can even index by multiple values by broadcasting ` atvalue ` over an array:
@@ -147,6 +152,7 @@ julia> A[atvalue.([2.5e-5s, 75.0µs])]
147
152
And data, a 2×2 Array{Float64,2}:
148
153
6.14454 12.2891
149
154
1.37825 2.75649
155
+
150
156
```
151
157
152
158
Sometimes, though, what we're really interested in is a window of time about a
@@ -158,15 +164,16 @@ we use the `atindex` function:
158
164
``` jldoctest
159
165
julia> A[atindex(-90µs .. 90µs, 5), :c2]
160
166
1-dimensional AxisArray{Float64,1,...} with axes:
161
- :time_sub, -7.5e-5 s:2.5e-5 s:7.500000000000002e -5 s
167
+ :time_sub, -7.5e-5 s:2.5e-5 s:7.5e -5 s
162
168
And data, a 7-element Array{Float64,1}:
169
+ 12.2891
163
170
6.85591
164
171
2.75649
165
172
-2.38007
166
173
-3.98828
167
174
5.88581
168
175
-0.452898
169
- 1.64289
176
+
170
177
```
171
178
172
179
Note that the returned AxisArray has its time axis shifted to represent the
@@ -182,26 +189,27 @@ julia> spks = A[atindex(-200µs .. 800µs, idxs), :c1]
182
189
:time_sub, -0.0002 s:2.5e-5 s:0.0008 s
183
190
:time_rep, Quantity{Float64, Dimensions:{𝐓}, Units:{s}}[0.162 s, 0.20045 s, 0.28495 s, 0.530325 s, 0.821725 s, 1.0453 s, 1.11967 s, 1.1523 s, 1.22085 s, 1.6253 s … 57.0094 s, 57.5818 s, 57.8716 s, 57.8806 s, 58.4353 s, 58.7041 s, 59.1015 s, 59.1783 s, 59.425 s, 59.5657 s]
184
191
And data, a 41×247 Array{Float64,2}:
185
- 0.672063 7.25649 0.633375 … 1.54583 5.81194 -4.706
192
+ -1.82238 2.3315 -1.56147 … 4.33751 4.77713 -1.81713
193
+ 0.672063 7.25649 0.633375 1.54583 5.81194 -4.706
186
194
-1.65182 2.57487 0.477408 3.09505 3.52478 4.13037
187
195
4.46035 2.11313 4.78372 1.23385 7.2525 3.57485
188
196
5.25651 -2.19785 3.05933 0.965021 6.78414 5.94854
189
- 7.8537 0.345008 0.960533 0.812989 0.336715 0.303909
190
- 0.466816 0.643649 -3.67087 … 3.92978 -3.1242 0.789722
197
+ 7.8537 0.345008 0.960533 … 0.812989 0.336715 0.303909
198
+ 0.466816 0.643649 -3.67087 3.92978 -3.1242 0.789722
191
199
-6.0445 -13.2441 -4.60716 0.265144 -4.50987 -8.84897
192
200
-9.21703 -13.2254 -14.4409 -8.6664 -13.3457 -11.6213
193
201
-16.1809 -22.7037 -25.023 -15.9376 -28.0817 -16.996
194
- -23.2671 -31.2021 -25.3787 -24.4914 -32.2599 -26.1118
195
202
⋮ ⋱ ⋮
203
+ 1.72728 4.77428 -10.3922 -2.08555 1.19198 -1.94365
196
204
-0.301629 0.0683982 -4.36574 1.92362 -5.12333 -3.4431
197
205
4.7182 1.18615 4.40717 -4.51757 -8.64314 0.0800021
198
- -2.43775 -0.151882 -1.40817 -3.38555 -2.23418 0.728549
199
- 3.2482 -0.60967 0.471288 … 2.53395 0.468817 -3.65905
206
+ -2.43775 -0.151882 -1.40817 … -3.38555 -2.23418 0.728549
207
+ 3.2482 -0.60967 0.471288 2.53395 0.468817 -3.65905
200
208
-4.26967 2.24747 -3.13758 1.74967 4.5052 -0.145357
201
209
-0.752487 1.69446 -1.20491 1.71429 1.81936 0.290158
202
210
4.64348 -3.94187 -1.59213 7.15428 -0.539748 4.82309
203
- 1.09652 -2.66999 0.521931 -3.80528 1.70421 3.40583
204
- -0.94341 2.60785 -3.34291 … 1.10584 4.31118 3.6404
211
+ 1.09652 -2.66999 0.521931 … -3.80528 1.70421 3.40583
212
+
205
213
```
206
214
207
215
By indexing with a repeated interval, we have * added* a dimension to the
0 commit comments