10
Exercise of data reduction for MOIRCS Multi-Object Spectroscopy Masao Hayashi (NAOJ) and Anna Ferré-Mateu (Subaru) Subaru Autumn School 2014, on 24-26 September 2014 Schedule on 25 th Sep. (as a guide) 10:10-12:00 (~2 hours): Step 1 – Step 2 13:00-15:00 (2 hours): Step 3 – Step 7 15:30-17:30 (2 hours): Step 8 – Step 10 Target galaxy: MODS11-0390 (Detector 1) Standard star: M53735 (Detector 2) pwd - shows the current location of the directory cd X - changes current directory to the directory X mkdir X - makes new directory named X ls (-lrt) - lists all the files/directories in the current directory (by date created) cp A B - copies the file/directory A to the file/directory B less file.txt - shows the contents of file.txt sed ‘s/X/Y/’ file.txt - reads character strings in file.txt and exchanges the strings following the requirement X to the string Y epar X - edits parameters of the task X .exit - to quit mcsmdp This document is for helping you understand a basic procedure of MOIRCS MOS data reduction. You should read the handbook carefully to get the detail. UNIX commands IRAF Be careful not to overwrite the existing files when you run a task Be careful to avoid a typo when you type a command, or you may encounter an error message . Data used for this exercise Raw data Reduced 2D spectrum (Goal for all) 1D spectrum (Goal for quick workers) http://www.edechs.com/MCSMDP/ Feel free to ask us when you have any problems. There is no problem with you going ahead rapidly if you can understand the individual processes by reading the handbook and this document by yourself.

Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Exercise of data reduction for MOIRCS

Multi-Object SpectroscopyMasao Hayashi (NAOJ) and Anna Ferré-Mateu (Subaru)

Subaru Autumn School 2014, on 24-26 September 2014

Schedule on 25th Sep. (as a guide)

10:10-12:00 (~2 hours): Step 1 – Step 2

13:00-15:00 (2 hours): Step 3 – Step 7

15:30-17:30 (2 hours): Step 8 – Step 10

• Target galaxy: MODS11-0390 (Detector 1)

• Standard star: M53735 (Detector 2)

• pwd - shows the current location of the directory

• cd X - changes current directory to the directory X

• mkdir X - makes new directory named X

• ls (-lrt) - lists all the files/directories in the current directory (by date created)

• cp A B - copies the file/directory A to the file/directory B

• less file.txt - shows the contents of file.txt

• sed ‘s/X/Y/’ file.txt - reads character strings in file.txt and

exchanges the strings following the requirement X to the string Y

• epar X - edits parameters of the task X

• .exit - to quit mcsmdp

This document is for helping you understand a basic procedure of MOIRCS MOS data reduction.

You should read the handbook carefully to get the detail.

UNIX commands

IRAF

Be careful not to overwrite the existing files when you run a task

Be careful to avoid a typo when you type a command,

or you may encounter an error message.

Data used for this exercise

Raw data Reduced 2D spectrum (Goal for all)

1D spectrum (Goal for quick workers)

http://www.edechs.com/MCSMDP/

Feel free to ask us when you have any

problems. There is no problem with you

going ahead rapidly if you can understand

the individual processes by reading the

handbook and this document by yourself.

Page 2: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 1 – Preparation for the data reduction

• Setup the software (MCSMDP)

$ emacs ~/.bashrc

source /data/local/subaru/MCSMDP_v1_1_3/etc/mcsmdp.sh

$ source ~/.bashrc

Add the following path in your ~/.bashrc:

To enable the change of ~/.bashrc

• Setup your working directory

$ cd /data/users/YOURACCOUNT/red

$ cp /mfst01d/hayshiso/autumn14/MCSMDP_sample.tbz .

$ tar jxf MCSMDP_sample.tbz

• Getting the MOIRCS MOS sample data

$ mkdir /data/users/YOURACCOUNT

$ mkdir /data/users/YOURACCOUNT/red

$ wget http://www.edechs.com/MCSMDP/MCSMDP_sample.tbz

You can also get the sample data from the website as follows:

$ cd /data/users/YOURACCOUNT/red/MCSMDP_sample/

$ mcsmdp

mkiraf? (yes):

> mcsmdp

• Starting of MCSMDP

※ (comments)

(← Enter)

(You can use any text editors that you like)

(starting of ds9)

(directory for data reduction)

(extraction of the *.tbz file)

• Checking the data

