Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance #968

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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