Giter Club home page Giter Club logo

pykonal's Introduction

Welcome to the pykonal repository!

This code implements the Fast Marching Method (FMM; Sethian et al., 1996) for solving the eikonal equation in Cartesian or spherical coordinates in 2 or 3 dimensions. The method implements mixed first- and second-order finite differences.

Raypaths

PyKonal offers two features that are absent from the comparable scikit-fmm package: (a) an implementation in spherical coordinates, and (b) functionality to compute shortest-traveltime paths.

Documentation

Documentation is available here.

Citation

If you make use of this code in published work, please cite White et al. (2020).

Installation

PIP—recommended

sh$> pip install pykonal

From source code

Download and unzip the latest release.

sh$> cd path/to/pykonal
sh$> pip install .

Bugs

Please report bugs, feature requests, and questions through the Issues tracker.

References

  1. Sethian, J. A. (1996). A fast marching level set method for monotonically advancing fronts. Proceedings of the National Academy of Sciences, 93(4), 1591–1595. https://doi.org/10.1073/pnas.93.4.1591
  2. White, M. C. A., Fang, H., Nakata, N., & Ben-Zion, Y. (2020). PyKonal: A Python Package for Solving the Eikonal Equation in Spherical and Cartesian Coordinates Using the Fast Marching Method. Seismological Research Letters, 91(4), 2378-2389. https://doi.org/10.1785/0220190318

pykonal's People

Contributors

jobh avatar lukaszmoroz-hl avatar malcolmw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pykonal's Issues

source coordinate out of the nodes

Could be very helpful if we can put the source coordinate in any arbitrary x,y,z and not just instead a node. Especially if we're considering large distance between two adjacent nodes (dx,dy,dz), this functionality would be more important.

Is there an example of vector velocity field?

Hi, Malcolm. Thanks for your sharing. It is really a great package. I am interested in figure_8.ipynb because of its potential application in the field of path planning. In this case, the velocity field is a scalar field. My understanding of this scalar field is that at every point in this Cartesian space, there is only the magnitude of the velocity and no direction information. In practice, velocity has both an x and a y component in a two-dimensional Cartesian plane. Does it still apply in the vector field? Maybe an example or suggestion for figure_8.ipynb in VectorField is ok. Thank you!

ray_trace ray doesn't start at given position

Hi, are there any restrictions to the velocity.values array ?
I am perhaps trying to abuse the library with highly heterogeneous velocities and sometimes, the ray that is returned by ray_trace simply doesn't start at the given start_idx.

ERROR: Failed building wheel for pykonal

Hi, I was trying to install pykonal in my mac. I am getting this error of failed to build wheel. I have installed wheel and setuptools using pip command. Also upgraded pip, wheel and setuptools. But still getting the same error. I am attaching a screenshot of my problem here.
Can you please let me know how to fix this issue?

Screenshot 2023-01-30 at 11 46 53 AM

Poetry add error

Hi, I'm trying to install your package on my conda environnement using poetry.
I have my own pyproject.toml with my dependencies and other configuration parameter.

It seems that I cannot add your package on my poetry env, i'm getting the error below :

(acouspack_py310_v5)[dev_PVE]$ poetry add pykonal
Using version ^0.4.0 for pykonal

Updating dependencies
Resolving dependencies... (3.8s)

Package operations: 2 installs, 0 updates, 0 removals

  • Installing cython (3.0.7)
  • Installing pykonal (0.4.0): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke get_requires_for_build_wheel
  
  Compiling pykonal/constants.pyx because it changed.
  Compiling pykonal/fields.pyx because it changed.
  Compiling pykonal/heapq.pyx because it changed.
  Compiling pykonal/locate.pyx because it changed.
  Compiling pykonal/solver.pyx because it changed.
  Compiling pykonal/stats.pyx because it changed.
  [1/6] Cythonizing pykonal/constants.pyx
  [2/6] Cythonizing pykonal/fields.pyx
  [3/6] Cythonizing pykonal/heapq.pyx
  [4/6] Cythonizing pykonal/locate.pyx
  [5/6] Cythonizing pykonal/solver.pyx
  [6/6] Cythonizing pykonal/stats.pyx
  /tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
  !!
  
          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:
  
          `license = 'GNU GPLv3'`
  
          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `license` is listed as `dynamic`.
  
          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
  
          To prevent this problem, you can list `license` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************
  
  !!
    _handle_missing_dynamic(dist, project_table)
  /tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `dependencies` defined outside of `pyproject.toml` is ignored.
  !!
  
          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:
  
          `dependencies = ['cython>=0.29.14', 'h5py', 'numpy', 'scipy']`
  
          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `dependencies` is listed as `dynamic`.
  
          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
  
          To prevent this problem, you can list `dependencies` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************
  
  !!
    _handle_missing_dynamic(dist, project_table)
  /tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `optional-dependencies` defined outside of `pyproject.toml` is ignored.
  !!
  
          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:
  
          `optional-dependencies = {'tests': ['nose']}`
  
          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `optional-dependencies` is listed as `dynamic`.
  
          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
  
          To prevent this problem, you can list `optional-dependencies` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************
  
  !!
    _handle_missing_dynamic(dist, project_table)
  Traceback (most recent call last):
    File "/projects/nactools/TOOLS/ACOUSPACK/DEV/dev_NF_pycharm/accouspack_pycharm/unpack_conda_env/acouspack_py310_v5/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/projects/nactools/TOOLS/ACOUSPACK/DEV/dev_NF_pycharm/accouspack_pycharm/unpack_conda_env/acouspack_py310_v5/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/projects/nactools/TOOLS/ACOUSPACK/DEV/dev_NF_pycharm/accouspack_pycharm/unpack_conda_env/acouspack_py310_v5/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 61, in <module>
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 159, in setup
      dist.parse_config_files()
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/_virtualenv.py", line 23, in parse_config_files
      result = old_parse_config_files(self, *args, **kwargs)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 627, in parse_config_files
      pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 67, in apply_configuration
      return _apply(dist, config, filepath)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 56, in apply
      _apply_project_table(dist, config, root_dir)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 82, in _apply_project_table
      corresp(dist, value, root_dir)
    File "/tmp/tmp1_lydcwk/.venv/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 183, in _license
      _set_config(dist, "license", val["text"])
  KeyError: 'text'
  

  at lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pykonal (0.4.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pykonal (==0.4.0)"'.

Do you know how I could fix that ?

numpy bool issue

In newer versions of numpy, np.bool is removed and bool is accepted. I would recommend either adding a specific version of numpy to the installation instructions, or changing constants.pyx so that DTYPE_BOOL = bool

The latest versions of numpy also accept float64, uint32, etc. without needing to prepend np.

Problem with computing ray paths

Hi There,
I found that solver.trace_ray() fails to output ray paths in some parts of my velocity model. In those cases, it only gives the end points of the rays. Do you know why is that? Thanks!

Tianze

The problem when installing pykonal

newbie to Python, am trying to install the package pykonal to explore Python, but can't get it installed. Below is the error output. Can anyone help pls? Thank you very much!

(pykonal_) C:\Users\26976>pip install pykonal
Collecting pykonal
Using cached pykonal-0.4.0.tar.gz (10.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [101 lines of output]
Compiling pykonal/constants.pyx because it changed.
Compiling pykonal/fields.pyx because it changed.
Compiling pykonal/heapq.pyx because it changed.
Compiling pykonal/locate.pyx because it changed.
Compiling pykonal/solver.pyx because it changed.
Compiling pykonal/stats.pyx because it changed.
[1/6] Cythonizing pykonal/constants.pyx
[2/6] Cythonizing pykonal/fields.pyx
[3/6] Cythonizing pykonal/heapq.pyx
[4/6] Cythonizing pykonal/locate.pyx
[5/6] Cythonizing pykonal/solver.pyx
[6/6] Cythonizing pykonal/stats.pyx
C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:75: _MissingDynamic: license defined outside of pyproject.toml is ignored.
!!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `license = 'GNU GPLv3'`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `license` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

          To prevent this problem, you can list `license` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:75: _MissingDynamic: `dependencies` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `dependencies = ['cython>=0.29.14', 'h5py', 'numpy', 'scipy']`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `dependencies` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

          To prevent this problem, you can list `dependencies` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:75: _MissingDynamic: `optional-dependencies` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `optional-dependencies = {'tests': ['nose']}`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `optional-dependencies` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

          To prevent this problem, you can list `optional-dependencies` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  Traceback (most recent call last):
    File "D:\anaconda3\envs\pykonal_\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "D:\anaconda3\envs\pykonal_\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "D:\anaconda3\envs\pykonal_\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 61, in <module>
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 159, in setup
      dist.parse_config_files()
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\dist.py", line 627, in parse_config_files
      pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 67, in apply_configuration
      return _apply(dist, config, filepath)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 56, in apply
      _apply_project_table(dist, config, root_dir)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 82, in _apply_project_table
      corresp(dist, value, root_dir)
    File "C:\Users\26976\AppData\Local\Temp\pip-build-env-v56uqsuw\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 183, in _license
      _set_config(dist, "license", val["text"])
  KeyError: 'text'
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Suggested improvement to raypath calculator

Hi, I am currently using Pykonal to generate traveltime grids for hundreds of stations in an effort to relocate events in New Zealand. These grids are in turn being used to pinpoint likely event hypocenters from associated phase arrivals.

Overall, I am very happy with the features of this program, however I would like to accurately gauge the raypath from source to receiver with a bit more confidence. Currently, I establish the travel time grid with the source index set as the rounded receiver location. For this step, I actually compute the approximate travel time to the nearest surrounding nodes, since the receivers do not actually fall on nodes. The velocity model is fairly coarse, with 10 km spacing in X and Y directions. Because of this, there can sometimes be several kilometers between the nearest node and the actual receiver location. It would be wonderful if I could input both start and end points for the raypath, as opposed to just the end point, as I feel this would give a more accurate result (albeit not significantly different given the scale I am working at).

How to interpret index of traveltime.values in sphere coordinates?

I thought the index 0 is R, index 1 is 90 - latitude and index 2 is longitude. However, I run the Spherical 2D example and then solver.traveltime.values[0, 1, :] show different values. I can't understand it the source is put at [0, 0, 0] (the North Pole), why are the values different for the same latitude? The values in the figure of that page seems the same. Thanks!

The code is below:

import numpy as np
import pykonal
import matplotlib.pyplot as plt

solver = pykonal.EikonalSolver(coord_sys="spherical")
solver.velocity.min_coords = 6371., 0, 0
solver.velocity.node_intervals = 1, np.pi/32, np.pi/32
solver.velocity.npts = 1, 33, 64
solver.velocity.values = np.ones(solver.velocity.npts)

src_idx = (0, 0, 0)
solver.traveltime.values[src_idx] = 0
solver.unknown[src_idx] = False
solver.trial.push(*src_idx)
solver.solve()

i1 = np.arange(33) * np.degrees(np.pi/32)
i2 = np.arange(64) * np.degrees(np.pi/32)
fig, ax = plt.subplots()
pc = ax.pcolormesh(i2, 90-i1, solver.traveltime.values[0, :, :], cmap='jet')
ax.set_xlabel("longitude")
ax.set_ylabel("latitude")
fig.colorbar(pc, ax=ax)
plt.tight_layout()
plt.show()

tt

solver.traveltime.value shows the same conclusion: different values are obtained for the same longitude. Because the velocities are always 1, the value with longtitude 0 is correct (111.19) but others are wrong.

from pykonal.transformations import geo2sph, sph2xyz

def print_tt(lat, lon):
    loc = np.array([lat, lon, 0])
    loc_sph = geo2sph(loc)
    print(solver.traveltime.value(loc_sph))

print_tt(89, 0)
print_tt(89, 10)

outputs:

111.19492664455889
1248.7380853952743

Request of data used in Locator2.ipynb

Dear Malcolm White,

My name is Emmanuel Castillo, I am a student from National University of Colombia. I have reviewed some Pykonal examples. I am very interested to reproduce this example: https://github.com/malcolmw/pykonal/blob/master/jupyter/Locator2.ipynb because I need to do something similar with other data.

Could you please give me the data used in this example to reproduce it and understand the code line by line, and surely, I could replicate the example with my data.

Thanks a lot,
Emmanuel David Castillo Taborda,
[email protected]
Regards.

Eliminating head waves in the results?

Hi There,
I am using PyKonal to compute the travel times of a source located in a low-velocity fault zone sandwiched between two high-velocity mediums. I noticed that the travel-time field in the fault zone seems to contain contributions from fault-zone head waves, whereas in reality, observed first arrivals are usually derived from direct-arrival body waves. Therefore, I am wondering if there is any way to remove the contributions from head waves in the results. Thanks a lot!

Tianze

3D Velocity Model Format

Hi Malcom,

I'd like to use this software to perform ray tracing through a 3D velocity model. I found your example 1D velocity model IASP91.csv. If I want to create a 3D model, should the file still be formatted the same way, just with extra rows for the spatially varying velocity? And if so, does it matter how the rows are ordered (or in other words, whether the depth or horizontal distance is varied first)?

Thanks!
Tara

segfault in ScalarField3D_value

Hi Malcom,

I had been experiencing this issue for quite some time, I suspect caused by an edge effect somewhere as it mostly happens with shallower models.

2023260T11:18:19::INFO::0000:: Tracing rays. (using within the context of pyvoro as usual!)
[gadi-cpu-clx-2555:2519722:0:2519722] Caught signal 11 (Segmentation fault: address not mapped to object at address 0x813db60)
==== backtrace (tid:2519722) ====
 0 0x0000000000012cf0 __funlockfile()  :0
 1 0x000000000004e41a __pyx_f_7pykonal_6fields_13ScalarField3D_value()  /home/158/rp6923/pykonal/pykonal/fields.cpp:10512
 2 0x0000000000057f26 __pyx_f_7pykonal_6fields_13ScalarField3D_trace_ray()  /home/158/rp6923/pykonal/pykonal/fields.cpp:9622
 3 0x000000000005a736 __pyx_pf_7pykonal_6fields_13ScalarField3D_4trace_ray()  /home/158/rp6923/pykonal/pykonal/fields.cpp:10149
 4 0x000000000005a736 __pyx_pw_7pykonal_6fields_13ScalarField3D_5trace_ray()  /home/158/rp6923/pykonal/pykonal/fields.cpp:10132

adding the last bit within the else clause in fields.pyx around line 500 seems to be a valid workaround... FWIW to anyone else and curious if this is a thing you've ran into yourself or might have a better way to address.

        for iax in range(3):
            if (
                (
                    point[iax] < self.cy_min_coords[iax]
                    or point[iax] > self.cy_max_coords[iax]
                )
                and not self.cy_iax_isperiodic[iax]
                and not self.cy_iax_isnull[iax]
            ):
                return (null)
            idx[iax]   = (point[iax] - self.cy_min_coords[iax]) / self.cy_node_intervals[iax]
            if self.cy_iax_isnull[iax]:
                ii[iax][0] = 0
                ii[iax][1] = 0
            else:
                ii[iax][0]  = <Py_ssize_t>idx[iax]
                ii[iax][1]  = <Py_ssize_t>(ii[iax][0]+1) % self.npts[iax]

                # **** double check still in bounds
                if ii[iax][0] < 0 or ii[iax][0] >= self.npts[iax] or ii[iax][1] < 0 or ii[iax][1] >= self.npts[iax]:
                    return null

NaN gradients in traveltime.trace_ray

Hi Malcolm,

I am struggling with an onset case of "Encountered NaN gradient" when using pyvorotomo, but I think this is happening in pykonal somewhere. Have you experienced this or know what the issue may be? I was initially thinking that some of my event-station distances were too close, and indeed sometimes very close arrivals this generated None raypaths, but removing these hasn't solved the issue. I don't have issues with other regions/velocity models so I'm guessing that's the culprit, but I don't see anything obviously wrong with it or understand how that would matter anyway.

Here is the error... seems to track back to line 639 of fields.pyx ( gg = np.moveaxis(np.stack([g0, g1, g2]), 0, -1) ) but again, I am at a loss to understand why. I am using a relatively new numpy 1.24.1 ...?

2023044T21:32:28::INFO::0000:: Updating P-wave model
2023044T21:32:28::INFO::0000:: Realization #1 (/500) with hvr = 8.0.
2023044T21:32:28::INFO::0000:: Tracing rays.
2023044T21:33:57::ERROR::0004:: _trace_rays() raised <class 'ValueError'>: Encountered NaN gradient.
2023044T21:33:57::ERROR::0004:: iterate() raised <class 'ValueError'>: Encountered NaN gradient.
2023044T21:33:57::ERROR::0004:: main() raised <class 'ValueError'>: Encountered NaN gradient.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 4 in communicator MPI_COMM_WORLD
with errorcode 0.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
2023044T21:33:57::ERROR::0001:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0001:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0001:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0002:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0002:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0002:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0003:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0003:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0003:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0005:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
--- Logging error ---
Traceback (most recent call last):
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 87, in _decorated_func
    return (func(*args, **kwargs))
            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_iterator.py", line 1206, in iterate
    self._trace_rays(phase)
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 92, in _decorated_func
    raise (exc)
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 87, in _decorated_func
    return (func(*args, **kwargs))
            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_iterator.py", line 790, in _trace_rays
    raypath = traveltime.trace_ray(coords) # <<<<<< something is happening HERE
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pykonal/fields.pyx", line 398, in pykonal.fields.ScalarField3D.trace_ray
  File "pykonal/fields.pyx", line 431, in pykonal.fields.ScalarField3D.trace_ray
  File "pykonal/fields.pyx", line 349, in pykonal.fields.ScalarField3D.gradient.__get__
  File "pykonal/fields.pyx", line 639, in pykonal.fields.ScalarField3D._gradient_of_spherical
  File "<__array_function__ internals>", line 200, in stack
  File "/home/seisop/.local/lib/python3.11/site-packages/numpy/core/shape_base.py", line 471, in stack
    return _nx.concatenate(expanded_arrays, axis=axis, out=out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<__array_function__ internals>", line 200, in concatenate
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 398, in signal_handler
    raise (SystemError("Interrupting signal received... aborting"))
SystemError: Interrupting signal received... aborting

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/__init__.py", line 1110, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/__init__.py", line 690, in format
    s = self.formatMessage(record)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/__init__.py", line 658, in formatMessage
    def formatMessage(self, record):
    
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 398, in signal_handler
    raise (SystemError("Interrupting signal received... aborting"))
SystemError: Interrupting signal received... aborting
Call stack:
  File "/home/seisop/.local/bin/pyvorotomo", line 109, in <module>
    main(argc)
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 87, in _decorated_func
    return (func(*args, **kwargs))
  File "/home/seisop/.local/bin/pyvorotomo", line 85, in main
    inversion_iterator.iterate()
  File "/home/seisop/.local/lib/python3.11/site-packages/pyvorotomo/_utilities.py", line 89, in _decorated_func
    logger.error(
Message: "iterate() raised <class 'SystemError'>: Interrupting signal received... aborting"
Arguments: ()
2023044T21:33:57::ERROR::0005:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0005:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0006:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0006:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0006:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0007:: _trace_rays() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0007:: iterate() raised <class 'SystemError'>: Interrupting signal received... aborting
2023044T21:33:57::ERROR::0007:: main() raised <class 'SystemError'>: Interrupting signal received... aborting
[sekiya:4070252] 6 more processes have sent help message help-mpi-api.txt / mpi-abort
[sekiya:4070252] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

Any insights appreciated... even if there's a way to failsafe this functions against NaNs or divide by zeros that I am missing.

Receive error on import on Mac M1

ImportError: dlopen(/Users/wbfrank/Projects/code/pykonal/pykonal/solver.cpython-310-darwin.so, 0x0002): tried: '/Users/wbfrank/Projects/code/pykonal/pykonal/solver.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

Cannot import - missing scipy/no module named 'pykonal.solver'

Hi,

Just to flag - following the installation instructions using miniconda3 lead to issues (at least on my system):

In [1]: import pykonal                                                                                                                                                                                      
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ad447b62261e> in <module>
----> 1 import pykonal

~/miniconda3/envs/pykonal/lib/python3.8/site-packages/pykonal/__init__.py in <module>
     14 from . import heapq
     15 from . import inventory
---> 16 from . import locate
     17 from . import solver
     18 from . import stats

pykonal/locate.pyx in init pykonal.locate()

ModuleNotFoundError: No module named 'scipy'

Resolved by installing scipy in my pykonal environment, as it doesn't ship with miniconda3. Possibly also true for virtualenv users.

Further to this, when then trying to import pykonal:

In [1]: import pykonal                                                                                                                                                                                      
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ad447b62261e> in <module>
----> 1 import pykonal

~/Documents/pykonal/pykonal/__init__.py in <module>
      8 )
      9 
---> 10 from .solver import EikonalSolver
     11 
     12 from . import constants

ModuleNotFoundError: No module named 'pykonal.solver'

I have tried also installing locally using the setup.py file, but to no avail.

System details:

>> g++ -v
...
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 

Looking forward to using the package - I've been using scikit-fmm to generate traveltime lookup tables as a backend for a software project I am involved in, but the ability to use spherical coordinate systems is an excellent addition!

ValueError which says Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long'

Hi,malcolmw.
When I use ur pykonal package,I always get the ERROR that says 'could not get source code'.And I also get the ValueERROR which says 'Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long' '.
I dont understand why I just copy your code and try to run but failed.
I've try to download the past version but still failed
I wonder if my computer went wrong or something get wrong.
Please help me
Thanks

Earthquake location

Hi Malcolm,

I am trying to use Pykonal to locate some events. Is there any minimal example on how to use 'EQLocator' Class ? I noticed that there is a code 'Locator2.ipnb' that locate events but the files required to run it are not available in the repository.

Best,
Andres.

ModuleNotFoundError: No module named 'pykonal.solver'

Hello, I have a error when I run the import pykonal. However, I install the pykonla by using conda and pip, which tells me Installing collected packages: pykonal Successfully installed pykonal-0.3.2b3. How can I solve it? Looking forward to your reply.

Issue with initial import

Not a python expert - installing via the conda path and everything seemed to go fine however I'm not able to load pykonal within python (missing module error) when running the examples,

import pykonal
Traceback (most recent call last):
File "", line 1, in
File "/Users/admin/Rice Geophysics Dropbox/Jonathan Ajo-Franklin/riceSeisMat/externalCodes/pykonal-0.2.3b3/pykonal/init.py", line 10, in
from .solver import EikonalSolver
ModuleNotFoundError: No module named 'pykonal.solver'

For reference on environment ....
Patch 3 version of pykonal-0.2.3b3
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:50:56)
[Clang 11.1.0 ] on darwin

tutorial/documentation

Hello,

This looks like a very interesting project! Do you have getting started section or some tutorials for using this code (sorry if I missed it)? If so it would be great to put a link in the project's readme file.

Also, the other python package in this space is sk-fmm. One of my first questions is what the differences are between pykonal and sk-fmm, maybe this could be covered as well?

Thanks!

synthetic surface waves..?

Hi Malcolm,

I've been toying around with the idea of using pykonal to emulate a surface wave "ray path" by artificially restricting the depth of the model until the travel time matches those observed via ambient noise analysis (one raypath per discrete period). The ultimate idea being to collect these for use in say, pyvorotomo for a proper 3D joint inversion.

The setup and pre-processing will take a lot of time, but it seems...doable? So far I have been able to match pykonal predicted times with generalized interstation distances / phase velocities reasonably well which is giving me some hope. It appears you may have given some thought to this way back when, wondering if you have any future plans or ideas or comments (or warnings!) as to the feasibility of this nowadays?

FWIW here are the helper functions I've come up with thus far, but I'm sure they could be optimized. Perhaps of use to other people for other reasons?

def trim_model(velocity_model,maxdepth=10):
    #get info from old model
    maxgeocoords = sph2geo(velocity_model.max_coords) #the surface (lat,lon,z)
    mingeocoords = sph2geo(velocity_model.min_coords) #at depth
    surface_depth = maxgeocoords[2]
    maxcoords = velocity_model.max_coords
    mincoords = velocity_model.min_coords #spherical coordinates are (z/rho,theta,phi)
    nz = velocity_model.npts[0]
    dz = (mingeocoords[2] - maxgeocoords[2])/nz
    prev_size = velocity_model.npts #(z/rho, theta, phi)
    prev_intervals = velocity_model.node_intervals #(z/rho, theta, phi)
    
    #get info for new model
    new_size = prev_size.copy()
    newnz = round( (maxdepth-surface_depth)/dz )
    
    new_size[0] = min(prev_size[0],newnz)
    
    new_intervals =  velocity_model.node_intervals.copy()
    new_intervals[0] = (newnz*dz)/(new_size[0]-1) # issue if new_size[0] is 1
    
    new_min_coords = mincoords.copy()
    new_min_coords[0] = 6371 - dz*newnz - maxgeocoords[2]
    
    #create new model
    new_velocity_model = pykonal.fields.ScalarField3D(coord_sys="spherical")
    new_velocity_model.min_coords = new_min_coords
    new_velocity_model.npts = new_size
    new_velocity_model.node_intervals = new_intervals
    new_velocity_model.values = velocity_model.values[-newnz:,:,:]
      
    return new_velocity_model
def resample_velocity(v,mult=2):
    rho_min, theta_min, phi_min = v.min_coords
    rho_max, theta_max, phi_max = v.max_coords
    nrho, ntheta, nphi = v.npts * mult
    
    drho = (rho_max - rho_min) / (nrho - 1)
    rho = np.linspace(rho_min, rho_max, nrho)

    dtheta = (theta_max - theta_min) / (ntheta - 1)
    theta = np.linspace(theta_min, theta_max, ntheta)

    dphi = (phi_max - phi_min) / (nphi - 1)
    phi = np.linspace(phi_min, phi_max, nphi)
    
    rtp = np.moveaxis(
    np.stack(np.meshgrid(rho, theta, phi, indexing="ij")),
    0, -1)
    
    resampled_data = v.resample(rtp.reshape(-1, 3)).reshape(rtp.shape[:-1])
    
    v_out = pykonal.fields.ScalarField3D(coord_sys="spherical")

    v_out.min_coords = rho_min, theta_min, phi_min
    v_out.node_intervals = drho, dtheta, dphi
    v_out.npts = nrho, ntheta, nphi
    v_out.values = resampled_data
    
    return v_out
def compute_tt_raypath(velocity_model, source_position, receiver_position, maxdepth=None):
    # Create a solver object
    solver = pykonal.solver.PointSourceSolver(coord_sys='spherical')
    
    # shrink velocity model to a shell of thickness maxdepth 
    if maxdepth:
        velocity_model = trim_model(velocity_model,maxdepth=maxdepth)
        #zero_velocity_below_depth(velocity_model,maxdepth=maxdepth)
        velocity_model = resample_velocity(velocity_model,2)
        velocity_model.values[0,:,:] = 0.2 #setting the bottom layer to some small value instead of 0 seems to help stability
    
    # incorporate velocity model
    solver.velocity.min_coords = velocity_model.min_coords
    #not writeable? solver.velocity.max_coords = velocity_model.max_coords    
    solver.velocity.node_intervals = velocity_model.node_intervals
    solver.velocity.npts = velocity_model.npts
    solver.velocity.values = velocity_model.values
    solver.src_loc = geo2sph(source_position)
    
    #solve and trace
    solver.solve()
    
    raypath = solver.trace_ray(geo2sph(receiver_position)) # sph2geo(raypath)
    max_raypath_depth = max(sph2geo(raypath)[:,2])
    
    traveltime = solver.traveltime.value(geo2sph(receiver_position))
    
    #how can we get the distance along the raypath?
    
    return traveltime,raypath

Spherical point source solver sometimes fails to converge

I'm trying to use the point source solver in spherical coordinates, and have found that for my problem and for some source locations, the algorithm fails to converge properly, instead giving an array of infinities. Its not clear to me what the bug is that is causing this. Changing the value of the phi coordinate slightly seems to stop this problem from happening for this particular example.

import pykonal
import numpy as np

lamax, lomin, depmin = 46.750, -113.0, -3.0
lanode, lonode, depnode = 32, 41, 164
ladx, lodx, depdx = 0.125, 0.125, 1.0

rmin = 6371 - depmin + 1 - depnode*depdx
thmin = np.deg2rad(90-lamax)
phmin = np.deg2rad(lomin)
rnode, thnode, phnode = depnode, lanode, lonode
rdx = depdx
phdx = np.deg2rad(lodx)
thdx = np.deg2rad(ladx)


model = 5*np.ones((rnode, thnode, phnode))

solver = pykonal.solver.PointSourceSolver(coord_sys="spherical")
solver.velocity.min_coords = rmin, thmin, phmin
solver.velocity.node_intervals = rdx, thdx, phdx
solver.velocity.npts = rnode, thnode, phnode
solver.velocity.values = model
solver.src_loc = (6373.149, 0.7995353303386024, -1.9405094222448556)
solver.solve()
solver.traveltime.values

trace_ray crashing

Trying to run trace_ray following:
https://malcolmw.github.io/pykonal-docs/api/classes/fields/ScalarField3D.html#pykonal.fields.ScalarField3D.trace_ray

pykonal 0.2.3b2

Using fractional node intervals doesn't work:

import numpy
import pykonal

ny, nz, nx = 100, 100, 100
solver = pykonal.EikonalSolver(coord_sys="cartesian")
solver.velocity.min_coords = 0, 0, 0
solver.velocity.node_intervals = 0.2, 0.1, 0.2
solver.velocity.npts = ny, nz, nx
solver.velocity.values = np.ones((ny, nz, nx))
src_idx = 50, 80, 50
solver.traveltime.values[src_idx] = 0
solver.unknown[src_idx] = False
solver.trial.push(*src_idx)
solver.solve()
solver.trace_ray(np.array([20, 0, 20], dtype=float))
array([[20.,  0., 20.]])

It just returns the last point, not the trace. Works with solver.node_intervals = 1, 1, 1

Might be useful to add to the documentation that you have to run solve() before trace_ray() otherwise I get:

/usr/lib/python3.7/site-packages/numpy/lib/function_base.py:1068: RuntimeWarning: invalid value encountered in subtract
  out[tuple(slice1)] = (f[tuple(slice4)] - f[tuple(slice2)]) / (2. * ax_dx)
/usr/lib/python3.7/site-packages/numpy/lib/function_base.py:1089: RuntimeWarning: invalid value encountered in subtract
  out[tuple(slice1)] = (f[tuple(slice2)] - f[tuple(slice3)]) / dx_0
/usr/lib/python3.7/site-packages/numpy/lib/function_base.py:1096: RuntimeWarning: invalid value encountered in subtract
  out[tuple(slice1)] = (f[tuple(slice2)] - f[tuple(slice3)]) / dx_n

install problem

Dear Malcolmw White,

I have a problem as below, could you please have a look at it?

pip install .
Processing /home/yanhan/software/beampower/pykonal
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /home/yanhan/anaconda3/envs/beampower_tuto/lib/python3.10/site-packages (from pykonal==0.3.2b4) (1.24.2)
Requirement already satisfied: cython>=0.29.14 in /home/yanhan/anaconda3/envs/beampower_tuto/lib/python3.10/site-packages (from pykonal==0.3.2b4) (0.29.33)
Requirement already satisfied: h5py in /home/yanhan/anaconda3/envs/beampower_tuto/lib/python3.10/site-packages (from pykonal==0.3.2b4) (3.8.0)
Requirement already satisfied: scipy in /home/yanhan/anaconda3/envs/beampower_tuto/lib/python3.10/site-packages (from pykonal==0.3.2b4) (1.10.1)
Building wheels for collected packages: pykonal
Building wheel for pykonal (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pykonal (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
building 'pykonal.constants' extension
gcc -pthread -B /home/yanhan/anaconda3/envs/beampower_tuto/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/yanhan/anaconda3/envs/beampower_tuto/include -fPIC -O2 -isystem /home/yanhan/anaconda3/envs/beampower_tuto/include -fPIC -I/tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include -I/home/yanhan/anaconda3/envs/beampower_tuto/include/python3.10 -c pykonal/constants.c -o build/temp.linux-x86_64-cpython-310/pykonal/constants.o
In file included from /tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,
from /tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from pykonal/constants.c:759:
/tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
pykonal/constants.c: In function '__Pyx_Import':
pykonal/constants.c:3803:21: warning: the comparison will always evaluate as 'true' for the pointer operand in '(char *)"pykonal.constants" + 7' must not be NULL [-Waddress]
3803 | if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
| ^~
gcc -pthread -B /home/yanhan/anaconda3/envs/beampower_tuto/compiler_compat -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/home/yanhan/anaconda3/envs/beampower_tuto/lib -Wl,-rpath-link,/home/yanhan/anaconda3/envs/beampower_tuto/lib -L/home/yanhan/anaconda3/envs/beampower_tuto/lib -Wl,--allow-shlib-undefined -Wl,-rpath,/home/yanhan/anaconda3/envs/beampower_tuto/lib -Wl,-rpath-link,/home/yanhan/anaconda3/envs/beampower_tuto/lib -L/home/yanhan/anaconda3/envs/beampower_tuto/lib build/temp.linux-x86_64-cpython-310/pykonal/constants.o -o build/lib.linux-x86_64-cpython-310/pykonal/constants.cpython-310-x86_64-linux-gnu.so
building 'pykonal.fields' extension
gcc -pthread -B /home/yanhan/anaconda3/envs/beampower_tuto/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/yanhan/anaconda3/envs/beampower_tuto/include -fPIC -O2 -isystem /home/yanhan/anaconda3/envs/beampower_tuto/include -fPIC -I/tmp/pip-build-env-2njkq_j3/overlay/lib/python3.10/site-packages/numpy/core/include -I/home/yanhan/anaconda3/envs/beampower_tuto/include/python3.10 -c pykonal/fields.cpp -o build/temp.linux-x86_64-cpython-310/pykonal/fields.o
gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
compilation terminated.
error: command '/home/yanhan/anaconda3/envs/beampower_tuto/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pykonal
Failed to build pykonal
ERROR: Could not build wheels for pykonal, which is required to install pyproject.toml-based projects

Spherical solver doesn't work for a certain range of src_phi values.

Hi Malcolm,

I'm having a problem with the 'spherical solver' that when src_phi is assigned a range of values, the solver cannot be properly solved.

I attached a jupyter notebook file and a python code for your convenience.
Archive.zip

You may first look at line 97, when src_phi is smaller than pi (3.1415926...), the solver works, but when src_phi is larger than pi (you may uncomment line 98)m the solver doesn't work.

Thanks a lot for your help!

Best,
Han

Error in pykonal.solver.EikonalSolver(coord_sys="cartesian").trial.push(*idx)

I tried the notebooks provided under this link. I am running on Windows 10 with Python 3.7.7 and Pykonal 0.3.2b1 package.

ValueError Traceback (most recent call last)
in
15 solver.unknown[src_idx] = False
16 # Add source node to Trial.
---> 17 solver.trial.push(*src_idx)
18 # Solve the system.
19 solver.solve()
pykonal\solver.pyx in pykonal.solver.EikonalSolver.trial.get()
pykonal\heapq.pyx in pykonal.heapq.Heap.init()
ValueError: Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long'

gcc: error trying to exec 'cc1plus' : execvp: No such file or directory

Dear All,

thank you for positing this amazing package. I am not sure whether this an issue or not since I already found the solution. When I tried to installed on Ubuntu, I got the following error after pip install .

gcc: error trying to exec 'cc1plus' : execvp: No such file or directory

after searching for sometime, I found that I was missing this library

conda install -c conda-forge gxx_linux-64

I hope someone find it useful

Publish to PyPI

Hey, could you put the package on PyPI as well? Not everyone can use Conda, and I believe that nowadays PyPI supports publishing cython binary wheels.

Using Shear Wave Velocity Model

I am using this package to try to trace ray paths from a shear wave velocity model, which has shear wave velocity reductions up to 30%, similar to the PyKonal_rays image. When I import the velocity model, I interpolate it based on Vs, and get a matrix that plots how it should look. However, when I use the EikonalSolver (cartesian), the travel times and resulting ray paths do not seem correct. I have tried different source and receiver locations. I am tracing the rays using solver.trace_ray().

Do you have source code or an example on how you got the pykonal_rays figure (figure on the welcome page).

Can't import pykonal. Though installation went well.

Hi , I installed pykonal which went well. As I am trying to import it, it is showing following error

`

AttributeError Traceback (most recent call last)
in
1 import skfmm
2 dir='out_create_piggyback2d/'
----> 3 import pykonal

~\Anaconda3\lib\site-packages\pykonal_init_.py in
8 )
9
---> 10 from .solver import EikonalSolver
11
12 from . import constants

pykonal\solver.pyx in init pykonal.solver()

pykonal\fields.pyx in init pykonal.fields()

~\Anaconda3\lib\site-packages\h5py_init_.py in
44 _errors.silence_errors()
45
---> 46 from ._conv import register_converters as _register_converters
47 _register_converters()
48

h5py\h5t.pxd in init h5py._conv()

h5py\h5t.pyx in init h5py.h5t()

~\Anaconda3\lib\site-packages\numpy_init_.py in getattr(attr)
318 return Tester
319
--> 320 raise AttributeError("module {!r} has no attribute "
321 "{!r}".format(name, attr))
322

AttributeError: module 'numpy' has no attribute 'typeDict'
`

my numpy version is 1.24.2 and scipy is 1.5.2
I tried with downgraded versions as well.
Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.