> hselect *.fits $I,OBS-MOD,DATA-TYP,OBJECT,DISPERSR,EXPTIME,DET-ID,K_DITCNT yes

Keywords of the FITS header (see Table 2.2 in the manual)

To make sure what kind of the data each frame is

• Making lists of the data processed simultaneously

The frames of the same detector and the same nodding position are listed

> hselect MCSA*.fits $I "OBJECT = 'DOMEFLAT' & @'DET-ID' = 1" > flat1.lst

> hselect MCSA*.fits $I "OBJECT = 'DOMEFLAT' & @'DET-ID' = 2" > flat2.lst

> hselect MCSA*.fits $I "OBJECT = 'CDFN_MASK02' & @'DET-ID' = 1 & K_DITCNT = 1" > obj1a.lst

> hselect MCSA*.fits $I "OBJECT = 'CDFN_MASK02' & @'DET-ID' = 1 & K_DITCNT = 2" > obj1b.lst

> hselect MCSA*.fits $I "OBJECT = 'CDFN_MASK02' & @'DET-ID' = 2 & K_DITCNT = 1" > obj2a.lst

> hselect MCSA*.fits $I "OBJECT = 'CDFN_MASK02' & @'DET-ID' = 2 & K_DITCNT = 2" > obj2b.lst

“ ” shows the requirement to list

DET-ID: Detector ID, 1 or 2

K_DITCNT: Nth number of nodding,

1 means A position and 2 means B position

> ls

> less flat1.lst

Check the lists and that they are created properly

(You should check all of the lists you created)

Page 3: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 2 – Flat fielding • Combining all dome flat data (per Detector 1 or Detector 2)

Why is “median” taken instead of “average”?

Consider why it is divided by 10000?

Try “> histogram HK500_CDFN2_Domeflat1.fits”

Step 3 – Interpolation of bad pixels

> epar imcombine

> imcombine @flat1.lst HK500_CDFN2_Domeflat1.fits

> imarith HK500_CDFN2_Domeflat1.fits / 10000.0 HK500_CDFN2_Domeflat1.fits

> !sed 's/¥(.*¥)/fl¥1/' obj1a.lst > flobj1a.lst

> !sed 's/¥(.*¥)/fl¥1/' obj1b.lst > flobj1b.lst

To better understand

[Important parameters] combine, reject, scale, weight

> imarith @obj1a.lst / HK500_CDFN2_Domeflat1.fits @flobj1a.lst

> imarith @obj1b.lst / HK500_CDFN2_Domeflat1.fits @flobj1b.lst

• Making lists for the resulting files

• Flat fielding

Check the resulting files!

> mkdir BPM

> !sed 's/¥(.*¥)¥.fits/BPM¥/¥1.pl/' obj1a.lst > bpm1a.lst

> !sed 's/¥(.*¥)¥.fits/BPM¥/¥1.pl/' obj1b.lst > bpm1b.lst

> imcopy

mdpdb$bpm/nlbpm1_FF64r.fits,mdpdb$bpm/nlbpm1_FF64r.fits,mdpdb$bpm/nlbpm1_FF64r.fits,

mdpdb$bpm/nlbpm1_FF64r.fits @bpm1a.lst

> imcopy

mdpdb$bpm/nlbpm1_FF64r.fits,mdpdb$bpm/nlbpm1_FF64r.fits,mdpdb$bpm/nlbpm1_FF64r.fits,

mdpdb$bpm/nlbpm1_FF64r.fits @bpm1b.lst

• Getting a bad pixel mask from the database (MDPDB)

(the directory where bad pixel masks for each frames are stored)

Name of the bad pixel mask

for MCSA***.fits : MCSA***.pl

(this task must be written in one line)

(this task must be written in one line)

(lists of name of output files)

Check the resulting files!

“$ ls BPM” to see the files in the directory BPM

• Fixing bad pixels specified by the BPM mask

> !sed 's/¥(.*¥)/cr¥1/' flobj1a.lst > crobj1a.lst

> !sed 's/¥(.*¥)/cr¥1/' flobj1b.lst > crobj1b.lst

> imcopy @flobj1a.lst @crobj1a.lst

> imcopy @flobj1b.lst @crobj1b.lst

> epar fixpix

> fixpix @crobj1a.lst @bpm1a.lst

> fixpix @crobj1b.lst @bpm1b.lst

(copy the frames before fixing the pixels)

(edit parameters of the task, fixpix)

