<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.aob.rs/index.php?action=history&amp;feed=atom&amp;title=IRAF4Students</id>
	<title>IRAF4Students - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.aob.rs/index.php?action=history&amp;feed=atom&amp;title=IRAF4Students"/>
	<link rel="alternate" type="text/html" href="http://wiki.aob.rs/index.php?title=IRAF4Students&amp;action=history"/>
	<updated>2026-04-04T04:14:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>http://wiki.aob.rs/index.php?title=IRAF4Students&amp;diff=113&amp;oldid=prev</id>
		<title>Ana.Lalovic: Created page with &quot;&lt;pre&gt;  Author: Milan Bogosavljevic  pokreni ds9 &amp; pokreni xgterm komanda ispod pokreni irafcl posle toga step 2   # AOB I Katedra za astronomiju # SVAP Maj, 2015  # Priprema z...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.aob.rs/index.php?title=IRAF4Students&amp;diff=113&amp;oldid=prev"/>
		<updated>2023-11-27T14:56:48Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt;  Author: Milan Bogosavljevic  pokreni ds9 &amp;amp; pokreni xgterm komanda ispod pokreni irafcl posle toga step 2   # AOB I Katedra za astronomiju # SVAP Maj, 2015  # Priprema z...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: Milan Bogosavljevic&lt;br /&gt;
