Skip to main content

Python wrapper for the XMM-Newton Science Analysis System (SAS)

Project description

pxsas is a simple Python 3 wrapper for the XMM-Newton Science Analysis System (SAS).


pxsas needs a working SAS installation. SAS has to be initialized before importing pxsas into your python environment.

A note about SAS 17.0.0 and above

Starting with version 17.0.0, the SAS installation procedure creates its own python environment for running some tasks. This is the system’s default python environment after the initialization of SAS. You can install pxsas in this environment, but this is extremely NOT recomended. Instead, you can redefine your PATH after SAS initialization like this (in bash):

export PATH="/path/to/my/python:$PATH"


pxsas can be easily installed using pip:

pip install pxsas


A simple example of using pxsas:

>>> import logging
>>> import os
>>> import pxsas

>>> logging.getLogger().setLevel(logging.INFO)

# Show SAS version used by pxsas
>>> pxsas.sasversion(full=True)
INFO:root:Running sasversion -v
INFO:root:sasversion (sasversion-1.3) [xmmsas_20190531_1155-18.0.0]


# Show the version of the task 'evselect'
>>>"evselect", "-v")

# Create a Calibration Index File for a given observation
# Raise exception if the task fails
>>> os.environ["SAS_ODF"] = "/path/to/observation/ODF"
>>"cifbuild", calindexset="ccf.cif")

# Create a Calibration Index File for a given observation
# Returns None if the task fails
>>> os.environ["SAS_ODF"] = "/path/to/observation/ODF"
>>>"cifbuild", calindexset="ccf.cif", raise_error=False)

The output messages from the SAS tasks are captured through the python logging system. If the task runs succesfully, returns the output text as a string. By default, if an error happens during execution, and exception is raised. If the keyword argument raise_error is set to False, then no exception is raised and it just returns None.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pxsas-1.1.tar.gz (3.2 kB view hashes)

Uploaded source

Built Distribution

pxsas-1.1-py3-none-any.whl (4.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page