inttag

The task inttag converts an events table of TIME-TAG mode STIS data into a raw, time-integrated ACCUM image. By default, inttag only integrates over the good time intervals (GTI), though the user can choose to integrate over the entire exposure time by setting allevents=True. The output image can be calibrated as any other raw image.

The input file for inttag is an event stream table of TIME-TAG mode produced by generic conversion. The data will be Doppler corrected (as required for medium and high resolution spectroscopic modes). This file will consist of a primary header with no data, and two binary table extensions. The primary header is identical in structure to the primary header of an ACCUM mode image. The first binary table (EXTNAME=EVENTS) contains a list of the events themselves (i.e. science data as an event stream), and the second binary table (EXTNAME=GTI) contains a list of good time intervals for the TIMETAG exposure. Columns “TIME”, “AXIS1”, and “AXIS2” in the EVENTS table are read. Columns “START” and “STOP” in the GTI table are read.

The output image is a time integrated (ACCUM mode) image with the same structure as any other STIS MAMA raw image (i.e. primary header followed by a single or series of triplet extensions: SCI, ERR, DQ). The number of triplets is determined by the value of rcount. The time interval in the Nth triplet covers from (starttime + (N-1)*increment) to (starttime + N*increment). The exposure time in each interval need not be identical, because events are included in the image only if they occur during “good time intervals” (as determined by the GTI extension table). The keyword OBSMODE in the primary header of the output image will still be set to “TIME-TAG”.

The output science image is ready to be calibrated (see calstis, crreject, basic2d, x2d, x1d).

Examples

inttag with default values:

>>> import stistools
>>> stistools.inttag.inttag("oddv01050_tag.fits", "oddv01050_raw.fits")

inttag with highres output:

>>> import stistools
>>> stistools.inttag.inttag("oddv01050_tag.fits", "oddv01050_raw.fits", highres=True)

inttag with multiple output imsets (5 count regions of 200s each):

>>> import stistools
>>> stistools.inttag.inttag("oddv01050_tag.fits", "oddv01050_raw.fits", rcount = 5, increment = 200)
inttag.events_to_accum(events_data, size_x, size_y, highres)

Map timetag events to a 2d accum image array.

Parameters:
events_data: record array

Record array of timetag events.

size_x: int

Number of pixels on axis 1 of the detector.

size_y: int

Number of pixels on axis 2 of the detector.

highres: bool

Boolean value indicating whether the output accum image is in high or low resolution.

Returns:
accum: array

2d image of all events in the imset on the detector.

inttag.exp_range(starttime, stoptime, events_data, gti_data, tzero_mjd)

Calculate exposure time, expstart, and expstop and mask imset

Parameters:
starttime: float

Start time of the imset in seconds

stoptime: float

Stop time of the imset in seconds

events_data: record array

Record array of timetag events.

gti_data: record array

Record array of good time intervals (GTIs).

tzero_mjd: bool

Modified Julian Date (MJD) corresponding to the beginning of the exposure

Returns:
exp_time: float

Total exposure time in seconds for the given imset. This number accounts for any exposure time lost to non-GTI time (if the user is not using allevents).

expstart: float

Start time of the imset exposure

expstop: float

Stop time of the imset exposure

good_events: float

The events list within the imset exposure time and within the GTIs.

inttag.inttag(tagfile, output, starttime=None, increment=None, rcount=1, highres=False, allevents=False, verbose=True)

Convert an events table of TIMETAG into an integrated ACCUM image.

Parameters:
tagfile: str

input file that contains TIMETAG event stream. This is ordinarily a FITS file containing two tables. The TIMETAG data are in the table with EXTNAME = “EVENTS”, and the “good time intervals” are in the table with EXTNAME = “GTI”. If the GTI table is missing or empty, all times will be considered “good”.

output: str

Name of the output FITS file.

starttime: float

Start time for integrating events, in units of seconds since the beginning of the exposure. The default value of None means that the start time will be set to the first START time in the GTI table.

increment: float

Time interval in seconds. The default value of None means integrate to the last STOP time in the GTI table, divided by rcount.

rcount: int

Repeat count, the number of output image sets to create. If rcount is greater than 1 and increment is not specified, will subdivide the total exposure time by rcount.

highres: bool

Create a high resolution output image? Default is False.

allevents: bool

If allevents is set to True, all events in the input EVENTS table will be accumulated into the output image. The TIME column in the EVENTS table will only be used to determine the exposure time, and the GTI table will be ignored.

verbose: bool

Print additional info?