WorkshopSelfcal: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''This page steps through self-calibration of the Science Verification data.''' | '''This page steps through self-calibration of the Science Verification data.''' | ||
* '''The quasar data and script shown in Ed's lecture can be copied from here: /home/ftp/NRAO-staff/efomalon/data_2157 (visible from your cluster account). Feel free to copy them (using "cp -r ") to your working directory and work through them before or after.''' | * '''The quasar data and script shown in Ed's lecture can be copied from here: /home/ftp/NRAO-staff/efomalon/data_2157 (visible from your cluster account). Feel free to copy them (using "cp -r ") to your working directory and work through them before or after. For example:''' "cp -r /home/ftp/NRAO-staff/efomalon/data_2157 ~/ef_quasar" | ||
This page describes the hands-on self calibration portion of the ALMA data reduction workshop. In this session you will carry out self-calibration on ALMA Science Verification data to improve the image quality. This page describes the data and introduces the scripts. It is not a full-fledged CASA guide, only background for the hands on portion of the workshop. For the imaging session in the morning go here: [[WorkshopImaging]] | This page describes the hands-on self calibration portion of the ALMA data reduction workshop. In this session you will carry out self-calibration on ALMA Science Verification data to improve the image quality. This page describes the data and introduces the scripts. It is not a full-fledged CASA guide, only background for the hands on portion of the workshop. For the imaging session in the morning go here: [[WorkshopImaging]] |
Revision as of 19:27, 2 December 2011
This page steps through self-calibration of the Science Verification data.
- The quasar data and script shown in Ed's lecture can be copied from here: /home/ftp/NRAO-staff/efomalon/data_2157 (visible from your cluster account). Feel free to copy them (using "cp -r ") to your working directory and work through them before or after. For example: "cp -r /home/ftp/NRAO-staff/efomalon/data_2157 ~/ef_quasar"
This page describes the hands-on self calibration portion of the ALMA data reduction workshop. In this session you will carry out self-calibration on ALMA Science Verification data to improve the image quality. This page describes the data and introduces the scripts. It is not a full-fledged CASA guide, only background for the hands on portion of the workshop. For the imaging session in the morning go here: WorkshopImaging
Overview
Data Description
You will use the now-familiar NGC 3256 Band 3 or TW Hydra Band 7 Science Verification data. You have seen both already this morning. Both contain several lines, including CO emission (1-0 for NGC 3256 and 3-2 for TW Hydra), and continuum emission. We will begin by imaging the continuum emission and using the resulting model to self calibrate the data. We will then see how to apply that self-calibration to improve the line images.
Note that it is perfectly possible to self-calibrate the other TW Hydra data or the Antennae Band 7 data (see AntennaeBand7). If you finish quickly, you might try to write your own script to do this.
Recommended Approach
Review the basics of how to use these scripts in WorkshopImaging. Assuming that you are comfortable with imaging, we suggest to grab the script above. Use it to image NGC 3256 or TW Hydra (just uncomment/comment the relevant portions to apply the script to either data set), making sure that the "calready" parameter is set to True. Then use gaincal to derive the complex gain corrections to each antenna that best match the data to the model. When you are satisfied with these corrections, apply them to the data to create a new corrected data set. Image those data.
The script takes you through one iteration of this self-calibration but the approach can be iterative, improving the model of the source as the corrected data become more and more accurate. Once you are comfortable with the procedure, try iterating and perhaps adding an amplitude calibration to the selfcal. Your degrees of freedom in this process are the solution interval and how you otherwise combine the data (averaging polarizations, spectral windows or channels, using a specific field in a mosaic). Try experimenting with these settings to see how your results are affected. Your basic diagnostic is the plotting of solutions using plotcal but the amount of noise and the structure of the residuals in the final image can also be useful indicators.
Continuum Self Calibration
This script can be configured to step you through a first phase self-calibration of either the TW Hydra Band 7 or NGC 3256 Band 3 data. Adjust the comments to use the data set that you like. The script will create a first, basic image following the same procedure that you used to image in the previous session. You will then self-calibrate to create a better image. Some comments to bear in mind:
- Remember that each CASA Measurement Set has three columns: data, corrected, and model. Conceptually data are the raw u-v data, corrected data are the data corrected by some complex gain solution, and model represents the model visibility that should be matched by the data in the absence of noise, antenna-dependent complex gain terms, or other corruptions. Data are required for every measurement set, corrected data appear as a result of applying a calibration via applycal (or copying the data column in a few cases), and model data are either read in or initialized via setjy or copied back into the measurement set during deconvolution by clean with the calready option turned on.
- You fill the model column with clean. This is done during the deconvolution, so you want to clean down to the point where you believe that the model you have built is still real but no further. gaincal will try derive solutions to match your data to whatever model you have in. So be sure that the model is real! (This is a potential danger of self-calibration.)
- Some additional viewer functionality may be useful here:
- One useful, but not perfect, diagnostic of your image quality is the RMS noise in the image. The viewer lets you find this easily. Grab one of the region defining tools that you use for making clean boxes (the rectangle is easiest) and drag out a portion of the image that contains no signal but is big enough to yield good statistics. After you have highlighted that region double click inside the region and have a look at the terminal. You should see a variety of statistics for the region, including the RMS deviation and a robust (median-based) analog. After you have made a self-calibrated image, you can repeat the measurement and compare the noise in the images. The ratio of peak intensity to RMS scatter off the source is often referred to as the "dynamic range" of the image.
- Once you have both a self-calibrated image and your original image it is interesting to compare them. To display them side by side open both as raster images with the viewer. Then click the 'Display Panel' pull-down and 'Panel Options'. Set number of panels in x to be two. Then click the radio button near the bottom of the viewer to 'blink' (rather than normal). You now see both at once.
- To set the two images on the same color scale click the wrench-shaped button and go to "Basic Settings". You can manually specify the min and the max intensity to be displayed in here. Note the tabs along the top that let you switch between images. In this way you can force the two images to shared color stretch and table to more fairly compare them.
- Keep a close eye on the terminal output during the gaincal call. You want to avoid having a lot of solutions fail (ideally you don't want any to fail). The main remediable reason that they will fail will be that you are not averaging enough data together to get a good solution (recall the S/N discussion during the lecture). Your easiest remedy here will be to increase the solution interval specified via the "solint" keyword. You can also consider averaging together polarizations by setting the "gaintype" keyword to "T" or allow averaging to cross spectral window or scan boundaries using the "combine=spw" or "combine=scan" parameters.
- plotcal gives you a more direct way to examine the self-calibration solution. Although slow, plotcal gives you a lot of options in how to display the data. "iteration" tells plotcal what parameter to use to trigger a new panel. So "iteration='spw'" means one spw in each panel. You could instead iterate over antenna. Whatever you are not iterating over (but has not been selected) gets tossed together into the panel. "subplot=431" tells it to make 4 rows and 3 columns. Use help to find more.
- Have a look at the amount of scatter in the phase solutions, the rapidity of their systematic variations, their overall amplitude, and the agreement among different ways of slicing the data. A lot of scatter may mean an unstable solution. Rapid but smooth variation may highlight the need for the shortest possible solution interval. High overall amplitudes in the corrections imply that the additional calibration really was necessary. And agreement among, e.g., different spectral windows, indicates that you might able to further average the data when deriving the solutions.
- If you're speeding along, we've included the workflow to perform a second iteration of self calibration (customized to NGC 3256) that corrects for amplitude variations. The syntax for gaincal and applycal can be a bit subtle here. The key fact to remember is that you have one "corrected" data column and applycal will overwrite that column.
- The gaincal call here applies the previous self-calibration on the fly. Then to apply the full, combined effect of both self calibrations you need to feed both tables in to applycal.
Continuum-to-Line Self Calibration
Self-calibration can also be used to improve your spectral line imaging. You can do this by self-calibrating the line data set directly or by using deriving corrections for the continuum emission and then applying them to the data before imaging the line data. The script here shows an example of the procedure to apply a continuum-based self-calibration to line data, which are then separated out and imaged. It builds on the previous ("Basic_selfcal.py") script, you need the calibration table from that script in hand so step through that one first. A few notes:
- The calibration tables know about spectral windows by their number. This means that you could potentially get yourself into trouble by splitting out a subset of the spectral windows (thus changing the definition of spw 0). You might be able to get away with this depending on how you set things up but it's safest to apply the calibration table to a data set with the same set of spectral windows as were used to generate the table.
The alternative approach uses the spectral line itself to derive a calibration solution. The script above steps through this procedure using the brightest 5 channels around the CO line in NGC 3256. It does not treat things in a full spectral line way, instead focusing on this "slice" of line emission (with no continuum subtraction). To get a spectral line cube at the end you would need to add in the additional steps of continuum subtraction and use mode "velocity", "channel", or "frequency". Feel free to experiment with this.