Search code examples
pyiron

Is there a way to store data in hdf5 file in ScriptJob in pyiron?


I have my own Monte Carlo code (which is not part of pyiron), which I launch via ScriptJob in pyiron. Currently, I store the output data in a file, but since the script job is a pyiron object and an hdf5 is created, I would love to store the data there. So, I'd love to have something like:

script_job = pr.create_job('ScriptJob', 'job')
script_job.script_path = 'monte_carlo.ipynb'
script_job.run()
script_job['user/output/'] # This returns the output of what I store in monte_carlo.ipynb

Is there a way to do something inside monte_carlo.ipynb to make this happen?


Solution

  • You can summarise your output in a dictionary named output_dict and then use:

    from pyiron import Notebook
    Notebook().store_custom_output_dict(output_dict)