Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ juno.egg-info/PKG-INFO

!mkdocs.yml
# !docs.yml
!.github/workflows/*
!.github/workflows/*

# simulation generated files
*.png
*.json
*.csv
*.log
6 changes: 6 additions & 0 deletions juno/Lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,12 @@ def calculate_escape_path_dimensions(lens: Lens, ep: float):
lens_h, lens_w = lens.profile.shape
ep_h, ep_w = int(lens_h * (1 + ep)), int(lens_w * (1 + ep))

# ensure the escape path is odd
if ep_h % 2 == 0:
ep_h += 1
if ep_w % 2 == 0:
ep_w += 1

return (ep_h, ep_w)


Expand Down
4 changes: 4 additions & 0 deletions juno/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '0.1.dev560+gefa629d.d20230301'
__version_tuple__ = version_tuple = (0, 1, 'dev560', 'gefa629d.d20230301')
5 changes: 5 additions & 0 deletions juno/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ def validate_beam_configuration(settings: BeamSettings):
if settings.source_distance is None:
raise ValueError(f"A source_distance must be provided for {settings.distance_mode}")

# check if step size greater than propagation distance
if settings.step_size is not None:
if settings.step_size > settings.source_distance:
raise ValueError(f"The step_size ({settings.step_size:.2e}m) must be less than the source_distance ({settings.source_distance:.2e}m) for {settings.distance_mode}.")

if settings.distance_mode == DistanceMode.Focal:
if settings.beam_spread not in [BeamSpread.Converging, BeamSpread.Diverging]:
raise ValueError(f"BeamSpread must be Converging, or Diverging for {settings.distance_mode} (currently {settings.beam_spread})")
Expand Down
4 changes: 4 additions & 0 deletions juno/juno_custom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# README


The tools in this directory are experimental and are not supported by the Juno team. They are provided as-is and are not guaranteed to work. If you find a bug, please report it on Github
Empty file added juno/juno_custom/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions juno/juno_custom/element_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from abc import ABC, abstractmethod

from juno import Lens


class ElementTemplate(ABC):
def __init__(self) -> None:
pass

def __repr__(self) -> str:
return f"Custom Element: {self.name}"

@abstractmethod
def generate_profile(self):
raise NotImplementedError("Custom elements must be modified in some way.")

def analyse(self):
print("No analysis conducted.")

@staticmethod
@abstractmethod
def __keys__() -> dict:
raise NotImplementedError(
"Custom elements must have a list of keys to generate a profile."
)
Empty file.
26 changes: 26 additions & 0 deletions juno/juno_custom/elements/axicon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# from juno.Lens import Lens

# from juno_custom.element_template import ElementTemplate


# AXICON_KEYS = ["height", "width", "exponent", "coefficient", "pixel_size"]

# class Axicon(ElementTemplate):
# def __init__(self, lens: Lens) -> None:
# super().__init__(lens)
# self.name = "Axicon"

# def __identifier__(self) -> str:
# return f"""Axicon"""

# def __repr__(self) -> str:
# return f"""Axicon (Exponent = 1.0)"""

# def generate_profile(self):
# self.lens.exponent = 1

# def analyse(self):
# print("Axicon analysis.")

# def __keys__(self) -> list:
# return AXICON_KEYS
21 changes: 21 additions & 0 deletions juno/juno_custom/elements/focusing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# from juno_custom.element_template import ElementTemplate
# from juno.Lens import Lens

# FOCUSING_KEYS = ["height", "width", "exponent", "coefficient", "pixel_size"]

# class FocusingLens(ElementTemplate):
# def __init__(self, lens: Lens) -> None:
# super().__init__(lens)
# self.name = "Focusing"

# def __repr__(self) -> str:
# return f"""Focusing Lens (Exponent = 2.0)"""

# def generate_profile(self):
# self.lens.exponent = 2

# def analyse(self):
# print("Focusing")

# def __keys__(self) -> list:
# return FOCUSING_KEYS
Loading