SciML / SciML/ComponentArrays.jl

UndefVarError: len not defined in `make_idx(data, pair::Pair, last_val)`

Open
#185 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
375
Forks
42
Avg merge
7h 25m
Merged PRs (30d)
17

Description

julia>     x = getsimulationresultsalldata(baseline_data, treatment_data);
ERROR: UndefVarError: `len` not defined
Stacktrace:
  [1] make_idx(data::Vector{Any}, pair::Pair{String, Matrix{Float64}}, last_val::Int64)
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:165
  [2] make_idx(data::Vector{Any}, nt::Dict{Symbol, Pair{String}}, last_val::Int64)
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:157
  [3] make_carray_args(A::Type{Vector}, nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:147
  [4] make_carray_args(nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:139
  [5] ComponentArray(nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:63****

im on 0.13.6
i can't show the rest of the trace but the make_idx function does look wrong

function make_idx(data, pair::Pair, last_val)
    data, ax = make_idx(data, pair.second, last_val)
    return (data, ViewAxis(last_val:(last_val+len-1), Axis(pair.second)))
end

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/componentarray.jl around lines 147-165, especially the make_idx overload shown in the report. Reproduce the reported ComponentArray construction with Julia 0.13.6 and inspect how the recursive call determines the axis length. Done means the reported input no longer raises UndefVarError: len not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.