Combining ExperimentData objects
The previous sections demonstrate how we can add data from an ODEProblem, FMU or a Dataset source in order to produce an ExperimentData object that would be used to train a DigitalEcho. In some scenarios, the complete data can come from multiple sources such as a combination of a Dataset and simulations from either ODEProblem or FMUs. In such a scenario, we would want to combine both the sources into a single ExperimentData object. 
For this demonstration, we will use the dataset from the Including Data from a Dataset manual and combine it with simulations from an ODEProblem source.
using JuliaHub, JLSO, DataGeneration
using OrdinaryDiffEqWe start by downloading the dataset, and loading it into an ExperimentData.
train_dataset_name = "robertson"
path_to_dataset = JuliaHub.download_dataset(("juliasimtutorials", train_dataset_name), "path to save");train_data = JLSO.load(path_to_dataset)[:result]
ed_dataset = ExperimentData(train_data) Number of Trajectories in ExperimentData: 100 
  Basic Statistics for Given Dynamical System's Specifications 
  Number of u0s in the ExperimentData: 3 
  Number of ps in the ExperimentData: 3 
 ╭─────────┬──────────────────────────────────────────────────────────────────...
──────╮...
│  Field  │...
           │...
├─────────┼──────────────────────────────────────────────────────────────────...
──────┤...
│         │     ╭────────────┬──────────────┬──────────────┬────────┬────────...
│         │     │   Labels   │  LowerBound  │  UpperBound  │  Mean  │  StdDev...
│         │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │  states_1  │      1       │      1       │   1    │...
│   u0s   │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │     ⋮      │      ⋮       │      ⋮       │   ⋮    │...
│         │     │     ⋮      │      ⋮       │      ⋮       │   ⋮    │...
│         │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │  states_3  │      0       │      0       │   0    │...
│         │     ╰────────────┴──────────────┴──────────────┴────────┴────────...
├─────────┼──────────────────────────────────────────────────────────────────...
──────┤...
│         │  ╭──────────┬──────────────┬──────────────┬─────────────┬────────...
│         │  │  Labels  │  LowerBound  │  UpperBound  │    Mean     │...
│         │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │   p_1    │  0.0360625   │  0.0439375   │  0.0399687  │  0.0023...
│   ps    │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │    ⋮     │      ⋮       │      ⋮       │      ⋮      │...
│         │  │    ⋮     │      ⋮       │      ⋮       │      ⋮      │...
│         │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │   p_3    │   9015.62    │   10992.2    │   10007.2   │...
│         │  ╰──────────┴──────────────┴──────────────┴─────────────┴────────...
╰─────────┴──────────────────────────────────────────────────────────────────...
──────╯...
 Basic Statistics for Given Dynamical System's Continuous Fields 
  Number of states in the ExperimentData: 3 
 ╭──────────┬─────────────────────────────────────────────────────────────────...
───────╮...
│  Field   │...
            │...
├──────────┼─────────────────────────────────────────────────────────────────...
───────┤...
│          │  ╭────────────┬──────────────┬──────────────┬────────────┬──────...
│          │  │   Labels   │  LowerBound  │  UpperBound  │    Mean    │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_1  │  0.0811106   │      1       │  0.586675  │...
│  states  │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_3  │      0       │   0.918889   │  0.413314  │...
│          │  ╰────────────┴──────────────┴──────────────┴────────────┴──────...
╰──────────┴─────────────────────────────────────────────────────────────────...
───────╯...
Now we simulate the Robertson model using an ODEProblem.
function rober(u, p, t)
    y₁, y₂, y₃ = u
    k₁, k₂, k₃ = p
    [-k₁ * y₁ + k₃ * y₂ * y₃;
        k₁ * y₁ - k₂ * y₂^2 - k₃ * y₂ * y₃;
        k₂ * y₂^2]
    # nothing
end
u0 = [1.0, 0.0, 0.0]
tspan = (0.0, 1e4)
rober_prob = ODEProblem{false}(rober, u0, tspan)ODEProblem with uType Vector{Float64} and tType Float64. In-place: false
timespan: (0.0, 10000.0)
u0: 3-element Vector{Float64}:
 1.0
 0.0
 0.0Note that we use the same labels for parameters, that have been used by the dataset.
