Skip to content

Commit

Permalink
Merge pull request #968 from mimiframework/perf
Browse files Browse the repository at this point in the history
Improve performance
  • Loading branch information
davidanthoff authored Jul 17, 2023
2 parents 5064cab + 7e4b216 commit eb15661
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/getdataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function _load_dataframe(m::AbstractModel, comp_name::Symbol, item_name::Symbol,
end
paths = m isa MarginalModel ? _get_all_paths(m.base) : _get_all_paths(m)
comp_path = paths[comp_name];
data = deepcopy(m[comp_path, item_name] === nothing ? m[comp_name, item_name] : m[comp_path, item_name])
data = m[comp_path, item_name] === nothing ? m[comp_name, item_name] : m[comp_path, item_name]

if num_dims == 1
dim1name = dims[1]
Expand All @@ -46,7 +46,7 @@ function _load_dataframe(m::AbstractModel, comp_name::Symbol, item_name::Symbol,
# @info "len shifted: $(length(shifted_data))"
df[!, item_name] = shifted_data
else
df[!, item_name] = data
df[!, item_name] = deepcopy(data)
end
else
df = _df_helper(m, comp_name, item_name, dims, data)
Expand Down Expand Up @@ -86,7 +86,7 @@ function _df_helper(m::AbstractModel, comp_name::Symbol, item_name::Symbol, dims
data = vcat(top, data, bottom)
end

df[!, item_name] = cat([vec(data[i, :]) for i = 1:len_dim1]...; dims=1)
df[!, item_name] = collect(vec(data'))
else

# shift the data to be padded with missings if this data is shorter than the model
Expand Down

0 comments on commit eb15661

Please sign in to comment.