visualizer.py 文件源码

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

项目:neurodriver 作者: neurokernel 项目源码 文件源码
def run(self, final_frame_name=None, dpi=300):
        """
        Starts the visualization process.

        If the property `out_filename` is set, the visualization is saved as a
        video to the disk; if not, the animation is displayed on screen.
        Please refer to documentation of `add_LPU`, `add_plot`
        and the properties of this class on how to configure the visualizer
        before calling this method. An example can be found in the class doc
        string.

        Parameters
        ----------
        final_frame_name : str, optional
            If specified, the final frame of the animation is saved
            to disk.
        dpi : int, default=300
            Resolution at which final frame is saved to disk if
            `final_frame_name` is specified.

        Notes
        -----
        If `update_interval` is set to 0 or None, it will be replaced by the
        index of the final time step. As a result, the visualizer will only
        generate and save the final frame if `final_frame_name` is set.
        """

        self.final_frame_name = final_frame_name
        self._initialize()
        if not self._update_interval:
            self._update_interval = self._maxt
            self._t = self._maxt
        if self._update_interval == -1:
            self._update_interval = max(np.asarray(self._dts.values()))*50
        for _ in np.arange(self._t,self._maxt*(1+np.finfo(float).eps),
                           self._update_interval):
            self._update()
        if final_frame_name is not None:
            self.f.savefig(final_frame_name, dpi=dpi)
        if self.out_filename:
            self._close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号