
# %% Setup packages 
# Imports
# to import write either:
# import ...
# import ... as ...
# from ... import ...


# %% Download the data


# split the data into training and validation data


# %% Define a function to plot one dataset


# Define a function to plot all datasets


# %% Set up the model
# Install the M1 model by using the sund function 'install_model'
# To see that the model has been installed try running 'M1' afterwards


# Load the M1 model by using the sund function 'load_model'
# The function return the model object which should be stored in variable, say 'm1'


# %% Create activity object
# Create two activity object, which sets A_in to the input values stored in the data file. 


# %% Create a simulation object and simulate
# Create a new Simulation object for the m1 object using the constructor `sund.Simulation(models=models)` from the sund package.


# Simulate the m1_simulation object, remember to specify the time_vector ([times to simulate]) and time_unit ('s' | 'm' | 'h' ).



# %% Observe the simulation result
# Print and/or plot the result of the simulation above


# Also try to simulate twice, before plotting, does it change the plot?



# %% Observe states and derivatives
# Observe the states values of both the simulations object 'm1_simulation'
# and the model object 'm1'. Note that they differ.


# Reset the states of the simulation object, and check the state values again.



# %% Running the same simulation with different parameter values
# Run two simulations with different parameter values, but the same initial conditions.


# `simple_model_simulation.simulate(parameter_values=[2.0], reset=True)`



# %% Simulate the hypothesis using the provided parameter values, plot and compare to data
# Define a function to plot the simulation



# Define a function to plot the simulations together with the data



# Plot the model with the given parameter values:



# %% Improve the agreement to data
# manually test new parameter values 


#plot the model agreement to data



# %% Implement a cost function
# Define the cost function


# %% Calculate the cost for the initial parameter set
# Calculate the cost for the initial parameter set for M1



# %% Test a parameter set which gives a simulation that crashes
# Test a known incorrect parameter set which should make the simulation crash



# %% Compare the cost to a chi^2-test
# Evaluate the model with the initial parameter values by comparing the cost to the chi2-limit
# Evaluate the model with the initial parameter values by comparing the cost to the chi2-limit



# %% Improve the agreement (manually)
# Manually evaluate the agreement by testing parameter values


# Find the degrees of freedom

  
# Find the chi-2 limit


# Plot the model agreement to data



# %% Improve the agreement using optimization methods
# Setup inputs and functions needed for the optimization


# %% Optimize using differential_evolution
# from scipy.optimize import differential_evolution


# %% Load the best found parameter set



# %% Use the best found parameter sets to plot the agreement to data



# %% Estimating the model uncertainty
# Create an empty list to store multiple parameter sets


# Update the cost function to store acceptable parameters


# Run the optimization a couple times and store the satisfactory parameters in the above created list.


# %% Save the accepted parameters to a csv file

    


# %% Plot the uncertainty
# Define a function to plot the model uncertainty


# Plot the uncertainty for the model



# %% Testing the model by predicting the validation data
# define validation activity


# Define the plot_sim_with_data function


# Test the model against the evaluation experiment



# %%  Test if the model agrees with data, in the same way as for the first hypothesis
# Set up M2
# Install the M2 model by using the sund function 'install_model'
# To see that the model has been installed try running 'installed_models' afterwards


# Load the M2 model by using the sund function 'load_model'
# The function return the model object which should be stored in variable, say 'm2'

# Simulate the m2_simulation object, remember to specify the time_vector ([times to simulate]) and time_unit ('s' | 'm' | 'h' ).


# Plot the model with the given parameter values:


# Calculate the cost for the given parameter values:


# Find a better parameter set manually:


# Setup for optimization
## define callback for M2


## Set bounds and additional arguments

# Run the optimization


# Use the best found parameter sets to plot the agreement to data



# %% Run the optimization a few more times



# %% Collect the uncertainty for model 2
# Create an empty list to store multiple parameter sets


# Run the optimization a couple times and store the satisfactory parameters in the above created list.


# Save the accepted parameters to a csv file

    
# load the accepted parameters from the csv file

    
# Plot your accepted parameters for model M2



# %% Plot the agreement to the validation data and test the agreement with a chi^2-test
# Setup the simulation and plot the validation experiment


# %% using the model to predict unknown scenarios
# Set up M2_pred
# Install the M2_pred model by using the sund function 'install_model'
# To see that the model has been installed try running 'installed_models' afterwards

# Load the M2_pred model by using the sund function 'load_model'
# The function return the model object which should be stored in variable, say 'm2_pred'

# Define prediction activity


# Define the plot_sim_with_data function


#Simulate and plot the predictions with M2_pred
