Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/plotprofilemap.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
1##################### generated by xml-casa (v2) from plotprofilemap.xml ############
2##################### b8e72814dcbd57ab3b49a9f1b6b9d3a8 ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_plotprofilemap import plotprofilemap as _plotprofilemap_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _plotprofilemap:
15 """
16 plotprofilemap ---- Makes profile map
19 The plotprofilemap makes spectral profile map from specified image.
20 The task accepts both CASA image and FITS cube as an input.
23 --------- parameter descriptions ---------------------------------------------
25 imagename Input image name (CASA image or FITS)
26 figfile Output figure name
27 overwrite Overwrite existing figfile
28 transparent Output transparent figure
29 pol Polarization component to be plotted
30 spectralaxis Type of spectral axis
31 restfreq Rest frequency
32 plotrange Spectral axis range to plot
33 title Title of the plot
34 linecolor Line color
35 linestyle Line style
36 linewidth Line width in points
37 separatepanel Separate plots
38 plotmasked Masked data handling
39 maskedcolor Line color for masked data
40 showaxislabel Show axis labels on the bottom left panel
41 showtick Show axis ticks
42 showticklabel Show axis tick labels on the bottom left panel
43 figsize Size of the figure
44 numpanels Number of panels
45 [1;42mRETURNS[1;m variant
47 --------- examples -----------------------------------------------------------
51 The plotprofilemap makes spectral profile map from specified image.
52 The task accepts both CASA image and FITS cube as an input.
54 It is necessary to specify existing CASA image or FITS cube as an
55 imagename. Otherwise, the task will fail. If figfile is specified,
56 profile map is saved as an PNG image. Please set overwrite to False
57 if you don't want to overwrite existing file.
59 Keyword arguments:
60 imagename -- input image name (CASA image or FITS cube)
61 figfile -- output PNG image name. No output if figfile is empty
62 default: '' (no output)
63 overwrite -- overwrite existing output file
64 default: False
65 transparent -- output transparent figure
66 default: False
67 pol -- polarization component to be plotted. It is an index for stokes axis
68 of the image.
69 default: 0
70 spectralaxis -- spectral axis type
71 default: '' (use image's spectral axis)
72 options: 'channel', 'freuquency', 'velocity'
73 restfreq -- rest frequency
74 default: '' (use image's rest frequency)
75 example: '100GHz'
76 plotrange -- spectral axis range to plot. unit for the range depends on
77 what spectral axis is chosen: channel for 'channel', GHz for
78 'frequency', and km/s for 'velocity'
79 default: '' (whole range)
80 example: '0~1000' (from 0.0 to 1000.0)
81 '~1000' (from minimul value to 1000.0)
82 '24~' (from 24.0 to maximum value)
83 title -- title of the plot
84 default: '' (no title)
85 linecolor -- line color in matplotlib format
86 default: 'b' (blue)
87 example: 'r' (red), 'black', '#ff99ff'
88 linestyle -- line style in matplotlib format
89 default: '-' (solid line)
90 example: '..' (dotted line), '.-' (solid line with point marker)
91 linewidth -- line width in points
92 default: 0.2
93 separatepanel -- separate panels
94 default: True
95 plotmasked -- masked data handling
96 default: 'empty' (show empty panel)
97 option: 'zero' (plot zero level)
98 'none' (show nothing)
99 'text' (show text indicating 'NO DATA')
100 'plot' (plot masked data with different
101 color specified by maskedcolor)
102 maskedcolor -- line color for masked data
103 showaxislabel -- Show axis labels on the bottom left panel
104 default: False
105 showtick -- Show ticks
106 default: False
107 showticklabel -- Show tick labels on the bottom left panel
108 default: False
109 figsize -- size of the figure
110 default: '' (matplotlib default)
111 example: '10cm' (10cm square)
112 '122mm,10cm' (122mm width and 10cm height)
113 numpanels -- Number of panels
114 default: '' (auto)
115 example: '6,8' (nx=6, ny=8)
116 '8' (nx=8, ny=8)
118 Number of panels along horizontal and vertical direction can be specified
119 via the parameter 'numpanels'. It should be a string containing numerical
120 value indicating number of panels. If only one number is given it will be
121 applied to both axes. If you want to provide different numbers to horizontal
122 and vertical axes, you should give two numbers as a string separated by comma.
123 See example of the above parameter description section.
125 If the number of panels is less than the number of pixels of input image,
126 more than one pixels are assigned to one panel. In that case, spectra to be
127 shown are the average of the assigned spectra in each pixel.
129 Default value for numpanels is empty string ('') which corresponds to an auto
130 calculation of the number of panels based on the number of pixels of input
131 image. Formula for the number of horizontal and vertical panels, nh and nv,
132 are as follows:
134 npanel = min(max(nx, ny), 8)
135 step = (max(nx, ny) - 1) / npanel + 1
136 nh = nx / step + 1
137 nv = ny / step + 1
139 where nx and ny are the number of pixels along direction axes. In the above
140 calculation, upper limit for nh and nv is 9.
145 """
147 _info_group_ = """visualization"""
148 _info_desc_ = """Makes profile map"""
150 def __call__( self, imagename='', figfile='', overwrite=False, transparent=False, pol=int(0), spectralaxis='', restfreq='', plotrange='', title='', linecolor='b', linestyle='-', linewidth=float(0.2), separatepanel=True, plotmasked='empty', maskedcolor='gray', showaxislabel=False, showtick=False, showticklabel=False, figsize='', numpanels='' ):
151 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'figfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}, 'transparent': {'type': 'cBool'}, 'pol': {'type': 'cInt'}, 'spectralaxis': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'frequency', 'channel', 'velocity' ]}, 'restfreq': {'type': 'cStr', 'coerce': _coerce.to_str}, 'plotrange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'title': {'type': 'cStr', 'coerce': _coerce.to_str}, 'linecolor': {'type': 'cStr', 'coerce': _coerce.to_str}, 'linestyle': {'type': 'cStr', 'coerce': _coerce.to_str}, 'linewidth': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'separatepanel': {'type': 'cBool'}, 'plotmasked': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'none', 'plot', 'empty', 'zero', 'text' ]}, 'maskedcolor': {'type': 'cStr', 'coerce': _coerce.to_str}, 'showaxislabel': {'type': 'cBool'}, 'showtick': {'type': 'cBool'}, 'showticklabel': {'type': 'cBool'}, 'figsize': {'type': 'cStr', 'coerce': _coerce.to_str}, 'numpanels': {'type': 'cStr', 'coerce': _coerce.to_str}}
152 doc = {'imagename': imagename, 'figfile': figfile, 'overwrite': overwrite, 'transparent': transparent, 'pol': pol, 'spectralaxis': spectralaxis, 'restfreq': restfreq, 'plotrange': plotrange, 'title': title, 'linecolor': linecolor, 'linestyle': linestyle, 'linewidth': linewidth, 'separatepanel': separatepanel, 'plotmasked': plotmasked, 'maskedcolor': maskedcolor, 'showaxislabel': showaxislabel, 'showtick': showtick, 'showticklabel': showticklabel, 'figsize': figsize, 'numpanels': numpanels}
153 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
154 _logging_state_ = _start_log( 'plotprofilemap', [ 'imagename=' + repr(_pc.document['imagename']), 'figfile=' + repr(_pc.document['figfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'transparent=' + repr(_pc.document['transparent']), 'pol=' + repr(_pc.document['pol']), 'spectralaxis=' + repr(_pc.document['spectralaxis']), 'restfreq=' + repr(_pc.document['restfreq']), 'plotrange=' + repr(_pc.document['plotrange']), 'title=' + repr(_pc.document['title']), 'linecolor=' + repr(_pc.document['linecolor']), 'linestyle=' + repr(_pc.document['linestyle']), 'linewidth=' + repr(_pc.document['linewidth']), 'separatepanel=' + repr(_pc.document['separatepanel']), 'plotmasked=' + repr(_pc.document['plotmasked']), 'maskedcolor=' + repr(_pc.document['maskedcolor']), 'showaxislabel=' + repr(_pc.document['showaxislabel']), 'showtick=' + repr(_pc.document['showtick']), 'showticklabel=' + repr(_pc.document['showticklabel']), 'figsize=' + repr(_pc.document['figsize']), 'numpanels=' + repr(_pc.document['numpanels']) ] )
155 task_result = None
156 try:
157 task_result = _plotprofilemap_t( _pc.document['imagename'], _pc.document['figfile'], _pc.document['overwrite'], _pc.document['transparent'], _pc.document['pol'], _pc.document['spectralaxis'], _pc.document['restfreq'], _pc.document['plotrange'], _pc.document['title'], _pc.document['linecolor'], _pc.document['linestyle'], _pc.document['linewidth'], _pc.document['separatepanel'], _pc.document['plotmasked'], _pc.document['maskedcolor'], _pc.document['showaxislabel'], _pc.document['showtick'], _pc.document['showticklabel'], _pc.document['figsize'], _pc.document['numpanels'] )
158 except Exception as exc:
159 _except_log('plotprofilemap', exc)
160 raise
161 finally:
162 task_result = _end_log( _logging_state_, 'plotprofilemap', task_result )
163 return task_result
165plotprofilemap = _plotprofilemap( )