XBinSpectrum¶
This is a subclass of XraySpectrum1D that provides extra attributions and functions for grouping the spectrum bins.
-
class
pyxsis.binspectrum.
XBinSpectrum
(*args, **kwargs)[source]¶ -
assign_bkg
(bkgspec, format='chandra_hetg', colname='COUNTS')[source]¶ Assign a background spectrum.
Inputs
bkgspec : str or XBkgSpectrum
If a string, loads background from the specified FITS file. Otherwise, stores the input in the XBinSpectrum.bkg attributes.
format : str
Specifies the format of the background file.
If ‘chandra_hetg’, runs XBkgSpectrum.load_HETG. Otherwise, runs XBkgSpectrum.load
colname : str
Specifies the column name of the relevant counts histogram when running XBkgSpectrum.load
-
binned_bkg
(bin_unit=None, use_backscale=True)[source]¶ Return the background spectrum using the same spectral binning.
Inputs
- bin_unitAstropy unit (default:None)
If not None, returns the bin edges in the desired units
- use_backscalebool
If True, returns the background scaled by the backscal value.
Returns
- bin_loastropy.Quantity
Lower edges for the new background bins
- bin_hiastropy.Quantity
Higher edges for the new background bins
- countsastropy.Quantity
Counts for the binned background histogram
- cts_errastropy.Quantity
Error on the new background bins
-
binned_counts
(bin_unit=None, error_type='Gauss', subtract_bkg=False, use_backscale=True)[source]¶ Returns the binned counts histogram from the noticed spectral region.
Inputs
- bin_unitAstropy unit (default:None)
If not None, returns the bin edges in the desired units
- error_typestring [‘Gehrels’ (default) or ‘Gauss’]
If ‘Gauss’, returns cts_err = sqrt(cts). If ‘Gehrels’, returns cts_err = 1.0 + sqrt(cts + 0.75)
- subtract_bkgbool
If True, supply the background subtracted region spectrum (only if a background spectrum is supplied)
- use_backscalebool
If True, scales the background by the backscal value
Returns
- bin_loastropy.Quantity
Lower edges for the new bins
- bin_hiastropy.Quantity
Higher edges for the new bins
- countsastropy.Quantity
Counts for the new bins
- cts_errastropy.Quantity
Error on the new bins
-
notice_range
(bmin, bmax)[source]¶ Define edges for spectral regions to notice. Notices regions exclusively.
>>> XBinSpectrum.notice(1.0*u.keV, 3.0*u.keV)
will notice only the region between 1 and 3 keV.
Inputs
- bminastropy.Quantity
Minimum value for the notice region
- bmaxastropy.Quantity
Maxium value for the notice region
Returns
Modifies the XraySpectrum1D.notice attribute.
-