Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cspell/custom-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ ureg
valinit
valtext
Yichen
pynx
zipf
arcname
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

# `pynxtools-spm`: A `pynxtools` reader for SPM data

.

This `pynxtools` plugin was generated with [`cookiecutter`](https://github.com/cookiecutter/cookiecutter) using the [`pynxtools-plugin-template`](https://github.com/FAIRmat-NFDI/`pynxtools-plugin-template) template.

## Installation
Expand All @@ -37,4 +35,4 @@ More information about this pynxtools plugin is available in the [documentation]
Rubel Mozumder


**Note**: This repository is an upgraded and renamed version of [pynxtools-stm](https://github.com/FAIRmat-NFDI/pynxtools-stm), which is now archived. In addition to the integration of new readers (e.g., `AFM`), all functionalities of `pynxtools-stm` remain available in this repository.
**Note**: This repository is an upgraded and renamed version of [pynxtools-stm](https://github.com/FAIRmat-NFDI/pynxtools-stm), which is now archived. In addition to the integration of new readers (e.g., `AFM`), all functionalities of `pynxtools-stm` remain available in this repository.
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ dependencies = [
"Parent Project" = "https://github.com/FAIRmat-NFDI"

[project.optional-dependencies]
nomad = ["nomad-lab >= 1.4.0"]

dev = [
"mypy",
"ruff>=0.14.0",
Expand All @@ -52,6 +54,11 @@ docs = [
"mkdocs-simple-hooks",
]

nomad_api = [
"requests",
"nomad-lab >= 1.4.0",
]

[project.entry-points."pynxtools.reader"]
spm = "pynxtools_spm.reader:SPMReader"

Expand All @@ -70,7 +77,7 @@ version_scheme = "no-guess-dev"
local_scheme = "node-and-date"

[tool.ruff]
include = ["src/pynxtools_spm/*.py", "tests/*.py"]
include = ["src/pynxtools_spm/**/*.py", "tests/**/*.py"]
lint.select = [
"E", # pycodestyle
"W", # pycodestyle
Expand Down Expand Up @@ -101,3 +108,8 @@ ignore_missing_imports = true
follow_imports = "silent"
no_strict_optional = true
disable_error_code = "import, annotation-unchecked"

[tool.uv]
extra-index-url = [
"https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple",
]
134 changes: 134 additions & 0 deletions scripts/example_upload_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
from pynxtools_spm.nomad_uploader.uploader import (
run_uploader_with,
NOMADSettings,
DataProcessingSettings,
)
from pathlib import Path

current_dir = Path(__file__).resolve().parent
project_dir = current_dir.parent

nomad_settings = NOMADSettings(
url_protocol="https",
url_domain="nomad-lab.eu",
url_version="prod/v1/develop/api/v1/",
url="https://nomad-lab.eu/prod/v1/develop/api/v1/",
username="Mozumder",
password="*#R516660a*#",
token="",
modify_upload_metadata=True,
publish_to_nomad=False,
)
nanonis = project_dir / "tests/data/nanonis"

total_upload = 3

data_proc_settings = DataProcessingSettings(
raw_file_exts=(
".dat",
".sxm",
),
single_batch_processing_time=total_upload * 90, # seconds
src_dir=nanonis,
# copy_file_elsewhere=False,
dst_dir="",
create_pseudo_file=True,
pseudo_exts=".done",
spm_params_obj_l=[],
sts_eln=nanonis / "sts/version_gen_5e_with_described_nxdata/eln_data.yaml",
sts_config="",
stm_eln=nanonis / "stm/version_gen_5_with_described_nxdata/eln_data.yaml",
stm_config="",
afm_eln=nanonis / "afm/version_gen_4_with_described_nxdata/eln_data.yaml",
afm_config="",
logger_dir=current_dir,
number_of_uploads=total_upload,
file_to_convert_data={
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
f"{nanonis / 'stm/version_gen_5_with_described_nxdata/Au_mica_2023_Y_A_diPAMY_195.sxm'}": {
"eln": "",
"technique": "stm",
},
f"{nanonis / 'sts/version_gen_5e_with_described_nxdata/STS_nanonis_generic_5e_1.dat'}": {
"eln": "",
"technique": "sts",
},
},
# metadata = {
# "metadata": {
# "upload_name": upload_name,
# "references": ["https://doi.org/xx.xxxx/xxxxxx"],
# "datasets": dataset_id,
# "embargo_length": 0,
# "coauthors": ["coauthor@affiliation.de"],
# "comment": 'This is a test upload...'
# },
# }
upload_metadata={
"metadata": {
"coauthors": ["cojaddl@physik.hu-berlin.de"],
"upload_name": "test_upload",
}
},
)

if __name__ == "__main__":
run_uploader_with(
nomad_settings=nomad_settings,
data_proc_settings=data_proc_settings,
)
13 changes: 13 additions & 0 deletions scripts/run_uploader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash

# Stop on error
set -e

current_dir=$(dirname $(realpath $0))
echo "Current directory: $current_dir"
uploader_script="$current_dir/example_upload_script.py"
venv="/home/rubel/NOMAD-FAIRmat/GH/pynxtools-spm/.venv"
python_3="$venv/bin/python3"
echo "Running uploader script..."
"$python_3" "$uploader_script" > "$current_dir/debug.txt" 2>&1
echo "Uploader script finished. Check debug.txt for details."
Loading
Loading