StellarModel.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:gullikson-scripts 作者: kgullikson88 项目源码 文件源码
def load_flux(self, parameters):
        '''
        Load just the flux from the grid, with possibly an index truncation.

        :param parameters: the stellar parameters
        :type parameters: dict

        :raises KeyError: if spectrum is not found in the HDF5 file.

        :returns: flux array
        '''

        key = self.flux_name.format(**parameters)
        with h5py.File(self.filename, "r") as hdf5:
            try:
                if self.ind is not None:
                    fl = hdf5['flux'][key][self.ind[0]:self.ind[1]]
                else:
                    fl = hdf5['flux'][key][:]
            except KeyError as e:
                raise GridError(e)

        # Note: will raise a KeyError if the file is not found.

        return fl
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号