Skip to content

Commit

Permalink
Ellips reader and eln_data (#120)
Browse files Browse the repository at this point in the history
* Reader for NXellipsometry(NXopt)

* mock function for NXellipsometry(NXopt)

* eln_data.yaml for NXellipsometry(NXopt)

* New reader for NXellipsometry(NXopt)

* Update mock.py

* indentation

* indentation

* Update mock.py

* Update mock.py

* Updated metadata file to be consistent with new NXellipsometry

* corrected some pycodestyle errors in the reader

* corrected some pycodestyle errors

* indentation

* shortened lines

* Added argument to FlattenSettings

used in ellips reader

* correcting some pylint errors

* pycodestyle problems

* Update reader.py

* Update reader.py

* Update reader.py

* label function

* removing err_labels

* fixing header_labels args

* Update reader.py

* derived prms

* data array functions

* Update reader.py

* removing unused argument header

* Update reader.py

* Update reader.py

* removed blocks from config keys

* update eln_data file

* changing ang. spread unit

* Corrections in the reader

* Renamed black_list to ignore_keys

* moved import math

* Updating reader to be consistent with new eln

* new eln file

* Updated writer to handle attributs in ellips reader

* updating definitions

* Update pynxtools/dataconverter/readers/ellips/reader.py

Co-authored-by: Florian Dobener <[email protected]>

* Updates eln_data to nomad generated one

* Fixes key mapping

---------

Co-authored-by: Florian Dobener <[email protected]>
  • Loading branch information
cmmngr and domna authored Jun 1, 2023
1 parent 2f3f99f commit f16e63a
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 246 deletions.
123 changes: 62 additions & 61 deletions examples/ellipsometry/eln_data.yaml
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
acquisition_program/\@url: https://www.jawoollam.com/ellipsometry-software/wvase
acquisition_program/program: WVASE
acquisition_program/version: '3.882'
address: Zum Großen Windkanal 2, 12489 Berlin, Germany
affiliation: Humboldt-Universität zu Berlin
angle_of_incidence_unit: degrees
angular_spread:
unit: rad ** 2
value: 0.2
atom_types: Si, O
blocks:
- type
- angle_of_incidence
calibration_status: no calibration
Data:
data_identifier: 1
data_software: WVASE
data_software/@url: https://www.jawoollam.com/ellipsometry-software/wvase
data_software/version: '3.882'
data_type: Psi/Delta
spectrum_type: wavelength
spectrum_unit: Angstroms
Instrument:
Beam_path:
Detector:
count_time:
unit: s
value: 1.0
detector_type: CCD spectrometer
focussing_probes:
angular_spread:
unit: rad
value: 0.2
data_correction: false
light_source:
source_type: arc lamp
rotating_element:
revolutions: 50.0
Sample_stage:
environment_conditions:
medium: air
stage_type: manual stage
angle_of_incidence/@unit: degrees
calibration_status: no calibration
company: J. A. Woollam Co.
ellipsometer_type: dual compensator
model: RC2
model/@version: 0.0.1
rotating_element_type: compensator (source side)
software: CompleteEASE
software/@url: https://www.jawoollam.com/ellipsometry-software/completeease
software/version: '6.37'
Sample:
atom_types: Si, O
backside_roughness: false
chemical_formula: SiO2
layer_structure: 2nm SiO2 on Si
sample_history: Commercially purchased sample
sample_name: 2nm SiO2 on Si
sample_type: multi layer
substrate: Si
User:
address: Zum Großen Windkanal 2, 12489 Berlin, Germany
affiliation: Humboldt-Universität zu Berlin
email: [email protected]
name: Name Surname
colnames:
- type
- wavelength
- angle_of_incidence
- psi
- delta
- err.psi
- err.delta
column_names:
- psi
- delta
company: J. A. Woollam Co.
count_time:
unit: s
value: 1
data_identifier: 1
data_type: psi/delta
- Psi
- Delta
- err.Psi
- err.Delta
definition: NXellipsometry
definition/\@url: https://github.com/FAIRmat-Experimental/nexus_definitions/tree/fairmat-ellips/contributed_definitions/NXellipsometry.nxdl.xml
definition/\@version: 0.0.2
detector_type: CCD spectrometer
ellipsometry_type: dual compensator
email: [email protected]
err-var:
- err.psi
- err.delta
definition/@url: https://github.com/FAIRmat-NFDI/nexus_definitions/blob/fairmat/contributed_definitions/NXellipsometry.nxdl.xml
definition/@version: 0.0.2
derived_parameter_type: depolarization
experiment_description: RC2 scan on 2nm SiO2 on Si in air
experiment_identifier: exp-ID
experiment_type: NIR-Vis-UV spectroscopic ellipsometry
filename: test-data.dat
firmware: CompleteEASE
firmware/\@url: https://www.jawoollam.com/ellipsometry-software/completeease
firmware/\@version: '6.37'
focussing_probes: false
integration_time:
unit: s
value: 0
layer_structure: 2nm SiO2 on Si
light_source: arc lamp
medium: air
model: RC2
model/\@version: 0.0.1
name: Name Surname
parameters:
- type
- angle
rotating_element: compensator (source side)
sample_history: Commercially purchased sample
sample_name: 2nm SiO2 on Si
plot_name: Psi and Delta
sep: \t
skip: 3
stage_type: manual stage
start_time: '2022-01-27T04:35:00+00:00'
wavelength_unit: angstrom
x-var: wavelength
y-var:
- psi
- delta
start_time: '2022-01-27T03:35:00+00:00'
47 changes: 23 additions & 24 deletions pynxtools/dataconverter/readers/ellips/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MockEllips():
- choose_data_type:
Chooses random entry from data_types
- mock_signals:
Mock data if data_type is psi/delta or tan(psi)/cos(delta)
Mock data if data_type is Psi/Delta or tan(Psi)/cos(Delta)
- mock_mueller_matrix:
Mock data if data_type is Mueller matrix
- mock_template:
Expand All @@ -47,10 +47,10 @@ class MockEllips():

def __init__(self, data_template) -> None:
self.data = data_template["measured_data"]
self.wavelength = data_template["spectrometer/wavelength"]
self.wavelength = data_template["data_collection/NAME_spectrum[wavelength_spectrum]"]
self.atom_types = data_template["atom_types"]
self.sample_list: list = []
self.data_types = ["psi/delta", "tan(psi)/cos(delta)", "Mueller matrix"]
self.data_types = ["Psi/Delta", "tan(Psi)/cos(Delta)", "Mueller matrix"]
self.angles: list = []
self.number_of_signals = 0

Expand All @@ -73,7 +73,7 @@ def choose_data_type(self, data_template) -> None:
data_template["data_type"] = data_type
if data_type == "Mueller matrix":
self.number_of_signals = 16
elif data_type in ("psi/delta", "tan(psi)/cos(delta)"):
elif data_type in ("Psi/Delta", "tan(Psi)/cos(Delta)"):
self.number_of_signals = 2

def mock_chemical_formula(self) -> None:
Expand Down Expand Up @@ -105,45 +105,44 @@ def mock_angles(self, data_template) -> None:
self.mock_mueller_matrix(data_template)

def mock_signals(self, data_template) -> None:
""" Mock data if data_type is psi/delta or tan(psi)/cos(delta)
""" Mock data if data_type is Psi/Delta or tan(Psi)/cos(Delta)
considering the (new) number of incident angles
"""
my_numpy_array = np.empty([1,
1,
len(self.angles),
self.number_of_signals,
len(self.wavelength)
])
my_numpy_array = np.empty([
len(self.angles),
self.number_of_signals,
len(self.wavelength)
])
for index in range(0, len(self.angles)):
noise = np.random.normal(0, 0.5, self.data[0, 0, 0, 0, :].size)
my_numpy_array[0][0][index] = self.data[0][0][0] * random.uniform(0.5, 1.5) + noise
noise = np.random.normal(0, 0.5, self.data[0, 0, :].size)
my_numpy_array[index] = self.data[0] * random.uniform(0.5, 1.5) + noise
self.data = my_numpy_array
data_template["measured_data"] = my_numpy_array

def mock_mueller_matrix(self, data_template) -> None:
""" Mock data if data_type is Mueller matrix (i.e. 16 elements/signals)
considering the (new) number of incident angles
"""
my_numpy_array = np.empty([1,
1,
len(self.angles),
self.number_of_signals,
len(self.wavelength)
])
my_numpy_array = np.empty([
len(self.angles),
self.number_of_signals,
len(self.wavelength)
])
for idx in range(0, len(self.angles)):
noise = np.random.normal(0, 0.1, self .data[0, 0, 0, 0, :].size)
noise = np.random.normal(0, 0.1, self .data[0, 0, :].size)
for m_idx in range(1, self.number_of_signals):
my_numpy_array[0][0][idx][m_idx] = self.data[0][0][0][0] * random.uniform(.5, 1.)
my_numpy_array[0][0][idx][m_idx] += noise
my_numpy_array[0][0][idx][0] = my_numpy_array[0][0][0][0] / my_numpy_array[0][0][0][0]
my_numpy_array[idx][m_idx] = self.data[0][0] * random.uniform(.5, 1.)
my_numpy_array[idx][m_idx] += noise
my_numpy_array[idx][0] = my_numpy_array[0][0] / my_numpy_array[0][0]
data_template["measured_data"] = my_numpy_array

def modify_spectral_range(self, data_template) -> None:
""" Change spectral range (i.e. wavlength array) and step size,
while length of the wavelength array remains the same.
"""
temp = random.uniform(0.25, 23)
data_template["spectrometer/wavelength"] = temp * data_template["spectrometer/wavelength"]
data_template["data_collection/NAME_spectrum[wavelength_spectrum]"] = \
temp * data_template["data_collection/NAME_spectrum[wavelength_spectrum]"]

def mock_template(self, data_template) -> None:
""" Creates a mock ellipsometry template """
Expand Down
Loading

0 comments on commit f16e63a

Please sign in to comment.