From 769acf9b735f3dc74f84d6ddf98c05c2afb56ee3 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 25 Mar 2017 09:06:17 -0500 Subject: [PATCH] Define a fallback for timeaxis --- src/ImageAxes.jl | 1 + test/runtests.jl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ImageAxes.jl b/src/ImageAxes.jl index fa52836..e0dbadf 100644 --- a/src/ImageAxes.jl +++ b/src/ImageAxes.jl @@ -38,6 +38,7 @@ new names as well. Return the time axis, if present, of the array `A`, and `nothing` otherwise. """ @inline timeaxis(A::AxisArray) = _timeaxis(A.axes...) +timeaxis(A::AbstractArray) = nothing timeaxis(A::AbstractMappedArray) = timeaxis(parent(A)) @traitfn _timeaxis{Ax<:Axis; !TimeAxis{Ax}}(ax::Ax, axes...) = _timeaxis(axes...) @traitfn _timeaxis{Ax<:Axis; TimeAxis{Ax}}(ax::Ax, axes...) = ax diff --git a/test/runtests.jl b/test/runtests.jl index db06447..dd7e8a0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -30,6 +30,8 @@ using SimpleTraits, Unitful @test @inferred(indices_spatial(A)) === (Base.OneTo(3), Base.OneTo(4)) assert_timedim_last(A) @test map(istimeaxis, axes(A)) == (false,false) + + @test @inferred(timeaxis(rand(3,5))) == nothing end @testset "units, no time" begin