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

Generated function error #142

Closed
CNelias opened this issue Feb 26, 2024 · 2 comments
Closed

Generated function error #142

CNelias opened this issue Feb 26, 2024 · 2 comments

Comments

@CNelias
Copy link

CNelias commented Feb 26, 2024

I tried to run the first example of the tutorial:

using Revise, Parameters, Plots
using BifurcationKit
const BK = BifurcationKit

# vector field
function TMvf(z, p)
	@unpack J, α, E0, τ, τD, τF, U0 = p
	E, x, u = z
	SS0 = J * u * x * E + E0
	SS1 = α * log(1 + exp(SS0 / α))
	[
	    (-E + SS1) / τ,
       (1.0 - x) / τD - u * x * E,
	    (U0 - u) / τF +  U0 * (1.0 - u) * E
	]
end

# parameter values
par_tm == 1.5, τ = 0.013, J = 3.07, E0 = -2.0, τD = 0.200, U0 = 0.3, τF = 1.5, τS = 0.007)

# initial condition
z0 = [0.238616, 0.982747, 0.367876]

# Bifurcation Problem
prob = BifurcationProblem(TMvf, z0, par_tm, (@lens _.E0);
	record_from_solution = (x, p) -> (E = x[1], x = x[2], u = x[3]),)

    # continuation options, we limit the parameter range for E0
opts_br = ContinuationPar(p_min = -4.0, p_max = -0.9)

# continuation of equilibria
br = continuation(prob, PALC(), opts_br;
	# we want to compute both sides of the branch of the initial
	# value of E0 = -2
	bothside = true)

but this does not run. Instead, I get the following error, which I have no idea how to fix, and seems to be burried quite deep into the source code.

ERROR: code reflection cannot be used from generated functions
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] _which(tt::Type; method_table::Nothing, world::UInt64, raise::Bool)
    @ Base .\reflection.jl:1692
  [3] _which
    @ Base .\reflection.jl:1688 [inlined]
  [4] which(tt::Any)
    @ Base .\reflection.jl:1728
  [5] which(tt::Any)
    @ Base .\reflection.jl:1719 [inlined]
  [6] is_propertynames_overloaded
    @ C:\Users\Agarwal Lab\.julia\packages\ConstructionBase\ZLOSb\src\ConstructionBase.jl:52 [inlined]
  [7] #s26#2
    @ C:\Users\Agarwal Lab\.julia\packages\ConstructionBase\ZLOSb\src\ConstructionBase.jl:56 [inlined]
  [8] var"#s26#2"(::Any, obj::Any)
    @ ConstructionBase .\none:0
  [9] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
    @ Core .\boot.jl:602
 [10] setproperties_object
    @ C:\Users\Agarwal Lab\.julia\packages\ConstructionBase\ZLOSb\src\ConstructionBase.jl:186 [inlined]
 [11] setproperties
    @ C:\Users\Agarwal Lab\.julia\packages\ConstructionBase\ZLOSb\src\ConstructionBase.jl:105 [inlined]
 [12] set
    @ C:\Users\Agarwal Lab\.julia\packages\Setfield\NshXm\src\lens.jl:110 [inlined]
 [13] set
    @ C:\Users\Agarwal Lab\.julia\packages\Setfield\NshXm\src\lens.jl:169 [inlined]
 [14] macro expansion
    @ C:\Users\Agarwal Lab\.julia\packages\Setfield\NshXm\src\sugar.jl:192 [inlined]
 [15] update
    @ C:\Users\Agarwal Lab\.julia\packages\BifurcationKit\5kgAI\src\continuation\Palc.jl:93 [inlined]
 [16] continuation(prob::BifurcationProblem{…}, alg::PALC{…}, contparams::ContinuationPar{…}; linear_algo::Nothing, bothside::Bool, kwargs::@Kwargs{})
    @ BifurcationKit C:\Users\Agarwal Lab\.julia\packages\BifurcationKit\5kgAI\src\Continuation.jl:528
 [17] top-level scope
    @ c:\Users\Agarwal Lab\Corentin\Julia\Mitochondrial-dynamics\src\test.jl:32

I am running Julia 1.10, and have the latest version of BifurcationKit (0.3.3)

@CNelias
Copy link
Author

CNelias commented Feb 26, 2024

I think it is an issue of conflicting packages versions, which disappeared after re-installing julia.

@CNelias CNelias closed this as completed Feb 26, 2024
@rveltz
Copy link
Member

rveltz commented Feb 26, 2024

The tutorials are automatically generated, hence they "cannot" error unless you see it on the webpage. The configuration for the run is https://bifurcationkit.github.io/BifurcationKitDocs.jl/dev/#Reproducibility

Do not hesitate to re open it if you see fit

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

No branches or pull requests

2 participants