Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/python.html
AHELP for CIAO 4.16

python

Context: scripting

Synopsis

Python is a dynamic object-oriented programming language used by CIAO

Description

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.

Refer to the Python Programming Language website for more information. Several web sites dedicated to using Python for Astronomical research exist, including the AstroBetter Wiki.

Python in CIAO

The CIAO software offers Python as the user scripting environment. For more information, refer to the Scripting in CIAO webpages.

CIAO comes with Python, IPython, NumPy, and matplotlib, with the version depending on how CIAO was installed. Other packages, such as Jupyter notebook support may also be included.


Installing extra Python packages

Extra Python packages can be installed with pip and, if CIAO was installed with conda, the conda tool. 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.

Changes in CIAO 4.16

Python versions

Support for Python 3.8 has been dropped, and Python 3.11 added.

macOS native ARM support

CIAO is now available for native macOS ARM systems; Rosetta2 is no longer required.

Changes in CIAO 4.15

Python versions

Support for Python 3.7 has been dropped, and Python 3.10 added.

macOS ARM support

Unfortunately certain packages that CIAO requires are still not available for macOS ARM systems, so CIAO 4.15 remains using the Rosetta2 emulation system.

Changes in CIAO 4.14

Python versions

Support for Python 3.6 has been dropped, and Python 3.9 added.

Conda installation

The conda installation now requires that the conda-forge channel is included in the installation.

Changes in CIAO 4.13

Python versions

Support for Python 3.5 has been dropped, and Python 3.8 added.

IPython support

In CIAO 4.13 Sherpa has added support to take advantage of Jupyter notebooks when displaying certain objects: for example, in a Jupyter notebook try the following

get_data()
get_source()
get_fit_results()
get_conf_results()

The CIAO 4.13 release notes contain an example notebook showing some of these changes.