astropy / astropy-tutorials

Tutorials for the Astropy Project
BSD 3-Clause "New" or "Revised" License
291 stars 176 forks source link

BUG in tutorials/UVES/UVES.ipynb function read_setup() #506

Closed jzoubian closed 2 years ago

jzoubian commented 2 years ago

During astroinfo 2021, we used your great tutorials and one of the participant founds a bug in the tutorials UVES, in the function read_setup()

def read_setup(filename):
    '''Get setup for UVES spectrum from the ESO pipeline

    Parameters
    ----------
    filename : string
    name of the fits file with the data

    Returns
    -------
    exposure_time : float
    wavelength_zero_point : float
    optical_arm : string
    '''
    sp = fits.open(filelist[0])
    header = sp[0].header

    return header['EXPTIME'], header['CRVAL1'], header['HIERARCH ESO INS PATH'

sp = fits.open(filelist[0]) should be sp = fits.open(filename).

In the loop :

for f in filelist:
    print(read_setup(f))

all the setup are the same because it is always the same print filelist[0].

adrn commented 2 years ago

Thanks for catching this! I implemented a fix in #506