HW 8

Pseudo Object Oriented Programming #2

 

Last week you created a function that generated an array of OBS structures that contained all of the vital information for each observation. During the next two weks you’ll write the code that reduces each raw image and measures the brightness of our primary target, the eclipsing binary OO Aquilae.

 

1)      Write a function called eb_flats.pro that performs the following tasks:

a)       Finds all of the flat field observations stored in OBS

b)      For each type of flat (sky and dome), normalize by dividing by the median pixel value and store in a data cube. For example:

 

domeflat[*, *, i] = dome_im/median(dome_im)

 

or

 

skyflat[*, *, j] = sky_im/median(sky_im)

 

c)       Use CMAPPLY to create a median flat field image for each flat type:

 

med_sky = cmapply(‘user:median’, skyflat, 3)

 

d)      Use SAVE to write the median flat field images to disk and store the location of these flats back into the OBS structure. You can save both flat field images using one save command:

 

flatsfile = ’~/idl/data/’+obs[0].night+’_flat.sav’

save, med_sky, med_dome, file=flatsfile

obs.flat = flatsfile

 

                 

 

2)      Write a function called eb_findstar.pro that reads in the first target observation of the night and prompts the user to click on stars A, B and C. Use the CURSOR function to read the pixel locations of the user’s clicks. Fit a 2-D Gaussian to the subimage around the click location to find the precise location of the star. Store the pixel locations in the STARS sub-structure field of all of the OBS structures.

 

You only have to do this once for each night. The information from eb_findstar will be used by the photometry program you’ll write later.

 

 

The only input variable for these two functions is the OBS structure array. In order to “write-protect” the input variable, name it OBS_IN in the function header and rename it to OBS in the function body, e.g.

 

function eb_findstar, obs_in

Obs = obs_in

return, obs

end

 

If you don’t do this, the modified obs variable will be passed back through the positional parameter, which may lead to unintended consequences.