demonstation
This commit is contained in:
parent
e2752161c3
commit
b7f6d284a7
|
|
@ -1,6 +1,7 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from fn.func import curried
|
||||||
|
|
||||||
from SimCAD import configs
|
from SimCAD import configs
|
||||||
from SimCAD.configuration import Configuration
|
from SimCAD.configuration import Configuration
|
||||||
|
|
@ -38,18 +39,32 @@ def s1m1(step, sL, s, _input):
|
||||||
y = 's1'
|
y = 's1'
|
||||||
x = _input['param1'] #+ [Coef1 x 5]
|
x = _input['param1'] #+ [Coef1 x 5]
|
||||||
return (y, x)
|
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):
|
def s2m1(step, sL, s, _input):
|
||||||
y = 's2'
|
y = 's2'
|
||||||
x = _input['param2'] #+ [Coef2 x 5]
|
x = _input['param2'] + param
|
||||||
return (y, x)
|
return (y, x)
|
||||||
|
|
||||||
s2m1 = sweep(
|
s2m1_params =[Decimal(11.0), Decimal(22.0)]
|
||||||
params = [Decimal(11.0), Decimal(22.0)],
|
@curried
|
||||||
sweep_f = lambda param: lambda step, sL, s, _input: (
|
def s2m1(param, step, sL, s, _input):
|
||||||
's2',
|
y = 's2'
|
||||||
s['s2'] + param
|
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):
|
def s1m2(step, sL, s, _input):
|
||||||
y = 's1'
|
y = 's1'
|
||||||
|
|
@ -87,7 +102,6 @@ es3p1 = sweep(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def es4p2(step, sL, s, _input):
|
def es4p2(step, sL, s, _input):
|
||||||
y = 's4'
|
y = 's4'
|
||||||
x = s['s4'] * bound_norm_random(seed['b'], proc_one_coef_A, proc_one_coef_B)
|
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
|
# need at least 1 behaviour and 1 state function for the 1st mech with behaviors
|
||||||
# mechanisms = {}
|
# mechanisms = {}
|
||||||
|
|
||||||
mechanisms = {
|
mechanisms = {
|
||||||
"m1": {
|
"m1": {
|
||||||
"behaviors": {
|
"behaviors": {
|
||||||
|
|
@ -155,7 +168,7 @@ mechanisms = {
|
||||||
},
|
},
|
||||||
"states": { # exclude only. TypeError: reduce() of empty sequence with no initial value
|
"states": { # exclude only. TypeError: reduce() of empty sequence with no initial value
|
||||||
"s1": s1m1,
|
"s1": s1m1,
|
||||||
"s2": s2m1
|
"s2": sweep(s2m1_params, s2m1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"m2": {
|
"m2": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue