|
PyXspec
1.0.1
|
Public Member Functions | |
| def | __init__ |
| def | __call__ |
| def | addCommand |
| def | delCommand |
| def | iplot |
| def | noID |
| def | setGroup |
| def | setID |
| def | setRebin |
| def | show |
| def | x |
| def | xErr |
| def | y |
| def | yErr |
| def | model |
| def | backgroundVals |
Public Attributes | |
| add | |
| Turn on/off the display of individual additive components [bool]. | |
| area | |
| Toggle displaying the data divided by the response effective area for each channel [bool]. | |
| background | |
| Toggle displaying the background spectrum (if any) when plotting data [bool]. | |
| commands | |
| Custom plot commands to be appended to Xspec-generated commands. | |
| device | |
| The plotting device name [string]. | |
| perHz | |
| Toggle displaying Y-axis units per Hz when using wavelength units for X-axis [bool]. | |
| redshift | |
| Apply a redshift to the X-axis energy or wavelength values [float]. | |
| splashPage | |
| When set to False, the usual XSPEC version and build data information will not be printed to the screen when the first plot window is initially opened [bool]. | |
| xAxis | |
| X-Axis Units [string]. | |
| xLog | |
| Set the x-axis to logarithmic or linear for energy or wavelength plots [bool]. | |
| yLog | |
| See xLog. | |
Xspec plotting class.
This is a singleton - only 1 instance allowed
Public instance attributes:
add -- Turn on/off the display of individual additive
components [bool].
area -- Toggle displaying the data divided by the response
effective area for each channel [bool].
background -- Toggle displaying the background spectrum (if any)
when plotting data [bool].
commands -- Custom plot commands to be appended to Xspec-generated
commands.
Get: Returns a tuple of the currently entered command
strings.
Set: Replaces all commands with the new tuple of
strings.
To remove ALL plot commands, set to an empty tuple, ie:
Plot.commands = ()
For inserting and deleting individual commands, use
addCommand and delCommand functions.
device -- The plotting device name [string].
perHz -- Toggle displaying Y-axis units per Hz when using
wavelength units for X-axis [bool].
redshift -- Apply a redshift to the X-axis energy or wavelength
values [float].
This will multiply X-axis energies by a factor of (1+z)
to allow for viewing in the source frame. Y-axis values
will be equally affected in plots which are normalized
by energy or wavelength. Note that this is not
connected in any way to redshift parameters in the model
(or the setplot id redshift parameter) and should only
be used for illustrative purposes.
splashPage -- When set to False, the usual XSPEC version and build data
information will not be printed to the screen when the
first plot window is initially opened [bool].
xAxis -- X-Axis Units [string].
Valid options are: "channel"
(energies) "keV", "MeV", "GeV", "Hz"
(wavelengths) "angstrom", "cm", "micron", nm"
These are case-insensitive and may be abbreviated.
This setting also affects the ignore/notice range
interpretation.
xLog -- Set the x-axis to logarithmic or linear for energy or
wavelength plots [bool].
xLog has no effect on plots in channel space. xLog
and yLog will not work for model-related plots
(eg. model, ufspec, and their variants) as their axes
are always set to log scale.
yLog -- See xLog.
| def __init__ | ( | self, | |
| deviceStr | |||
| ) |
| def __call__ | ( | self, | |
| panes | |||
| ) |
Display the plot.
Input 1 or more plot command strings.
Examples:
Single Plots:
Plot("data")
Plot("model")
Plot("ufspec")
Multiple Plots (or single plots taking additional arguments):
Plot("data","model","resid")
Plot("data model resid")
Plot("data,model,resid")
Plot("data","model m1") # Plots data and a model named "m1".
To repeat a plot using the previously entered arguments,
simply do: Plot()
| def addCommand | ( | self, | |
| cmd | |||
| ) |
Add a plot command [string] to the end of the plot commands list.
| def backgroundVals | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of background data values for a plot group Background value arrays only exist for data plots when the Plot.background flag is set to True.
| def delCommand | ( | self, | |
| num | |||
| ) |
Remove a plot command by (1-based) number [int]. This is intended for removal of single commands. To remove ALL commands, set the Plot.commands attribute to an empty tuple, ie: Plot.commands = ()
| def iplot | ( | self, | |
| panes | |||
| ) |
Display the plot and leave it in interactive plotting mode.
This function takes the same arguments and syntax as when
displaying plots in the regular mode (through Plot's
__call__ method). Examples:
Plot.iplot("data") # 1-panel data plot
Plot.iplot("data model") # 2-panel data and model
Plot.iplot() # Repeats the previous plot.
| def model | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of Y-coordinate model values for a plot group
| def noID | ( | self | ) |
Turn off the plotting of line IDs.
| def setGroup | ( | self, | |
| groupStr | |||
| ) |
Define a range of spectra to be in the same plot group.
Input argument is a string specifying one or more ranges, delimited
by commas and/or spaces.
Examples:
"1-3 4-6" : Spectra 1-3 in plot group 1, 4-6 in group 2.
"1,2 4" : Spectra 1, 2, and 4 are each now in their own group.
"1-**" : All spectra are in a single plot group.
None : If input argument is Python's None variable, all
plot grouping will be removed.
| def setID | ( | self, | |
temperature = None, |
|||
emissivity = None, |
|||
redshift = None |
|||
| ) |
Switch on plotting of line IDs.
All input arguments are floats and are optional. If they are omitted
they will retain their previous values.
temperature -- Selects the temperature of the APEC line list.
emissitivity -- Only lines with emissivities above this setting will
be displayed.
redshift -- Line display will be redshifted by this amount.
To turn off plotting of line IDs, use the noID() function.
| def setRebin | ( | self, | |
minSig = None, |
|||
maxBins = None, |
|||
groupNum = None, |
|||
errType = None |
|||
| ) |
Define characteristics used in rebinning the data (for plotting
purposes ONLY).
All input arguments are optional. If they are omitted they will retain
their previous values.
minSig -- Bins will be combined until this minimum significance
is reached (in units of sigma). [float]
maxBins -- The maximum number of bins to combine in attempt to
reach minSig. [int]
groupNum -- The plot group number to which this setting applies.
If number is negative, it will apply to ALL plot
groups. [int]
errType -- Specifies how to calculate the error bars on the new
bins. Valid entries are "quad", "sqrt", "poiss-1",
"poiss-2", "poiss-3". [string] See the "setplot"
description in the XSPEC manual for more information.
| def show | ( | self | ) |
Display current plot settings
| def x | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of X-coordinate data values for a plot group
| def xErr | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of X-coordinate errors for a plot group
| def y | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of Y-coordinate data values for a plot group
| def yErr | ( | self, | |
plotGroup = 1 |
|||
| ) |
Return a list of Y-coordinate errors for a plot group
Turn on/off the display of individual additive components [bool].
Toggle displaying the data divided by the response effective area for each channel [bool].
Toggle displaying the background spectrum (if any) when plotting data [bool].
Custom plot commands to be appended to Xspec-generated commands.
Get: Returns a tuple of the currently entered command
strings.
Set: Replaces all commands with the new tuple of
strings.
To remove ALL plot commands, set to an empty tuple, ie:
Plot.commands = ()
For inserting and deleting individual commands, use
addCommand and delCommand functions.
The plotting device name [string].
Toggle displaying Y-axis units per Hz when using wavelength units for X-axis [bool].
Apply a redshift to the X-axis energy or wavelength values [float].
This will multiply X-axis energies by a factor of (1+z)
to allow for viewing in the source frame. Y-axis values
will be equally affected in plots which are normalized
by energy or wavelength. Note that this is not
connected in any way to redshift parameters in the model
(or the setplot id redshift parameter) and should only
be used for illustrative purposes.
When set to False, the usual XSPEC version and build data information will not be printed to the screen when the first plot window is initially opened [bool].
X-Axis Units [string].
Valid options are: "channel" (energies) "keV", "MeV", "GeV", "Hz" (wavelengths) "angstrom", "cm", "micron", nm" These are case-insensitive and may be abbreviated. This setting also affects the ignore/notice range interpretation.
Set the x-axis to logarithmic or linear for energy or wavelength plots [bool].
xLog has no effect on plots in channel space. xLog
and yLog will not work for model-related plots
(eg. model, ufspec, and their variants) as their axes
are always set to log scale.
See xLog.
1.7.5.1