Skip to content

Commit

Permalink
Change default ray energy to 100 KeV
Browse files Browse the repository at this point in the history
  • Loading branch information
jgray-19 committed Jan 24, 2024
1 parent bf4d636 commit b5e107f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ray.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
obj.dist_to_detector = dist_to_detector;
obj.end_point = start_point + direction .* dist_to_detector;

obj.energy = 10; %KeV
obj.energy = 100; %KeV
end

function [lengths, indices] = get_intersections(self, voxels)
Expand Down
14 changes: 7 additions & 7 deletions tests/ray_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ function test_ray_init(tc)
tc.assertEqual(r.start_point, [0;0;0]);
tc.assertEqual(r.direction, [1;0;0]);
tc.assertEqual(r.end_point, [10;0;0]);
tc.assertEqual(r.energy, 10); % default energy - may change later
tc.assertEqual(r.energy, 100); % default energy - may change later

r2 = ray([0;-5;0], [0;1;0], 10);
tc.assertEqual(r2.start_point, [0;-5;0]);
tc.assertEqual(r2.direction, [0;1;0]);
tc.assertEqual(r2.end_point, [0;5;0]);
tc.assertEqual(r2.energy, 10); % default energy - may change later
tc.assertEqual(r2.energy, 100); % default energy - may change later
end

function test_siddon_ray(tc)
Expand All @@ -86,7 +86,7 @@ function test_siddon_ray(tc)
function test_calculate_mu(tc)
my_box = voxel_box([0;0;0], [3;3;3], @water);
array = voxel_array(zeros(3, 1), [5; 5; 5], 1, my_box);
voxel_attenuation = water(10/1000); % Default value of ray
voxel_attenuation = water(100/1000); % Default value of ray

r = ray([-6;0;0], [1;0;0], 12);
tc.assertEqual(r.calculate_mu(array), 3*voxel_attenuation, "RelTol", 2e-16);
Expand All @@ -110,14 +110,14 @@ function test_update_parameters(tc)
tc.assertEqual(r.start_point, [1;0;0]);
tc.assertEqual(r.direction, [0;1;0]);
tc.assertEqual(r.end_point, [1;10;0]);
tc.assertEqual(r.energy, 10); % default energy - may change later
tc.assertEqual(r.energy, 100); % default energy - may change later

r = ray([0;0;0], [1;0;0], 5);
r = r.update_parameters([0;0;1], [0;0;1]);
tc.assertEqual(r.start_point, [0;0;1]);
tc.assertEqual(r.direction, [0;0;1]);
tc.assertEqual(r.end_point, [0;0;6]);
tc.assertEqual(r.energy, 10); % default energy - may change later
tc.assertEqual(r.energy, 100); % default energy - may change later
end

function test_move_start_point(tc)
Expand All @@ -126,14 +126,14 @@ function test_move_start_point(tc)
tc.assertEqual(r.start_point, [1;0;0]);
tc.assertEqual(r.direction, [1;0;0]);
tc.assertEqual(r.end_point, [11;0;0]);
tc.assertEqual(r.energy, 10); % default energy - may change later
tc.assertEqual(r.energy, 100); % default energy - may change later

r = ray([0;0;0], [1;0;0], 10);
r = r.move_start_point([0;0;1]);
tc.assertEqual(r.start_point, [0;0;1]);
tc.assertEqual(r.direction, [1;0;0]);
tc.assertEqual(r.end_point, [10;0;1]);
tc.assertEqual(r.energy, 10); % default energy - may change later
tc.assertEqual(r.energy, 100); % default energy - may change later
end
end
end

0 comments on commit b5e107f

Please sign in to comment.