simetenn / uncertainpy

Uncertainpy: a Python toolbox for uncertainty quantification and sensitivity analysis, tailored towards computational neuroscience.
http://uncertainpy.readthedocs.io
GNU General Public License v3.0
224 stars 50 forks source link

Enable continuing UQ and SA after loading model results #12

Open simetenn opened 6 years ago

simetenn commented 6 years ago

Enable continuing UQ and SA after loading model results from file. This require the following additional information to be saved:

simetenn commented 6 years ago

Additionally, couple this to the options of giving the user the parameters where to evaluate the model, and then give a list of model evaluations back. This to enable easy use of HPC by enabling the user to manually run the model.

fangqx commented 3 years ago

Hello Simetenn: I am trying to use your tool to quantify model uncertainty associated with model inputs. Because my model is not implemented in python and needs some time to finish the model run and get the results, my question is that my model run is always stopped by the main processes ( e.g., model = un.Model()). Could you give me some suggestions on how can I get my external model run first and get the result first? Thank you very much!

simetenn commented 3 years ago

Hi fangqx,

If I understand your problem correctly you do not necessarily need to be able to resume UQ and SA after running the model. The model itself does not need to be implemented in Python. Any external model can be used, as long as you can control the model parameters and retrieve the simulation output via Python. One way of doing could be to write you parameters to file, call the external model with os.system(), subprocess.run() or something similar and use your parameter file in those runs, write the results to file, and then read the result back into python

def external_model(parameter_1, parameter_2):
    # Write parameters to file, or possibly pass them along with the external model command

    # Call external model using os.system(), subprocess.run() or something similar

    # Read the results back into Python
    return time, values, info