"SPTCLASS: SPecTral CLASSificator code"

    Hernandez Jesus (1, 2)


Collaborators:
    Cesar Briceño  (1)
    Nuria Calvet (2)
    Lee Hartmann (2)
    Perry Berlind (3)
    Kevin Luhman (4)

(1)    
Centro de Investigaciones de Astronomía, Apdo. Postal 264, Mérida 5101-A, Venezuela.
(2)     University of Michigan, Ann Arbor, MI 48109.
(3)   Smithsonian Astrophysical Observatory, Fred Lawrence Whipple Observatory, 670 Mount Hopkins Road, P.O. Box 97, Amado, AZ 85645.
(4)   Department of Astronomy and Astrophysics, The Pennsylvania State University, University Park, PA 16802

NOTE: this webpage in under costruction!!!!!!!

ABSTRACT

This document explains the installing and running process of the code SPTCLASS, which was designed for assigning semi-automatic spectral types to a sample of stars. The main code includes three spectral classification schemes: the first one is optimized to classify stars in the mass range of TTS (K5 or later; hereafter LATE-type scheme), the second one is optimized to classify stars in the mass range of IMTTS (F late to K early; hereafter Gtype scheme), and the third one is optimized to classify stars in the mass range of HAeBe (F5 or earlier; hereafter HAeBe scheme). The code generates a postscript file which shows the individual results from different spectral indices, and a closer view around the lines Halpha  and Li I (6707Å). The code has an interactive module where you can select the best result from the three schemes and you can easily analyze the input spectra. This code has been applied to spectra from different spectrographs such as, FAST (FLWO), HYDRA (KPNO) and HECTOSPEC (MMT).

1 - HISTORY:

This code was originally developed to classify young intermediate mass stars (from B late to F late)  to study properties of a sample of Herbig AeBe stars (Hernandez et al 2004) .  The code was extended to classify solar type stars (from F middle to K early)  and low mass stars  (from K early to M5)  at the Centro de Investigaciones de Astronomía (CIDA, Venezuela) and the Harvard Smithsonian Center for Astrophysics (US). Results from this extended code was published in Briceno et al (2005), Sicilia-Aguilar et al (2005) and Hernandez et al (2005).  In my PHD thesis (Hernandez 2005) ,  the code is described in more detail showing the calibration of the three parts of the code: (1) HAeBe class with 44 spectral features optimized to classify BAF stars,  (2)  Gtype class with 11 spectral features optimized to classify FGK stars and (3) Late class with 10 spectral features optimized to classify stars  from K5 to M5. The code was modified at CIDA and at the Astronomy department of the University of Michigan adding a more friendly interface that allows us to geive a quick inspection of the spectra and the some important features related to accretion (Halpha, infrared CaII triplet) and youth (LiI, Na I, Halpha). Finally, the Late class part of the code was extended to classify substellar objects from K5 to L0 including the calibration of six additional spectral features.
 

2.- INTALLING AND RUNNING SPTCLASS

2.1.- To install SPTCLASS follow these steps:

a. The code needs the programs IRAF and IDL (full license or demo version; V>=6.0). It is also necessary to install the IDL Astronomy User's Library

b. Download the code SPTCLASS.tar.gz (contact the author for authorization or update).

c. Decompress the code in a selected directory (e.g. /home/jesush/). This will generate the following directory and subdirectories.
SPTCLASS/; base directory
SPTCLASS/LATE_CLASS; directory for the Late-type scheme
SPTCLASS/GTYPE_CLASS; directory for the Gtype scheme
SPTCLASS/HAEBE_CLASS; directory for the HAeBe scheme
STPCLASS/SpTbin; executable files
STPCLASS/SpTpro; idl program files
SPEC_EXAM: sample of spectra

