pha class public methods

  •  pha()
    
     pha(const pha& a)
    
     pha(const string filename, const Integer PHAnumber = 1,
         const Integer SpectrumNumber = 1)
    
     pha(const RealVector& inPha, const RealVector& inStatError,
         const RealVector& inSysError, const IntegerVector& inChannel,
         const IntegerVector& inQuality, const IntegerVector& inGroup,
         const RealVector& inAreaScaling, const RealVector& inBackScaling,
         const Integer inFirstChannel, const Real inExposure,
         const Real inCorrectionScaling, const Integer inDetChans,
         const bool inPoisserr, const std::map<string,string>& inKeys,
         const StringVector& inXSPECFilter = StringVector())
    

    Constructors. The first is the default constructor, the others are constructor versions of the copy, read, and load methods described below.

  •  ~pha()
    

    Default destructor.

  •  Integer read(string filename, Integer PHAnumber = 1,
                  Integer SpectrumNumber = 1)
    

    Read file into object. If PHAnumber is given then look for the SPECTRUM extension with EXTVER=PHAnumber. The third argument is to read the pha from the SpectrumNumber row of a type II file.

  •  pha(const RealVector& inPha, const RealVector& inStatError,
         const RealVector& inSysError, const IntegerVector& inChannel,
         const IntegerVector& inQuality, const IntegerVector& inGroup,
         const RealVector& inAreaScaling, const RealVector& inBackScaling,
         const Integer inFirstChannel, const Real inExposure,
         const Real inCorrectionScaling, const Integer inDetChans,
         const bool inPoisserr, const std::map<string,string>& inKeys,
         const StringVector& inXSPECFilter = StringVector())
    

    Load all the required information into the pha object.

  •  pha& operator= (const pha&)
    
     pha& copy(const pha&)
    

    Deep copy.

  •  string disp() const
    

    Display information about the spectrum - return as a string.

  •  void clear()
    

    Clear information from the spectrum

  •  string check() const
    

    Check completeness and consistency of information in spectrum, if there is a problem then return diagnostic in string.

  •  Integer write(const string filename, const string sourceFilename="")
    

    Write spectrum as type I file. If sourceFilename is given then the primary HDU and any other extra HDUs are copied into the output file as well as any extra keywords or columns in the spectrum extension.

  •  pha& operator*= (const Real)
    

    Multiply by a constant.

  •  pha& operator+= (const pha&)
    

    Add to another pha. If one or both of the pha have non-Poisson errors then they are added in quadrature. If systematic errors are present then the resulting pha has systematic errors equal to the maximum of those from the input pha. The exposures are added.

  •  Integer checkCompatibility(const pha&) const
    

    Check compatibility with another pha. This should be done before attempting to sum them.

  •  Integer selectChannels(IntegerVector& Start, IntegerVector& End)
    

    Select a subset of the channels

  •  Integer setGrouping(grouping&)
    

    Set the pha grouping array from a grouping object.

  •  grouping getGrouping() const
    

    Get a grouping object from the pha grouping array

  •  grouping getMinCountsGrouping(const Integer MinCounts, 
                                   const Integer StartChannel,
                                   const Integer EndChannel) const
    

    Get grouping (optionally between channels StartChannel and EndChannel) using a minimum number of counts per bin. If StartChannel and EndChannel are both zero then all channels are included.

  •  grouping getMinSNGrouping(const Real SignalToNoise, 
                               const pha& Background,
                               const Integer StartChannel,
                               const Integer EndChannel) const
    

    Get grouping (optionally between channels StartChannel and EndChannel) using a minimum S/N. Optionally includes a background file as well. If StartChannel and EndChannel are both zero then all channels are included. If Background = pha() then the background is not included.

  •  grouping getMinSNOptimalGrouping(const RealVector FWHM,
                                      const Real SignalToNoise,
                                      const pha& Background,
                                      const Integer StartChannel,
                                      const Integer EndChannel) const
    

    Get grouping (optionally between channels StartChannel and EndChannel) using a optimal binning with a minimum S/N. Optionally includes a background file as well. If StartChannel and EndChannel are both zero then all channels are included. If Background = pha() then the background is not included. If SignalToNoise is negative then it will be ignored and only optimal binning is used.

  •  Integer rebinChannels(grouping& groupInfo,
                           const string errorType)
    

    Rebin spectrum channels based on a grouping object. If no string is input then the resulting StatError is calculated by summing in quadrature. If a string is input then the resulting StatError is calculated based on the value of the input string. If it is PROPAGATE then summing in quadrature is used. If not, then GAUSS uses 1/sqrt(Pha), POISS-0 sets Poisserr to true, POISS-1 uses 1 + sqrt(N+0.75), POISS-2 uses sqrt(N-0.25), and POISS-3 uses the arithmetic mean of POISS-1 and POISS-2. In general, only the options PROPAGATE or POISS-0 should be used.

  •  Integer shiftChannels(const Integer Start, const Integer End,
                           const Real Shift, const Real Factor = 1.0)
    
     Integer shiftChannels(const IntegerVector& Start,
                           const IntegerVector& End, const RealVector& Shift,
                           const RealVector& Factor)
    
     Integer shiftChannels(const RealVector& ChannelLowEnergy,
                           const RealVector& ChannelHighEnergy,
                           const Integer Start, const Integer End,
                           const Real Shift, const Real Factor = 1.0)
    
     Integer shiftChannels(const RealVector& ChannelLowEnergy,
                           const RealVector& ChannelHighEnergy,
                           const IntegerVector& Start, const IntegerVector& End,
                           const RealVector& Shift, const RealVector& Factor)
    

    Shift counts in channels. Those counts between channels Start and End will be shifted by Shift channels and stretched by Factor. If the channel energies are given then Shift is assumed to be in energy, otherwise in channels.Total counts are conserved.

  •  Integer convertUnits(const RealVector& ChannelLowEnergy,
                          const RealVector& ChannelHighEnergy,
                          const string EnergyUnits)
    

    Convert flux units from whatever they are currently to ph/cm$^2$/s. This requires as input the channel energy arrays from the rmf object and the string specifying their units. The allowed flux units are: ph/cm$^2$/s/X, where X is one of MeV, GeV, Hz, A, cm, um, nm; ergs/cm$^2$/s; ergs/cm$^2$/s/X, where X is one of Hz, A, cm, um, nm; Jy. The allowed energy units are keV, GeV, Hz, angstrom, cm, micron or nm.

  •  Integer NumberChannels() const
    
     Integer getNumberChannels() const
    

    Return the size of RealVectors.


HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Wednesday, 28-Aug-2024 16:49:29 EDT