Code Monkey home page Code Monkey logo

stride's People

Stargazers

翁瑋杉 avatar Benedict Grey avatar  avatar  avatar Xiaolei avatar Lucas da Costa avatar  avatar  avatar snowlee666 avatar  avatar David Lee avatar  avatar Ruizhe Cao avatar  avatar Guillermo Valle avatar  avatar Paul Wetzel avatar  avatar Nima Maftoon avatar Nikolaus Schlemm avatar  avatar  avatar Jingyi Xiao avatar sunxu avatar Brad Segal avatar Zhifeng avatar Juntao Wang avatar  avatar RFR avatar edsml-xl522 avatar  avatar Darin Erat Sleiter avatar  avatar  avatar  avatar  avatar  avatar shubin avatar Ciaran Coleman avatar Haipeng Li avatar Lokeshwaran avatar Adeeb Arif Kor avatar Bradley Treeby avatar Edgar Dorausch avatar  avatar NingL avatar  avatar  avatar Magnus Dalen Kvalevåg avatar David Sinden avatar Ziyi Yin avatar Zhuorui Zhang avatar  avatar Keshuai Xu avatar Ban-Sok Shin avatar Lindsey Kitchell avatar Nathan Meulenbroek avatar Walter Simson avatar Carlos Cueto avatar Delio Vicini avatar guojun avatar Rehman Ali avatar Anle Dai avatar  avatar Ahmed Ratnani avatar Kajetan Chrapkiewicz avatar  avatar  avatar  avatar  avatar Yuanguo Wang avatar Leo avatar Jason Dou avatar Kayhan Batmanghelich avatar Miguel Xochicale, PhD avatar Marcelo Lerendegui avatar  avatar Ali Siahkoohi avatar George Bisbas avatar Fabio Luporini avatar Antonio Stanziola avatar Matteo Ravasi avatar

Watchers

Fabio Luporini avatar James Cloos avatar Gerard Gorman avatar Miguel Xochicale, PhD avatar  avatar NingL avatar Carlos Cueto avatar

stride's Issues

Move reflection coefficient calculation to Boundary.damping()

Right now, the theoretical reflection coefficient of the boundary is calculated in the Boundary sub-classes:

reflection_coefficient = 10**(-(np.log10(max(*space.absorbing)) - 1)/np.log10(2) - 3)

but this should be the same for all boundaries, so should be moved to Boundary.damping().

Unable to install stride

I am trying install on M2 OSX 14.1.1
Step to reproduce:

  1. conda env create -f environment.yml
  2. conda activate stride
  3. pip install -e .
    Errors:
❯ pip install .
Processing /Users/sarit/study/stride
  Preparing metadata (setup.py) ... done
