-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt main to the new post-processing classes
- Loading branch information
1 parent
f80921a
commit 5d0784e
Showing
1 changed file
with
21 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,30 @@ | ||
import os | ||
import shutil | ||
from pathlib import Path | ||
from typing import Type | ||
|
||
from f4e_radwaste.post_processing.calculate_dose_rates import DoseCalculator | ||
from f4e_radwaste.post_processing.components_info import ComponentsInfo | ||
from f4e_radwaste.post_processing.folder_paths import FolderPaths | ||
from f4e_radwaste.post_processing.input_data import InputData | ||
from f4e_radwaste.post_processing.post_processing import ( | ||
process_input_data_by_material, | ||
process_input_data_by_components, | ||
) | ||
from f4e_radwaste.readers import ( | ||
dgs_file, | ||
mesh_info_file, | ||
isotope_criteria_file, | ||
filter_cells_file, | ||
) | ||
from f4e_radwaste.readers.aux_material_file import read_element_mixes_of_materials | ||
from f4e_radwaste.readers.component_ids_file import ( | ||
get_component_ids_from_folder, | ||
get_relevant_cells_from_components, | ||
) | ||
from f4e_radwaste.readers.dose_matrix_file import ( | ||
read_dose_1_m_factors, | ||
read_contact_dose_rate_factors, | ||
StandardProcessor, | ||
ByComponentProcessor, | ||
FilteredProcessor, | ||
) | ||
|
||
|
||
# def standard_process(input_folder_path: Path): | ||
# # Get the data | ||
# folder_paths = get_folder_paths(input_folder_path) | ||
# input_data = load_input_data_from_folder(folder_paths.input_files) | ||
# | ||
# # Save the data tables before formatting | ||
# input_data.save_data_tables(folder_paths) | ||
# | ||
# # Process and save the data grouped by material in VTK and CSV | ||
# process_input_data_by_material(input_data, folder_paths) | ||
# | ||
# | ||
# def filtered_process(input_folder_path: Path): | ||
# # Get the data | ||
# folder_paths = get_folder_paths(input_folder_path) | ||
# input_data = load_input_data_from_folder(folder_paths.input_files) | ||
# cells_to_include = filter_cells_file.read_file(folder_paths.input_files) | ||
# | ||
# # Apply the filter | ||
# input_data.apply_filter_include_cells(cells_to_include) | ||
# | ||
# # Save the data tables before formatting | ||
# input_data.save_data_tables(folder_paths) | ||
# | ||
# # Process and save the data grouped by material in VTK and CSV | ||
# process_input_data_by_material(input_data, folder_paths) | ||
# | ||
# | ||
# def by_component_process(input_folder_path: Path): | ||
# # Get the data | ||
# folder_paths = get_folder_paths(input_folder_path) | ||
# input_data = load_input_data_from_folder(folder_paths.input_files) | ||
# component_ids = get_component_ids_from_folder(folder_paths.input_files) | ||
# dose_calculator = DoseCalculator( | ||
# dose_1_m_factors=read_dose_1_m_factors(PATH_TO_DOSE_FACTORS_FILE), | ||
# cdr_factors=read_contact_dose_rate_factors(PATH_TO_DOSE_FACTORS_FILE), | ||
# element_mix_by_material_id=read_element_mixes_of_materials( | ||
# folder_paths.input_files | ||
# ), | ||
# ) | ||
# | ||
# # Filter in only the cells that appear in the components for performance reasons | ||
# cells_to_include = get_relevant_cells_from_components(component_ids) | ||
# input_data.apply_filter_include_cells(cells_to_include) | ||
# | ||
# # Process and save the data grouped by component in CSV | ||
# process_input_data_by_components( | ||
# input_data, folder_paths, component_ids, dose_calculator | ||
# ) | ||
def standard_process(input_path: Path): | ||
load_and_process_folder(input_path, StandardProcessor) | ||
|
||
|
||
def filtered_process(input_path: Path): | ||
load_and_process_folder(input_path, FilteredProcessor) | ||
|
||
|
||
def by_component_process(input_path: Path): | ||
load_and_process_folder(input_path, ByComponentProcessor) | ||
|
||
|
||
def load_and_process_folder(input_path: Path, processor_type: Type[StandardProcessor]): | ||
processor = processor_type(input_path) | ||
processor.process() | ||
|
||
|
||
if __name__ == "__main__": | ||
by_component_process(Path(r"D:\WORK\tryingSimple\tests\old_data\ivvs_cart")) | ||
# standard_process(Path(r"D:\WORK\test_results")) | ||
standard_process(Path(r"D:\WORK\tryingSimple\tests\old_data\ivvs_cart")) |