import pyfits

hdus = pyfits.open("../data/bayestar2017.fits")
hdus[1].data = hdus[1].data[:1000]
hdus.writeto("../data/sample.fits")
