Skip to content

Commit

Permalink
update XPS xml reader and tests file
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Jan 22, 2024
1 parent 9c1290a commit 64212f4
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 93 deletions.
27 changes: 4 additions & 23 deletions pynxtools/dataconverter/readers/xps/config/config_xml_specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"experiment_facility":"@eln",
"experiment_laboratory":"@eln",
"entry_identifier":"@eln",
"duration":"@eln",
"duration/@units":"@eln",
"method":"@xps_token:region/analysis_method",
"program_name":"@eln"
},
Expand Down Expand Up @@ -77,14 +75,7 @@
"resolution":"@xps_token:region/scan_delta",
"resolution/@units":"eV"
},
"transmission_function":{
"@default":"relative_intensity",
"@signal":"relative_intensity",
"@axes":["kinetic_energy"],
"kinetic_energy":"@xps_token:transmission_function/kinetic_energy",
"kinetic_energy/@units":"@xps_token:transmission_function/kinetic_energy/@units",
"relative_intensity":"@xps_token:collectioncolumn/transmission_function/relative_intensity"
},
"transmission_function":"None",
"COLLECTIONCOLUMN[collectioncolumn]":{
"scheme":"@eln",
"lens_mode":"@xps_token:collectioncolumn/lens_mode",
Expand All @@ -93,10 +84,6 @@
"spatial_acceptance":"None",
"field_aperture":"None",
"contrast_aperture":"None",
"iris":{
"size":"@xps_token:collectioncolumn/iris_diameter",
"size/@units":"@xps_token:collectioncolumn/iris_diameter/@units"
},
"device_information":{
"vendor":"@eln",
"model":"@eln",
Expand Down Expand Up @@ -131,7 +118,7 @@
"@signal":"raw",
"@default":"raw",
"raw":"@detector_data:cycles/Cycle_",
"raw/@units":"@xps_token:detector/raw_data/raw/@units"
"raw/@units":"counts"
}
}
},
Expand Down Expand Up @@ -226,12 +213,6 @@
"end_time":"@eln",
"description":"@eln",
"method":"@eln"
},
"PHYSICAL_PROCESS[sample_loading]":{
"start_time":"@eln",
"end_time":"@eln",
"description":"@eln",
"method":"@eln"
}
},
"temperature":{
Expand Down Expand Up @@ -260,8 +241,8 @@
"data":"@data:cycle",
"data/@units":"counts",
"energy":"@link:/entry/process/energy_calibration/calibrated_axis",
"energy/@type":"@xps_token:data/energy/@type",
"energy/@units":"@xps_token:data/energy/@units",
"energy/@type":"kinetic",
"energy/@units":"eV",
"@energy_indices":"None",
"@energy_depends":"None"
}
Expand Down
47 changes: 26 additions & 21 deletions pynxtools/dataconverter/readers/xps/xml/xml_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,6 @@
)


def _construct_entry_name_xml(key):
"""Construction entry name."""
key_parts = key.split("/")
try:
# entry example : vendor__sample__name_of_scan_region
entry_name = (
f"{key_parts[2]}"
f"__"
f'{key_parts[3].split("_", 1)[1]}'
f"__"
f'{key_parts[5].split("_", 1)[1]}'
)
except IndexError:
entry_name = ""
return entry_name


