How to use the specutils.io.read_IRAF_spec.IrafFormatError function in specutils

To help you get started, we’ve selected a few specutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astropy / specutils / specutils / io / read_IRAF_spec.py View on Github external
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)
github astropy / specutils / specutils / io / read_IRAF_spec.py View on Github external
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
github astropy / specutils / specutils / io / read_IRAF_spec.py View on Github external
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