From f860c806d7a0b0f2ecb2b7dabf16fafd7db61bf1 Mon Sep 17 00:00:00 2001 From: Rubel Date: Fri, 15 Sep 2023 13:15:15 +0200 Subject: [PATCH] Changing Reader name from STMReader to XRDReader. --- .../dataconverter/readers/xrd/Untitled.ipynb | 80 +++++++++++++++++++ pynxtools/dataconverter/readers/xrd/reader.py | 4 +- 2 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 pynxtools/dataconverter/readers/xrd/Untitled.ipynb diff --git a/pynxtools/dataconverter/readers/xrd/Untitled.ipynb b/pynxtools/dataconverter/readers/xrd/Untitled.ipynb new file mode 100644 index 000000000..b0fe84a28 --- /dev/null +++ b/pynxtools/dataconverter/readers/xrd/Untitled.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "bc15a0fb-c139-4f5f-8602-a6644e1e92f0", + "metadata": {}, + "outputs": [ + { + "ename": "RuntimeError", + "evalue": "module compiled against API version 0x10 but this version of numpy is 0xe", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;31mRuntimeError\u001b[0m: module compiled against API version 0x10 but this version of numpy is 0xe" + ] + }, + { + "ename": "ImportError", + "evalue": "numpy.core.multiarray failed to import", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_29230/4118053084.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpynxtools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdataconverter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreaders\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxrd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxrd_parser\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mparse_and_convert_file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/NOMAD-FAIRmat/GH/pynxtools/pynxtools/dataconverter/readers/xrd/xrd_parser.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m \u001b[0;31m# for file path operations\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mxml\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0metree\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mElementTree\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mET\u001b[0m \u001b[0;31m# for XML parsing\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mxrayutilities\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mio\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpanalytical_xml\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mXRDMLFile\u001b[0m \u001b[0;31m# for reading XRDML files\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 25\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0mFileReader\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/NOMAD-FAIRmat/GH/pynxtools/.pyenv_3_10/lib/python3.10/site-packages/xrayutilities/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;31m# load configuration\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 32\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m__path__\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0manalysis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mio\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaterials\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msimpack\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 33\u001b[0m from .experiment import (GID, GISAXS, HXRD, Experiment, FourC, NonCOP,\n\u001b[1;32m 34\u001b[0m PowderExperiment, QConversion)\n", + "\u001b[0;32m~/NOMAD-FAIRmat/GH/pynxtools/.pyenv_3_10/lib/python3.10/site-packages/xrayutilities/analysis/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 25\u001b[0m \"\"\"\n\u001b[1;32m 26\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m from .line_cuts import (get_arbitrary_line, get_omega_scan, get_qx_scan,\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0mget_qy_scan\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_qz_scan\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_radial_scan\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m get_ttheta_scan)\n", + "\u001b[0;32m~/NOMAD-FAIRmat/GH/pynxtools/.pyenv_3_10/lib/python3.10/site-packages/xrayutilities/analysis/line_cuts.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexperiment\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mHXRD\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 22\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgridder\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mFuzzyGridder1D\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/NOMAD-FAIRmat/GH/pynxtools/.pyenv_3_10/lib/python3.10/site-packages/xrayutilities/experiment.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 37\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[0;31m# package internal imports\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 39\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcxrayutilities\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mutilities\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 40\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mexception\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mInputError\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mImportError\u001b[0m: numpy.core.multiarray failed to import" + ] + } + ], + "source": [ + "from pynxtools.dataconverter.readers.xrd.xrd_parser import parse_and_convert_file" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "945d80f2-9fdd-4e61-8ff2-d721e50000b0", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy.core.multiarray" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "98f6e21d-6c50-4efa-bdce-3ac1ef4c4df0", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pynxtools/dataconverter/readers/xrd/reader.py b/pynxtools/dataconverter/readers/xrd/reader.py index f6a83db96..2ffd6da8f 100644 --- a/pynxtools/dataconverter/readers/xrd/reader.py +++ b/pynxtools/dataconverter/readers/xrd/reader.py @@ -52,7 +52,7 @@ XRD_FILE_EXTENSIONS = [".xrdml", ".udf", ".raw", ".xye"] -class STMReader(BaseReader): +class XRDReader(BaseReader): """ Reader for XPS. """ @@ -118,4 +118,4 @@ def read(self, return filled_template -READER = STMReader +READER = XRDReader