def __init__(self, *args, **kwargs):
if len(args) == 1 and os.path.exists(args[0]):
data, header, wavelength = self._restore_from_file(args[0], **kwargs)
elif all([k in kwargs for k in ['data', 'header', 'wavelength']]):
data = kwargs.get('data')
header = kwargs.get('header')
wavelength = kwargs.get('wavelength')
else:
raise ValueError('''EISCube can only be initialized with a valid FITS file or NumPy
array with an associated wavelength and header.''')
# check dimensions
if data.shape[-1] != wavelength.shape[0]:
raise ValueError('''Third dimension of data cube must have the same length as
wavelength.''')
self.meta = header.copy()
self.wavelength = wavelength
self.data = data
self.cmap = kwargs.get('cmap', sunpy.cm.get_cmap('hinodexrt'))
self._fix_header()
评论列表
文章目录