Mini Tools for LAMOST data

astroNN.lamost module is designed for dealing with LAMOST DR5.

LAMOST DR5 is not a public data release yet, this module only provides a limited amount of tools to deal with the spectra. If you do not have the data, astroNN will not provide any LAMOST DR5 data nor functions to download them.

LAMOST Data Policy:

LAMOST DR5 Homepage:

LAMOST DR5 Data Model:

LAMOST Spectra Wavelength Solution


To return wavelegnth_solution


dr (Union(int, NoneType)) – data release


wavelength solution array

Return type:



2018-Mar-15 - Written - Henry Leung (University of Toronto)

You can retrieve LAMOST spectra wavelength solution by

from astroNN.lamost import wavelength_solution

lambda_solution = wavelength_solution(dr=5)

Pseudo-Continuum Normalization of LAMOST Spectra

astroNN.lamost.pseudo_continuum(flux, ivar, wavelength=None, L=50, dr=None)[source]

Pseudo-Continuum normalise a spectrum by dividing by a Gaussian-weighted smoothed spectrum.

  • flux (ndarray) – The observed flux array.

  • ivar (ndarray) – The inverse variances of the fluxes.

  • wavelength (ndarray) – An array of the wavelengths.

  • L (int) – [optional] The width of the Gaussian in pixels.

  • dr (int) – [optional] dara release


Continuum normalized flux and flux uncerteinty

Return type:


from astroNN.lamost import pseudo_continuum

# spectra_errs refers to the inverse variance array provided by LAMOST
# spectra can be multiple spectra at a time
norm_spec, norm_spec_err = pseudo_continuum(spectra, spectra_errs, dr=5)

Load LAMOST DR5 catalogue


Open LAMOST DR5 allstar


fits file opened by astropy

Return type:


2018-Jun-17 - Written - Henry Leung (University of Toronto)

from astroNN.lamost import load_allstar_dr5

fits_file = load_allstar_dr5()
fits_file[1].header  # print file header