Skip to content

Commit 6df063a

Browse files
draft for paper
1 parent f4bb356 commit 6df063a

34 files changed

+147453
-2426
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ deeptrack-app/*
44

55
build/*
66
dist/*
7-
*.egg-info/
7+
*.egg-info/
8+
*/datasets/*

deeptrack/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .aberrations import *
2+
from .augmentations import *
3+
from .features import *
4+
from .math import *
5+
from .noises import *
6+
from .optics import *
7+
from .scatterers import *
8+
from .sequences import *
9+
10+
from . import image, losses, generators, models, utils

deeptrack/aberrations.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
''' Features that aberrate and modify pupil functions
1+
''' Features that aberrate and modify pupil functions.
22
33
Classes
44
-------
@@ -54,7 +54,6 @@ def _process_and_get(self, image_list, **kwargs):
5454
for image in image_list:
5555
x = np.arange(image.shape[0]) - image.shape[0] / 2
5656
y = np.arange(image.shape[1]) - image.shape[1] / 2
57-
5857
X, Y = np.meshgrid(x, y)
5958
rho = np.sqrt(X**2 + Y**2)
6059
rho /= np.max(rho[image != 0])
@@ -69,7 +68,6 @@ def _process_and_get(self, image_list, **kwargs):
6968
# AMPLITUDE ABERRATIONS
7069

7170

72-
7371
class GaussianApodization(Aberration):
7472
''' Introduces pupil apodization.
7573
@@ -81,15 +79,28 @@ class GaussianApodization(Aberration):
8179
sigma : float
8280
The standard deviation of the apodization. The edge of the pupil
8381
is at one deviation from the center.
82+
offset : (float, float)
83+
Offsets the center of the gaussian.
8484
8585
'''
8686

87-
def __init__(self, sigma, **kwargs):
88-
super().__init__(sigma=sigma, **kwargs)
87+
def __init__(self, sigma=1, offset=(0, 0), **kwargs):
88+
super().__init__(sigma=sigma, offset=offset, **kwargs)
89+
90+
91+
def get(self, pupil, offset, sigma, rho, **kwargs):
92+
if offset != (0, 0):
93+
x = np.arange(pupil.shape[0]) - pupil.shape[0] / 2 - offset[0]
94+
y = np.arange(pupil.shape[1]) - pupil.shape[1] / 2 - offset[1]
95+
X, Y = np.meshgrid(x, y)
96+
rho = np.sqrt(X**2 + Y**2)
97+
rho /= np.max(rho[pupil != 0])
98+
rho[rho > 1] = np.inf
8999

90100

91-
def get(self, pupil, sigma, rho, **kwargs):
92-
return pupil * np.exp(-(rho / sigma)**2)
101+
pupil = pupil * np.exp(-(rho / sigma)**2)
102+
return pupil
103+
93104

94105

95106

@@ -100,7 +111,7 @@ def get(self, pupil, sigma, rho, **kwargs):
100111
class Zernike(Aberration):
101112
''' Introduces a Zernike phase aberration.
102113
103-
Calculates the Zernike polynomial deined by the numbers `n` and `m` at
114+
Calculates the Zernike polynomial defined by the numbers `n` and `m` at
104115
each pixel in the pupil, multiplies it by `coefficient`, and adds the
105116
result to the phase of the pupil.
106117

0 commit comments

Comments
 (0)