Closed gostevehoward closed 7 years ago
With recent versions of StaticArrays, you may have to spell those as SizedArray{Tuple{2,2},...
rather than SizedArray{(2,2),...
, etc.
Thanks @Keno. There are several weird things going on here.
First, I narrowed the source of the problem down to the six SizedMatrix
types in the declaration of BivariateNormalDerivatives
.
The master version of bivariate_normals.jl
includes declarations in both styles: it has SArray
types with the Tuple{1,2,3}
form, and it has the above SizedMatrix
types with the (1,2,3)
form. So it was a bit unclear which version of StaticArrays the code is intended to run against. The REQUIRE file still says 0.1.4, but Jeff said to checkout master several weeks ago. So that's what I have. (Of course I tried running against 0.4.0 and got the predicatable error from the new-style types.)
I tried changing the SizedMatrix
types over to the Tuple{1,2,3}
form, but got a new error:
[1]<1> ERROR: MethodError: Cannot `convert` an object of type Type{Tuple{2,2}} to an object of type Array{Float64,2}
This may have arisen from a call to the constructor Array{Float64,2}(...),
since type constructors fall back to convert methods.
[1]<1> ERROR: Stack trace:
[1]<1> ERROR: Type at SizedArray.jl:23 [inlined]
[1]<1> ERROR: macro expansion at SizedArray.jl:41 [inlined]
[1]<1> ERROR: Type at SizedArray.jl:35 [inlined]
[1]<1> ERROR: convert at convert.jl:18 [inlined]
[1]<1> ERROR: Celeste.PSF.BivariateNormalDerivatives{Float64}() at bivariate_normals.jl:90
[1]<1> ERROR: (::Celeste.PSF.##call#1#2)(::Bool, ::Float64, ::Float64, ::Type{T} where T, ::Celeste.Transform.DataTransform, ::Int64) at PSF.jl:58
[1]<1> ERROR: #fit_raw_psf_for_celeste#16 at PSF.jl:679 [inlined]
[1]<1> ERROR: fit_raw_psf_for_celeste at PSF.jl:677 [inlined]
[1]<1> ERROR: convert(::Type{Celeste.Model.Image}, ::Celeste.SDSSIO.RawImage) at SDSSIO.jl:278
[1]<1> ERROR: load_field_images(::Array{Celeste.SDSSIO.RunCamcolField,1}, ::String, ::Bool, ::Bool) at SDSSIO.jl:309
[1]<1> ERROR: load_field_images(::Array{Celeste.SDSSIO.RunCamcolField,1}, ::String) at SDSSIO.jl:299
[1]<1> ERROR: include_from_node1(::String) at loading.jl:539
[1]<1> ERROR: include(::String) at sysimg.jl:14
[1]<1> ERROR: process_options(::Base.JLOptions) at client.jl:305
[1]<1> ERROR: _start() at client.jl:371
I suspect this is a bug in StaticArrays, though I lack the context to be sure, but observe:
julia> StaticArrays.SizedMatrix{(2,2), Float64}
ERROR: TypeError: SizedArray: in S, expected S<:Tuple, got Tuple{Int64,Int64}
julia> StaticArrays.SizedMatrix{Tuple{2,2}, Float64}
StaticArrays.SizedArray{Tuple{2,2},Float64,2,M} where M
julia> StaticArrays.SizedMatrix{Tuple{2,2}, Float64}()
ERROR: MethodError: Cannot `convert` an object of type Type{Tuple{2,2}} to an object of type Array{Float64,2}
This may have arisen from a call to the constructor Array{Float64,2}(...),
since type constructors fall back to convert methods.
Stacktrace:
[1] Type at /home/steve/.julia/v0.6/StaticArrays/src/SizedArray.jl:23 [inlined]
[2] StaticArrays.SizedArray{Tuple{2,2},Float64,2,M} where M() at /home/steve/.julia/v0.6/StaticArrays/src/SizedArray.jl:31
The other weird thing is that, in the original error traceback (in my previous comment), line 517 seems to be spurious. You can truncate bivariate_normals.jl
to be less than 500 lines and still get line 517 in the traceback. If you mess around, you can get the traceback to point to a different file (which is less than 500 lines) but still say line 517. So that traceback seems to be somehow corrupted.
StaticArrays was switched over gradually. SArray was first, but I think SizedArray was switched over now as well.
@andymiller is reporting this problem too. Is there a workaround?
In addition to #666, the following patch to StaticArrays master fixed it for me:
diff --git a/src/SizedArray.jl b/src/SizedArray.jl
index 6c0b976..ec7a34d 100644
--- a/src/SizedArray.jl
+++ b/src/SizedArray.jl
@@ -20,7 +20,7 @@ immutable SizedArray{S <: Tuple, T, N, M} <: StaticArray{S, T, N}
end
function (::Type{SizedArray{S, T, N, M}}){S, T, N, M}()
- new{S, T, N, M}(Array{T, M}(S))
+ new{S, T, N, M}(Array{T, M}(S.parameters...))
end
end
I submitted a PR to StaticArrays. I have no idea if it's the right fix or what. But it gets Celeste working again.
Thanks for fixing this Steve. @andymiller let us know if you're having trouble still. Celeste master works for me now if I run
Pkg.update()
Pkg.checkout("StaticArrays")
Pkg.build("StaticArrays")
Works for me --- thanks!
@jeff-regier I can't import Celeste on latest Julia 0.6. I ran Pkg.update(). Error is
Not sure how to debug that. Line 517 doesn't seem to have relevant code. Full log: