G. Cowan RHUL Physics Dept. 21 November 2004 Simple ImageJ photometry plugins I have written two ImageJ plugins to do the photometry analysis as discussed in the lectures in a highly automated way. The code is still in a state of development and can be found in www.pp.rhul.ac.uk/~cowan/WWW/ph290/imagej/ This directory contains a file myImageJ.bat for running ImageJ and a folder called plugins. To use, copy everything in this directory including the contents of the plugins folder to your area. When you run ImageJ by clicking on myImageJ.bat, it finds those plugins that are in the corresponding plugins folder. The folder contains two plugins: AperturePhotometry_.java and MultiImagPhotometry.java. (Note that ImageJ plugins must contain an underscore somewhere in their name.) If you modify any of the java files you can recompile them by using the files compileAP.bat and CompileMultiImagePhot.bat. AperturePhotometry_.java processes a single image which you need to open in ImageJ before starting the plugin. The plugin MultiImagePhotometry_.java carries out the same algorithm on a set of images which you list in a text file. There is an example input file called deltaCepFiles.txt which you need to edit to contain the full path names of the files you want to process. It is suggested that you begin with AperturePhotometry_. To use this plugin, first open an image of a star field. Then from the plugins menu select AperturePhotometry. The algorithm searches for clusters of adjacent pixels which are significantly higher than the background sky value. To know what "significantly higher" means, we need to tell the program the CCD gain. For the SBIG ST-7E, this is 2.3 e-/ADU. The program finds a number of clusters and orders them in decreasing order of total counts in ADU. It then asks for a minimum flux value for stars to be measured. In this way if a star field contains many dim stars and a few bright ones, you can ignore the dim ones and just measure the flux of the stars brighter than some minimum amount. For the delta Cephei images (1 s integration time) a reasonable threshold is 10000 ADU. The program then asks for the aperture radius (in pixels). A reasonable value for the delta Cephei images is 20 pixels. This needs to be studied further. The AperturePhotometry plugin returns some of its results in the small "Results" window and some other information winds up in the DOS window. None of this has been well optimized, and you are invited to hack into the code and modify it to your liking. After you have run AperturePhotometry and you see roughly how it works, you should use MultiImagePhotometry to analyze the set of images you want to study. This takes as input a text file which contains a list of data files, one per line, with the full path name for each file. A sample file is in deltaCepFiles.txt (but the path names refer to my laptop, so you'll have to change them). With the MultiImagePhotometry plugin the output printed in the Results window is reasonably complete and should be sufficient for, e.g., the delta Cephei analysis. You should save the contents of the Results window (File -> save as). Then take the numbers and either cut/paste them into a gnuplot or Excel file for further analysis. About the code -------------- The most important java classes are StarField and its subclass ApPhot. A StarField object represents an image and contains, among other things the array of pixels values. It contains non-public classes Pixel, Cluster and Star. An ApPhot object contains, in addition to what it inherits from StarField, information on the apertures (for now limited to circular or annular regions) and measured flux values inside the apertures. ApPhot uses the class Annulus to define the apertures. StarField and ApPhot are independent from ImageJ. The interface with ImageJ routines is provided by the primary plugin classes AperturePhotometry_ and MultiImagePhotometry_ as well as a class containing static utility routines called SFUtil (standing for Star Field Utilities). Some of the global parameters are accessed through the class SFPar.