Skip to the navigation links
Last modified: February 2010

AHELP for CIAO 4.2


Context: sl.contrib


lightcurves - routines to remove periods of anomalously high (or low) count rates in a lightcurve


require ("lightcurves");


The lightcurves module provides two routines that can be used to remove periods of high (or low) count rates in a lightcurve. The first - lc_clean() - is designed for use with the ACIS background files and is based on the lc_clean program created by Maxim Markevitch. The second - lc_sigma_clip() - is a simple sigma-clipping routine. See "ahelp lc_clean" and "ahelp lc_sigma_clip" for more information about the individual routines.

Loading the module

The module can be loaded into a S-Lang interpreter - such as chips, sherpa, or slsh - by saying:

require ("lightcurves");

This only needs to be done once per session (when using an interactive shell such as chips or sherpa). Loading the module will make available the lc_clean and lc_sigma_clip routines.

The two routines use different algorithms to detect flares in a light curve. Both are intended to be used with data that has relatively high count rates (i.e. ones in which bins are not expected to have no counts in them). The default mode is to create a plot showing the selected periods of the light curve, and to display the filter on screen. They can also be used to create a GTI file which encodes this information and can be used to filter the event file to remove these periods.

Example 1

chips> lc_clean("");
chips> add_window;
chips> lc_sigma_clip("");

Display the results of the two algorithms in two windows to aid comparison of the results.

Example 2

chips> lc_clean(""; outfile="clean.gti");

Filter the light curve in the file using the lc_clean algorithm and create a GTI file (clean.gti). This file can then be used to filter the event file (here assumed to be called evt2.fits) using dmcopy:

unix% dmcopy "evt2.fits[@clean.gti]" evt2.cleaned.fits

Example 3

chips> lc_sigma_clip(""; outfile="clip.gti");

Filter the light curve in the file using the lc_sigma_clip algorithm and create a GTI file (clip.gti). This file can then be used to filter the event file (here assumed to be called evt2.fits) using dmcopy:

unix% dmcopy "evt2.fits[@clip.gti]" evt2.cleaned.fits


The routines are designed to work with light curves that were created using the CIAO dmextract tool, run with the opt parameter set to ltc1. They should however also work with any file which has the following columns:

  • TIME
  • TIME_MIN and TIME_MAX (optional)
  • COUNT_RATE or, if not present, RATE
  • EXPOSURE (optional for lc_sigma_clip, required for lc_clean)

If the file contains OBJECT and OBS_ID keywords then these will be used to label the plot.


Missing OBS_ID label

The ObsID label was missing from the plots.


The module was updated to work with CIAO 4.2.

S-Lang module changes

The analyze_ltcrv and lc_clean modules have been removed, and


should be used to load both routines.


Both routines have been enhanced to better handle "extreme" lightcurves (i.e. those that contain large variations in the count rate) and lc_sigma_clip() can now handle lightcurves which result in a large number of GTIs being created.

The screen output - when verbose is 1 - includes more information, including accounting for the DTCOR value (dead-time correction factor) if present in the lightcurve.


Combined the lc_clean and analyze_ltcrv scripts

The lightcurves script is a combination of the and scripts from earlier releases of CIAO.

Users who load or will find that a warning message is displayed, but that they should be able to use the commands as before. This is a temporary change, intended to avoid immediate disruption to scripts and workflow, but users are urged to update to using directly since the lc_clean() and lc_sigma_clip() routines it contains provide more options than the old versions.

Renamed analyze_ltcrv to lc_sigma_clip

The analyze_ltcrv routine has been renamed to lc_sigma_clip. This routine can now create a GTI file rather than just printing the good time intervals to the screen.

Improved (and common) options

The method for specifying optional arguments - such as the name of an output file - has been re-worked to use the qualifier support in S-Lang v2.1. Common options for the two routines now have the same name and behave the same way.

Plot suppport

Plots of the lightcurves, together with a histogram of the cleaned (and original) data are displayed by default (they can be turned off). If a GTI file is created then the time ranges excluded by this file are added to the plot (this can also be turned off).


This script is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see the installation instructions page for help on installing the package.


See the bugs page for this script on the CIAO website for an up-to-date listing of known bugs.

See Also

lc_clean, lc_sigma_clip, lightcurves
lc_clean, lc_sigma_clip
acis_detect_afterglow, acis_find_hotpix, acis_streak_map, acisreadcorr, axbary, deflare, destreak, dmcopy, glvary

Last modified: February 2010