Skip to content


Loic Hausammann requested to merge init into master

Initial version of PySWIFTsim.

@pdraper and @matthieu, if you want to review the code. I would like to suggest starting by tests/ to see how the wrapper works. If you want to run it, you will need to switch on the update_cooling_grackle branch in Swift and download this file For the setup, just run python install --with-swift PATH_TO_SWIFT.

You can then look at src/parser_wrapper, src/units_wrapper or src/cooling_wrapper (do not care about how I deal with the input/output, you will need to focus on it to understand it).

At the end, you can look at how I deal with the python/C interface. First you can look at pyswiftsim/ where I define a python class for each struct that I am wrapping (using and then to src/pyswiftsim_tools where I define the C methods to transform a python object to a C object. The big advantage of my method is that you can modify any non pointer field (I would like to allow changing a pointer, but it may be tricky).

Edited by Loic Hausammann

Merge request reports