Skip to content

Commit

Permalink
Added ice model to simulate potential
Browse files Browse the repository at this point in the history
  • Loading branch information
jmp1985 committed Apr 17, 2024
1 parent 04620d3 commit d7e3bc8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/parakeet/simulate/_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,27 @@ def __call__(self, index):
potential.voxel_size = tuple((pixel_size, pixel_size, slice_thickness))

# Simulate the potential
simulate.potential(potential, volume_z0)
if self.simulation["ice"] == True:
# Get the masker
masker = simulate.masker(
index,
pixel_size,
origin,
offset,
orientation,
position,
self.sample,
self.scan,
self.simulation,
)

# Run the simulation
image = simulate.potential(potential, volume_z0, masker)

else:
# Run the simulation
logger.info("Simulating")
simulate.potential(potential, volume_z0)

# Compute the image scaled with Poisson noise
return (index, None, None)
Expand Down
9 changes: 7 additions & 2 deletions src/parakeet/simulate/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def ctf(self):
"""
return np.array(multem.compute_ctf(self.system_conf, self.input)).T

def potential(self, out, volume_z0):
def potential(self, out, volume_z0, masker=None):
"""
Simulate the potential
Expand All @@ -407,7 +407,12 @@ def callback(z0, z1, V):
out.data[index, :, :] = V[margin:-margin, margin:-margin].T

# Run the simulation
multem.compute_projected_potential(self.system_conf, self.input, callback)
if masker is not None:
multem.compute_projected_potential(
self.system_conf, self.input, masker, callback
)
else:
multem.compute_projected_potential(self.system_conf, self.input, callback)

def image(self, masker=None):
"""
Expand Down

0 comments on commit d7e3bc8

Please sign in to comment.