(lists of name of output files)

[Important parameters] cinterp, linterp

Check the resulting files!

Consider how you can improve this process.

You would notice that there are a lot of hot pixels left.

So, there is still a room to improve this process.

(see section 4.2.1 in the manual and make sure to set the proper parameters)

(¥ means a backslash)

Page 4: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 4 – Cosmic rays This process is skipped this time, because it is not significant for the data we are now analyzing.

However, in general, it is better to remove cosmic rays on each frame.

You should be able to realize this by blinking the several consecutive frames as described in section 4.2.2 of the manual.

• Subtracting the background by comparing two consecutive frames

Step 5 – A-B sky subtraction

> !sed 's/¥(.*¥)/ab¥1/' crobj1a.lst > abobj1a.lst

> imarith @crobj1a.lst - @crobj1b.lst @abobj1a.lst

A B A-B A B A-B

sky background

objectslit

Consider why the positive/negative OH sky lines are still

seen in the A-B frames?

The sky background may be subtracted better by more

frames (i.e, 3 or more) being used in this process.

Consider how you can/may improve this process.

Step 6 – Distortion correctionCorrecting the spectra from spatial and spectral distortions (especially for those spectra near the edge). You have to use the database files corresponding to the date the data was obtained (see MCSRED for other database dates).

> !sed 's/¥(.*¥)/gc¥1/' abobj1a.lst > gcobj1a.lst

> epar geotran

> geotran @abobj1a.lst @gcobj1a.lst mdpdb$geomap/mcsdistcrr1_feb07new.dbs

mcsdistcrr1_feb07new.gmp

parameter: database

parameter: transforms

Before the correction After the correction

2D spectrum

Check the resulting files!

Step 7 – Extraction of individual 2D spectra

X range: all (you can extract the specific X range as well)

Y range: from 1755 pixel to 1840 pixel

> maskplot CDFN_MASK02.mdp image=gcabcrflMCSA00057147.fits raw+

> !sed 's/¥(.*¥)¥.fits/¥1_MODS11-0390¥.fits/' gcobj1a.lst > gcMODS11-0390.lst

> !sed 's/¥(.*¥)¥.fits/¥1_MODS11-0390_rot¥.fits/' gcobj1a.lst > gcMODS11-0390_rot.lst

> !sed 's/¥(.*¥)/¥1[*,1755:1840]/' gcobj1a.lst > cut.lst

> imcopy @cut.lst @gcMODS11-0390_rot.lst

> rotate @gcMODS11-0390_rot.lst @gcMODS11-0390.lst 180

(check the image visually!)

(extract the 2D spectrum of the target object)

(Detector 1: wavelength↓ with x ↑,

so rotate the frames by 180 degree)

x-coordinates

wavelength

The process, grism rotation correction, is skipped this time, because it is not significant for the data.

Page 5: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 8 – Wavelength calibration

> !sed 's/¥(.*¥)/gcsky¥1/' crobj1a.lst > gcsky1a.lst

> geotran @crobj1a.lst @gcsky1a.lst

mdpdb$geomap/mcsdistcrr1_feb07new.dbs mcsdistcrr1_feb07new.gmp

• Preparing the spectra without the A-B subtraction to use OH sky lines for the calibration

> !sed 's/¥(.*¥)¥.fits/¥1_MODS11-0390¥.fits/' gcsky1a.lst > gcskyMODS11-0390.lst

> !sed 's/¥(.*¥)¥.fits/¥1_MODS11-0390_rot¥.fits/' gcsky1a.lst > gcskyMODS11-0390_rot.lst

> !sed 's/¥(.*¥)/¥1[*,1755:1840]/' gcsky1a.lst > cut.lst

> imcopy @cut.lst @gcskyMODS11-0390_rot.lst

> rotate @gcskyMODS11-0390_rot.lst @gcskyMODS11-0390.lst 180

First, distortion correction is performed for the frames where the sky is not subtracted yet.

Next, the spectrum is extracted. This is the same process as the step-7, but for “A”-spectrum, not “A-B”-spectrum.

Compare the spectra with those obtained in the Step-7.

Can you see the strong OH sky lines on the 2D spectrum?

• Identifying the OH sky lines to determine the relation between the X-coordinates and wavelengthPlease read section 4.4.1 of the handbook carefully and understand what is preformed in this process.

> epar identify

> identify gcskycrflMCSA00057147_MODS11-0390.fits

[Important parameters] section, nsum, fwidth, function, order