params_labels = train_data["params_labels"]3-element Vector{String}:
 "p_1"
 "p_2"
 "p_3"p_lb = [0.036, 2.7e7, 0.9e4]
p_ub = [0.044, 3.3e7, 1.1e4]
nsamples = 50
param_space = ParameterSpace(p_lb, p_ub, nsamples; labels = params_labels) 3 dimensional ParameterSpace with 50 samples 
 ╭──────────────────┬──────────────────────────────────────────────┬──────────...
─────────╮...
│    Space Type    │                  Statistics                  │  Number...
of Samples  │...
├──────────────────┼──────────────────────────────────────────────┼──────────...
─────────┤...
│                  │  ╭──────────┬──────────────┬──────────────╮  │...
│                  │  │  Labels  │  LowerBound  │  UpperBound  │  │...
│                  │  ├──────────┼──────────────┼──────────────┤  │...
│                  │  │   p_1    │    0.036     │    0.044     │  │...
│  ParameterSpace  │  ├──────────┼──────────────┼──────────────┤  │...
│                  │  │    ⋮     │      ⋮       │      ⋮       │  │...
│                  │  │    ⋮     │      ⋮       │      ⋮       │  │...
│                  │  ├──────────┼──────────────┼──────────────┤  │...
│                  │  │   p_3    │     9000     │    11000     │  │...
│                  │  ╰──────────┴──────────────┴──────────────╯  │...
╰──────────────────┴──────────────────────────────────────────────┴──────────...
─────────╯...
Now we define the SimulatorConfig and call it on the rober_prob.
sim_config = SimulatorConfig(param_space)
ed_ode = sim_config(rober_prob; alg = Rosenbrock23()) Number of Trajectories in ExperimentData: 50 
  Basic Statistics for Given Dynamical System's Specifications 
  Number of u0s in the ExperimentData: 3 
  Number of ps in the ExperimentData: 3 
 ╭─────────┬──────────────────────────────────────────────────────────────────...
───╮...
│  Field  │...
        │...
├─────────┼──────────────────────────────────────────────────────────────────...
───┤...
│         │   ╭────────────┬──────────────┬──────────────┬────────┬──────────...
│         │   │   Labels   │  LowerBound  │  UpperBound  │  Mean  │  StdDev...
│         │   ├────────────┼──────────────┼──────────────┼────────┼──────────...
│         │   │  states_1  │      1       │      1       │   1    │    0...
│   u0s   │   ├────────────┼──────────────┼──────────────┼────────┼──────────...
│         │   │     ⋮      │      ⋮       │      ⋮       │   ⋮    │    ⋮...
│         │   │     ⋮      │      ⋮       │      ⋮       │   ⋮    │    ⋮...
│         │   ├────────────┼──────────────┼──────────────┼────────┼──────────...
│         │   │  states_3  │      0       │      0       │   0    │    0...
│         │   ╰────────────┴──────────────┴──────────────┴────────┴──────────...
├─────────┼──────────────────────────────────────────────────────────────────...
───┤...
│         │  ╭──────────┬──────────────┬──────────────┬─────────┬────────────...
│         │  │  Labels  │  LowerBound  │  UpperBound  │  Mean   │    StdDev...
│         │  ├──────────┼──────────────┼──────────────┼─────────┼────────────...
│         │  │   p_1    │   0.03608    │   0.04392    │  0.04   │  0.00233238...
│   ps    │  ├──────────┼──────────────┼──────────────┼─────────┼────────────...
│         │  │    ⋮     │      ⋮       │      ⋮       │    ⋮    │      ⋮...
│         │  │    ⋮     │      ⋮       │      ⋮       │    ⋮    │      ⋮...
│         │  ├──────────┼──────────────┼──────────────┼─────────┼────────────...
│         │  │   p_3    │     9020     │    10980     │  10000  │   583.095...
│         │  ╰──────────┴──────────────┴──────────────┴─────────┴────────────...
╰─────────┴──────────────────────────────────────────────────────────────────...
───╯...
 Basic Statistics for Given Dynamical System's Continuous Fields 
  Number of states in the ExperimentData: 3 
 ╭──────────┬─────────────────────────────────────────────────────────────────...
