G. Cowan 12 August, 2002 Updated 16 January, 2008 Software for solar limb darkening analysis There are currently four different programs needed for the solar limb darkening analysis: StudioZero (video data acquisition) ImageJ (extraction of drift scan data from video) LimbDark (a java program for analysis of the limb darkening curves) Gnuplot (plotting and fitting) I. Video data acquisition with StudioZero StudioZero is a C++ program supplied as a sample with the Logitech's QuickCam SDK. To run, go to programs -> QuickCam SDK -> samples -> StudioZero MFC Sample. We have the source code for this so in principle we can modify it to suit our needs. Even in its current form, however, it does almost exactly what we want. After starting StudioZero, click on the camera icon (below the lefthand video window) to get to the camera settings. Choose: Image size: small (160 x 120) Lens distortion correction: OFF Then go to advanced camera settings and choose: Auto gain: OFF Auto white balance: OFF Also from the advanced camera settings menu, adjust the contrast, saturation, brightness, gain and exposure so that the limb darkening effect is clearly visible. Record these settings and try different values to see what effect they have on your results. In order to avoid nonlinear CCD response, the peak value in the centre of the sun's disc should be about half of the maximum value, i.e., around 127 per pixel. The following values were found to give reasonable results (on a clear day in July) for scans with the B, V or R filters: contrast: 255 saturation: 255 brightness: 127 white balance: 127 exposure: 84 gain: 255 For scans with no filters, an exposure of 63 was better. Then return to the main StudioZero menu and select: Frame Rate: 1 frame / second Video Compression / Codec: Uncompressed Record audio: OFF Get the telescope set up with the proper filters, focussed, etc., which is easiest to do with the tracking on. Then turn off the tracking motor (Telescope -> align -> land). The sun will now drift through the field of view. Adjust the telescope's declination so that the centre of the sun's disc passes directly through the centre of the camera's image. Once this is set up, by using the east and west adjustments, position the telescope just to the west of the sun. Begin recording by clicking "Record", and simply let the sun drift through the field of view. When the sun has passed (this takes around two and a half minutes), stop the recording and save the data by clicking "Save As". Note that the raw video files will be very large, since the compression is turned off. II. Extraction of drift scan data from video with ImageJ ImageJ is an image analysis program written and maintained at the National Institute of Health. It is available from rsb.info.nih.gov/ij. One of the features of ImageJ is that the user can write java clases that can run as plugins. The plugin JMF_Movie_Analyzer can read in the video file, step through each frame and unpack the data in the individual pixels. Each pixel has three values corresponding to the red, green and blue (RGB) filters integrated into the CCD chip. The R, G and B values are then individually summed in a 4 by 4 box in the centre of the image. The frame number and summed R, G and B values are written to the output window and also to an output file. To run ImageJ with the JMF_Movie_Analyzer plugin, you need to click on the ImageJ.bat icon, and not the default ImageJ icon. Under "plugins", select JMF_Movie_Analyzer. You will be prompted for input and output files. It is probably a good idea to name the output file the same as the input except replacing the ".avi" extension with ".txt". When JMF_Movie_Analyzer has stepped through the video, it makes the entire series of frames available in a window which can be clicked through and inspected individually. By editing the source file JMF_Movie_Analyzer.java, you can make various modifications to the program as you see fit. If, for example, the sun is not centred vertically in the frame, or if you wish to avoid a set of sunspots, you can adjust which pixels are summed by modifying the code. Example scripts for recompiling the program are kept together with the source code. III. Limb darkening analysis with LimbDark The output from ImageJ is a text file with four columns of numbers: the frame number (which effectively gives the position over the sun's disc) and the R, G and B values for the centres of each frame. This must be converted to give the normalized intensity as a function of r/R or mu. You can use the java program LimbDark to do this stage of the analysis. The program you will be given only reads in the data and assigns the frame number, R, G, and B values to arrays. Your task is to extend this program to determine the position on the sun's disc (r/R, or equivalently mu = cos theta) for each frame. First, it is a reasonable approximation to take the sum of the R, G and B values for the intensity. Converting the frame numbers to r/R is a bit more complicated. The sun's limb is usually defined as the place where the derivative of the intensity is with respect to radius is the greatest. You should therefore estimate the derivative of the intensity using finite differences, and from this determine the times for the rising and falling limbs. Using this, you can determine r/R for each data point, where we usually define -1 < r/R < 0 for the rising limb and 0 < r/R < 1 for the falling limb. Of course you will also get nonzero intensities for |r/R| > 0. For a first approximation these can be ignored. In a more refined analysis we could take them into account by modelling the effects of scattered light and limted resolution. IV. Plotting and fitting with Gnuplot Gnuplot is a general purpose plotting and fitting program. It is widely used in the physical sciences and you are strongly advised to become familiar with its use. The PH3010 web page has links to gnuplot documentation. In particular you should work through the gnuplot tutorial by Henri Gavin at www.duke.edu/~hpgavin/gnuplot.html . A sample gnuplot source file is given in limbdark_fit.gnu. To execute the commands in the file, first run gnuplot and then enter gnuplot> load "limbdark_fit.gnu" The load command followed by a file name in quotes simply executes all of the commands entered in the file. This is the best way to develop and store a more complicated set of commands. You will need to generalize the file to read in and fit the files that you produce using LimbDark.java.