OK. Here’s the module code (not all the individual files ofc)
export Solution,
Params, Target, Path, Beamparams, initialise, etch, outplot, makegcode
using Dierckx,
CSV,
Roots,
QuadGK,
Polynomials,
SparseArrays,
OSQP,
Printf,
Statistics,
AbstractPlotting.MakieLayout,
AbstractPlotting,
GLMakie,
Colors,
ColorSchemes,
FileIO,
JLD,
Interpolations
include("Params.jl")
include("Beamparams.jl")
include("Target.jl")
include("Path.jl")
include("Solution.jl")
include("initialise.jl")
include("makeinterpolant.jl")
include("calibration.jl")
include("makerange.jl")
include("findtracks.jl")
include("rasterpaths.jl")
include("joinpaths.jl")
include("Dmap.jl")
include("invDmap.jl")
include("makeinfluencematrix.jl")
include("makesmoothingmatrix.jl")
include("refinetarget.jl")
include("inversesolve.jl")
include("outplot.jl")
include("GSsearch.jl")
include("optimize_Zrange.jl")
include("compresspath.jl")
include("makemaskpath.jl")
include("find_dtheta.jl")
include("etch.jl")
include("findgradient.jl")
include("improve_path.jl")
include("optimise_paths.jl")
include("optimiseoverlap.jl")
include("makegcode.jl")
end
Here’s the complete REPL history when I try to use it
julia> include("Etching.jl");
julia> using .Etching
julia> sol, sol0 = etch("coin",25.0,2; Zrange = 0.5);
target = coin, size = 25.0.
┌ Warning: type Interpolations.FilledExtrapolation{Core.Float64,3,Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Core.Float64} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Gridded{Interpolations.Linear} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Linear not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
ERROR: MethodError: Cannot `convert` an object of type JLD.var"##Interpolations.FilledExtrapolation{Core.Float64,3,Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Core.Float64}#325" to an object of type Interpolations.FilledExtrapolation{Float64,3,Interpolations.GriddedInterpolation{Float64,3,Float64,Interpolations.Gridded{Interpolations.Linear},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},Array{Float64,1},Array{Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Float64}
Closest candidates are:
convert(::Type{T}, ::T) where T<:AbstractArray at abstractarray.jl:14
convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at C:\Users\pmzjb1\AppData\Local\JuliaPro-1.4.2-1\Julia-1.4.2\share\julia\stdlib\v1.4\LinearAlgebra\src\factorization.jl:55
convert(::Type{S}, ::T) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\CategoricalArrays\dmrjI\src\value.jl:103
...
Stacktrace:
[1] macro expansion at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:422 [inlined]
[2] jlconvert(::Type{Beamparams}, ::JLD.JldFile, ::Ptr{UInt8}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:551
[3] read_scalar_default(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type{T} where T) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:400
[4] read_scalar(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type{T} where T) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:396
[5] read(::JLD.JldDataset) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:367
[6] read(::JLD.JldFile, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:343
[7] #49 at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1258 [inlined]
[8] map at .\tuple.jl:158 [inlined]
[9] #48 at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1258 [inlined]
[10] jldopen(::JLD.var"#48#50"{Tuple{String,String}}, ::String, ::Vararg{String,N} where N; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:243
[11] jldopen(::Function, ::String, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:241
[12] load(::FileIO.File{FileIO.DataFormat{:JLD}}, ::Tuple{String,String}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1257
[13] load(::FileIO.File{FileIO.DataFormat{:JLD}}, ::String, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1255
[14] load(::String, ::String, ::Vararg{String,N} where N; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\FileIO\ZknoK\src\loadsave.jl:118
[15] load at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\FileIO\ZknoK\src\loadsave.jl:118 [inlined]
[16] etch(::String, ::Float64, ::Int64; Zmin::Float64, Zmax::Float64, Zrange::Float64, maskfiles::String, gcodeflag::Bool, dirname::String, plotflag::Bool, saveflag::Bool, verbose::Bool, straightflag::Bool, overlap::Float64, gamma::Float64, dsmin::Float64, dsmax::Float64, dthetamax::Float64, order::Int64, vmin::Float64, vmax::Float64, pixellength::Float64, linsys_solver::String, eps_abs::Float64, eps_rel::Float64) at C:\Users\pmzjb1\Google Drive\LaserJet Julia Project\etch.jl:76
[17] top-level scope at none:0
It looks like something to do with the packages JLD and Interpolations to me, but I don’t really know what.
Just to emphasise, when I don’t try to make this a module, and just have the ‘using’ statement and the list of 'include’s, it works fine, so I don’t see how I can be missing something in the ‘using’ list.