HENDRICS documentation

Build Status Build status Coverage Status Documentation Status


This repository contains an evolution of MaLTPyNT. This software is being heavily rewritten in order to use Stingray’s classes and functions whenever possible. To use the original MaLTPyNT, please go to matteobachetti/MaLTPyNT.


This set of command-line scripts based on Stingray is designed to do correctly and fairly easily a quick-look (spectral-) timing analysis of X-ray data, treating properly the gaps in the data due, e.g., to occultation from the Earth or passages through the SAA.

Originally, its development as MaLTPyNT - Matteo’s Libraries and Tools in Python for NuSTAR Timing - was driven by the need of performing aperiodic timing analysis on NuSTAR data, whose long dead time made it difficult to treat power density spectra with the usual tools. By exploiting the presence of two independent detectors, one could use the cospectrum as a proxy for the power density spectrum (for an explanation of why this is important, look at Bachetti et al., ApJ, 800, 109 -arXiv:1409.3248).

Today, this set of command line scripts is much more complete and it is capable of working with the data of many more satellites. Among the features already implemented are power density and cross spectra, time lags, pulsar searches with the Epoch folding and the Z_n^2 statistics, color-color and color-intensity diagrams. More is in preparation: rms-energy, lag-energy, covariance-energy spectra, Lomb-Scargle periodograms and in general all that is available in Stingray. The analysis done in HENDRICS will be compatible with the graphical user interface DAVE, so that users will have the choice to analyze single datasets with an easy interactive interface, and continue the analysis in batch mode with HENDRICS. The periodograms produced by HENDRICS (like a power density spectrum or a cospectrum), can be saved in a format compatible with Xspec or Isis, for those who are familiar with those fitting packages. Despite its original main focus on NuSTAR, the software can be used to make standard aperiodic timing analysis on X-ray data from, in principle, any other satellite (for sure XMM-Newton and RXTE).

What’s new


Lots of improvements to pulsar functionalities; .. Note

Windows support for Python <3.6 was dropped. Most of the code will still work on old versions,
but the difficulty of tracking down library versions to test in Appveyor forces me
to drop the obsolescent versions of Python from testing on that architecture.


The API is now rewritten to use Stingray where possible. All MPxxx scripts are renamed to HENxxx.

Functionality additions:

  • Epoch folding search
  • Z-squared search
  • Color-Color Diagrams and Hardness-Intensity Diagrams
  • Power spectral fitting

(MaLTPyNT) 2.0


MaLTPyNT provisionally accepted as an Astropy affiliated package

In preparation for the 2.0 release, the API has received some visible changes. Names do not have the mp_ prefix anymore, as they were very redundant; the structure of the code base is now based on the AstroPy structure; tests have been moved and the documentation improved.

HENexposure is a new livetime correction script on sub-second timescales for NuSTAR. It will be able to replace nulccorr, and get results on shorter bin times, in observations done with a specific observing mode, where the observer has explicitly requested to telemeter all events (including rejected) and the user has run nupipeline with the CLEANCOLS = NO option. This tool is under testing.

HENfake is a new script to create fake observation files in FITS format, for testing. New functions to create fake data will be added to hendrics.fake.

Preliminary notes

HENDRICS vs FTOOLS (and together with FTOOLS)


HENDRICS does a better job than POWSPEC from several points of view:

  • Good time intervals (GTIs) are completely avoided in the computation. No gaps dirtying up the power spectrum! (This is particularly important for NuSTAR, as orbital gaps are always present in typical observation timescales)
  • The number of bins used in the power spectrum (or the cospectrum) need not be a power of two! No padding needed.

Clarification about dead time treatment

HENDRICS does not supersede nulccorr (yet). If one is only interested in frequencies below ~0.5 Hz, nulccorr treats robustly various dead time components and its use is recommended. Light curves produced by nulccorr can be converted to HENDRICS format using HENlcurve --fits-input <lcname>.fits, and used for the subsequent steps of the timing analysis.


Improved livetime correction in progress!

HENexposure tries to push the livetime correction to timescales below 1 s, allowing livetime-corrected timing analysis above 1 Hz. The feature is under testing

License and notes for the users

This software is released with a 3-clause BSD license. You can find license information in the LICENSE.rst file.

If you use this software in a publication, please refer to its Astrophysics Source Code Library identifier:

  1. Bachetti, M. 2015, MaLTPyNT, Astrophysics Source Code Library, record ascl:1502.021.

In particular, if you use the cospectrum, please also refer to:

  1. Bachetti et al. 2015, ApJ , 800, 109.

I listed a number of open issues in the Issues page. Feel free to comment on them and propose more. Please choose carefully the category: bugs, enhancements, etc.


(MaLTPyNT) 2.0

I would like to thank all the co-authors of the NuSTAR timing paper and the NuSTAR X-ray binaries working group. This software would not exist without the interesting discussions before and around that paper. In particular, I would like to thank Ivan Zolotukhin, Francesca Fornasini, Erin Kara, Felix Fürst, Poshak Gandhi, John Tomsick and Abdu Zoghbi for helping testing the code and giving various suggestions on how to improve it. Last but not least, I would like to thank Marco Buttu (by the way, check out his book if you speak Italian) for his priceless pointers on Python coding and code management techniques.

Indices and tables