solldavid / twistpy Goto Github PK
View Code? Open in Web Editor NEWToolbox for Wavefield Inertial Sensing Techniques
License: GNU Lesser General Public License v3.0
Toolbox for Wavefield Inertial Sensing Techniques
License: GNU Lesser General Public License v3.0
Hi David,
Is it possible to add an option to plot the frequency of polarization analysis and filtering in log scale?
Thanks for your help!
Best,
Angel
Greetings,
I'm Fu, and very nice package! When i use the beamforming method, I modify some of your code to get the array response function
, but the results look like very weird.
According to the book 2018 seismic ambient noise
, I set the cross spectral density C
matrix to be the identity matrix in the following, I don't it is correct or not?
Best,
Fu
# number of stations
N = coordinates.shape[0]
# compute steering_vectors
frequency = np.mean(freq_band)
n_vel, n_inc, n_azi, steering_vectors = compute_steering_vectors(
coordinates,
reference_receiver,
dest_epsg,
frequency,
velocity,
inclination,
azimuth,
)
# compute covariance matrix
C = np.ones((N, N), dtype=np.complex128)
# compute beamforming power
P: np.ndarray = np.einsum(
"sn, nk, sk->s",
steering_vectors.conj(),
C,
steering_vectors,
optimize=True,
)
# reshape beamforming power
P_reshape = np.reshape(P, (n_inc, n_azi, n_vel))
P = np.real(P_reshape)
and the function compute_steering_vectors
:
def compute_steering_vectors(
coordinates,
reference_receiver,
dest_epsg,
frequency: float,
velocity: Union[float, tuple] = 6000,
inclination: Union[float, tuple] = (-90, 90, 1),
azimuth: tuple = (0, 360, 1),
) -> None:
r"""Precompute the steering vectors
Compute the steering vectors for the specified parameter range. For parameters that are specified as a tuple,
the grid search is performed over the range: (min_value, max_value, increment)
Parameters
----------
frequency : :obj:`float`
Discrete frequency at which beamforming is performed
velocity : :obj:`float` or :obj:`tuple`
Specifies the velocity as a float (if known) or grid over which search is performed
inclination : :obj:`tuple`
Specifies inclination grid over which search is performed
azimuth : :obj:`tuple`
Specifies azimuth grid over which search is performed
"""
# number of stations
N = coordinates.shape[0]
# compute inclination, azimuth and velocity vectors
if isinstance(velocity, tuple):
velocity_gridded = np.arange(
velocity[0],
velocity[1] + velocity[2],
velocity[2],
)
else:
velocity_gridded = np.array([velocity])
if isinstance(inclination, tuple):
inclination_gridded = np.radians(
np.arange(
inclination[0],
inclination[1] + inclination[2],
inclination[2],
)
)
else:
inclination_gridded = np.radians(np.array([inclination]))
azimuth_gridded = np.radians(
np.arange(azimuth[0], azimuth[1] + azimuth[2], azimuth[2])
)
n_vel = len(velocity_gridded)
n_inc = len(inclination_gridded)
n_azi = len(azimuth_gridded)
# create grid
inclination_gridded, azimuth_gridded, velocity_gridded = np.meshgrid(
inclination_gridded, azimuth_gridded, velocity_gridded, indexing="ij"
)
# compute relative coordinates, and convert lat/lon/elev to y/x/z
utm_x, utm_y = latlon_2_utm(
coordinates[:, 0], coordinates[:, 1], dest_epsg=dest_epsg
)
coords_utm = np.column_stack((utm_x, utm_y, coordinates[:, 2]))
coords = coords_utm - np.tile(coords_utm[reference_receiver, :], (N, 1))
coords = np.asmatrix(coords)
# compute wave vector and wave number
wave_vector_x = (np.sin(inclination_gridded) * np.cos(azimuth_gridded)).ravel()
wave_vector_y = (np.sin(inclination_gridded) * np.sin(azimuth_gridded)).ravel()
wave_vector_z = (np.cos(inclination_gridded)).ravel()
wave_vector_x, wave_vector_y, wave_vector_z = (
np.asmatrix(wave_vector_x).T,
np.asmatrix(wave_vector_y).T,
np.asmatrix(wave_vector_z).T,
)
wave_number = (-2 * np.pi * frequency / velocity_gridded).ravel()
wave_number = np.asmatrix(wave_number).T
# compute steering vectors, steering_vectors = exp(i * k * np.dot(wave_vector * coords))
steering_vectors: np.ndarray = np.exp(
1j
* np.multiply(
np.tile(wave_number, (1, N)),
(
wave_vector_x * coords[:, 0].T
+ wave_vector_y * coords[:, 1].T
+ wave_vector_z * coords[:, 2].T
),
)
)
# ensure that steering vectors are unit vectors
steering_vectors = steering_vectors / np.sqrt(N)
return n_vel, n_inc, n_azi, steering_vectors
Hi David,
Is it possible to add an option to save the polarization attribute plot of polarization analysis and filtering?
Thanks!
Best,
Angel
Dear Dr.Solldavid
Thanks for sharing this great package.
When I try run dispersion.py
It seems lacking "../example_data/SWM/SWM_proper_preprocessing.mseed".
Best regards,
Xi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.