&lt;br /&gt;
pokreni ds9 &amp;amp;&lt;br /&gt;
pokreni xgterm komanda ispod&lt;br /&gt;
pokreni irafcl&lt;br /&gt;
posle toga step 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# AOB I Katedra za astronomiju&lt;br /&gt;
# SVAP Maj, 2015&lt;br /&gt;
&lt;br /&gt;
# Priprema za obradu podataka i fotometriju u IRAF-u&lt;br /&gt;
# Folder &amp;quot;raw&amp;quot; - sadrzi sirova posmatranja: kalibracione snimke i &lt;br /&gt;
# snimke polja u kome se nalazi objekat Qatar-2b&lt;br /&gt;
# http://www.openexoplanetcatalogue.com/planet/Qatar-2%20b/&lt;br /&gt;
# http://var2.astro.cz/ETD/predict_detail.php?STARNAME=Qatar-2&amp;amp;PLANET=b&amp;amp;PER=&amp;amp;M=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
###############################&lt;br /&gt;
## Step 1:&lt;br /&gt;
## These are general guidelines for a fresh start in using IRAF&lt;br /&gt;
###############################&lt;br /&gt;
&lt;br /&gt;
# 1) In Unix command prompt&lt;br /&gt;
# Set up IRAF, this sets some preferences and paths to where you are&lt;br /&gt;
# the file login.cl with general preferences will be created in&lt;br /&gt;
# current directory to take advantage of those preferences, &lt;br /&gt;
# you need to start IRAF from current directory&lt;br /&gt;
# choose xgterm when asked&lt;br /&gt;
&lt;br /&gt;
mkiraf&lt;br /&gt;
&lt;br /&gt;
# 2) edit the login.cl which was just created:&lt;br /&gt;
# uncomment the line for stdimage setting and&lt;br /&gt;
# increase the image buffer size to hold images up to 4096x4096 pixels&lt;br /&gt;
# the line should be like this (wihtout the # comment symbol):&lt;br /&gt;
# set     stdimage        = imt4096&lt;br /&gt;
&lt;br /&gt;
# 3) launch xgterm with some neat options like a scrollbar&lt;br /&gt;
&lt;br /&gt;
xgterm -sb -sl 1000 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
# 4) Start the IRAF command prompt (from the directory where login.cl was created)&lt;br /&gt;
cl&lt;br /&gt;
&lt;br /&gt;
# start ds9&lt;br /&gt;
&lt;br /&gt;
!ds9 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
###############################&lt;br /&gt;
# Step 2: raw data processing in IRAF&lt;br /&gt;
# redux of 2012_05_09 data&lt;br /&gt;
# Qatar 2-b transit; Bogosavljevic/Sekulic; Vidojevica 60cm&lt;br /&gt;
###############################&lt;br /&gt;
&lt;br /&gt;
# While in IRAF command prompt:&lt;br /&gt;
# 5) make a folder called reduced and copy over raw files into that directory&lt;br /&gt;
# it is very advisable to always make this copy so that you can&lt;br /&gt;
# redo the process at any time by copying over the raw files &lt;br /&gt;
&lt;br /&gt;
 !mkdir reduced&lt;br /&gt;
 !cp ./raw/*fit reduced/&lt;br /&gt;
 cd reduced&lt;br /&gt;
&lt;br /&gt;
# 6) Proceeding with bias, dark, flat corrections of raw data&lt;br /&gt;
# make bias list of all Bias files &lt;br /&gt;
#(tip: fast and easy way to work in IRAF is to use lists)&lt;br /&gt;
&lt;br /&gt;
!ls Calib-1*Bias* &amp;gt; bias.list&lt;br /&gt;
&lt;br /&gt;
# 7) examine statistics of bias frames for uniformity&lt;br /&gt;
imstat.nclip = 3&lt;br /&gt;
imstat @bias.list &lt;br /&gt;
&lt;br /&gt;
# 8) take a look at one bias frame, examine it&lt;br /&gt;
&lt;br /&gt;
displ Calib-100_Bias.fit 1&lt;br /&gt;
&lt;br /&gt;
# 9) load ccdred package&lt;br /&gt;
&lt;br /&gt;
noao&lt;br /&gt;
imred &lt;br /&gt;
ccdred&lt;br /&gt;
&lt;br /&gt;
# 10) combine bias (also called &amp;quot;zero&amp;quot;) frames&lt;br /&gt;
&lt;br /&gt;
zerocombine @bias.list output=&amp;quot;Zero&amp;quot; combine=&amp;quot;median&amp;quot; reject=&amp;quot;minmax&amp;quot; ccdtype=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# NOTE:&lt;br /&gt;
# same can be done by editing the parameters of the procedure &amp;quot;zerocombine&amp;quot;&lt;br /&gt;
#  with &amp;quot;epar zerocombine&amp;quot; and just changing the above listed parameters &lt;br /&gt;
# (leave other as default), save and exit with &amp;quot;:q&amp;quot;,&lt;br /&gt;
# or run it with &amp;quot;:go&amp;quot;. If exit then run it &amp;quot;zerocombine&amp;quot;,&lt;br /&gt;
# pressing enter for questions. This applies to all below procedures in IRAF&lt;br /&gt;
 &lt;br /&gt;
# 11) examine the final combined frame called Zero&lt;br /&gt;
&lt;br /&gt;
displ Zero 2&lt;br /&gt;
imstat Zero&lt;br /&gt;
&lt;br /&gt;
# note the decrease in STDDEV&lt;br /&gt;
# note that the average bias level is 1376&lt;br /&gt;
&lt;br /&gt;
# 11) make dark list of all Dark files, check their statistics, see how they look like&lt;br /&gt;
&lt;br /&gt;
!ls Calib-1*D60* &amp;gt; dark60.list&lt;br /&gt;
imstat @dark60.list &lt;br /&gt;
displ  Calib-104_D60.fit 1&lt;br /&gt;
&lt;br /&gt;
# note that after 60seconds of integration, the average level in the CCD is about 1389&lt;br /&gt;
# the temperature of the camera was -25 Celsius&lt;br /&gt;
# which means that the dark current electrons added 1389 - 1376 = 13 ADU&lt;br /&gt;
# the units recorded by the CCD camera are ADU. The actual eletroncs are &lt;br /&gt;
# obtained when this number is divided by GAIN = 1.2 e-/ADU for this camera.&lt;br /&gt;
# so, we got about 13 / 1.2 = 10.8 e- of dark current in this case.&lt;br /&gt;
&lt;br /&gt;
# 12) processing darks (subtracting bias) and combinining them&lt;br /&gt;
# set some general parameters for ccdred and ccdproc for ASV CCD camera&lt;br /&gt;
&lt;br /&gt;
 ccdred.verbose=yes&lt;br /&gt;
 ccdproc.fixpix = no&lt;br /&gt;
 ccdproc.oversca = no&lt;br /&gt;
 ccdproc.trim = no&lt;br /&gt;
 ccdproc.ccdtype=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 ccdproc @dark60.list zero=&amp;quot;Zero&amp;quot; zerocor+ darkcor- flatcor- &lt;br /&gt;
&lt;br /&gt;
 darkcombine @dark60.list output=&amp;quot;Dark60&amp;quot; ccdtype=&amp;quot;&amp;quot; process- combine=&amp;quot;median&amp;quot; # reject=&amp;quot;minmax&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Proces- switch means : do not process with ccdproc, as we have already did this &lt;br /&gt;
 # by hand, in the previous step&lt;br /&gt;
&lt;br /&gt;
# does the end result make sense?&lt;br /&gt;
 displ Dark60 1&lt;br /&gt;
 imstat Dark60&lt;br /&gt;
&lt;br /&gt;
# 13) make a list of twilight flatfield files in the V filter &lt;br /&gt;
# check their statistics, see how they look like&lt;br /&gt;
!ls TwiFlat-*V.fit &amp;gt; twiflat_V.list&lt;br /&gt;
imstat @twiflat_V.list &lt;br /&gt;
&lt;br /&gt;
# For flats, it is very important to check them all visually&lt;br /&gt;
displ TwiFlat-010_V.fit 1&lt;br /&gt;
displ TwiFlat-011_V.fit 2&lt;br /&gt;
displ TwiFlat-012_V.fit 3&lt;br /&gt;
displ TwiFlat-013_V.fit 4&lt;br /&gt;
displ TwiFlat-014_V.fit 5&lt;br /&gt;
&lt;br /&gt;
# what do you see if you flip trough these images (hit TAB key in DS9)?&lt;br /&gt;
# why is the light dropping of towards the edges?&lt;br /&gt;
# are there stars caught in the twilight flat?&lt;br /&gt;
# - we must get rid of those!&lt;br /&gt;
&lt;br /&gt;
# 14) process flats (subtract bias, dark) and combine them&lt;br /&gt;
&lt;br /&gt;
 ccdproc @twiflat_V.list zero=&amp;quot;Zero&amp;quot; dark=&amp;quot;Dark60&amp;quot; zerocor+ darkcor+ flatcor- &lt;br /&gt;
&lt;br /&gt;
# note that the dark frame used was Dark60,&lt;br /&gt;
#  and IRAF noted it was scaled to exposure of flats&lt;br /&gt;
&lt;br /&gt;
# 15) combine the processed flats&lt;br /&gt;
 flatcombine @twiflat_V.list output=&amp;quot;MasterFlatV&amp;quot; ccdtype=&amp;quot;&amp;quot; process- scale=&amp;quot;median&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# 16) examine the result&lt;br /&gt;
&lt;br /&gt;
 displ MasterFlatV 1&lt;br /&gt;
 &lt;br /&gt;
# NOTE: stars have been averaged out! This is why we must dither (move the telescope)&lt;br /&gt;
# slightly when taking twilight flat frames!&lt;br /&gt;
&lt;br /&gt;
# 17) Finally, processing science frames  &lt;br /&gt;
# subtracting bias, dark and then flatfielding all of them&lt;br /&gt;
!ls Qatar2b-*fit &amp;gt; qatar.list&lt;br /&gt;
&lt;br /&gt;
ccdproc @qatar.list zero=&amp;quot;Zero&amp;quot; dark=&amp;quot;Dark60&amp;quot; flat=&amp;quot;MasterFlatV&amp;quot; zerocor+ darkcor+ flatcor+&lt;br /&gt;
&lt;br /&gt;
# with the above 3 steps you finished the data reduction in IRAF (bias, flat field, dark correction)&lt;br /&gt;
# next you move to the magnitude measurements&lt;br /&gt;
&lt;br /&gt;
# 18) Check the header of any of the finally processed data frames:&lt;br /&gt;
&lt;br /&gt;
 imhead Qatar2b-239_V.fit l+&lt;br /&gt;
&lt;br /&gt;
# This is how a finished processing job should look like at the end:&lt;br /&gt;
#ZEROCOR = 'May 19 14:13 Zero level correction image is Zero'&lt;br /&gt;
#DARKCOR = 'May 19 14:13 Dark count correction image is Dark60 with scale=1.'&lt;br /&gt;
#FLATCOR = 'May 19 14:13 Flat field image is MasterFlatV with scale=30623.51'&lt;br /&gt;
#CCDSEC  = '[1:2048,1:2048]'&lt;br /&gt;
#CCDMEAN =             536.6693&lt;br /&gt;
#CCDMEANT=           1116511997&lt;br /&gt;
#CCDPROC = 'May 19 14:13 CCD processing done'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # 19) Go to DS9 and remove all current frames by going in the menu:&lt;br /&gt;
 # Frame -&amp;gt; Delete All Frames&lt;br /&gt;
 # now compare a raw and processed science frame&lt;br /&gt;
&lt;br /&gt;
 displ ../raw/Qatar2b-239_V.fit 1 zscale+&lt;br /&gt;
 displ Qatar2b-239_V.fit 2 zscale+&lt;br /&gt;
&lt;br /&gt;
 # you can also press scale and select zscale in the DS9 window&lt;br /&gt;
 # compare the two images&lt;br /&gt;
 # what have we gained?&lt;br /&gt;
 # was the flatfielding in the reduction able to completely remove the effect of vigneting?&lt;br /&gt;
&lt;br /&gt;
#####################################################################################&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
##############################&lt;br /&gt;
# Step 3: APERTURE PHOTOMETRY&lt;br /&gt;
##############################&lt;br /&gt;
&lt;br /&gt;
# make a reference.dat file - what are the x,y coordinates of the objects you want to measure?&lt;br /&gt;
# lets take three objects - a check star, a comaprison star and the target&lt;br /&gt;
&lt;br /&gt;
# Compare this&lt;br /&gt;
# http://var2.astro.cz/ETD/predict_detail.php?STARNAME=Qatar-2&amp;amp;PLANET=b&amp;amp;PER=&amp;amp;M=&lt;br /&gt;
# with the first frame&lt;br /&gt;
&lt;br /&gt;
displ Qatar2b-101_V.fit 1&lt;br /&gt;
&lt;br /&gt;
# note that the image looks flipped in the X axis (why could that be?)&lt;br /&gt;
# Do Zoom -&amp;gt; Invert X in DS9 to make life easier&lt;br /&gt;
&lt;br /&gt;
# The star with the Qatar-2b planet is the one in the middle, close to &lt;br /&gt;
# (x,y) = (1060,920)&lt;br /&gt;
# click on the star in DS9. A green circle should appear.&lt;br /&gt;
# Make sure the circle is selected (active) and go to the menu and click&lt;br /&gt;
# Region -&amp;gt; Centroid &lt;br /&gt;
# then double click the circle to see its properties&lt;br /&gt;
# you will see the center as (1062, 919)&lt;br /&gt;
&lt;br /&gt;
# Do the same for objects at (740,711) which we will take as comparison star&lt;br /&gt;
# and (1374, 1716)&lt;br /&gt;
# DONT FORGET THE DISPLAYED IMAGE IS FLIPPED IN X (coordinates are larger to the left)&lt;br /&gt;
&lt;br /&gt;
# as in the exercise with the fake data&lt;br /&gt;
# make a reference.dat file containing these x and y of three objects&lt;br /&gt;
# (no commas between x and y)&lt;br /&gt;
# copy it so that it is also a .coo file for the first frame &lt;br /&gt;
&lt;br /&gt;
!cp reference.dat Qatar2b-101_V.coo&lt;br /&gt;
&lt;br /&gt;
# check it once more&lt;br /&gt;
displ Qatar2b-101_V 1&lt;br /&gt;
tvmark 1 reference.dat mark=&amp;quot;circle&amp;quot; radii=20&lt;br /&gt;
&lt;br /&gt;
# calculate offsets using python code&lt;br /&gt;
!cp ../offsets_qphot.py .&lt;br /&gt;
!cp ../reference.dat .&lt;br /&gt;
!python offsets_qphot.py&lt;br /&gt;
&lt;br /&gt;
# when promtped answer:&lt;br /&gt;
# Enter file with the list of images to be processed: qatar.list&lt;br /&gt;
# Enter file with object x,y coordinates in the reference frame: reference.dat&lt;br /&gt;
# The code will display a plot of all the X and Y offsets. &lt;br /&gt;
&lt;br /&gt;
# Can you understand why are the X shifts continually drifting?&lt;br /&gt;
# Its the telescope tracking innacuracy!&lt;br /&gt;
# Why is there a sudden jump at frame 90 in Y shifts?&lt;br /&gt;
# Somebody adjusted the field by moving the telescope at that time!&lt;br /&gt;
# Close this plot to continue.&lt;br /&gt;
&lt;br /&gt;
# make the list of all the  .coo file&lt;br /&gt;
&lt;br /&gt;
!ls Qatar*coo &amp;gt; coolist&lt;br /&gt;
&lt;br /&gt;
# load the IRAF apphot package&lt;br /&gt;
noao &lt;br /&gt;
digiphot&lt;br /&gt;
apphot&lt;br /&gt;
&lt;br /&gt;
# set parameters of qphot which are instrument dependent&lt;br /&gt;
&lt;br /&gt;
# FITS keywords for filter, time and exposure&lt;br /&gt;
# and some instrument and data specific parameters: CCD camera gain &lt;br /&gt;
# and magnitude scale flux zeropoint (if known, or taken arbitrary setpoint)&lt;br /&gt;
# for the case of Qatar*.fit files in this exercise:&lt;br /&gt;
&lt;br /&gt;
qphot.obstime=&amp;quot;date&amp;quot;&lt;br /&gt;
qphot.exposur=&amp;quot;exptime&amp;quot;&lt;br /&gt;
qphot.zmag = 20.&lt;br /&gt;
qphot.epadu= 1.2&lt;br /&gt;
&lt;br /&gt;
# set sizes of annuli for measuring stars&lt;br /&gt;
# centering box size (qphot star will recenter the target positions)&lt;br /&gt;
# measuring aperture for star, and for sky inner radius and sky outer radius&lt;br /&gt;
&lt;br /&gt;
qphot.cbox = 5.&lt;br /&gt;
qphot.annulus=20.&lt;br /&gt;
qphot.dannulus=20.&lt;br /&gt;
qphot.aperture=10.&lt;br /&gt;
&lt;br /&gt;
qphot @qatar.list coords=@coolist interac-&lt;br /&gt;
# just hit enter when prompted, the defaults have been set in the earlier step&lt;br /&gt;
&lt;br /&gt;
# QPHOT creates output files of the type QatarXXX.fit.mag.1 &lt;br /&gt;
# It contains various measurements of relevance to the aperture photometry&lt;br /&gt;
# there is one file for every image, with three different sources measured&lt;br /&gt;
# To convert this output into something more basic, you can use&lt;br /&gt;
# IRAF txdump command - it will print out just the columns you request&lt;br /&gt;
# but it will do so for all three sources&lt;br /&gt;
&lt;br /&gt;
txdump Qatar*.mag.1 image,otime,xcenter,ycenter,mag,merr yes &amp;gt; all_measurements.dat&lt;br /&gt;
&lt;br /&gt;
# extract the three sources separately for convenience of analysis&lt;br /&gt;
# the sed commands below extract the first line and then every third, &lt;br /&gt;
# or the second and every third and so on.&lt;br /&gt;
!sed -n 'p;n;n;' all_measurements.dat &amp;gt;! target.dat&lt;br /&gt;
!sed -n 'n;p;n;' all_measurements.dat &amp;gt;! comparison.dat&lt;br /&gt;
!sed -n 'n;n;p;' all_measurements.dat &amp;gt;! check.dat&lt;br /&gt;
&lt;br /&gt;
# use your favorite plotting software to plot the difference between target and comparison&lt;br /&gt;
# overplot the total error (propagate magnitude errors in quadrature!)&lt;br /&gt;
# Here is what I got as a result qatar2b-exercise.jpeg&lt;br /&gt;
&lt;br /&gt;
# Lets check the magnitude of our check star, and the  difference between comparison and check.&lt;br /&gt;
# if everything is in order and our comparison and check stars are not variable, &lt;br /&gt;
# the difference should be constant.&lt;br /&gt;
&lt;br /&gt;
# Examine check.dat. Wait. what? Magnitudes are jumping up and down, and going to INDEF.&lt;br /&gt;
# Is there a problem? Seems like qphot could not measure anything in frame Qatar2b-122_V.fit&lt;br /&gt;
# And there is a jump in five magnitudes between 109 and 110. Smells like a crude error.&lt;br /&gt;
# Lets see what is going on.&lt;br /&gt;
&lt;br /&gt;
# delete all frames in DS9 and then&lt;br /&gt;
displ Qatar2b-101_V.fit 1&lt;br /&gt;
displ Qatar2b-110_V.fit 2&lt;br /&gt;
# blink them. Look at the positon of the chosen check star. &lt;br /&gt;
# Still dont see anything strange?&lt;br /&gt;
# how about now?&lt;br /&gt;
displ Qatar2b-120_V.fit 3&lt;br /&gt;
displ Qatar2b-130_V.fit 4&lt;br /&gt;
displ Qatar2b-140_V.fit 5&lt;br /&gt;
displ Qatar2b-150_V.fit 6&lt;br /&gt;
&lt;br /&gt;
# use TAB in DS9 to flip trough the 6 frames.&lt;br /&gt;
# IT'S MOVING! Congratulations. You just discovered an asteroid (or a new Solar System planet?)&lt;br /&gt;
# by accident. It happens. Always - always be on the lookout and check-check-doublecheck your data.&lt;br /&gt;
&lt;br /&gt;
# Do you know how to use the information from the header of the CCD image and go to&lt;br /&gt;
# Minor Planet Center Checker and find out if this is a known asteroid?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ana.Lalovic</name></author>
		
	</entry>
</feed>