The apogee package works with SDSS-III APOGEE and SDSS-IV APOGEE-2 data. It reads various data products and applies cuts, works with APOGEE bitmasks, and plots APOGEE spectra. It can generate model spectra for APOGEE spectra, and APOGEE model grids can be used to fit spectra. apogee includes some simple stacking functions and implements the effective selection function for APOGEE.
https://ui.adsabs.harvard.edu/abs/2016ApJ...817...49B; please see additional citation information here: https://github.com/jobovy/apogee#citing-this-code