Skip to content

Commit d57b37e

Browse files
authored
Merge pull request #73 from tpgillam/tg/named_array_dimname
Convert NamedArray dimnames to Symbol
2 parents 0b8a82a + 7f68679 commit d57b37e

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AxisKeys"
22
uuid = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
33
license = "MIT"
4-
version = "0.1.17"
4+
version = "0.1.18"
55

66
[deps]
77
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
@@ -33,9 +33,10 @@ julia = "1"
3333
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3434
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
3535
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
36+
NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673"
3637
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3738
UniqueVectors = "2fbcfb34-fd0c-5fbb-b5d7-e826d8f5b0a9"
3839
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
3940

4041
[targets]
41-
test = ["BenchmarkTools", "Dates", "FFTW", "Test", "UniqueVectors", "Unitful"]
42+
test = ["BenchmarkTools", "Dates", "FFTW", "NamedArrays", "Test", "UniqueVectors", "Unitful"]

src/wrap.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ function wrapdims_import(A::AbstractArray)
141141
v
142142
end
143143
if nameouter() == false
144-
return KeyedArray(NamedDimsArray(A.array, A.dimnames), keys)
144+
return KeyedArray(NamedDimsArray(A.array, Symbol.(A.dimnames)), keys)
145145
else
146-
return NamedDimsArray(KeyedArray(A.array, keys), A.dimnames)
146+
return NamedDimsArray(KeyedArray(A.array, keys), Symbol.(A.dimnames))
147147
end
148148

149149
elseif fields == (:data, :axes) # then it's an AxisArray

test/_packages.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ end
2626
@test n(y=k) == n[:,7]
2727

2828
end
29+
@testset "namedarrays" begin
30+
using NamedArrays
31+
32+
# NamedArrays lets us have strings as well as symbols for dimension names. Make sure
33+
# we can handle both.
34+
for dimension_name in (:aa, "aa")
35+
x = NamedArray([1])
36+
setdimnames!(x, dimension_name, 1)
37+
k = wrapdims(x)
38+
@test dimnames(k) == (:aa,)
39+
end
40+
end
2941
@testset "tables" begin
3042
using Tables
3143

0 commit comments

Comments
 (0)