Skip to content

Commit

Permalink
Merge branch 'main' into migrating-web-to-vue
Browse files Browse the repository at this point in the history
  • Loading branch information
NewtonSander committed Jul 26, 2024
2 parents c015fdd + caa7fba commit eeefed1
Show file tree
Hide file tree
Showing 8 changed files with 2,111 additions and 2,008 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,28 @@ jobs:
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'

- name: Install gcc-11
- name: Install dependencies for macOS
if: matrix.os == 'macos-latest'
run: |
brew install gcc@11
brew install libomp llvm
- name: Set environment variables for macOS
if: matrix.os == 'macos-latest'
run: |
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix llvm)/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I$(brew --prefix llvm)/include" >> $GITHUB_ENV
echo "CPATH=$(brew --prefix libomp)/include" >> $GITHUB_ENV
echo "DEVITO_ARCH=clang" >> $GITHUB_ENV
- name: Run integration test on macOS
if: matrix.os == 'macos-latest'
run: |
make test-integration
- name: Run integration test
if: matrix.os == 'ubuntu-latest'
env:
DEVITO_ARCH: gcc-11
DEVITO_ARCH: gcc
run: |
make test-integration
make test-integration
3 changes: 2 additions & 1 deletion docs/examples/plot_ultrasound_imaging_multiplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"""

# %%
from typing import List
from typing import List, cast

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -129,6 +129,7 @@ def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
# - rho - density
# - alpha - attenuation
fig, axs = plt.subplots(1, 3, figsize=(15, 5))
axs = cast(np.ndarray, axs)

for idx, attribute in enumerate(["vp", "rho", "alpha"]):
im = axs[idx].imshow(getattr(scenario.problem.medium, attribute).data)
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/plot_ultrasound_imaging_scanline.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"""

# %%
from typing import List
from typing import List, cast

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -129,6 +129,7 @@ def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
# - rho - density
# - alpha - attenuation
fig, axs = plt.subplots(1, 3, figsize=(15, 5))
axs = cast(np.ndarray, axs)

for idx, attribute in enumerate(["vp", "rho", "alpha"]):
im = axs[idx].imshow(getattr(scenario.problem.medium, attribute).data)
Expand Down
11 changes: 11 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ As a last step **before running NDK**, follow the instructions below depending o

??? "Before running on MacOS"

<<<<<<< HEAD
The two main compiler options for MacOS are **clang** and **gcc**.

### clang

If you prefer to use **clang** you will have to install `libomp` and `llvm`, you will also have to export a few environment variables needed by the compiler.
=======
The single compiler option for MacOS is **clang**.

### clang

To setup your environment you will have to install `libomp` and `llvm`, you will also have to export a few environment variables needed by the compiler.
>>>>>>> main
1. Install libomp

Expand Down Expand Up @@ -89,6 +97,7 @@ As a last step **before running NDK**, follow the instructions below depending o
source ~/.zshrc
```

<<<<<<< HEAD
### gcc

On MacOS the `gcc` executable is a symbolic link to `clang`, so by defining ~~DEVITO_ARCH=gcc~~ devito will try to add `gcc` flags to the `clang` compiler, and the compilation will most probably fail.
Expand All @@ -114,6 +123,8 @@ As a last step **before running NDK**, follow the instructions below depending o
```


=======
>>>>>>> main
??? "Before running on Linux"

1. Export the `DEVITO_ARCH` environment variable, or add it to your shell profile:
Expand Down
4,047 changes: 2,059 additions & 1,988 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "neurotechdevkit"
version = "v0.6.1"
version = "v0.6.2"
description = "Neurotech Development Kit: an open-source software library designed to enhance accessibility to cutting-edge neurotechnology"
authors = ["AE Studio <[email protected]>"]
maintainers = ["AE Studio <[email protected]>"]
Expand Down Expand Up @@ -47,12 +47,13 @@ pyrevolve = ">=2.2.3"
pydicom = "^2.4.3"
nibabel = "^5.1.0"
flask-cors = "^4.0.0"
mypy = "1.11"

[tool.poetry.group.dev.dependencies]
black = {extras = ["jupyter"], version = "^23.9.1"}
flake8 = "^5.0.4"
isort = "^5.10.1"
mypy = "^0.990"
mypy = "^1.11"
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.20.2"
Expand Down Expand Up @@ -105,5 +106,6 @@ markers = [
include = ["src"]
reportGeneralTypeIssues = "none"
exclude = ["src/web/app"]

# [tool.flake8]
# flake8 does not support config in pyproject.toml, see .flake8
24 changes: 12 additions & 12 deletions src/neurotechdevkit/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Source(abc.ABC):
def __init__(
self,
*,
position: npt.ArrayLike,
direction: npt.ArrayLike,
position: list[float],
direction: list[float],
aperture: float,
focal_length: float,
num_points: int,
Expand Down Expand Up @@ -162,7 +162,7 @@ class PointSource(Source):
def __init__(
self,
*,
position: npt.ArrayLike,
position: list[float],
num_dim: int = 2,
delay: float = 0.0,
) -> None:
Expand Down Expand Up @@ -209,7 +209,7 @@ class PointSource2D(PointSource):
def __init__(
self,
*,
position: npt.ArrayLike,
position: list[float],
delay: float = 0.0,
) -> None:
"""Initialize a new 2-D point source."""
Expand All @@ -226,7 +226,7 @@ class PointSource3D(PointSource):
def __init__(
self,
*,
position: npt.ArrayLike,
position: list[float],
delay: float = 0.0,
) -> None:
"""Initialize a new 3-D point source."""
Expand Down Expand Up @@ -486,8 +486,8 @@ class UnfocusedSource(Source, abc.ABC):
def __init__(
self,
*,
position: npt.ArrayLike,
direction: npt.ArrayLike,
position: list[float],
direction: list[float],
aperture: float,
num_points: int,
delay: float = 0.0,
Expand Down Expand Up @@ -624,8 +624,8 @@ class PhasedArraySource(Source):
def __init__(
self,
*,
position: npt.ArrayLike,
direction: npt.ArrayLike,
position: list[float],
direction: list[float],
num_points: int,
num_elements: int,
pitch: float,
Expand Down Expand Up @@ -1173,9 +1173,9 @@ class PhasedArraySource3D(PhasedArraySource):
def __init__(
self,
*,
position: npt.ArrayLike,
direction: npt.ArrayLike,
center_line: npt.ArrayLike,
position: list[float],
direction: list[float],
center_line: list[float],
num_points: int,
num_elements: int,
pitch: float,
Expand Down
2 changes: 2 additions & 0 deletions src/web/messages/transducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def from_source(
focalLength=focal_length,
delay=source._delay,
elementDelays=element_delays,
centerLine=None,
height=None,
)

def to_ndk_source(self) -> Union[PhasedArraySource2D, PhasedArraySource3D]:
Expand Down

0 comments on commit eeefed1

Please sign in to comment.