DASPy-toolbox 1.1.3__tar.gz → 1.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/PKG-INFO +1 -1
  2. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/PKG-INFO +1 -1
  3. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/channel.py +45 -12
  4. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/dasdatetime.py +0 -2
  5. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/section.py +1 -1
  6. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/setup.py +1 -1
  7. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/SOURCES.txt +0 -0
  8. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/dependency_links.txt +0 -0
  9. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/entry_points.txt +0 -0
  10. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/requires.txt +0 -0
  11. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/DASPy_toolbox.egg-info/top_level.txt +0 -0
  12. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/LICENSE +0 -0
  13. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/README.md +0 -0
  14. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/__init__.py +0 -0
  15. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/__init__.py +0 -0
  16. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/decomposition.py +0 -0
  17. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/denoising.py +0 -0
  18. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/fdct.py +0 -0
  19. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/advanced_tools/strain2vel.py +0 -0
  20. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/basic_tools/__init__.py +0 -0
  21. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/basic_tools/filter.py +0 -0
  22. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/basic_tools/freqattributes.py +0 -0
  23. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/basic_tools/preprocessing.py +0 -0
  24. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/basic_tools/visualization.py +0 -0
  25. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/__init__.py +0 -0
  26. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/collection.py +0 -0
  27. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/example.pkl +0 -0
  28. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/read.py +0 -0
  29. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/daspy/core/write.py +0 -0
  30. {daspy_toolbox-1.1.3 → daspy_toolbox-1.1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DASPy-toolbox
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
4
  Summary: DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing, which comprises classic seismic data processing techniques and Specialized algorithms for DAS applications.
5
5
  Home-page: https://github.com/HMZ-03/DASPy
6
6
  Author: Minzhe Hu, Zefeng Li
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DASPy-toolbox
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
4
  Summary: DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing, which comprises classic seismic data processing techniques and Specialized algorithms for DAS applications.
5
5
  Home-page: https://github.com/HMZ-03/DASPy
6
6
  Author: Minzhe Hu, Zefeng Li
@@ -398,29 +398,62 @@ def channel_spacing(geometry, depth_info=False):
398
398
  return dist
399
399
 
400
400
 
401
- def closest_channel_to_point(geometry, point):
401
+ def distance_to_channels(geometry, points):
402
+ """
403
+ Calculate the distance from a point to each channel.
404
+
405
+ :param geometry: numpy.ndarray. It needs to consist of two columns (
406
+ longitude, latitude), three columns (longitude, latitude and depth).
407
+ :param points: numpy.ndarray. A array consisting of longitude and
408
+ latitude or longitude, latitude and depth.
409
+ :return: numpy.ndarray. The distance from the given point to each channel.
410
+ """
411
+ if geometry.shape[1] == 3:
412
+ depth_info = True
413
+ else:
414
+ depth_info = False
415
+
416
+ nch = len(geometry)
417
+ points = np.array(points)
418
+ if points.ndim == 1:
419
+ points = points.reshape(1, -1)
420
+ npt = len(points)
421
+ dist = np.zeros((npt, nch))
422
+ for i, pt in enumerate(points):
423
+ for j, geo in enumerate(geometry):
424
+ d = Geodesic.WGS84.Inverse(pt[1], pt[0], geo[1], geo[0])['s12']
425
+ if depth_info:
426
+ dist[i, j] = np.sqrt(d**2 + (pt[2] - geo[2]) ** 2)
427
+ else:
428
+ dist[i, j] = d
429
+ return dist
430
+
431
+
432
+ def closest_channel_to_point(geometry, points, verbose=False):
402
433
  """
403
434
  Find the channel number closest to a given point.
404
435
 
405
436
  :param geometry: numpy.ndarray. It needs to consist of longitude, latitude
406
- or channel number, longitude, latitude.
407
- :param point: tuple or numpy.ndarray. A tuple consisting of latitude and longitude.
437
+ (and depth) or channel number, longitude, latitude (and depth).
438
+ :param points: numpy.ndarray. A tuple consisting of longitude and
439
+ latitude (and depth).
440
+ :param verbose: bool. Return the channel and the distance to the closest
441
+ channel if True.
408
442
  :return: int. The channel number closest to the given point.
409
443
  """
410
- if geometry.shape[1] == 2:
411
- channels = np.arange(len(geometry)).astype(int)
444
+ nch = len(geometry)
445
+ if points.shape[1] == geometry.shape[1]:
446
+ channels = np.arange(nch).astype(int)
412
447
  else:
413
448
  geometry = geometry[geometry[:, 0].argsort()]
414
449
  channels = geometry[:, 0].astype(int)
415
450
  geometry = geometry[:, 1:]
416
451
 
417
- lat, lon = point
418
- distances = np.array([
419
- Geodesic.WGS84.Inverse(lat, lon, geometry[i, 0], geometry[i, 1])['s12']
420
- for i in range(len(geometry))
421
- ])
422
- closest_index = np.argmin(distances)
423
- return int(channels[closest_index])
452
+ dist = distance_to_channels(points, geometry)
453
+ closest_index = np.argmin(dist, axis=1)
454
+ if verbose:
455
+ return channels[closest_index], np.min(dist, axis=1)
456
+ return channels[closest_index]
424
457
 
425
458
 
426
459
  def equally_spaced_channels(geometry, dx, depth_info=False, verbose=False):
@@ -12,8 +12,6 @@ local_tz = timezone(timedelta(seconds=-time.altzone))
12
12
 
13
13
 
14
14
  class DASDateTime(datetime):
15
-
16
-
17
15
  def __add__(self, other):
18
16
  if isinstance(other, Iterable):
19
17
  out = []
@@ -1,6 +1,6 @@
1
1
  # Purpose: Module for handling Section objects.
2
2
  # Author: Minzhe Hu
3
- # Date: 2025.3.10
3
+ # Date: 2025.4.2
4
4
  # Email: hmz2018@mail.ustc.edu.cn
5
5
  import warnings
6
6
  import os
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
 
4
4
  setup(
5
- name='DASPy-toolbox', version='1.1.3',
5
+ name='DASPy-toolbox', version='1.1.5',
6
6
  description=(
7
7
  'DASPy is an open-source project dedicated to provide a python package '
8
8
  'for DAS (Distributed Acoustic Sensing) data processing, which '
File without changes
File without changes
File without changes