Skip to main content

pxsas

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

Dependencies

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"

Installation

pxsas can be easily installed using pip:

pip install pxsas

Example

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]

'18.0.0'

# Show the version of the task 'evselect'
>>> pxsas.run("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"
>> pxsas.run("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"
>>> pxsas.run("cifbuild", calindexset="ccf.cif", raise_error=False)

The output messages from the SAS tasks are captured through the python logging system. The messages are included at the logging level defined bt the parameter verbosity_level. For example:

>> pxsas.run(“cifbuild”, calindexset=”ccf.cif”, verbosity_level=logging.DEBUG)

will include the output messages of the task as DEBUG messages. By default the logging level is INFO. For not capturing the messages through the logging system, use verbosity_level=0.

If the task runs succesfully, pxsas.run 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.

Metadata

Release files for pxsas 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pxsas 1.2
File Size Uploaded
pxsas-1.2.tar.gz 4.1 kB Details

Release files / pxsas-1.2.tar.gz

Download URL pxsas-1.2.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
516070de3a5d444756e4a4336a56722c306939ee021929d04268f6c02489f3b3
BLAKE2b-256 checksum
How to use checksums
7131824632c86046d45f8f5aee085af0439ac3920fbaf32be3ca8f050e89c91a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/5.0.0 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.2 This release

1 release file

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page