Skip to the navigation links
Last modified: February 2010

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/lightcurves.py.html
AHELP for CIAO 4.2

lightcurves

Context: py.contrib

Synopsis

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

Syntax

from lightcurves import *

Description

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 Python interpreter - such as chips, sherpa, or ipython - by saying:

from lightcurves import *

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("bg.lc")
chips> add_window()
chips> lc_sigma_clip("bg.lc")

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

Example 2

chips> lc_clean("bg.lc", outfile="clean.gti")

Filter the light curve in the file bg.lc 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("bg.lc", outfile="clip.gti")

Filter the light curve in the file bg.lc 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

FORMAT OF LIGHT CURVES

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.

CHANGES IN CIAO 4.2 - 1.1

Missing OBS_ID label

The ObsID label was missing from the plots.

CHANGES IN CIAO 4.2 - 1.0

The module was updated to work with CIAO 4.2.

CHANGES IN CIAO 4.1 - 1.1

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 True - includes more information, including accounting for the DTCOR value (dead-time correction factor) if present in the lightcurve.

CHANGES IN CIAO 4.1 - 1.0

Python version

There is now a Python version of the script available; in earlier CIAO releases the code was only runnable using S-Lang. The Python version provides the lc_clean() and lc_sigma_clip() routines (the latter was previously called analyze_ltcrv() in the S-Lang version). Both routines can create a GTI file, and they have a common set of options.

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).

NOTES

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.

Bugs

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

See Also

py.contrib
lc_clean, lc_sigma_clip
sl.contrib
lc_clean, lc_sigma_clip, lightcurves
tools
acis_detect_afterglow, acis_find_hotpix, acis_streak_map, acisreadcorr, axbary, deflare, destreak, dmcopy, glvary

Last modified: February 2010