- Important files in SPTCLASS directory: SPTCLASS.csh (main program); graf_todo.idl and indice_err.idl (idl scripts); codespt.source (define the environments variables); README.lyx and README.ps (a little help)
- Important files in SPTCLASS/SpTpro/ (idl programs): BDclass3.pro, ew_calc.pro, graf_todo.pro, minchi2.pro, final.pro, indice_err.pro, multi_dialog.pro, graf_inter.pro, interac3.pro, clasif7.pro, rspfast.pro, clasifica7.pro, interpolE.pro, rsphydra.pro, ew_calc2.pro, jchisq.pro, WMean3.pro, minchi1.pro, wmean.pro
- Important files in SPTCLASS/SpTbin/ (executables files): BDclass.csh, editar5.csh, GET_SPT_Gtype.csh, indice_err.csh, Gtype.csh, LATE6.csh, Clasifica7.csh, edit_ind.csh, GETSPTLATE.csh, grafica.csh, INDICE.csh, NUM2SPT.csh, SP_OUTPUT.csh, grafica_int.csh.
- Important files in SPTCLASS/LATE_CLASS/ (Late type scheme): Ind_*.dat (calibration files,16 indices), BDclass3.idl and indice_err.idl (idl scripts).
- Important files in SPTCLASS/GTYPE_CLASS/ (Gtype scheme): calibra7.dat (calibration file), Clasifica7.idl, indice_err.idl (idl scripts).
- Important files in SPTCLASS/HAEBE_CLASS/ (HAeBe): final.pro grafica2c.pro Spcalculator3.pro WMean.pro grafica2b.pro Spcalculator2.pro WMean3.pro (idl programs); grafica2C.idl Spcalculator2.idl Spcalculator3.idl (IDL scripts); defban.csh editar5.csh graficaC.csh Spclass2.csh editar3b.csh generadordef.csh Spcalculator.csh  (C-shell scripts); criterios.dat (calibration file). This part of the program is under construction. This version includes the original scheme used in Hernandez et al 2004 and 2005. Improvements are coming soon.

 d. Configure IRAF in your work directories.
Make mkiraf in the directories: SPTCLASS/, SPTCLASS/LATE_CLASS/, SPTCLASS/GTYPE_CLASS/ and SPTCLASS/HAEBE_CLASS. Edit the "login.cl" files generated by the command mkiraf adding a line with the word "onedspec", this activates the onedspec package in IRAF.

e. Edit the first line of the file codespt.source (environments variables). E.g.;
setenv BASE1 /home/jesush/SPTCLASS
Add a line in your .cshrc to include the definitions in the file codespt.source. E.g; add in your .cshrc the following line (e.g.):
source /home/jesush/SPTCLASS/codespt.source

f. Check if all the files .csh in the code have executable permissions.

2.- RUNNING SPTCLASS CODE.

Follow these steps:

a. Preparing the spectra file input.  You have to prepare a file with the spectra to classify (spectra.lis). Each line has to have the entire path where they are located. The spectra must be wavelength calibrated and  one-dimensional formatted. If it is neccesary, use IRAF to convert from multidimentional format to onedimensional format with the scopy and scombine task of the onedspec package. An example of spectra.lis is shown below:

/extra/IRS_proyect/SPECTRA/cvso107_fast.fits
/extra/IRS_proyect/SPECTRA/cvso109_fast.fits
/extra/IRS_proyect/SPECTRA/cvso58_fast.fits
/extra/IRS_proyect/SPECTRA/cvso58_hecto.fits
/extra/IRS_proyect/SPECTRA/cvso58_hydra.fits
/extra/IRS_proyect/SPECTRA/cvso90_fast.fits

WARNING: Avoid repeating lines in this file
WARNING: Avoid lines with more than 76 characteres

b. Running the code. In the directory SPTCLASS/ run the program typing the following comand.

> SPTCLASS.csh spectra.lis

spectra.lis is the list of spectra that you want to classify.

3 - SPECTRAL CLASSIFICATION INDICES

Following Hillenbrand (1995), the equivalent width (Wλ) for each spectral feature is obtained by measuring the decrease in flux due to line absorption from the continuum that is expected when interpolating between two adjacent bands, defined here as the blue continuum band [BCB] and the red continuum band [RCB]. The equivalent width Wλ is defined as :


where FFB, FBCB, and FRCB are the fluxes at the central wavelengths (λFB, λBCB, and λRCB) of the feature band and continuum bands, respectively, and ΔλFB is the width of the FB. Equivalent widths or "indices" measured by this procedure are largely insensitive to reddening as long as the wavelength coverage of each band is relatively small. Indices constructed in this way should also be quite independent of the S/N as long as the sidebands are chosen to be next to the measured feature and are wide enough to obtain a good flux estimate. Thus, judicious selection of the width of each band relies on a compromise between minimizing reddening effects and maximizing the S/N.

