[Japanese][English]
■ Quick Reduction of HDS data on IRAF

This page is an explanation of the quick reduction of Subaru HDS (High Dispersion Spectrograph) data on ANA system at Subaru summit/remote observation system.
Basically, this page describes the quick reduction scheme on ANA system at summit or remote observing room. But, if you want, you can make same environment on your owned IRAF system. (Please download and install CL-scrpts here.)
Under this reduction scheme, all data should be reduced to one dimensional spectra. If you want to keep the spatial information on them, you have to find another solution to reduce your data.

For details on data reduction with IRAF, please see these manuals (PDF : Japanese/English)
Table of Conents
How to login to ANA/How to start IRAF
Overview about the quick reduction on IRAF
OverScan by hdsql
[Preparation 1]Making Mask Frame from BIAS
[Preparation 2]Making Template for Order Trace
[Preparation 3]Making Nomilized Flat
[Preparation 4]Wavelength Identification of a Th-Ar Frame
hdsql : Quick Look of Object Frames
Tips, Trouble Shooting

Download of CL scripts

Making a combined spectrum (by Continuum fit)
Making a combined spectrum (by Flux calibration)




How to login to ANA/How to start IRAF
[1] Login to ANA from its console, using the user account foryour obs. (uXXXXX).
[2] Right click on your desktop. Select the menu item "Gen2 ANA"
"ANA Menu" Window will come up.
[3] Push "HDS" button in ANA Menu.
[4] An xgterm for IRAF and a "HDS LOG Editor" window will come up.
For the first time, "mkiraf" command to create your IRAF environment is running in the xgterm. Please type "xgterm" for your teminal selection in mkiraf.
[5] You can use tasks "overscan" for overscan region crrection and "hdsql" for HDS quick data reduction on this IRAF without any settings by yourself. The environment arguments, stdimage=imt4096, imtype="fits", have been also registred already.
[6] In IRAF terminal,
     cl> cd /work/oXXXXX
You should work under this directory.
Your data is archived in "/data/oXXXXX/" (read only).


Overview of quick data analysis on ANA IRAF
Reduction process using hdsql
▲[Reduction scheme using "hdsql"]
   Left side is the inside of the task "hdsql". Before "hdsql", you should do preparations (1 - 4) on the right side.
   IRAF tasks used in each processes are written in this color.


After this, I will explain how to do quick data look of HDS on ANA, using the task "hdsql" on IRAF.
Upper figure shows these processes. If you do full processes of this quick analysis, you can get one-dimensional, flat-fielded, and wavelength calibrated spectra. However, each processes in "hdsql" can be skipped, if not necessary.
Before using "hdsql", preparations 1 - 4 on the right side of the figure are required. If you can skip flat-fielding and/or wavelength calibration, you should do preparation 2 at least. (But, I recommend to prepare a mask frame following the preparation 1 in order to trace object frames without an bad affection from bad column in the CCDs.)
After these preparation processes, you should use "hdsql" for each object frames.
HDS has two CCD chips on its camera. So, one exposure has two frame IDs. The red CCD has odd HDSA numbers (=CCD1/Left side CCD), and the blue one has even HDSA numbers (=CCD2/Right side CCD). These Red/Blue frames should be analyzed independently.


