Commit 6c9e0163 authored by Isabelle Kieffer's avatar Isabelle Kieffer

Experiment titles correction

parent 5ac28493
......@@ -15,14 +15,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#my_directory = \"/home/letard/Sshade/Data/Carriere_Co2014\"\n",
"my_directory = \"/home/letard/Sshade/Data/Maurin_Co2012\"\n",
"#my_directory = \"/home/letard/Sshade/Data/Thomas_Hg2016\"\n",
"#my_directory = \"/home/letard/Sshade/Data/Bissardon_Se2015\""
"#my_directory = \"/home/letard/Sshade/Data/Bissardon_Se2015\"\n",
"my_directory = \"/home/letard/Sshade/Data/Test\""
]
},
{
......@@ -32,9 +32,9 @@
"outputs": [],
"source": [
"#csv2xml.ods_converter(my_directory,\"manip_Carriere_Co2014.ods\")\n",
"csv2xml.ods_converter(my_directory,\"manip_Maurin_Co2012.ods\")\n",
"#csv2xml.ods_converter(my_directory,\"manip_Thomas_Hg2016.ods\")\n",
"#csv2xml.ods_converter(my_directory,\"manip_Bissardon_Se2015.ods\")"
"#csv2xml.ods_converter(my_directory,\"manip_Bissardon_Se2015.ods\")\n",
"csv2xml.ods_converter(my_directory,\"manip_test1.ods\")"
]
},
{
......@@ -102,9 +102,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['INSTRU_XAS_TRANS_FAME', 'IM_20120926_001', 'IM_20120926_002', 'IM_20120926_005', '<![CDATA[Co K edge XAS transmission and XAS fluorescence and XAS HERFD of Co oxides and salts for the study of Co doping in maghemite nanoparticles, measured in transmission]]>']\n",
"['INSTRU_XAS_FLUO_FAME', 'IM_20120926_003', 'IM_20120926_004', '<![CDATA[Co K edge XAS transmission and XAS fluorescence and XAS HERFD of Co oxides for the study of Co doping in maghemite nanoparticles, measured in fluorescence]]>']\n",
"['INSTRU_XAS_CAS_Si333_FAME', 'IM_20120926_006', 'IM_20120926_007', 'IM_20120926_008', '<![CDATA[Co K edge XAS transmission and XAS fluorescence and XAS HERFD of Co doped maghemite nanoparticles, measured in HERFD]]>']\n",
"FILE experiments_spectra_IM_20120926_001.xml ALREADY EXISTS\n",
"Do you want to overwrite it? y\n",
"\n",
"=== The file experiments_spectra_IM_20120926_001.xml has been written in /home/letard/Sshade/Data/Test. ===\n"
]
}
],
"source": [
"csv2xml.experiments_structure_file_writer(my_directory,\"experiments_spectra_with_structure.csv\")"
]
......
......@@ -75,6 +75,7 @@
-- Ajout des nouveaux modes d'import de spectre dans le template (pas dans excel, car ce sont des corrections donc on les fera sans doute spectre par spectre).
-- Mêmes modifications faites pour l'experiment avec structure.
-- Ajout des filtres (mandatory en fluo) → NULL.
-- Correction de la génération des titres d'experiment et de sub-experiment.
'''
import sys
......@@ -1298,25 +1299,38 @@ def experiments_file_writer(expdir,csvfilename):
title=title+'XAS '+inss[0]['measurement_type']+' '
title=title+"of "+csvdata['experiment_title']
##Variable parameters = observation mode --> add the info of the measurement types
##Variable parameters = observation mode --> add the info of the measurement types (avoiding double citing)
if csvdata['variable_parameters_type']=='observation mode':
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
flag_XES=1
flag_XAS=[]
for nins in range(len(inss)):
if inss[nins]['measurement_type']=='XES':
title=title+inss[nins]['measurement_type']+' '
if flag_XES:
if nins!=0:
title=title+'and '
title=title+inss[nins]['measurement_type']+' '
flag_XES=0
else:
title=title+'XAS '+inss[nins]['measurement_type']+' '
if nins < len(inss)-1:
title=title+'and '
if inss[nins]['measurement_type'] not in flag_XAS:
if nins!=0:
title=title+'and '
title=title+'XAS '+inss[nins]['measurement_type']+' '
flag_XAS.append(inss[nins]['measurement_type'])
title=title+"of "+csvdata['experiment_title']
##Variable parameters = spectral range (ie the edge) --> add the info of the edges
##Variable parameters = spectral range (ie the edge) --> add the info of the edges (avoiding double citing)
if csvdata['variable_parameters_type']=='spectral range':
title=''
flag_edge_elem=[]
flag_edge_type=[]
for nins in range(len(inss)):
title=title+inss[nins]['absorption_edge_element_uid'].split("_")[1]+" "+inss[nins]['absorption_edge_type']+' edge '
if nins < len(inss)-1:
title=title+'and '
if inss[nins]['absorption_edge_element_uid'] not in flag_edge_elem or inss[nins]['absorption_edge_type'] not in flag_edge_type:
if nins!=0:
title=title+'and '
title=title+inss[nins]['absorption_edge_element_uid'].split("_")[1]+" "+inss[nins]['absorption_edge_type']+' edge '
flag_edge_elem.append(inss[nins]['absorption_edge_element_uid'])
flag_edge_type.append(inss[nins]['absorption_edge_type'])
if inss[0]['measurement_type']=='XES':
title=title+inss[0]['measurement_type']+' '
else:
......@@ -1326,8 +1340,7 @@ def experiments_file_writer(expdir,csvfilename):
##Variable parameters = pressure or temperature or sample composition --> add the info of the measurement conditions
if csvdata["variable_parameters_type"]=='temperature' or csvdata["variable_parameters_type"]=='pressure' \
or csvdata["variable_parameters_type"]=='sample composition':
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+\
" edge "
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
if inss[0]['measurement_type']=='XES':
title=title+inss[0]['measurement_type']+' '
else:
......@@ -1728,19 +1741,25 @@ def experiments_structure_file_writer(expdir,csvfilename):
#Building the title of the experiment
if 'observation mode' in pars:
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+\
" edge "
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
flag_XES=1
flag_XAS=[]
for nins in range(len(inss)):
if inss[nins]['measurement_type']=='XES':
title=title+inss[nins]['measurement_type']+' '
if flag_XES:
if nins!=0:
title=title+'and '
title=title+inss[nins]['measurement_type']+' '
flag_XES=0
else:
title=title+'XAS '+inss[nins]['measurement_type']+' '
if nins < len(inss)-1:
title=title+'and '
title=title+"of "+csvdata['experiment_title']
if inss[nins]['measurement_type'] not in flag_XAS:
if nins!=0:
title=title+'and '
title=title+'XAS '+inss[nins]['measurement_type']+' '
flag_XAS.append(inss[nins]['measurement_type'])
title=title+"of "+csvdata['experiment_title']
else:
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+\
" edge "
title=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
if inss[0]['measurement_type']=='XES':
title=title+inss[0]['measurement_type']+' '
else:
......@@ -1750,21 +1769,17 @@ def experiments_structure_file_writer(expdir,csvfilename):
title='<![CDATA['+title+']]>'
#Building the titles of the sub-experiments
meas_type_index=0
for ntit in range(len(tits)):
if 'observation mode' in pars:
subtitle=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+\
" edge "
for nins in range(len(inss)):
if inss[nins]['measurement_type']=='XES':
subtitle=subtitle+inss[nins]['measurement_type']+' '
else:
subtitle=subtitle+'XAS '+inss[nins]['measurement_type']+' '
if nins < len(inss)-1:
subtitle=subtitle+'and '
subtitle=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
if inss[meas_type_index]['measurement_type']=='XES':
subtitle=subtitle+inss[meas_type_index]['measurement_type']+' '
else:
subtitle=subtitle+'XAS '+inss[meas_type_index]['measurement_type']+' '
subtitle=subtitle+"of "+tits[ntit]
else:
subtitle=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+\
" edge "
subtitle=inss[0]['absorption_edge_element_uid'].split("_")[1]+" "+inss[0]['absorption_edge_type']+" edge "
if inss[0]['measurement_type']=='XES':
subtitle=subtitle+inss[0]['measurement_type']+' '
else:
......@@ -1772,6 +1787,7 @@ def experiments_structure_file_writer(expdir,csvfilename):
subtitle=subtitle+"of "+tits[ntit]
subtitle='<![CDATA['+subtitle+']]>'
vals[ntit].append(subtitle)
meas_type_index+=len(vals[ntit])-2
#Building the titles of the spectra
for nins in range(len(inss)):
......
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