nicer.NicerFileSet

Locate and load the files that make up one NICER observation.

Classes

NicerFileSet(args)

The event, GTI, filter and housekeeping data for one NICER ObsID.

class nicer.NicerFileSet.NicerFileSet(args)[source]

Bases: object

The event, GTI, filter and housekeeping data for one NICER ObsID.

On creation, the standard files are found in the observation directory, the filter file and GTIs are read (with TIMEZERO applied), and an event table is built from the merged unfiltered (ufa) event files. The event table has its TIME column renamed to MET and is sorted by time. GTIs shorter than 16 s are discarded unless args.keith is set.

Parameters:

args (argparse.Namespace) -- Options, normally from nicerql.py. The attributes used are obsdir (ObsID directory), sps (SPS housekeeping file, or None to look for one), useftools (merge and filter the events with FTOOLS), applygti (GTI file to apply, or None), gtirows (rows of the GTI table to keep, or None), keith (keep short GTIs), object (override the OBJECT keyword, or None), basename (output base name, or None to use the ObsID) and filterbinsize (bin size in seconds for the binned overshoot rate). The orbit file found is stored in args.orb.

evfiles, ufafiles, uffiles

Cleaned (*mpu7_cl.evt), merged unfiltered (*mpu7_ufa.evt) and per-MPU unfiltered (*mpu?_uf.evt) event files.

Type:

list of str

hkfiles

MPU housekeeping files.

Type:

list of str

mkfile

Filter (.mkf) file name.

Type:

str

mktable

Contents of the filter file.

Type:

astropy.table.Table

llinterp

Interpolator for the spacecraft latitude and longitude.

Type:

nicer.latloninterp.LatLonInterp

gtitable

Good time intervals, with a DURATION column.

Type:

astropy.table.Table

etable

The events.

Type:

astropy.table.Table

basename

Base name for output files.

Type:

str

ovbintable

Binned overshoot rate (see getbinnedovershoots()).

Type:

astropy.table.Table or None

Raises:

Exception -- If no cleaned event files are found or no events remain.

createetable()[source]

Read and stack the events from the merged unfiltered event files.

TIMEZERO is added to the event times.

Returns:

astropy.table.Table -- The event table (also stored as self.etable).

sortmet()[source]

Rename the TIME column to MET, sort the events by time and set the exposure.

EXPOSURE in the table metadata is set to the total GTI duration, and OBJECT is replaced if args.object was given.

getbinnedovershoots()[source]

Make a binned overshoot-rate table from the filter file.

This is only done when the base name ends in _prefilt: fcurve bins FPM_OVERONLY_COUNT from the filter file in args.filterbinsize second bins, writing basename_ovbin.fits, and the result is read into self.ovbintable. Otherwise self.ovbintable is set to None. Requires HEASoft.

writebkffile()[source]

Write a .bkf FITS file of rates that are useful for background filtering.

The file has the overshoot and undershoot rates, bad-ratio event rate, count rates in several energy bands (above 13 keV, below 0.25 keV, 0.25-2 keV and 2-8 keV) and spacecraft latitude and longitude, all binned on the housekeeping time grid.

This needs the hkmet, hkovershoots, hkundershoots, eventovershoots and eventbothshoots attributes, which are not set when the object is created.

getgti()[source]

Read the GTIs from the first merged unfiltered event file into self.gtitable.

TIMEZERO is applied, a DURATION column is added, and GTIs shorter than 16 s are removed unless args.keith is set.

makebasename()[source]

Set self.basename for output files.

The ObsID from the event file name is used unless args.basename was given. An OBS_ID keyword of all zeros is replaced by the ObsID from the file name.