SpectrumObservationList

class gammapy.spectrum.SpectrumObservationList(initlist=None)[source]

Bases: collections.UserList

List of SpectrumObservation objects.

Attributes Summary

obs_id List of observations ids
off_vector_list Off PHACountsSpectrumList
on_vector_list On PHACountsSpectrumList
total_livetime Summed livetime

Methods Summary

append(item)
clear()
copy()
count(item)
extend(other)
index(item, *args)
insert(i, item)
obs(obs_id) Return one observation.
peek() Quickly look at observations
pop([i])
read(directory[, pha_typeII]) Read multiple observations
remove(item)
reverse()
safe_range([method]) Safe energy range
sort(*args, **kwds)
stack() Return stacked SpectrumObservation
write([outdir, pha_typeII]) Create OGIP files

Attributes Documentation

obs_id

List of observations ids

off_vector_list

Off PHACountsSpectrumList

on_vector_list

On PHACountsSpectrumList

total_livetime

Summed livetime

Methods Documentation

append(item)
clear()
copy()
count(item)
extend(other)
index(item, *args)
insert(i, item)
obs(obs_id)[source]

Return one observation.

Parameters:

obs_id : int

Identifier

peek()[source]

Quickly look at observations

Uses IPython widgets. TODO: Change to bokeh

pop(i=-1)
classmethod read(directory, pha_typeII=False)[source]

Read multiple observations

This methods reads all PHA files contained in a given directory. Enable pha_typeII to read a PHA type II file.

see https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node8.html

TODO: Replace with more sophisticated file managment system

Parameters:

directory : Path

Directory holding the observations

pha_typeII : bool, default: False

Read PHA typeII file

remove(item)
reverse()
safe_range(method='inclusive')[source]

Safe energy range

This is the energy range in with any / all observations have their safe threshold

Parameters:

method : str, {‘inclusive’, ‘exclusive’}

Maximum or minimum range

sort(*args, **kwds)
stack()[source]

Return stacked SpectrumObservation

write(outdir=None, pha_typeII=False, **kwargs)[source]

Create OGIP files

Each observation will be written as seperate set of FITS files by default. If the option pha_typeII is enabled all on and off counts spectra will be collected into one PHACountsSpectrumList and written to one FITS file. All datasets will be associated to the same response files. see https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node8.html

TODO: File written with the pha_typeII option are not read properly with sherpa. This could be a sherpa issue. Investigate and file issue.

Parameters:

outdir : str, Path, optional

Output directory, default: pwd

pha_typeII : bool, default: False

Collect PHA datasets into one file