Simulating observations

Once a scenario has been defined, we can simulate observations from each observation model with pypfilt.simulate_from_model():

def simulate_lorenz63_observations():
    scenario_file = 'lorenz63_simulate.toml'
    instances = list(pypfilt.load_instances(scenario_file))
    instance = instances[0]

    # Simulate observations for x(t), y(t), and z(t).
    obs_tables = pypfilt.simulate_from_model(instance)

    # Save the observations to plain-text files.
    for obs_unit, obs_table in obs_tables.items():
        out_file = f'lorenz63-{obs_unit}.ssv'
        pypfilt.io.write_table(out_file, obs_table)

    return obs_tables

Note

Recall that for this scenario we specified fixed values for each parameter and state variable, so that we can simulate observations from a known ground truth.

  • Example simulated observations for \(x(t)\).
    time value
    0.0 2.060708988743798
    0.1 3.011886300171387
    0.2 6.56829062668601
    
  • Example simulated observations for \(y(t)\).
    time value
    0.0 -0.9391882744264315
    0.1 3.9838547749049513
    0.2 16.169975938885628
    

We can now use these simulated observations to fit the simulation model and generate forecasts for the future observations.