───────╮...
│  Field   │...
            │...
├──────────┼─────────────────────────────────────────────────────────────────...
───────┤...
│          │  ╭────────────┬──────────────┬──────────────┬────────────┬──────...
│          │  │   Labels   │  LowerBound  │  UpperBound  │    Mean    │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_1  │   0.086008   │      1       │  0.703216  │...
│  states  │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_3  │      0       │   0.913992   │  0.296769  │...
│          │  ╰────────────┴──────────────┴──────────────┴────────────┴──────...
╰──────────┴─────────────────────────────────────────────────────────────────...
───────╯...
Now we have two different ExperimentData objects: ed_dataset and ed_ode. We can combine them using combine:
ed = combine(ed_ode, ed_dataset) Number of Trajectories in ExperimentData: 150 
  Basic Statistics for Given Dynamical System's Specifications 
  Number of u0s in the ExperimentData: 3 
  Number of ps in the ExperimentData: 3 
 ╭─────────┬──────────────────────────────────────────────────────────────────...
───────╮...
│  Field  │...
            │...
├─────────┼──────────────────────────────────────────────────────────────────...
───────┤...
│         │     ╭────────────┬──────────────┬──────────────┬────────┬────────...
│         │     │   Labels   │  LowerBound  │  UpperBound  │  Mean  │  StdDev...
│         │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │  states_1  │      1       │      1       │   1    │...
│   u0s   │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │     ⋮      │      ⋮       │      ⋮       │   ⋮    │...
│         │     │     ⋮      │      ⋮       │      ⋮       │   ⋮    │...
│         │     ├────────────┼──────────────┼──────────────┼────────┼────────...
│         │     │  states_3  │      0       │      0       │   0    │...
│         │     ╰────────────┴──────────────┴──────────────┴────────┴────────...
├─────────┼──────────────────────────────────────────────────────────────────...
───────┤...
│         │  ╭──────────┬──────────────┬──────────────┬─────────────┬────────...
│         │  │  Labels  │  LowerBound  │  UpperBound  │    Mean     │...
│         │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │   p_1    │  0.0360625   │  0.0439375   │  0.0399792  │  0.0023...
│   ps    │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │    ⋮     │      ⋮       │      ⋮       │      ⋮      │...
│         │  │    ⋮     │      ⋮       │      ⋮       │      ⋮      │...
│         │  ├──────────┼──────────────┼──────────────┼─────────────┼────────...
│         │  │   p_3    │   9015.62    │   10992.2    │   10004.8   │...
│         │  ╰──────────┴──────────────┴──────────────┴─────────────┴────────...
╰─────────┴──────────────────────────────────────────────────────────────────...
───────╯...
 Basic Statistics for Given Dynamical System's Continuous Fields 
  Number of states in the ExperimentData: 3 
 ╭──────────┬─────────────────────────────────────────────────────────────────...
───────╮...
│  Field   │...
            │...
├──────────┼─────────────────────────────────────────────────────────────────...
───────┤...
│          │  ╭────────────┬──────────────┬──────────────┬────────────┬──────...
│          │  │   Labels   │  LowerBound  │  UpperBound  │    Mean    │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_1  │  0.0811106   │      1       │  0.586974  │...
│  states  │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  │     ⋮      │      ⋮       │      ⋮       │     ⋮      │...
│          │  ├────────────┼──────────────┼──────────────┼────────────┼──────...
│          │  │  states_3  │      0       │   0.918889   │  0.413015  │...
│          │  ╰────────────┴──────────────┴──────────────┴────────────┴──────...
╰──────────┴─────────────────────────────────────────────────────────────────...
───────╯...
Notice, that the number of trajectories is 150. So it takes 100 trajectories from ed_dataset and 50 trajectories from ed_ode.