|
11 | 11 | ) |
12 | 12 |
|
13 | 13 |
|
| 14 | +@pytest.mark.full_data |
| 15 | +def test_pipe_tomopy_tomobank_preview( |
| 16 | + get_files: Callable, |
| 17 | + cmd, |
| 18 | + tomobank_00088, |
| 19 | + tomopy_tomobank, |
| 20 | + tomobank00088_tomopy_npz, |
| 21 | + output_folder, |
| 22 | +): |
| 23 | + change_value_parameters_method_pipeline( |
| 24 | + tomopy_tomobank, |
| 25 | + method=[ |
| 26 | + "standard_tomo", |
| 27 | + "standard_tomo", |
| 28 | + "standard_tomo", |
| 29 | + "standard_tomo", |
| 30 | + "standard_tomo", |
| 31 | + "standard_tomo", |
| 32 | + "find_center_vo", |
| 33 | + ], |
| 34 | + key=[ |
| 35 | + "preview", |
| 36 | + "data_path", |
| 37 | + "image_key_path", |
| 38 | + "rotation_angles", |
| 39 | + "darks", |
| 40 | + "flats", |
| 41 | + "ind", |
| 42 | + ], |
| 43 | + value=[ |
| 44 | + {"detector_y": {"start": 500, "stop": 510}}, |
| 45 | + "/exchange/data", |
| 46 | + None, |
| 47 | + { |
| 48 | + "user_defined": { |
| 49 | + "start_angle": 0, |
| 50 | + "stop_angle": 179.876, |
| 51 | + "angles_total": 1500, |
| 52 | + } |
| 53 | + }, |
| 54 | + { |
| 55 | + "file": "input_data", |
| 56 | + "image_key_path": None, |
| 57 | + "data_path": "/exchange/data_dark", |
| 58 | + }, |
| 59 | + { |
| 60 | + "file": "input_data", |
| 61 | + "image_key_path": None, |
| 62 | + "data_path": "/exchange/data_white", |
| 63 | + }, |
| 64 | + "mid", |
| 65 | + ], |
| 66 | + ) |
| 67 | + |
| 68 | + cmd.pop(4) #: don't save all |
| 69 | + cmd.insert(5, tomobank_00088) |
| 70 | + cmd.insert(7, tomopy_tomobank) |
| 71 | + cmd.insert(8, output_folder) |
| 72 | + |
| 73 | + subprocess.check_output(cmd) |
| 74 | + |
| 75 | + files = get_files(output_folder) |
| 76 | + |
| 77 | + #: check the generated reconstruction (hdf5 file) |
| 78 | + h5_files = list(filter(lambda x: ".h5" in x, files)) |
| 79 | + assert len(h5_files) == 1 |
| 80 | + |
| 81 | + # load the pre-saved numpy array for comparison bellow |
| 82 | + data_gt = tomobank00088_tomopy_npz["data"] |
| 83 | + axis_slice = tomobank00088_tomopy_npz["axis_slice"] |
| 84 | + |
| 85 | + res_norm = calculate_gt_residual( |
| 86 | + path_to_data="data/", |
| 87 | + h5_file_name="tomopy", |
| 88 | + h5_files=h5_files, |
| 89 | + data_gt=data_gt, |
| 90 | + axis_slice=axis_slice, |
| 91 | + ) |
| 92 | + |
| 93 | + assert res_norm < 1e-4 |
| 94 | + |
| 95 | + |
| 96 | +@pytest.mark.full_data |
| 97 | +def test_pipe_FBP3d_tomobar_tomobank_preview( |
| 98 | + get_files: Callable, |
| 99 | + cmd, |
| 100 | + tomobank_00088, |
| 101 | + FBP3d_tomobar_tomobank, |
| 102 | + tomobank00088_FBP3d_tomobar, |
| 103 | + output_folder, |
| 104 | +): |
| 105 | + change_value_parameters_method_pipeline( |
| 106 | + FBP3d_tomobar_tomobank, |
| 107 | + method=[ |
| 108 | + "standard_tomo", |
| 109 | + "standard_tomo", |
| 110 | + "standard_tomo", |
| 111 | + "standard_tomo", |
| 112 | + "standard_tomo", |
| 113 | + "standard_tomo", |
| 114 | + "find_center_vo", |
| 115 | + ], |
| 116 | + key=[ |
| 117 | + "preview", |
| 118 | + "data_path", |
| 119 | + "image_key_path", |
| 120 | + "rotation_angles", |
| 121 | + "darks", |
| 122 | + "flats", |
| 123 | + "ind", |
| 124 | + ], |
| 125 | + value=[ |
| 126 | + {"detector_y": {"start": 500, "stop": 510}}, |
| 127 | + "/exchange/data", |
| 128 | + None, |
| 129 | + { |
| 130 | + "user_defined": { |
| 131 | + "start_angle": 0, |
| 132 | + "stop_angle": 179.876, |
| 133 | + "angles_total": 1500, |
| 134 | + } |
| 135 | + }, |
| 136 | + { |
| 137 | + "file": "input_data", |
| 138 | + "image_key_path": None, |
| 139 | + "data_path": "/exchange/data_dark", |
| 140 | + }, |
| 141 | + { |
| 142 | + "file": "input_data", |
| 143 | + "image_key_path": None, |
| 144 | + "data_path": "/exchange/data_white", |
| 145 | + }, |
| 146 | + "mid", |
| 147 | + ], |
| 148 | + ) |
| 149 | + |
| 150 | + cmd.pop(4) #: don't save all |
| 151 | + cmd.insert(5, tomobank_00088) |
| 152 | + cmd.insert(7, FBP3d_tomobar_tomobank) |
| 153 | + cmd.insert(8, output_folder) |
| 154 | + |
| 155 | + subprocess.check_output(cmd) |
| 156 | + |
| 157 | + files = get_files(output_folder) |
| 158 | + |
| 159 | + #: check the generated reconstruction (hdf5 file) |
| 160 | + h5_files = list(filter(lambda x: ".h5" in x, files)) |
| 161 | + assert len(h5_files) == 1 |
| 162 | + |
| 163 | + # load the pre-saved numpy array for comparison bellow |
| 164 | + data_gt = tomobank00088_FBP3d_tomobar["data"] |
| 165 | + axis_slice = tomobank00088_FBP3d_tomobar["axis_slice"] |
| 166 | + |
| 167 | + res_norm = calculate_gt_residual( |
| 168 | + path_to_data="data/", |
| 169 | + h5_file_name="FBP3d_tomobar", |
| 170 | + h5_files=h5_files, |
| 171 | + data_gt=data_gt, |
| 172 | + axis_slice=axis_slice, |
| 173 | + ) |
| 174 | + |
| 175 | + assert res_norm < 1e-4 |
| 176 | + |
| 177 | + |
14 | 178 | @pytest.mark.full_data |
15 | 179 | def test_pipe_FBP3d_tomobar_k11_38731_in_disk( |
16 | 180 | get_files: Callable, |
@@ -476,167 +640,3 @@ def test_pipe_sweep_paganin_FBP3d_tomobar_i12_119647( |
476 | 640 |
|
477 | 641 |
|
478 | 642 | # ######################################################################## |
479 | | - |
480 | | - |
481 | | -@pytest.mark.full_data |
482 | | -def test_pipe_tomopy_tomobank_preview( |
483 | | - get_files: Callable, |
484 | | - cmd, |
485 | | - tomobank_00088, |
486 | | - tomopy_tomobank, |
487 | | - tomobank00088_tomopy_npz, |
488 | | - output_folder, |
489 | | -): |
490 | | - change_value_parameters_method_pipeline( |
491 | | - tomopy_tomobank, |
492 | | - method=[ |
493 | | - "standard_tomo", |
494 | | - "standard_tomo", |
495 | | - "standard_tomo", |
496 | | - "standard_tomo", |
497 | | - "standard_tomo", |
498 | | - "standard_tomo", |
499 | | - "find_center_vo", |
500 | | - ], |
501 | | - key=[ |
502 | | - "preview", |
503 | | - "data_path", |
504 | | - "image_key_path", |
505 | | - "rotation_angles", |
506 | | - "darks", |
507 | | - "flats", |
508 | | - "ind", |
509 | | - ], |
510 | | - value=[ |
511 | | - {"detector_y": {"start": 500, "stop": 510}}, |
512 | | - "/exchange/data", |
513 | | - None, |
514 | | - { |
515 | | - "user_defined": { |
516 | | - "start_angle": 0, |
517 | | - "stop_angle": 179.876, |
518 | | - "angles_total": 1500, |
519 | | - } |
520 | | - }, |
521 | | - { |
522 | | - "file": "input_data", |
523 | | - "image_key_path": None, |
524 | | - "data_path": "/exchange/data_dark", |
525 | | - }, |
526 | | - { |
527 | | - "file": "input_data", |
528 | | - "image_key_path": None, |
529 | | - "data_path": "/exchange/data_white", |
530 | | - }, |
531 | | - "mid", |
532 | | - ], |
533 | | - ) |
534 | | - |
535 | | - cmd.pop(4) #: don't save all |
536 | | - cmd.insert(5, tomobank_00088) |
537 | | - cmd.insert(7, tomopy_tomobank) |
538 | | - cmd.insert(8, output_folder) |
539 | | - |
540 | | - subprocess.check_output(cmd) |
541 | | - |
542 | | - files = get_files(output_folder) |
543 | | - |
544 | | - #: check the generated reconstruction (hdf5 file) |
545 | | - h5_files = list(filter(lambda x: ".h5" in x, files)) |
546 | | - assert len(h5_files) == 1 |
547 | | - |
548 | | - # load the pre-saved numpy array for comparison bellow |
549 | | - data_gt = tomobank00088_tomopy_npz["data"] |
550 | | - axis_slice = tomobank00088_tomopy_npz["axis_slice"] |
551 | | - |
552 | | - res_norm = calculate_gt_residual( |
553 | | - path_to_data="data/", |
554 | | - h5_file_name="tomopy", |
555 | | - h5_files=h5_files, |
556 | | - data_gt=data_gt, |
557 | | - axis_slice=axis_slice, |
558 | | - ) |
559 | | - |
560 | | - assert res_norm < 1e-4 |
561 | | - |
562 | | - |
563 | | -@pytest.mark.full_data |
564 | | -def test_pipe_FBP3d_tomobar_tomobank_preview( |
565 | | - get_files: Callable, |
566 | | - cmd, |
567 | | - tomobank_00088, |
568 | | - FBP3d_tomobar_tomobank, |
569 | | - tomobank00088_FBP3d_tomobar, |
570 | | - output_folder, |
571 | | -): |
572 | | - change_value_parameters_method_pipeline( |
573 | | - FBP3d_tomobar_tomobank, |
574 | | - method=[ |
575 | | - "standard_tomo", |
576 | | - "standard_tomo", |
577 | | - "standard_tomo", |
578 | | - "standard_tomo", |
579 | | - "standard_tomo", |
580 | | - "standard_tomo", |
581 | | - "find_center_vo", |
582 | | - ], |
583 | | - key=[ |
584 | | - "preview", |
585 | | - "data_path", |
586 | | - "image_key_path", |
587 | | - "rotation_angles", |
588 | | - "darks", |
589 | | - "flats", |
590 | | - "ind", |
591 | | - ], |
592 | | - value=[ |
593 | | - {"detector_y": {"start": 500, "stop": 510}}, |
594 | | - "/exchange/data", |
595 | | - None, |
596 | | - { |
597 | | - "user_defined": { |
598 | | - "start_angle": 0, |
599 | | - "stop_angle": 179.876, |
600 | | - "angles_total": 1500, |
601 | | - } |
602 | | - }, |
603 | | - { |
604 | | - "file": "input_data", |
605 | | - "image_key_path": None, |
606 | | - "data_path": "/exchange/data_dark", |
607 | | - }, |
608 | | - { |
609 | | - "file": "input_data", |
610 | | - "image_key_path": None, |
611 | | - "data_path": "/exchange/data_white", |
612 | | - }, |
613 | | - "mid", |
614 | | - ], |
615 | | - ) |
616 | | - |
617 | | - cmd.pop(4) #: don't save all |
618 | | - cmd.insert(5, tomobank_00088) |
619 | | - cmd.insert(7, FBP3d_tomobar_tomobank) |
620 | | - cmd.insert(8, output_folder) |
621 | | - |
622 | | - subprocess.check_output(cmd) |
623 | | - |
624 | | - files = get_files(output_folder) |
625 | | - |
626 | | - #: check the generated reconstruction (hdf5 file) |
627 | | - h5_files = list(filter(lambda x: ".h5" in x, files)) |
628 | | - assert len(h5_files) == 1 |
629 | | - |
630 | | - # load the pre-saved numpy array for comparison bellow |
631 | | - data_gt = tomobank00088_FBP3d_tomobar["data"] |
632 | | - axis_slice = tomobank00088_FBP3d_tomobar["axis_slice"] |
633 | | - |
634 | | - res_norm = calculate_gt_residual( |
635 | | - path_to_data="data/", |
636 | | - h5_file_name="FBP3d_tomobar", |
637 | | - h5_files=h5_files, |
638 | | - data_gt=data_gt, |
639 | | - axis_slice=axis_slice, |
640 | | - ) |
641 | | - |
642 | | - assert res_norm < 1e-4 |
0 commit comments