Interactive Viewer Testing for the optical extentions
added by Martin Kümmel, Harald Kuntschner and Mark Westmoquette (ESO)
revised by Sandra Castro and Ralf Palsa.
The below details a number of interactive test sequences with standard outcomes in order to test the functionality of the optical extensions added to the viewer.
The test images in these sequences can be retrieve from the NRAO repository with the command:
svn co https://svn.cv.nrao.edu/svn/casa-data/trunk/regression/viewertest
Scenario A (load and display spectrum + errors):
- Load the FITS cube "small_meas3D.fits" as a raster image (click expand arrow and load the Quality extension (labelled [SCIENCE,ERROR]).
- Open "Data Display Options" (spanner icon). Under the "axis label properties" sub-panel change "spectral unit" to "Wavelength [Angstrom]", "[mm]", "frequency [GHz]", "MHz", etc. Verify changes of the unit displayed in the main viewer panel.
- In the "Data Display Options", verify the presence of the "hidden axes" drop-down tab (only present when an error extension is loaded) and switch the quality slider to "1", which means it switches the display from data to error. Adjust the "Data Range" values to [0,0.3] in the "basic settings" tab to view the error values. Switch the hidden axes back to "0" (i.e. data).
- Open the "spectral viewer" window (Tools -> Spectral Profile) and define a region on the image (using any tool).
- Inspect the 'mean', 'median' and 'sum' spectrum in the spectral profile window. For 'mean' and 'sum' options, 'propagated' errors can be displayed. For 'mean' and 'median' options, 'rmse' errors should be available. Select 'mean' with 'rmse' errors, then switch straight to 'sum' spectrum and check that the errors switch to 'propagated'.
- Use the "single point selection" tool in the main Viewer Window to select the spaxel at 10,10 (use the 'tracking data' information in the box at the bottom of the window). 'Propagated' errors are available for 'mean' and 'sum' options.
- Change the unit in the profiler to "wavelength [Angstrom]", "[um]", "[mm]", "frequency [GHz]" etc. Verify the changes in the x-axis units.
- Save the displayed spectrum (in nm units) as an ascii plot file using the "export profile to file" button (disk icon) in the spectral profile window and selecting txt (not FITS) format. Open in a text editor and check that the spectrum has been saved correctly with all 3 columns. Verify that the correct x-axis unit is in the header of the plot file (nm)
- Change units of the spectrum to "frequency [GHz]", then save to an ascii plot file; verify that the units are changed and correct in the header of the ascii file.
- Save the spectrum (in nm units) as a FITS file using the "export profile to file" button (disk icon) and selecting FITS format. Load exported spectra in external viewer and verify that the exported spectra are OK.
- Change the x-axis units in the profiler (to e.g. mm). Export the spectrum in FITS format again and confirm that the FITS spectrum is still in its 'native' units (and NOT the ones it was changed to in the profiler).
Scenario B (display two spectra from two spatially overlapping cubes, export to ascii)
- Load "small_meas3Dsci.fits" test cube as a raster image
- Load "small_meas3Derr.fits" test cube as a raster image
- Open the "Spectral Profile" window (Tools -> Spectral Profile) and define a region on the image (using any tool). The spectrum of the 1st loaded cube (small_mean3Dsci) should be shown in blue, and the 2nd (small_mean3Derr) in red.
- Open the spectral profiler window preferences (black cog icon) and de-select the "Overlay" option. Verify that only the red spectrum remains and the blue spectrum disappears.
- Select to display 'rmse' errors. Error bars should appear on the red (primary) spectrum only.
- Open the "Image Manager" window (Data -> Manage Images) and re-order the images by draging the "image boxes" keeping then left mouse button pressed. Moving the "small_mean3Dsci.fits" box to the bottom of the stack should bring this cube to the top in the viewer window, and swap around the blue and red spectra in the spectral profile window. Displaying 'rmse' errors should now add error bars to the small_mean3Dsci spectrum.
- Save the displayed spectra as an 'ascii plot file' using the button in the spectral profile window. Open in a text editor and check that both spectra have been saved, one after the other in the text file with errors for the first and none for the second.
Scenario C (spectral fitting)
- Load "egred.fits" cube as a raster image (click expand arrow and load the Quality extension (labelled [SCIENCE,ERROR]). Open the "Spectral Profile" tool and use the rectangle select tool to select a region in the image from 2,2 to 5,5. Make sure the combine type is set to "Mean".
- Zoom into the central region of the spectrum with the brightest emission line. Select this brightest line including some continuum either side with the shift key (e.g. 656-658nm). Fit a Gauss+poly1 line. Verify that the results are printed in the status bar of the viewer and on the logger or terminal output, and that they match. The results should be Gauss amplitude = 0.202572 k, centre = 656.851 nm, FWHM = 0.291573 nm, area = 0.0628722
- Change error type from "no error" to "propagated". Re-fit the line and verify that the fit is correct (the values and errors of the fit results MUST change - if only very slightly)
- Modify the fit type and re-fit (Gauss+poly 1, Gauss+poly 0, Gauss+no poly, no Gauss+poly 1, no Gauss+poly 0, no Gauss+no poly) For the last combination verify that the warning "There is nothing to fit!" is printed in the status bar and on the logger or terminal output.
- Verify that pressing "clean" removes the fits from the plot
- Change the units to GHz. Re-zoom in on the brightest line and repeat the Gauss+poly 1 fit in the modified units. The results should be Gauss amplitude = 0.201912 k, centre = 456409 GHz, FWHM = 200.962 GHz, area = 43.1926.
- Open the "Image manager" window (Data -> Manage images) and press the button "Options". In the dialog enter a rest wavelength of 660nm. Open "data display options" window and under the "axis label properties" sub-panel and change the spectral unit to "optical velocity [km/s]". The frame/channel value (axis unit) displayed in upper-right [default] of the image in the main viewer window should change to km/s values relative to zero at 660 nm. The x-axis units of the spectrum should also change accordingly.
- Re-zoom in on the brightest line and refit it with a Gauss+poly 1 model. Verify that the fit was successful in -ve velocity units (the centre should be -1430.188 km/s).
- Close the "egred.fits" buffer and open "eg1316.fits". Make sure the same rectangular region is selected and change the spectral viewer units back to nm.
- Select (using the shift key or by entering the values) the region 480-500nm. Fit a Gauss+poly 1 model. Verify that the absorption line was fit ok. The results should be amplitude = -1.69576 k, centre = 489.302 nm, FWHM = 2.88865 nm, area = -5.21423. Switch to "rmse" errors and re-fit. The results should be similar.
Scenario D (image collapse and export)
- Load the FITS cube "3DVisTestIDL.fits" as a raster image (click expand arrow and load the Quality extension (labelled [SCIENCE,ERROR]). This image contains masked values (NaNs in spaxel [13,13] between wavelengths of 5000-5050 and 5600-5605 A); confirm that the masking has properly been taken into account by, e.g. looking at slice 440 in the "Channels" panel.
- Open the "Collapse/Moments" spectral viewer window (button with arrows facing inward). Use an area select tool (e.g. rectangle) to select a region of the image that includes part of the masked out spaxels. This should be displayed in the spectral viewer.
- Select a spectral channel (slice) using Ctrl+<Right Mouse> at the desired location in the spectral viewer window. This should display a vertical marker at the selected spectral location. Verify that the corresponding channel [slice] is now shown in the main window as an image.
- In the "Collapse/Moments" spectral viewer window, mark a spectral range (shift key) and collapse the image with the various combine methods.
- Confirm that the resulting output image lands in the main viewer window and that the output image has an error if appropriate: if loaded with errors, combine methods "mean" and "sum" should offer propagated errors; the combine methods "mean" and "median" should offer "rmse" as error.
- Save the image+error from the main viewer window using the "save as" (disk icon) button. Confirm that the "browse" functionality works.
- Close the collapsed image buffer and load the image back in (click expand arrow and load the Quality extension [SCIENCE,ERROR] as a raster image).
- In the animator tool box, activate the "images" section (tickbox) and press the play or step forward/back buttons. Verify that the viewer blinks between the collapsed cube and the original image.
- Confirm that the error extension, if existing, was exported and imported properly. To do this, unregister the original cube (to bring the newly loaded collapsed image to the foreground), and step through the two 'channels' of the collapsed image using the "channel animator" (play or step forward/back buttons) to view the data and error extensions.
Scenario E (2D Gaussian fitting)
- Load the image "centGaussTest.fits" into the viewer.
- Use the rectangle area tool to create a region. Make the region large enough to cover one of the objects in the image.
- Drag the region over one of the objects.
- In the region panel, press on the tab named "fit".
- Press onto the button "gaussfit"
- Confirm that under 'reasonable' circumstances (sufficient size and positioning of the region on the object) the Gaussian fit is successful.
- Confirm that the fitted Gaussian parameters agree with the inputs used for generating this image. These inputs are stored in the keywords HISTORY of that image.
- Confirm that the object center and the direction of the major axis are marked in green.
- Position the region again over an object. In the region panel, un-select "mark center". Repeat the "gaussfit". Confirm that the object center and orientation are NOT marked.
- In the region panel, select "mark center" and in the selector on the right choose a color, e.g. yellow. Repeat the "gaussfit". Confirm that the center marking is done in the chosen color.
- Repeat 2.-9. with the region shapes ellipse and polygon.