Giter Club home page Giter Club logo

amirmardan / pyfwi Goto Github PK

View Code? Open in Web Editor NEW
55.0 5.0 11.0 10.59 MB

This repository is for PyFWI, a Python package for seismic FWI and reservoir monitoring (time-lapse FWI)

Home Page: https://pyfwi.readthedocs.io/en/latest/

License: GNU General Public License v3.0

Python 28.25% C 3.64% Jupyter Notebook 68.11%
seismic full-waveform-inversion fwi tl-fwi wave-modelling monitoring seismic-inversion seismic-monitoring time-lapse time-lapse-imaging

pyfwi's Introduction

PyFWI

PyPI version License: GPL v3 Documentation Status DOI Downloads

This repository contains Python package for elastic seismic full-waveform inversion (FWI) and time-lapse FWI.

Installation

To install this package, run

python3 -m pip install PyFWI

on macOS or

py -m pip install PyFWI

on Windows.

The structure of PyFWI can be shown as

PyFWI_structure

Citing PyFWI

@article{mardan2023pyfwi,
  title = {PyFWI: {A Python} package for full-waveform inversion and reservoir monitoring},
  author = {Mardan, Amir and Giroux, Bernard and Fabien-Ouellet, Gabriel},
  journal = {SoftwareX},
  volume = {22},
  pages = {101384},
  year = {2023},
  publisher = {Elsevier},
  doi = {10.1016/j.softx.2023.101384}
}

pyfwi's People

Contributors

amirmardan 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

Watchers

 avatar  avatar  avatar  avatar  avatar

pyfwi's Issues

Tried to run this but ran into problems. I'm on a M1 MacOS laptop. I tried to run it via both standard m1 modes and Rosetta mode to mimic Intel-based mac behavior.

Tried to run this but ran into problems. I'm on a M1 MacOS laptop. I tried to run it via both standard m1 modes and Rosetta mode to mimic Intel-based mac behavior.

The error I get (not doing any Rosetta fanciness) is

(pyfwi) JustinGosses_per:PyFWI-test justingosses$ pip install PyFWI
Collecting PyFWI
  Using cached PyFWI-0.1.7-py3-none-any.whl (68 kB)