OverScan by "hdsql"
Each red/blue CCDs of HDS have two read out points. And there is over scan region at the ceter of frame (please see users' manual of HDS). Instead of subtruction of independent BIAS frames, an average count in this overscan region should be subtructed from object frames. The task "overscan" does this process.
This task also converts ADU to electron numbers (× ∼1.7).
Raw frames of HDS before "overscan" have FITS extention table in them. So, in IRAF, you have to designate each raw frames like "HDSA000YYYYY.fits[0]", attached "[0]" to their file names.

At the beginning of "hdsql" analysis, we will start form this "overscan" process for raw frames. Before making a mask [Preparation 1] or a template for order tracing ([Preparation 2], a raw frame for a template should be "overscan" processed. So, I will explain how to do on;y "overscan" using "hdsql".


[1] Confirm the data directory, in which raw data frames (HDSA000YYYYY.fits) archived.
Usually, it should be like /data/oXXXXX/ .
[2] In IRAF terminal,
     cl> eparam hdsql
determin parameters for "hdsql". The parameter "indirec" is the raw data directory confirmed in [1] + header of raw data filename ("HDSA000" usually). And file number without header should be inserted in parameter "inid". Overscanned data are automatically created into the current working direcotry. So, you don't have to copy any raw data to your working direcotry.
PACKAGE = echelle
   TASK = hdsql
    
inid    =                22405  Input frame ID
(indirec= /data/o05129/HDSA000) directory of Input data

(oversca=                  yes) Overscan?
(biassub=                   no) BIAS / Dark Subtraction?
(maskbad=                   no) Mask Bad Pixels?
(linear =                   no) Linearity Correction?
(cosmicr=                   no) Cosmicray-event rejection?
(scatter=                   no) Scattered light subtraction?
(flat   =                   no) Flat fielding?
(apall  =                   no) Extract spectra with apall?
(remask =                   no) Re-Mask wavlength calibrated spectrum?
(wavecal=                   no) Wavelength calibration?
(rvcorre=                   no) Heliocentric wavelength correction?
(splot  =                   no) Splot Spectrum?

                                ### Overscan ###
(os_save=                  yes) Save overscaned data?
......
[3] Execute "hdsql" with these parameters. An overscanned file "H22045o.fits" should be created.
Before OverScan (RAW)
▲HDS RAW Image (Red CCD)
      After OverScan
▲HDS Image after OverScan (Red CCD)
After the OverScan process, the BIAS level will be almost same (~0) in both side of the CCD chip. And, the overscan region in the middle of the RAW image will be removed.


[Preparation 1]
Making Mask from BIAS
In the HDS CCD chips (especially in the Red), there are some strong bad column. These could cause bad affection in some reduction prcesses (order tracing, flat fiedling etc.). In order to reduce this bad affection, a mask frame should be created at the beginning of your reduction process.
This "mask" is made by extracting bad pixels in BIAS frames, which have abnormal counts. It should be noted that this mask will create untrue (interpolated) values in each masked object frame.
Furthermore, the Blue CCD has some "negative" (dark) bad column. This mask cannot correct these dark bad column. But, these will not affect so much in your order tracing or flat-fielding. So, the "Over-Correction" by an exact mask might be avoided here.


[Preparation 1] Making Mask fro BIAS
Source BIAS
Pretreatment by hdsql OverScan only
After hdsql Make average BIAS by "imcombine".
Make mask from BIAS by "mkbadmask".
Parameters in hdsql Put the created mask frame into mb_refer in "### Masking Bad Pixels".

[1] Only "overscan" by "hdsql" for each BIAS frame.
Make a text list file (Bias2x1R.lst etc.) for created HXXXXXo.fits . Make a medianed BIAS frame by "imcombine".
     ecl> imcombine @Bias2x1R.lst Bias2x1R combine=median reject=sigclip

[2] Determine the lower / upper count level for this BIAS. Then, create a Mask using a task "mkbadmask" (original).
This "mkbad mask" uses "wacosm11.cl" in its inside. So, you have to define it in your login.cl etc.
PACKAGE = echelle
   TASK = mkbadmask

inimage =             Bias2x1R  Input BIAS image 
outimage=             Mask2x1R  Output MASK image 

(lower  =                 -100) Lower limit replacement window
(upper  =                  300) Upper limit replacement window

(clean  =                  yes) Clean up by wacosm11
(base   =                    1) Baseline for wacosm11
(mode   =                    q)
You should appoit the lower and apper counts for BIAS, here. These could be changed by the CCD binning mode. But, I can say the upper should be around 300 and the lower should be around -100 to detect the strongest bad column in the Red chip.
Furthermore, this command can remove some Cosmic-Ray events (and maybe including some isolated bad pixels) from your mask, using "wacosm11".
[3] The created mask frame will be a mono-chorme frame with its count =1 (for Bad pixels) or =0 (for Good pixels). This mask can be use by a task "fixpix".
But, the explanation for fixpix is now skipped (It is automatically called from hdsql.).
Mask image created from BIAS
▲Mask frame created from BIAS(Red CCD)
After OverScan
▲After OverScan (Red CCD)
      After Masked
▲After Masking(Red CCD)
The strongest bad column (right side) is masked.
On the other hand, the bad column in the left side (slightly weak) is still staying on.
This column might be remoed by a mask made with "upper=100".
But, this left side bad column might not affect in your data reduction process (order tracing, flat-fielding etc.).
Therefore, it is not important to force to remove it in this masking process.
[4] Put the created mask frame into a hdsql parameter, mb_refer in "### Masking Bad Pixels".
[5] In ANA, masks for all binning mode and Red/Blue chips have been prepared in
   /home/hds01/share/data/  
(likely Mask2x1R.fits etc.). So, you can skip above process to create masks, if you are reducing your data in ANA.


[Preparation 2]
Making a Template for Order Trace
Templates for order trace can be made from a frame of a bright (standard) star or flats.
If you are using standard wavelength setting (cf. StdYb), you can use standard templates like "StdYbLshsl2x2.fits" in "/home/hds01/share/data/" directory. This "StdYbLshsl2x2.fits", filename means Wavelength Setting : StdYb, The Left CCD (Red), 2x2 binning. Then, you can skip the following process of making a template. In this case, you should also copy a aperture information file in "/home/hds01/share/data/database/" directory to the "database/" directory in your working place.


[Preparation 2] Making a Template for Order Trace
Source a bright (Standard) star or a flat frame (taken with a narrow slit length)
Pretreatment by hdsql OverScan + Masing Bad Pixels (or OverScan only)
After hdsql Trace echelle apertures by "apall".
Parameters in hdsql Put th this aperture reference frame into sc_refer in "### Scattered Light Subtraction"
& ap_refer in "### Aperture Extraction".

[1] Run "hdsql" with overscan=yes and masbad=yes for a frame, which you want to make a template.
Rename created HXXXXXom.fits to some meaning filename (Here, we use "ApYb2x1R.fits".).
[2] Execute task "apall" for this overscanned file with following parameters.
If the aparture finding fails in the edge of the CCD, it can be solved by a small change of the parameter "line" (default "INDEF" means the center of the chip along the dispersion direction. For example, in the case of 2x1 binning, this default value is 2050. So, try 2200 or 1800 as the value of "line". Or, you can change it by typing ": line 2200" in the Aperture editing irafterm.).
In aperture extraction display (xgterm, the below left image), "m"-key is for manual detection of a order. "o"-key on the line which should be the 1st order →Aperture(1)="1" sort the order of aperture number. Then, "q"-key for the next fitting. For the following some questions, basically just say "yes" (hit return) in usual case.
In fitting display (the below right image), "s"→"s"-keys is for the elimination of affected region with bad column. "t"-key is for the clear of this regional selection. "f"-key is re-fit of the tracing.
PACKAGE = echelle
  TASK = apall

input   =             ApYb2x1R  List of input images
(output =                     ) List of output spectra
(apertur=                     ) Apertures
(format =              echelle) Extracted spectra format
(referen=                     ) List of aperture reference images
(profile=                     ) List of aperture profile images

(interac=                  yes) Run task interactively?
(find   =                  yes) Find apertures?
(recente=                  yes) Recenter apertures?
(resize =                  yes) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                  yes) Trace apertures?
(fittrac=                  yes) Fit the traced points interactively?
(extract=                  yes) Extract spectra?
(extras =                   no) Extract sky, sigma, etc.?
(review =                  yes) Review extractions?

(line   =                INDEF) Dispersion line
(nsum   =                   20) Number of dispersion lines to sum or median

                                # DEFAULT APERTURE PARAMETERS

(lower  =                  -20) Lower aperture limit relative to center
(upper  =                   20) Upper aperture limit relative to center
(apidtab=                     ) Aperture ID table (optional)

                                # DEFAULT BACKGROUND PARAMETERS

(b_funct=            chebyshev) Background function
(b_order=                    1) Background function order
(b_sampl=          -10:-6,6:10) Background sample regions
(b_naver=                   -3) Background average or median
(b_niter=                    0) Background rejection iterations
(b_low_r=                   3.) Background lower rejection sigma
(b_high_=                   3.) Background upper rejection sigma
(b_grow =                   0.) Background rejection growing radius

                                # APERTURE CENTERING PARAMETERS

(width  =                  15.) Profile centering width
(radius =                  30.) Profile centering radius
(thresho=                   0.) Detection threshold for profile centering

                                # AUTOMATIC FINDING AND ORDERING PARAMETERS

nfind   =                   22  Number of apertures to be found automatically
(minsep =                  40.) Minimum separation between spectra
(maxsep =                1000.) Maximum separation between spectra
(order  =           increasing) Order of apertures

                                # RECENTERING PARAMETERS

(aprecen=                     ) Apertures for recentering calculation
(npeaks =                INDEF) Select brightest peaks
(shift  =                   no) Use average shift instead of recentering?

                                # RESIZING PARAMETERS

(llimit =                 -17.) Lower aperture limit relative to center
(ulimit =                  17.) Upper aperture limit relative to center
(ylevel =                 0.05) Fraction of peak or intensity for automatic width
(peak   =                  yes) Is ylevel a fraction of the peak?
(bkg    =                   no) Subtract background in automatic width?
(r_grow =                   0.) Grow limits by this factor
(avglimi=                  yes) Average limits over all apertures?

                                # TRACING PARAMETERS

(t_nsum =                   10) Number of dispersion lines to sum
(t_step =                    3) Tracing step
(t_nlost=                   10) Number of consecutive times profile is lost befor
(t_funct=             legendre) Trace fitting function
(t_order=                    3) Trace fitting function order
(t_sampl=                    *) Trace sample regions
(t_naver=                    1) Trace average or median
(t_niter=                    2) Trace rejection iterations
(t_low_r=                   3.) Trace lower rejection sigma
(t_high_=                   3.) Trace upper rejection sigma
(t_grow =                   0.) Trace rejection growing radius

                                # EXTRACTION PARAMETERS

(backgro=                 none) Background to subtract
(skybox =                    1) Box car smoothing length for sky
(weights=                 none) Extraction weights (none|variance)
(pfit   =                fit1d) Profile fitting type (fit1d|fit2d)
(clean  =                   no) Detect and replace bad pixels?
(saturat=                INDEF) Saturation level
(readnoi=                   0.) Read out noise sigma (photons)
(gain   =                   1.) Photon gain (photons/data number)
(lsigma =                   4.) Lower rejection threshold
(usigma =                   4.) Upper rejection threshold
(nsubaps=                    1) Number of subapertures per aperture
(mode   =                   ql)
[3] An one-dimensional spectrum, "apYb2x1R.ec.fits", is created now.
The aparture information of this file is saved in "database/apapYb2x1R" .
Order extraction in apall
▲Aperture finding in "apall"
Order fitting in apall
▲Order fitting in "apall"
[4] Put this Aperture reference frame (used in "apall") into the hdsql parameters,
   sc_refer   in  ##### Scattered Light Subtraction
and
   ap_refer   in  ##### Aperture Extraction
.


[Preparation 3]
Making a Nomilized Flat
Using above order trace template, make a normalized flat frame from raw flat frames.
Of course, you can skip this process, if you don't need flat-fielding in your quick look analysis.
Even for standard settings, standard flat frames are not saved in "/opt/share/hds" directory. So, if you want to do flat-fielding, this process is always required at least at once.


[Preparation 3] Making a Normalized Flat
Sorce Flat frames
Pretreatment by hdsql OverScan (at least) + Masing Bad Pixels + Linearity Correction
After hdsql Subtract scattered light by "apscatter" with an aperture reference (likely "ref=ApYb2x1R").
Normalize by "apflatten" also with an aperture reference ("ref=ApYb2x1R").
Parameters in hdsql Put the resultant flat frame into fl_refer in "### Flat Fielding".

[1] Overscan, Masking Bad Pixels and Linearity Correction each raw flat frames using "hdsql".
In the most case (except in the case of Near-IR), two sets of flat frames, whose maximum ADU optimized for red and blue CCD respectively, are taken. So, you should select raw flat frames only optimized for your analyzing color.
[2] Make a text list file of your resultant flat frames (HXXXXXoml.fits) with a text editor ("vi" or "mule" etc). Using "imcombine" task, make an averaged flat frame. (combine=average reject=avsigclip).
    ecl> imcombine @FlatYb2x1R.lst FlatYb2x1R combine=ave reject=avsigclip
[3] Using the task "apscatter" with the aperture reference (ref=ApYb2x1R), remove scattered light from the averaged flat frame.
    ecl> apscatter FlatYb2x1R FlatYb2x1R.sc referen=ApYb2x1R find- recent+ resize+ edit+ trac-
Aperture editing in scatter
▲Aperture edit in apscatter
   (resize and recenter referring the order template)
Fitting along dispersion in apscatter
▲Scatterd light fitting (along dispersion)
   (fitted by spline3 with order=20)
[4] Using the task "apflatten", make a normalized flat frame.
For "refren" field, input the filename of order trace template.
    ecl> apflatten FlatYb2x1R.sc FlatYb2x1R.sc.nm referen=ApYb2x1R find- recent+ resize+ edit+ trac-
The order of fitting function (the below right image) should be relatively high (10-20?). In xgterm window, type like ":order 11" to change the fitting order number. Then type "f"-key for re-fitting.
The process to exclude effect of bad column and/or chip edges is similar to the case of "apall".
The output file, "FlatYb2x1R.nm.fits", will be used as a flat frame in the following "hdsql".
PACKAGE = echelle
TASK = apflatten

input   =        FlatYb2x1R.sc  List of images to flatten
output  =     FlatYb2x1R.sc.nm  List of output flatten images
(apertur=                     ) Apertures
(referen=             ApYb2x1R) List of reference images

(interac=                  yes) Run task interactively?
(find   =                   no) Find apertures?
(recente=                   no) Recenter apertures?
(resize =                  yes) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                   no) Trace apertures?
(fittrac=                   no) Fit traced points interactively?
(flatten=                  yes) Flatten spectra?
(fitspec=                  yes) Fit normalization spectra interactively?

