Created
January 21, 2020 15:42
-
-
Save thomasaarholt/1f44648e5f9adf3cfd9211dc0e492d4b to your computer and use it in GitHub Desktop.
Export Velox EDS K-factors
This file contains hidden or 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
# In Velox, choose a dataset and select all elements in the periodic table (This is a little tedious) | |
# From the Velox Menu, go "EDS" -> "Export Quantification Details..." | |
# This exports two files, one called "... Lines" and one called "... Composition". We want the former. | |
import pandas as pd | |
df = pd.read_csv(r"exported_eds_quant-Lines.csv") | |
DF = df.iloc[1:] # There was a single blank line in my dataset, so I get rid of it | |
DF.loc[:,'K-factor'] = DF['K-factor'].astype(float) # String to float on the k-factors | |
# Two functions that we map across the dataset to split the header into separate elements and line | |
def splitelement(entry): | |
return entry.split("-")[0] | |
def splitline(entry): | |
return entry.split("-")[1] | |
DF.loc[:,'Element'] = DF['Line identifier'].map(splitelement) | |
DF.loc[:, 'Line'] = DF['Line identifier'].map(splitline) | |
DF.loc[:, 'Name'] = DF['Line identifier'] | |
si_k_factor = DF['K-factor'][DF['Name'] == 'Si-Ka1'] | |
DF.loc[:, 'K-factor'] = DF['K-factor'] / si_k_factor.values # It's normalised by top element. We want by Si Ka1 | |
our_list = DF[['Element', 'Line', 'Name', 'K-factor']] # This is the new order of columns | |
our_list.to_csv('All_Titan2014_Kfactors.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment