Skip to content
Snippets Groups Projects
Commit 7ef1e48c authored by Danilo Ferreira de Lima's avatar Danilo Ferreira de Lima
Browse files

Fixed axis for fft.

parent ac390456
No related branches found
No related tags found
1 merge request!16Added resolution calculation.
......@@ -2,4 +2,4 @@
Estimate high-resolution photon spectrometer data from low-resolution non-invasive measurements.
"""
VERSION = "0.3.1"
VERSION = "0.3.2"
......@@ -53,14 +53,14 @@ def deconv(y: np.ndarray, yhat: np.ndarray) -> Tuple[np.ndarray, np.ndarray, np.
calculate the deconvolution between them.
"""
# subtract the mean spectra to remove the FEL bandwidth
yhat_s = yhat - np.mean(yhat, keepdims=True, axis=(0, 1))
y_s = y - np.mean(y, keepdims=True, axis=(0, 1))
yhat_s = yhat - np.mean(yhat, keepdims=True, axis=0)
y_s = y - np.mean(y, keepdims=True, axis=0)
# Fourier transforms
Yhat = np.fft.fft(yhat_s)
Y = np.fft.fft(y_s)
# spectral power of the assumed "true" signal (the grating spectrometer data)
Syy = np.mean(np.absolute(Y)**2, axis=(0, 1))
Syh = np.mean(Y*np.conj(Yhat), axis=(0, 1))
Syy = np.mean(np.absolute(Y)**2, axis=0)
Syh = np.mean(Y*np.conj(Yhat), axis=0)
# approximate transfer function as the ratio of power spectrum densities
H = Syh/Syy
return np.fft.fftshift(np.fft.ifft(H)), H, Syy
......
......@@ -469,9 +469,10 @@ def plot_pes(df: pd.DataFrame,
#cax[ch].xaxis.label.set_color(col[ch])
#cax[ch].title.set_color(col[ch])
if not tof:
locator = matplotlib.ticker.MultipleLocator(2)
locator.view_limits(1000, 1010)
cax[ch].xaxis.set_major_locator(locator)
#locator = matplotlib.ticker.MultipleLocator(2)
#locator.view_limits(1000, 1010)
#cax[ch].xaxis.set_major_locator(locator)
cax[ch].set_xticks(np.arange(998, 1010, 2))
ax.legend(frameon=False, loc='center')
plt.tight_layout()
fig.savefig(filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment