field.py 文件源码

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

项目:synthesizAR 作者: wtbarnes 项目源码 文件源码
def _filter_streamlines(self, streamline, close_threshold=0.05,
                            loop_length_range: u.cm =[2.e+9, 5.e+10]*u.cm, **kwargs):
        """
        Check extracted loop to make sure it fits given criteria. Return True if it passes.

        Parameters
        ----------
        streamline : yt streamline object
        close_threshold : `float`
            percentage of domain width allowed between loop endpoints
        loop_length_range : `~astropy.Quantity`
            minimum and maximum allowed loop lengths (in centimeters)
        """
        streamline = streamline[np.all(streamline != 0.0, axis=1)]
        loop_length = np.sum(np.linalg.norm(np.diff(streamline, axis=0), axis=1))
        if np.fabs(streamline[0, 2] - streamline[-1, 2]) > close_threshold*self.extrapolated_3d_field.domain_width[2]:
            return False
        elif loop_length > loop_length_range[1].to(u.cm).value or loop_length < loop_length_range[0].to(u.cm).value:
            return False
        else:
            return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号