Commit 427abb50 authored by Isabelle Kieffer's avatar Isabelle Kieffer

Filling automatically the monochromator resolution

parent 1c8ae49c
......@@ -8,25 +8,25 @@
"source": [
"import sys\n",
"sys.path.append(\"/home/letard/local/sshade/sshade\")\n",
"import csv2xml\n",
"csv2xml?\n",
"import csv2xml_r\n",
"#csv2xml?\n",
"#csv2xml.experiments_file_writer?"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"my_directory = \"/home/letard/Sshade/Data/Thomas_Hg2016\"\n",
"#my_directory = \"/home/letard/Sshade/Data/Thomas_Hg2016\"\n",
"#my_directory = \"/home/letard/Sshade/Data/Bissardon_Se2015\"\n",
"#my_directory = \"/home/letard/Sshade/Data/Test\""
"my_directory = \"/home/letard/Sshade/Data/Test\""
]
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -34,61 +34,36 @@
"output_type": "stream",
"text": [
"\n",
"=== The file laboratory_MEG.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file laboratory.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file laboratory_LEG.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file experimentalist.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file experimentalist_JFG.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file pellet.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file experimentalist_IMS.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file frozen_solution.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file experimentalist_PC.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file HPHT_solution.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file experimentalist_ST.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"=== The file experiments_spectra.csv has been written in /home/letard/Sshade/Data/Test. ===\n",
"\n",
"=== The file pellet_1.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file pellet_2.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file frozen_solution_1.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file frozen_solution_2.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file frozen_solution_3.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file experiments_spectra.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file experiments_spectra_with_structure.csv has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n"
"=== The file experiments_spectra_with_structure.csv has been written in /home/letard/Sshade/Data/Test. ===\n"
]
}
],
"source": [
"csv2xml.ods_converter(my_directory,\"manip_Thomas_Hg2016.ods\")\n",
"#csv2xml.ods_converter(my_directory,\"manip_Thomas_Hg2016.ods\")\n",
"#csv2xml.ods_converter(my_directory,\"manip_Bissardon_Se2015.ods\")\n",
"#csv2xml.ods_converter(my_directory,\"manip_test1.ods\")"
"csv2xml_r.ods_converter(my_directory,\"manip_test3.ods\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"=== The file sample_ST_20161127_003.xml has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file sample_ST_20161127_001.xml has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n",
"\n",
"=== The file sample_ST_20161127_002.xml has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n"
]
}
],
"outputs": [],
"source": [
"#csv2xml.multiple_file_writer(my_directory,\"pellet\")\n",
"csv2xml.multiple_file_writer(my_directory,\"frozen_solution\")"
"csv2xml.multiple_file_writer(my_directory,\"pellet\")"
]
},
{
......@@ -118,6 +93,24 @@
"csv2xml.sample_pellet_file_writer(my_directory,\"pellet_8.csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"csv2xml.sample_frozen_solution_file_writer(my_directory,\"frozen_solution.csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"csv2xml.sample_HPHT_solution_file_writer(my_directory,\"HPHT_solution.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
......@@ -127,13 +120,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"FILE experiments_spectra_to.xml ALREADY EXISTS\n",
"Do you want to overwrite it? y\n",
"L2-3\n",
"0.255\n",
"\n",
"=== The file sample_MC_20141202_004.xml has been written in /home/letard/Sshade/Data/Carriere_Co2014. ===\n"
"=== The file experiments_spectra_to.xml has been written in /home/letard/Sshade/Data/Test. ===\n"
]
}
],
"source": [
"csv2xml.sample_frozen_solution_file_writer(my_directory,\"frozen_solution_4.csv\")"
"csv2xml_r.experiments_file_writer(my_directory,\"experiments_spectra.csv\")"
]
},
{
......@@ -142,7 +139,7 @@
"metadata": {},
"outputs": [],
"source": [
"csv2xml.sample_HPHT_solution_file_writer(my_directory,\"HPHT_solution.csv\")"
"csv2xml.experiments_structure_file_writer(my_directory,\"experiments_spectra_with_structure.csv\")"
]
},
{
......@@ -151,27 +148,52 @@
"metadata": {},
"outputs": [],
"source": [
"csv2xml.experiments_file_writer(my_directory,\"experiments_spectra.csv\")"
"resol={}"
]
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"FILE experiments_spectra_ST_20161124_001.xml ALREADY EXISTS\n",
"Do you want to overwrite it? y\n",
"\n",
"=== The file experiments_spectra_ST_20161124_001.xml has been written in /home/letard/Sshade/Data/Thomas_Hg2016. ===\n"
]
}
],
"outputs": [],
"source": [
"csv2xml.experiments_structure_file_writer(my_directory,\"experiments_spectra_with_structure.csv\")"
"resol['Hg']=0.5"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(resol['Au'][0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resol['Au']=[0.5,0.1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resol['Ag']=[5,'NULL']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(resol['Ag'][1])"
]
},
{
......
......@@ -87,6 +87,82 @@
TemplatePath = "/home/letard/local/sshade/Templates/"
#======================================================================================================================#
# RESOLUTION TABLE #
#======================================================================================================================#
resol = {}
resol['ATOM_Ti'] = ['0.255','NULL']
resol['ATOM_V'] = ['0.280','NULL']
resol['ATOM_Cr'] = ['0.307','NULL']
resol['ATOM_Mn'] = ['0.335','NULL']
resol['ATOM_Fe'] = ['0.365','NULL']
resol['ATOM_Co'] = ['0.395','NULL']
resol['ATOM_Ni'] = ['0.427','NULL']
resol['ATOM_Cu'] = ['0.460','NULL']
resol['ATOM_Zn'] = ['0.495','NULL']
resol['ATOM_Ga'] = ['0.532','NULL']
resol['ATOM_Ge'] = ['0.569','NULL']
resol['ATOM_As'] = ['0.609','NULL']
resol['ATOM_Se'] = ['0.649','NULL']
resol['ATOM_Br'] = ['0.691','NULL']
resol['ATOM_Kr'] = ['0.735','NULL']
resol['ATOM_Rb'] = ['0.779','NULL']
resol['ATOM_Sr'] = ['0.826','NULL']
resol['ATOM_Y'] = ['0.874','NULL']
resol['ATOM_Zr'] = ['0.923','NULL']
resol['ATOM_Nb'] = ['0.973','NULL']
resol['ATOM_Mo'] = ['1.03','NULL']
resol['ATOM_Tc'] = ['1.08','NULL']
resol['ATOM_Ru'] = ['1.13','NULL']
resol['ATOM_Rh'] = ['1.19','NULL']
resol['ATOM_Pd'] = ['1.25','NULL']
resol['ATOM_Ag'] = ['1.30','NULL']
resol['ATOM_Cd'] = ['1.37','NULL']
resol['ATOM_In'] = ['1.43','NULL']
resol['ATOM_Sn'] = ['1.50','NULL']
resol['ATOM_Sb'] = ['1.56','NULL']
resol['ATOM_Te'] = ['1.63','NULL']
resol['ATOM_I'] = ['1.70','NULL']
resol['ATOM_Xe'] = ['1.77','NULL']
resol['ATOM_Cs'] = ['1.85','NULL']
resol['ATOM_Ba'] = ['1.92','0.294']
resol['ATOM_La'] = ['1.99','0.281']
resol['ATOM_Hf'] = ['NULL','0.490']
resol['ATOM_Ta'] = ['NULL','0.507']
resol['ATOM_W'] = ['NULL','0.523']
resol['ATOM_Re'] = ['NULL','0.540']
resol['ATOM_Os'] = ['NULL','0.558']
resol['ATOM_Ir'] = ['NULL','0.575']
resol['ATOM_Pt'] = ['NULL','0.593']
resol['ATOM_Au'] = ['NULL','0.611']
resol['ATOM_Hg'] = ['NULL','0.630']
resol['ATOM_Tl'] = ['NULL','0.649']
resol['ATOM_Pb'] = ['NULL','0.668']
resol['ATOM_Bi'] = ['NULL','0.688']
resol['ATOM_Po'] = ['NULL','0.708']
resol['ATOM_At'] = ['NULL','0.729']
resol['ATOM_Rn'] = ['NULL','0.750']
resol['ATOM_Fr'] = ['NULL','0.771']
resol['ATOM_Ra'] = ['NULL','0.792']
resol['ATOM_Ac'] = ['NULL','0.814']
resol['ATOM_Ce'] = ['NULL','0.293']
resol['ATOM_Pr'] = ['NULL','0.306']
resol['ATOM_Nd'] = ['NULL','0.318']
resol['ATOM_Pm'] = ['NULL','0.331']
resol['ATOM_Sm'] = ['NULL','0.344']
resol['ATOM_Eu'] = ['NULL','0.357']
resol['ATOM_Gd'] = ['NULL','0.371']
resol['ATOM_Tb'] = ['NULL','0.385']
resol['ATOM_Dy'] = ['NULL','0.399']
resol['ATOM_Ho'] = ['NULL','0.414']
resol['ATOM_Er'] = ['NULL','0.428']
resol['ATOM_Tm'] = ['NULL','0.443']
resol['ATOM_Yb'] = ['NULL','0.458']
resol['ATOM_Lu'] = ['NULL','0.474']
resol['ATOM_Th'] = ['NULL','0.836']
resol['ATOM_Pa'] = ['NULL','0.858']
resol['ATOM_U'] = ['NULL','0.880']
#======================================================================================================================#
# ODS TO CSV FILE CONVERTER #
#======================================================================================================================#
......@@ -1281,7 +1357,7 @@ def experiments_file_writer(expdir,csvfilename):
sys.exit("Your file should be a .csv file!!!")
#Checking the validity of the input file
check_lines_th=8+nexps+31*(ninss+1)
check_lines_th=8+nexps+30*(ninss+1)
check_lines_eff=len(csvdata)-1+nexps
for nins in range(len(inss)):
check_lines_eff=check_lines_eff+len(inss[nins])
......@@ -1455,7 +1531,10 @@ def experiments_file_writer(expdir,csvfilename):
for elem in level3[n3].findall("absorption_edge_type"):
elem.text=inss[nins]['absorption_edge_type']
for elem in level3[n3].findall("resolution"):
elem.text=inss[nins]['resolution']
if inss[nins]['absorption_edge_type']=='K':
elem.text=resol[inss[nins]['absorption_edge_element_uid']][0]
if inss[nins]['absorption_edge_type'].startswith('L'):
elem.text=resol[inss[nins]['absorption_edge_element_uid']][1]
for elem in level2[n2].findall("comments"):
elem.text=inss[nins]['calibration_comment']
if level2[n2].tag=='angle':
......@@ -1813,7 +1892,7 @@ def experiments_structure_file_writer(expdir,csvfilename):
inss[nins]['calibration_comment']=inss[nins]['calibration_comment']+"]]>"
#Checking the validity of the input file
check_lines_th = 10 + (nexps+1) + 31*(ninss+1) + len(vals)
check_lines_th = 10 + (nexps+1) + 30*(ninss+1) + len(vals)
check_lines_eff = len(csvdata)-1 + len(pars) + (nexps+1) + len(tits)
for nins in range(len(inss)):
check_lines_eff=check_lines_eff+len(inss[nins])-2 #-2 because 2 lines added for built_spectrum_title
......@@ -1907,7 +1986,10 @@ def experiments_structure_file_writer(expdir,csvfilename):
for elem in level3[n3].findall("absorption_edge_type"):
elem.text=inss[nins]['absorption_edge_type']
for elem in level3[n3].findall("resolution"):
elem.text=inss[nins]['resolution']
if inss[nins]['absorption_edge_type']=='K':
elem.text=resol[inss[nins]['absorption_edge_element_uid']][0]
if inss[nins]['absorption_edge_type'].startswith('L'):
elem.text=resol[inss[nins]['absorption_edge_element_uid']][1]
for elem in level2[n2].findall("comments"):
elem.text=inss[nins]['calibration_comment']
if level2[n2].tag=='angle':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment