← Back
Editing: _bsplines.cpython-311.pyc
� d�c)M � � � d dl mZmZmZmZmZmZmZmZm Z m Z mZ d dlm Z mZmZmZmZmZmZmZmZ ddlmZmZ d dlmZ d dlmZ g d�Zdd �Zi Zd � Z d� Z!d� Z"d � Z#d� Z$d� Z%d� Z&d� Z'd� Z(d� Z)d� Z*dd�Z+dd�Z,dd�Z-dd�Z.dS )� )�logical_and�asarray�pi� zeros_like� piecewise�array�arctan2�tan�zeros�arange�floor) �sqrt�exp�greater�less�cos�add�sin� less_equal� greater_equal� )� cspline2d�sepfir2d)�comb)�float_factorial) � spline_filter�bspline�gauss_spline�cubic� quadratic� cspline1d� qspline1d�cspline1d_eval�qspline1d_eval� @c �� � | j j }t g d�d� � dz }|dv r}| � d� � } t | j |� � }t | j |� � }t |||� � }t |||� � }|d|z z � |� � }nJ|dv r7t | |� � }t |||� � }|� |� � }nt d� � �|S ) a3 Smoothing spline (cubic) filtering of a rank-2 array. Filter an input data set, `Iin`, using a (cubic) smoothing spline of fall-off `lmbda`. Parameters ---------- Iin : array_like input data set lmbda : float, optional spline smooghing fall-off value, default is `5.0`. Returns ------- res : ndarray filterd input data Examples -------- We can filter an multi dimentional signal (ex: 2D image) using cubic B-spline filter: >>> import numpy as np >>> from scipy.signal import spline_filter >>> import matplotlib.pyplot as plt >>> orig_img = np.eye(20) # create an image >>> orig_img[10, :] = 1.0 >>> sp_filter = spline_filter(orig_img, lmbda=0.1) >>> f, ax = plt.subplots(1, 2, sharex=True) >>> for ind, data in enumerate([[orig_img, "original image"], ... [sp_filter, "spline filter"]]): ... ax[ind].imshow(data[0], cmap='gray_r') ... ax[ind].set_title(data[1]) >>> plt.tight_layout() >>> plt.show() )� �?g @r'