diff --git a/examples/model_coupling/external-linearmodel-ascii.jl b/examples/model_coupling/external-linearmodel-ascii.jl deleted file mode 120000 index 75b46a9a..00000000 --- a/examples/model_coupling/external-linearmodel-ascii.jl +++ /dev/null @@ -1,14 +0,0 @@ -#TODO this does NOT work; `parameters` are not required to be Ordered Dictionary -paramfile = open("parameters.dat") -parameters = Meta.parse.(readlines(paramfile)) -close(paramfile) - -f(t) = parameters[1] * t - parameters[2] # a * t - b; linear model -times = 1:4 -predictions = map(f, times) - -predicfile = open("predictions.dat", "w") -for prediction in predictions - write(predicfile, string(prediction, "\n")) -end -close(predicfile) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-ascii.jl b/examples/model_coupling/external-linearmodel-ascii.jl new file mode 100644 index 00000000..75b46a9a --- /dev/null +++ b/examples/model_coupling/external-linearmodel-ascii.jl @@ -0,0 +1,14 @@ +#TODO this does NOT work; `parameters` are not required to be Ordered Dictionary +paramfile = open("parameters.dat") +parameters = Meta.parse.(readlines(paramfile)) +close(paramfile) + +f(t) = parameters[1] * t - parameters[2] # a * t - b; linear model +times = 1:4 +predictions = map(f, times) + +predicfile = open("predictions.dat", "w") +for prediction in predictions + write(predicfile, string(prediction, "\n")) +end +close(predicfile) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-ascii.mads b/examples/model_coupling/external-linearmodel-ascii.mads deleted file mode 120000 index 33b8c7ed..00000000 --- a/examples/model_coupling/external-linearmodel-ascii.mads +++ /dev/null @@ -1,11 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-ascii.jl" -ASCIIParameters: parameters.dat -ASCIIPredictions: predictions.dat diff --git a/examples/model_coupling/external-linearmodel-ascii.mads b/examples/model_coupling/external-linearmodel-ascii.mads new file mode 100644 index 00000000..33b8c7ed --- /dev/null +++ b/examples/model_coupling/external-linearmodel-ascii.mads @@ -0,0 +1,11 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-ascii.jl" +ASCIIParameters: parameters.dat +ASCIIPredictions: predictions.dat diff --git a/examples/model_coupling/external-linearmodel-jld.jl b/examples/model_coupling/external-linearmodel-jld.jl deleted file mode 120000 index 101dd562..00000000 --- a/examples/model_coupling/external-linearmodel-jld.jl +++ /dev/null @@ -1,10 +0,0 @@ -import JLD -import OrderedCollections - -parameters = JLD.load("parameters.jld") # JLD file created to write current model parameters -JLD -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -JLD.save("predictions.jld", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-jld.jl b/examples/model_coupling/external-linearmodel-jld.jl new file mode 100644 index 00000000..101dd562 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-jld.jl @@ -0,0 +1,10 @@ +import JLD +import OrderedCollections + +parameters = JLD.load("parameters.jld") # JLD file created to write current model parameters +JLD +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +JLD.save("predictions.jld", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-jld.mads b/examples/model_coupling/external-linearmodel-jld.mads deleted file mode 120000 index f136c215..00000000 --- a/examples/model_coupling/external-linearmodel-jld.mads +++ /dev/null @@ -1,13 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-jld.jl" -JLDParameters: parameters.jld -JLDPredictions: -- predictions.jld diff --git a/examples/model_coupling/external-linearmodel-jld.mads b/examples/model_coupling/external-linearmodel-jld.mads new file mode 100644 index 00000000..f136c215 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-jld.mads @@ -0,0 +1,13 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-jld.jl" +JLDParameters: parameters.jld +JLDPredictions: +- predictions.jld diff --git a/examples/model_coupling/external-linearmodel-jld2.jl b/examples/model_coupling/external-linearmodel-jld2.jl deleted file mode 120000 index 4f5a50a6..00000000 --- a/examples/model_coupling/external-linearmodel-jld2.jl +++ /dev/null @@ -1,10 +0,0 @@ -import JLD2 -import OrderedCollections - -parameters = JLD2.load("parameters.jld2") # JLD file created to write current model parameters - -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -JLD2.save("predictions.jld2", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-jld2.jl b/examples/model_coupling/external-linearmodel-jld2.jl new file mode 100644 index 00000000..4f5a50a6 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-jld2.jl @@ -0,0 +1,10 @@ +import JLD2 +import OrderedCollections + +parameters = JLD2.load("parameters.jld2") # JLD file created to write current model parameters + +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +JLD2.save("predictions.jld2", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-jld2.mads b/examples/model_coupling/external-linearmodel-jld2.mads deleted file mode 120000 index 3cfbefba..00000000 --- a/examples/model_coupling/external-linearmodel-jld2.mads +++ /dev/null @@ -1,13 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-jld2.jl" -JLDParameters: parameters.jld2 -JLDPredictions: -- predictions.jld2 diff --git a/examples/model_coupling/external-linearmodel-jld2.mads b/examples/model_coupling/external-linearmodel-jld2.mads new file mode 100644 index 00000000..3cfbefba --- /dev/null +++ b/examples/model_coupling/external-linearmodel-jld2.mads @@ -0,0 +1,13 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-jld2.jl" +JLDParameters: parameters.jld2 +JLDPredictions: +- predictions.jld2 diff --git a/examples/model_coupling/external-linearmodel-json-exp.mads b/examples/model_coupling/external-linearmodel-json-exp.mads deleted file mode 120000 index d520fd0c..00000000 --- a/examples/model_coupling/external-linearmodel-json-exp.mads +++ /dev/null @@ -1,12 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", exp: a*-1 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-json.jl" -JSONParameters: parameters.json -JSONPredictions: -- predictions.json diff --git a/examples/model_coupling/external-linearmodel-json-exp.mads b/examples/model_coupling/external-linearmodel-json-exp.mads new file mode 100644 index 00000000..d520fd0c --- /dev/null +++ b/examples/model_coupling/external-linearmodel-json-exp.mads @@ -0,0 +1,12 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", exp: a*-1 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-json.jl" +JSONParameters: parameters.json +JSONPredictions: +- predictions.json diff --git a/examples/model_coupling/external-linearmodel-json.jl b/examples/model_coupling/external-linearmodel-json.jl deleted file mode 120000 index e621c50f..00000000 --- a/examples/model_coupling/external-linearmodel-json.jl +++ /dev/null @@ -1,15 +0,0 @@ -import JSON -import OrderedCollections - -parameters = JSON.parsefile("parameters.json") -@show parameters - -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -@show map(i -> string("o", i), times), map(f, times) -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -@show predictions -jo = open("predictions.json", "w") -JSON.print(jo, predictions) -close(jo) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-json.jl b/examples/model_coupling/external-linearmodel-json.jl new file mode 100644 index 00000000..e621c50f --- /dev/null +++ b/examples/model_coupling/external-linearmodel-json.jl @@ -0,0 +1,15 @@ +import JSON +import OrderedCollections + +parameters = JSON.parsefile("parameters.json") +@show parameters + +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +@show map(i -> string("o", i), times), map(f, times) +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +@show predictions +jo = open("predictions.json", "w") +JSON.print(jo, predictions) +close(jo) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-json.mads b/examples/model_coupling/external-linearmodel-json.mads deleted file mode 120000 index 4aa2a16f..00000000 --- a/examples/model_coupling/external-linearmodel-json.mads +++ /dev/null @@ -1,12 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-json.jl" -JSONParameters: parameters.json -JSONPredictions: -- predictions.json diff --git a/examples/model_coupling/external-linearmodel-json.mads b/examples/model_coupling/external-linearmodel-json.mads new file mode 100644 index 00000000..4aa2a16f --- /dev/null +++ b/examples/model_coupling/external-linearmodel-json.mads @@ -0,0 +1,12 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-json.jl" +JSONParameters: parameters.json +JSONPredictions: +- predictions.json diff --git a/examples/model_coupling/external-linearmodel-parameters.inst b/examples/model_coupling/external-linearmodel-parameters.inst deleted file mode 120000 index 4a92c7a6..00000000 --- a/examples/model_coupling/external-linearmodel-parameters.inst +++ /dev/null @@ -1 +0,0 @@ -internal-linearmodel-parameters.inst \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-parameters.inst b/examples/model_coupling/external-linearmodel-parameters.inst new file mode 100644 index 00000000..4a92c7a6 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-parameters.inst @@ -0,0 +1 @@ +internal-linearmodel-parameters.inst \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-parameters.tpl b/examples/model_coupling/external-linearmodel-parameters.tpl deleted file mode 120000 index 4704ee1d..00000000 --- a/examples/model_coupling/external-linearmodel-parameters.tpl +++ /dev/null @@ -1 +0,0 @@ -internal-linearmodel-parameters.tpl \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-parameters.tpl b/examples/model_coupling/external-linearmodel-parameters.tpl new file mode 100644 index 00000000..4704ee1d --- /dev/null +++ b/examples/model_coupling/external-linearmodel-parameters.tpl @@ -0,0 +1 @@ +internal-linearmodel-parameters.tpl \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-yaml.jl b/examples/model_coupling/external-linearmodel-yaml.jl deleted file mode 120000 index d771a085..00000000 --- a/examples/model_coupling/external-linearmodel-yaml.jl +++ /dev/null @@ -1,14 +0,0 @@ -import OrderedCollections -import YAML - -parameters = YAML.load("parameters.yaml") -if isfile(parameters) - parameters = YAML.load_file(parameters) -end - -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -@show predictions -YAML.write_file("predictions.yaml", predictions) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-yaml.jl b/examples/model_coupling/external-linearmodel-yaml.jl new file mode 100644 index 00000000..d771a085 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-yaml.jl @@ -0,0 +1,14 @@ +import OrderedCollections +import YAML + +parameters = YAML.load("parameters.yaml") +if isfile(parameters) + parameters = YAML.load_file(parameters) +end + +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +@show predictions +YAML.write_file("predictions.yaml", predictions) \ No newline at end of file diff --git a/examples/model_coupling/external-linearmodel-yaml.mads b/examples/model_coupling/external-linearmodel-yaml.mads deleted file mode 120000 index d43eb2c2..00000000 --- a/examples/model_coupling/external-linearmodel-yaml.mads +++ /dev/null @@ -1,13 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-yaml.jl" -YAMLParameters: parameters.yaml -YAMLPredictions: -- predictions.yaml diff --git a/examples/model_coupling/external-linearmodel-yaml.mads b/examples/model_coupling/external-linearmodel-yaml.mads new file mode 100644 index 00000000..d43eb2c2 --- /dev/null +++ b/examples/model_coupling/external-linearmodel-yaml.mads @@ -0,0 +1,13 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-yaml.jl" +YAMLParameters: parameters.yaml +YAMLPredictions: +- predictions.yaml diff --git a/examples/model_coupling/internal-linearmodel.jl b/examples/model_coupling/internal-linearmodel.jl deleted file mode 120000 index 901bf177..00000000 --- a/examples/model_coupling/internal-linearmodel.jl +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/model_coupling/internal-linearmodel.jl b/examples/model_coupling/internal-linearmodel.jl new file mode 100644 index 00000000..901bf177 --- /dev/null +++ b/examples/model_coupling/internal-linearmodel.jl @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/model_coupling/internal-linearmodel.mads b/examples/model_coupling/internal-linearmodel.mads deleted file mode 120000 index 71417293..00000000 --- a/examples/model_coupling/internal-linearmodel.mads +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/model_coupling/internal-linearmodel.mads b/examples/model_coupling/internal-linearmodel.mads new file mode 100644 index 00000000..71417293 --- /dev/null +++ b/examples/model_coupling/internal-linearmodel.mads @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/montecarlo/internal-linearmodel.jl b/examples/montecarlo/internal-linearmodel.jl deleted file mode 120000 index 901bf177..00000000 --- a/examples/montecarlo/internal-linearmodel.jl +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/montecarlo/internal-linearmodel.jl b/examples/montecarlo/internal-linearmodel.jl new file mode 100644 index 00000000..901bf177 --- /dev/null +++ b/examples/montecarlo/internal-linearmodel.jl @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/montecarlo/internal-linearmodel.mads b/examples/montecarlo/internal-linearmodel.mads deleted file mode 120000 index 71417293..00000000 --- a/examples/montecarlo/internal-linearmodel.mads +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/montecarlo/internal-linearmodel.mads b/examples/montecarlo/internal-linearmodel.mads new file mode 100644 index 00000000..71417293 --- /dev/null +++ b/examples/montecarlo/internal-linearmodel.mads @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/optimization/external-ascii-linearmodel.jl b/examples/optimization/external-ascii-linearmodel.jl deleted file mode 120000 index 75b46a9a..00000000 --- a/examples/optimization/external-ascii-linearmodel.jl +++ /dev/null @@ -1,14 +0,0 @@ -#TODO this does NOT work; `parameters` are not required to be Ordered Dictionary -paramfile = open("parameters.dat") -parameters = Meta.parse.(readlines(paramfile)) -close(paramfile) - -f(t) = parameters[1] * t - parameters[2] # a * t - b; linear model -times = 1:4 -predictions = map(f, times) - -predicfile = open("predictions.dat", "w") -for prediction in predictions - write(predicfile, string(prediction, "\n")) -end -close(predicfile) \ No newline at end of file diff --git a/examples/optimization/external-ascii-linearmodel.jl b/examples/optimization/external-ascii-linearmodel.jl new file mode 100644 index 00000000..75b46a9a --- /dev/null +++ b/examples/optimization/external-ascii-linearmodel.jl @@ -0,0 +1,14 @@ +#TODO this does NOT work; `parameters` are not required to be Ordered Dictionary +paramfile = open("parameters.dat") +parameters = Meta.parse.(readlines(paramfile)) +close(paramfile) + +f(t) = parameters[1] * t - parameters[2] # a * t - b; linear model +times = 1:4 +predictions = map(f, times) + +predicfile = open("predictions.dat", "w") +for prediction in predictions + write(predicfile, string(prediction, "\n")) +end +close(predicfile) \ No newline at end of file diff --git a/examples/optimization/external-ascii.mads b/examples/optimization/external-ascii.mads deleted file mode 120000 index 33b8c7ed..00000000 --- a/examples/optimization/external-ascii.mads +++ /dev/null @@ -1,11 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-ascii.jl" -ASCIIParameters: parameters.dat -ASCIIPredictions: predictions.dat diff --git a/examples/optimization/external-ascii.mads b/examples/optimization/external-ascii.mads new file mode 100644 index 00000000..33b8c7ed --- /dev/null +++ b/examples/optimization/external-ascii.mads @@ -0,0 +1,11 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-ascii.jl" +ASCIIParameters: parameters.dat +ASCIIPredictions: predictions.dat diff --git a/examples/optimization/external-jld-linearmodel.jl b/examples/optimization/external-jld-linearmodel.jl deleted file mode 120000 index 32bb131c..00000000 --- a/examples/optimization/external-jld-linearmodel.jl +++ /dev/null @@ -1,11 +0,0 @@ -import JLD - -import OrderedCollections - -parameters = JLD2.load("parameters.jld") # JLD file created to write current model parameters - -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -JLD2.save("predictions.jld", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/optimization/external-jld-linearmodel.jl b/examples/optimization/external-jld-linearmodel.jl new file mode 100644 index 00000000..32bb131c --- /dev/null +++ b/examples/optimization/external-jld-linearmodel.jl @@ -0,0 +1,11 @@ +import JLD + +import OrderedCollections + +parameters = JLD2.load("parameters.jld") # JLD file created to write current model parameters + +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +JLD2.save("predictions.jld", predictions) # JLD file created to write current model predictions \ No newline at end of file diff --git a/examples/optimization/external-jld.mads b/examples/optimization/external-jld.mads deleted file mode 120000 index f136c215..00000000 --- a/examples/optimization/external-jld.mads +++ /dev/null @@ -1,13 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-jld.jl" -JLDParameters: parameters.jld -JLDPredictions: -- predictions.jld diff --git a/examples/optimization/external-jld.mads b/examples/optimization/external-jld.mads new file mode 100644 index 00000000..f136c215 --- /dev/null +++ b/examples/optimization/external-jld.mads @@ -0,0 +1,13 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-jld.jl" +JLDParameters: parameters.jld +JLDPredictions: +- predictions.jld diff --git a/examples/optimization/external-yaml-linearmodel.jl b/examples/optimization/external-yaml-linearmodel.jl deleted file mode 120000 index d771a085..00000000 --- a/examples/optimization/external-yaml-linearmodel.jl +++ /dev/null @@ -1,14 +0,0 @@ -import OrderedCollections -import YAML - -parameters = YAML.load("parameters.yaml") -if isfile(parameters) - parameters = YAML.load_file(parameters) -end - -f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model -times = 1:4 -predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) - -@show predictions -YAML.write_file("predictions.yaml", predictions) \ No newline at end of file diff --git a/examples/optimization/external-yaml-linearmodel.jl b/examples/optimization/external-yaml-linearmodel.jl new file mode 100644 index 00000000..d771a085 --- /dev/null +++ b/examples/optimization/external-yaml-linearmodel.jl @@ -0,0 +1,14 @@ +import OrderedCollections +import YAML + +parameters = YAML.load("parameters.yaml") +if isfile(parameters) + parameters = YAML.load_file(parameters) +end + +f(t) = parameters["a"] * t - parameters["b"] # a * t - b; linear model +times = 1:4 +predictions = OrderedCollections.OrderedDict(zip(map(i -> string("o", i), times), map(f, times))) + +@show predictions +YAML.write_file("predictions.yaml", predictions) \ No newline at end of file diff --git a/examples/optimization/external-yaml.mads b/examples/optimization/external-yaml.mads deleted file mode 120000 index d43eb2c2..00000000 --- a/examples/optimization/external-yaml.mads +++ /dev/null @@ -1,13 +0,0 @@ -Parameters: -- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } -- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } -Observations: -- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} -- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} -- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} -- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} -Command: "julia external-linearmodel-yaml.jl" -YAMLParameters: parameters.yaml -YAMLPredictions: -- predictions.yaml diff --git a/examples/optimization/external-yaml.mads b/examples/optimization/external-yaml.mads new file mode 100644 index 00000000..d43eb2c2 --- /dev/null +++ b/examples/optimization/external-yaml.mads @@ -0,0 +1,13 @@ +Parameters: +- a : { longname: "parameter a", init: 1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- b : { longname: "parameter b", init: -1, type: opt, log: no, step: 0.1, min: -10, max: 10 } +- c : { longname: "parameter b", init: -1, type: null, log: no, step: 0.1, min: -10, max: 10 } +Observations: +- o1: { longname: "observation 1", log: false, max: 20, min: -20, target: -3, weight: 1} +- o2: { longname: "observation 2", log: false, max: 20, min: -20, target: 1, weight: 1} +- o3: { longname: "observation 3", log: false, max: 20, min: -20, target: 5, weight: 1} +- o4: { longname: "observation 4", log: false, max: 20, min: -20, target: 9, weight: 1} +Command: "julia external-linearmodel-yaml.jl" +YAMLParameters: parameters.yaml +YAMLPredictions: +- predictions.yaml diff --git a/examples/optimization/internal-linearmodel+template.jl b/examples/optimization/internal-linearmodel+template.jl deleted file mode 120000 index a51f338f..00000000 --- a/examples/optimization/internal-linearmodel+template.jl +++ /dev/null @@ -1 +0,0 @@ -../model_coupling/internal-linearmodel+template.jl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel+template.jl b/examples/optimization/internal-linearmodel+template.jl new file mode 100644 index 00000000..a51f338f --- /dev/null +++ b/examples/optimization/internal-linearmodel+template.jl @@ -0,0 +1 @@ +../model_coupling/internal-linearmodel+template.jl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel+template.mads b/examples/optimization/internal-linearmodel+template.mads deleted file mode 120000 index 01a32d95..00000000 --- a/examples/optimization/internal-linearmodel+template.mads +++ /dev/null @@ -1 +0,0 @@ -../model_coupling/internal-linearmodel+template.mads \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel+template.mads b/examples/optimization/internal-linearmodel+template.mads new file mode 100644 index 00000000..01a32d95 --- /dev/null +++ b/examples/optimization/internal-linearmodel+template.mads @@ -0,0 +1 @@ +../model_coupling/internal-linearmodel+template.mads \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel-parameters.tpl b/examples/optimization/internal-linearmodel-parameters.tpl deleted file mode 120000 index 47678d3c..00000000 --- a/examples/optimization/internal-linearmodel-parameters.tpl +++ /dev/null @@ -1 +0,0 @@ -../model_coupling/internal-linearmodel-parameters.tpl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel-parameters.tpl b/examples/optimization/internal-linearmodel-parameters.tpl new file mode 100644 index 00000000..47678d3c --- /dev/null +++ b/examples/optimization/internal-linearmodel-parameters.tpl @@ -0,0 +1 @@ +../model_coupling/internal-linearmodel-parameters.tpl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel.jl b/examples/optimization/internal-linearmodel.jl deleted file mode 120000 index 901bf177..00000000 --- a/examples/optimization/internal-linearmodel.jl +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel.jl b/examples/optimization/internal-linearmodel.jl new file mode 100644 index 00000000..901bf177 --- /dev/null +++ b/examples/optimization/internal-linearmodel.jl @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.jl \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel.mads b/examples/optimization/internal-linearmodel.mads deleted file mode 120000 index 71417293..00000000 --- a/examples/optimization/internal-linearmodel.mads +++ /dev/null @@ -1 +0,0 @@ -../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/optimization/internal-linearmodel.mads b/examples/optimization/internal-linearmodel.mads new file mode 100644 index 00000000..71417293 --- /dev/null +++ b/examples/optimization/internal-linearmodel.mads @@ -0,0 +1 @@ +../models/internal-linear-model/internal-linearmodel.mads \ No newline at end of file diff --git a/examples/svr/svr.jl b/examples/svr/svr.jl deleted file mode 120000 index 32332837..00000000 --- a/examples/svr/svr.jl +++ /dev/null @@ -1,44 +0,0 @@ -import Mads - -@info("Support Vector Regression (SVR) analysis") - -Random.seed!(2017) - -md = Mads.loadmadsfile(joinpath("..", "models", "internal-polynomial-model", "internal-polynomial.mads")) -rootname = Mads.getmadsrootname(md) -svrexec, svrread, svrsave, svrclean = Mads.makesvrmodel(md, 100) - -numberofsamples = 100 -paramdict = Mads.getparamrandom(md, numberofsamples) -paramarray = hcat(map(i->collect(paramdict[i]), keys(paramdict))...) -predictions = Mads.forward(md, paramdict)' - -Mads.madsinfo("Model predictions ...") -Mads.spaghettiplot(md, predictions, keyword="w13a-model", format="PNG") -Mads.display("$rootname-w13a-model-$numberofsamples-spaghetti.png") - -@time svrpredictions = svrexec(paramarray) -@info("SVR discrepancy $(maximum(abs.(svrpredictions .- predictions)))") - -Mads.madsinfo("SVR predictions ...") -Mads.spaghettiplot(md, svrpredictions, keyword="w13a-svr", format="PNG") -Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png") - -sa = Mads.efast(md) -Mads.plotobsSAresults(md, sa, format="PNG") -Mads.display("$rootname-efast-385.png") - -mdsvr = deepcopy(md) -mdsvr["Julia model"] = svrexec -mdsvr["Filename"] = "$rootname-svr.mads" - -sasvr = Mads.efast(mdsvr) -Mads.plotobsSAresults(mdsvr, sasvr, format="PNG") -Mads.display("$rootname-svr-efast-385.png") - -svrsave() -svrclean() -svrread() -svrclean() - -Mads.rmdir("svrmodels") \ No newline at end of file diff --git a/examples/svr/svr.jl b/examples/svr/svr.jl new file mode 100644 index 00000000..32332837 --- /dev/null +++ b/examples/svr/svr.jl @@ -0,0 +1,44 @@ +import Mads + +@info("Support Vector Regression (SVR) analysis") + +Random.seed!(2017) + +md = Mads.loadmadsfile(joinpath("..", "models", "internal-polynomial-model", "internal-polynomial.mads")) +rootname = Mads.getmadsrootname(md) +svrexec, svrread, svrsave, svrclean = Mads.makesvrmodel(md, 100) + +numberofsamples = 100 +paramdict = Mads.getparamrandom(md, numberofsamples) +paramarray = hcat(map(i->collect(paramdict[i]), keys(paramdict))...) +predictions = Mads.forward(md, paramdict)' + +Mads.madsinfo("Model predictions ...") +Mads.spaghettiplot(md, predictions, keyword="w13a-model", format="PNG") +Mads.display("$rootname-w13a-model-$numberofsamples-spaghetti.png") + +@time svrpredictions = svrexec(paramarray) +@info("SVR discrepancy $(maximum(abs.(svrpredictions .- predictions)))") + +Mads.madsinfo("SVR predictions ...") +Mads.spaghettiplot(md, svrpredictions, keyword="w13a-svr", format="PNG") +Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png") + +sa = Mads.efast(md) +Mads.plotobsSAresults(md, sa, format="PNG") +Mads.display("$rootname-efast-385.png") + +mdsvr = deepcopy(md) +mdsvr["Julia model"] = svrexec +mdsvr["Filename"] = "$rootname-svr.mads" + +sasvr = Mads.efast(mdsvr) +Mads.plotobsSAresults(mdsvr, sasvr, format="PNG") +Mads.display("$rootname-svr-efast-385.png") + +svrsave() +svrclean() +svrread() +svrclean() + +Mads.rmdir("svrmodels") \ No newline at end of file diff --git a/src/madsjl.jl b/src/madsjl.jl old mode 100755 new mode 100644