Theoretical spectrum of a star

Often one needs a theoretical spectrum of a star, which one observes and for which one has already measured spectra.
To select a theoretical spectrum from spectra libraries available on the internet, you need at least two parameters of the star: the effective temperature (Teff) and the gravitation (logg). These parameters can easily be found on the internet, e.g. for beta Aurigae in wikipedia (google):

There you find very similar values for the two components of the binary star system: Teff = 9350 and 9200 K, logg = 3.93.

To get a theoretical spectrum for the star I wrote a Python script (see attachment) which can do the following:
It accesses a spectrum library of the University of Hamburg. The correct selection of the spectrum is done by entering Teff and logg (here 9250 K and logg = 4.0, only certain parameter numbers are allowed, they are listed after calling the program).

The theoretical spectrum ranges from 3800 to 11000 Angstroms. It is calculated in high resolution, in steps of 0.01 Angstrom. But our spectrograph probably has a lower resolution, mostly between 0.3 and 1 Angstrom. Therefore, our Python script convolves the theoretical spectrum with a Gaussian function corresponding to our apparatus profile. The apparatus profile is characterized by entering our spectral resolution R (e.g. R = 10000).

We also limit the calculated spectrum to a desired range of wavelengths (e.g. 4000…7000 Angstrom).

But it still has the very small step size of 0.01 angstrom. Therefore we re-bin this theoretical spectrum with a step size of 0.1 Angstrom. The final result calculated in this way is saved as an ascii file in tab format and as a fit file, with a name we assigned beforehand, here in the example „betAur“. In addition, the high-resolution theoretical spectrum and our spectrum calculated from it with a smaller step size and resolution are displayed graphically in a pdf and a png plot and saved.