To work with PTS you need to copy the Python source code to your local file system. First create a directory hierarchy that will hold the PTS source code and run-time information. The top-level directory can have any name (for example PTS
) and can be located anywhere (for example in your home directory), but the subdirectories should be named as indicated below. Execute the following commands in a Terminal window to create the PTS directory in your home folder.
cd mkdir PTS cd PTS mkdir run pts
The PTS source code is available from the public PTS GitHub repository. While any user can freely retrieve the code from this repository (even anonymously), only the SKIRT team has write access to it. To obtain the code, simply type the following commands in a Terminal window:
cd ~/PTS git clone https://github.com/SKIRT/PTS9.git pts
To update your local copy of the source code after changes were made to the repository from which you cloned it, use:
cd ~/PTS/pts git pull
If you plan to make code contributions, you should create an account at GitHub.com, fork the PTS repository and then clone this forked repository. This allows you to push modifications to your own fork and initiate a pull request when you want to contribute the changes to the project. Refer to Contributing and The GitHub workflow for the SKIRT project for more information.
It is important that your Python install can automatically locate the PTS source code so that it can execute PTS commands and import PTS packages regardless of the current directory. Furthermore it is handy to provide an alias so that you can easily access PTS from the command line.
To accomplish this, you will have to add the following lines to your login script (.profile
or .bash_profile
or equivalent if you are using a shell other than bash
):
export PYTHONPATH=~/PTS alias pts="python -m pts.do"
Note that the first line must be adjusted if your PTS directory resides in a different place or has another name. After you save the login script, you must log out an log back in (or open another Terminal window) for the changes to take effect.
You can run a basic test of your PTS installation by entering the following command line:
pts try me
which should produce a response similar to the following:
03/06/2019 16:52:05.043 Starting admin/try_do... 03/06/2019 16:52:05.043 Command line arguments are: 03/06/2019 16:52:05.043 Fixed string: me 03/06/2019 16:52:05.043 Optional string: PTS is great 03/06/2019 16:52:05.043 Float number: 3.14 03/06/2019 16:52:05.043 Integer number: 7 03/06/2019 16:52:05.043 Finished admin/try_do.
You may need to install additional third-party Python packages on which the PTS code depends. To assist with this process, the list_dependencies
command script lists all packages referred to by the PTS code, including an indication of whether each package is already installed or not:
$ pts list_dependencies Starting admin/list_dependencies... PTS depends on 32 packages: argparse -- installed astropy -- installed datetime -- installed ... ! reportlab -- NOT INSTALLED ... scipy -- installed zipfile -- installed Finished admin/list_dependencies.
The list includes both standard and third-party packages. Because the standard packages are built into the regular Python distribution, they will always be marked as "installed".
Some dependencies are optional and will be invoked only when the related PTS functionalty is actually used. The fsps
package is an example of this.