From 82658c8860d28c0ce344800717c8172060de9497 Mon Sep 17 00:00:00 2001 From: Paul Levasseur Date: Fri, 20 Sep 2024 15:57:06 +0200 Subject: [PATCH] v1 --- .idea/csv-editor.xml | 16 ++ .idea/modules.xml | 1 - .idea/nomad_plugin_sintering.iml | 2 +- list/bin/Activate.ps1 | 247 ---------------- list/bin/activate | 69 ----- list/bin/activate.csh | 26 -- list/bin/activate.fish | 69 ----- list/bin/pip | 8 - list/bin/pip3 | 8 - list/bin/pip3.11 | 8 - list/bin/python | 1 - list/bin/python3 | 1 - list/bin/python3.11 | 1 - list/lib64 | 1 - list/pyvenv.cfg | 5 - normalized.archive.json | 272 ++++++++++++++++++ pyproject.toml | 3 +- .../example_uploads/__init__.py | 8 - .../example_uploads/getting_started/README.md | 1 - .../schema_packages/schema_package.py | 38 +++ .../schema_packages/sintering.py | 4 +- tests/conftest.py | 0 tests/data/data_sintering.archive.yaml | 3 + 23 files changed, 333 insertions(+), 459 deletions(-) create mode 100644 .idea/csv-editor.xml delete mode 100644 list/bin/Activate.ps1 delete mode 100644 list/bin/activate delete mode 100644 list/bin/activate.csh delete mode 100644 list/bin/activate.fish delete mode 100755 list/bin/pip delete mode 100755 list/bin/pip3 delete mode 100755 list/bin/pip3.11 delete mode 120000 list/bin/python delete mode 120000 list/bin/python3 delete mode 120000 list/bin/python3.11 delete mode 120000 list/lib64 delete mode 100644 list/pyvenv.cfg create mode 100644 normalized.archive.json delete mode 100644 src/nomad_plugin_sintering/example_uploads/__init__.py delete mode 100644 src/nomad_plugin_sintering/example_uploads/getting_started/README.md create mode 100644 src/nomad_plugin_sintering/schema_packages/schema_package.py delete mode 100644 tests/conftest.py create mode 100644 tests/data/data_sintering.archive.yaml diff --git a/.idea/csv-editor.xml b/.idea/csv-editor.xml new file mode 100644 index 0000000..4a34461 --- /dev/null +++ b/.idea/csv-editor.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 4af0e06..7f66a5c 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,6 @@ - diff --git a/.idea/nomad_plugin_sintering.iml b/.idea/nomad_plugin_sintering.iml index 5cf4ff9..cbb4ce1 100644 --- a/.idea/nomad_plugin_sintering.iml +++ b/.idea/nomad_plugin_sintering.iml @@ -3,10 +3,10 @@ + - \ No newline at end of file diff --git a/list/bin/Activate.ps1 b/list/bin/Activate.ps1 deleted file mode 100644 index b49d77b..0000000 --- a/list/bin/Activate.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove VIRTUAL_ENV_PROMPT altogether. - if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { - Remove-Item -Path env:VIRTUAL_ENV_PROMPT - } - - # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: - if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { - Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force - } - - # Leave deactivate function in the global namespace if requested: - if (-not $NonDestructive) { - Remove-Item -Path function:deactivate - } -} - -<# -.Description -Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the -given folder, and returns them in a map. - -For each line in the pyvenv.cfg file, if that line can be parsed into exactly -two strings separated by `=` (with any amount of whitespace surrounding the =) -then it is considered a `key = value` line. The left hand string is the key, -the right hand is the value. - -If the value starts with a `'` or a `"` then the first and last character is -stripped from the value before being captured. - -.Parameter ConfigDir -Path to the directory that contains the `pyvenv.cfg` file. -#> -function Get-PyVenvConfig( - [String] - $ConfigDir -) { - Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" - - # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). - $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue - - # An empty map will be returned if no config file is found. - $pyvenvConfig = @{ } - - if ($pyvenvConfigPath) { - - Write-Verbose "File exists, parse `key = value` lines" - $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath - - $pyvenvConfigContent | ForEach-Object { - $keyval = $PSItem -split "\s*=\s*", 2 - if ($keyval[0] -and $keyval[1]) { - $val = $keyval[1] - - # Remove extraneous quotations around a string value. - if ("'""".Contains($val.Substring(0, 1))) { - $val = $val.Substring(1, $val.Length - 2) - } - - $pyvenvConfig[$keyval[0]] = $val - Write-Verbose "Adding Key: '$($keyval[0])'='$val'" - } - } - } - return $pyvenvConfig -} - - -<# Begin Activate script --------------------------------------------------- #> - -# Determine the containing directory of this script -$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition -$VenvExecDir = Get-Item -Path $VenvExecPath - -Write-Verbose "Activation script is located in path: '$VenvExecPath'" -Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" -Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" - -# Set values required in priority: CmdLine, ConfigFile, Default -# First, get the location of the virtual environment, it might not be -# VenvExecDir if specified on the command line. -if ($VenvDir) { - Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" -} -else { - Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." - $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") - Write-Verbose "VenvDir=$VenvDir" -} - -# Next, read the `pyvenv.cfg` file to determine any required value such -# as `prompt`. -$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir - -# Next, set the prompt from the command line, or the config file, or -# just use the name of the virtual environment folder. -if ($Prompt) { - Write-Verbose "Prompt specified as argument, using '$Prompt'" -} -else { - Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" - if ($pyvenvCfg -and $pyvenvCfg['prompt']) { - Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" - $Prompt = $pyvenvCfg['prompt']; - } - else { - Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" - Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" - $Prompt = Split-Path -Path $venvDir -Leaf - } -} - -Write-Verbose "Prompt = '$Prompt'" -Write-Verbose "VenvDir='$VenvDir'" - -# Deactivate any currently active virtual environment, but leave the -# deactivate function in place. -deactivate -nondestructive - -# Now set the environment variable VIRTUAL_ENV, used by many tools to determine -# that there is an activated venv. -$env:VIRTUAL_ENV = $VenvDir - -if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { - - Write-Verbose "Setting prompt to '$Prompt'" - - # Set the prompt to include the env name - # Make sure _OLD_VIRTUAL_PROMPT is global - function global:_OLD_VIRTUAL_PROMPT { "" } - Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT - New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt - - function global:prompt { - Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " - _OLD_VIRTUAL_PROMPT - } - $env:VIRTUAL_ENV_PROMPT = $Prompt -} - -# Clear PYTHONHOME -if (Test-Path -Path Env:PYTHONHOME) { - Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME - Remove-Item -Path Env:PYTHONHOME -} - -# Add the venv to the PATH -Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH -$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/list/bin/activate b/list/bin/activate deleted file mode 100644 index c062f24..0000000 --- a/list/bin/activate +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# you cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # This should detect bash and zsh, which have a hash command that must - # be called to get it to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then - hash -r 2> /dev/null - fi - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -VIRTUAL_ENV="/home/palevasseur/nomad_plugin_sintering/list" -export VIRTUAL_ENV - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/bin:$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - PS1="(list) ${PS1:-}" - export PS1 - VIRTUAL_ENV_PROMPT="(list) " - export VIRTUAL_ENV_PROMPT -fi - -# This should detect bash and zsh, which have a hash command that must -# be called to get it to forget past commands. Without forgetting -# past commands the $PATH changes we made may not be respected -if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then - hash -r 2> /dev/null -fi diff --git a/list/bin/activate.csh b/list/bin/activate.csh deleted file mode 100644 index 56b1b71..0000000 --- a/list/bin/activate.csh +++ /dev/null @@ -1,26 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV "/home/palevasseur/nomad_plugin_sintering/list" - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/bin:$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = "(list) $prompt" - setenv VIRTUAL_ENV_PROMPT "(list) " -endif - -alias pydoc python -m pydoc - -rehash diff --git a/list/bin/activate.fish b/list/bin/activate.fish deleted file mode 100644 index 8b01d07..0000000 --- a/list/bin/activate.fish +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source /bin/activate.fish" *from fish* -# (https://fishshell.com/); you cannot run it directly. - -function deactivate -d "Exit virtual environment and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - set -e _OLD_FISH_PROMPT_OVERRIDE - # prevents error when using nested fish instances (Issue #93858) - if functions -q _old_fish_prompt - functions -e fish_prompt - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - end - - set -e VIRTUAL_ENV - set -e VIRTUAL_ENV_PROMPT - if test "$argv[1]" != "nondestructive" - # Self-destruct! - functions -e deactivate - end -end - -# Unset irrelevant variables. -deactivate nondestructive - -set -gx VIRTUAL_ENV "/home/palevasseur/nomad_plugin_sintering/list" - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/bin" $PATH - -# Unset PYTHONHOME if set. -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # Save the current fish_prompt function as the function _old_fish_prompt. - functions -c fish_prompt _old_fish_prompt - - # With the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command. - set -l old_status $status - - # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) "(list) " (set_color normal) - - # Restore the return status of the previous command. - echo "exit $old_status" | . - # Output the original/"old" prompt. - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" - set -gx VIRTUAL_ENV_PROMPT "(list) " -end diff --git a/list/bin/pip b/list/bin/pip deleted file mode 100755 index f8549d2..0000000 --- a/list/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/palevasseur/nomad_plugin_sintering/list/bin/python3.11 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/list/bin/pip3 b/list/bin/pip3 deleted file mode 100755 index f8549d2..0000000 --- a/list/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/palevasseur/nomad_plugin_sintering/list/bin/python3.11 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/list/bin/pip3.11 b/list/bin/pip3.11 deleted file mode 100755 index f8549d2..0000000 --- a/list/bin/pip3.11 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/palevasseur/nomad_plugin_sintering/list/bin/python3.11 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/list/bin/python b/list/bin/python deleted file mode 120000 index 6e7f3c7..0000000 --- a/list/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3.11 \ No newline at end of file diff --git a/list/bin/python3 b/list/bin/python3 deleted file mode 120000 index 6e7f3c7..0000000 --- a/list/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -python3.11 \ No newline at end of file diff --git a/list/bin/python3.11 b/list/bin/python3.11 deleted file mode 120000 index bdc5cab..0000000 --- a/list/bin/python3.11 +++ /dev/null @@ -1 +0,0 @@ -/usr/bin/python3.11 \ No newline at end of file diff --git a/list/lib64 b/list/lib64 deleted file mode 120000 index 7951405..0000000 --- a/list/lib64 +++ /dev/null @@ -1 +0,0 @@ -lib \ No newline at end of file diff --git a/list/pyvenv.cfg b/list/pyvenv.cfg deleted file mode 100644 index 1524305..0000000 --- a/list/pyvenv.cfg +++ /dev/null @@ -1,5 +0,0 @@ -home = /usr/bin -include-system-site-packages = false -version = 3.11.2 -executable = /usr/bin/python3.11 -command = /home/palevasseur/nomad_plugin_sintering/.nomad_env/bin/python -m venv /home/palevasseur/nomad_plugin_sintering/list diff --git a/normalized.archive.json b/normalized.archive.json new file mode 100644 index 0000000..d897faa --- /dev/null +++ b/normalized.archive.json @@ -0,0 +1,272 @@ +{ + "data": { + "m_def": "nomad_plugin_sintering.schema_packages.sintering.Sintering", + "name": "data sintering", + "datetime": "2024-09-20T15:21:53.453123+00:00", + "data_file": "data_sintering.csv", + "steps": [ + { + "name": "heating", + "duration": 1800.0, + "initial_temperature": 25.0, + "final_temperature": 300.0 + }, + { + "name": "hold", + "duration": 3600.0, + "initial_temperature": 300.0, + "final_temperature": 300.0 + }, + { + "name": "cooling", + "duration": 1800.0, + "initial_temperature": 300.0, + "final_temperature": 25.0 + } + ] + }, + "workflow2": { + "name": "data sintering" + }, + "metadata": { + "entry_name": "data_sintering.archive.yaml", + "entry_type": "Sintering", + "mainfile": "/home/palevasseur/nomad_plugin_sintering/tests/data/data_sintering.archive.yaml", + "text_search_contents": [ + "cooling", + "hold", + "data_sintering.csv", + "heating", + "data sintering" + ], + "n_quantities": 31, + "quantities": [ + "", + "data", + "data.data_file", + "data.datetime", + "data.name", + "data.steps", + "data.steps.duration", + "data.steps.final_temperature", + "data.steps.initial_temperature", + "data.steps.name", + "metadata", + "metadata.entry_name", + "metadata.entry_type", + "metadata.mainfile", + "metadata.quantities", + "metadata.section_defs", + "metadata.section_defs.definition_id", + "metadata.section_defs.definition_qualified_name", + "metadata.section_defs.used_directly", + "metadata.sections", + "results", + "results.eln", + "results.eln.methods", + "results.eln.names", + "results.eln.sections", + "results.properties", + "workflow2", + "workflow2.name" + ], + "sections": [ + "nomad.datamodel.datamodel.EntryArchive", + "nomad.datamodel.datamodel.EntryMetadata", + "nomad.datamodel.metainfo.workflow.Workflow", + "nomad.datamodel.results.ELN", + "nomad.datamodel.results.Properties", + "nomad.datamodel.results.Results", + "nomad_plugin_sintering.schema_packages.sintering.Sintering", + "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp" + ], + "section_defs": [ + { + "definition_qualified_name": "nomad.datamodel.data.ArchiveSection", + "definition_id": "7047cbff9980abff17cce4b1b6b0d1c783505b7f", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.data.EntryData", + "definition_id": "538f52fd8d52b29372066f878319c6aeb03b74d2", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.datamodel.EntryArchive", + "definition_id": "f1714301c7ba757a6f15734660ff1bc2393660c4", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.datamodel.EntryMetadata", + "definition_id": "6edfa503af63b84d6a6021c227d00137b4c1cc9c", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.basesections.Activity", + "definition_id": "bd0abbd05794fb9a22acf98127f53b6c621a2649", + "used_directly": false + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.basesections.ActivityStep", + "definition_id": "a99fab14031097eb4b33562274029bd735d753fa", + "used_directly": false + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.basesections.BaseSection", + "definition_id": "106bafb5140238b4afe8128b8c341b5b3e927838", + "used_directly": false + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.basesections.Process", + "definition_id": "937d37a2a0a3bdd1ee31d1e4c919497c018dfb44", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.basesections.ProcessStep", + "definition_id": "c1ab49b91cd0a92bd199740e3a6a2184a8e1498e", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.workflow.Task", + "definition_id": "ac62fdff74f54fd477531446ca111c0dd9df6ba2", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.metainfo.workflow.Workflow", + "definition_id": "fc65ae24157492e422afe61173a71403fc5e1fd7", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.results.ELN", + "definition_id": "eeed330bd18d40f3a2a00cc35ba6f58808d0c543", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.results.Properties", + "definition_id": "6fb112524bb10f9ac23e8d162e4d7ad2e5862be3", + "used_directly": true + }, + { + "definition_qualified_name": "nomad.datamodel.results.Results", + "definition_id": "72fc7fdff28b055cec563fb9df2cadc21b225fc0", + "used_directly": true + }, + { + "definition_qualified_name": "nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition_id": "9f71f29278c87f0f992a420ee0543325919275bc", + "used_directly": true + }, + { + "definition_qualified_name": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp", + "definition_id": "71c5a34f55720dd913e84d8ea24e27300c272186", + "used_directly": true + } + ], + "search_quantities": [ + { + "id": "data.data_file#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.Sintering.data_file", + "path_archive": "data.data_file", + "str_value": "data_sintering.csv" + }, + { + "id": "data.steps.name#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ActivityStep.name", + "path_archive": "data.steps.0.name", + "str_value": "heating" + }, + { + "id": "data.steps.duration#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ProcessStep.duration", + "path_archive": "data.steps.0.duration", + "float_value": 1800.0 + }, + { + "id": "data.steps.initial_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.initial_temperature", + "path_archive": "data.steps.0.initial_temperature", + "float_value": 25.0 + }, + { + "id": "data.steps.final_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.final_temperature", + "path_archive": "data.steps.0.final_temperature", + "float_value": 300.0 + }, + { + "id": "data.steps.name#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ActivityStep.name", + "path_archive": "data.steps.1.name", + "str_value": "hold" + }, + { + "id": "data.steps.duration#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ProcessStep.duration", + "path_archive": "data.steps.1.duration", + "float_value": 3600.0 + }, + { + "id": "data.steps.initial_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.initial_temperature", + "path_archive": "data.steps.1.initial_temperature", + "float_value": 300.0 + }, + { + "id": "data.steps.final_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.final_temperature", + "path_archive": "data.steps.1.final_temperature", + "float_value": 300.0 + }, + { + "id": "data.steps.name#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ActivityStep.name", + "path_archive": "data.steps.2.name", + "str_value": "cooling" + }, + { + "id": "data.steps.duration#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.ProcessStep.duration", + "path_archive": "data.steps.2.duration", + "float_value": 1800.0 + }, + { + "id": "data.steps.initial_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.initial_temperature", + "path_archive": "data.steps.2.initial_temperature", + "float_value": 300.0 + }, + { + "id": "data.steps.final_temperature#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad_plugin_sintering.schema_packages.sintering.TemperatureRamp.final_temperature", + "path_archive": "data.steps.2.final_temperature", + "float_value": 25.0 + }, + { + "id": "data.name#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.BaseSection.name", + "path_archive": "data.name", + "str_value": "data sintering" + }, + { + "id": "data.datetime#nomad_plugin_sintering.schema_packages.sintering.Sintering", + "definition": "nomad.datamodel.metainfo.basesections.Activity.datetime", + "path_archive": "data.datetime", + "datetime_value": "2024-09-20T15:21:53.453123+00:00" + } + ] + }, + "results": { + "properties": {}, + "eln": { + "sections": [ + "Sintering" + ], + "names": [ + "data sintering" + ], + "methods": [ + "Sintering" + ] + } + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 553d1f6..3cfe2e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ select = [ "UP", # isort "I", - # pylint + # pylint "PL", ] @@ -115,7 +115,6 @@ parser_entry_point = "nomad_plugin_sintering.parsers:parser_entry_point" sintering_entry_point = "nomad_plugin_sintering.schema_packages:sintering_entry_point" normalizer_entry_point = "nomad_plugin_sintering.normalizers:normalizer_entry_point" app_entry_point = "nomad_plugin_sintering.apps:app_entry_point" -example_upload_entry_point = "nomad_plugin_sintering.example_uploads:example_upload_entry_point" [tool.cruft] # Avoid updating workflow files, this leads to permissions issues skip = [".github/*"] diff --git a/src/nomad_plugin_sintering/example_uploads/__init__.py b/src/nomad_plugin_sintering/example_uploads/__init__.py deleted file mode 100644 index a9b80d1..0000000 --- a/src/nomad_plugin_sintering/example_uploads/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -from nomad.config.models.plugins import ExampleUploadEntryPoint - -example_upload_entry_point = ExampleUploadEntryPoint( - title='New Example Upload', - category='Examples', - description='Description of this example upload.', - path='example_uploads/getting_started', -) diff --git a/src/nomad_plugin_sintering/example_uploads/getting_started/README.md b/src/nomad_plugin_sintering/example_uploads/getting_started/README.md deleted file mode 100644 index 6d2118f..0000000 --- a/src/nomad_plugin_sintering/example_uploads/getting_started/README.md +++ /dev/null @@ -1 +0,0 @@ -EXAMPLE DATA diff --git a/src/nomad_plugin_sintering/schema_packages/schema_package.py b/src/nomad_plugin_sintering/schema_packages/schema_package.py new file mode 100644 index 0000000..e718979 --- /dev/null +++ b/src/nomad_plugin_sintering/schema_packages/schema_package.py @@ -0,0 +1,38 @@ +from typing import ( + TYPE_CHECKING, +) + +if TYPE_CHECKING: + from nomad.datamodel.datamodel import ( + EntryArchive, + ) + from structlog.stdlib import ( + BoundLogger, + ) + +from nomad.config import config +from nomad.datamodel.data import Schema +from nomad.datamodel.metainfo.annotations import ELNAnnotation, ELNComponentEnum +from nomad.metainfo import Quantity, SchemaPackage + +configuration = config.get_plugin_entry_point( + 'sintering.schema_packages:sintering_entry_point' +) + +m_package = SchemaPackage() + + +class NewSchemaPackage(Schema): + name = Quantity( + type=str, a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity) + ) + message = Quantity(type=str) + + def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: + super().normalize(archive, logger) + + logger.info('NewSchema.normalize', parameter=configuration.parameter) + self.message = f'Hello {self.name}!' + + +m_package.__init_metainfo__() \ No newline at end of file diff --git a/src/nomad_plugin_sintering/schema_packages/sintering.py b/src/nomad_plugin_sintering/schema_packages/sintering.py index bbe937b..9c961ce 100644 --- a/src/nomad_plugin_sintering/schema_packages/sintering.py +++ b/src/nomad_plugin_sintering/schema_packages/sintering.py @@ -113,7 +113,7 @@ class Sintering(Process, EntryData, ArchiveSection): }, ) - def normalize(self, archive, logger: BoundLogger) -> None: + def normalize(self, archive, logger: 'BoundLogger') -> None: ''' The normalizer for the `Sintering` class. @@ -135,7 +135,7 @@ def normalize(self, archive, logger: BoundLogger) -> None: step.initial_temperature = ureg.Quantity(row['initial temperature [C]'], 'celsius') step.final_temperature = ureg.Quantity(row['final temperature [C]'], 'celsius') steps.append(step) - self.steps = steps + self.steps = steps m_package.__init_metainfo__() diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/data/data_sintering.archive.yaml b/tests/data/data_sintering.archive.yaml new file mode 100644 index 0000000..df785cb --- /dev/null +++ b/tests/data/data_sintering.archive.yaml @@ -0,0 +1,3 @@ +data: + m_def: nomad_plugin_sintering.schema_packages.sintering.Sintering + data_file: data_sintering.csv \ No newline at end of file