<jupyter_start><jupyter_text>[![Notebook Tutorial](__code/__all/notebook_tutorial.png)](https://neutronimaging.pages.ornl.gov/tutorial/notebooks/bragg_edge_raw_sample_and_powder)  Select Your IPTS<jupyter_code>from __code import system
from __code.bragg_edge.bragg_edge_raw_sample_and_powder import BraggEdge
from __code.bragg_edge.bragg_edge import Interface

system.System.select_working_dir(facility='SNS', instrument='SNAP')
from __code.__all import custom_style
custom_style.style()

from plotly.offline import plot, init_notebook_mode, iplot
init_notebook_mode()<jupyter_output><empty_output><jupyter_text>Prepare UI engine<jupyter_code>%gui qt<jupyter_output><empty_output><jupyter_text>Select Raw Data Input FolderData and time spectra files will be loaded<jupyter_code>o_bragg = BraggEdge(working_dir=system.System.get_working_dir())
o_bragg.select_working_folder()<jupyter_output><empty_output><jupyter_text>Select Open Beam Input Folder<jupyter_code>o_bragg.select_ob_folder()<jupyter_output><empty_output><jupyter_text>Select Background Region  Select how many random files to use to select various ROIs<jupyter_code>o_bragg.how_many_data_to_use_to_select_sample_roi()<jupyter_output><empty_output><jupyter_text>Select background region in integrated image<jupyter_code>o_bragg.define_integrated_sample_to_use()
o_background = Interface(data=o_bragg.final_image)
o_background.show()<jupyter_output><empty_output><jupyter_text>Normalize Data<jupyter_code>o_bragg.normalization(o_background=o_background)<jupyter_output><empty_output><jupyter_text>Powder Element(s) to Use to Compare the Bragg Edges<jupyter_code>o_bragg.list_elements()<jupyter_output><empty_output><jupyter_text>List Bragg Edges<jupyter_code>o_bragg.list_powder_bragg_edges()<jupyter_output><empty_output><jupyter_text>Select Sample ROI<jupyter_code>o_sample = Interface(data=o_bragg.final_image)
o_sample.show()<jupyter_output><empty_output><jupyter_text>Define Experiment Setup<jupyter_code>o_bragg.exp_setup()<jupyter_output><empty_output><jupyter_text>Calculate Bragg Edges Data<jupyter_code>o_bragg.calculate_counts_vs_file_index_of_regions_selected(list_roi=o_sample.list_roi)
o_bragg.load_time_spectra()<jupyter_output><empty_output><jupyter_text>Display Bragg Edges vs Signal Run the next cell **only if** you want to display the signal Counts vs lambda<jupyter_code>o_bragg.plot()<jupyter_output><empty_output><jupyter_text>Export Data<jupyter_code>o_bragg.select_output_data_folder()
o_bragg.select_output_table_folder()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09141055949566587, 'fraction_numerical': 0.0, 'mean_word_length': 14.86875, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '305626', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 959, 'n_tokens_neox': 940, 'n_words': 113, 'path': 'notebooks/bragg_edge_raw_sample_and_powder.ipynb', 'repo_name': 'mabrahamdevops/python_notebooks', 'size': '2538'}