section = middle linensum

fwidth x-coordinates

y-c

oo

rdin

ate

s

x [pixel]

wa

ve

len

gth

[A

]

In the case that the fitting function is linear,

Extract 1D spectrum along the line

function, order

Fig. 4.2 of the handbook

Figure similar to Fig. 4.3 of the handbook

residual

Command keys used frequently: m, f, l

Command keys used frequently: d, f

> epar reidentify

> reidentify gcskycrflMCSA00057147_MODS11-0390.fits gcskycrflMCSA00057147_MODS11-

0390.fits

• Identifying the OH sky lines at different y-coordinates as well

At this stage, y-coordinates can correspond to different wavelengths at a given x-coordinate.

[Important parameters] trace, step

parameter: reference

parameter: images

wavelength(x): wavelength as a function of x at a given y-coordinate

(The figure 4.1 of the manual is provided in a paper apart.)

Page 6: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

nsum

fwidth x-coordinates

y-c

oo

rdin

ate

s

step

1D spectrum → wavelength(x) at y3

1D spectrum → wavelength(x) at y2

1D spectrum → wavelength(x) at y1

wavelength(x, y)

• Deriving the relation between the wavelength and (x,y) coordinates

wavelength3(x) at y3

wavelength2(x) at y2

wavelength1(x) at y1

wavelength?(x) at y?

………

[Important parameters] function, xorder, yorder

> epar fitcoords

> fitcoords gcskycrflMCSA00057147_MODS11-0390

Check the fitting results.

Type “xxyy” and “r”, or type “xxyr” and “r” (see Table 4.3 of the handbook)

• Transforming the spectrum based on the database of the wavelength as a func. of (x,y)

> epar transform

> !sed 's/¥(.*¥)/tr¥1/' gcMODS11-0390.lst > trMODS11-0390.lst

> transform @gcMODS11-0390.lst @trMODS11-0390.lst gcskycrflMCSA00057147_MODS11-

0390

> mdpdisplay gcabcrflMCSA00057147_MODS11-0390.fits frame=1

> mdpdisplay trgcabcrflMCSA00057147_MODS11-0390.fits frame=2

(the name of the database)

To check the transformed spectrum

Here, we assume that the relation between wavelength and (x,y) derived for a given frame is

applicable to the other frames as well. However, in general, the assumption is not always true.

Page 7: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 9 – Removal of residual sky emission

• Subtracting the residual sky emission by fitting the background

> !sed 's/¥(.*¥)/bg¥1/' trMODS11-0390.lst > bgMODS11-0390.lst

> epar background

> background @trMODS11-0390.lst @bgMODS11-0390.lst (“q” and then “return” to exit)

[Important parameters] axis, function, order

> hselect @bgMODS11-0390.lst "$I,K_DITWID" yes

> !sed 's/¥(.*¥)/sh¥1/' bgMODS11-0390.lst > shMODS11-0390.lst

> imshift @bgMODS11-0390.lst @shMODS11-0390.lst 0 26

Step 10 – Combining all of the spectra

> epar imcombine

> imcombine @bgMODS11-0390.lst,@ngMODS11-0390.lst HK500_MODS11-0390

> !sed 's/¥(.*¥)/ng¥1/' shMODS11-0390.lst > ngMODS11-0390.lst

> imarith @shMODS11-0390.lst * -1 @ngMODS11-0390.lst

• Shifting the spectra by the nodding length

(check the nodding length)

A-B

the nodding length

(26 = 3” / 0.117, 1pixel=0.117”)

• Inverting the negative value into the positive one

• Combining the spectra

Now, you obtained the 2-D spectrum! The reduction is nearly completed.

bg

shng

bg+ng

A

B

B

B

A

A

B

A+B

A

Shift

Invert

bg

A

B

Combine+

Page 8: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 11 – Reduction of spectrum of a standard starThe spectrum of a standard star is used for flux calibration and telluric correction.

• Standard star: M53735

The spectrum was taken on the detector 2.

## flat

> epar imcombine

> imcombine @flat2.lst HK500_CDFN2_Domeflat2.fits

> imarith HK500_CDFN2_Domeflat2.fits / 10000.0 HK500_CDFN2_Domeflat2.fits

> imarith MCSA00057114.fits / HK500_CDFN2_Domeflat2.fits flMCSA00057114.fits

> imarith MCSA00057116.fits / HK500_CDFN2_Domeflat2.fits flMCSA00057116.fits

