Jack-H-Buckner / UniversalDiffEq.jl

Universal differential equations for ecologists
MIT License
6 stars 1 forks source link

plot_bifurcation_diagram() doesn't work with wide-formatted covariate data #88

Closed 19fitzna closed 2 months ago

19fitzna commented 2 months ago

plot_bifurcation_diagram relies on model.variable_column_name having a value which is not nothing

For instances where a user is using wide-format covariate data they set variable_column_name = nothing resulting in the following error when trying to use plot_bifurcation_diagram with a model using wide-format covariate data:

MethodError: no method matching getindex(::DataFrame, ::Colon, ::Nothing)

Stacktrace:
 [1] plot_bifrucation_diagram(model::MultiUDE, xvariable::String; N::Int64, color_variable::Nothing, conditional_variable::Nothing, size::Tuple{Int64, Int64})
   @ UniversalDiffEq C:\Users\user\.julia\packages\UniversalDiffEq\iRceU\src\ODEAnalysis.jl:678
 [2] plot_bifrucation_diagram(model::MultiUDE, xvariable::String)
   @ UniversalDiffEq C:\Users\user\.julia\packages\UniversalDiffEq\iRceU\src\ODEAnalysis.jl:657

I can include an MWE if needed but this should occur anytime when using plot_bifurcation_diagram for a model with kwarg variable_column_name = nothing

zechmeunier commented 2 months ago

Isn't it the behavior of most functions that take covariates to require them to be supplied in long format?

19fitzna commented 2 months ago

At least within our package, all other functions that use covariates support both at this moment.

As an alternative to changing this function to work with wide format we could drop wide-format support or provide a warning that wide format has limited functionality when defining a model with wide-format covariates.

Jack-H-Buckner commented 2 months ago

Thanks for catching this! I'll work on it - were you using a multiple or single time series model?

19fitzna commented 2 months ago

I was using multiple time series