Skip to content

IvS-KULeuven/IvSPythonRepository

Repository files navigation

Documentation

Installation

  • Clone the git repository to create a local copy as a folder called "ivs". Make sure the directory is re-named as "ivs".

    $ cd python
    $ git clone https://github.com/IvS-KULeuven/IvSPythonRepository.git ivs

    This will clone all repository files into the ~/python/ivs folder. Be aware, however, that only the python scripts and the documentation are being cloned, not the (numerous and sometimes huge) datafiles that come along with it, containing, for example, limbdarkening coefficients. The directories of these files can be found, and specified, in ~ivs/config.py.

  • Updating your own clone of the IvS python repository to the most recent version can be done with:

    $ cd ivs
    $ git pull
  • The IvS repository now comes with an Anaconda python environment file to help avoid user problems with the python modules. To create the repository anaconda environment run the following commands:

    $ cd ivs
    $ conda env create -f IvS_repo_3.6.yml

    If you do not use anaconda you can find the repository dependencies in this file. Make sure to activate your environment each time before using the repository, either by sourcing it in your .bash_profile or running:

    $ conda activate ivs_repo_3.6
  • Make sure that your python path points to the directory above the ivs folder:

    If your python repository is in, e.g., ~/python/ivs/ , you can put in your .bash_profile:

    export PYTHONPATH=/home/YOURNAME/python:$PYTHONPATH

    Warning: don't put ~/python/ivs in your Python path, but just ~/python.

    Once added to the PYTHONPATH you can import ivs modules using, for example:

    from ivs.statistics import linearregression
  • The IvS Python repository contains mostly python routines. Some of the time-critical functions, however, are written in fortran. To compile them you can run the following code (make sure to have the ivs_repo_3.6 environment activated first):

    $ python config.py compile

    If you want to specify your own fortran compiler you can do so with

    $ python config.py compile f77

    Note: This requires the F2PY module which has previously caused problems... Sometimes the compilation process may fail. If so, try to compile spectra/pyrotin4.f manually, and then retry the automatic compilation (repeat for all troublesome files):

    $ cd spectra/
    $ f2py --fcompiler=gfortran -c pyrotin4.f -m pyrotin4
    $ cd ../
    $ python config.py compile
  • In the config file you may also change the paths where the data catalogs (variable: data_dir) can be found, if you are not using the default locations (i.e. you are outside the institute).

  • To generate the documentation, simply run the script

    $ python makedoc.py

    in the repository's root folder. This assumes that 'epydoc' is available which is already installed on all IvS computers. On your own laptop, you can get it from http://epydoc.sourceforge.net.

    Open "/doc/html/index.html" in your favorite browser and start browsing! Whenever you change something yourself in your local branch or you pull changes from someone else, you can re-run the makedoc.py script.

  • Happy computing!

I have a bug/issue (and a fix/improvement):

Please let us know via the Issues tab on the Github page: https://github.com/IvS-KULeuven/IvSPythonRepository/issues

Likewise, if you are able to fix a bug/issue yourself, or have a coding improvement to offer, please let us know so that it can be integrated into the repository!

About

Python Repository of the Institute of Astronomy @ KU Leuven

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published