## bad pixel

> imcopy mdpdb$bpm/nlbpm2_FF64r.fits BPM/MCSA00057114.pl

> imcopy mdpdb$bpm/nlbpm2_FF64r.fits BPM/MCSA00057116.pl

> imcopy flMCSA00057114.fits crflMCSA00057114.fits

> imcopy flMCSA00057116.fits crflMCSA00057116.fits

> epar fixpix

> fixpix crflMCSA00057114.fits BPM/MCSA00057114.pl

> fixpix crflMCSA00057116.fits BPM/MCSA00057116.pl

## A-B sky subtraction

> imarith crflMCSA00057114.fits - crflMCSA00057116.fits abcrflMCSA00057114.fits

## distortion

> epar geotran

> geotran abcrflMCSA00057114.fits gcabcrflMCSA00057114.fits

mdpdb$geomap/mcsdistcrr2_feb07new.dbs mcsdistcrr2_feb07new.gmp

## extraction of a slit

> maskplot CDFN_MASK02.mdp image=gcabcrflMCSA00057114.fits raw+

> imcopy gcabcrflMCSA00057114.fits[*,902:1022] gcabcrflMCSA00057114_M53735.fits

## wavelengh calibration

> geotran crflMCSA00057114.fits gcskycrflMCSA00057114.fits

mdpdb$geomap/mcsdistcrr2_feb07new.dbs mcsdistcrr2_feb07new.gmp

> imcopy gcskycrflMCSA00057114.fits[*,902:1022] gcskycrflMCSA00057114_M53735.fits

> epar identify

> identify gcskycrflMCSA00057114_M53735.fits

> epar reidentify

> reidentify gcskycrflMCSA00057114_M53735.fits gcskycrflMCSA00057114_M53735.fits

> epar fitcoords

> fitcoords gcskycrflMCSA00057114_M53735

> epar transform

> transform gcabcrflMCSA00057114_M53735.fits trgcabcrflMCSA00057114_M53735.fits

gccrflMCSA00057114_M53735

> mdpdisplay gcabcrflMCSA00057114_M53735.fits frame=1

> mdpdisplay trgcabcrflMCSA00057114_M53735.fits frame=2

## residual background subtraction

> epar background

> background trgcabcrflMCSA00057114_M53735.fits bgtrgcabcrflMCSA00057114_M53735.fits

Page 9: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

## A+B combine

> hselect bgtrgcabcrflMCSA00057114_M53735.fits "$I,K_DITWID" yes

> imshift bgtrgcabcrflMCSA00057114_M53735.fits shbgtrgcabcrflMCSA00057114_M53735.fits 0

43

> imarith shbgtrgcabcrflMCSA00057114_M53735.fits * -1

ngshbgtrgcabcrflMCSA00057114_M53735.fits

> epar imcombine

> imcombine

bgtrgcabcrflMCSA00057114_M53735.fits,ngshbgtrgcabcrflMCSA00057114_M53735.fits

HK500_M53735.fits

• Extracting the 1D spectrum of the standard star

## apall

> apall HK500_M53735.fits

> epar rescurve

> rescurve HK500_M53735.ms.fits 8.856 resc_CDFN2_HK500.fits

> mdpfcalib HK500_MODS11-0390.fits resc_CDFN2_HK500.fits HK500_MODS11-0390fl.fits

Step 12 – Flux calibration and telluric correction

The reduction is completed!!

Please read section 4.6 of the handbook carefully and understand what is preformed in this task.

Please read section 4.6 of the handbook carefully and understand what is preformed in this process.

Detection of emission line

Page 10: Exercise of data reduction for MOIRCS ... - Subaru Telescope · Please read section 4.4.1 of the handbook carefully and understand what is preformed in this process. > epar identify

Step 13 – Data anaysis

• Measurement of redshift of the target galaxy

> splot HK500_MODS11-0390fl.fits 41

“:nsum 5” → the region [*,39:43] is used to plot the spectrum, i.e 5 pixels around 41

“w” and then “x” → zoom the plot in x

“w” and then “c” → zoom the plot around the cursor

“k” in the left side of emission line and then “k” in the right → profile fitting

Consider what is the redshift of this target galaxy, given that this line is Hα?

• Measurement of luminosity of the emission line

• Estimation of star formation rate of this galaxy

For example,

Enjoy the analysis with near-infrared spectra taken by MOIRCS MOS !!

• And so on …