Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

dsatools

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsatools - npm Package Compare versions

Comparing version
0.1.80
to
0.1.86
+1
-1
dsatools.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: dsatools
Version: 0.1.80
Version: 0.1.86
Summary: The library with a most popular tools for Digital Signal Analysis (DSA)

@@ -5,0 +5,0 @@ Home-page: https://github.com/MVRonkin/dsatools

@@ -1,2 +0,2 @@

import numpy as np
import numpy as _np

@@ -48,4 +48,4 @@ __all__=['calc_phase',

'''
frequencies = np.asarray(frequencies, dtype = float)
init_phases = np.asarray(init_phases, dtype = float)
frequencies = __np.asarray(frequencies, dtype = float)
init_phases = __np.asarray(init_phases, dtype = float)

@@ -64,3 +64,3 @@ if length is None:

return 2*np.pi*np.cumsum(frequencies)*dt+init_phases
return 2*__np.pi*__np.cumsum(frequencies)*dt+init_phases

@@ -70,3 +70,3 @@ #-------------------------------------

array = np.asarray(array, dtype = float)
array = __np.asarray(array, dtype = float)

@@ -79,3 +79,3 @@ if size is None:

if array.size==1:
return np.ones(size, dtype=float)*array
return __np.ones(size, dtype=float)*array
else:

@@ -86,5 +86,5 @@ if array.size>=size:

else:
last = np.ones(size-array.size,
last = __np.ones(size-array.size,
dtype=float)*array[-1]
return np.concatenate((array,last))
return __np.concatenate((array,last))

@@ -115,3 +115,3 @@ #-------------------------------

length = int(length)
t = np.arange(length)/fs
t = __np.arange(length)/fs
return f0+delta_f*t/((length/fs))

@@ -143,5 +143,5 @@ #-------------------------------

length = int(length)
t = np.arange(length)/(2*fs)
t = __np.arange(length)/(2*fs)
tm = length/fs/2
return np.concatenate((f0+delta_f*t/tm,
return __np.concatenate((f0+delta_f*t/tm,
f0+delta_f-delta_f*t/tm))

@@ -174,5 +174,5 @@ #-------------------------------

'''
t = np.arange(length)/fs
freq = np.power(t,degree)/((length/fs))
return f0+delta_f*freq/np.max(freq)
t = __np.arange(length)/fs
freq = __np.power(t,degree)/((length/fs))
return f0+delta_f*freq/__np.max(freq)
#-------------------------------

@@ -201,5 +201,5 @@ def sin_frequency(f0, delta_f, length, fs):

'''
t = np.arange(length)/fs
t = __np.arange(length)/fs
tm = length/fs
return (f0+delta_f/2)+delta_f*np.sin(2*np.pi*t/tm)/2
return (f0+delta_f/2)+delta_f*__np.sin(2*__np.pi*t/tm)/2
#-------------------------------

@@ -228,5 +228,5 @@ def sin_quart_frequency(f0, delta_f, length, fs):

'''
t = np.arange(length)/fs
t = __np.arange(length)/fs
tm = length/fs
return (f0)+delta_f*np.sin((2*np.pi*t/tm)/4)
return (f0)+delta_f*__np.sin((2*__np.pi*t/tm)/4)

@@ -256,8 +256,8 @@ #-------------------------------

'''
t = np.arange(length)/fs
t = __np.arange(length)/fs
tm = length/fs
return (f0)+delta_f*np.sin((2*np.pi*t/tm)/2)
return (f0)+delta_f*__np.sin((2*__np.pi*t/tm)/2)
#-------------------------------
def sin_phase_frequency(f0, delta_f, length, fs, phi0=0, phiN=np.pi/4):
def sin_phase_frequency(f0, delta_f, length, fs, phi0=0, phiN=__np.pi/4):
'''

@@ -284,6 +284,57 @@ Arbitarry sinus frequency to time relation.

'''
t = np.arange(length)/fs
t = __np.arange(length)/fs
tm = length/fs
divider = np.pi/phiN
freqm = np.sin(2*np.pi*t/(tm*divider)+phi0)
divider = __np.pi/phiN
freqm = __np.sin(2*__np.pi*t/(tm*divider)+phi0)
return (f0)+delta_f*(freqm-min(freqm))/(max(freqm)-min(freqm))
#---------------------------------------
def to_beatsignal(sig_ref, sig_delayed,
reduced_ratio=None, hilbert = False):
'''
Mixing reference and delayed (received)
signals to create the beat one.
Parameters
-------------
sig_ref: 1d ndarray,
reference signal
sig_delayed: 1d ndarray,
dealyed signal
reduced_ratio: float,
pooling (or downsampling) ratio as fs_old/fs_new,
where fs is the sampling frequency,
hilbert: bool,
If ture, hilbert transform will be carried out additionally.
Returns
-------------
sig_beat: 1d ndarray,
beat signal.
'''
sig_beat = sig_ref*__np.conj(sig_delayed);
if reduced_ratio is not None:
len_reduce = int(len(sig_ref)/reduced_ratio)
sp = __np.fft.fft(sig_beat)
if hilbert is False:
sp = _np.concatenate((sp[:len_reduce//2],
[sp[len(sp)//2]],
sp[len(sp) - len_reduce//2 +1:]))
else:
sp = _np.concatenate((sp[:len_reduce//2],
[sp[len(sp)//2]],
_np.zeros(len_reduce//2 +1,
dtype=complex)))
sig_beat = _np.fft.ifft(sp)
else:
if hilbert:
sp = _np.fft.fft(sig_beat)
sp[len(sp)//2:] = 0
sig_beat = _np.fft.ifft(sp)
#TODO: add pooling
return sig_beat

@@ -15,3 +15,4 @@ from ._awgn import (awgn,

to_2d,
to_callback)
to_callback,
as1darray)

@@ -30,3 +31,5 @@ from ._probe import probe, probe_filter

cross_subsets,
corcof)
corcof,
standartize,
normalize)

@@ -33,0 +36,0 @@ from ._geometry import (calc_line,

import numpy as np
import scipy
_all__ = ['afft','cexp','cexp2pi','arg','polyval','gamma','corcof']
_all__ = ['afft','cexp','cexp2pi','arg','polyval','gamma','corcof','standartize','normalize']

@@ -188,5 +188,48 @@ #-------------------------------------------------------------------

#--------------------------------------
def standartize(vector):
'''
Standartize vector:
..math::
y = (x-min(x))/(max(x)-min(x))
Parameters
-------------
vector: 1d ndarray,
input vector
Returns
----------
vector: 1d ndarray,
output vector
'''
denum = np.max(vector) - np.min(vector)
if denum ==0:
return 0
return (vector - np.min(vector))/denum
#-------------------------------------------------------------------
#------------------------------
def normalize(vector):
'''
Normalize vector:
..math::
y = (x-mean(x))/sqrt(var(x))
Parameters
-------------
vector: 1d ndarray,
input vector
Returns
----------
vector: 1d ndarray,
output vector
'''
stdv = np.std(vector)
if stdv ==0:
return 0
return (vector - np.mean(vector))/stdv
#--------------------------------------------------
__P_GAMMA__ = [ 676.5203681218851

@@ -193,0 +236,0 @@ ,-1259.1392167224028

@@ -5,3 +5,3 @@ import numpy as np

__all__=['fixpoint','is_1d','is_complex','to_1d','to_2d','to_callback',]
__all__=['fixpoint','is_1d','is_complex','to_1d','to_2d','to_callback','as1darray']
#-------------------------------------------------------------------

@@ -27,9 +27,65 @@ # def is_numbertype(x):

def is_complex(x):
x = np.asarray(x)
return isinstance(x.dtype,complex.np._complex,np.complex,np.complex128,np.complex64)
return isinstance(x,(complex,np.complex64,np.complex128) )
#-------------------------------------------------------------------
def to_1d(x):
x = np.asarray(x)
if (np.ndim(x)==0): return np.append([],x)
else: return x
'''
Transform any data to 1d ndarray.
Parameters
----------
data: None,float,int,ndarray
dtype: data type,
Returns
--------
1d ndarray
'''
data = np.asarray(data)
if dtype is not None:
data.astype(dtype)
if np.ndim(data)==0:
return np.asarray([data])
elif np.ndim(data)==1:
return data
else:
data = np.squeeze(data)
if np.ndim(data)==1:
return data
else:
return np.ravel(data)
#-------------------------------------------------------------------
def as1darray(data, dtype = None):
'''
Transform any data to 1d ndarray.
Parameters
----------
data: None,float,int,ndarray
dtype: data type,
Returns
--------
1d ndarray
'''
data = np.asarray(data)
if dtype is not None:
data.astype(dtype)
if np.ndim(data)==0:
return np.asarray([data])
elif np.ndim(data)==1:
return data
else:
data = np.squeeze(data)
if np.ndim(data)==1:
return data
else:
return np.ravel(data)
#-------------------------------------------------------------------

@@ -36,0 +92,0 @@ def to_2d(x, column=False):

Metadata-Version: 1.1
Name: dsatools
Version: 0.1.80
Version: 0.1.86
Summary: The library with a most popular tools for Digital Signal Analysis (DSA)

@@ -5,0 +5,0 @@ Home-page: https://github.com/MVRonkin/dsatools

@@ -10,3 +10,3 @@

packages=find_packages(),
version="0.1.80",
version="0.1.86",
description=""" The library with a most popular tools for Digital Signal Analysis (DSA) """,

@@ -13,0 +13,0 @@ long_description=readme,