Skip to content

Commit

Permalink
Updated tests for simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewHerzing committed Mar 20, 2024
1 parent 691e626 commit cd92bcb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tomotools/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def create_catalyst_model(nparticles=15, particle_density=255, support_density=1
return catalyst


def create_cylinder_model(radius=30, blur=True, blur_sigma=1.5, add_others=True):
def create_cylinder_model(radius=30, blur=True, blur_sigma=1.5, add_others=False):
"""
Create a model data array that mimics a needle shaped sample.
Expand Down
14 changes: 10 additions & 4 deletions tomotools/tests/test_simulation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from tomotools import simulation as sim
import numpy as np
from hyperspy.signals import Signal2D


class TestModels:
Expand All @@ -11,10 +12,15 @@ def test_catalyst_model_with_particle(self):
stack = sim.create_catalyst_model(1, volsize=[20, 20, 20], support_radius=5, size_interval=[2, 3])
assert stack.data.shape == (20, 20, 20)

def test_needle_model(self):
model = sim.create_needle_model()
assert model.shape == (256, 256, 256)
assert type(model) is np.ndarray
def test_cylinder_model(self):
model = sim.create_cylinder_model()
assert model.data.shape == (200, 200, 200)
assert type(model) is Signal2D

def test_cylinder_model_with_others(self):
model = sim.create_cylinder_model(add_others=True)
assert model.data.shape == (400, 400, 400)
assert type(model) is Signal2D

def test_tilt_series_model(self):
stack = sim.create_catalyst_model(0, volsize=[10, 10, 10])
Expand Down

0 comments on commit cd92bcb

Please sign in to comment.