Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_IRAF_wave(header):
old_STRIP_HEADER_WHITESPACE = fits.STRIP_HEADER_WHITESPACE()
try:
fits.STRIP_HEADER_WHITESPACE.set(False)
if header['NAXIS'] ==2:
if header['WCSDIM'] == 2:
if header['CTYPE1'] == 'MULTISPE' or header['CTYPE2'] == 'MULTISPE':
if header['CTYPE1'] == 'MULTISPE' and header['CTYPE2'] == 'MULTISPE':
wave = wave_multispec(header)
else:
raise IrafFormatError('File does not conform to IRAF format - multispec spectra must have CTYPE1 and CTYPE2 = MULTISPE')
else:
raise NotImplementedError
elif header['NAXIS'] ==1:
wave = wave_1dspec(header)
else:
raise NotImplementedError
return wave
finally:
fits.STRIP_HEADER_WHITESPACE.set(old_STRIP_HEADER_WHITESPACE)
pmin, pmax, thiswave = cubic_spline(spec)
elif func == 4:
pmin, pmax, thiswave = linear_spline(spec)
elif func == 5:
# TBD: pixel coordinate array
raise NotImplementedError
elif func == 6:
#TBD: sampled coordinate array
raise NotImplementedError
else:
raise IrafFormatError('File does not conform to IRAF format - non-linear of dispersion function must be [1,2,3,4,5,6]')
wave[N-1,pmin-1:pmax] += weight * (offset + thiswave)
wave[N-1,:] = wave[N-1,:]/(1.+z)
else:
raise IrafFormatError('File does not conform to IRAF format - type of dispersion function must be [-1,0,1,2]')
return wave
if func == 1:
pmin, pmax, thiswave = polynomial(chebyshev, spec)
elif func == 2:
pmin, pmax, thiswave = polynomial(legendre, spec)
elif func == 3:
pmin, pmax, thiswave = cubic_spline(spec)
elif func == 4:
pmin, pmax, thiswave = linear_spline(spec)
elif func == 5:
# TBD: pixel coordinate array
raise NotImplementedError
elif func == 6:
#TBD: sampled coordinate array
raise NotImplementedError
else:
raise IrafFormatError('File does not conform to IRAF format - non-linear of dispersion function must be [1,2,3,4,5,6]')
wave[N-1,pmin-1:pmax] += weight * (offset + thiswave)
wave[N-1,:] = wave[N-1,:]/(1.+z)
else:
raise IrafFormatError('File does not conform to IRAF format - type of dispersion function must be [-1,0,1,2]')
return wave