diff --git a/.buildinfo b/.buildinfo index d12cc026..2a98bb5b 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: fe8c1d3b967b2eeecf9897aaafb268bf +config: c65022d8955ccc77a4cb9446efae7850 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_modules/index.html b/_modules/index.html index f5c0aba3..dfd6ed1a 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -22,7 +22,7 @@
@@ -125,7 +125,7 @@ All modules for which code is available
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
@@ -360,7 +360,7 @@
@@ -487,7 +487,7 @@
@@ -924,7 +924,7 @@
@@ -569,7 +569,7 @@
@@ -205,7 +205,7 @@
@@ -934,7 +934,7 @@
@@ -3851,7 +3851,7 @@
@@ -366,7 +366,7 @@
@@ -234,7 +234,7 @@
@@ -772,7 +772,7 @@
@@ -570,7 +570,7 @@
@@ -304,7 +304,7 @@
@@ -153,7 +153,7 @@
@@ -1003,7 +1003,7 @@
@@ -249,7 +249,7 @@
@@ -2087,7 +2087,7 @@
@@ -3028,7 +3028,7 @@
@@ -821,7 +821,7 @@
@@ -455,7 +455,7 @@
@@ -384,7 +384,7 @@
@@ -792,7 +792,7 @@
@@ -372,7 +372,7 @@
@@ -87,7 +87,7 @@
@@ -950,7 +950,7 @@
@@ -246,7 +246,7 @@
@@ -986,7 +986,7 @@
@@ -242,7 +242,7 @@
@@ -114,7 +114,7 @@
@@ -285,7 +285,7 @@
@@ -134,7 +134,7 @@
@@ -162,7 +162,7 @@
@@ -134,7 +134,7 @@
@@ -156,7 +156,7 @@
@@ -112,7 +112,7 @@
@@ -130,7 +130,7 @@
@@ -167,7 +167,7 @@
@@ -118,7 +118,7 @@
Source code for pwtools.arrayio
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.base
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.batch
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.calculators
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.comb
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.common
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.crys
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.dcd
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.decorators
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.eos
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.io
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.kpath
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.lammps
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.mpl
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.mttk
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.num
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.parse
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.pwscf
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.pydos
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.random
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.rbf.core
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.rbf.hyperopt
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Quick search
Source code for pwtools.signal
"""
-Some general signal procressing tools (FFT, correlation). Mostly textbook and
+Some general signal processing tools (FFT, correlation). Mostly textbook and
reference implementations plus some utilities.
"""
@@ -518,9 +518,9 @@
Source code for pwtools.signal
The x-axis is the offset "t" (or "lag" in Digital Signal Processing lit.).
Since the ACF is symmetric around t=0, we return only t=0...len(v)-1 .
- Several Python and Fortran implememtations. The Python versions are mostly
+ Several Python and Fortran implementations. The Python versions are mostly
for reference and are slow, except for fft-based, which is by far the
- fastet.
+ fastest.
Parameters
----------
@@ -599,7 +599,7 @@
Source code for pwtools.signal
return _flib.acorr(v, c, 2, _norm)
elif method == 7:
# Correlation via fft. After ifft, the imaginary part is (in theory) =
- # 0, in practise < 1e-16, so we are safe to return the real part only.
+ # 0, in practice < 1e-16, so we are safe to return the real part only.
vv = np.concatenate((v, np.zeros((nstep,),dtype=float)))
c = ifft(np.abs(fft(vv))**2.0)[:nstep].real
else:
@@ -707,9 +707,13 @@
Source code for pwtools.signal
def smooth(data, kern, axis=0, edge='m', norm=True):
"""Smooth N-dim `data` by convolution with a kernel `kern`.
- Uses scipy.signal.fftconvolve().
+ Uses ``scipy.signal.fftconvolve()``.
- Note that due to edge effect handling (padding) and kernal normalization,
+ Note: This function is actually a special case of
+ ``scipy.ndimage.convolve()``, so you may also use that. See the Notes
+ section below for details.
+
+ Note that due to edge effect handling (padding) and kernel normalization,
the convolution identity convolve(data,kern) == convolve(kern,data) doesn't
apply here. We always return an array of ``data.shape``.
@@ -792,6 +796,7 @@
Source code for pwtools.signal
References
----------
[1] http://wiki.scipy.org/Cookbook/SignalSmooth
+ [2] https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.convolve.html#scipy.ndimage.convolve
See Also
--------
@@ -801,6 +806,30 @@
Source code for pwtools.signal
Notes
-----
+ ``scipy.ndimage.convolve``:
+
+ We only apply padding and convolution along `axis` (since the main ndarray
+ use case is :func:`pwtools.crys.smooth`), while ``ndimage.convolve``
+ supports this for all dimensions. Also ``ndimage.convolve`` has more edge
+ effect handling methods available :-)
+
+ >>> a=rand(100,200,300)
+ >>> k=rand(3,1,1)
+
+ >>> # Defaults
+ >>> np.allclose(pwtools.signal.smooth(a, k, edge="m", norm=True, axis=0),
+ ... scipy.ndimage.convolve(a, k/k.sum(), mode="mirror"))
+
+ >>> # Without kernel normalization
+ >>> np.allclose(pwtools.signal.smooth(a, k, edge="m", norm=False, axis=0),
+ ... scipy.ndimage.convolve(a, k, mode="mirror"))
+
+ >>> # Use another axis and another edge method
+ >>> k=rand(1,3,1)
+ >>> np.allclose(pwtools.signal.smooth(a, k, edge="c", norm=True, axis=1),
+ ... scipy.ndimage.convolve(a, k/k.sum(), mode="nearest"))
+
+
Kernels:
Even kernels result in shifted signals, odd kernels are better.
@@ -846,7 +875,7 @@
Source code for pwtools.signal
>>> kern = scipy.signal.hann(101)
>>> ret = scipy.signal.fftconvolve(arr, kern[:,None,None])
- Then it is better to loop over some or all of the remaing dimensions::
+ Then it is better to loop over some or all of the remaining dimensions::
>>> ret = np.empty_like(arr)
>>> for jj in range(arr.shape[1]):
@@ -858,7 +887,7 @@
Source code for pwtools.signal
>>> for kk in range(arr.shape[2]):
>>> ret[:,jj,kk] = smooth(arr[:,jj,kk], kern)
- The size of the chunk over which you explicitely loop depends on the data
+ The size of the chunk over which you explicitly loop depends on the data
of course. We do exactly this in :func:`pwtools.crys.smooth`.
"""
# edge = 'm'
@@ -935,7 +964,7 @@
Source code for pwtools.signal
def odd(n, add=1):
"""Return next odd integer to `n`.
- Can be used to construt odd smoothing kernels in :func:`smooth`.
+ Can be used to construct odd smoothing kernels in :func:`smooth`.
Parameters
----------
@@ -1027,7 +1056,7 @@
Source code for pwtools.signal
window : string or tuple of string and parameter values
Desired window to use. See `scipy.signal.get_window` for a list
of windows and required parameters. Default is "hamming". Ignored
- if `width` and `ripple` givem b/c then ``kaiserord`` is used to
+ if `width` and `ripple` given b/c then ``kaiserord`` is used to
build a Kaiser window.
mode : str
'lowpass', 'highpass', 'bandpass', 'bandstop'
@@ -1086,7 +1115,7 @@
Source code for pwtools.signal
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.sql
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.symmetry
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.thermo
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.timer
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.verbose
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
Source code for pwtools.visualize
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
_dcd¶Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools._flib.html b/generated/api/__sphinx_autodoc_module__pwtools._flib.html
index 90c81c89..8153987c 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools._flib.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools._flib.html
@@ -25,7 +25,7 @@
_flib¶<
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.arrayio.html b/generated/api/__sphinx_autodoc_module__pwtools.arrayio.html
index 6cad2e20..3088661e 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.arrayio.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.arrayio.html
@@ -25,7 +25,7 @@
arrayio¶
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.atomic_data.html b/generated/api/__sphinx_autodoc_module__pwtools.atomic_data.html
index 2dddcbb4..eeddbce4 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.atomic_data.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.atomic_data.html
@@ -25,7 +25,7 @@
atomic_dataSphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.base.html b/generated/api/__sphinx_autodoc_module__pwtools.base.html
index 16be3806..3b3de57d 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.base.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.base.html
@@ -25,7 +25,7 @@
base¶
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.batch.html b/generated/api/__sphinx_autodoc_module__pwtools.batch.html
index f645cb06..857942a6 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.batch.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.batch.html
@@ -25,7 +25,7 @@
batch¶
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.calculators.html b/generated/api/__sphinx_autodoc_module__pwtools.calculators.html
index a82c3ee8..0ef8b7ac 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.calculators.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.calculators.html
@@ -25,7 +25,7 @@
calculatorsSphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.comb.html b/generated/api/__sphinx_autodoc_module__pwtools.comb.html
index aae6a5ba..776abcda 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.comb.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.comb.html
@@ -25,7 +25,7 @@
comb¶
©2023, Steve Schmerler.
|
- Powered by Sphinx 7.3.7
+ Powered by Sphinx 7.4.6
& Alabaster 0.7.16
|
diff --git a/generated/api/__sphinx_autodoc_module__pwtools.common.html b/generated/api/__sphinx_autodoc_module__pwtools.common.html
index ee53cdd1..e7e9e451 100644
--- a/generated/api/__sphinx_autodoc_module__pwtools.common.html
+++ b/generated/api/__sphinx_autodoc_module__pwtools.common.html
@@ -25,7 +25,7 @@