(line   =                INDEF) Dispersion line
(nsum   =                  100) Number of dispersion lines to sum or median
(thresho=                  10.) Threshold for flattening spectra

(pfit   =                fit1d) Profile fitting type (fit1d|fit2d)
(clean  =                   no) Detect and replace bad pixels?
(saturat=                INDEF) Saturation level
(readnoi=                   0.) Read out noise sigma (photons)
(gain   =                   1.) Photon gain (photons/data number)
(lsigma =                   4.) Lower rejection threshold
(usigma =                   4.) Upper rejection threshold

(functio=              spline3) Fitting function for normalization spectra
(order  =                    3) Fitting function order
(sample =                    *) Sample regions
(naverag=                    1) Average or median
(niterat=                    5) Number of rejection iterations
(low_rej=                   3.) Lower rejection sigma
(high_re=                   3.) High upper rejection sigma
(grow   =                   0.) Rejection growing radius
(mode   =                    q)
Order extraction in apflatten
▲Fitting in apflatten
   (fitted by spline3 with order=20)
[5] Put the resultant normalized flat frame into the hdsql parameter,
   "fl_refer"      in ##### Flat Fielding
.


[Preparation 4]
Wavelength Identification of a Th-Ar Frame
Using above order trace templates, making a wavelength information frame from a Th-Ar (comparison) frame.
If you don't need wavelength calibration in your quick look analysis, of course you can skip this process.
If you have an old identified Th-Ar frame, you can easily proceed the following process referring it in the task "ecreidentify". In such case, you should copy an database file of the old Th-Ar (cf. ecXXXXX) into database/ under your working directory.


