Skip to main content

Installing pySAS

Full documentation for pySAS can be found here:

xmmpysas.readthedocs.io

This version of pySAS can be used with versions 20 and up of XMM-Newton SAS. After installing SAS following the installation instructions you can then install the development version of pySAS using

pip install xmmpysas

Note: Make sure you install xmmpysas. There is different Python module called pysas that has nothing to with pySAS for XMM-Newton.

Note: Requires Python version >=3.10.

Before you use pySAS for the first time you will need to configure pySAS so that it knows where you have SAS installed, and where the XMM calibration files are located. After installing pySAS using pip, in Python just run:

import pysas
pysas.config_pysas.run_config()

This will step you through connecting pySAS to SAS. After pySAS has been configured you can import pySAS like normal.

import pysas

You can update pySAS using

pip install xmmpysas --upgrade

Documentatio and Example Scripts

There are example scripts and Jupyter notebooks available on GitHub demonstrating how to use pySAS. We are expanding the number of example scripts and Jupyter notebooks. You can clone the repository with the example notebooks by running the following command in a directory of your choosing:

git clone https://github.com/XMMGOF/pysas_docs.git

The documentation for pySAS on Read the Docs has:

Running pySAS for the First Time

The very first time you run this version of pySAS you will have to set SAS defaults that will be used by pySAS. To set the defaults run the following commands in python:

import pysas
pysas.config_pysas.run_config()

This script will set:

  • sas_dir: The directory where SAS is installed. If you are running the script from inside the SAS directory this will be auto-detected.
  • sas_ccfpath: The directory where the calibration files are stored. If you already have them downloaded, just enter the directory where they are. But if you have not downloaded them yet, you will be given the option to download them after the setup. The script will even create the directory for you.
  • data_dir: You will have the option of designating a defaut data directory. All observation data files will be downloaded into this directory. If the data directory does not exist it will be created for you.

Note: If you installed pySAS by cloning it from GitHub you must add the pySAS directory to your PYTHONPATH environment variable. For example:

export PYTHONPATH=/path/to/sas/install/xmmsas_202XXXXXX_YYYY/lib/python:$PYTHONPATH

It is recommended that you add this line to your .bash_profile file (or equivelent shell file). This is not necessary if pySAS was installed using pip install xmmpysas.

Cloning This Repository

Alternatively, pySAS can be cloned from GitHub by going into the directory where pySAS is installed to remove the current version of pySAS using

cd /path/to/sas/install/xmmsas_202XXXXXX_YYYY/lib/python/
rm -rf ./pysas

and then clone this version of pySAS by executing the command,

git clone https://github.com/XMMGOF/pysas.git

You can then use pySAS like normal.

To incorporate new changes to pySAS from GitHub, from the pysas directory use the following command,

git pull https://github.com/XMMGOF/pysas.git

FAQ

Q: Will this break my SAS inatallation?

A: No. This makes no changes to your SAS installation.

Q: I have already been working with pySAS and I have several Python scripts already written. Will this make them break?

A: No. This version of pySAS is fully backwards compatible with the standard pySAS distributed with SAS. This version only adds capabilites. The features included here will eventually work their way into the standard version of pySAS.

Q: Can I contribute changes to pySAS?

A: YES! That is the purpose of this repository! The whole idea is to provide a place where changes can be made and tested, issues can be raised, and features can be requested for pySAS. User input is greatly encouraged.

Q: Can I use pip to install pySAS?

A: Yes! Install using

pip install xmmpysas

Q: What about using conda to install pySAS?

A: We are working on it!

Q: Can I use pySAS to update the XMM-Newton calibration files?

A: Yes! Just start a Python session and run the following commands:

import pysas
pysas.sasutils.update_calibration_files()

This will download new calibration files.

Metadata

Release files for xmmpysas 2.5.3

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

Source distribution (sdist)

Source distribution for xmmpysas 2.5.3
File Size Uploaded
xmmpysas-2.5.3.tar.gz 93.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xmmpysas 2.5.3
File Interpreter ABI Platform
xmmpysas-2.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 198.3 kB

Release files / xmmpysas-2.5.3.tar.gz

Download URL xmmpysas-2.5.3.tar.gz
Size 93.6 kB
Tags Source
SHA-256 checksum
How to use checksums
49cd28004a1d5d853702cd245d6908ab032887bebd6d99995947e533231f8cdc
BLAKE2b-256 checksum
How to use checksums
266597ddf65fd272749252f5a9dfd4e2436bd7b1fcc62d1557973865b92fa197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / xmmpysas-2.5.3-py3-none-any.whl

Download URL xmmpysas-2.5.3-py3-none-any.whl
Size 104.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9072be1e2631c8e3db6bd0d6735709d7658cd26f5be4871f61b48c7c686a98eb
BLAKE2b-256 checksum
How to use checksums
339de6e1580f8ec44a0ab20e8b0d45613cf41cf10a67bdda4fad0be134ee03b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

2.5.3 This release

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

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