Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Shashi Gowda
    @shashi
    @jiahao JuliaLang/Interact.jl#36 add yours! ;)
    Alex
    @axsk
    is it possible to create a plot signal, which then gets updated in its representation in jupyter notebooks? so that i can update the plots from another cell?
    Shashi Gowda
    @shashi
    @axsk yes.
    using Reactive, Interact
    n = Signal(20)
    map(n->plot(x=rand(n), y=rand(n)), n)

    The other cell:

    push!(n, 20)

    or

    slider(10:100, signal=n)
    Linh17
    @Linh17

    Model

    m = Model(solver = GurobiSolver())
    @defVar(m,Y[k=1:n])
    @defVar(m,X[i=1:n,k=1:n])
    i get n= maximum(b) already
    but for variable it requires an integer number
    how can i push n inside the variable slot?
    Oliver Schulz
    @oschulz
    Is there any way to use Interact with Julia 0.5 already?
    Christoph Ortner
    @cortner

    I noticed that Interact.jl uses ipywidgets. I am currently trying to use the Python package chemview which relies on ipywidgets as well. While I can import it ok, it crashes as soon as I try to create a widget. Trying ipywidgets directly, e.g.,

    using PyCall
    @pyimport ipywidgets
    ipywidgets.IntSlider()

    gives me just a long error message. Looking at Interact.jl I don't really understand how ipywidgets is used. Is this non-trivial thing and just getting a python package to work directly via PyCall won't be possible?

    Shashi Gowda
    @shashi
    Interact.jl doesn't directly deal with ipywidgets, instead it only sends messages to jupyter according to its widgets protocol
    Christoph Ortner
    @cortner
    thanks - do you remember whether there was a good reason for this? I.e., there are fundamental difficulties in trying to use PyCall and the ipywidgets package directly?
    Josef Heinen
    @jheinen
    Interact.jl seems to be broken after updating ipywidgets to version 7.0.0? Does anyone have a solution?
    cjruiz
    @cjruiz
    Hellos, does anyone tried to create an interactive plot with GtkInteract?
    w = mainwindow(title="Simple test")
    n = slider(1:10, label="n")
    m = slider(11:20, label="m")
    cg = cairographic()
    
    append!(w, [n, m, cg])
    
    map(n,m) do n,m
      push!(cg, plot(sin, n*pi, m*pi))
    end
    I tried that program (example in GTKInteract docs) but when i use the slider i get the following error:
    MethodError : no method matching update_view(::Interact.Slider(Int64))
    I used
    using Immerse; using GtkInteract;
    Immerse v= 0.0.13, Interact version =0.5.0,
    jsschlosser
    @jsschlosser
    using Interact
    using DifferentialEquations
    using Latexify
    using Plots 
    gr()
    
    """
    A function which simulates and plots an ODE. 
    
    The system is first equilibrated for an input value of 1.
    The plotted dynamics is the relaxation of the system after the input is changed to 10.
    """
    function plotODE(ode::AbstractParameterizedFunction, parameters, plotvars)
        set_param_values!(ode, parameters)
        ode.input = 1. 
        u0 = fill(1., length(ode.syms))
        ssprob = SteadyStateProblem(ode, u0)
        u0 = solve(ssprob).u
    
        tspan = (0.,10.)
        ode.input = 10. 
        prob = ODEProblem(ode, u0, tspan)
        sol = solve(prob, solver=Rosenbrock23())
    
        plot(sol, vars=plotvars, xlabel="Time", ylabel="Concentration", ylims=[0.,-Inf])
    end
    
    """
    Automatically generate sliders for all the ODE's parameters and map the results 
    to the plotODE function.
    """
    function interactivePlot(ode::AbstractParameterizedFunction)
        display(latexalign(ode))
        params = [slider(-2:0.1:2, label=latexify("$p"), value=log10(getfield(ode, p))) 
            for p in ode.params]
        plotvars = selection(ode.syms, multi=true)
    
        display(hbox(vbox(params[2:end]...), plotvars))
    
        map((x...)->plotODE(ode, 10. .^collect(x[1:end-1]), x[end]), 
            signal.(params)..., signal(plotvars))
    end
    
    """
    Define some ODEs
    """
    
    input=1.0
    r_x=>1.0
    e_x=>1.0 
    r_y=>1.0 
    e_y=>1.0
    
    ode1 = @ode_def negativeFeedback begin
        dx = r_x * (e_x * input * y - x)
        dy = r_y * (e_y / x - y)
    end 
    
    
    ode2 = @ode_def incoherentFeedForward begin
        dx = r_x * (e_x * input - x)
        dy = r_y * (e_y * input / x - y)
    end
    interactivePlot(ode2)
    I have tried this code and I get:
    UndefVarError: set_param_values! not defined
    
    Stacktrace:
     [1] plotODE at .\In[13]:14 [inlined]
     [2] (::##46#49{incoherentFeedForward})(::Array{Any,1}, ::Vararg{Array{Any,1},N} where N) at .\In[13]:40
     [3] map(::Function, ::Reactive.Signal{Array{Any,1}}) at C:\Users\Joseph\.julia\v0.6\Reactive\src\operators.jl:32
     [4] interactivePlot(::incoherentFeedForward) at .\In[13]:40
     [5] include_string(::String, ::String) at .\loading.jl:515
    any help?
    Niklas Korsbo
    @korsbo
    @jsschlosser I'm seeing this a few months late, but the problem is that DifferentialEquations changed a lot since I made that example. Parameters are now passed directly to ODEProblem and is not a property which resides within the ParameterizedFunction. I'll update the example so that it works with the new DifferentialEquations API.
    Niklas Korsbo
    @korsbo
    The JuliaGizmos/Interact.jl#36 is now updated and working (until the next API change).
    fargolo
    @fargolo
    Dear colleagues,
    I have a widget working on juno, but on responsive on mux.
    Any help?