-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save_xps module to save XPS data in two column format (#9)
* save_xps to save XPS data in two column format * Update __init__.py * Update glossary.md * Update xps.md * Update xps.md * Update xps.md * Update save_xps.py * Add files via upload * Update xps.md * Update xps.md
- Loading branch information
Showing
6 changed files
with
83 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Program: Save XPS data in two column format | ||
Version: 20220325 | ||
@author: Pranab Das (GitHub: @pranabdas) | ||
""" | ||
|
||
|
||
def save_xps(energy, intensity, filename=""): | ||
import numpy as np | ||
import datetime | ||
|
||
if (filename == ""): | ||
filename = "XPS_data_" + datetime.datetime.now().strftime("%Y%m%d%H%M%S") + ".x_y" | ||
|
||
# check energy and intensity have same length | ||
if (len(energy) != len(intensity)): | ||
raise ValueError("Lengths of input arrays do not match") | ||
else: | ||
data = np.array([energy, intensity]).T | ||
np.savetxt(filename, data) |