22institutetext: Área de Física de Procesos Irreversibles, Departamento de Ciencias Básicas,
Universidad Autónoma Metropolitana-Azcapotzalco (UAM-A), Ciudad de México, México.
33institutetext: Departamento de Física, Escuela Superior de Física y Matemáticas,
Instituto Politécnico Nacional, Ciudad de México, México,
33email: [email protected], 33email: [email protected], 33email: [email protected] 33email: [email protected],
Algorithm for removing secondary lines blended with Balmer lines in synthetic spectra of massive stars.
Abstract
In order to measure automatically the equivalent width of the Balmer lines in a database of 40,000 atmosphere models, we have developed a program that mimics the work of an astronomer in terms of identifying and eliminating secondary spectral lines mixed with the Balmer lines. The equivalent widths measured have average errors of 5 percent, which makes them very reliable. As part of the FITspec code, this program improves the automatic adjustment of an atmosphere model to the observed spectrum of a massive star.
Keywords:
Algorithm, Database, Artificial intelligence, Balmer lines, Stellar atmospheres.1 Introduction
The main restriction when studying astronomical objects is the impossibility of directly experiencing them. The massive stars have a period of evolution characteristic of millions of years and temperatures of the order of K. Complex phenomena occurring in the atmosphere of the star can be simulated by a numerical code. In recent decades, there have been developed sophisticated stellar atmosphere codes such as TLUSTY [1], FASTWIND [2], [3], CMFGEN [4], and the Postdam Wolf–Rayet (PoWR) code [5], [6], [7]. As a result, significant advances have been achieved toward understanding the physical conditions prevailing in the atmospheres and winds of massive stars.
The number of models generated to study an object grows exponentially depending on the number of parameters included in the simulation, with the consequent microprocessor time consumption. A strategy to address this problem is to generate a grid of models, covering characteristic values for each parameter, which can be used as a tool to study not only one, but an infinity of objects. With the use of the ABACUS-I supercomputer of the ABACUS Centre for Applied Mathematics and High Performance Computing of CINVESTAV (Mexico), it has recently been generated a grid with such characteristics [8]. This grid covers a six-dimensional space with different values of the main parameters of the star, wind, and chemical composition. Currently the grid has 40,000 models of stellar atmospheres, and hence it would be impossible to compare by eye the observed spectrum of a star with all models in the database.
In particular, the FITspec code [9] is a tool for the automatic fitting of synthetic stellar spectra. To adjust the effective temperature, FITspec requires as input the equivalent width (EW) of five helium lines: He II 4541, 4200; He I 4471, 4387, 4144; and He I + He II 4026. Additionally, to adjust the surface gravity, the program requires the EW of six Balmer lines: Hβ 4861, Hγ 4341, Hδ 4102, Hϵ , Hζ 3889, and Hη 3835. In order to achieve a good fit, it is important that the measurement of the EWs be as accurate as possible. The EW measured automatically may differ from what a human being would measure manually. It is important to reduce the effect of the lines mixed with the main line, since it overestimates the EW. In this paper we present a numerical method that reduces the effect of the mixed lines on the EW values.
2 Measurement of the equivalent width by elimination of secondary lines
The equivalent width (EW) is defined as the width of a rectangle with an area equal to the spectral line and a height equal to the continuum. For an experienced astronomer it is easy to identify by eye the initial () and final () wavelengths, as well as the continuous wavelength in order to measure the area of the spectral line and establish the EW (Fig. 1). However, a computer cannot identify these values directly, and to determine them we analyze a sample of 20 spectra of the database. The selection was made using random numbers, corresponding to the spectrum number. For each spectrum of the sample, the and values of the six Balmer lines considered were established by simply analyzing the spectrum by eye. The mean and the standard deviation were obtained and and were assumed as the values of the mean plus the standard deviation (Table 1). T he value of the continuum was fixed at 1.0 since it corresponds to the normalized spectra.

() | () | ||||||
---|---|---|---|---|---|---|---|
Line | Assumed | Assumed | |||||
Hβ | 4861.28 | 4847.55 | 4.61 | 4842.94 | 4877.60 | 4.51 | 4882.11 |
Hγ | 4349.47 | 4326.53 | 3.47 | 4323.06 | 4356.51 | 4.05 | 4360.56 |
Hδ | 4101.71 | 4086.11 | 5.30 | 4080.81 | 4119.21 | 6.00 | 4125.22 |
Hϵ | 3970.08 | 3959.26 | 2.82 | 3956.44 | 3983.07 | 4.31 | 3987.37 |
Hζ | 3889.02 | 3878.75 | 3.00 | 3875.75 | 3902.25 | 3.49 | 3905.74 |
Hη | 3835.40 | 3825.29 | 2.71 | 3822.58 | 3847.60 | 3.08 | 3850.68 |
To determine if there are more than one spectral line between and , we use Bolzano’s theorem: Let f be a continuous real function in a closed interval with and of opposite signs. Then there is at least one point c of the open interval with .
This implies that when and have opposite signs, the function crosses the horizontal axis. We take advantage of this property to determine how many secondary lines are mixed with the main line that we want to measure. If the horizontal axis is arbitrarily moved and placed at an intermediate level between the continuum and the depth of the spectral line (Fig. 1), then the modified flow is obtained
(1) |
where is the modified flow, is the normalized flow, and is the reference level, which can take any value between the continuum and the depth of the line. We further assume that is a continuous function of the wavelength (w) in the interval , while and are two subsequent values of the wavelength. If and have opposite signs, then there is a point c where . This means that crosses the reference level. In Fig. 2, it is seen that the number of spectral lines within the interval is given by the number of times(nc) that crosses the reference line divided by two. In this way, the number of secondary lines mixed with a Balmer line is given by
(2) |

3 Algorithm
The simplified version for a spectral line is shown. Twenty-five reference levels were established iteratively.
input: = normalized flux, float type array.
w = wavelength, float type array.
= central wavelength of the spectral line, float.
Output: = normalized flux with secondary lines removed
Begin
fc = flux in the central wavelength of the spectral line
step = (1 - fc)/25.0)
level = 1
while level less or equal to 25
= 1.0 – step * level
n = number of elements of
= f - rl
for i = 1 to n - 1
sign = [i] * [i+1]
end for
nl = (number of elements of sign ¡ 0)/2
if nl less or equal to 1 then there are not secondary lines
if nl ¿ 1 then there are nl - 1 secondary lines
for i=1 to nl -1
in secondary line[i] = average flux of the rl
end for
end if
level = level + 1
end while
= + rl
return
end
4 Errors
The purpose of the algorithm is to measure the equivalent width of the Balmer lines automatically, replacing the work of an experienced astronomer. Ideally, the algorithm should obtain the same EW values as the astronomer. Assuming that the error is the difference between both values and that the true value is the one that is measured manually, we can calculate the error as:
(3) |
5 Results and discussion
Figure 3 shows a spectrum in which the secondary lines were removed with the use of the algorithm. It is clearly seen that the program has identified and eliminated the secondary lines properly. An astronomer can identify at first sight whether a spectral line is isolated or there are several lines mixed. However, this is not a trivial task for a computer. The term artificial intelligence is applied when a machine imitates some cognitive functions of human beings [10]. In this case, the algorithm mimics the process of perceiving the spectral lines through the sense of sight.

Using equation (3), we calculate the errors for the six Balmer lines in the twenty spectra of the sample. Subsequently, the standard deviation and the average of the errors in each line are calculated, considering two cases when the secondary lines are preserved or removed. The results are summarized in Table 2, Additionally, Fig. 4 shows a comparison between the errors produced for each line in both cases.
It would be expected that when the EW is calculated by preserving the secondary lines, its values would be overestimated. On the other hand, when the secondary lines are removed, the overestimation will decrease, and even so the EWs would be underestimated. However, Table 2 shows that in both cases, the EWs are underestimated in all the lines, except in Hη. This behavior is due to the and values having been considered in each case.
With secondary lines | Without secondary lines | ||||
---|---|---|---|---|---|
line | Average error | Average error | |||
H | 4861.28 | -0.0920 | 0.0838 | -0.0402 | 0.0415 |
H | 4349.47 | -0.1147 | 0.1694 | -0.0953 | 0.2484 |
H | 4101.71 | -0.1833 | 0.1881 | -0.1560 | 0.1549 |
H | 3970.08 | -0.0837 | 0.0560 | -0.0577 | 0.0299 |
H | 3889.02 | 0.0525 | 0.1230 | -0.0022 | 0.0886 |
H | 3835.40 | 0.1183 | 0.3405 | 0.0427 | 0.1364 |
When the EWs are measured by keeping the secondary lines, the values of and are established closer to the central wavelength to avoid the effect of such lines. This method underestimates the EWs, especially in those spectra where the Balmer lines are broadened by gravitational effects. On the other hand, the algorithm that suppresses the secondary lines, allowed to fix the values of and more realistically, from the spectra of the sample. This algorithm obtains values closer to those that an astronomer would measure regardless of whether the Balmer lines are narrow or broadened.

Figure 4 shows that when measuring the EWs while retaining the secondary lines, the average errors are 10 percent, while when eliminating the secondary lines, the average errors are reduced to 5 percent. Only for Hδ the errors are greater than 15 percent. As it can be seen in Figure 3, this line presents a large number of mixed lines.
6 Conclusions
Properly measuring the EWs of a spectrum is a task that requires an experienced astronomer. However, the time required grows proportionally to the number of spectra and the lines measured in each spectrum. Obtaining the value of the EWs in a database of 40,000 spectra in a reasonable time is an impossible task to perform manually. In this work, we have presented an algorithm, which has the ability to perform a realistic measurement, identify the secondary lines mixed with the Balmer lines, and then eliminate them before calculating the EW, in a way similar to what an experienced astronomer would do.
The algorithm improves the results obtained in the previous version of FITspec, reducing the error from 10 to 5 percent. By improving the value of EWs, the algorithm also allows to increase the quality of the automatic adjustment of spectra made by FITspec.
Acknowledgments
The authors acknowledge the use of the ABACUS-I supercomputer at the Laboratory of Applied Mathematics and High-Performance Computing of the Mathematics Department of CINVESTAV-IPN, where this work was performed. The research leading to these results has received funding from the European Union’s Horizon 2020 Programme under the ENERXICO Project, grant agreement no 828947 and under the Mexican CONACYT-SENER-Hidrocarburos grant agreement B-S-69926. J. K. acknowledges financial support by the Consejo Nacional de Ciencia y Tecnología (CONACyT), México, under grant 283151.
References
- [1] Hubeny, I. & Lanz, T.: Non-LTE line-blanketed model atmospheres of hot stars. 1: Hybrid complete linearization/accelerated lambda iteration method. ApJ 439, 875-904 (1995).
- [2] Santolaya-Rey, A. E., Puls, J., & Herrero, A.: Atmospheric NLTE-models for the spectroscopic analysis of luminous blue stars with winds. A&A 323, 488-512 (1997).
- [3] Puls, J., Urbaneja, M. A., Venero, R., Repolust, T., Springmann, U., Jokuthy, A., & Mokiem, M. R.: Atmospheric NLTE-models for the spectroscopic analysis of blue stars with winds-II. Line-blanketed models. A&A 435(2), 669-698 (2005).
- [4] Hillier, D. J., & Miller, D. L.: The treatment of non-LTE line blanketing in spherically expanding outflows. ApJ 496(1), 407 (1998).
- [5] Gräfener, G., Koesterke, L., & Hamann, W. R.: Line-blanketed model atmospheres for WR stars. A&A 387(1), 244-257 (2002).
- [6] Hamann, W. R., & Gräfener, G.: A temperature correction method for expanding atmospheres. A&A 410(3), 993-1000 (2003).
- [7] Sander, A., Shenar, T., Hainich, R., Gímenez-García, A., Todt, H., & Hamann, W. R.: On the consistent treatment of the quasi-hydrostatic layers in hot star atmospheres. A&A 577, A13 (2015).
- [8] Zsargó, J., Fierro, C. R., Klapp, J., Arrieta, A., Arias, L., & Hillier, D. J. Database of CMFGEN Models in a 6-Dimensional Space. In Latin American High Perfor- mance Computing Conference (pp. 387-392). Springer, Cham.(2016, August).
- [9] Fierro-Santillán, C. R., Zsargó, J., Klapp, J., Díaz-Azuara, S. A., Arrieta, A., Arias, L., & Sigalotti, L. D. G.: FITspec: A New Algorithm for the Automated Fit of Synthetic Stellar Spectra for OB Stars. ApJS 236(2), 38 (2018).
- [10] Russell, S. J., & Norvig, P.: Artificial intelligence: a modern approach. Malaysia. Pearson Education Limited (2016).