SpectrumObservationList¶
-
class
gammapy.spectrum.SpectrumObservationList(initlist=None)[source]¶ Bases:
collections.UserListList of
SpectrumObservationobjects.Attributes Summary
obs_idList of observations ids off_vector_listOff PHACountsSpectrumListon_vector_listOn PHACountsSpectrumListtotal_livetimeSummed livetime Methods Summary
append(item)S.append(value) – append value to the end of the sequence clear()copy()count(value)extend(other)S.extend(iterable) – extend sequence by appending elements from the iterable index(value, [start, [stop]])Raises ValueError if the value is not present. insert(i, item)S.insert(index, value) – insert value before index obs(obs_id)Return one observation. peek()Quickly look at observations pop([index])Raise IndexError if list is empty or index is out of range. read(directory[, pha_typeII])Read multiple observations remove(item)S.remove(value) – remove first occurrence of value. reverse()S.reverse() – reverse IN PLACE safe_range([method])Safe energy range sort(*args, **kwds)stack()Return stacked SpectrumObservationwrite([outdir, pha_typeII])Create OGIP files Attributes Documentation
-
obs_id¶ List of observations ids
-
off_vector_list¶
-
on_vector_list¶
-
total_livetime¶ Summed livetime
Methods Documentation
-
append(item)¶ S.append(value) – append value to the end of the sequence
-
clear() → None -- remove all items from S¶
-
copy()¶
-
count(value) → integer -- return number of occurrences of value¶
-
extend(other)¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
insert(i, item)¶ S.insert(index, value) – insert value before index
-
pop([index]) → item -- remove and return item at index (default last).¶ Raise IndexError if list is empty or index is out of range.
-
classmethod
read(directory, pha_typeII=False)[source]¶ Read multiple observations
This methods reads all PHA files contained in a given directory. Enable
pha_typeIIto 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 :
pathlib.Path Directory holding the observations
- pha_typeII : bool, default: False
Read PHA typeII file
- directory :
-
remove(item)¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
reverse()¶ S.reverse() – reverse IN PLACE
-
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_typeIIis enabled all on and off counts spectra will be collected into onePHACountsSpectrumListand 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.htmlTODO: File written with the
pha_typeIIoption are not read properly with sherpa. This could be a sherpa issue. Investigate and file issue.Parameters: - outdir : str,
pathlib.Path, optional Output directory, default: pwd
- pha_typeII : bool, default: False
Collect PHA datasets into one file
- outdir : str,
-