pha class public methods

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

    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 vector<Real>& inPha, const vector<Real>& inStatError,
         const vector<Real>& inSysError, const vector<Integer>& inChannel,
         const vector<Integer>& inQuality, const vector<Integer>& inGroup,
         const vector<Real>& inAreaScaling, const vector<Real>& inBackScaling,
         const Integer inFirstChannel, const Real inExposure,
         const Real inCorrectionScaling, const Integer inDetChans,
         const bool inPoisserr, const map<string,string>& inKeys,
         const vector<string>& inXSPECFilter = vector<string>())
    

    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(vector<Integer>& Start, vector<Integer>& 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 = 0,
                                   const Integer EndChannel = 0) const
    

    Get grouping (optionally between channels StartChannel and EndChannel) using a minimum number of counts per bin.

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

    Get grouping (optionally between channels StartChannel and EndChannel) using a minimum S/N. Optionally includes a background file as well.

  •  grouping getMinSNOptimalGrouping(const vector<Real> FWHM,
                               const Real SignalToNoise, 
                               const pha& Background = pha(),
                               const Integer StartChannel = 0,
                               const Integer EndChannel = 0) 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.

  •  Integer rebinChannels(grouping& groupInfo,
                           const string errorType = “PROPAGATE”)
    

    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 vector<Integer>& Start, 
                       const vector<Integer>& End, const vector<Real>& Shift,
                       const vector<Real>& Factor)
    
     Integer shiftChannels(const vector<Real>& ChannelLowEnergy,
                       const vector<Real>& ChannelHighEnergy, 
                       const Integer Start, const Integer End, 
                       const Real Shift, const Real Factor = 1.0)
    
     Integer shiftChannels(const vector<Real>& ChannelLowEnergy,
                       const vector<Real>& ChannelHighEnergy, 
                       const vector<Integer>& Start, const vector<Integer>& End,
                       const vector<Real>& Shift, const vector<Real>& 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 vector<Real>& ChannelLowEnergy,
                          const vector<Real>& 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 vector<Real>s.


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

Last modified: Wednesday, 23-Mar-2022 21:09:00 EDT