[Preparation 4] Wavelength Identification of a Th-Ar Frame
Source Comparison (Th-Ar)
Pretreatment by hdsql OverScan + Masing Bad Pixels + Aperture Extraction
After hdsql [a] In a case w/o reference
identify Th-Ar lines by "ecidentify".

[b] If you have an old identifed Th-Ar frame,
refer the old frame by "ecreidentify" with "referen=ThArXXXX". Then, "ecidentify".
Parameter in hdsql Put the identifed Th-Ar frame into wv_refer in "### Wavelength Calibration".

[1] Using "hdsql" for a raw frame of Th-Ar, proceed "OverScan", "Masking Bad Pixels" and "Aperture Extraction" at this time.
For the aperture refrence ("ap_refer"), input the order template frame which already made in the previous preparation process.
And don't resize, recenter and edit apreture in "apall". In order to save the file after "apall" set the parameter, "ap_save=yes".
PACKAGE = echelle
   TASK = hdsql
    
inid    =                22073  Input frame ID
(indirec= /data/o05129/HDSA000) directory of Input data

(oversca=                  yes) Overscan?
(biassub=                   no) BIAS / Dark Subtraction?
(maskbad=                  yes) Mask Bad Pixels?
(linear =                   no) Linearity Correction?
(cosmicr=                   no) Cosmicray-event rejection?
(scatter=                   no) Scattered light subtraction?
(flat   =                   no) Flat fielding?
(apall  =                  yes) Extract spectra with apall?
(remask =                   no) Re-Mask wavlength calibrated spectrum?
(wavecal=                   no) Wavelength calibration?
(rvcorre=                   no) Heliocentric wavelength correction?
(splot  =                   no) Splot Spectrum?
   (......)
(ap_save=                  yes) Save apalled data?
(ap_in  =                     ) Input frame for apall (if necessary)?
(ap_refe=             ApYb2x1R) Reference frame for apall
(ap_inte=                  yes) Run apall interactively?
(ap_rece=                   no) Recenter apertures?
(ap_resi=                   no) Resize apertures?
(ap_edit=                   no) Edit apertures?
(ap_trac=                   no) Trace apertures?
(ap_fitt=                   no) Fit the traced points interactively?
(ap_llim=                  -30) Lower aperture limit relative to center
(ap_ulim=                   30) Upper aperture limit relative to center
(ap_ylev=                 0.05) Fraction of peak for automatic width determinati
(ap_peak=                  yes) Is ylevel a fraction of the peak?
(ap_bg  =                 none) Background to subtract
     (......)
[2] An one-dimensional spectra, "H22073om_ec.fits" (or H22073o_ec.fits, if you skipped masking), is created.
Rename this file, for example "ThArYb2x1R.ec.fits".
[3a] Without old references
Do "ecidentify" to the renamed one-dimensinal file.
In usual case, you should identify 5 or 6 points per order. . After finished inputs along all orders(you can skip 2-3 orders), "f"-key makes a wavelength fitting. Then, in xgterm window, change x & y order numbers with ":xorder 5", ":yorder 4" (In usual case, x=5 and y=4 are enough for orders of this fitting.). Delete out-stand points with "d"-key and re-fit with "f"-key. If the fitting error becomes small enough (<0.005Å, It could be changed by the resolution of the spectrograph), hit "l"-key to register all lines in the list. Then, adjust the fitting error again in the same way. If it becomes small enough, quit with "q"-key.
If you identify an UV data (< 330nm), the original thar.dat in IRAF should be not enough for identification. You must download a new one from this page, and replace it.
PACKAGE = echelle
  TASK = ecidentify

images  =           ThArYb2x1R  Images containing features to be identified
(databas=             database) Database in which to record feature data
(coordli=   linelists$thar.dat) User coordinate list
(units  =                     ) Coordinate units
(match  =                   1.) Coordinate list matching limit in user units
(maxfeat=                 1000) Maximum number of features for automatic identifi
(zwidth =                  10.) Zoom graph width in user units
(ftype  =             emission) Feature type
(fwidth =                   4.) Feature width in pixels
(cradius=                   5.) Centering radius in pixels
(thresho=                  10.) Feature threshold for centering
(minsep =                   2.) Minimum pixel separation
(functio=            chebyshev) Coordinate function
(xorder =                    2) Order of coordinate function along dispersion
(yorder =                    2) Order of coordinate function across dispersion
(niterat=                    0) Rejection iterations
(lowreje=                   3.) Lower rejection sigma
(highrej=                   3.) Upper rejection sigma
(autowri=                   no) Automatically write to database?
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input
(mode   =                    q)
Identification of Th-Ar lines
▲Th-Ar line identification in "ecidentify"
   (about 6 lines in each order)
Residual of fitting in ecidentify
▲Fitting errors in "ecidentify"
   (xorder=2, yorder=2 for the first fit)
Identification of Th-Ar lines
▲Fitting errors in "ecidentify"
   (xorder=4, yorder=4 : 0.6 arcsec slit width, 2x1bin)
Residual of fitting in ecidentify
▲Fitting errors in "ecidentify"
   (final result by xorder=5, yorder=4)
[3b] Referring an old identifed Th-Ar frame
Copy the old Th-Ar file (ThArYb2x1R_old.fits) and its database file (database/ecThArYb2x1R_old) into your working directory. Refer it by a task "ecreidentify".
    ecl> ecreidentify ThArYb2x1R referen=ThArYb2x1R_old
If the resultant RMS error is relatively high (> 0.01), there might be a disagreement between the new and the old frames.
After "ecreidentify", run "ecidentify" for the new Th-Ar frame to confirm the fitting errors.
[4] Put the identifed Th-Ar frame into the hdsql parameter,
   "wv_refer"    in ##### Wavelength Calibration
.


hdsql : Quick Look of Object Frames
After above "preparations"(1 is recommended, 2 is indispensable, 3 & 4 can be skipped) have been finished, you can start the quick look for each object with the task "hdsql".
You can choose processes (wavelength calib., flat-fielding, cosmic ray rejection and scattered light subtraction etc) you want in hdsql. If you want to skip it, you should input "no" in each parameter in "hdsql".


