HW 7
Pseudo Object Oriented Programming #1
For the next several weeks we will be building a data reduction pipeline for observations of an eclipsing binary. Each week we will write various components of the pipeline. For the first assignment, we will write a function that will create an array of structures called obs. Many of the fields will be empty until we build more components, such as the parts that do the flat-fielding and photometry.
Write a function called eb_makeobs.pro that creates an array of structures contaning the vital properties of a set of observations. The single input variable is a string variable containing the path to the data directory. For this assignment, the data directory is:
/home/johnjohn/data/eb/2002June18/
All future data sets will be in the eb/ directory, so the input variable only needs to specify the specific night, which in this case is “2002June18”.
Each structure, or object, should contain the following fields:
|
UTDATE: |
The UT date of the observation |
||||||||
|
UTTIME: |
The UT time of the observation |
||||||||
|
JD: |
The Julian day number of the observation, calculated from UTDATE and UTTIME. Use the julday() function: doc_library, ‘julday’ |
||||||||
|
NCOL: |
The number of columns (NAXIS1 in the fits header) |
||||||||
|
NROW: |
The number of columns (NAXIS2 in the fits header) |
||||||||
|
RAW: |
Location of raw FITS file |
||||||||
|
REDUCED: |
Location of reduced image: ~/idl/ay299/data/reduced_2002June18/ You’ll have to create this directory. |
||||||||
|
FLAT: |
Location of median, normalized flat field image. You can fill in the name, but the file obviously won’t exist until we write the flats program. |
||||||||
|
OBSNUM: |
The observation sequence number |
||||||||
|
EXPTIME: |
Exposure time |
||||||||
|
OBJECT: |
Primary target name |
||||||||
|
RA: |
Right ascension as a decimal number of degrees. Use the ten() function and you may need to dig out your old Carroll & Ostlie to see how to convert RA to degrees) |
||||||||
|
DEC: |
Declination as a decimal number of degrees |
||||||||
|
GAIN: |
1.54 |
||||||||
|
STARS: |
This is a 4-element array of structures. Yes, there is a structure in each of these OBS structures! There are three stars you will be interested in. The primary target Star A and two reference stars: Stars B and C. Each element of the stars array of structures has the following fields (These fields should be left empty until we write the photometry and basic astronometry routines):
|
||||||||
|
LASTMOD: |
The date that the object was last modified. Leave this blank for now. |
||||||||
|
HISTORY: |
String variable that contains notes about what actions have been performed on the object. Since no actions have been performed yet, leave this empty. |
The FITS files are stored here:
/home/johnjohn/data/eb/2002June18/*.ccd.gz
The FITS files don’t have the normal .fits suffix, but instead have .ccd.gz. This is just the Lick observatory naming convention and the .gz means the files have been compressed. Don’t worry, readfits() and headfits() know how to deal with compressed files.
Save the final array of structures in your hw7/ directory
save, obs,
file=’~/idl/ay299/hw7/obs.dat’
Some tips:
1) Use headfits() to read the FITS headers.
2) Use hprint look at an example header first, so you can learn all of the header field names.
3) Use fxpar() to read fields from each FITS header.
4) Create one instance of the obs structure first, then use replicate() to form the array of structures.
5) RSI says the findfile() function is obsolete and recommends file_search() instead.
files =
file_search('/home/johnjohn/data/eb/2002June18/', '*.ccd.gz')
6) You will need to create a single instance of the stars structure, replicate it 3 times and then insert the field into the obs structure before you replicate the obs structure Nfiles times.
7) Here is an example obs structure.