-
Notifications
You must be signed in to change notification settings - Fork 12
5.2 Postprocessing
Once you stored the outputs from the fracture analysis pipeline, you usually want to plot your data in a use case specific way. To help doing so, we prepared a OutputReader
class.
This class must be imported and initialized using
# imports
import os
from crackpy.fracture_analysis.read import OutputReader
# initialization
reader = OutputReader()
The reader has one main function reader.make_csv_from_results()
. However, before generating such csv-files, the reader has to read from the Fracture Analysis Tool output files. It is possible to read a list of Tags. You can generally check the list of possible tags in the fat-output file. One possible tag is defined by <TAG_NAME>
.
path_to_fat_output_files = os.path.join("path", "to", "files")
files = os.listdir(path_to_fat_output_files)
list_of_tags_to_read = ["CJP_results", "SIFs_integral"]
for file in files:
for tag in list_of_tags_to_read:
reader.read_tag_data(path=path_to_fat_output_files, filename=file, tag=tag)
Now, the reader stored a dictionary reader.data
that refers for each fat-output-file-name to another dictionary for every tag that was read, i.e. tag_string -> tag_data. Additionally, the experimental data are always stored.
Now, we can export the read data to csv. In many cases, it is easier to filter the data before exporting, e.g. to only export data for specific crack lengths or forces. To this purpose, we can define a dictionary, where the keys may refer to any experimental data keywords, e.g. "Force", or "Crack_tip_x" and the values indicate minimum and maximum values for that keyword. Moreover, it is possible to export only a list of filenames or a list of tags or "all".
filter_conditions = {"Force": (14900.0, 15100.0, "Crack_tip_x": (-25.2, -24.5)}
reader.make_csv_from_results(files="all", output_path=os.path.join("path", "to", "csv_export"),
output_filename, tags="all", filter_condition=filter_conditions)