Collecting datetime
  Downloading DateTime-4.5-py2.py3-none-any.whl (52 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.0/52.0 kB 1.3 MB/s eta 0:00:00
Collecting scipy
  Using cached scipy-1.8.1-cp310-cp310-macosx_12_0_arm64.whl (28.7 MB)
Collecting segyio
  Using cached segyio-1.9.6.tar.gz (1.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/ry/tr7t3nh122z_0n6rz2cl3lv40000gn/T/pip-install-guz0ovaa/segyio_20210f3369a9411ba04344ec9a238dd0/setup.py", line 3, in <module>
          import skbuild
      ModuleNotFoundError: No module named 'skbuild'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Googled this error and seems to be related to errors others have had with segyio. Maybe someone with experience with segyio would be able to help?

Originally posted by @JustinGOSSES in softwareunderground/awesome-open-geoscience#179 (comment)

error while running example.py

Hi Amir,
As your suggestion for adding argument "set_env_variable=False" in wave.WavePropagator, then I got this error

PS C:\Users\ASUS\Desktop\bismillah> & C:/Users/ASUS/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/ASUS/Desktop/bismillah/example.py
Device 0 is chosen.
Choose platform:
[0] <pyopencl.Platform 'Intel(R) OpenCL HD Graphics' at 0x1cf38ace6a0>
[1] <pyopencl.Platform 'NVIDIA CUDA' at 0x1cf38ae0a20>
[2] <pyopencl.Platform 'Intel(R) OpenCL' at 0x1cf2e529808>
[3] <pyopencl.Platform 'Intel(R) FPGA Emulation Platform for OpenCL(TM)' at 0x1cf2e52abf8>
[4] <pyopencl.Platform 'Intel(R) FPGA SDK for OpenCL(TM)' at 0x7ffdeca44f20>
Choice [0]:1
Set the environment variable PYOPENCL_CTX='1' to avoid being asked again.
Device 0 is chosen.
Choose platform:
[0] <pyopencl.Platform 'Intel(R) OpenCL HD Graphics' at 0x1cf38ace6a0>
[1] <pyopencl.Platform 'NVIDIA CUDA' at 0x1cf38ae0a20>
[2] <pyopencl.Platform 'Intel(R) OpenCL' at 0x1cf2e529808>
[3] <pyopencl.Platform 'Intel(R) FPGA Emulation Platform for OpenCL(TM)' at 0x1cf2e52abf8>
[4] <pyopencl.Platform 'Intel(R) FPGA SDK for OpenCL(TM)' at 0x7ffdeca44f20>
    self.__kernel(s, coeff)
  File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyFWI\wave_propagation.py", line 712, in __kernel
    cl.enqueue_copy(self.queue, copy_purpose, self.vx_b)
  File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyopencl\__init__.py", line 2009, in enqueue_copy    return _cl._enqueue_read_buffer(queue, src, dest, **kwargs)
pyopencl._cl.RuntimeError: clEnqueueReadBuffer failed: OUT_OF_RESOURCES

Issue in the example code

Hi Amir, In the example code:

# Create the wave object
W = wave.WavePropagator(inpa, src, rec_loc, model_shape,
                        n_well_rec=n_well_rec,
                        components=seisout, chpr=0)

# Call the forward modelling 
d_obs = W.forward_modeling(model, show=False)  # show=True can show the propagation of the wave

When I run the code, I keep receiving this error:

Cell In[6], line 7
      2 W = wave.WavePropagator(inpa, src, rec_loc, model_shape,
      3                         n_well_rec=n_well_rec,
      4                         components=seisout, chpr=0)
      6 # Call the forward modelling 
----> 7 d_obs = W.forward_modeling(model, show=False)  # show=True can show the propagation of the wave

File ~/anaconda3/envs/env3/lib/python3.10/site-packages/PyFWI/wave_propagation.py:898, in WavePropagator.forward_modeling(self, model0, show)
    896 self.pml_preparation(model['vp'].max())
    897 self.elastic_buffers(model)
--> 898 seismo = self.forward_propagator(model)
    899 data = acq.seismic_section(seismo, self.components, shape=self.seismo_shape)
    900 return data

File ~/anaconda3/envs/env3/lib/python3.10/site-packages/PyFWI/wave_propagation.py:648, in WavePropagator.forward_propagator(self, model)
    642     self.prg.MakeAllZero(self.queue, (self.tnz, self.tnx), None,
    643                          self.vx_b, self.vz_b,
    644                          self.taux_b, self.tauz_b, self.tauxz_b
    645                          )
    646     # print(s)
    647     # print(coeff)
--> 648     self.__kernel(s, coeff)
    650 if self.acq_type == 2:
    651     for par in self.seismogram:

File ~/anaconda3/envs/env3/lib/python3.10/site-packages/PyFWI/wave_propagation.py:714, in WavePropagator.__kernel(self, s, coeff)
    712 for t in np.arange(self.nt):
    713     if t % self.dt_scale == 0:
--> 714         self.__injSrc(t_src, s)
    715         # t_src += 1.0
    716     print(t)

File ~/anaconda3/envs/env3/lib/python3.10/site-packages/PyFWI/wave_propagation.py:661, in WavePropagator.__injSrc(self, t, s)
    656 src_kv_x, src_kv_z, src_kt_x, src_kt_z, src_kt_xz = np.float32(self.src(t))
    657 # print(t.astype(np.float32).type)
    658 # print(t)
    659 # print(type(src_kt_xz))
    660 # t = np.float32(t)
--> 661 self.prg.injSrc(self.queue, (self.tnz, self.tnx), None,
    662                 self.vx_b, self.vz_b,
    663                     self.taux_b, self.tauz_b, self.tauxz_b,
    664                 self.seismogramid_vx_b, self.seismogramid_vz_b,
    665                 self.seismogramid_taux_b, self.seismogramid_tauz_b, self.seismogramid_tauxz_b,
    666                 self.dxr,
    667                 self.srcx[s], self.srcz[s],
    668                 src_kv_x, src_kv_z,
    669                 src_kt_x, src_kt_z, 
    670                 t
    671                 )

File ~/anaconda3/envs/env3/lib/python3.10/site-packages/pyopencl/__init__.py:901, in _add_functionality.<locals>.kernel_call(self, queue, global_size, local_size, *args, **kwargs)
    895 def kernel_call(self, queue, global_size, local_size, *args, **kwargs):
    896     # __call__ can't be overridden directly, so we need this
    897     # trampoline hack.
    898 
    899     # Note: This is only used for the generic __call__, before
    900     # kernel_set_scalar_arg_dtypes is called.
--> 901     return self._enqueue(self, queue, global_size, local_size, *args, **kwargs)

File <pyopencl invoker for 'injSrc'>:7, in enqueue_knl_injSrc(self, queue, global_size, local_size, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, global_offset, g_times_l, allow_empty_ndrange, wait_for)

LogicError: clSetKernelArg failed: INVALID_ARG_SIZE - when processing arg#18 (1-based): 

Implementation on circular geometry

Discussed in #6

Originally posted by makeabhishek March 21, 2023
Hi, This is a discussion rather than an issue. I want to know if it is possible to implement the code for circular geometry. Is any example available?

Any answers and suggestions would be appreciated.

Consider sources and geophones all around the model.

example

Hi Amir, thanks a lot for the work you do.

Could you please provide an example of the marmousi2 model? I'm interested in understanding its application in seismic imaging.

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.