Table 1: HAeBe class indices
#
NAME
Central Wavelength (A)
Spectral type range
1
CaII(K)
3933
A0-G0
2
FeI+ScI
4047
F5-K1
3
MnI
4032
B5-G9
4
HeI
4026
O8-B3; B3-A0
5
CN
4175
O8-A5; F5-G9
6
HeI
4144
O8-B3; B3-A1; F5-K3
7
TiII+FeII
4203
F2-K4
8
CaI 4226
F2-K3
9
TiII, FeII, CrII 4176 O8-A7
10
FeI
4271 F2-K5
11
CH(Gband)
4305 F2-G2
12
HeI+FeI
4387
O8-B3; B3-A1; F2-K4
13
MnI+FeI 
4458 F2-K4
14
HeI
4387
O8-B2; B2-A1; A7-K1
15
MnII
4481
B5-A1
16
FeI
4490
B5-A1
17
FeI
4532
A0-G5
18
FeI
4592
B5-K4
19
FeI+ScII
4669
O8-B3; B2-G2
20
FeI
4787
A5-K3
21
HeI+FeI
4922
O8-B2; B2-A1; A7-K4; K5-M6
22
HeI+FeI+TiI
5016
A0-K5
23
FeI
5079
A0-K3; K5-M6
24
FeII+MgI
5173
A0-G0
25
FeI+CaI
5270
A0-K0
26
FeI
5329
F2-K5
27
FeI
5404
O8-B2-F5-K5
28
HeI
5878
O8-A0; G9-M0
29
CaI
5589
A0-K3; M0-M6
30
MgI
5711
A5-K5;K5-M6
31
NaI
5890
F2-G2; G9-K7
32
MnI
6015
F2-K5
33
CaI
6162
F5-K3; K0-K7
34
HeI
6678
B2-A0
35
HeI
7066
O8-A1;M0-M6
36
Halpha
6565
O8-A1;A0-K7
37
Hbeta
4861
O8-A1;A1-G0
38
Hgamma
4349
O8-A1;A1-K6
39
TiO
6185
M0-M6
40
TiO
6720
K5-M6
41
CaH
6975
K2-M6
42
CaH
6385
K1-M6
43
CaH
6830
K2M6
44
Hdelta
4102
O8-A1;A1-F9

Table 2: Gtype class indices
#
Name
Central wavelength
Spectral type rages
1
Ca I
4226
G0-M0
2
Gband
4290
F5-K5
3
Fe I
4370
F5-K4
4
Fe I
4458
A5-K5
5
Mg I
5170
F0-K4
6
Ca I
5277
F5-K5
7
Fe I
5329
F5-K5
8
Fe I
5406
G0-K4
9
Ca I
5590
F5-K5
10
Fe I
5709
G0-K5
11
Ca I
6165
G0-K5

Table 3: Late type class indices
#
Name Central wavelength Spectral type rages
1
TiO1
4775
K3-M6
2
TiO2 4975
K3-M6
3
TiO3 5225
K0-M6
4
TiO4 5475
K4-M6
5
TiO5 5600
K3-M6
6
TiO6 5950
K6-M6
7
TiO7 6255
K2-M6
8
TiO8 6800
K3-M7;M7-M9.5
9
TiO9 7100
K5-M7;M7-M9.5
10
TiO10 7150
K5-M7;M7-M9.5
11
VO1
7460
M5-M9;M9-L0
12
VO2 7940
M0-M9;M9-L0
13
VO3 7840
M0-M8;M8-M9.5
14
VO4 8500
M0-M9;M9-L0
15
VO5 8675
M0-M9;M9-L0
16
VO6 8880
M0-M9;M9-L0

Most of these spectral features were calibrated using a standard sequence obtained with the FAST spectrograph at FLWO. However, the standard sequence for very low mass stars (VLMS) and substellar objects were provided by Kevin Luhman.  In the calibration links of Table 3, we plotted with different colors FAST standards (blue) and Kevin's VLMS standards (red). 


4.- MODULES IN SPTCLASS

SPTCLASS is designed to run several steps or modules, which you can run individually. In the SPTCLASS.csh program you can read:
# What process to run: m: meassuring Flux
# l: Program for late stars
# g: Program for Gtype stars
# e: Program for early stars
# h: Measure Halpha, LiI, and other lines
# p: Plotting the results
# i: Create interactive output
# a: create at begining artificial results (default 0)

# Process        l  g e h p i a
set process = (1 1 1 1 1 1 0)     #Edit this line to enable (1) or disable (0) each module:

(1) Module for Late-type scheme (1 0 0 0 0 0 0):
This module activates the Late-type scheme in SPTCLASS using spectral features listed in Table 1. The main results are in the file T1.lis

(2) Module for Gtype scheme (0 1 0 0 0 0 0): This module activates the Gtype scheme in SPTCLASS using spectral features listed in Table 2. The main results are in the file T2.lis

(3) Module for HAeBe scheme (0 0 1 0 0 0 0):This module activates the HAeBe scheme in SPTCLASS using spectral features listed in Table 3. The main results are in the file T3.lis.

(4) Module to measure automatically the equivalent width (EW) of several lines (0 0 0 1 0 0 0): Halpha, LiI6707, Infrered triplet of CaII[8498,8542,8662], Infrared doblet of Na I[8183,8194], infrared doublet of KI[7665,7697], CaH6975 band. These EW are useful for a quick analisys of a sample, however more accurate result can be obtained with module 6. Results are in files: T4.lis (Halpha), T5.lis(LiI) and MAS_LIN.dat (other features).
Note: These values are estimators of EW. If you want reliable values for LiI and Halpha you have to use the interactive module.

(5) PLOTTING THE OUTPUT (0 0 0 0 1 0 0): Generate a postscript file with plots showing the results from the schemes of SPTCLASS. The output is GRAFICA.ps

(6) INTERACTIVE MODULE (0 0 0 0 0 1 0): Using this module you can get a more friendly spectral analysis and spectral types checking of each star in your sample. You can select the best scheme to classify your star, put the quality flag in the result, write comments or measure the EW of Halpha and LiI. The results are in a file, RESU.temp, when lines begining with RES show the spectral results and lines begining with COMMENT show comments associated with your result.

(7) GENERATE ARTIFICIAL RESULTS TO AVOID THE USE OF ONE SCHEME (0 0 0 0 0 0 1). In some cases when the spectral range is too different from FAST (3700-7100 AA) or the spectral cover is too small, the HAeBe scheme crashes, so you have to avoid the use the HAeBe type scheme using this module to generate artifitial results for HAeBe type scheme. In this way you can use the other schemes when your sample is not early type objects. In this cases you activate the last module of SPTCLASS, e.g: set process =(1 1 0 1 1 1 1).
Note: normally this module is disabled.


5.-  SPTCLASS: the example

Normally you use the module set as (1 1 1 1 1 1 0), running SPTCLASS typing a single line ( SPTCLASS.csh spectra.lis). The code uses the onedspec package of IRAF to get the measurements in the feature band and continuum bands for each feature listed in Tables 1, 2 and 3 (section 3). Then IDL programs calibrate the spectral indices converting from equivalent width to spectral types.  The results are plotted in a postscript file (GRAFICA.ps) which shows the dispersion of individual results for HAeBe, Gtype and Late type parts of the code. Figure 1 shows an example of this plot.


Figure 1:  This is an example of the postcript output from the code, you can inspect the spectra (top-left panel) of the star with a zoom in Halpha (top-mid panel) and LiI 6707 (top-right panel).  The bottom panels show the results from each part of the code, Late type (left), Gtype (middle) and HAeBe (right). Since the spectra exhibit strong molecular bands expected in late type stars, it is apparent that you get the best result from the Late type scheme. This star has Halpha in emission and have Li I 6707 in absorption indicating that it is a young star. The EW of Halpha is strong (EW=-110A) indicating that this star is accreting material from the disks to the central object.

The interactive module allows you to decide which scheme is best for your spectrum, includes a quality flag, comments, and measures the equivalent of Halpha and Li I  directly from the spectrum fitting a gaussian to the line.

The interactive module will show a box where you can indicate where you want to begin your inspection by typing the number of line in your input file (spectra.lis):

Figure 2: initial box


A main box (Figure 3) is displayed where you can choose your options for your spectrum. SPTCLASS will also display the same plot in GRAFICA.ps (see Figure 1) and a plot with a closer view of several lines (Figure 4).

FIGURE 3: main box
Figure 4: Important lines. In this example you can see the infrared Ca II triplet, the  infrared O I (7773, 8446) doublette and the line He I (6676) in emission supporting that this object is a strong accretor.
Note: most of these lines are locate out from the spectral range of FAST and HYDRA but are useful for spectra taken with the HECSPEC instrument at MMT. The code could be modified easily to include other spectral features in this box.



5.1  Choosing your classification scheme:

