From b7f6d284a7543cb891e1ac8d6ed8d99a5bf18e40 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Thu, 13 Dec 2018 23:44:35 -0500 Subject: [PATCH] demonstation --- simulations/validation/config1.py | 35 +++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/simulations/validation/config1.py b/simulations/validation/config1.py index e9a01c5..f1bb962 100644 --- a/simulations/validation/config1.py +++ b/simulations/validation/config1.py @@ -1,6 +1,7 @@ from decimal import Decimal import numpy as np from datetime import timedelta +from fn.func import curried from SimCAD import configs from SimCAD.configuration import Configuration @@ -38,18 +39,32 @@ def s1m1(step, sL, s, _input): y = 's1' x = _input['param1'] #+ [Coef1 x 5] return (y, x) + + + +# curry to give sweep_f s2m1 and returning a s2m1 sweep_f(s2m1)(param) +# decorator +param = Decimal(11.0) def s2m1(step, sL, s, _input): y = 's2' - x = _input['param2'] #+ [Coef2 x 5] + x = _input['param2'] + param return (y, x) -s2m1 = sweep( - params = [Decimal(11.0), Decimal(22.0)], - sweep_f = lambda param: lambda step, sL, s, _input: ( - 's2', - s['s2'] + param - ) -) +s2m1_params =[Decimal(11.0), Decimal(22.0)] +@curried +def s2m1(param, step, sL, s, _input): + y = 's2' + x = _input['param2'] + param + return (y, x) + + +# s2m1_sweep = s2m1(param=s2m1_params) + +# +# s2m1_sweep = sweep( +# params = s2m1_params, +# sweep_f = s2m1_sweep +# ) def s1m2(step, sL, s, _input): y = 's1' @@ -87,7 +102,6 @@ es3p1 = sweep( ) ) - def es4p2(step, sL, s, _input): y = 's4' x = s['s4'] * bound_norm_random(seed['b'], proc_one_coef_A, proc_one_coef_B) @@ -146,7 +160,6 @@ env_processes = { # need at least 1 behaviour and 1 state function for the 1st mech with behaviors # mechanisms = {} - mechanisms = { "m1": { "behaviors": { @@ -155,7 +168,7 @@ mechanisms = { }, "states": { # exclude only. TypeError: reduce() of empty sequence with no initial value "s1": s1m1, - "s2": s2m1 + "s2": sweep(s2m1_params, s2m1) } }, "m2": {