Commit 6cfdcbcb authored by Sylvain Soliman's avatar Sylvain Soliman

Merge branch 'release/4.3.10'

parents 6bd75701 02b2fd51
......@@ -8,7 +8,7 @@
about/0
]).
version('4.3.9').
version('4.3.10').
copyright(
'Copyright (C) 2003-2020 Inria, EPI Lifeware, Saclay-Île de France, France'
......
{
"name": "gui",
"version": "4.3.9",
"version": "4.3.10",
"description": "biocham gui in jupyter notebook",
"main": "src/index.js",
"scripts": {
......
"""Example magic"""
__version__ = '4.3.9'
__version__ = '4.3.10'
......@@ -524,6 +524,9 @@ expand_expression(Expression, ExpandedExpression) :-
!,
expand_expression(NewBody, ExpandedExpression).
expand_expression(Parameter, Value) :-
parameter_value(Parameter, Value),
!.
expand_expression(Expression, ExpandedExpression) :-
grammar_map(
......
......@@ -162,6 +162,7 @@ else
fi
echo "installing python packages ($packages)…"
python3 -m pip install -U $packages
jupyter nbextension enable --py widgetsnbextension
### trust all our notebooks but make them read-only
find . -name '*.ipynb' -print0 | xargs -0 jupyter trust
......
......@@ -370,20 +370,19 @@ solve :-
add_table('numerical_simulation', Table).
gather_fields(Events, Fields) :-
gather_fields(Events, ['Time':t|Fields_tail]) :-
findall(
Field,
(
Field = 'Time': t
;
enumerate_variables(Field)
;
enumerate_nonconstant_parameters(Events, Field)
;
enumerate_nonparametric_functions(Field)
),
Fields
).
Fields_unsorted
),
sort(Fields_unsorted, Fields_tail).
enumerate_variables(Header: x(VariableIndex)) :-
......
......@@ -34,7 +34,10 @@ axes(xy).
:- initial(option(show: {})).
:- initial(option(logscale: '')).
:- initial(option(against: 'Time')).
:- initial(option(xmin:42)).
:- initial(option(ymin:42)).
:- initial(option(xmax:42)).
:- initial(option(ymax:42)).
plot :-
biocham_command,
......@@ -51,6 +54,22 @@ plot :-
against, object, Against,
'Selects the X axis for the plot, defaulting to Time.'
),
option(
xmin, number, _Xmin,
'Select the axes for the current plot (42 is overwrite to *)'
),
option(
ymin, number, _Ymin,
'Select the axes for the current plot (42 is overwrite to *)'
),
option(
xmax, number, _Xmax,
'Select the axes for the current plot (42 is overwrite to *)'
),
option(
ymax, number, _Ymax,
'Select the axes for the current plot (42 is overwrite to *)'
),
doc('
plots the current trace. After a simulation, the trace is composed of molecular concentrations and user-defined functions over time.
\\begin{example}'
......@@ -216,6 +235,8 @@ set format "%.5g"
set style data lines
set datafile separator ","
'),
get_axes(Xmin, Xmax, Ymin, Ymax),
format(Stream, "set xrange [~w:~w]~nset yrange [~w:~w]~n", [Xmin, Xmax, Ymin, Ymax]),
logscale(Axes),
(
Axes == ''
......@@ -276,5 +297,26 @@ handle_show(Show) :-
).
%! get_axes(-Xmin, -Xmax, -Ymin, -Ymax)
%
% retrieve the option values for the axes of gnuplot
get_axes(Xmin, Xmax, Ymin, Ymax) :-
get_one_axe(xmin, Xmin),
get_one_axe(xmax, Xmax),
get_one_axe(ymin, Ymin),
get_one_axe(ymax, Ymax).
get_one_axe(Name, Value) :-
get_option(Name, RawV),
(
RawV = 42
->
Value = '*'
;
Value = RawV
).
unquoted_term_to_atom(T, A) :-
with_output_to(atom(A), write(T)).
......@@ -62,7 +62,7 @@ rosenbrock_init(Epsilon_abs) :-
% Start of the ode solver, cf numerical_simulation.pl for Options
ode_solver([
fields: _,
fields: Fields,
equations: Equations,
initial_values: InitialState,
initial_parameter_values: InitialParameters,
......@@ -102,8 +102,9 @@ ode_solver([
),
nb_getval(variable_list,VariableList),
initialize_functions_list,
add_functions_names(VariableList, Var_Func_List),
assertz(saved_row(['#''Time'|Var_Func_List])), %initialize the label of the numerical table
% add_functions_names(VariableList, Var_Func_List),
initialize_names(Fields, Names),
assertz(saved_row(Names)), %initialize the label of the numerical table
eval_state(InitialState,InitialParameters,TrueInitialState),
split_events(Events, RegularEvents, TimeEvents),
nb_setval(events_list,RegularEvents),
......@@ -114,11 +115,11 @@ ode_solver([
add_functions_values(TrueInitialState, InitialTime, FullState),
SecondRow =.. [row,InitialTime|FullState],
nb_setval(last_row, SecondRow),
assertz(saved_row([InitialTime|FullState])),
log_current_row(InitialTime, FullState, Fields),
TrueInitialTime is InitialTime
),
rosenbrock_init(Epsilon_abs),
rosenbrock(Equations,TrueInitialTime,Duration,MaxStSz,MinStSz,Jacobian),
rosenbrock(Equations,TrueInitialTime,Duration,MaxStSz,MinStSz,Jacobian,Fields),
retractall(k_fail).
......@@ -187,6 +188,37 @@ add_functions_names(VarName, VarFuncName) :-
give_function_name(function(Name, _Expr), Name).
%! initialize_names(+Fields, -Names)
%
% Extract the name of the different fields to be plotted
initialize_names_int([], []).
initialize_names_int([Name:_|FTail], [Name|NTail]) :-
initialize_names_int(FTail, NTail).
initialize_names([Name:_|FTail], [NName|NTail]) :-
atom_concat('# ', Name, NName),
initialize_names_int(FTail, NTail).
%! log_current_row(+Time, +State, +Fields)
log_current_row(Time, State, Fields) :-
prepare_row(Time, State, Fields, ToSave),
assertz(saved_row(ToSave)).
prepare_row(_Time, _State, [], []) :- !.
prepare_row(Time, State, [_N:t|FTail], [Time|VTail]) :-
!,
prepare_row(Time, State, FTail, VTail).
prepare_row(Time, State, [_N:x(N)|FTail], [Val|VTail]) :-
nth0(N, State, Val),
prepare_row(Time, State, FTail, VTail).
%! add_functions_values(+State, +Time, -FullState)
%
% Add the value of all functions to construct the FullState list
......@@ -350,13 +382,13 @@ get_last_row(Time,CurrentState):-
/* Rosenbrock method */
/*********************/
%! rosenbrock(+Equations, +InitialTime, +Duration, +Jacobian)
%! rosenbrock(+Equations, +InitialTime, +Duration, +Max, +Min, +Jacobian, +Fields)
%
% Parameters are stored within the global variable parameters_list
% The current state of the simulation if obtained in the final row of the global
% variable numerical_table
rosenbrock(Equations, InitialTime, Duration, MaxStSz, MinStSz, Jacobian) :-
rosenbrock(Equations, InitialTime, Duration, MaxStSz, MinStSz, Jacobian, Fields) :-
FinalTime is InitialTime + Duration,
StepSizeMax is Duration*MaxStSz,
StepSizeMin is Duration*MinStSz,
......@@ -402,7 +434,8 @@ rosenbrock(Equations, InitialTime, Duration, MaxStSz, MinStSz, Jacobian) :-
add_functions_values(Next_state, Time2, Next_state_full),
NewLine =.. [row,Time2|Next_state_full],
nb_setval(last_row, NewLine),
assertz(saved_row([Time2|Next_state_full])),
log_current_row(Time2, Next_state_full, Fields),
% assertz(saved_row([Time2|Next_state_full])),
nb_setval(last_time,Time2),
Time2 >= FinalTime,!,
%Collect the data for numerical table
......
......@@ -8,7 +8,7 @@ check_integration_1([], _Epsilon) :- !.
check_integration_1([Head|Tail], Epsilon) :-
Head = row(T,A,B),
Sum is A+B, near(1.0, Sum, Epsilon),
Value is exp(-T), near(B, Value, Epsilon),
Value is exp(-T), near(A, Value, Epsilon),
check_integration_1(Tail, Epsilon).
check_integration_2([], _Epsilon) :- !.
......@@ -76,7 +76,7 @@ test(test_time_event, [setup(command(clear_model)), cleanup(command(clear_model)
command(add_event('Time'>=4, k=1)),
command(numerical_simulation(method:rsbk, time:5)),
get_table_data(D),
last(D, row(T,_B,A)),
last(D, row(T,A,_B)),
near(A, exp(2-T), 1e-5).
:- end_tests(rosenbrock).
......@@ -2,4 +2,4 @@
export TOKEN=$( head -c 30 /dev/urandom | xxd -p )
docker run -d --restart=always --net=host -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --expose 8000 --name=proxy jupyterhub/configurable-http-proxy --default-target http://127.0.0.1:9999
docker run -d --restart=always --net=host -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb -v /var/run/docker.sock:/docker.sock jupyter/tmpnb python orchestrate.py --image='registry.gitlab.inria.fr/lifeware/biocham:v4.1.29' --pool-size=40 --command='start.sh biocham --notebook --NotebookApp.base_url={base_path} --NotebookApp.token={token} --ip=0.0.0.0 --port {port}'
docker run -d --restart=always --net=host -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb -v /var/run/docker.sock:/docker.sock jupyter/tmpnb python orchestrate.py --image='registry.gitlab.inria.fr/lifeware/biocham:v4.3.9' --pool-size=40 --command='start.sh biocham --notebook --NotebookApp.base_url={base_path} --NotebookApp.token={token} --ip=0.0.0.0 --port {port}'
......@@ -235,7 +235,7 @@ subst_deg_and_vars(A/N, Vars, Ai, AA - D) :-
!,
subst_deg_and_vars(A, Vars, Ai, AA).
% Only accept division by constants
% Only accept addition of constants
subst_deg_and_vars(N + M, _Vars, _Ai, D) :-
const_degree(N+M, D),
!.
......@@ -263,7 +263,7 @@ const_eval(N, N) :-
const_eval(Term, D) :-
Term =.. [Op, A, B],
member(Op, ['+', '*', '-', '/']),
member(Op, ['+', '*', '-', '^', '/']),
const_eval(A, AA),
const_eval(B, BB),
TTerm =.. [Op, AA, BB],
......
......@@ -32,7 +32,7 @@
</head>
<body>
<h1>The Biochemical Abstract Machine BIOCHAM 4</h1>
<h1>version 4.3.9 January 2020</h1>
<h1>version 4.3.10 January 2020</h1>
<div class="authors">
<p>
......@@ -143,8 +143,11 @@ synthesizing reaction systems for executing imperative programs or computing rea
</l>
<br>
<li><span style="text-decoration: underline;">docker images:</span>&nbsp;
<a href="https://gitlab.inria.fr/lifeware/biocham">https://gitlab.inria.fr/lifeware/biocham/container_registry</a>. </li>
<a
href="https://gitlab.inria.fr/lifeware/biocham/container_registry">https://gitlab.inria.fr/lifeware/biocham/container_registry</a>.<br/>Launch
with <pre>docker run -p 8888:8888 registry.gitlab.inria.fr/lifeware/biocham:[tag]</pre>
You can add <pre>start.sh biocham --notebook --NotebookApp.token=''</pre> if you don't want
token-based authentication.</li>
<br>
<li><span>current notebook version online:</span>&nbsp;
<a href="http://lifeware.inria.fr/biocham4/online/">biocham4 notebook</a>. </li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment