Metadata-Version: 2.1
Name: BroadSword
Version: 0.0.15
Summary: Python script to broaden calculated spectra from Wien2k and compare to experimental data at the REIXS Beamline at the Canadian Light Source, Saskatoon, Canada.
Home-page: https://github.com/Cody-Somers/BroadSword
Author: Cody Somers
Author-email: cas003@usask.ca
Project-URL: Beamline Information, https://reixs.lightsource.ca
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# BroadSword
Converting the BroadSword program written by Teak Boyko from the Canadian Light Source in Saskatoon, SK, CA.
The program has been transcribed into python so that it can be compatible with jupyter notebook.

## Installation

Install the package from PyPi with the pip package manager. This is the recommended way to obtain a copy for your local machine and will install all required dependencies.

```
    $ pip install BroadSword
```

You will also need [Jupyter Notebook](https://github.com/jupyter) together with python 3 on your local machine.

## Example Program

```
# Specify the base directory for the scans
# e.g. put it in the scan directory or specify a full path name
basedir = '.'
#basedir = "/Users/cas003/Downloads/Beamtime/DataFiles"

## Setup necessary inputs
from BroadSword.BroadSword import *
from bokeh.io import output_notebook
output_notebook(hide_banner=True)

broad = Broaden()
broad.loadExp(".","N_test_XES.txt","N_test_XAS.txt",0.44996547)
broad.loadCalc(".","N1_emis.txspec","N1_abs.txspec","N1_half.txspec",0.45062079,27.176237)
broad.loadCalc(".","N2_emis.txspec","N2_abs.txspec","N2_half.txspec",0.45091878,27.177975)
broad.loadCalc(".","N3_emis.txspec","N3_abs.txspec","N3_half.txspec",0.45090808,27.122234)
broad.loadCalc(".","N4_emis.txspec","N4_abs.txspec","N4_half.txspec",0.45088602,27.177070)
broad.initResolution(0.15,1200,5000,0.5,0.5,0.5)
broad.Shift(19.2,20.2)
#broad.broaden()
broad.broaden("/Users/cas003/opt/anaconda3/lib/python3.9/site-packages/BroadSword/")
broad.export("Nitrogen")
```

### Functions

loadExp(base directory, measured XES spectrum, measured XANES spectrum, calculated ground state fermi energy)

loadCalc(base directory, calculated XES spectrum, calculated XAS spectrum, calculated XANES spectrum, calculated excited state fermi energy, calculated ground state binding energy)

Shift(XAS shift, XES shift)

initResolution(XES corehole lifetime, spectrometer resolution, monochromator resolution, disorder, XES corehole lifetime scaling, XAS corehole lifetime scaling)

broaden(Path to .so or .dylib file)

export(File name)

### Comments

Shifting takes ~1s to plot, so shift the unbroadened spectra first until it is in the proper position. Then include broad.broaden() in the notebook since this can take ~30s to compute.
