Spectral Viewer: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Bmills (talk | contribs)
No edit summary
Bmills (talk | contribs)
No edit summary
 
Line 55: Line 55:


<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
You can change both of these defaults in the two drop-down menus to the bottom right of the spectrum. Here (Figure 4), the data are shown plotted with the RMS error bars. Instead of displaying the mean on the y-axis, you can also view the median, sum, or flux of the data in the selected region.
You can change both of these defaults in the two drop-down menus to the bottom right of the spectrum. Here (Figure 4), the data are shown plotted with the RMS error bars. Instead of displaying the mean on the y-axis, now we are looking at the median (you can also view the sum, or the flux of in the selected region, but no error bars are available for these quantities).
</div>
</div>


<div style="float: right; width: 50%; text-align: center;">
<div style="float: right; width: 50%; text-align: center;">
[[File:viewer_tut4.png | 300px]]   
[[File:viewer_new4.png | 300px]]   


''Figure 4; Click to enlarge''
''Figure 4; Click to enlarge''
</div>
</div>


|- style
 
|-  
|
|


== Selecting Data ==
== Toolbars ==


<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
When you hover over the spectrum displayed in the Spectral Profile viewer, holding down the Ctrl-key will draw a grey vertical line at the position of the mouse. With the Ctrl-key held down, if you then click the left mouse button, the viewer will display the channel corresponding to that point in the spectrum (Figure 5).  
At the top of the Spectral Profile panel is a toolbar (Figure 5) which allows you to save the spectrum as either a data file (fits/ASCII) or an image.
The toolbar also allows you to pan and zoom the spectrum (you can also do this with your trackpad, sometimes without meaning to!).
One of the most useful buttons is the 'unzoom' button, which resets the spectrum, and allows you to undo any inadvertent panning or zooming.  
</div>
</div>


<div style="float: right; width: 50%; text-align: center;">
<div style="float: right; width: 50%; text-align: center;">
[[File:viewer_tut7.png | 300px]]   
[[File:sviewer_toolbar.png | 300px]]   


''Figure 5; Click to enlarge''
''Figure 5; Click to enlarge''
Line 81: Line 84:
|- style="background-color:#eeeeee;"
|- style="background-color:#eeeeee;"
|
|
== Selecting Data ==


<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
Line 92: Line 98:
''Figure 6; Click to enlarge''
''Figure 6; Click to enlarge''
</div>
</div>
|-
|
<div style="float: left; width: 50%; align: left;">
When you hover over the spectrum displayed in the Spectral Profile viewer, holding down the Ctrl-key will draw a grey vertical line at the position of the mouse. With the Ctrl-key held down, if you then click the left mouse button, the viewer will display the channel corresponding to that point in the spectrum (Figure 7).
</div>
<div style="float: right; width: 50%; text-align: center;">
[[File:viewer_tut7.png | 300px]] 
''Figure 7; Click to enlarge''
</div>




|-  
|- style="background-color:#eeeeee;"
|
|


Line 101: Line 121:
<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
The Spectral Profile tool allows you to quickly make several types of moment maps for the selected cube.   
The Spectral Profile tool allows you to quickly make several types of moment maps for the selected cube.   
With the mouse in the Spectral Profile window, clicking and dragging with the left mouse button, while holding down the Shift-key, will highlight a range of the spectrum (in grey). To remove the highlighted range, in the top toolbar, click the left-hand magnifying glass button. The data can then be collapsed over the highlighted range. A drop-down menu below the spectrum allows you to choose between either summing the data, creating a Moment 0 map, or making an image of the mean or median values over the selected region of the spectral axis. Clicking 'collapse' will generate the requested image in the Viewer (Figure 7).  
With the mouse in the Spectral Profile window, clicking and dragging with the left mouse button, while holding down the Shift-key, will highlight a range of the spectrum (in grey). To remove the highlighted range, in the top toolbar, click the left-hand magnifying glass button. The data can then be collapsed over the highlighted range. A drop-down menu below the spectrum allows you to choose between either summing the data, creating a Moment 0 map, or making an image of the mean or median values over the selected region of the spectral axis. Clicking 'collapse' will generate the requested image in the Viewer (Figure 8).  
Instead of selecting the data range by highlighting the spectrum, you can also enter the desired x-axis range directly in the 'from' and 'to' boxes below the spectrum.
Instead of selecting the data range by highlighting the spectrum, you can also enter the desired x-axis range directly in the 'from' and 'to' boxes below the spectrum.
</div>
</div>


