vice.yields.presets.save

Save a permanent copy of yields stored in a given file for loading back into VICE at any time via an import statement.

Signature: vice.yields.presets.save(filename)

New in version 1.1.0.

Parameters

filenamestr

The full or relative path to the script containing the yields to be saved. The name of this file will become the name of the preset to use in import statements.

Raises

  • RuntimeError
    • An exception occurs in attempting to import the file

    • The file is named JW20.py. This will always be the Johnson & Weinberg (2020) preset file.

  • IOError
    • The file does not exist

  • TypeError
    • filename is not of type str

Example Code

The following in a file named “example.py”:

import vice
vice.yields.ccsne.settings['o'] = 0.015
vice.yields.ccsne.settings['fe'] = 0.0012
vice.yields.sneia.settings['o'] = 0.0
vice.yields.sneia.settings['fe'] = 0.0017

And the following in the same directory as that file:

>>> import vice
>>> vice.yields.presets.save("example.py")

This will enable the following from any directory:

>>> import vice
>>> from vice.yields.presets import example
>>> vice.yields.ccsne.settings['o']
0.015