rmf()
rmf(const rmf& a)
rmf(const string filename, const Integer RMFnumber = 1)
rmf(const IntegerVector& inNumberGroups,
const std::vector<IntegerVector>& inFirstChannelGroup,
const std::vector<IntegerVector>& inNumberChannelsGroup,
const std::vector<IntegerVector>& inOrderGroup,
const RealVector& inLowEnergy, const RealVector& inHighEnergy,
const std::vector<RealVector>& inMatrix,
const RealVector& inChannelLowEnergy,
const RealVector& inChannelHighEnergy,
const Integer inFirstChannel, const Real inAreaScaling,
const Real inResponseThreshold, const std::map<string,string>& inKeys)
Constructors. The first is the default constructor. The rest
are constructor versions of the copy, read, and load methods
described below.
~rmf()
Default destructor.
Integer read(string filename, Integer RMFnumber = 1)
Read the RMF file into an object. If RMFnumber is given read
from the MATRIX (or SPECRESP MATRIX) and EBOUNDS extensions
with EXTVER=RMFnumber. If there is only one EBOUNDS
extension then that will be used.
Integer readMatrix(string filename, Integer RMFnumber = 1)
Read the MATRIX (or SPECRESP MATRIX) extension from an RMF
file into an object. If RMFnumber is given read from the
MATRIX (or SPECRESP MATRIX) extension with EXTVER=RMFnumber.
Integer readChannelBounds(string filename, Integer RMFnumber = 1)
Read the EBOUNDS extension from an RMF file into an object.
If RMFnumber is given read from the EBOUNDS extension with
EXTVER=RMFnumber.
Integer load(const IntegerVector& inNumberGroups,
const std::vector<IntegerVector>& inFirstChannelGroup,
const std::vector<IntegerVector>& inNumberChannelsGroup,
const std::vector<IntegerVector>& inOrderGroup,
const RealVector& inLowEnergy,
const RealVector& inHighEnergy,
const std::vector<RealVector>& inMatrix,
const RealVector& inChannelLowEnergy,
const RealVector& inChannelHighEnergy,
const Integer inFirstChannel, const Real inAreaScaling,
const Real inResponseThreshold,
const std::map<string,string>& inKeys)
Load the rmf object with the required information. The
inKeys map is used to set the string members with the first
element being the FITS keyword name and the second the values.
void initialize(const arf&)
Initialize from an arf object. Copies members in common between arfs and rmfs
void loadDiagonalResponse(const RealVector& eLow,
const RealVector& eHigh,
const RealVector& rspVals,
const Integer firstChan)
Load the simple case of a diagonal response where the
response energy and channel energy ranges are assumed to be
the same and the only non-zero response values are along the
diagonal and are set using the rspVals argument.
rmf& operator= (const rmf&)
rmf& copy(const rmf&)
Deep copy.
Real ElementValue(Integer Channel, Integer EnergyBin,
Integer GratingOrder = -999)
Return the value for a particular channel, energy, and
grating order. If the grating order argument is set to -999
then it is ignored.
RealVector RowValues(Integer EnergyBin,
Integer GratingOrder = -999)
Return the response array for a particular energy and
grating order. If the grating order argument is set to -999
then it is ignored.
IntegerVector RandomChannels(const Real energy,
const Integer NumberPhotons,
const RealVector& RandomNumber,
const Integer GratingOrder = -999)
IntegerVector RandomChannels(const RealVector& energy,
const IntegerVector& NumberPhotons,
const std::vector<RealVector>& RandomNumber,
Integer GratingOrder = -999)
Use the response matrix to generate random channel numbers
for photons of given energy and grating order. When using a
vector of energies, NumberPhotons[i] events are generated
for energy[i]. The RandomNumber input should be uniformly
distributed between 0 and 1. There should be NumberPhotons[i]
random numbers for energy[i]. If the grating order argument
is set to -999 then it is ignored.
string disp() const
Display information about the response. - return as a string.
void clear()
Clear information from the response.
void clearMatrix()
Clear only the matrix information from the response.
string check() const
Check completeness and consistency of information in the rmf,
if there is a problem then return diagnostic in string.
void normalize()
Normalize the rmf so it sums to 1.0 for each energy bin.
void compress(const Real threshold)
Compress the rmf to remove all elements below the threshold value.
void uncompress()
Uncompress the rmf i.e. turn it into a full rectangular matrix.
Integer rebinChannels(grouping&)
Rebin in channel space using the specified grouping object.
Integer rebinEnergies(grouping&)
Rebin in energy space using the specified grouping object.
Integer shiftChannels(const Integer Start,
const Integer End, const Real Shift,
const Real Factor,
bool useEnergyBounds)
Integer shiftChannels(const IntegerVector& vStart,
const IntegerVector& vEnd,
const RealVector& vShift,
const RealVector& vFactor,
bool useEnergyBounds)
Remap the response up or down in channels. Moves response
between channels Start and End by Shift channels and
stretches by Factor. If useEnergyBounds is true then Shift
is assumed to be in energy, otherwise in channels.
Integer shiftEnergies(const Integer Start, const Integer End,
const Real Shift, const Real Factor)
Integer shiftEnergies(const IntegerVector& vStart,
const IntegerVector& vEnd,
const RealVector& vShift,
const RealVector& vFactor)
Remap the response up or down in energies. Moves response
between energy bins Start and End by Shift energy and
stretches by Factor. Shift is assumed to be in energy.
Integer remapEnergies(const RealVector& targetEnergies)
Remap the response onto an arbitrary energy grid (which
should be coarser than the original).
Integer interpolateAndMultiply(const RealVector& energies,
const RealVector& factors)
Multiply by a vector which may not have the same energy
binning as the response.
Integer write(const string filename,
const string sourceFilename="") const
Write response to a RMF file. Note that if the output
filename exists and already has MATRIX and EBOUNDS
extensions then this method will write additional
extensions provided that no sourceFilename is given.
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 EBOUNDS
and MATRIX extensions.
Integer writeMatrix(const string filename) const
Write the MATRIX extension to a RMF file. Note that if the
output filename exists and already has a MATRIX extension
then this method will write an additional extension.
Integer writeChannelBounds(const string filename) const
Write the EBOUNDS extension to a RMF file. Note that if the
output filename exists and already has a EBOUNDS extension then
these methods will write an additional extension.
rmf& operator*=(const arf&)
Multiply current rmf by an arf.
rmf& operator*=(const Real&)
Multiply current rmf by a factor.
rmf& operator+=(const rmf&)
Add another rmf to the current rmf.
Integer checkCompatibility(const rmf&)
Check compatibility with another rmf.
Integer checkCompatibility(const arf&)
Check compatibility with an arf.
Integer convertUnits()
Convert energy units from current units to keV. Valid
options for the current units are keV, MeV, GeV, Hz,
angstrom, cm, micron, nm.
void reverseRows()
Reverse the rows. This is useful if the rows are not in
increasing order of energy, which xspec requires.
void addRow(const RealVector& Response,
const Real eLow, const Real eHigh)
void addRow(const std::vector<RealVector>& Response, const Real eLow,
const Real eHigh, const IntegerVector& GratingOrder)
Add a row to the response using an input response vector and energy range.
void addRow(const IntegerVector& fChan, const IntegerVector& nChan,
const RealVector& Response, const Real eLow, const Real eHigh)
Add a row to the response using channel group format
void substituteRow(const Integer RowNumber,
const RealVector& Response)
void substituteRow(const Integer RowNumber,
const std::vector<RealVector>& Response,
const IntegerVector& GratingOrder)
Substitute a row into the response using an input response
vector and energy range.
void substituteRow(const IntegerVector& fChan,
const IntegerVector& nChan, const RealVector& Response,
const Real eLow, const Real eHigh)
Substitute a row into the response using channel group format
RealVector multiplyByModel(const RealVector& model)
Multiply a response by a vector and output a vector of pha
values. The input vector is assumed to be on the energy binning.
RealVector estimatedFWHM() const
Return a vector containing the FWHM in channels for each
energy. This does assume that the response has a
well-defined main peak.
RealVector estimatedFWHMperChannel() const
Return a vector containing the FWHM in channels for each
channel. This does assume that the response has a
well-defined main peak.
Integer NumberChannels() const
Integer getNumberChannels() const
Return the number of spectrum channels.
Integer NumberEnergyBins() const
Integer getNumberEnergyBins() const
Return the number of response energies.
Integer NumberTotalGroups() const
Integer getNumberTotalGroups() const
Return the number of response groups.
Integer NumberTotalElements() const
Integer getNumberTotalElements() const\end{verbateim}
Return the number of response elements.
\end{itemize}
\subsection{Public rmf methods to get and set internal data}
\begin{itemize}
\item \begin{verbatim} Integer getFirstChannel() const
void setFirstChannel(const Integer value)
const IntegerVector& getNumberGroups() const
Integer setNumberGroups(const IntegerVector& values)
Integer getNumberGroupsForEnergyBin(const Integer i) const
Integer setNumberGroupsForEnergyBin(const Integer i, const Integer value)
const std::vector<IntegerVector>& getFirstChannelGroup() const
Integer setFirstChannelGroup(const std::vector<IntegerVector>& values)
IntegerVector& getFirstChannelGroupForEnergyBin(const Integer i) const
Integer setFirstChannelGroupForEnergyBin(const IntegerVector i,
const Integer value)
const std::vector<IntegerVector>& getNumberChannelsGroup() const
Integer setNumberChannelsGroup(const std::vector<IntegerVector>& values)
IntegerVector& getNumberChannelsGroupForEnergyBin(const Integer i) const
Integer setNumberChannelsGroupForEnergyBin(const Integer i,
const IntegerVector value)
const std::vector<IntegerVector>& Getordergroup() const
Integer setOrderGroup(const std::vector<IntegerVector>& values)
IntegerVector& getOrderGroupForEnergyBin(const Integer i) const
Integer setOrderGroupForEnergyBin(const Integer i, const Integer value)
const RealVector& getLowEnergy() const
Integer setLowEnergy(const RealVector& values)
Real getLowEnergyElement(const Integer i) const
Integer setLowEnergyElement(const Integer i, const Real value)
const RealVector& getHighEnergy() const
Integer setHighEnergy(const RealVector& values)
Real getHighEnergyElement(const Integer i) const
Integer setHighEnergyElement(const Integer i, const Real value)
const std::vector<RealVector>& getMatrix() const
Integer setMatrix(const std::vector<RealVector>& values)
RealVector& getMatrixForEnergyBin(const Integer i) const
Integer setMatrixElement(const Integer i, const RealVector value)
const RealVector& getChannelLowEnergy() const
Integer setChannelLowEnergy(const RealVector& values)
Real getChannelLowEnergyElement(const Integer i) const
Integer setChannelLowEnergyElement(const Integer i, const Real value)
const RealVector& getChannelHighEnergy() const
Integer setChannelHighEnergy(const RealVector& values)
Real getChannelHighEnergyElement(const Integer i) const
Integer setChannelHighEnergyElement(const Integer i, const Real value)
Real getAreaScaling() const
void setAreaScaling(const Real value)
Real getResponseThreshold() const
void setResponseThreshold(const Real value)
string getEnergyUnits() const
void setEnergyUnits(const string value)
string getRMFUnits() const
void setRMFUnits(const string value)
string getChannelType() const
void setChannelType(const string value)
string getTelescope() const
void setTelescope(const string value)
string getInstrument() const
void setInstrument(const string value)
string getDetector() const
void setDetector(const string value)
string getFilter() const
void setFilter(const string value)
string getRMFType() const
void setRMFType(const string value)
string getRMFExtensionName() const
void setRMFExtensionName(const string value)
string getEBDExtensionName() const
void setEBDExtensionName(const string value)
string getStokesParameter() const
void setStokesParameter(const string value)
string getStokesWeighting() const
void setStokesWeighting(const string value)