<div style="float: right; width: 50%; text-align: center;">
<div style="float: right; width: 50%; text-align: center;">
[[File:viewer_tut6.png | 300px]]   
[[File:viewer_new6.png | 300px]]   


''Figure 7; Click to enlarge''
''Figure 8; Click to enlarge''
</div>
</div>


|- style="background-color:#eeeeee;"
|-  
|
|


Line 117: Line 137:


<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
At the very bottom left of the Spectral Profile window is a tab which allows you to toggle between creating moment maps (the default), and fitting Gaussians. Clicking on the 'linefit' tab will allow you to fit a Gaussian + polynomial to the displayed spectrum. You can select the x-axis region to be fit with the 'from' and 'to' boxes, or by highlighting the spectrum as described above. The drop-down menus below the spectrum allow you to fit a Gaussian, Gaussian + 0th or 1st-order polynomial, or simply a polynomial to the spectrum. The resulting fit parameters are sent to standard output (the window with the casapy prompt, or the terminal in which casaviewer was launched)
At the very bottom left of the Spectral Profile window (Figure 9) is a tab which allows you to toggle between creating moment maps (the default), and fitting Gaussians. Clicking on the 'linefit' tab will allow you to fit a Gaussian + polynomial to the displayed spectrum. You can select the x-axis region to be fit with the 'from' and 'to' boxes, or by highlighting the spectrum as described above. The drop-down menus below the spectrum allow you to fit a Gaussian, Gaussian + 0th or 1st-order polynomial, or simply a polynomial to the spectrum. The resulting fit parameters are sent to standard output (the window with the casapy prompt, or the terminal in which casaviewer was launched)
</div>
</div>


Line 123: Line 143:
[[File:viewer_tut8.png | 300px]]   
[[File:viewer_tut8.png | 300px]]   


''Figure 8; Click to enlarge''
''Figure 9; Click to enlarge''
</div>
</div>


|-  
|- style="background-color:#eeeeee;"
|
|


Line 132: Line 152:


<div style="float: left; width: 50%; text-align: left;">
<div style="float: left; width: 50%; text-align: left;">
If you are looking at line profiles with more than one image loaded into the viewer, and the images have different velocity axes, then closing one image can cause the velocity axis in the spectral viewer to become gibberish. Close and reopen the spectral viewer, and the axis will reset.


If nothing appears in the Spectral profile window, first try clicking the left-hand magnifying glass button in the top toolbar to reset the zoom. If there is still no spectrum, make sure that you have selected a region in your image.


If nothing appears in the Spectral profile window, first try clicking the left-hand magnifying glass button in the top toolbar to reset the zoom. If there is still no spectrum, make sure that you have selected a region in your image.


Strange things happen when you have multiple registered images in the viewer at one time. Spectra from all registered cubes will be overlaid in the spectral viewer (Figure 10), but you can only fit profiles and view error bars (and presumably save fits/ASCII data) for one of these spectra.
If you are looking at line profiles with multiple registered images, and the images have different velocity axes, then closing/unregistering one image can also cause the velocity axis in the spectral viewer to become gibberish. Close and reopen the spectral viewer, or unregister/register the main image and the axis will reset.
</div>
<div style="float: right; width: 50%; text-align: center;">
[[File:viewer_multispec.png | 300px]] 
''Figure 10; Click to enlarge''
</div>
</div>



Latest revision as of 05:21, 23 August 2012



A quick tutorial on how to use the Spectral Profile plotting tool, based on the CASA cookbook


Opening the Spectral Profile plotting tool

First, open the image viewer by calling 'viewer' from the CASA prompt, or 'casaviewer' from the command line. To select the region of your image for which you want to display the spectrum, use the Point, Rectangle, Ellipse or Polygon Region tool in the Viewer Display Panel (Figure 1). The values for extended regions are computed as the mean over all pixels within the marked region, (but you also have the option to view the median, sum, or flux). For Point positions, it is possible to mark multiple positions and switch between the positions by hovering over the respective markers (to remove a point or region box, hover over it and hit ESC).

Figure 1; Click to enlarge

