File size: 1,996 Bytes
56c956f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
jupytext:
  formats: md:myst
  text_representation:
    extension: .md
    format_name: myst
    format_version: 0.13
    jupytext_version: 1.11.5
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

# The tutorial 8th 

Describes how PyXplore processes X-ray photoelectron spectroscopy (XPS) data.

## coding

> **1. Save your XPS data to the root directory and rename the file to `int.csv`.**




```{code-cell}
# import PyXplore package
from PyXplore import WPEM
import pandas as pd
```

> **2. Parse your diffraction data (`bing energy`, intensity) and perform background processing.**

```{code-cell}
intensity_csv = pd.read_csv(r'int.csv',header=None )
var = WPEM.BackgroundFit(intensity_csv,segement=[[910,931],[948,952],[958,959],[966,970]],bac_num=120,Model='XPS',noise = 0.05,bac_var_type='multivariate gaussian')
```

> **3. After running the code, a new folder named `ConvertedDocuments` will be created in the root directory. This folder contains the background information.**

> **Copy the two important files — `bac.csv` and `no_bac_intensity.csv` — from `ConvertedDocuments` into the root directory, as they are required for the next steps.**

```{seealso}
A key difference with XPS is that the initial binding energy needs to be queried and input using two parameters: `AtomIdentifier` and `satellitePeaks`.**
```



```{code-cell}

AtomIdentifier = [['CuII','2p3/2',933.7,],['CuII','2p1/2',954,],]
satellitePeaks = [['CuII', '2p3/2',941.6,],['CuII','2p3/2',943.4],['CuII','2p1/2',962.5,],]
# The file name of non-background data 
no_bac_intensity_file = "no_bac_intensity.csv" 
# The file name of raw/original data 
original_file = "int.csv"  
# The file name of background data 
bacground_file = "bac.csv"  

# Execute the model
WPEM.XPSfit(
        var, AtomIdentifier, satellitePeaks,no_bac_intensity_file, original_file, bacground_file, 
    bta = 0.80,iter_max = 50,
)

```



> **The results are saved in the `XPSFittingProfile` folder.**