User Modules

To allow users to add code easily within the POSYDON namespace without modifying the code core, we added a directory called user_modules. Users can put their own code there and simply import it as any other function within the POSYDON namespace. This feature is designed for users who would like to implement their own common envelope or supernova prescription. Implementing your own module requires essentially two steps:

First, the class defining your new step needs to be constructed. This class ought to have an __init__ method that takes in verbose as an argument and a __call__ method that takes in a BinaryStar object as an argument. The physics describing the new step will be included in the call method within which the binary’s parameters will be altered according to your prescription. Be sure to adjust the binary state and event so the flow knows how to handle your output binaries.

Second, the binary flow needs to be adjusted so POSYDON’s population synthesis code knows to direct the relevant binaries to the newly constructed step. This can be done by creating a custom user module, similar to how it is done for a custom step. Read our flow chart documentation to understand what this object is and how you can create your own.

For a complete example of how to implement a new user module, we include a tutorial describing the process: Custom POSYDON steps and flow chart.