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

@strdict and dict_list with a single parameter do not create a Dict of type {String,Any} #265

Closed
hdavid16 opened this issue Jun 30, 2021 · 3 comments
Labels

Comments

@hdavid16
Copy link
Member

This is an issue because if the output of the simulation is not of the same type as your parameter, then it cannot be saved as described in https://juliadynamics.github.io/DrWatson.jl/dev/workflow/#.-Run-and-save-1

So if my parameter is an integer (for setting a random seed) and my output is a DataFrame. The dataframe cannot be stored in the Dict fulld because of a type error.

@Datseris
Copy link
Member

Hi there,

  1. Can you paste a MWE?
  2. If they don't create a type Dict{String,Any}, what do they create?
  3. In the example you paste above, in the function makesim you wouldn't copy(d), but instead do fulld = Dict{String,Any}(copy(d)), which ensures that your dictionary is whatever type you want...

As far as I can tell this isn't really an issue with DrWatson, but a rather simple conversion to Dict{String,Any}. If a MWE proves otherwise, feel free to re-open.

@jolars
Copy link

jolars commented Oct 25, 2023

Actually, creating a Dict{String,Any}, does not help because of #327. See here:

using DrWatson

params_dict = Dict{String,Any}(
  "sigma" => 0.5,
  "q" => 0.5
)

params_expanded = dict_list(param_dict)

# julia> 1-element Vector{Dict{String, Float64}}:
#   Dict("sigma" => 0.5, "q" => 0.5)

It would be nice if #342 was merged.

@Datseris
Copy link
Member

@jolars feel free to branch off that PR #342 and fix the comments I have and then I'll merge your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants