Skip to content

Commit

Permalink
Added warning for time
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliovv committed Oct 30, 2021
1 parent 0823f24 commit 473f7e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file added dist/tfest-0.1.11.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions tfest.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Metadata-Version: 2.1
Name: tfest
Version: 0.1.10
Version: 0.1.11
Summary: Transfer function estimation based on frequency response.
Home-page: https://github.com/giuliovv/tfest
Author: Giulio Vaccari
Author-email: io@giuliovaccari.it
License: MIT
Download-URL: https://github.com/giuliovv/tfest/archive/refs/tags/v0.1.10-alpha.tar.gz
Download-URL: https://github.com/giuliovv/tfest/archive/refs/tags/v0.1.11-alpha.tar.gz
Description: # Tfest
Transfer function estimation with frequency response. Only works for SISO systems for now.
Python equivalent of MATLAB tfest
Expand Down
6 changes: 5 additions & 1 deletion tfest/tfest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import matplotlib.pyplot as plt
import numpy as np
import warnings

from matplotlib.mlab import psd, csd
from scipy.optimize import minimize
Expand Down Expand Up @@ -33,13 +34,16 @@ def loss(self, x, nzeros, freq, H):
risp /= np.array([np.polyval(poles, s) for s in 1j*freq])
return np.linalg.norm((risp-H).reshape(-1, 1), axis=1).sum() #+ np.abs(x).sum()

def frequency_response(self, method="h1", time=1):
def frequency_response(self, method="h1", time=None):
"""
method: "fft" or "h1" (default) or "h2"
time: time for fft
return: frequency response and frequency
"""
if time == None:
warnings.warn("Setting default time=1")
time = 1
if method == "fft":
u_f = fft(self.u)
y_f = fft(self.y)
Expand Down

0 comments on commit 473f7e4

Please sign in to comment.