ion_sources.py 文件源码

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

项目:fiasco 作者: wtbarnes 项目源码 文件源码
def preprocessor(self, table, line, index):
        line = line.strip().split()
        if index == 0:
            self._drparams_filetype = int(line[0])
            if self._drparams_filetype == 1:
                # Badnell type
                self.dtypes = [int,float,float]
                self.units = [None,u.K,(u.cm**3)/u.s*(u.K**(3/2))]
                self.headings = ['fit_type', 'E_fit', 'c_fit']
                self.descriptions = ['fit type', 'E fit parameter','c fit parameter']
            elif self._drparams_filetype == 2:
                # Shull type
                self.dtypes = [int,float,float,float,float]
                self.units = [None,(u.cm**3)/u.s*(u.K**(3/2)),u.dimensionless_unscaled,u.K,u.K]
                self.headings = ['fit_type', 'A_fit', 'B_fit', 'T0_fit', 'T1_fit']
                self.descriptions = ['fit type','A fit coefficient','B fit coefficient',
                                     'T0 fit coefficient','T1 fit coefficient']
            else:
                raise ValueError('Unrecognized drparams filetype {}'.format(self._drparams_filetype))
        else:
            if self._drparams_filetype == 1:
                tmp = np.array(line[2:],dtype=float)
                if index%2 == 0:
                    tmp_col = table[-1]
                    for i in range(tmp.shape[0]):
                        table.append([self._drparams_filetype,tmp_col[i],tmp[i]])
                    del table[0]
                else:
                    table.append(tmp)
            else:
                table.append([self._drparams_filetype]+line[2:])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号