Skip to content

Commit

Permalink
Screening field at position (#106)
Browse files Browse the repository at this point in the history
* Fix bug in Solution.screening_field_at_position()

* Update docs

* cleanup solution.py
  • Loading branch information
loganbvh committed Sep 19, 2023
1 parent 053026a commit 23835f6
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 146 deletions.
Binary file modified docs/images/logo_currents.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/logo_currents_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/logo_fields.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/logo_streams.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/logo_terminal_currents.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/logo_terminal_streams.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/notebooks/field-sources.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
{
"data": {
"text/html": [
"<table><tr><th>Software</th><th>Version</th></tr><tr><td>SuperScreen</td><td>0.10.0</td></tr><tr><td>Numpy</td><td>1.23.3</td></tr><tr><td>Numba</td><td>0.57.0</td></tr><tr><td>SciPy</td><td>1.9.1</td></tr><tr><td>matplotlib</td><td>3.6.0</td></tr><tr><td>IPython</td><td>8.5.0</td></tr><tr><td>Python</td><td>3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:01:00) \n",
"[Clang 13.0.1 ]</td></tr><tr><td>OS</td><td>posix [darwin]</td></tr><tr><td>Number of CPUs</td><td>Physical: 10, Logical: 10</td></tr><tr><td>BLAS Info</td><td>OPENBLAS</td></tr><tr><td colspan='2'>Thu Aug 03 13:18:33 2023 PDT</td></tr></table>"
"<table><tr><th>Software</th><th>Version</th></tr><tr><td>SuperScreen</td><td>0.10.2</td></tr><tr><td>Numpy</td><td>1.23.3</td></tr><tr><td>Numba</td><td>0.57.0</td></tr><tr><td>SciPy</td><td>1.9.1</td></tr><tr><td>matplotlib</td><td>3.6.0</td></tr><tr><td>IPython</td><td>8.5.0</td></tr><tr><td>Python</td><td>3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:01:00) \n",
"[Clang 13.0.1 ]</td></tr><tr><td>OS</td><td>posix [darwin]</td></tr><tr><td>Number of CPUs</td><td>Physical: 10, Logical: 10</td></tr><tr><td>BLAS Info</td><td>OPENBLAS</td></tr><tr><td colspan='2'>Tue Sep 19 16:13:07 2023 PDT</td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand Down Expand Up @@ -142,9 +142,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"x = 0.45250693865850633\n",
"y = 0.26481336104450504\n",
"z = 0.4510648754100197\n",
"x = 0.7650684631746568\n",
"y = 0.7478751704881408\n",
"z = 0.18189859902136085\n",
"field(x, y, z) = 5.0\n"
]
}
Expand Down
26 changes: 13 additions & 13 deletions docs/notebooks/logo.ipynb

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/notebooks/polygons.ipynb

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions docs/notebooks/quickstart.ipynb

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions docs/notebooks/scanning-squid.ipynb

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions docs/notebooks/terminal-currents.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions superscreen/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,14 @@ def screening_field_at_position(
if not isinstance(zs, np.ndarray):
raise ValueError(f"Expected zs to be an ndarray, but got {type(zs)}.")

fields = {}
shape = (len(positions),)
if vector:
shape = shape + (3,)
zeros = np.zeros(len(positions), dtype=dtype)
# Compute the fields at the specified positions from the currents in each film
fields = {}
for name, film in device.films.items():
layer = layers[film.layer]
field_from_film = np.zeros(len(positions), dtype=dtype)
if vector:
field_from_film = np.zeros((len(positions), 3), dtype=dtype)
else:
field_from_film = np.zeros(len(positions), dtype=dtype)
in_film = np.zeros(len(positions), dtype=bool)
if np.all(zs == layer.z0):
# Evaluate the screening field within a film.
Expand All @@ -695,6 +694,7 @@ def screening_field_at_position(
)
if vector:
# Make shape (m, 3)
zeros = np.zeros_like(field_in_film)
field_in_film = np.array([zeros, zeros, field_in_film]).T
field_from_film[in_film] = field_in_film
# Evaluate the screening field outside of any films.
Expand Down
2 changes: 1 addition & 1 deletion superscreen/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = (0, 10, 1)
__version_info__ = (0, 10, 2)
__version__ = ".".join(map(str, __version_info__))

0 comments on commit 23835f6

Please sign in to comment.