class XmlMapperSpecs(XPSMapper):
"""
Class for restructuring xml data file from
Expand Down Expand Up @@ -180,13 +163,14 @@ def construct_data(self):
f"{scan_nm}_chan_{row}"
] = xr.DataArray(
data=channel_counts[row + 1, :],
coords={"BE": binding_energy},
coords={"energy": binding_energy},
)

# Storing callibrated and after accumulated each scan counts
if row == mcd_num - 1:
self._xps_dict["data"][entry][scan_nm] = xr.DataArray(
data=channel_counts[0, :], coords={"BE": binding_energy}
data=channel_counts[0, :],
coords={"energy": binding_energy},
)
else:
for row in np.arange(mcd_num):
Expand All @@ -203,13 +187,14 @@ def construct_data(self):
f"{scan_nm}_chan{row}"
] = xr.DataArray(
data=channel_counts[row + 1, :],
coords={"BE": binding_energy},
coords={"energy": binding_energy},
)

# Storing callibrated and after accumulated each scan counts
if row == mcd_num - 1:
self._xps_dict["data"][entry][scan_nm] = xr.DataArray(
data=channel_counts[0, :], coords={"BE": binding_energy}
data=channel_counts[0, :],
coords={"energy": binding_energy},
)


Expand Down Expand Up @@ -699,6 +684,7 @@ def collect_raw_data_to_construct_data(self):
self.entry_to_data[entry]["raw_data"]["excitation_energy"] = val

elif "region/scan_mode/name" in key:
val = self._convert_energy_scan_mode(val)
self.entry_to_data[entry]["raw_data"]["scan_mode"] = val

elif "region/kinetic_energy" in key:
Expand Down Expand Up @@ -748,3 +734,22 @@ def collect_raw_data_to_construct_data(self):
scan_name = f"cycle{cycle_num}_scan{scan_num}"

self.entry_to_data[entry]["raw_data"]["scans"][scan_name] = val

def _convert_energy_scan_mode(self, energy_scan_mode):
"""
Convert the native names for the energy scan modes to the ones
used in NXmpes.
"""
energy_scan_mode_map = {
"FixedAnalyzerTransmission": "fixed_analyser_transmission",
"FixedRetardationRatio": "fixed_retardation_ratio",
"FixedEnergies": "fixed_energy",
"Snapshot": "snapshot",
}

try:
energy_scan_mode = energy_scan_mode_map[energy_scan_mode]
except KeyError:
pass
return energy_scan_mode
193 changes: 144 additions & 49 deletions tests/data/dataconverter/readers/xps/eln_data.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,146 @@
Instrument:
Analyser:
Collectioncolumn:
scheme: "Angular dispersive"
mode: "Unknown"
description: "hemispherical"
name: null
Energydispersion:
entrance_slit: "Unknown"
scheme: "hemispherical"
energy_scan_mode: "fixed"
pass_energy:
unit: null
Detector:
amplifier_type: "channeltron"
detector_type: "Multi-anode"
Beam:
definition:
value: NXmpes
version: 1.0
title: XPS Experiment
start_time: 2022-04-08T11:47:02.0200Z
end_time: 2022-04-08T12:32:06.0200Z
experiment_institution: BESSY II
program_name: SpecsLab 2
user:
name: Lukas Pielsticker
email: [email protected]
instrument:
device_information:
vendor: SPECS GmbH
model: XPS setup
identifier: null
energy_resolution:
type: calibrated
resolution:
value: 0.2
unit: eV
source_probe:
type: Synchrotron X-ray Source
probe: x-ray
device_information:
vendor: null
model: null
identifier: null
beam_probe:
distance:
unit: "mm"
value: 0.0
energy_resolution:
unit: null
value: null
Source:
type: "Synchrotron X-ray Source"
probe: "x-ray"
Sample:
name: "PBTTT"
chemical_formula: "(C42H62S4)n"
preparation_description: "From third party"
temperature:
unit: "K"
value: 298.0
situation: "vacuum"
gas_pressure:
unit: "Pa"
value: 101325.0
density: null
description: "A polymer material called PBTTT with chemical name poly[2,5-bis(3-dodecylthiophen-2-yl)thieno[3,2-b]thiophene]."
title: "XPS Experiment"
start_time: "2022-04-08T11:47:02.0200Z"
definition:
value: "NXmpes"
version: "1.0"
User:
name: "Ahmed Mansour"
email: "[email protected]"
Data:
BE:
unit: null

unit: mm
analyser:
description: hemispherical
name: PHOIBOS 150
device_information:
vendor: SPECS GmbH
model: PHOIBOS 150
identifier: null
collectioncolumn:
scheme: angular dispersive
device_information:
vendor: null
model: null
identifier: null
energydispersion:
scheme: hemispherical
entrance_slit: unknown
energy_scan_mode: fixed_analyser_transmission
diameter:
unit: mm
value: 150
device_information:
vendor: null
model: null
identifier: null
detector:
amplifier_type: channeltron
detector_type: Multi-anode
manipulator:
device_information:
vendor: SPECS GmbH
model: 5-axis manipulator
identifier: null
temperature_sensor:
name: type K thermocouple
measurement: temperature
attached_to: sample
type: type K thermocouple
value:
value: 298.0
unit: K
sample_heater:
name: Coherent Compact Evolution IR Diode LASER (DILAS)
physical_quantity: temperature
type: IR diode laser
heater_power:
value: 0.0
unit: W
pid:
setpoint:
value: 298.0
unit: K
cryostat:
name: null
physical_quantity: null
type: null
pid:
setpoint: null
drain_current_amperemeter:
name: Amperemeter 1.0
measurement: current
type: wire
value:
value: 0.0
unit: A
sample_bias_voltmeter:
name: XPS sample voltmeter
measurement: voltage
attached_to: sample
type: oscilloscope
value:
value: 0.0
unit: V
sample_bias_potentiostat:
name: XPS sample potentiostat
physical_quantity: voltage
type: potentiostat
pid:
setpoint:
value: 0.0
unit: V
pressure_gauge:
name: Atmion
measurement: pressure
type: hot-filament ionization gauge
value:
value: 0.000000001
unit: mbar
value_log:
value:
value: null
unit: null
flood_gun:
name: FG 22/35
physical_quantity: current
type: low energy electron source
current:
value: 0.0
unit: A
current_log:
value:
value: null
unit: null
sample:
description: A polymer material called PBTTT with chemical name poly[2,5-bis(3-dodecylthiophen-2-yl)thieno[3,2-b]thiophene].
substance:
molecular_formula_hill: (C42H62S4)n
situation: vacuum
sample_history:
sample_preparation:
start_time: 2022-04-08T11:02:38.0200Z
end_time: 2022-04-08T11:06:42.200Z
description: From third party
method: null

0 comments on commit 64212f4

Please sign in to comment.