<jupyter_start><jupyter_text>Automating Powder X-Ray Diffraction Data Analysis Authors* **<NAME>**, <EMAIL>  Getting StartedThe Python module NuPXRD was written to simplify the analysis of PXRD data.  *Input*: A raw PXRD .dat file  *Output*: CSV file, visualization of the pattern<jupyter_code>import os
import numpy as np
from nupxrd import nupxrd

print(os.path.dirname(nupxrd.__file__))<jupyter_output>/Users/rossjamesverploegh/miniconda3/lib/python3.6/site-packages/nupxrd<jupyter_text>Initialize the NuPXRD object and pass it the path to the PXRD .DAT file.<jupyter_code>pxrd_data=nupxrd.NuPXRD(path=os.getcwd()+"/UiO_66.DAT")<jupyter_output><empty_output><jupyter_text>Read the UiO-66 PXRD data and initialize the attributes.<jupyter_code>pxrd_data.read_pxrd()<jupyter_output><empty_output><jupyter_text>Inspect all the attributes of the pxrd_data object.<jupyter_code>print(pxrd_data.path)
print(pxrd_data.mofname)
print(pxrd_data.data)<jupyter_output>/Users/rossjamesverploegh/Dropbox (NuMat Technologies)/Ross_Verploegh/2018_Projects/github_verploegh/nupxrd/notebooks/UiO_66.DAT
UiO_66
[['Bundle', '1'], ['Partition', '1'], ['Operator', 'N.U. X-ray Dif. Fac'], ['Gonio', 'ATX-G'], ['Memo', 'J.B. Cohen X-ray Diffraction Facility'], ['IncidentMonochro', 'Slit collimation'], ['CounterMonochro', 'Receiving slit'], ['Attachment', 'XY-STAGE'], ['Filter', ''], ['SlitName0', 'XRR Compression'], ['SlitName1', 'Reciprocal SM Slit Collimation'], ['Counter', 'SC-70'], ['KAlpha1', '1.54056'], ['KAlpha2', '1.54439'], ['KBata', '0'], ['Target', 'Cu'], ['KV', '50'], ['mA', '240'], ['AxisName', '2Theta'], ['MeasurementMethod', 'Continuation'], ['Start', '2'], ['Finish', '30'], ['Speed', '10'], ['FixedTime', ''], ['Width', '0.01'], ['FullScale', '11800'], ['Comment', ''], ['SampleName', ''], ['Xunit', 'deg.'], ['Yunit', 'CPS'], [2.0, 600.4], [2.01, 683.8], [2.02, 750.6], [2.03, 667.1], [2.04, 733.9], [2.05, 750.6], [2.06, 516.9], [2.07, 650.4], [2.08, 6[...]<jupyter_text>Write the csv file for easy reading.<jupyter_code>pxrd_data.write_csv()<jupyter_output><empty_output><jupyter_text>Use pandas to inspect the csv file, making sure it was written correctly.<jupyter_code>import pandas as pd
uio66 = pd.read_csv("output_UiO_66.csv")
print(uio66)<jupyter_output>Bundle                                      1
0             Partition                                      1
1              Operator                    N.U. X-ray Dif. Fac
2                 Gonio                                  ATX-G
3                  Memo  J.B. Cohen X-ray Diffraction Facility
4      IncidentMonochro                       Slit collimation
5       CounterMonochro                         Receiving slit
6            Attachment                               XY-STAGE
7                Filter                                    NaN
8             SlitName0                        XRR Compression
9             SlitName1         Reciprocal SM Slit Collimation
10              Counter                                  SC-70
11              KAlpha1                                1.54056
12              KAlpha2                                1.54439
13                KBata                                      0
14               Target                                [...]<jupyter_text>Plot the PXRD data using bokeh.<jupyter_code>from bokeh.plotting import figure, output_notebook, show

output_notebook()
p = figure(plot_width=400, plot_height=400)
twotheta = [i[0] for i in pxrd_data.data][30::]
intensity = [i[1] for i in pxrd_data.data][30::]
p.line(twotheta, intensity, line_width=0.75)
p.xaxis.axis_label = "2\u03b8"
p.yaxis.axis_label = "Intensity / a.u."
show(p)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1432447097124254, 'fraction_numerical': 0.048833423765599564, 'mean_word_length': 2.5970731707317074, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '10460', 'license': 'MIT', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1243, 'n_words': 284, 'path': 'notebooks/tutorial.ipynb', 'repo_name': 'RossVerploegh/nupxrd', 'size': '3706'}