Python is a dynamic object-oriented programming language used by CIAO
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools and comes with extensive standard libraries. A list of key software features is available on the About Python webpage.
Python in CIAO
The CIAO software offers Python as the user scripting environment. Python is distributed with CIAO, but users may opt to run their own custom installation instead; see "ahelp ciaorc" for information on how to change the Python version that is being used.
For more information, refer to the Scripting in CIAO webpages.
Python package Versions
The following versions are provided with CIAO 4.11:
- Python version 3.5.4
- IPython version 6.5.0 (including Jupyter notebook support)
- NumPy version 1.12.1
- Matplotlib version 2.2.3
- six version 1.10.0
- pip version 9.0.1 (installed as the pip3 tool)
Installing extra Python packages
The CIAO 4.11 release includes - as a beta release - the pip tool for installing Python packages into the CIAO installation. For users who have write permission to the CIAO installation (e.g. they have installed CIAO onto their own machine), a package such as AstroPy can be installed (after initializing CIAO) with the command:
unix% pip3 install astropy
or - if they don't have write permission to the CIAO installation , or do not want to risk the installation - the following will install it locally:
unix% pip3 install --user astropy
Listing installed packages
The list option can be used to see what Python packages are available:
unix% pip3 list --format=columns
Please contact the CXC HelpDesk if you encounter problems when using pip3.
Jupyter notebook support
CIAO 4.11 includes support for Jupyter notebooks, so after starting CIAO, the following command will start the server, and open a browser window, for the contents of the notebooks directory:
unix% jupyter notebook --notebook-dir notebooks
Since most CIAO tools are run from the command line, it may be useful to also install the bash kernel for Jupyter notebooks, using:
unix% pip3 install bash_kernel unix% python -m bash_kernel.install
This will let users select a "bash kernel" for running commands within a notebook.
Changes in CIAO 4.11
Python 3.5 only
The CIAO 4.11 release only supports Python 3.5, as support for Python 2.7 has been dropped. The installation includes the six Python compatability library, which may be helpful in quickly converting code from Python 2.7 to 3.5.
Updated Python packages
The extra Python software provided with CIAO - namely IPython and NumPy - has been updated. This includes adding support for Jupyter notebooks.
New Python packages
CIAO 4.11 is the first release to include the Matplotlib plotting library. Sherpa can be set up so that it uses Matplotlib rather than ChIPS for its plotting, as described in ahelp sherpa. This release is also the first to include the pip tool for installing Python packages.