simulation.py 文件源码

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

项目:pyinduct 作者: pyinduct 项目源码 文件源码
def get_results(self, time_steps, result_key="output", interpolation="nearest", as_eval_data=False):
        """
        return results from internal storage for given time steps.
        .. warning:: calling this method before a simulation was run will result in an error.

        :param time_steps: time points where values are demanded
        :param result_key: type of values to be returned
        :param interpolation: interpolation method to use if demanded time-steps are not covered by the storage,
            see :func:`scipy.interpolate.interp1d` for all possibilities
        :param as_eval_data: return results as EvalData object for straightforward display
        """
        func = interp1d(np.array(self._time_storage), np.array(self._value_storage[result_key]),
                        kind=interpolation, assume_sorted=True, axis=0)
        values = func(time_steps)

        if as_eval_data:
            return EvalData([time_steps], values, name=".".join([self.name, result_key]))

        return values
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号