[1] Inside of "hdsql", there are 12 steps, from (1)OverScan to (12)Plot.
At least, (1)OverScan & (8)Aperture Extraction are necessary to get one dimensional spectra for your quick look. The following parameter list is showing the setting to get full reduction of "hdsql". If you want to skip some steps in "hdsql", just set "no" for corresponded parameters ("overscan", "maskbad", "linearity" ... etc.).
The inside of each step is described hereafter.
[1/12] OverScan (suffix="o")
This task calculate the average ADU in overscan regions in each frame and then subtract this value from the entire image. Therefore, this process is very similar to BIAS subtraction.
At the same time, it change counts in the frame from ADU to electron numbers, multiplying conversion factors (≈1.7).
All raw frames must not skip this step.
[2/12] Bias/Dark Subtraction (suffix="b")
BIAS or Dark or both of them will be subtracted from the object frame in this step.
Actually, there is another step to mask bad pixels after this. So, it is not important to subtract BIAS from your targets' frames.
The dark counts will be scaled automatically referring the exposure times of dark and target frames.
[2/12] Parameters for BIAS/Dark Subtraction
bs_refer BIAS frame
bs_dark Dark+BIAS frame
bs_style Which type of subtraction you want? [bias(=default)|dark|both]

[3/12] Masking Bad Pixels (suffix="m")
Bad pixels in the target frame are masked in this step.
[3/12] Parameters for Masking Bad Pixels
mb_refer Mask frame
mb_auto Automatic creation of a new mask from BIAS "bs_refer"? (default=no)
mb_lower Lower limit count for mb_auto mask creation (default=-100)
mb_upper Upper limit count for mb_auto mask creation (default=300)

[4/12] Linearity Correction (suffix="l")
Significant non-linearity is found in HDS EEV-42-80 CCDs for higher electron numbers (over 10,000e-). The task "hdslinear" has been prepared to correct this non-linearity.
[5/12] Cosmic-Ray Rejection (suffix="c")
This step is using the task "wacosm11".
This task applies median filter to the object frame at first, fixes out-stand pixels, then, replace counts of these pixels with extrapolated values. The important parameter of this task is the baseline count "cr_base". This should be similar to the peak count of the object frame. (Smaller value is better to find cosmic ray hits. But it is afraid that smaller value can lead misunderstanding real count as cosmic ray hits.)
For further explanation, you should refer the IRAF reduction manual of HDS.
[6/12] Scattered Light Subtraction (suffix="s")
This step uses the task "apscatter". It does a curved surface fitting along gaps between each orders, and subtruct the fitted result from the frame.
[6/12] Parameters for Scattered Light Subtraction
sc_refer Aperture reference frame (same as ap_refer in "Aperture Extraction")
sc_inte Run apscatter interactively or not? (default=yes)
sc_rece Recentering of apertures? (default=yes)
sc_resi Resizing of apertures? (default=yes)
sc_edit Edit apertures? (default=yes)
sc_trac Re-tracing each aperture? (default=no)
sc_fitt Trace apertures manually? (default=no)

Scattered Light fitting along X
▲Fitting along the cross dispersion in apscatter
   (Check the fitting curve is lying on the bottom of order gaps.)

Scattered Light fitting along Y
▲Fitting along the echelle dispersion in apscatter
   (fitted by spline3 with order=20)

[7/12] Flat Fielding (suffix="f")
The target frame will be devided by the (normalized) flat.
[7/12] Parameters for Flat Fielding
fl_refer (normalized) Flat frame

[8/12] Aperture Extraction (suffix="_ec")
The apertures in the target frame will be traced to create one-dimentional spectrum.
[8/12] Parameters for Aperture Extraction
ap_refer Aperture reference frame (same as "sc_refer" in "Scattered Light Subtraction")
ap_inte Run Aperture Extraction interactively? (default=yes)
ap_rece Recentering apertures? (default=yes)
ap_resi Resising apertures? (default=yes)
ap_edit Edit apertures? (default=yes)
ap_trac Re-tracing apertures? (default=no)
ap_fitt Trace apertures manually? (default=no)
ap_llim Lower limit pixel of apertures (default=-30)
ap_ulim Upper limit pixel of apertures (default=30)
ap_bg How to fit sky background? [none(=default)|average|median|minimum|fit]

Aperture Edit in apall
▲Editting apertures in apall
   ("."-key to select nearest order, "a"-keyto select all order.
   ": lower ??",": upper ??" to set the size of aperture.)


Confirmation of 1-order in apall
▲Detailed confirmation of the selected order
   ("b"-key to enter this mode, "s" & "t"-key to edit the BG area.
   "c"-key to check the pixel position on the cursor.)


[9/12] Wavelength Calibration (suffix="w")
Wavelength calibration referring the identified Th-Ar frame.
[9/12] Parameters for Wavelength Calibration
wv_refer Identified Th-Ar frame
wv_log Log scaled wavelength? (default=no)

[10/12] Re-Mask after Wavelength Calibration (suffix="z")
This step creates a wavelength calibrated mask from "mb_refer". Then, it will be applied to the target spectrum.
[10/12] Parameters for Re-Mask after Wavelength Calibration
zm_val Cout for masked pixels (default=1)
It is better to set to "1" (instead of "0"), if you want to edit (interpolation between selected orders) the blaze function of the target spectrum.
zm_thre Threshold count for making a new mask (default=0.1 [0-1])

Before Re-Mask
▲Target spectrum before Re-Mask
   (There are some pixels damaged by bad Column.)


After Re-Mask
▲Target spectrum after Re-Mask
   (Counts of masked pixles are set to 1.0e- .
    This should be much lower than other healthy pixels.)


[11/12] Heliocentric RV Correction (suffix="r")
Wavelength in the target frame will be corrected to the heliocentric by this step, using the task "rvhds" (original).
[11/12] Parameters for Heliocentric RV Correction
rv_obs Observatory's name to be set by the task "observatory" (default="subaru")

[12/12] Plot
This step will just show the resultant spectrum by splot.
[12/12] Parameters for Plot
sp_line Order to plot (default=1)



Here is an example of all parameters of hdsql.
You should set Mask (Mask2x1R), Aperture reference (ApYb2x1R), Flat (FlatYb2x1R.sc.nm) and Identified Th-Ar (ThArYb2x1R) to proceed a full-reduction of target frames using hdsql.
PACKAGE = echelle
   TASK = hdsql
    
inid    =                22081  Input frame ID
(indirec= /data/o05129/HDSA000) directory of Input data

(oversca=                  yes) Overscan?
(biassub=                   no) BIAS / Dark Subtraction?
(maskbad=                  yes) Mask Bad Pixels?
(linear =                   no) Linearity Correction?
(cosmicr=                   no) Cosmicray-event rejection?
(scatter=                   no) Scattered light subtraction?
(flat   =                   no) Flat fielding?
(apall  =                  yes) Extract spectra with apall?
(remask =                   no) Re-Mask wavlength calibrated spectrum?
(wavecal=                   no) Wavelength calibration?
(rvcorre=                   no) Heliocentric wavelength correction?
(splot  =                   no) Splot Spectrum?

                                ### Overscan ###
(os_save=                  yes) Save overscaned data?

                                ### Bias/Dark Subtraction ###
(bs_save=                  yes) Save BIAS / Dark subtracted data?
(bs_in  =                     ) Input frame for BIAS / Dark subtraction (if nece
(bs_styl=                 bias) Subtraction style (bias|dark)
(bs_refe=                     ) BIAS frame
(bs_dark=                     ) Dark + BIAS frame

                                ### Masking Bad Pixels ###
(mb_save=                  yes) Save masked data?
(mb_refe=             Mask2x1R) Bad Pix Mask frame
(mb_auto=                   no) Auto mask creation from BIAS(bsrefer)?
(mb_uppe=                  300) Upper limit for mb_auto
(mb_lowe=                 -100) Lower limit for mb_auto
(mb_clea=                  yes) Cleaning by wacosm11?
(mb_base=                    1) Baseline for wacosm11

                                ### Linearity Correction ###
(ln_save=                  yes) Save Linearity Corrected data?
(ln_in  =                     ) Input frame for Linearity Correction (if necessa

                                ### Cosmic-ray Rejection ###
(cr_save=                  yes) Save cosmicray processed data?
(cr_in  =                     ) Input frame for wacosm1 (if necessary)
(cr_base=                 2000) Baseline for wacosm1

                                ### Scattered-light Subtraction ###
(sc_save=                  yes) Save scattered light subtracted data?
(sc_in  =                     ) Input frame for scattered light subtraction (if 
(sc_refe=             ApYb2x1R) Reference for aperture finding
(sc_inte=                  yes) Run apscatter interactively?
(sc_rece=                  yes) Recenter apertures for apscatter?
(sc_resi=                  yes) Resize apertures for apscatter?
(sc_edit=                  yes) Edit apertures for apscatter?
(sc_trac=                   no) Trace apertures for apscatter?
(sc_fitt=                   no) Fit the traced points interactively for apscatte

                                ### Flat Fielding ###
(fl_save=                  yes) Save flat-fielded data?
(fl_in  =                     ) Input frame for flat fielding (if necessary)
(fl_refe=     FlatYb2x1R.sc.nm) Flat frame

                                ### Aperture Extraction ###
(ap_save=                  yes) Save apalled data?
(ap_in  =                     ) Input frame for apall (if necessary)?
(ap_refe=             ApYb2x1R) Reference frame for apall
(ap_inte=                  yes) Run apall interactively?
(ap_rece=                  yes) Recenter apertures?
(ap_resi=                  yes) Resize apertures?
(ap_edit=                  yes) Edit apertures?
(ap_trac=                   no) Trace apertures?
(ap_fitt=                   no) Fit the traced points interactively?
(ap_llim=                  -30) Lower aperture limit relative to center
(ap_ulim=                   30) Upper aperture limit relative to center
(ap_ylev=                 0.05) Fraction of peak for automatic width determinati
(ap_peak=                  yes) Is ylevel a fraction of the peak?
(ap_bg  =                 none) Background to subtract

                                ### Wavelength Calibration ###
(wv_save=                  yes) Save wavelength-calibrated data?
(wv_in  =                     ) Input frame for wavelength calibration (if neces
(wv_refe=           ThArYb2x1R) Reference frame for refspectra
(wv_log =                   no) Logarithmic wavelength scale?

                                ### Re-Mask after Wavelength Calibration###
(zm_save=                  yes) Save re-masked data?
(zm_val =                   1.) Pixel Value replaced to All Bad Pixels
(zm_thre=                  0.1) Threshold pixel value for bad column [0-1]

                                ### Heliocentric Wavelength Correction ###
(rv_save=                  yes) Save heliocentric wavelength corrected data?
(rv_in  =                     ) Input frame for radial velocity correction (if n
(rv_obs =               subaru) Observatory

                                ### Splot ###
(sp_line=                    1) Splot image line/aperture to plot

(mode   =                    q)
[2] If the task works well, you can get a final resultant spectrum file, like "H22081omlcsf_ecwzr.fits".
Added "omlcsf_ecwzr" in the filename means "o"=overscan, "m"=masked bad pixels, "l"=linearity corrected, "c"=cosmicray rejected, "s"=scatterd light subtracted, "f"=flat fielded, "_ec"=aparture extracted, "w"=wavelength caliblated, "z"=zero masked after wavelength calibrated and "r"=radial velocity corrected. If you want to keep files after each step, please set parameters *_save to "yes" in each step (cf. os_save=yes).
Completion of hdsql
▲Example of resultant spectrum
   (the order around NaD)



Tips, trouble shooting
[1] HDS creates two frames from Red and blue CCD with one exposures. So, you have to create two calibration file sets in your preparation phase for both color reduction. If you want to reduce your data simultaneously (Maybe you want to do it during your observation.), you can use tasks "hdsql1", "hdsql2" and "hdsql3" in ANA, which has just same function of "hdsql". So, in ANA, you can use "hdsql" for Red CCD reduction and "hdsql1" for Blue CCD's for example.
[2] You can stop you reduction at any voluntary points. If you want to restart you reduction process, please input "XX_in" for your restarting inputs.
[3] This task confirm overwrite each resultant frames, if necessary. So, before you redo the same process for the same file, it is better to rename or delete existing resultant files to avoid annoying situation.
[4] If the task stopped for some reasons with some errors, some temporary files with "tmp*" filename could be remained in your working directory. You shoould delete such file before your next reduction.


Download of CL scripts
After downloaded above cl script files and added following configuration in your "login.cl", you can use "hdsql" also in your environment.
"/home/hds01/share/cl/" (setting in ANA) should be replaced with the directory in which you put these scripts.

I recommend to copy hdsql.cl to hdsql[1,2,3].cl . These same tasks might be good to use in the data nalaysis for the other CCD chip or wavelength settings.


set stdimage = imt4096

set hdshome = "/home/hds01/share/cl/"

task overscan  = "hdshome$overscan.cl"
task hdsql     = "hdshome$hdsql.cl"
task hdsql1    = "hdshome$hdsql1.cl"
task hdsql2    = "hdshome$hdsql2.cl"
task hdsql3    = "hdshome$hdsql3.cl"
task wacosm11  = "hdshome$wacosm11.cl"
task hdslinear = "hdshome$hdslinear.cl"
task mkbadmask = "hdshome$mkbadmask.cl"
task rvhds     = "hdshome$rvhds.cl"
task hdsbadfix = "hdshome$hdsbadfix.cl"

imred
echelle
rv


The task "rvhds" requires the information about the position of the observatory. "Subaru Telescope" is not included in IRAF's original observatory.dat .

observatory = "subaru"
        name = "SUBARU Telescope, NAOJ"
        longitude = -155.4706
        latitude = 19.8255
        altitude = 4163
        timzone = -10


So, you should add above information into your noaolib$obsdb.dat, or save it to a new file and set it in your login.cl .
     set    obsdb          = "/home/hds01/share/cl/obsdb.dat"
You can check your observatory information in your IRAF environment as follows.


ecl> observatory
Command (set|list|images) (set|list|images) (list): 
Observatory to set, list, or image default (subaru): 
# Observatory parameters for SUBARU Telescope, NAOJ
       observatory = subaru
       timzone = -10
       altitude = 4163
       latitude = 19.8255
       longitude = -155.4706
       name = 'SUBARU Telescope, NAOJ'




     
[Old version]




Appendix. Making a combined spectrum merging all orders

It can be said that the above quick look analysis by hdsql includes all required processes for primay data analysis of Echelle spectra.
Hereafter, I suppose some of us want to try to create combined spectra from resultant multi-odered spectra created by hdsql.
In this process, the "blaze function" of echelle orders must be corrected. Roughly, there are two ways to do this correction.
     [A]  Continuuum Fitting of target spectrum
     [B]  Flux calibration using standard stars

[A] by continuuum fitting of target spectrum
If your target is a "normal" star without any broad absorption or emission, in which the continuuum level can be determined easily, it is good to correct its echelle blaze by the continuuum fitting of the target spectrum.

[1] Fit the continuuum of the target spectrum, using the task "continuum".
   ecl> continuum H75611omlcsf_ecwzr H75611omlcsf_ecwzr_c
Continuum fitting
▲Continuum Fiting by "continuum"
   (Fitting order is about 6-15.)

Spectrum normalized by continuum level
▲Continuum Fitted spectrum
   (normalized as continuuum level=1)

If you combined this resultant spectrum (H75611omlcsf_ecwzr_c) directly by the task "scombine" (combine=ave group=images), you ca get a "rough" combined spectrum. But, its S/N ratio in this spectrum might be "partly" not good, in this case. Because counts form the edge of each order are not weighed but added with adjascent "overlapped" area.
In order to avoid this degeneration, it is better to create a "blaze function" of the spectrum.
[2] Deviding the source by the fitted spectrum, you can get easily the "Blaze Function" (CBlaze).
   ecl> sarith H75611omlcsf_ecwzr / H75611omlcsf_ecwzr_c CBlaze
(Here, CBlaze includes information about the "shape" of target's continuum. So, it is not a pure Echelle blaze function. But, for convinience, I describe it just a "blaze function".)
[3] If possible, it is better to modify CBlaze to correct affect from broad target's absorption or atmospheric absorption by interpolating from adjacent echelle orders.

If you set "zm_val=0" in hdsql, the masked area of CBlaze is also set to 0. This might be not good to do such interpolation.
Blaze function from Continuum Fit
▲Overplotting all orders of CBlaze
Modified Blaze function from Continuum Fit
▲Overplotting all orders of modified CBlaze
(It is not important to correct the function at the edge of CCD.
But, it is better to correct it around H alpha or other broad absorptions showing peculiar features compared with adjacent echelle orders.)


[4] If the target has been re-masked after wavelength calibration in hdsql (and "zm_val!=0"), the mask should be re-applied to the source (before continuum fitted) target frame.
hdsql automatically creates a Mask file (cf. Mask_HXXXXXomlcsf_ecw.fits) for each target spectrum and keep its file name into the image header (H_MASK).
The original task "hdsbadfix" can easily do this masking process.
     ecl> hdsbadfix H75611omlcsf_ecwzr H75611omlcsf_ecwzr_b mask+ manual+ cl_mask+ value=0
With the option manual=yes, "hdsbadfix" can easily fix the bad counts around the edge (2 orders from both edges) of CCD. At this time, if you set cl_mask=yes in your option, the mask is also modified automatically to add these edge of CCD in it.
[5] In the same way, you should apply the mask to CBlaze.
If the masked area has a "healthy" overlapped wavelength area in adjacent echelle order, you can pick up the data only from the "healthy" area (Of course, the S/N ratio in such region could be getting lower.).
Because CBlaze has been created from the target spectrum, it contains the same H_MASK in its header.
     ecl> hdsbadfix CBlaze CBlaze_b mask+ manual- cl_mask- value=0
You should set value=0 to set counts to "0" in the masked area.
[6] Using the task "scombine", sum all orders of the target and CBlaze_b (w/ combine=sum group=images). Then devide the summed target by the summed CBlaze_b_sum. This process can avoid the degeneration of the S/N ratio around overlapped area, and get the smooth connection.
     ecl> socmbine H75611omlcsf_ecwzr_b H75611omlcsf_ecwzr_b_sum combine=sum gorup=images
     ecl> socmbine CBlaze_b CBlaze_b_sum combine=sum gorup=images
     ecl> sarith H75611omlcsf_ecwzr_b_sum / CBlaze_b_sum H75611_Cfit
     
scombined CBlaze
▲Summed CBlaze_b
scombined object
▲Summed targets spectrum
Object Soectrum normalized by Continuum fit
▲The final resultant target spectrum by continuum fit

devided by non-Masked CBlaze
▲Devided by "non-masked" CBlaze_sum
(affected by bad column)



devided by Masked CBlaze
▲Devided by masked CBlaze_b_sum
(Spectrum has been connected smoothly using the counts
  only from healthy order.)



[B] by flux calibration using a standard star
If the target spectrum has broad emission/absorption features to make it diffcult to determin its continuum level, you should do the flux calibration using a standard star taken in a very close area of the sky. Of course, this method can conserve the flux information of the target.
In HDS, the blaze function of the echelle orders might be relatively unstable and changing by the telescope positions and/or focus offsets. So, instead of spectrophotometric standards (very rare), you should take some "normal stars" as standards during your observation.
  • close to your target position (& observing time)
  • Early type star (<A-type stars); and of course, its Sp-type & magnitude should be well-known.
  • (Especially for UV obs, in which Balmer limit is included) Stars w/lower rotation velocity
    (For >400nm, this is not so important. Furthermore, the rapid rotator must be good to see the earth's atmospheric absotptions. So, it is not simple to say which is better for your standards.)


[1] Measure the flux of the standard using the task "standard".
PACKAGE = echelle
   TASK = standard

input   = H75611omlcsf_ecwzr_tb  Input image file root name
output  =       HD153855R_0724  Output flux file (used by SENSFUNC)
(samesta=                  yes) Same star in all apertures?
(beam_sw=                   no) Beam switch spectra?
(apertur=                     ) Aperture selection list
(bandwid=                   1.) Bandpass widths
(bandsep=                   1.) Bandpass separation
(fnuzero=  3.6800000000000E-20) Absolute flux zero point
(extinct= hdshome$mkoextinct.dat) Extinction file
(caldir =  onedstds$blackbody/) Directory containing calibration data
(observa=       )_.observatory) Observatory for data
(interac=                  yes) Graphic interaction to define new bandpasses
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input
star_nam=                    v  Star name in calibration list
airmass =                 1.62  Airmass
exptime =                  30.  Exposure time (seconds)
mag     =                 6.97  Magnitude of star
magband =                    V  Magnitude type
teff    =                B1III  Effective temperature or spectral type
answer  =                 YES!  (no|yes|NO|YES|NO!|YES!)
(mode   =                    q)
▲The case of a normal star with well-known spectral type and magnitude (fitting to a blackbody).

     (......)
(caldir =  onedstds$spec50cal/) Directory containing calibration data
     (......)
star_nam=             bd284211  Star name in calibration list
airmass =                 1.62  Airmass
exptime =                  30.  Exposure time (seconds)
     (......)
▲The case of a spectrophotometric standards whose spectroscopic data has been stocked in IRAF

In "standard" task, the values for "airmass" and "exptime" automatically imported from image headers. So, if they are incorrect, you should edit them.
"teff" for the blackbody fitting can be represented not only by temperatures but also by spectral types as shown in above example.
[2] Create a sensitivity curve using the task "sensfunc".
PACKAGE = echelle
   TASK = sensfunc

standard=       HD153855R_0724  Input standard star data file (from STANDARD)
sensitiv=       HD153855R_0724  Output root sensitivity function imagename
(apertur=                     ) Aperture selection list
(ignorea=                   no) Ignore apertures and make one sensitivity functi
(logfile=              logfile) Output log for statistics information
(extinct=        )_.extinction) Extinction file
(newexti= hdshome$mkoextinct.dat) Output revised extinction file
(observa=       )_.observatory) Observatory of data
(functio=              spline3) Fitting function
(order  =                   10) Order of fit
(interac=                  yes) Determine sensitivity function interactively?
(graphs =                   sr) Graphs per frame
(marks  =       plus cross box) Data mark types (marks deleted added)
(colors =              2 1 3 4) Colors (lines marks deleted added)
(cursor =                     ) Graphics cursor input
(device =             stdgraph) Graphics output device
answer  =                  YES  (no|yes|NO|YES)
(mode   =                    q)
task standard
▲Flux calibration of a standard by "standard"
(You can choose more wider band for calibration [~4A])

task sensfunc
▲Determination of a sensitivity curve in "sensfunc"
(fitted by spiline with order=10.)

[3] Prepare the target spectrum by "hdsql" (co-add, if necessary). Then, run the task "calibrate" to do the flux calibration for it.
PACKAGE = echelle
   TASK = calibrate

input   = V1312Sco_R_omlcsf_ecwzr_t  Input spectra to calibrate
output  = V1312Sco_R_omlcsf_ecwzr_tf  Output calibrated spectra
(extinct=                  yes) Apply extinction correction?
(flux   =                  yes) Apply flux calibration?
(extinct= hdshome$mkoextinct.dat) Extinction file
(observa=       )_.observatory) Observatory of observation
(ignorea=                   no) Ignore aperture numbers in flux calibration?
(sensiti=       HD153855R_0724) Image root name for sensitivity spectra
(fnu    =                   no) Create spectra having units of FNU?
airmass =                 1.99  Airmass
exptime =                1500.  Exposure time (seconds)
(mode   =                    q)
[4] After this, the process should be almost same with the case of continuum fitting.
Devinding the source target by the flux calibrated target spectrum, you can get the "Blaze Function" (FBlaze) for the target.
   ecl> sarith V1312Sco_R_omlcsf_ecwzr_t / V1312Sco_R_omlcsf_ecwzr_tf FBlaze
(This FBlaze is not an exact same blaze function with CBlaze. But, for convinience, I describe it just a "blaze function".)
[5] If possible, it is better to modify FBlaze to correct affect from broad target's absorption or atmospheric absorption by interpolating from adjacent echelle orders.

If you set "zm_val=0" in hdsql, the masked area of FBlaze is also set to 0. This might be not good to do such interpolation.
Blaze function from Flux calib
▲Overplotting all orders of FBlaze
Modified Blaze function from Flux calib
▲Overplotting all orders of modified FBlaze (masked)


[6] If the target has been re-masked after wavelength calibration in hdsql (and "zm_val!=0"), the mask should be re-applied to the source (before flux calibrated) target frame. The original task "hdsbadfix" can easily do this masking process.
     ecl> hdsbadfix V1312Sco_R_omlcsf_ecwzr_t V1312Sco_R_omlcsf_ecwzr_tb mask+ manual+ cl_mask+ value=0
You should set value=0 to set counts to "0" in the masked area.
With the option manual=yes, "hdsbadfix" can easily fix the bad counts around the edge (2 orders from both edges) of CCD. At this time, if you set cl_mask=yes in your option, the mask is also modified automatically to add these edge of CCD in it.
[7] In the same way, you should apply the mask to FBlaze.
     ecl> hdsbadfix FBlaze FBlaze_b mask+ manual- cl_mask- value=0
You should also set value=0 to set counts to "0" in the masked area.
[8] Using the task "scombine", sum all orders of the target and FBlaze_b (w/ combine=sum group=images). Then devide the summed target by the summed FBlaze_b_sum. This process can avoid the degeneration of the S/N ratio around overlapped area, and get the smooth connection.
     ecl> socmbine V1312Sco_R_omlcsf_ecwzr_tb V1312Sco_R_omlcsf_ecwzr_tb_sum combine=sum gorup=images
     ecl> socmbine FBlaze_b FBlaze_b_sum combine=sum gorup=images
     ecl> sarith V1312Sco_R_omlcsf_ecwzr_tb_sum / FBlaze_b_sum V1312Sco_R_Fcalib
When you want to connect spectra of Red and Blue CCD chips, you can use "scombine" with "group=all" option.
     ecl> socmbine V1312Sco_R_Fcalib,V1312Sco_B_Fcalib V1312Sco_All_Fcalib combine=sum gorup=all
     
Blaze function from Flux calib
▲Flux calibrated & combined taget spectrum
Modified Blaze function from Flux calib
▲A part of resultant spectrum
(Broad emission lines lying along several echelle orders can be connected smoothly by this method.)




Akito Tajitsu
Last modified: Fri Dec 23 20:23:55 HST 2011


Copyright © 2000-2003 Subaru Telescope, NAOJ. All rights reserved.