[17]:
# Da Profile_class_test

%reset
%load_ext autoreload
%autoreload 2
Once deleted, variables cannot be recovered. Proceed (y/[n])? y
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload
[13]:
%qtconsole
[21]:


%matplotlib inline
[22]:
import matplotlib.pyplot as plt
import numpy as np
import os

from dataIO.span import span
from dataIO.fn_add_subfix import fn_add_subfix

from IPython.display import display
from plotting.backends import maximize
[5]:
pwd
[5]:
'C:\\Users\\kovor\\Documents\\python\\pyXTel\\pyxsurf\\pyProfile\\test'
[23]:
np
[23]:
<module 'numpy' from 'C:\\Users\\kovor\\Anaconda3\\lib\\site-packages\\numpy\\__init__.py'>

Appendix: make_signal

[ ]:
from pyProfile.profile_class import Profile
from pyProfile.profile import make_signal
[59]:
make_signal?
[46]:
# use helper function to create x and y:
x,y = make_signal(amp=10.,L=30.,N=21,nwaves=2.8,ystartend=(0,0),noise=0)

# plot them with usual matplotlib commands:
plt.plot(x,y)
[46]:
[<matplotlib.lines.Line2D at 0x184361817f0>]
../_images/notebooks_test_make_signal_9_1.png
[25]:
%matplotlib

Creo un segnale (reale). Ne creo una copia sottocampionata per test, ovviamente sono tutti valori reali.

[26]:
L=1
N=11

plt.clf()
x,y=make_signal(1,L=1,N=101,nwaves=3)
plt.plot(x,y,label='harmonic signal with 0 phase')
x,y=make_signal(1,L=1,N=N,nwaves=3)
plt.plot(x,y,'o',label='downsampled curve')
x,y=make_signal(1,L=1,N=101,nwaves=3,phase=np.pi/4)
plt.plot(x,y,label='phase pi/4')
plt.grid(1)
plt.legend(loc=0)
[26]:
<matplotlib.legend.Legend at 0x2a55959feb8>
../_images/notebooks_test_make_signal_12_1.png

Quindi ora posso creare segnali complessi arbitrari usando due segnali con stessa frequenza e fase diversa su reale e immaginario.

Questo ovviamente significa che posso usare una serie di ca N/2 armoniche per descrivere interamente il segnale, a patto di fornire anche la fase.

Option minus_one

[27]:

plt.clf() A=make_signal(1,L=1,N=N,nwaves=nwaves) plt.plot(*A) print(A[0].shape) print(A[1].shape)
<Figure size 432x288 with 0 Axes>
[28]:
# redo plot adding "minux_one option"
plt.clf()
plt.plot(*A)

plt.plot(*(make_signal(1,L=1,N=N,nwaves=nwaves,minus_one=True)),'o')

plt.grid(1)
plt.xlim([0.97,1.01])
plt.ylim([-0.2,0.1])
plt.show()
<Figure size 432x288 with 0 Axes>
[ ]:
# makes a 2d surface from matlab data
# fit 2D
# estrai profili dritti o in diagonale