Skip to content

[WIP] Initialization of a Python Wrapper

Loic Hausammann requested to merge python into master

@matthieu @pdraper

I have only a few small modifications of swift, but they are not really due to python (adding a print function and fixing a comment).

If you wish, we can plan a hangout session to discuss the code (the code is a draft, therefore it may be quite awful to read).

In pyswiftsim/test/test_cooling.py, you have an example on how to use the wrapper.

.pxd file are cython header file, they define (partially) what is contained in .h files and in .pyx (which are the implementation files).

I tried to follow the filename of swift in my wrapper, but currently a few things are different:

  • In pointers files, I am implementing a wrapper around C pointer (in order to deal with the swift struct in python).
  • Cooling files contains the cooling stuff + some random definitions that should move to different files.

I am not really proud of my setup.py files (I am reading the swift Makefile in order to get some libraries), but I think it is the best way to ensure taking the same libraries.

In order to use the wrapper, you need to do:

  • make install in the swift main repository
  • setup.py install in the pyswiftsim main repository

In configure.ac, I have written some useless stuff during my first try but kept it in comment as it may be useful later

Here is a picture done with the Grackle cooling and test_cooling.py

cooling_grackle

Edited by Matthieu Schaller

Merge request reports