Skip to content

Commit

Permalink
black formatting all xps readers
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Nov 29, 2023
1 parent 9fbbb37 commit 4b9c518
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 123 deletions.
8 changes: 5 additions & 3 deletions pynxtools/dataconverter/readers/xps/file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
from pynxtools.dataconverter.readers.xps.sle.sle_specs import SleParserSpecs
from pynxtools.dataconverter.readers.xps.slh.slh_specs import SlhParserSpecs
from pynxtools.dataconverter.readers.xps.txt.txt_scienta import TxtParserScienta

# from pynxtools.dataconverter.readers.xps.txt.txt_specs import TxtParserSpecs
from pynxtools.dataconverter.readers.xps.txt.txt_vamas_export import TxtParserVamasExport
from pynxtools.dataconverter.readers.xps.txt.txt_vamas_export import (
TxtParserVamasExport,
)
from pynxtools.dataconverter.readers.xps.vms.vamas import VamasParser
from pynxtools.dataconverter.readers.xps.xy.xy_specs import XyParserSpecs
from pynxtools.dataconverter.readers.xps.xml.xml_specs import XmlParserSpecs



class XpsDataFileParser:
"""Class intended for receiving any type of XPS data file."""

Expand All @@ -49,7 +51,7 @@ class XpsDataFileParser:
},
"vms": {"unkwown": VamasParser},
"xml": {"specs": XmlParserSpecs},
"xy": {'specs': XyParserSpecs},
"xy": {"specs": XyParserSpecs},
}

__config_files: Dict = {
Expand Down
9 changes: 6 additions & 3 deletions pynxtools/dataconverter/readers/xps/reader_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from scipy.interpolate import interp1d
import numpy as np


def safe_arange_with_edges(start, stop, step):
"""
In order to avoid float point errors in the division by step.
Expand All @@ -43,6 +44,7 @@ def safe_arange_with_edges(start, stop, step):
"""
return step * np.arange(start / step, (stop + step) / step)


def check_uniform_step_width(x):
"""
Check to see if a non-uniform step width is used in the spectrum
Expand All @@ -66,6 +68,7 @@ def check_uniform_step_width(x):
return False
return True


def get_minimal_step(x):
"""
Return the minimal difference between two consecutive values
Expand All @@ -90,6 +93,7 @@ def get_minimal_step(x):

return step


def _resample_array(y, x0, x1):
"""
Resample an array (y) which has the same initial spacing
Expand All @@ -114,6 +118,7 @@ def _resample_array(y, x0, x1):
fn = interp1d(x0, y, axis=0, fill_value="extrapolate")
return fn(x1)


def interpolate_arrays(x, array_list):
"""
Interpolate data points in case a non-uniform step width was used.
Expand Down Expand Up @@ -195,9 +200,7 @@ def construct_entry_name(key):
try:
# entry example : sample__name_of_scan_region
entry_name = (
f'{key_parts[2].split("_", 1)[1]}'
f"__"
f'{key_parts[4].split("_", 1)[1]}'
f'{key_parts[2].split("_", 1)[1]}' f"__" f'{key_parts[4].split("_", 1)[1]}'
)
except IndexError:
entry_name = ""
Expand Down
Loading

0 comments on commit 4b9c518

Please sign in to comment.