← Back
Editing: test_ltisys.cpython-311.pyc
� d�cݸ � �x � d dl Z d dlZd dlmZmZmZmZmZ d dl m Z d dlm Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dl m!Z! d dl"m#Z# d+d�Z$ G d � d � � Z% G d� d� � Z& G d � d� � Z' G d� d� � Z( G d� d� � Z) G d� de)� � Z* G d� de)� � Z+ G d� d� � Z, G d� de,� � Z- G d� de,� � Z. G d� d� � Z/ G d� d � � Z0 G d!� d"� � Z1 G d#� d$� � Z2 G d%� d&� � Z3 G d'� d(� � Z4 G d)� d*� � Z5dS ),� N)�assert_almost_equal�assert_equal�assert_allclose�assert_�suppress_warnings)�raises)�ss2tf�tf2ss�lsim2�impulse2�step2�lti�dlti�bode�freqresp�lsim�impulse�step�abcd_normalize�place_poles�TransferFunction� StateSpace�ZerosPolesGain)�BadCoefficients)�matrix�:�0�yE>c �� � |� � � }| D ]�}d}t |j d � � D ]�}t j t j |� � t j |� � gt j || � � t j || � � g||� � rd}t j ||� � n��|s2t dt |� � z dz t |� � z � � ���dS )a Check each pole in P1 is close to a pole in P2 with a 1e-8 relative tolerance or 1e-8 absolute tolerance (useful for zero poles). These tolerances are very strict but the systems tested are known to accept these poles so we should not be far from what is requested. Fr TzCan't find pole z in N) �copy�range�shape�np�allclose�real�imag�delete� ValueError�str)�P1�P2�rtol�atol�p1�found�p2_idxs �@/usr/lib/python3/dist-packages/scipy/signal/tests/test_ltisys.py�_assert_poles_closer0 s � � �����B�� N� N�����B�H�Q�K�(�(� � �F��{�B�G�B�K�K������5��G�B�v�J�/�/����F��1D�1D�E���'� '� � ��� �"�f�%�%�%��� � � N��/�#�b�'�'�9�F�B�S��W�W�L�M�M�M� N� N� N� c �, � e Zd Zd� Zd� Zd� Zd� Zd� ZdS )�TestPlacePolesc � � t |||fi |��}t j � |t j ||j � � z � � \ }}t ||j � � t ||j � � t ||j � � |S )z� Perform the most common tests on the poles computed by place_poles and return the Bunch object for further specific tests ) r r! �linalg�eig�dot�gain_matrixr0 �requested_poles�computed_poles)�self�A�B�P�kwargs�fsf�expected�_s r/ �_checkzTestPlacePoles._check( s� � � �!�Q��,�,�V�,�,���i�m�m�A���q�#�/�(B�(B�$B�C�C���!��H�c�&9�:�:�:��H�c�&8�9�9�9��A�c�1�2�2�2�� r1 c �� � t j g d�� � � dd� � }t j g d�� � � dd� � }t j g d�� � }| � |||d�� � | � |||d�� � t j d � � � 5 | � ||d� � d d d � � d S # 1 swxY w Y d S )N�g�G�z�?g�����ʿg\��(�@gNbX9��g�<,Ԛ�g)\��(�r g�������?g�O��n�?�d;�O�@gV-���g�O��n�@g�~j�t��?rF g�rh��|�?g�E��� �� )r ���K�@�V-�?rI r r �^�I+ �r � �皙����ɿ� �g}гY�9�g�D��T!��KNV0��method�YT�ignore)�invalid)rK rK � rU )r! �array�reshaperC �errstate)r; r<