Collecting blosc (from stride==1.2)
  Downloading blosc-1.11.1.tar.gz (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 8.4 MB/s eta 0:00:00
  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
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/Users/sarit/anaconda3/envs/stride/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/sarit/anaconda3/envs/stride/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/sarit/anaconda3/envs/stride/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h5/4mllfnsj3_z7pn72_yfp82qw0000gn/T/pip-build-env-nld0hmmi/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h5/4mllfnsj3_z7pn72_yfp82qw0000gn/T/pip-build-env-nld0hmmi/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/h5/4mllfnsj3_z7pn72_yfp82qw0000gn/T/pip-build-env-nld0hmmi/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/private/var/folders/h5/4mllfnsj3_z7pn72_yfp82qw0000gn/T/pip-build-env-nld0hmmi/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 84, in <module>
      KeyError: 'flags'
      [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.

RuntimeError in homogeneous_acoustic/ forward_2D.py

Hello @ccuetom,
I am testing the forward example and don't change anything. However, it shows runtimeError in jupyter notebook.
'~/anaconda3/envs/usct/lib/python3.8/site-packages/uvloop/loop.pyx in uvloop.loop.Loop.run_until_complete()

~/anaconda3/envs/usct/lib/python3.8/site-packages/uvloop/loop.pyx in uvloop.loop.Loop.run_until_complete()

~/anaconda3/envs/usct/lib/python3.8/site-packages/uvloop/loop.pyx in uvloop.loop.Loop.run_forever()

~/anaconda3/envs/usct/lib/python3.8/site-packages/uvloop/loop.pyx in uvloop.loop.Loop._run()

RuntimeError: Cannot run the event loop while another loop is running'.

Could you please tell me how to fix it?
Thanks a lot

Add tutorial on the use of "parameter"

We use parameters extensively during inversion, but these are not fully documented in the tutorials.

A new tutorial should be added, or existing tutorials extended, to include this.

07_script_running has error

I can run tutorial 1-6 without any problem. Until No.7

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[4], line 2
      1 if __name__ == '__main__':
----> 2     mosaic.run(main)

File ~/anaconda3/lib/python3.10/site-packages/mosaic/__init__.py:275, in run(main, *args, **kwargs)
    272                         key, value = line.strip().split('=')
    273                         kwargs[key] = kwargs.get(key, eval(value))
--> 275 init(*args, **kwargs)
    277 loop = _runtime.get_event_loop()
    279 async def _main():

File ~/anaconda3/lib/python3.10/site-packages/mosaic/__init__.py:134, in init(runtime_type, runtime_indices, address, port, parent_id, parent_address, parent_port, monitor_address, monitor_port, pubsub_port, num_workers, num_threads, mode, reuse_head, monitor_strategy, log_level, profile, node_list, asyncio_loop, dump_init, wait, **kwargs)
    130     raise KeyError('Endpoint type is not recognised, available types are head, '
    131                    'monitor, node and worker')
    133 loop = _runtime.get_event_loop(asyncio_loop=asyncio_loop)
--> 134 result = loop.run(_runtime.init, **runtime_config)
    136 if profile:
    137     profiler.start()

File ~/anaconda3/lib/python3.10/site-packages/mosaic/utils/event_loop.py:291, in EventLoop.run(self, coro, *args, **kwargs)
    288     coro = awaitify(coro)
    290 if not self._loop.is_running():
--> 291     return self._loop.run_until_complete(coro(*args, **kwargs))
    293 future = self._loop.create_task(coro(*args, **kwargs))
    295 self._futures.add(future)

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1511, in uvloop.loop.Loop.run_until_complete()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1504, in uvloop.loop.Loop.run_until_complete()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1377, in uvloop.loop.Loop.run_forever()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:522, in uvloop.loop.Loop._run()

RuntimeError: Cannot run the event loop while another loop is running

How to fix this?

Normalization of fft in fft.magnitude_spectrum

Using stride.utils.fft.magnitude_spectrum, I wanted to calculate the amplitude of a steady-state sinusoidal.

import numpy as np
from stride.utils import fft

freq = 25.
ppp = 30
dt = 1 / freq / ppp
t = np.arange(5 * ppp) * dt  # five periods
amplitude = 234.  # this is the target amplitude we expect to recover
y = amplitude * np.sin(2 * np.pi * freq * t)

freqs, fft_amps = fft.magnitude_spectrum(y, dt, db=False)
freq_idx = np.argmin(np.abs(freqs - freq))
print(fft_amps[freq_idx])

I naively expected the output to be 234.0, the amplitude of the sinusoidal, but the result is 17550.0.

Which is the intended result for magnitude_spectrum? Is it expected that the user needs to apply a factor to the FFT magnitudes in order to extract the steady-state?

For some context, I investigated the source of the difference:

Based on examples using np.fft, it seems like it is common to divide the output fft amplitudes by N/2 where N is the length of the input array (len(y)). In fact, this is the exact scaling factor we see 17550 = 234 * 75.

The source of the N/2 seems to be a combination of two things:

  1. the choice of FFT normalization
  2. the fact that the wave amplitude in frequency space is split over positive and negative frequency components

np.fft documentation does not do a great job of explaining this, but I found this post and this other post to be useful in understanding.

The result is that if we want to recover the original sinusoidal amplitude, we need to divide the desired fft element magnitude by N / 2 where N is the length of the input array and the factor of two is there because we are only looking at the positive frequency element.

Alternatively, we could us the forward normalization and sum the amplitude in the positive and negative frequency components.

If the result of the existing implementation does not match the intention for this function, I'd be happy to contribute a fix. And if the results do match intention and I misunderstood, then I'd be happy to contribute an explanation of how to extract the steady-state amplitude in the documentation.

Poor inversion results when using linear transducers.

Dear author,
Stride is a great piece of work, and I'm following it. First, when I use the transducers with the default elliptical geometry, problem.plot() looks like this:
problem1
And the corresponding inversion result is as follows:
result1
It looks like the inversion result is good!
However, when I changed the transducer geometry to a linear arrangement, problem.plot() looks like this:
problem2
And the corresponding inversion result is as follows:
result2
You can see that the result is very poor at this point, and it is almost impossible to get any sound velocity distribution. Do you know the reason for this result, and how to make the linear transducer also get a correct inversion result? I'm looking forward your reply!

Yours
Sincerely

fatal error: 'omp.h' file not found

Hello,

I'm following along the Quickstart guide and am trying to run the breast3D example. After running mrun python 01_script_forward.py after following the setup instructions in my conda environment, I am encountering the following error:

gcc -march=native -O3 -g -fPIC -Wall -std=c99 -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -L/opt/homebrew/opt/libomp/lib /var/folders/f5/8wnxq98j4yg3kcwdnr6wxv1w0000gn/T/devito-jitcache-uid501/92880c20e74dc42603f8fec770e331f8f6b398cb.c -lm -o /var/folders/f5/8wnxq98j4yg3kcwdnr6wxv1w0000gn/T/devito-jitcache-uid501/92880c20e74dc42603f8fec770e331f8f6b398cb.dylib
/var/folders/f5/8wnxq98j4yg3kcwdnr6wxv1w0000gn/T/devito-jitcache-uid501/92880c20e74dc42603f8fec770e331f8f6b398cb.c:9:10: fatal error: 'omp.h' file not found
#include "omp.h"
^~~~~~~
1 error generated.
FAILED compiler invocation: gcc -march=native -O3 -g -fPIC -Wall -std=c99 -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -L/opt/homebrew/opt/libomp/lib /var/folders/f5/8wnxq98j4yg3kcwdnr6wxv1w0000gn/T/devito-jitcache-uid501/92880c20e74dc42603f8fec770e331f8f6b398cb.c -lm -o /var/folders/f5/8wnxq98j4yg3kcwdnr6wxv1w0000gn/T/devito-jitcache-uid501/92880c20e74dc42603f8fec770e331f8f6b398cb.dylib

I've tried brew install libomp but this did not change the result. I am running on a MacBook Pro with an M3 chip.

I'd appreciate any tips, thanks!

the outputs of simulating forward model

Dear @ccuetom ,
Thanks for your contribution. I would like to if I use Stride to simulate asonic wave propagation in the water, the output of it is from the receivers or the whole computational domain . e.g., if the numerical grid is 1000 by 1000, the number of receiver is 128 and the time step is 2000. The size of the pressure field is 1000 by 1000 by 2000 or 128 by 2000. I meet some problem while installing Stride and cannot test it. Could you please tell me the pressure data is from receiver locations or the entire computational grid? Thanks a lot!

Example does not run

On a clean account, I installed the latest Miniconda

Conda 23.3.1
Python 3.10.10

Copy pasted line by line

git clone https://github.com/trustimaging/stride
cd stride
conda env create -f environment.yml
conda activate stride
pip install -e .

and tried to run the example:

cd stride_examples/examples/breast2D
mrun python 01_script_forward.py

This is the output:

Traceback (most recent call last):
File "/home/test/miniconda3/envs/stride/bin/mrun", line 33, in
sys.exit(load_entry_point('stride', 'console_scripts', 'mrun')())
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/test/stride/mosaic/cli/mrun.py", line 134, in go
init('monitor', **runtime_config, wait=False)
File "/home/test/stride/mosaic/init.py", line 129, in init
result = loop.run(_runtime.init, **runtime_config)
File "/home/test/stride/mosaic/utils/event_loop.py", line 283, in run
return self._loop.run_until_complete(coro(*args, **kwargs))
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/test/stride/mosaic/runtime/monitor.py", line 106, in init
await super().init(**kwargs)
File "/home/test/stride/mosaic/runtime/runtime.py", line 202, in init
self._local_warehouse = SpillBuffer(spill_directory, warehouse_memory)
File "/home/test/stride/mosaic/utils/spill_buffer.py", line 141, in init
zict.File(spill_directory, mode='w'))
TypeError: File.init() got an unexpected keyword argument 'mode'
Exception ignored in: <function ZictBase.del at 0x7f74253e88b0>
Traceback (most recent call last):
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/zict/common.py", line 80, in del
self.close()
File "/home/test/miniconda3/envs/stride/lib/python3.10/site-packages/zict/buffer.py", line 269, in close
close(self.fast, self.slow)
AttributeError: 'SpillBuffer' object has no attribute 'fast'

Unable to run stride docker on M2

M2 OSX 14.1.1

Version

4.25.2 (129061)

Engine: 24.0.6

Compose: v2.23.0-desktop.1

Credential Helper: v0.7.0

Kubernetes: v1.28.2

Step to reproduce:

  1. checkout stride repo
  2. docker compose build --no-cache

Errors:

❯ docker compose build --no-cache
[+] Building 3.2s (14/22)                                                                                                                             docker:desktop-linux
 => [stride internal] load build definition from Dockerfile.stride                                                                                                    0.0s
 => => transferring dockerfile: 2.25kB                                                                                                                                0.0s
 => [stride internal] load .dockerignore                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                       0.0s
 => [stride internal] load metadata for docker.io/devitocodes/bases:cpu-gcc                                                                                           2.3s
 => [stride internal] load metadata for docker.io/continuumio/miniconda3:latest                                                                                       2.2s
 => [stride auth] devitocodes/bases:pull token for registry-1.docker.io                                                                                               0.0s
 => [stride auth] continuumio/miniconda3:pull token for registry-1.docker.io                                                                                          0.0s
 => CACHED [stride anaconda 1/1] FROM docker.io/continuumio/miniconda3:latest@sha256:5ee0ed861bce8f67acb0a3e8a416891781db54302d93bf20a3c6301d7683d7b9                 0.0s
 => CACHED [stride builder 1/6] FROM docker.io/devitocodes/bases:cpu-gcc@sha256:0d9b27e3a265f2b54bca77afdb91f725530eded47f043b66d33adbfc2be059b0                      0.0s
 => [stride internal] load build context                                                                                                                              0.0s
 => => transferring context: 21.27kB                                                                                                                                  0.0s
 => [stride user 2/9] RUN mkdir -p /app &&     groupadd -r -g 1000 app &&     useradd -r -u 1000 -g app -d /app -s /sbin/nologin -c "Docker image user" app &&     c  0.4s
 => [stride builder 2/6] COPY --from=anaconda /opt/conda /opt/conda                                                                                                   0.6s
 => [stride builder 3/6] ADD . /app/stride                                                                                                                            0.0s
 => [stride builder 4/6] RUN rm -rf /app/stride/.git && rm -rf /app/stride/legacy                                                                                     0.1s
 => ERROR [stride builder 5/6] RUN . /opt/conda/etc/profile.d/conda.sh &&     conda update -n base -c defaults conda &&     conda env create -f /app/stride/environm  0.1s
------
 > [stride builder 5/6] RUN . /opt/conda/etc/profile.d/conda.sh &&     conda update -n base -c defaults conda &&     conda env create -f /app/stride/environment.yml &&     conda activate stride &&     /opt/conda/envs/stride/bin/pip install -e /app/stride/ &&     conda install -c conda-forge mayavi:
0.136 /bin/sh: 9: /opt/conda/bin/conda: not found
------
failed to solve: process "/bin/sh -c . /opt/conda/etc/profile.d/conda.sh &&     conda update -n base -c defaults conda &&     conda env create -f /app/stride/environment.yml &&     conda activate stride &&     /opt/conda/envs/stride/bin/pip install -e /app/stride/ &&     conda install -c conda-forge mayavi" did not complete successfully: exit code: 127

Updates have broken IsoElasticDevito forward modelling

No received signal is seen when running elastic forward models with the IsoElasticDevito pde. When looking at the received data acquired over a ring array of receiving elements, only the trace at the src element is non-zero and this only contains the source signal assigned to that element.

The elastic modelling does work on Stride as early as 25/01/2022 (commit 1e8bf26). However, more recent updates seem to have broken this functionality.

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.