Package astLib :: Module astPlots
[hide private]
[frames] | no frames]

Module astPlots

source code

module for producing astronomical plots

(c) 2007, 2008 Matt Hilton

http://astlib.sourceforge.net

Functions [hide private]
 
finderChart(imageData, imageWCS, RADeg, decDeg, clipSizeDeg, outputFileName=None, cutLevels=["smart",99.5], colorMapName="gray", title=None, axisLabels="sexagesimal", minorLabels=False, colorBar="off")
Makes a finder chart from a square section clipped from the given image array and astWCS.
source code
 
contourOverlayChart(imageData, imageWCS, contourImageData, contourImageWCS, RADeg, decDeg, clipSizeDeg, contourLevels, outputFileName=None, cutLevels=["smart",99.5], colorMapName="gray", contourSmoothFactor=0, contourColor="white", contourWidth=1, title=None, axisLabels="sexagesimal", minorLabels=False, colorBar="off")
Makes a plot of an image array with a second image array overlaid as a contour map, with celestial coordinate axes determined from WCS information.
source code
 
makeWCSAxisLabels(imageData, imageWCS, axisLabels="sexagesimal", minorLabels=False)
This function calculates the positions of coordinate labels for the RA and Dec axes of the given image array and WCS.
source code
dictionary
getTickSteps(plotSizeDeg, axis, mode="sexagesimal")
Chooses the appropriate WCS coordinate tick steps for the given axis of a plot of given size.
source code
Variables [hide private]
dictionary list DEC_TICK_STEPS = [{'deg': 1.0/ 60.0/ 60.0, 'int': 1, 'unit': "...
Defines the possible coordinate label steps on the delination axis in sexagesimal mode.
dictionary list RA_TICK_STEPS = [{'deg':(1.0/ 60.0/ 60.0/ 24.0)* 360.0, 'int':...
Defines the possible coordinate label steps on the right ascension axis in sexagesimal mode.
list DECIMAL_TICK_STEPS = [0.001, 0.0025, 0.005, 0.01, 0.025, 0.05,...
Defines the possible coordinate label steps on both coordinate axes in decimal degrees mode.
string DEG = u"\N{DEGREE SIGN}"
Variable to stand in for the degrees symbol.
string PRIME = "\'"
Variable to stand in for the prime symbol.
string DOUBLE_PRIME = "\""
Variable to stand in for the double prime symbol.
Function Details [hide private]

finderChart(imageData, imageWCS, RADeg, decDeg, clipSizeDeg, outputFileName=None, cutLevels=["smart",99.5], colorMapName="gray", title=None, axisLabels="sexagesimal", minorLabels=False, colorBar="off")

source code 

Makes a finder chart from a square section clipped from the given image array and astWCS. The image array is rotated such that North is at the top, East is at the left. The axes can be marked in either sexagesimal or decimal celestial coordinates: the appropriate axis scales will be determined automatically from the size of the clipped image section.

By default, this function does not write the finder chart to a file - instead, the figure will become the currently active matplotlib.pylab figure (this allows the user to modify the figure as desired). To output the figure to a file, set outputFileName to the path where you wish to save the figure: the file format will be determined from the file extension (e.g. .eps, .png), and can be any file format that matplotlib is capable of writing.
Parameters:
  • imageData (numpy array) - image data array
  • imageWCS (astWCS.WCS) - astWCS.WCS object
  • RADeg (float) - coordinate in decimal degrees
  • decDeg (float) - coordinate in decimal degrees
  • clipSizeDeg (float) - size of square clipped section in decimal degrees
  • outputFileName (string) - path where to save the figure, file format determined by the file extention (e.g. .eps, .png)
  • cutLevels (list) - sets the image scaling - available options:
    • pixel values: cutLevels=[low value, high value].
    • histogram equalisation: cutLevels=["histEq", number of bins ( e.g. 1024)]
    • relative: cutLevels=["relative", cut per cent level (e.g. 99.5)]
    • smart: cutLevels=["smart", cut per cent level (e.g. 99.5)]
    ["smart", 99.5] seems to provide good scaling over a range of different images.
  • colorMapName (string) - name of a standard matplotlib colormap, e.g. "hot", "cool", "gray" etc. (do "help(pylab.colormaps)" in the Python interpreter to see available options)
  • title (string) - optional title for the plot
  • axisLabels (string) - either "sexagesimal" (for H:M:S, D:M:S) or "decimal" (for decimal degrees)
  • minorLabels (bool) - if set to True, add additional labels between coordinate labels
  • colorBar (bool) - if True, plot a vertical color bar at the side of the image indicating the intensity scale.

contourOverlayChart(imageData, imageWCS, contourImageData, contourImageWCS, RADeg, decDeg, clipSizeDeg, contourLevels, outputFileName=None, cutLevels=["smart",99.5], colorMapName="gray", contourSmoothFactor=0, contourColor="white", contourWidth=1, title=None, axisLabels="sexagesimal", minorLabels=False, colorBar="off")

source code 

Makes a plot of an image array with a second image array overlaid as a contour map, with celestial coordinate axes determined from WCS information. The image arrays are rotated such that North is at the top, East is at the left. The axes can be marked in either sexagesimal or decimal celestial coordinates: the appropriate axis scales will be determined automatically from the size of the clipped image section.

By default, this function does not write the finder chart to a file - instead, the figure will become the currently active matplotlib.pylab figure (this allows the user to modify the figure as desired). To output the figure to a file, set outputFileName to the path where you wish to save the figure: the file format will be determined from the file extension (e.g. .eps, .png), and can be any file format that matplotlib is capable of writing.
Parameters:
  • imageData (numpy array) - image data array for the background image
  • imageWCS (astWCS.WCS) - astWCS.WCS object for the background image
  • contourImageData (numpy array) - image data array from which contours are to be generated
  • contourImageWCS (astWCS.WCS) - astWCS.WCS object for the image to be contoured
  • RADeg (float) - coordinate in decimal degrees
  • decDeg (float) - coordinate in decimal degrees
  • clipSizeDeg (float) - size of square clipped section in decimal degrees
  • contourLevels (list) - sets the contour levels - available options:
    • values: contourLevels=[list of values specifying each level]
    • linear spacing: contourLevels=['linear', min level value, max level value, number of levels]
    • log spacing: contourLevels=['log', min level value, max level value, number of levels]
    For linear and log spacing, the minimum contour level can either be set explicitly or have one of the following special values:
    • 'min': sets the minimum level automatically to the minimum value in contourImageData
    • ['mean', x]: sets the minimum level to x*the mean value of contourImageData
    • ['median', x]: sets the minimum level to x*the median value of contourImageData
    • ['mode', x]: sets the minimum level x*the mode value of the contourImageData (note that the mode is estimated using mode=3*median-2*mode: if mode<0 and log scaling is set, defaults to using x*median as the minimum contour level.)
    Likewise, the maximum contour level can either be set explicitly or have the following special value:
    • 'max': sets the maximum level automatically to the maximum value of contourImageData
  • outputFileName (string) - path where to save the figure, file format determined by the file extention (e.g. .eps, .png)
  • cutLevels (list) - sets the image scaling - available options:
    • pixel values: cutLevels=[low value, high value].
    • histogram equalisation: cutLevels=["histEq", number of bins ( e.g. 1024)]
    • relative: cutLevels=["relative", cut per cent level (e.g. 99.5)]
    • smart: cutLevels=["smart", cut per cent level (e.g. 99.5)]
    ["smart", 99.5] seems to provide good scaling over a range of different images.
  • colorMapName (string) - name of a standard matplotlib colormap, e.g. "hot", "cool", "gray" etc. (do "help(pylab.colormaps)" in the Python interpreter to see available options)
  • contourSmoothFactor (float) - standard deviation (in pixels) of Gaussian filter for pre-smoothing of contour image data (set to 0 for no smoothing)
  • contourColor (string) - color of the overlaid contours, specified by the name of a standard matplotlib color, e.g., "black", "white", "cyan" etc. (do "help(pylab.colors)" in the Python interpreter to see available options)
  • contourWidth (int) - width of the overlaid contours
  • title (string) - optional title for the plot
  • axisLabels (string) - either "sexagesimal" (for H:M:S, D:M:S) or "decimal" (for decimal degrees)
  • minorLabels (bool) - if set to True, add additional labels between coordinate labels
  • colorBar (bool) - if True, plot a vertical color bar at the side of the image indicating the intensity scale.

makeWCSAxisLabels(imageData, imageWCS, axisLabels="sexagesimal", minorLabels=False)

source code 
This function calculates the positions of coordinate labels for the RA and Dec axes of the given image array and WCS. The labels are applied to the x and y tick marks of the currently active matplotlib figure.
Parameters:
  • imageData (numpy array) - image data array
  • imageWCS (astWCS.WCS) - astWCS.WCS object
  • axisLabels (string) - either "sexagesimal" (for H:M:S, D:M:S) or "decimal" (for decimal degrees)
  • minorLabels (bool) - if set to True, add additional labels between coordinate labels

getTickSteps(plotSizeDeg, axis, mode="sexagesimal")

source code 
Chooses the appropriate WCS coordinate tick steps for the given axis of a plot of given size.
Parameters:
  • plotSizeDeg (float) - size of plot in decimal degrees
  • axis (string) - either "ra" or "dec"
  • mode (string) - either "sexagesimal" (for H:M:S, D:M:S) or "decimal" (for decimal degrees)
Returns: dictionary
tick step sizes for major, minor and unlabelled plot ticks, in format {'major', 'minor', 'unmarked'}

Note: axis is ignored is mode = "decimal"


Variables Details [hide private]

DEC_TICK_STEPS

Defines the possible coordinate label steps on the delination axis in sexagesimal mode. Dictionary format: {'deg', 'int', 'unit'}
Type:
dictionary list
Value:
[{'deg': 1.0/ 60.0/ 60.0, 'int': 1, 'unit': "s"}, {'deg': 5.0/ 60.0/ 6\
0.0, 'int': 5, 'unit': "s"}, {'deg': 10.0/ 60.0/ 60.0, 'int': 10, 'uni\
t': "s"}, {'deg': 30.0/ 60.0/ 60.0, 'int': 30, 'unit': "s"}, {'deg': 1\
.0/ 60.0, 'int': 1, 'unit': "m"}, {'deg': 5.0/ 60.0, 'int': 5, 'unit':\
 "m"}, {'deg': 15.0/ 60.0, 'int': 15, 'unit': "m"}, {'deg': 30.0/ 60.0\
, 'int': 30, 'unit': "m"}, {'deg': 1.0, 'int': 1, 'unit': "d"}, {'deg'\
: 5.0, 'int': 5, 'unit': "d"}, {'deg': 10.0, 'int': 10, 'unit': "d"}, \
{'deg': 30.0, 'int': 30, 'unit': "d"}]

RA_TICK_STEPS

Defines the possible coordinate label steps on the right ascension axis in sexagesimal mode. Dictionary format: {'deg', 'int', 'unit'}
Type:
dictionary list
Value:
[{'deg':(1.0/ 60.0/ 60.0/ 24.0)* 360.0, 'int': 1, 'unit': "s"}, {'deg'\
:(5.0/ 60.0/ 60.0/ 24.0)* 360.0, 'int': 5, 'unit': "s"}, {'deg':(10.0/\
 60.0/ 60.0/ 24.0)* 360.0, 'int': 10, 'unit': "s"}, {'deg':(30.0/ 60.0\
/ 60.0/ 24.0)* 360.0, 'int': 30, 'unit': "s"}, {'deg':(1.0/ 60.0/ 24.0\
)* 360.0, 'int': 1, 'unit': "m"}, {'deg':(5.0/ 60.0/ 24.0)* 360.0, 'in\
t': 5, 'unit': "m"}, {'deg':(10.0/ 60.0/ 24.0)* 360.0, 'int': 15, 'uni\
t': "m"}, {'deg':(30.0/ 60.0/ 24.0)* 360.0, 'int': 30, 'unit': "m"}, {\
'deg':(1.0/ 24.0)* 360.0, 'int': 1, 'unit': "h"}, {'deg':(3.0/ 24.0)* \
...

DECIMAL_TICK_STEPS

Defines the possible coordinate label steps on both coordinate axes in decimal degrees mode.
Type:
list
Value:
[0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.\
0, 10.0, 30.0, 90.0]