From the Main Toolbar of the Viewer (see Figure 2), the Spectral Profile plotting tool can be selected. This creates a new Spectral Profile window containing an x-y plot of the intensity versus spectral axis. The displayed spectrum is extracted in the region you have marked.

Figure 2; Click to enlarge

Data Display Options

This is the Spectral Profile panel (Figure 3) that appears, showing the spectrum for the selected region in the image. If you have not yet selected a region, the spectral profile window will remain blank until you do. You can mark multiple regions for which you want to extract profiles; hovering over a region will display the corresponding spectrum in the Spectral Profile window. By default if you have selected a region larger than a point, the value plotted on the y-axis is the mean of data in the region. By default, the data are also plotted with no error bars.

Figure 3; Click to enlarge

You can change both of these defaults in the two drop-down menus to the bottom right of the spectrum. Here (Figure 4), the data are shown plotted with the RMS error bars. Instead of displaying the mean on the y-axis, now we are looking at the median (you can also view the sum, or the flux of in the selected region, but no error bars are available for these quantities).

Figure 4; Click to enlarge


Toolbars

At the top of the Spectral Profile panel is a toolbar (Figure 5) which allows you to save the spectrum as either a data file (fits/ASCII) or an image. The toolbar also allows you to pan and zoom the spectrum (you can also do this with your trackpad, sometimes without meaning to!). One of the most useful buttons is the 'unzoom' button, which resets the spectrum, and allows you to undo any inadvertent panning or zooming.

Figure 5; Click to enlarge


Selecting Data

Using just the left mouse button, you can click on the spectrum to draw a box, and zoom in on a particular part of the spectrum (Figure 6). You can always unzoom to the original spectrum by, in the top toolbar, clicking the left-hand magnifying glass button.

Figure 6; Click to enlarge

When you hover over the spectrum displayed in the Spectral Profile viewer, holding down the Ctrl-key will draw a grey vertical line at the position of the mouse. With the Ctrl-key held down, if you then click the left mouse button, the viewer will display the channel corresponding to that point in the spectrum (Figure 7).

Figure 7; Click to enlarge


Making a Moment Map

The Spectral Profile tool allows you to quickly make several types of moment maps for the selected cube. With the mouse in the Spectral Profile window, clicking and dragging with the left mouse button, while holding down the Shift-key, will highlight a range of the spectrum (in grey). To remove the highlighted range, in the top toolbar, click the left-hand magnifying glass button. The data can then be collapsed over the highlighted range. A drop-down menu below the spectrum allows you to choose between either summing the data, creating a Moment 0 map, or making an image of the mean or median values over the selected region of the spectral axis. Clicking 'collapse' will generate the requested image in the Viewer (Figure 8). Instead of selecting the data range by highlighting the spectrum, you can also enter the desired x-axis range directly in the 'from' and 'to' boxes below the spectrum.

Figure 8; Click to enlarge

Fitting Profiles

At the very bottom left of the Spectral Profile window (Figure 9) is a tab which allows you to toggle between creating moment maps (the default), and fitting Gaussians. Clicking on the 'linefit' tab will allow you to fit a Gaussian + polynomial to the displayed spectrum. You can select the x-axis region to be fit with the 'from' and 'to' boxes, or by highlighting the spectrum as described above. The drop-down menus below the spectrum allow you to fit a Gaussian, Gaussian + 0th or 1st-order polynomial, or simply a polynomial to the spectrum. The resulting fit parameters are sent to standard output (the window with the casapy prompt, or the terminal in which casaviewer was launched)

Figure 9; Click to enlarge

Trouble Shooting

If nothing appears in the Spectral profile window, first try clicking the left-hand magnifying glass button in the top toolbar to reset the zoom. If there is still no spectrum, make sure that you have selected a region in your image.


Strange things happen when you have multiple registered images in the viewer at one time. Spectra from all registered cubes will be overlaid in the spectral viewer (Figure 10), but you can only fit profiles and view error bars (and presumably save fits/ASCII data) for one of these spectra.


If you are looking at line profiles with multiple registered images, and the images have different velocity axes, then closing/unregistering one image can also cause the velocity axis in the spectral viewer to become gibberish. Close and reopen the spectral viewer, or unregister/register the main image and the axis will reset.

Figure 10; Click to enlarge


Last checked on CASA Version 3.4.0 (r19988).

--Betsy Mills 08:25, 21 August 2012 (UTC)