|
PyXspec
1.0.1
|
Public Member Functions | |
| def | __init__ |
| def | setPars |
| def | show |
Public Attributes | |
| gain | |
| A response model object (class RModel) for applying a shift in response file gain. | |
| arf | |
| Get/Set the arf filename string. | |
| chanEnergies | |
| Tuple of floats, the detector channel energies in keV. | |
| energies | |
| Tuple of floats, the photon energies in keV which are stored in the MATRIX extension. | |
| rmf | |
| The response file name string. | |
| sourceNumber | |
| The 1-based source number for which the response is assigned. | |
Detector response class.
Public instance attributes implemented as properties, these are GET only
unless specified otherwise.
arf -- Get/Set the arf filename string.
Enter None or empty string to remove an existing arf.
chanEnergies -- Tuple of floats, the detector channel energies in keV.
These are the energies normally stored in the
EBOUNDS extension.
energies -- Tuple of floats, the photon energies in keV which are
stored in the MATRIX extension.
gain -- A response model object (class RModel) for applying
a shift in response file gain.
(Also see Response.setPars() for setting multiple
gain parameters at a time.)
When gain is turned ON, it creates two variable
fit Parameter object members:
gain.slope (default = 1.0)
gain.offset (default = 0.0)
To turn gain ON simply assign a value to EITHER
parameter, ie.:
gain.slope = 1.05
This automatically also creates a gain.offset
parameter with default value 0.0, which you may
want to re-adjust. Examples:
gain.offset = .02
gain.offset.values = ".015,.001,,,,0.1"
'slope' and 'offset' are of the same type as regular
model parameters, and therefore have the same
functions, attributes, and syntax rules for setting
values. (See the Parameter class help for more
details.)
To turn gain OFF, call its off() method:
gain.off()
gain.off() restores the response to its original state,
and DELETES the 'slope' and 'offset' parameters.
Therefore any references to 'slope' and 'offset' are
INVALID after gain is turned off.
rmf -- The response file name string.
sourceNumber -- The 1-based source number for which the response is
assigned.
This is normally always 1 unless multiple sources are
loaded for multiple-model evaluation.
| def __init__ | ( | self, | |
| parent, | |||
| respTuple | |||
| ) |
Construct a Response object. Intended for creation by a Spectrum object only.
| def setPars | ( | self, | |
| seqPars | |||
| ) |
Set multiple response parameters with a single function call.
Similar to the Model.setPars() function, this allows multiple
response parameters to be changed with just a SINGLE recalculation
performed at the end.
seqPars -- An arbitrary number of CONSECUTIVE parameter values
to be matched 1-to-1 with the response model's
parameters.
Currently just 1 response model ('gain') is available, which has
2 response parameters ('slope' and 'offset').
Examples:
s = Spectrum("file1")
resp = s.response
# 'gain' is off by default and response parameters don't yet exist.
# The following call automatically turns 'gain' on and creates
# both 'slope' and 'offset' parameters even though it is only
# assigning to 'slope'. 'offset' will retain its default value
# of 0.0.
resp.setPars(1.05) # Equivalent to doing: resp.gain.slope = 1.05
# This is equivalent to: resp.gain.slope = .995
# resp.gain.offset = .08
# except that the recalculation is only performed at the end
# rather than after each parameter is changed:
resp.setPars(.995, .08)
# Can also assign auxiliary values by passing 1 or 2 string
# arguments.
resp.setPars("1.1,,.02,.02,1.8,1.8","-.05,,-2,-2")
# Remove gain and delete the response parameters:
resp.gain.off()
| def show | ( | self | ) |
Display response information including (optional) response parameters.
Get/Set the arf filename string.
Enter None or empty string to remove an existing arf.
Tuple of floats, the detector channel energies in keV.
These are the energies normally stored in the EBOUNDS extension.
Tuple of floats, the photon energies in keV which are stored in the MATRIX extension.
A response model object (class RModel) for applying a shift in response file gain.
(Also see Response.setPars() for setting multiple
gain parameters at a time.)
When gain is turned ON, it creates two variable
fit Parameter object members:
gain.slope (default = 1.0)
gain.offset (default = 0.0)
To turn gain ON simply assign a value to EITHER
parameter, ie.:
gain.slope = 1.05
This automatically also creates a gain.offset
parameter with default value 0.0, which you may
want to re-adjust. Examples:
gain.offset = .02
gain.offset.values = ".015,.001,,,,0.1"
'slope' and 'offset' are of the same type as regular
model parameters, and therefore have the same
functions, attributes, and syntax rules for setting
values. (See the Parameter class help for more
details.)
To turn gain OFF, call its off() method:
gain.off()
gain.off() restores the response to its original state,
and DELETES the 'slope' and 'offset' parameters.
Therefore any references to 'slope' and 'offset' are
INVALID after gain is turned off.
The response file name string.
The 1-based source number for which the response is assigned.
This is normally always 1 unless multiple sources are
loaded for multiple-model evaluation.
1.7.5.1