def is_spectral_cube(filename, **kwargs): """ Check that the file is a 3D or 4D FITS spectral cube """ if not is_fits(filename): return False try: StokesSpectralCube.read(filename) except Exception: return False else: return True
def read_spectral_cube(filename, **kwargs): """ Read in a FITS spectral cube. If multiple Stokes components are present, these are split into separate glue components. """ cube = StokesSpectralCube.read(filename) return spectral_cube_to_data(cube)
def is_spectral_cube(filename, **kwargs): """ Check that the file is a 3D or 4D FITS spectral cube """ file_format = identify_file_format(filename) if file_format is None: return False try: StokesSpectralCube.read(filename, format=file_format) except Exception: return False else: return True
def read_spectral_cube(filename, **kwargs): """ Read in a FITS spectral cube. If multiple Stokes components are present, these are split into separate glue components. """ cube = StokesSpectralCube.read(filename, format=identify_file_format(filename)) return spectral_cube_to_data(cube)