In the first column of the main box (Figure 3) you can choose which classification scheme is the best for your star. With little experiences with spectral classification you can estimate if your star is an early type star (showing  strong Balmer lines and He I),  solar type star (showing  many Fe I lines and weak Balmer lines) or a Late type star (showing molecular bands like TiO and VO). In general, the best scheme for your spectrum has less dispersion in the individual results.  In some cases, when SPTCLASS does not converge to a unique result ( noisy or high reddening spectra) you can manually put a spectral type using the  first option in the second column of the main box. This will display:

Figure 5: Manual Classification. This option requires some experience in spectral classification. If you are not sure about using this option select the option NO_CLASSIFIED (last option second column in main box)

SPTCLASS gives you an option to improve your spectral typing by rejecting individual results interactively.  The second option in the second column of the main box will display.

Figure 6: Chossing the scheme for interactive classification.

Choose which group of individual results you want to use for interactive classification. The example plotted in Figure 1 could be improved selecting the
Late type scheme for interative classification. This will display:

Figure 7: Interactive classification. The spectral type given by the Late scheme  is  K7.2 (67.2). You can reject the three points located in the blue part of the spectra (which could be more affected by the accretion lines) and get a spectral type K7.5 (67.5). 

WARNING: If you choose more than one option in the first two columns, SPTCLASS will crash.

5.2  SELECTING A QUALITY FLAG:

The third column shows the quality flag for your result. This option gives a reference for the quality of your spectral typing based on the number of features used to classify your spectrum and the dispersion of these individual results ( 2=> excelent classification, 1=> good classification, 0=> bad classification).
WARNING: If you choose more than one option in the third column, SPTCLASS will crash.
NOTE:  The quality flag for manual classification is -1 and the quality flag for interactive classification is -2.

5.3  FLAG FOR LiI PRESENCE:

You can put a flag for the precense of LiI 6707 using the fourth column in the main box (2=> present, 1=> maybe present, 0=> no Li I)

5.3  MEASURE THE EW OF LiI (6707) and Halpha:

In the last column you can choose if you want to measure the EW of LiI 6707 and/or Halpha fitting a gaussian function. For example if you select measure the EW of Halpha, SPTCLASS will display a closer view of the Halpha line. Click on the continumm in the blue and red part to fit a gaussian line to the feature.
Figure 8: Equivalent width of Halpha. The green line shows the position at 6563A. The purple line is the gaussian line fitted to the feature.

5.3  COMMENTING YOUR RESULTS:

The last option in the last column of the main box will display a box where you can type any comment about the result or the object classified with SPTCLASS.

Figure 9: Comment box.

6  THE OUTPUT:

Results will be saved in the file RESU.temp.  An example of this file  is shown below, where there are two kinds of lines:
RES line for result  and COMMENT line for  comments typed in  sec 5.3)

RES:    1618   75.2    1.5    8    1    0       0.0       0.0       0.0    6563.0    -999.9
COMMENT: VLMS_noHalpha
RES:    1619   55.0    6.0    0   -1    0       0.0       0.0       1.2    6562.9       5.9
COMMENT:
RES:    1620   70.2    1.0    9    1    1       0.1    6707.8       0.6    6562.6       3.5
COMMENT:
RES:    1621   52.3    3.0    5    1    1       0.1    6708.3      -2.0    6562.4       6.8
COMMENT:
RES:    1622   53.0    2.6    5    1    0       0.0       0.0      -0.8    6562.9       5.1
COMMENT:
RES:    1623   48.8    1.9   16    1    0       0.0       0.0       2.6    6565.8       9.2
COMMENT:
RES:    1624   47.7    1.9   18    1    0       0.0       0.0       2.7    6563.2       8.6
COMMENT:
RES:    1625   54.8    2.8    5    1    0       0.0       0.0       1.9    6565.1       8.3
COMMENT:

The RES line shows an internal running number (col 1) which is the number of line in the input file (spectra.lis);  the spectral type,  its error (in subclasses), the number of features used for spectral typing and the quality flag selected in sec 5.2 (col 2, 3, 4, and 5). The flag for the Li I precense, the EW of Li I and the center line in the gaussian fuction fitted to the line are shown in col 6, 7 an 8, respectively. The EW of Halpha, the center line, and the FWHM derived from the gaussian line fitting  are shown in the last three columns.

NOTE: any comments or question email me at hernandj@umich.edu or jesush@cida.ve.