Git Product home page Git Product logo

pydynamic's People

Contributors

amunizp avatar bjoernludwigptb avatar bruns01 avatar eichstaedtptb avatar ma-weber avatar mgrub avatar plkruseptb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pydynamic's Issues

Implement discrete wavelet transformation

  • simplify the FIRuncFilter function for certain filter coefficients (Uab == zero) in a new function
  • use this simplified function to build a single wavelet-block (of user specified type)
  • recursivly use wavelet blocks up to build a full discrete wavelet transform

Initial sketch/idea:
WIN_20191015_11_26_57_Pro (2)

document phase range

In the source of
PyDynamic/uncertainty/propagate_DFT.py
it states in the function DFT2AmpPhase()
P: np.ndarray
vector of phase values

It would be helpful to know the possible interval (-pi:pi) or (0:2pi) or (-180:180)
whatsoever. I confess, that I didn't check the web documentation for that information.

By the Way "DFT2AmpPhase" is in fact a "DFT2MagPhase".
This is the very common confusion of amplitude (oszillation/sine) and magnitude (vector/complex number/transfer function).
But I fear it would be a mess to change that now.

VisibleDeprecationWarning

PyDynamic installed/updated via "pip" on 18.10.2016:

/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:594: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
rH, iH = H[:N/2+1], H[N/2+1:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:595: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
rY, iY = Y[:N/2+1], Y[N/2+1:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:597: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
Yc = Y[:N/2+1] + 1j_Y[N/2+1:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:598: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
Hc = H[:N/2+1] + 1j_H[N/2+1:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:68: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
v1 = V[:N]; v2 = V[N:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:69: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
w1 = W[:N]; w2 = W[N:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:83: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
A = M[:N,:N]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:84: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
B = M[:N,N:]
/usr/local/lib/python3.5/dist-packages/PyDynamic/uncertainty/propagate_DFT.py:85: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
D = M[N:,N:]

Update graphic in Readme.md

We should update the image PyDynamic modules and think about a workflow for doing so in the future (for example when we rename the modules while working on issue #31.

mask-parameter in GUM_iDFT

This is a (nasty) side effect of the introduction of the mask parameter for GUM_DFT.
For example:
If the DC (0 Hz) component of a signal was removed by masking it "0" in GUM_DFT then the argument to a subsequent GUM_iDFT is lacking the first real and first imaginary component without knowing about that.
This leads to an erroneous (distorted) output.
The "0"-masked components could be zero-padded in GUM_iDFT for one possible solution.

support for large sparse covariance matrices

Some routines in the package make use of
np.random.multivariate_normal(...)
which samples from a multivariate normal distribution based on information
given by the covariance matrix in the arguments to the call.
In many cases of dynamic measurements long time series of combinations of time series
lead to very large but (very) sparse covariance matrices. These cannot be handled efficiently
by np.random.multivariate_normal().
A dedicated function fit to deal efficiently with scipy.sparse-matrices would be much appreciated!

Clean doc folder

Become sure about what is needed and what are uneccessary leftovers from previous builds and delete them.

Inconsistent function signature

The following function definition in PyDynamic-1.2.61\PyDynamic\uncertainty\propagate_DFT.py use slightly different orders of the parameters (Y,X,UY,UX vs. Y,UY,X,UX). This need special attention for the user and might be a pitfall when changing from multiplication to division.
def DFT_transferfunction(X, Y, UX, UY):
def DFT_deconv(H, Y, UH, UY):
def DFT_multiply(Y, UY, F, UF=None):
Maybe introduce an additional function DFT_divide(Y, UY, X, UX) for calculation of Y/X.
Additionaly, for me, the order of parameters “numerator followed by denominator” is more intuitive. In DFT_deconv and DFT_transferfunction the order is “denominator followed by numerator”.

Proposal: GUM_DFT and long data sets

For long data sets the size of the covariance matrix calculated in GUM_DFT(...) gets prohibitiv.
In many cases however, the analysis is only interested in a (small) subset of the complete frequency range.
Hence it would be beneficial to have a means to select a subset of the frequencies in a parameter of GUM_DFT with the covariance matrix only calculated for that subset.
The subset could be selected by

  • maximum frequency
  • minimum and maximum frequency
  • Boolean vector of indices (optimal)
  • ...

knowing the frequencies of the GUM_DFT

For consistency reasons it would be helpful to have a function
uncertainty.propagate_DFT.GUM_DFTfreq(N,dt)
which returns a vector of frequencies related to the result of GUM_DFT(...)
See also numpy.fftfreq(...) or scipy.fftpack.fftfreq(...)

enhance warning messages

It would improve debugging efficiency in application development, if warnings from
PyDynamic subroutines would start with the name of the respective routine.
Like:
"DFT2AmpPhase: Some amplitude values are below the defined threshold "
instead of just
"Some amplitude values are below the defined threshold"

Issues on Time2AmpPhase_multi function

Line F, UF, CX = GUM_DFT(x[m,:], Ux[m], CxCos, CxSin, returnC=True) works when there is no CX.

Lines:
A[m,:] = A_m[selector]
P[m,:] = P_m[selector]
UAP[m,:ns] = UAP_m.data[0][:N][selector]
UAP[m,ns:2ns] = UAP_m.data[1][UAP_m.offsets[1]:2N+UAP_m.offsets[1]][selector]
UAP[m, 2*ns:] = UAP_m.data[0][N:][selector]

Error: Subdimensional views are not implemented.

testsignals.py uses scipy.misc.comb, which is deprecated starting in scipy_1.0.0

https://github.com/eichstaedtPTB/PyDynamic/blob/6ee0983a31ac80b0f7d279f6bb87f4d0229c9f37/PyDynamic/misc/testsignals.py#L14

"requirements.txt" states, that "scipy=1.0.0": https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.misc.comb.html#scipy.misc.comb

In order to be able to use later versions of scipy, this can be fixed by exchanging the import line to:

from scipy.special import comb

This will cause no incompatibilities, as the required version of scipy already only provides backwards-comptability-links to scipy.misc.comb.

Missing np.diag in propagate_dft

In uncertainty.propagate_dft the calculation of uf is missing an np.diag for the case that the input uncertainty is a full covariance matrix.

Rename deconvolution and identification to model_estimation

To avoid unambiguous method naming we will combine all methods from identification and devonvolution in one new module model_estimation including the fit_filter.py methods with same namings in both modules. That requires us to rename some methods out of devonvolution.fit_filter.py. Because of the following incompatibility with previous versions of PyDynamic we need to insert a deprecation warning into the next minor release and inform users about the upcoming change.

Documentation: Deconvolution calculates transfer function

The function
DFT_deconv (H, Y, UH, UY)
can be used to calculate the transfer function H(f) in the frequency domain by using
H,UH = DFT_deconv (Y, X, UY, UX).
Although this is in many cases a primary question when starting from calibration measurements
it is a "well hidden" feature so far.
This feature fills an important gap and should be exposed in the documentation.
It may even be worthwhile to create an additional function pointer/hook
DFT_TransferFunc = DFT_deconv
in order to make code more readable, that makes use of this feature.

UMC_generic: enable multi-dimensional samples

So far, the UMC_generic function expects samples with only one dimension (aka a vector). This should be generalized for even more generic use-cases.

If possible, the histogram-feature should be expanded to the multi-dim case.

Allow zero uncertainty of filter-parameters in IIRuncFilter

In uncertainty.propagate_filter.IIRuncFilter allow to have zero uncertainty of filter-parameters.

Remark:

  • task seems obsolet, uncertainty Uy takes full account of changes in Uab, as published in equation 12 of the associated paper
  • modifications/variations of Uab in IIR-example show very good agreement between IIRuncFilter and Monte-Carlo-method - independent of Uab being zero or not.



Output with Uab != 0
uncertainty_not_equal_zero



Output with Uab == 0
uncertainty_equal_zero



Issue generated from in-code-TODO, see #41

Wrong comment in identification/fit_filter.py

In the comments explaining the parameters of the function
fit_filter( ... )
it reads

justFit: boolean, when true stabilization is carried out.

To my understanding it should read (inversely):
justFit: boolean, when true stabilization is not carried out.

Error in fit_sos of Devel Branch

The call:
p,up = fit_sos((data['f']), (data['h']), UH=(data['uh']))

leads to errors in np.linalg.solve (c.f. below).

type f: float64
shape f: (161,)
type h: float64
shape h: (322,)
type uh: float64
shape uh: (322, 322)

h,uh are results of DFT_deconv(...)
f is result of GUM_DFTfreq()

Messages:

/home/bruns01/PTB/Python/Stoszauswertung_tdms/fit_transfer.py:60: RuntimeWarning: covariance is not positive-semidefinite.
HRI = np.random.multivariate_normal(H, UH, runs)
/home/bruns01/PTB/Python/Stoszauswertung_tdms/fit_transfer.py:105: RuntimeWarning: divide by zero encountered in true_divide
iri = np.r_[np.real(1 / H), np.imag(1 / H)]
Traceback (most recent call last):
File "/home/bruns01/PTB/Python/Stoszauswertung_tdms/Shock_PyDynamic.py", line 177, in Identify_total
self.Identify_singles()
File "/home/bruns01/PTB/Python/Stoszauswertung_tdms/Shock_PyDynamic.py", line 262, in Identify_singles
p,up = fit_sos((data['f']), (data['h']), UH=(data['uh']))
File "/home/bruns01/PTB/Python/Stoszauswertung_tdms/fit_transfer.py", line 112, in fit_sos
XVy = (X.T).dot(np.linalg.solve(W, iri))
File "/usr/lib/python3/dist-packages/numpy/linalg/linalg.py", line 384, in solve
r = gufunc(a, b, signature=signature, extobj=extobj)
ValueError: solve1: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (m,m),(m)->(m) (size 644 is different from 322)

fit_sos: Consistent handling of complex inputs and outputs.

As an example:
DFTdeconv(...) returns the (mathematically) complex values of the result X as an np.array of dtype float64
generated by hstack-ing the real and imaginary parts.

fit_transfer.fit_sos(...) in turn expects a complex input "H" (dtype=complex)
(c.f. devel branch)
The whole package should use a consistent transfer (input/output) of complex valued vectors or matrices.
Preferably by using dtype complex where ever appropriate, to avoid any confusion.

Include matrix structure information in GUM_DFT and related methods

The method GUM_DFT returns two numpy arrays. The docstring of that method should include an information for the interpretation of these arrays. That is, add information where real and where imaginary parts are stored.
The same should be done for all methods in that module.

Add python version to prerequisites

We have to choose a package manager (conda or pip) to maintain the dependencies and then setup the according mechanism in the repo environment.yml or requirements.txt.

Proposal: support for resampling/upsampling in GUM_iDFT

The method GUM_iDFT has a parameter Nx=... which is meant to represent the requested number of samples in the time domain. However, in the current implementation this is limited by the number of frequencies available. Hence, upsampling of a band limited signal is not possible for now.
Subsequently applied scipy.signal.resample() calls will again operate in the frequency domain using fft and ifft.
Therefore it seems reasonable to include an upsampling option in GUM_iDFT.

Include corr_noise unambiguously in the public interface

The class corr_noise is part of the testsignals module inside misc package. It is mentioned in PyDynamic's assignment of __all__ but not in the package level assignment. It should be mentioned in all relevant occuring assignments of __all__.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.