Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Aug 8, 2024
1 parent a80b83d commit 47aba8a
Show file tree
Hide file tree
Showing 30 changed files with 0 additions and 0 deletions.
14 changes: 0 additions & 14 deletions examples/model_coupling/external-linearmodel-ascii.jl

This file was deleted.

14 changes: 14 additions & 0 deletions examples/model_coupling/external-linearmodel-ascii.jl
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 0 additions & 11 deletions examples/model_coupling/external-linearmodel-ascii.mads

This file was deleted.

11 changes: 11 additions & 0 deletions examples/model_coupling/external-linearmodel-ascii.mads
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions examples/model_coupling/external-linearmodel-jld.jl

This file was deleted.

10 changes: 10 additions & 0 deletions examples/model_coupling/external-linearmodel-jld.jl
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions examples/model_coupling/external-linearmodel-jld.mads

This file was deleted.

13 changes: 13 additions & 0 deletions examples/model_coupling/external-linearmodel-jld.mads
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions examples/model_coupling/external-linearmodel-jld2.jl

This file was deleted.

10 changes: 10 additions & 0 deletions examples/model_coupling/external-linearmodel-jld2.jl
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions examples/model_coupling/external-linearmodel-jld2.mads

This file was deleted.

13 changes: 13 additions & 0 deletions examples/model_coupling/external-linearmodel-jld2.mads
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions examples/model_coupling/external-linearmodel-json-exp.mads

This file was deleted.

12 changes: 12 additions & 0 deletions examples/model_coupling/external-linearmodel-json-exp.mads
Original file line number Diff line number Diff line change
@@ -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
15 changes: 0 additions & 15 deletions examples/model_coupling/external-linearmodel-json.jl

This file was deleted.

15 changes: 15 additions & 0 deletions examples/model_coupling/external-linearmodel-json.jl
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 0 additions & 12 deletions examples/model_coupling/external-linearmodel-json.mads

This file was deleted.

12 changes: 12 additions & 0 deletions examples/model_coupling/external-linearmodel-json.mads
Original file line number Diff line number Diff line change
@@ -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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal-linearmodel-parameters.inst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal-linearmodel-parameters.tpl
14 changes: 0 additions & 14 deletions examples/model_coupling/external-linearmodel-yaml.jl

This file was deleted.

14 changes: 14 additions & 0 deletions examples/model_coupling/external-linearmodel-yaml.jl
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 0 additions & 13 deletions examples/model_coupling/external-linearmodel-yaml.mads

This file was deleted.

13 changes: 13 additions & 0 deletions examples/model_coupling/external-linearmodel-yaml.mads
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion examples/model_coupling/internal-linearmodel.jl

This file was deleted.

1 change: 1 addition & 0 deletions examples/model_coupling/internal-linearmodel.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../models/internal-linear-model/internal-linearmodel.jl
1 change: 0 additions & 1 deletion examples/model_coupling/internal-linearmodel.mads

This file was deleted.

1 change: 1 addition & 0 deletions examples/model_coupling/internal-linearmodel.mads
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../models/internal-linear-model/internal-linearmodel.mads
1 change: 0 additions & 1 deletion examples/montecarlo/internal-linearmodel.jl

This file was deleted.

1 change: 1 addition & 0 deletions examples/montecarlo/internal-linearmodel.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../models/internal-linear-model/internal-linearmodel.jl
1 change: 0 additions & 1 deletion examples/montecarlo/internal-linearmodel.mads

This file was deleted.

1 change: 1 addition & 0 deletions examples/montecarlo/internal-linearmodel.mads
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../models/internal-linear-model/internal-linearmodel.mads
14 changes: 0 additions & 14 deletions examples/optimization/external-ascii-linearmodel.jl

This file was deleted.

14 changes: 14 additions & 0 deletions examples/optimization/external-ascii-linearmodel.jl
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 0 additions & 11 deletions examples/optimization/external-ascii.mads

This file was deleted.

11 changes: 11 additions & 0 deletions examples/optimization/external-ascii.mads
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 47aba8a

Please sign in to comment.