From 959122fb049b7cba6c7e8ce87bdae8af1b6db944 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Tue, 10 Dec 2024 14:37:50 +0100 Subject: [PATCH 01/18] add functionality to download ROD files via command line --- README.md | 37 +++++++++++++++++++++++++ pyproject.toml | 7 ++++- src/pynxtools_raman/rod/rod_get_file.py | 36 ++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/pynxtools_raman/rod/rod_get_file.py diff --git a/README.md b/README.md index 2ef201d..cfaac83 100644 --- a/README.md +++ b/README.md @@ -32,5 +32,42 @@ within the field of raman into a standardized representation using the ## Docs Extensive documentation of this pynxtools plugin is available [here](https://fairmat-nfdi.github.io/pynxtools-raman/). You can find information about getting started, how-to guides, the supported file formats, how to get involved, and much more there. +## Use Example via GitHub +Download(clone) the repository via git: +```shell +git clone https://github.com/FAIRmat-NFDI/pynxtools-raman.git +``` +Switch to the project root folder: +```shell +cd pynxtools-raman +``` +You see 3 Folders: +- examples: contains example datasets, to show how the data conversion is done (currently 1 example from WITec and 1 example from the Raman Open Database) +- tests: contains a test procedure and files, which are required for software development +- src/pynxtools_raman: contains the source files, which contain the sub-reader function for Raman experiments. This only works in combination with the python package [pynxtools](https://github.com/FAIRmat-NFDI/pynxtools). This contains the [Multiformat Reader](https://fairmat-nfdi.github.io/pynxtools/how-tos/use-multi-format-reader.html) and the respective sub-reader functions for WITec or Raman Open Database. This also contains the config.json files in src/pynxtools_raman/config, which are necessary to map the data via the Multiformat Reader, by as well allowing individual adjustments. In this way each laboratory is able to map the data via the same reader, while each laboratory has its own individual electronic lab notebook structure. + +Install the python package: +```shell +pip install . +``` +**Perform a dataconversion** +for the WITec dataset via: +```shell +dataconverter examples/witec/txt/eln_data.yaml examples/witec/txt/Si-wafer-Raman-Spectrum-1.txt src/pynxtools_raman/config/config_file_witec.json --reader raman --nxdl NXraman --output new_witec_example_neuxs.nxs +``` + +and for the Raman Open Database dataset set via: +```shell +dataconverter examples/database/rod/rod_file_1000679.rod src/pynxtools_raman/config/config_file_rod.json --reader raman --nxdl NXraman --output new_rod_example_neuxs.nxs +``` + +**For Example for the Raman Open Database command:** +- You assign the reader name via `--reader raman` +- You assign the NeXus definition language (nxdl) via `--nxdl NXraman` +- You specify the name and path of the output file via `--output new_rod_example_neuxs.nxs` +- You assign an indiviualized config file via `src/pynxtools_raman/config/config_file_rod.json`. The config file is detected by its extension `.json` +- You give the file, which includes the meta and measurement data via `examples/database/rod/rod_file_1000679.rod`. The parser is specificed to detect the `.rod` file, and handle the content appropiately + + ## Contact person in FAIRmat for this reader Ron Hildebrandt diff --git a/pyproject.toml b/pyproject.toml index 8080cc9..e126104 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,12 +23,17 @@ classifiers = [ ] dependencies = [ "pynxtools>=0.7.0", - "gemmi>=0.6.7" + "gemmi>=0.6.7", + "requests>=2.32.3", ] [project.entry-points."pynxtools.reader"] raman = "pynxtools_raman.reader:RamanReader" + +[project.scripts] +download_rod_file = "pynxtools_raman.rod.rod_get_file:trigger_rod_download" + [tool.setuptools.packages.find] where = [ "src", diff --git a/src/pynxtools_raman/rod/rod_get_file.py b/src/pynxtools_raman/rod/rod_get_file.py new file mode 100644 index 0000000..9c6de1a --- /dev/null +++ b/src/pynxtools_raman/rod/rod_get_file.py @@ -0,0 +1,36 @@ +import argparse + +import requests + + +rod_id = 1000679 + + +def save_rod_file_from_ROD_via_API(rod_id: int) -> str: + url = "https://solsa.crystallography.net/rod/" + str(rod_id) + ".rod" + response = requests.post(url) + + filename = str(rod_id) + + with open(filename + ".rod", "w", encoding="utf-8") as file: + file.write(response.text) + print("Saved ROD ID %s to file '%s'"(rod_id, filename)) + + +def trigger_rod_download(): + # Create an argument parser + parser = argparse.ArgumentParser(description="Download a CIF file.") + parser.add_argument( + "rod_id", # The argument's name + type=str, # Argument type (e.g., string) + help="The name of the file to download", # Help message + ) + + # Parse the command-line arguments + args = parser.parse_args() + + save_rod_file_from_ROD_via_API(args.rod_id) + + # Use the parsed argument + print(f"Downloading CIF file: {args.rod_id}") + # Add your logic to download the file here From 1333d7f9130a0cb8c1e97b9d779292b141f69374 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Tue, 10 Dec 2024 14:39:39 +0100 Subject: [PATCH 02/18] remove readme adjustments --- README.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/README.md b/README.md index cfaac83..a657983 100644 --- a/README.md +++ b/README.md @@ -32,42 +32,6 @@ within the field of raman into a standardized representation using the ## Docs Extensive documentation of this pynxtools plugin is available [here](https://fairmat-nfdi.github.io/pynxtools-raman/). You can find information about getting started, how-to guides, the supported file formats, how to get involved, and much more there. -## Use Example via GitHub -Download(clone) the repository via git: -```shell -git clone https://github.com/FAIRmat-NFDI/pynxtools-raman.git -``` -Switch to the project root folder: -```shell -cd pynxtools-raman -``` -You see 3 Folders: -- examples: contains example datasets, to show how the data conversion is done (currently 1 example from WITec and 1 example from the Raman Open Database) -- tests: contains a test procedure and files, which are required for software development -- src/pynxtools_raman: contains the source files, which contain the sub-reader function for Raman experiments. This only works in combination with the python package [pynxtools](https://github.com/FAIRmat-NFDI/pynxtools). This contains the [Multiformat Reader](https://fairmat-nfdi.github.io/pynxtools/how-tos/use-multi-format-reader.html) and the respective sub-reader functions for WITec or Raman Open Database. This also contains the config.json files in src/pynxtools_raman/config, which are necessary to map the data via the Multiformat Reader, by as well allowing individual adjustments. In this way each laboratory is able to map the data via the same reader, while each laboratory has its own individual electronic lab notebook structure. - -Install the python package: -```shell -pip install . -``` -**Perform a dataconversion** -for the WITec dataset via: -```shell -dataconverter examples/witec/txt/eln_data.yaml examples/witec/txt/Si-wafer-Raman-Spectrum-1.txt src/pynxtools_raman/config/config_file_witec.json --reader raman --nxdl NXraman --output new_witec_example_neuxs.nxs -``` - -and for the Raman Open Database dataset set via: -```shell -dataconverter examples/database/rod/rod_file_1000679.rod src/pynxtools_raman/config/config_file_rod.json --reader raman --nxdl NXraman --output new_rod_example_neuxs.nxs -``` - -**For Example for the Raman Open Database command:** -- You assign the reader name via `--reader raman` -- You assign the NeXus definition language (nxdl) via `--nxdl NXraman` -- You specify the name and path of the output file via `--output new_rod_example_neuxs.nxs` -- You assign an indiviualized config file via `src/pynxtools_raman/config/config_file_rod.json`. The config file is detected by its extension `.json` -- You give the file, which includes the meta and measurement data via `examples/database/rod/rod_file_1000679.rod`. The parser is specificed to detect the `.rod` file, and handle the content appropiately - ## Contact person in FAIRmat for this reader Ron Hildebrandt From 2241edfbfaccb073681f85f35776b46a4a3a1483 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Wed, 11 Dec 2024 09:52:16 +0100 Subject: [PATCH 03/18] add exceptions for API request --- src/pynxtools_raman/rod/rod_get_file.py | 31 ++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/pynxtools_raman/rod/rod_get_file.py b/src/pynxtools_raman/rod/rod_get_file.py index 9c6de1a..804de4c 100644 --- a/src/pynxtools_raman/rod/rod_get_file.py +++ b/src/pynxtools_raman/rod/rod_get_file.py @@ -2,19 +2,32 @@ import requests - rod_id = 1000679 -def save_rod_file_from_ROD_via_API(rod_id: int) -> str: +def save_rod_file_from_ROD_via_API(rod_id: int): url = "https://solsa.crystallography.net/rod/" + str(rod_id) + ".rod" - response = requests.post(url) - filename = str(rod_id) + print(f"Initialized download of .rod file with ID '{rod_id}' from '{url}'.") + + try: + response = requests.post(url) + response.raise_for_status() # Raise HTTP error for bad + + print(f"Successfully received .rod file with ID '{rod_id}'") - with open(filename + ".rod", "w", encoding="utf-8") as file: - file.write(response.text) - print("Saved ROD ID %s to file '%s'"(rod_id, filename)) + filename = str(rod_id) + + with open(filename + ".rod", "w", encoding="utf-8") as file: + file.write(response.text) + print(f"Saved .rod file with ID '{rod_id}' to file '{filename}'") + + except requests.exceptions.ConnectionError as con_err: + print(f"ConnectionError occured: {con_err}") + except requests.exceptions.HTTPError as http_err: + print(f"CHTTPError occured: {http_err}") + except requests.exceptions.RequestException as req_exc: + print(f"RequestException occured: {req_exc}") def trigger_rod_download(): @@ -30,7 +43,3 @@ def trigger_rod_download(): args = parser.parse_args() save_rod_file_from_ROD_via_API(args.rod_id) - - # Use the parsed argument - print(f"Downloading CIF file: {args.rod_id}") - # Add your logic to download the file here From e092d14c8651519b060c876a8ee368120ae9a91f Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Fri, 13 Dec 2024 11:00:27 +0100 Subject: [PATCH 04/18] adjustements to include .rod downloads and parsing other rod files --- src/download_rod_files/README.md | 34 ++++++++++++++++++ .../convert_all_rod_to_nxs.sh | 14 ++++++++ .../download_rods_script.sh | 6 ++++ .../config/config_file_rod.json | 4 +-- src/pynxtools_raman/reader.py | 32 +++++++++++------ tests/data/rod/example.nxs | Bin 68760 -> 68784 bytes tests/data/witec/example.nxs | Bin 78784 -> 78784 bytes 7 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 src/download_rod_files/README.md create mode 100755 src/download_rod_files/convert_all_rod_to_nxs.sh create mode 100755 src/download_rod_files/download_rods_script.sh diff --git a/src/download_rod_files/README.md b/src/download_rod_files/README.md new file mode 100644 index 0000000..8f3d8e5 --- /dev/null +++ b/src/download_rod_files/README.md @@ -0,0 +1,34 @@ +# Downloading multiple .rod files + +## download_rods_script.sh + +Adjust the file `download_rods_script.sh`to the range of download you want. +Default start is `1` and default end is `3`. +Be careful: Do not trigger unneccsary amounts of downloads. + +Take a look [here](https://solsa.crystallography.net/rod/1000679.html), to get valid .rod IDs. For this example its e.g. `1000679`. + +## Add the command as script + +`chmod +x download_rods_script.sh` + +## Exectutute the script + +`./download_rods_script.sh` + + +## Convert the downloaded .rod files + +via the pynxtools-raman command: + +`dataconverter /1000679.rod src/pynxtools_raman/config/config_file_rod.json --reader raman --nxdl NXraman --output rod_example_neuxs.nxs` + + +# Automatec conversion of all .rod files to .nxs files + +## Add the command as script +`chmod +x convert_all_rod_to_nxs.sh` + +## Call the script +`./src/download_rod_files/convert_all_rod_to_nxs.sh` + diff --git a/src/download_rod_files/convert_all_rod_to_nxs.sh b/src/download_rod_files/convert_all_rod_to_nxs.sh new file mode 100755 index 0000000..ac2c41a --- /dev/null +++ b/src/download_rod_files/convert_all_rod_to_nxs.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Define the folder containing the .rod files +folder_path="./src/download_rod_files" + +# Loop over all .rod files in the folder +for file in "$folder_path"/*.rod; do + # Extract the base name (without extension) + base_name=$(basename "$file" .rod) + + # Execute the command with the base name + dataconverter "$file" src/pynxtools_raman/config/config_file_rod.json \ + --reader raman --nxdl NXraman --output "${base_name}.nxs" +done \ No newline at end of file diff --git a/src/download_rod_files/download_rods_script.sh b/src/download_rod_files/download_rods_script.sh new file mode 100755 index 0000000..939b45f --- /dev/null +++ b/src/download_rod_files/download_rods_script.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +#for X in {1..3}; do +for X in {1000004..1000005}; do + download_rod_file "$X" +done \ No newline at end of file diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index 62d4982..315223f 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -18,7 +18,7 @@ "/ENTRY[entry]/INSTRUMENT[instrument]/LENS_OPT[objective_lens]/numerical_aperture": "@data:_raman_measurement_device.microscope_numerical_aperture", "/ENTRY[entry]/INSTRUMENT[instrument]/MONOCHROMATOR[monochromator]/grating/period": "@data:_raman_measurement_device.diffraction_grating", "/ENTRY[entry]/INSTRUMENT[instrument]/MONOCHROMATOR[monochromator]/grating/period/@units": "lines/mm", - "/ENTRY[entry]/SAMPLE[sample]/name":"@data:_chemical_name_systematic", + "/ENTRY[entry]/SAMPLE[sample]/name":"@data:_chemical_name_mineral", "/ENTRY[entry]/SAMPLE[sample]/physical_form":"@data:_[local]_chemical_compound_state", "/ENTRY[entry]/SAMPLE[sample]/chemical_formula":"@data:_chemical_formula_structural", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[medium]/sample_medium":"@data:_raman_measurement.environment", @@ -31,7 +31,7 @@ "/ENTRY[entry]/definition/@url": "Remove_this_if_pynxtools_issue_#469_is_solved", "/ENTRY[entry]/experiment_type": "Raman spectroscopy", "/ENTRY[entry]/raman_experiment_type": "other", - "/ENTRY[entry]/title": "@data:_chemical_name_mineral", + "/ENTRY[entry]/title": "@data:_cod_original_formula_sum", "/ENTRY[entry]/start_time": "@data:_raman_measurement.datetime_initiated", "/ENTRY[entry]/@default": "data", "/ENTRY[entry]/DATA[data]/@signal": "y_values", diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index 5021697..d71d854 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -90,6 +90,12 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: # get the key and value pairs from the rod file self.raman_data = rod.extract_keys_and_values_from_cif() + # replace the [ and ] to avoid confliucts in processing with pynxtools NXclass assignments + self.raman_data = { + key.replace("_[local]_", "_local_"): value + for key, value in self.raman_data.items() + } + self.missing_meta_data = copy.deepcopy(self.raman_data) # This changes all uppercase string elements to lowercase string elements for the given key, within a given key value pair @@ -101,16 +107,17 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: # transform the string into a datetime object time_key = "_raman_measurement.datetime_initiated" date_time_str = self.raman_data.get(time_key) - date_time_obj = datetime.datetime.strptime(date_time_str, "%Y-%m-%d") - # assume UTC for .rod data, as this is not specified in detail - tzinfo = datetime.timezone.utc - if isinstance(date_time_obj, datetime.datetime): - if tzinfo is not None: - # Apply the specified timezone to the datetime object - date_time_obj = date_time_obj.replace(tzinfo=tzinfo) - - # assign the dictionary the corrrected date format - self.raman_data[time_key] = date_time_obj.isoformat() + if date_time_str is not None: + date_time_obj = datetime.datetime.strptime(date_time_str, "%Y-%m-%d") + # assume UTC for .rod data, as this is not specified in detail + tzinfo = datetime.timezone.utc + if isinstance(date_time_obj, datetime.datetime): + if tzinfo is not None: + # Apply the specified timezone to the datetime object + date_time_obj = date_time_obj.replace(tzinfo=tzinfo) + + # assign the dictionary the corrrected date format + self.raman_data[time_key] = date_time_obj.isoformat() # remove capitalization objective_type_key = "_raman_measurement_device.optics_type" @@ -199,7 +206,10 @@ def get_data(self, key: str, path: str) -> Any: # this filters out the meta data, which is up to now only created for .rod files if self.missing_meta_data: - del self.missing_meta_data[path] + # this if condition is required, to only delete keys which are abaialble by the data. + # e.g. is defined to extract it via config.json, but there is no value in meta data + if path in self.missing_meta_data.keys(): + del self.missing_meta_data[path] if value is not None: try: diff --git a/tests/data/rod/example.nxs b/tests/data/rod/example.nxs index 55e64f1593d60ae89b710c006ff3eb5883bf9f07..9569c15c980d44c360fab33efc7ff9a08b8d1f49 100644 GIT binary patch delta 3830 zcmZ`6Yfx0@^_~mJy_eUb#@z*F7kuo3ChP(VNUBR}492J{O(&>hWk=D)%0s0U7&Cx> zqCYyrdS+Tp+X>9HW-D6v_C~~1Ek276%xdd1CdD`=rV|=WI*OBV?Dx8W>11bi&-;Am zJFk0p&)(R`-q?0GL_*oipigglCdWi$K<^p^bfzg-A7_Cgqb=?bzz}-l-%~Bw68i*0 zx@))M$DrbdSPUr+h{K~Pg)k1UD6iS$xsntkpx0Z#Fa^D;)vo@4RKoy~CJ1SqfZKxA z4OIkB#D^(XNWvy{86@L*^*uItub9iJpP>}f&>3< z;;?&!m6?sD6cAXqBef{Ry#z19;#7yBSc(99 z6q`|zs)8lo>GjN=J$o+6b)F}GP9bg{@BBZe(K-H|xbjMIT&tHOJ%S#Z#Sy2-yE2c{ zy@GE4F{dkK4jbR#FdU=n`)Ko8v|iDE4_?JIPezjS1FqrgCJ=uWpRNua1!y*ny@vfw~ORsXu>;%t$IqiSMVI>FB(D(GpzT<-6(~!Q;7)Wmg>^QAp zWQh~p7?|RceG;}^n4y{Wz1boCgwc`V2HAH2SEkKSdko>>H=8w>Fq_`XLOG(2u>{Q= zL(`UF11IFP6=Sf}ncG4&O)HI{tht019X!^wf=(o~k9X`Brg0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U&Y5L GrV0RCz7Wy? delta 65 zcmX@`oaMlCmJOMF5(Wx}MpniqRtBbeCKg6UW+vJOhE@g!#*+j2Bm^-en^*B|U&Y5L GrV0R7st~3C From 6eb06d8439f5833703dfc35f3c8fe31c59a06960 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Fri, 13 Dec 2024 11:08:18 +0100 Subject: [PATCH 05/18] test more files and update scripts --- src/download_rod_files/README.md | 2 +- src/download_rod_files/convert_all_rod_to_nxs.sh | 2 +- src/download_rod_files/download_rods_script.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/download_rod_files/README.md b/src/download_rod_files/README.md index 8f3d8e5..2c16b88 100644 --- a/src/download_rod_files/README.md +++ b/src/download_rod_files/README.md @@ -14,7 +14,7 @@ Take a look [here](https://solsa.crystallography.net/rod/1000679.html), to get v ## Exectutute the script -`./download_rods_script.sh` +`./src/download_rod_files/download_rods_script.sh` ## Convert the downloaded .rod files diff --git a/src/download_rod_files/convert_all_rod_to_nxs.sh b/src/download_rod_files/convert_all_rod_to_nxs.sh index ac2c41a..faad0c6 100755 --- a/src/download_rod_files/convert_all_rod_to_nxs.sh +++ b/src/download_rod_files/convert_all_rod_to_nxs.sh @@ -1,7 +1,7 @@ #!/bin/bash # Define the folder containing the .rod files -folder_path="./src/download_rod_files" +folder_path="." # Loop over all .rod files in the folder for file in "$folder_path"/*.rod; do diff --git a/src/download_rod_files/download_rods_script.sh b/src/download_rod_files/download_rods_script.sh index 939b45f..fb9557e 100755 --- a/src/download_rod_files/download_rods_script.sh +++ b/src/download_rod_files/download_rods_script.sh @@ -1,6 +1,6 @@ #!/bin/bash #for X in {1..3}; do -for X in {1000004..1000005}; do +for X in {1000001..1000003}; do download_rod_file "$X" done \ No newline at end of file From 99f7d696010b2d632ccbb09a511a75a7a0cc7c52 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Fri, 13 Dec 2024 11:29:10 +0100 Subject: [PATCH 06/18] add source for list of .rod IDs --- .gitignore | 1 + src/download_rod_files/README.md | 4 +- src/download_rod_files/ROD-numbers.txt | 1133 ++++++++++++++++++++++++ 3 files changed, 1136 insertions(+), 2 deletions(-) create mode 100644 src/download_rod_files/ROD-numbers.txt diff --git a/.gitignore b/.gitignore index 58f23fa..ce3e0dd 100644 --- a/.gitignore +++ b/.gitignore @@ -199,6 +199,7 @@ cython_debug/ .pyenv *.pyc *.txt +!src/download_rod_files/ROD-numbers.txt !tests/data/witec/*.txt !examples/witec/txt/*.txt !requirements.txt diff --git a/src/download_rod_files/README.md b/src/download_rod_files/README.md index 2c16b88..45ae20a 100644 --- a/src/download_rod_files/README.md +++ b/src/download_rod_files/README.md @@ -6,8 +6,8 @@ Adjust the file `download_rods_script.sh`to the range of download you want. Default start is `1` and default end is `3`. Be careful: Do not trigger unneccsary amounts of downloads. -Take a look [here](https://solsa.crystallography.net/rod/1000679.html), to get valid .rod IDs. For this example its e.g. `1000679`. - +Take a look [here](https://solsa.crystallography.net/rod/result), to get valid .rod IDs. +The list of .rod IDs can be accessed [here](https://solsa.crystallography.net/rod/result.php?format=lst&CODSESSION=ooqj2idj19cgpe30275okg42df). ## Add the command as script `chmod +x download_rods_script.sh` diff --git a/src/download_rod_files/ROD-numbers.txt b/src/download_rod_files/ROD-numbers.txt new file mode 100644 index 0000000..ea5cab0 --- /dev/null +++ b/src/download_rod_files/ROD-numbers.txt @@ -0,0 +1,1133 @@ +1000000 +1000001 +1000002 +1000003 +1000004 +1000005 +1000006 +1000007 +1000008 +1000009 +1000010 +1000011 +1000012 +1000013 +1000014 +1000015 +1000016 +1000017 +1000018 +1000019 +1000020 +1000021 +1000022 +1000023 +1000024 +1000025 +1000026 +1000027 +1000028 +1000029 +1000030 +1000031 +1000032 +1000033 +1000034 +1000035 +1000036 +1000037 +1000038 +1000039 +1000040 +1000041 +1000042 +1000043 +1000044 +1000045 +1000046 +1000047 +1000048 +1000049 +1000050 +1000051 +1000052 +1000053 +1000054 +1000055 +1000056 +1000057 +1000058 +1000059 +1000060 +1000061 +1000062 +1000063 +1000064 +1000065 +1000066 +1000067 +1000068 +1000069 +1000070 +1000071 +1000072 +1000073 +1000074 +1000075 +1000076 +1000077 +1000078 +1000079 +1000080 +1000081 +1000082 +1000083 +1000084 +1000085 +1000086 +1000087 +1000088 +1000089 +1000090 +1000091 +1000092 +1000093 +1000094 +1000095 +1000096 +1000097 +1000098 +1000099 +1000100 +1000101 +1000102 +1000103 +1000104 +1000105 +1000106 +1000107 +1000108 +1000109 +1000110 +1000111 +1000112 +1000113 +1000114 +1000115 +1000116 +1000117 +1000118 +1000119 +1000120 +1000121 +1000122 +1000123 +1000124 +1000125 +1000126 +1000127 +1000128 +1000129 +1000130 +1000131 +1000132 +1000133 +1000134 +1000135 +1000136 +1000137 +1000138 +1000139 +1000140 +1000141 +1000142 +1000143 +1000144 +1000145 +1000146 +1000147 +1000148 +1000149 +1000150 +1000151 +1000152 +1000153 +1000154 +1000155 +1000156 +1000157 +1000158 +1000159 +1000160 +1000161 +1000162 +1000163 +1000164 +1000165 +1000166 +1000167 +1000168 +1000169 +1000170 +1000171 +1000172 +1000173 +1000174 +1000175 +1000176 +1000177 +1000178 +1000179 +1000180 +1000181 +1000182 +1000183 +1000184 +1000185 +1000186 +1000187 +1000188 +1000189 +1000190 +1000191 +1000192 +1000193 +1000194 +1000195 +1000196 +1000197 +1000198 +1000199 +1000200 +1000201 +1000202 +1000203 +1000204 +1000205 +1000206 +1000207 +1000208 +1000209 +1000210 +1000211 +1000212 +1000213 +1000214 +1000215 +1000216 +1000217 +1000218 +1000219 +1000220 +1000221 +1000222 +1000223 +1000224 +1000225 +1000226 +1000227 +1000228 +1000229 +1000230 +1000231 +1000232 +1000233 +1000234 +1000235 +1000236 +1000237 +1000238 +1000239 +1000240 +1000241 +1000242 +1000243 +1000244 +1000245 +1000246 +1000247 +1000248 +1000249 +1000250 +1000251 +1000252 +1000253 +1000254 +1000255 +1000256 +1000257 +1000258 +1000259 +1000260 +1000261 +1000262 +1000263 +1000264 +1000265 +1000266 +1000267 +1000268 +1000269 +1000270 +1000271 +1000272 +1000273 +1000274 +1000275 +1000276 +1000277 +1000278 +1000279 +1000280 +1000281 +1000282 +1000283 +1000284 +1000285 +1000286 +1000287 +1000288 +1000289 +1000290 +1000291 +1000292 +1000293 +1000294 +1000295 +1000296 +1000297 +1000298 +1000299 +1000300 +1000301 +1000302 +1000303 +1000304 +1000305 +1000306 +1000307 +1000308 +1000309 +1000310 +1000311 +1000312 +1000313 +1000314 +1000315 +1000316 +1000317 +1000318 +1000319 +1000320 +1000321 +1000322 +1000323 +1000324 +1000325 +1000326 +1000327 +1000328 +1000329 +1000330 +1000331 +1000332 +1000333 +1000334 +1000335 +1000336 +1000337 +1000338 +1000339 +1000340 +1000341 +1000342 +1000343 +1000344 +1000345 +1000346 +1000347 +1000348 +1000349 +1000350 +1000351 +1000352 +1000353 +1000354 +1000355 +1000356 +1000357 +1000358 +1000359 +1000360 +1000361 +1000362 +1000363 +1000364 +1000365 +1000366 +1000367 +1000368 +1000369 +1000370 +1000371 +1000372 +1000373 +1000374 +1000375 +1000376 +1000377 +1000378 +1000379 +1000380 +1000381 +1000382 +1000383 +1000384 +1000385 +1000386 +1000387 +1000388 +1000389 +1000390 +1000391 +1000392 +1000393 +1000394 +1000395 +1000396 +1000397 +1000398 +1000399 +1000400 +1000401 +1000402 +1000403 +1000404 +1000405 +1000406 +1000407 +1000408 +1000409 +1000410 +1000411 +1000412 +1000413 +1000414 +1000415 +1000416 +1000417 +1000418 +1000419 +1000420 +1000421 +1000422 +1000423 +1000424 +1000425 +1000426 +1000427 +1000428 +1000429 +1000430 +1000431 +1000432 +1000433 +1000434 +1000435 +1000436 +1000437 +1000438 +1000439 +1000440 +1000441 +1000442 +1000443 +1000444 +1000445 +1000446 +1000447 +1000448 +1000449 +1000450 +1000451 +1000452 +1000453 +1000454 +1000455 +1000456 +1000457 +1000458 +1000459 +1000460 +1000461 +1000462 +1000463 +1000464 +1000465 +1000466 +1000467 +1000468 +1000469 +1000470 +1000471 +1000472 +1000473 +1000474 +1000475 +1000476 +1000477 +1000478 +1000479 +1000480 +1000481 +1000482 +1000483 +1000484 +1000485 +1000486 +1000487 +1000488 +1000489 +1000490 +1000491 +1000492 +1000493 +1000494 +1000495 +1000496 +1000497 +1000498 +1000499 +1000500 +1000501 +1000502 +1000503 +1000504 +1000505 +1000506 +1000507 +1000508 +1000509 +1000510 +1000511 +1000512 +1000513 +1000514 +1000515 +1000516 +1000517 +1000518 +1000519 +1000520 +1000521 +1000522 +1000523 +1000524 +1000525 +1000526 +1000527 +1000528 +1000529 +1000530 +1000531 +1000532 +1000533 +1000534 +1000535 +1000536 +1000537 +1000538 +1000539 +1000540 +1000541 +1000542 +1000543 +1000544 +1000545 +1000546 +1000547 +1000548 +1000549 +1000550 +1000551 +1000552 +1000553 +1000554 +1000555 +1000556 +1000557 +1000558 +1000559 +1000560 +1000561 +1000562 +1000563 +1000564 +1000565 +1000566 +1000567 +1000568 +1000569 +1000570 +1000571 +1000572 +1000573 +1000574 +1000575 +1000576 +1000577 +1000578 +1000579 +1000580 +1000581 +1000582 +1000583 +1000584 +1000585 +1000586 +1000587 +1000588 +1000589 +1000590 +1000591 +1000592 +1000593 +1000594 +1000595 +1000596 +1000597 +1000598 +1000599 +1000600 +1000601 +1000602 +1000603 +1000604 +1000605 +1000606 +1000607 +1000608 +1000609 +1000610 +1000611 +1000612 +1000613 +1000614 +1000615 +1000616 +1000617 +1000618 +1000619 +1000620 +1000621 +1000622 +1000623 +1000624 +1000625 +1000626 +1000627 +1000628 +1000629 +1000630 +1000631 +1000632 +1000633 +1000634 +1000635 +1000636 +1000637 +1000638 +1000639 +1000640 +1000641 +1000642 +1000643 +1000644 +1000645 +1000646 +1000647 +1000648 +1000649 +1000650 +1000651 +1000652 +1000653 +1000654 +1000655 +1000656 +1000657 +1000658 +1000659 +1000660 +1000661 +1000662 +1000663 +1000664 +1000665 +1000666 +1000667 +1000668 +1000669 +1000670 +1000671 +1000672 +1000673 +1000674 +1000675 +1000676 +1000677 +1000678 +1000679 +2000000 +2000001 +2000002 +2000003 +2000004 +2000005 +2000006 +2100000 +2100001 +2100002 +2100003 +2100004 +2100005 +2100006 +2100007 +2100008 +2100009 +2100010 +2100011 +2100012 +2100013 +2100014 +2100015 +2100016 +2100017 +2100018 +2100019 +2100020 +2100021 +2100022 +2100023 +2100024 +2100025 +2100026 +2100027 +2100028 +2100029 +2100030 +2100031 +2100032 +2100033 +2100034 +2100035 +2100036 +2100037 +2100038 +2100039 +2100040 +2100041 +2100042 +2100043 +2100044 +2100045 +2100046 +2100047 +2100048 +2100049 +2100050 +2100051 +2100052 +2100053 +2100054 +2100055 +2100056 +2100057 +2100058 +2100059 +2100060 +2100061 +2200000 +2200001 +2200002 +2200003 +2200004 +2200005 +2200006 +2200007 +2200008 +2200009 +2200010 +2300000 +2300001 +2300002 +2300003 +2300004 +2300005 +2300006 +2300007 +2310000 +2310001 +2310002 +2310003 +2310004 +2310005 +2310006 +2310007 +2310008 +2310009 +2310010 +2310011 +2310012 +3500000 +3500001 +3500002 +3500003 +3500004 +3500005 +3500006 +3500007 +3500008 +3500009 +3500010 +3500011 +3500012 +3500013 +3500014 +3500015 +3500016 +3500017 +3500018 +3500019 +3500020 +3500021 +3500022 +3500023 +3500024 +3500025 +3500026 +3500027 +3500028 +3500029 +3500030 +3500031 +3500032 +3500033 +3500034 +3500035 +3500036 +3500037 +3500038 +3500039 +3500040 +3500041 +3500042 +3500043 +3500044 +3500045 +3500046 +3500047 +3500048 +3500049 +3500050 +3500051 +3500052 +3500053 +3500054 +3500055 +3500056 +3500057 +3500058 +3500059 +3500060 +3500061 +3500062 +3500063 +3500064 +3500065 +3500066 +3500067 +3500068 +3500069 +3500070 +3500071 +3500072 +3500073 +3500074 +3500075 +3500076 +3500077 +3500078 +3500079 +3500080 +3500081 +3500082 +3500083 +3500084 +3500085 +3500086 +3500087 +3500088 +3500089 +3500090 +3500091 +3500092 +3500093 +3500094 +3500095 +3500096 +3500097 +3500098 +3500099 +3500100 +3500101 +3500102 +3500103 +3500104 +3500105 +3500106 +3500107 +3500108 +3500109 +3500110 +3500111 +3500112 +3500113 +3500114 +3500115 +3500116 +3500117 +3500118 +3500119 +3500120 +3500121 +3500122 +3500123 +3500124 +3500125 +3500126 +3500127 +3500128 +3500129 +3500130 +3500131 +3500132 +3500133 +3500134 +3500135 +3500136 +3500137 +3500138 +3500139 +3500140 +3500141 +3500142 +3500143 +3500144 +3500145 +3500146 +3500147 +3500148 +3500149 +3500150 +3500151 +3500152 +3500153 +3500154 +3500155 +3500156 +3500157 +3500158 +3500159 +3500160 +3500161 +3500162 +3500163 +3500164 +3500165 +3500166 +3500167 +3500168 +3500169 +3500170 +3500171 +3500172 +3500173 +3500174 +3500175 +3500176 +3500177 +3500178 +3500179 +3500180 +3500181 +3500182 +3500183 +3500184 +3500185 +3500186 +3500187 +3500188 +3500189 +3500190 +3500191 +3500192 +3500193 +3500194 +3500195 +3500196 +3500197 +3500198 +3500199 +3500200 +3500201 +3500202 +3500203 +3500204 +3500205 +3500206 +3500207 +3500208 +3500209 +3500210 +3500211 +3500212 +3500213 +3500214 +3500215 +3500216 +3500217 +3500218 +3500219 +3500220 +3500221 +3500222 +3500223 +3500224 +3500225 +3500226 +3500227 +3500228 +3500229 +3500230 +3500231 +3500232 +3500233 +3500234 +3500235 +3500236 +3500237 +3500238 +3500239 +3500240 +3500241 +3500242 +3500243 +3500244 +3500245 +3500246 +3500247 +3500248 +3500249 +3500250 +3500251 +3500252 +3500253 +3500254 +3500255 +3500256 +3500257 +3500258 +3500259 +3500260 +3500261 +3500262 +3500263 +3500264 +3500265 +3500266 +3500267 +3500268 +3500269 +3500270 +3500271 +3500272 +3500273 +3500274 +3500275 +3500276 +3500277 +3500278 +3500279 +3500280 +3500281 +3500282 +3500283 +3500284 +4020000 +4020001 +7200000 +7200001 +7200002 +7200003 +7200004 +7200005 +8100000 +8100001 +8100002 +8100003 +8100004 +8100005 +8100006 +8100007 +8100008 +8100009 +8100010 +8100011 +8100012 +8100013 +8100014 +8100015 +8100016 +8100017 +8100018 +8100019 +8100020 +8100021 +8100022 +8100023 +8100024 +8100025 +8100026 +8100027 +8100028 +8100029 +8100030 +8100031 +8100032 +8100033 +8100034 +8100035 +8100036 +8100037 +8100038 +8100039 +8100040 +8100041 +8100042 +8100043 +8100044 +8100045 +8100046 +8100047 +8100048 +8100049 +8100050 +8100051 +8100052 +8100053 +8100054 +8100055 +8100056 +8100057 +8100058 From 035543632400f4a9bd732312276d6911f6142e42 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Fri, 13 Dec 2024 11:32:51 +0100 Subject: [PATCH 07/18] updates for manual download via command line --- src/download_rod_files/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/download_rod_files/README.md b/src/download_rod_files/README.md index 45ae20a..5efccd2 100644 --- a/src/download_rod_files/README.md +++ b/src/download_rod_files/README.md @@ -1,6 +1,12 @@ # Downloading multiple .rod files -## download_rods_script.sh +## Manually downloading + +You can download a rod file with `ÌD=1000679` via: +`download_rod_file 1000679` + + +## Download_rods_script.sh Adjust the file `download_rods_script.sh`to the range of download you want. Default start is `1` and default end is `3`. From 367c77c7321d9f9b37518da87c1756cf58bac44c Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Tue, 17 Dec 2024 10:46:01 +0100 Subject: [PATCH 08/18] add download all rod files script, removal of single quote from .rod file parser, adjustments for nomad element detection --- .gitignore | 2 +- src/download_rod_files/README.md | 3 +++ .../ROD-numbers_subset_test.txt | 19 +++++++++++++++ .../download_all_rod_files_script.sh | 22 ++++++++++++++++++ .../config/config_file_rod.json | 2 +- src/pynxtools_raman/rod/rod_reader.py | 2 ++ tests/data/rod/example.nxs | Bin 68784 -> 69384 bytes 7 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/download_rod_files/ROD-numbers_subset_test.txt create mode 100755 src/download_rod_files/download_all_rod_files_script.sh diff --git a/.gitignore b/.gitignore index ce3e0dd..1b9ce6d 100644 --- a/.gitignore +++ b/.gitignore @@ -199,7 +199,7 @@ cython_debug/ .pyenv *.pyc *.txt -!src/download_rod_files/ROD-numbers.txt +!src/download_rod_files/*.txt !tests/data/witec/*.txt !examples/witec/txt/*.txt !requirements.txt diff --git a/src/download_rod_files/README.md b/src/download_rod_files/README.md index 5efccd2..57e1afb 100644 --- a/src/download_rod_files/README.md +++ b/src/download_rod_files/README.md @@ -29,6 +29,9 @@ via the pynxtools-raman command: `dataconverter /1000679.rod src/pynxtools_raman/config/config_file_rod.json --reader raman --nxdl NXraman --output rod_example_neuxs.nxs` +## Downloading all .rod files + +Take a look at the file: "download_all_rod_files_script.sh" # Automatec conversion of all .rod files to .nxs files diff --git a/src/download_rod_files/ROD-numbers_subset_test.txt b/src/download_rod_files/ROD-numbers_subset_test.txt new file mode 100644 index 0000000..b5409c7 --- /dev/null +++ b/src/download_rod_files/ROD-numbers_subset_test.txt @@ -0,0 +1,19 @@ +1000000 +1000001 +1000002 +1000003 +1000004 +1000005 +1000006 +1000007 +1000008 +1000009 +1000010 +1000011 +1000012 +1000013 +1000014 +1000015 +1000016 +1000017 +1000018 \ No newline at end of file diff --git a/src/download_rod_files/download_all_rod_files_script.sh b/src/download_rod_files/download_all_rod_files_script.sh new file mode 100755 index 0000000..0683b4c --- /dev/null +++ b/src/download_rod_files/download_all_rod_files_script.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Define your input file +input_file="src/download_rod_files/ROD-numbers_subset_test.txt" +# Change it to this line, to download all .rod files. +#input_file="src/download_rod_files/ROD-numbers.txt" + +# Ask for confirmation before proceeding +read -p "Are you sure you want to proceed with the download? (y/n): " confirmation + +# Check user input +if [[ "$confirmation" != "y" && "$confirmation" != "Y" ]]; then + echo "Operation cancelled." + exit 1 +fi + + +# Read all numbers from the file +while read -r num; do + # Loop over your desired range + download_rod_file "$num" +done < "$input_file" \ No newline at end of file diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index 315223f..9e3c918 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -20,7 +20,7 @@ "/ENTRY[entry]/INSTRUMENT[instrument]/MONOCHROMATOR[monochromator]/grating/period/@units": "lines/mm", "/ENTRY[entry]/SAMPLE[sample]/name":"@data:_chemical_name_mineral", "/ENTRY[entry]/SAMPLE[sample]/physical_form":"@data:_[local]_chemical_compound_state", - "/ENTRY[entry]/SAMPLE[sample]/chemical_formula":"@data:_chemical_formula_structural", + "/ENTRY[entry]/SAMPLE[sample]/chemical_formula":"['@data:_cod_original_formula_sum','@data:_chemical_formula_sum','@data:_chemical_formula_structural']", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[medium]/sample_medium":"@data:_raman_measurement.environment", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/SENSOR[temperature_sensor]/measurement":"temperature", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/SENSOR[temperature_sensor]/value":"@data:_raman_measurement.temperature", diff --git a/src/pynxtools_raman/rod/rod_reader.py b/src/pynxtools_raman/rod/rod_reader.py index eaf9b08..e3333fe 100644 --- a/src/pynxtools_raman/rod/rod_reader.py +++ b/src/pynxtools_raman/rod/rod_reader.py @@ -129,6 +129,8 @@ def get_cif_value_from_key( value = value.replace("\n", " ") return value.lstrip() # remove leading space if it is present if value.count("\n") == 0: + if value[0] == "'": + return value.replace("'", "") return value if is_cif_loop_value: # if block like value via loop_ = [....] output_list = [] diff --git a/tests/data/rod/example.nxs b/tests/data/rod/example.nxs index 9569c15c980d44c360fab33efc7ff9a08b8d1f49..1013402fd4a4493fec37f5bd2fb544ac6eaeb076 100644 GIT binary patch delta 4523 zcmb6cdsI|)`hJ%|?hLQtAu~WSGiuGCJZ5;Ps41xF_y8u*KtlN-1AlKaA>%uJO?Af!IGxzuV z9>4GXeZNc35ySr98xFc;B{4X!Lbgw+_x~(Mxn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x9KDw;kfz9HV zoHY2VZU+;ySMJib2toG5c@Ft1}rd}q->V9Un6t9 zaR84GK5q_RJ1X%UYfjdIfQ!zR?>l87S8M#KCq!XTRTluQKi?b7e9vk8@{N{=*kIk8 zRiNO3)b*scExvF}~kEc0-L&QW38yOJmj`_(tt5oCG< z92>Uaug^7*P}PYU>G(tH0M?zXA_0)&j-t#18mFMy04_nOPGGxh^!<_Ik zYqkp(w486i;1!!_`@l#{*9DnnS}aM|W@K3blSgRAO(lQV-78Vmp8(w*651|GV%yjF zc!vwVW6d>oM~CiXd7 zc2hSGGxJ&c%JA8&>6__z{oAGFm+jn}%j4_WEBLsjWfq#y58QSWFa5LuZJCnTBVpF}bx<5w zA5Z=q8T#HbeL2~c$S;=gZ%lSA6wm=Cj;3S7YbV)I9Q%$QTYlGswYOb*vy7!<*^!UM znxFJnb=@JaYB7g@gfc@9YA^o4GhXr|k6d5~$gNFB>r1zQ9jr~C)#4cMs9fNM2`th11t@!iGy{pEbwX^R0NL3fi+;ZKoOJ#$}La Date: Tue, 17 Dec 2024 13:39:17 +0100 Subject: [PATCH 09/18] add features to parse all .rod files --- .../convert_all_rod_to_nxs.sh | 2 +- .../download_all_rod_files_script.sh | 2 +- src/pynxtools_raman/reader.py | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/download_rod_files/convert_all_rod_to_nxs.sh b/src/download_rod_files/convert_all_rod_to_nxs.sh index faad0c6..53d9630 100755 --- a/src/download_rod_files/convert_all_rod_to_nxs.sh +++ b/src/download_rod_files/convert_all_rod_to_nxs.sh @@ -1,7 +1,7 @@ #!/bin/bash # Define the folder containing the .rod files -folder_path="." +folder_path="." # took about 8min # Loop over all .rod files in the folder for file in "$folder_path"/*.rod; do diff --git a/src/download_rod_files/download_all_rod_files_script.sh b/src/download_rod_files/download_all_rod_files_script.sh index 0683b4c..e19c808 100755 --- a/src/download_rod_files/download_all_rod_files_script.sh +++ b/src/download_rod_files/download_all_rod_files_script.sh @@ -3,7 +3,7 @@ # Define your input file input_file="src/download_rod_files/ROD-numbers_subset_test.txt" # Change it to this line, to download all .rod files. -#input_file="src/download_rod_files/ROD-numbers.txt" +#input_file="src/download_rod_files/ROD-numbers.txt" # took 7 minutes to download all files # Ask for confirmation before proceeding read -p "Are you sure you want to proceed with the download? (y/n): " confirmation diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index d71d854..488d5ed 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -100,9 +100,9 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: # This changes all uppercase string elements to lowercase string elements for the given key, within a given key value pair key_to_make_value_lower_case = "_raman_measurement.environment" - self.raman_data[key_to_make_value_lower_case] = self.raman_data.get( - key_to_make_value_lower_case - ).lower() + environment_name_str = self.raman_data.get(key_to_make_value_lower_case) + if environment_name_str is not None: + self.raman_data[key_to_make_value_lower_case] = environment_name_str.lower() # transform the string into a datetime object time_key = "_raman_measurement.datetime_initiated" @@ -121,13 +121,13 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: # remove capitalization objective_type_key = "_raman_measurement_device.optics_type" - self.raman_data[objective_type_key] = self.raman_data.get( - objective_type_key - ).lower() - # set a valid raman NXDL value, but only if it matches one of the correct ones: - objective_type_list = ["objective", "lens", "glass fiber", "none"] - if self.raman_data.get(objective_type_key) not in objective_type_list: - self.raman_data[objective_type_key] = "other" + objective_type_str = self.raman_data.get(objective_type_key) + if objective_type_str is not None: + self.raman_data[objective_type_key] = objective_type_str.lower() + # set a valid raman NXDL value, but only if it matches one of the correct ones: + objective_type_list = ["objective", "lens", "glass fiber", "none"] + if self.raman_data.get(objective_type_key) not in objective_type_list: + self.raman_data[objective_type_key] = "other" return {} From 4dacf713fb45e3f2367e3a48b748357384a805fc Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Tue, 17 Dec 2024 14:24:36 +0100 Subject: [PATCH 10/18] refinements for lasertype .rod key --- src/pynxtools_raman/config/config_file_rod.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index 9e3c918..5a8a76b 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -10,7 +10,8 @@ "/ENTRY[entry]/INSTRUMENT[instrument]/detector_TYPE[detector_ccd]/count_time/@units": "s", "/ENTRY[entry]/INSTRUMENT[instrument]/detector_TYPE[detector_ccd]/count_time": "@data:_raman_measurement.integration_time", "/ENTRY[entry]/INSTRUMENT[instrument]/detector_TYPE[detector_ccd]/detector_channel_type":"single-channel", - "/ENTRY[entry]/INSTRUMENT[instrument]/SOURCE[source_532nmlaser]/type": "@data:_raman_measurement_device.excitation_laser_type", + "/ENTRY[entry]/INSTRUMENT[instrument]/SOURCE[source_532nmlaser]/type": "Laser", + "/ENTRY[entry]/INSTRUMENT[instrument]/SOURCE[source_532nmlaser]/type_other": "@data:_raman_measurement_device.excitation_laser_type", "/ENTRY[entry]/INSTRUMENT[instrument]/FABRICATION[device_information]/vendor":"@data:_raman_measurement_device.company", "/ENTRY[entry]/INSTRUMENT[instrument]/FABRICATION[device_information]/model": "@data:_raman_measurement_device.model", "/ENTRY[entry]/INSTRUMENT[instrument]/LENS_OPT[objective_lens]/type": "@data:_raman_measurement_device.optics_type", @@ -42,7 +43,6 @@ "/ENTRY[entry]/DATA[data]/x_values_raman/@long_name": "Raman Shift", "/ENTRY[entry]/DATA[data]/x_values_raman": "@data:_raman_spectrum.raman_shift", "/ENTRY[entry]/DATA[data]/x_values_raman/@units": "1/cm", - "/ENTRY[entry]/experiment_identifier/service": "DOI", "/ENTRY[entry]/experiment_identifier/identifier": "@data:_journal_paper_doi", "/ENTRY[entry]/entry_identifier/service": "Raman open databse ID", "/ENTRY[entry]/entry_identifier/identifier": "@data:_rod_database.code" From f462a7cfa23ce542df2f07de3a68aedf276a97cf Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Tue, 17 Dec 2024 14:26:41 +0100 Subject: [PATCH 11/18] reparse example --- tests/data/rod/example.nxs | Bin 69384 -> 69384 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/data/rod/example.nxs b/tests/data/rod/example.nxs index 1013402fd4a4493fec37f5bd2fb544ac6eaeb076..1b0a38c55d27a4ed42c284ae5acf30a976d3189a 100644 GIT binary patch delta 1729 zcmZ8heN0y{+K*pWJt`Ya|MJAI+h_Ykxqxf`Bf(}?rW*MKYGtO_jh}K z=XcJ%?$gok)6pN)6U&PD_QV#=!Kyk}Eyr;gxKF1~%A}V3#j=Gvr#z39|4k{msU2bfzSWisQrhx~ii!ueov%;!Kc>DRKIw$2MSUYF%}8Z`8W-6wEFe z16FLN_}y|ODPP4$scY3MGCz(hz*`hkh#;7t2vY<-JdP)+y$8#LG}x=yPv99LO$rDf z!?wJ_Tx+2vH_MV|wdUk!T5<|4mIGK7Z_xdJN9v1D;EDThk7&eTGQZC`*6&p zkJ|YDCIb=1aM-kixF@8Rh8#wlw_EEgs^d1R}Qz51H zQ?>#Sq%(7I1m`a%YEHaW<9hM+6V)y}d;4jrr2kF8cc0gy-)q(i>^R3?5=9+gr?H%* zr{aC%6^(ml`S=#yT(oB-MgN-e%p$ix|61>|GVfR6+R zPpU^e;ze}ym4l7qiZL*BiP+`5Jy_o700#}0;R7S@5Vv1y z8A%|dcN9OldL**kbLUIxm5@_8mA??i>Ph`rC|&(2v($NSKVZgqk6aZd&(d`@g`Z-D z*hO&-(9*!8aD$JTT%=K|{&rZA#n;$@$z6@t40>(wIy)mwV0nKj9-Q8;S(;`cSsY^i zUOY!BI;QZ+$zxbDWk&xb-w@m|p^4wJBl#+WMCNk&KQbfKV5jOg&arrU2>1I2oa#3Q zS=_GTh87gV)8oN_f!D65#g(a2$dPAEQ$5STlzut{q>tt({h=BB?7L&h&YNs2M8~cA zT{EI+gtnj-G@5Wo)`Pw?9mWc9qhZ!Z{IhBUNcs=TK*=p`SNh|<)u>rgYm#Ntn15!O zcx6yY=Nz`&KB8SOU*Vg__}+=&`-{qVp7H%@17FqenqTJ|4k>(h;nhQxjP0E;+uy=$ zyBXVGDO*)pg>B8<5Zj!_I6^vu*zyNu8*YNacDF1AlD~RT_(CAgKSj~1+$oG-U{g50 zn9vsFp-b{F5P*5SzIcN;?z4g>mvMTn63xrK+Vxkjbw8BSmv;4h1zAeP!=LuaH<#G& zg@|{qhVE_a3iM$2mnl49t>Yz`XjG5`yt(!eI-6|rJZug>lpM4kfM@B;-C?Y3doBt- fN3VA)fOPE{D}0##!iATkp@Kxr{)ORK*vtP1sU+i> delta 1738 zcmZ`(eN0Wdrst5mt?^i+hbx6@g9#mgRzns#sNyoXV#wP0BIC!f z@s(FAIBDMCLrK;Wo2?|jFt6BAkZ&!_wc1Lo)=FqhOxOQ6A`K=c^VqxAC1yf6jeprZ zO;aJ3vEwlXz3X&rV1DNoo^O)|LB}MTL5WF+WE+aTb+Occj zk!^tyg5mSHbj(e_xM?@`PD`J)?~Y01hm{E&r)_#1@EtPaib{4VV#v4T<>-Ge&T5K2Kz45 zpgrp1E;XS!=*3MFngBT{ih2aT%v$WWNEtZ<=S&Tp{>Ci$ZqSrY$@W1U2J;NRE%1oA z)N%(mlyVDpR^TR>Oi$5;rkIFns2!>ySC2GCSem8ICTNwi(Sq2QjIr|u)XaKt@2a9A zG|RV#wwy|ShEB?68jLJ)_H7EZwz` Date: Tue, 17 Dec 2024 15:13:30 +0100 Subject: [PATCH 12/18] add resolution as parsed parameter --- .../config/config_file_rod.json | 3 ++ src/pynxtools_raman/reader.py | 6 ++++ src/pynxtools_raman/rod/rod_reader.py | 28 ++++++++++++++++++ tests/data/rod/example.nxs | Bin 69384 -> 70464 bytes 4 files changed, 37 insertions(+) diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index 5a8a76b..f32d39b 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -19,6 +19,9 @@ "/ENTRY[entry]/INSTRUMENT[instrument]/LENS_OPT[objective_lens]/numerical_aperture": "@data:_raman_measurement_device.microscope_numerical_aperture", "/ENTRY[entry]/INSTRUMENT[instrument]/MONOCHROMATOR[monochromator]/grating/period": "@data:_raman_measurement_device.diffraction_grating", "/ENTRY[entry]/INSTRUMENT[instrument]/MONOCHROMATOR[monochromator]/grating/period/@units": "lines/mm", + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/physical_quantity": "@data", + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/resolution": "@data", + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/resolution/@units": "@data", "/ENTRY[entry]/SAMPLE[sample]/name":"@data:_chemical_name_mineral", "/ENTRY[entry]/SAMPLE[sample]/physical_form":"@data:_[local]_chemical_compound_state", "/ENTRY[entry]/SAMPLE[sample]/chemical_formula":"['@data:_cod_original_formula_sum','@data:_chemical_formula_sum','@data:_chemical_formula_structural']", diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index 488d5ed..d90ed06 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -28,6 +28,7 @@ from pynxtools_raman.rod.rod_reader import RodParser +from pynxtools_raman.rod.rod_reader import post_process_rod from pynxtools_raman.witec.witec_reader import post_process_witec from pynxtools_raman.witec.witec_reader import parse_txt_file @@ -129,6 +130,8 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: if self.raman_data.get(objective_type_key) not in objective_type_list: self.raman_data[objective_type_key] = "other" + self.post_process = post_process_rod.__get__(self, RamanReader) + return {} def handle_txt_file(self, filepath): @@ -205,6 +208,9 @@ def get_data(self, key: str, path: str) -> Any: # this filters out the meta data, which is up to now only created for .rod files + if (path is None or path is "") and key is not None: + return self.raman_data.get(key) + if self.missing_meta_data: # this if condition is required, to only delete keys which are abaialble by the data. # e.g. is defined to extract it via config.json, but there is no value in meta data diff --git a/src/pynxtools_raman/rod/rod_reader.py b/src/pynxtools_raman/rod/rod_reader.py index e3333fe..8233b65 100644 --- a/src/pynxtools_raman/rod/rod_reader.py +++ b/src/pynxtools_raman/rod/rod_reader.py @@ -3,6 +3,7 @@ from pathlib import Path import logging +import numpy as np logger = logging.getLogger("pynxtools") @@ -163,3 +164,30 @@ def extract_keys_and_values_from_cif(self): ) return cif_dict_key_value_pair_dict + + +def post_process_rod(self) -> None: + wavelength_nm = float( + self.raman_data.get("_raman_measurement_device.excitation_laser_wavelength") + ) + resoltion_invers_cm = float( + self.raman_data.get("_raman_measurement_device.resolution") + ) + + if wavelength_nm is not None and resoltion_invers_cm is not None: + # assume the resolution is referd to the resolution at the laser wavelength + wavelength_invers_cm = 1e7 / wavelength_nm + resolution_nm = resoltion_invers_cm / wavelength_invers_cm * wavelength_nm + + # update the data dictionary + self.raman_data[ + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/physical_quantity" + ] = "wavelength" + self.raman_data[ + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/resolution" + ] = resolution_nm + self.raman_data[ + "/ENTRY[entry]/INSTRUMENT[instrument]/RESOLUTION[wavelength_resolution]/resolution/@units" + ] = "nm" + # remove this key from original input data + del self.missing_meta_data["_raman_measurement_device.resolution"] diff --git a/tests/data/rod/example.nxs b/tests/data/rod/example.nxs index 1b0a38c55d27a4ed42c284ae5acf30a976d3189a..b1905353b19d2f811fafd81a88e177ac935f55a5 100644 GIT binary patch delta 3901 zcmZ`+dsLLi760z=`gU2C1s}VBVHeP_z7TwaRTr!ZDhT*OUP64WtpdK<=+S`5A0>aZ zhxH!M5>IV0r?mup@bNW-powc0gVxx^s7EE9uBN8MmUi*PN3596_suN3@tiE2xsUnH zojZ5#otdxxcfqb>!3|bo8{wFcN9-@9y)Q{ng%+gN0YFQvh&3UGke&z-1ZS=u7GO_^ z4hpgCb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zt!n|a1s&uQwLazo|Jr*ew`&cHzkXSLc5BQF79C>Pm`xx`Aj6BG8Jj;Rgc=p*m zrQ^rRjcRxpL)G{u-mAj8@p4#!m&S9Z(_m}m8))*mB;6NFq;qZ5M9#I(dHXZAHzhou zs0S{I)wM5Eu@6p05?%i4lgA(_M7K)+3y)*)HV2%5Y2x3rzXXBIHqY Date: Wed, 18 Dec 2024 13:01:14 +0100 Subject: [PATCH 13/18] extend rod file parsing with unit cell parameters --- .../config/config_file_rod.json | 17 ++++++-- src/pynxtools_raman/reader.py | 40 ++++++++++++++++++ tests/data/rod/example.nxs | Bin 70464 -> 70736 bytes 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index f32d39b..6e23900 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -29,21 +29,32 @@ "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/SENSOR[temperature_sensor]/measurement":"temperature", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/SENSOR[temperature_sensor]/value":"@data:_raman_measurement.temperature", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/SENSOR[temperature_sensor]/value/@units":"K", + "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_temperature]/description":"@data:_raman_measurement.environment_details", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_pressure]/SENSOR[sensor]/measurement":"pressure", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_pressure]/SENSOR[sensor]/value":"@data:_raman_measurement.pressure", "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_pressure]/SENSOR[sensor]/value/@units":"kPa", + "/ENTRY[entry]/SAMPLE[sample]/ENVIRONMENT[env_pressure]/description":"@data:_raman_measurement.environment_details", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_abc":"@data:rod_unit_cell_length_abc", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_abc/@units":"angstrom", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_alphabetagamma":"@data:rod_unit_cell_angles_alphabetagamma", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_alphabetagamma/@units":"degree", + "/ENTRY[entry]/SAMPLE[sample]/density":"@data:_exptl_crystal_density_diffrn", + "/ENTRY[entry]/SAMPLE[sample]/density/@units":"g/cm³", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_volume":"@data:_cell_volume", + "/ENTRY[entry]/SAMPLE[sample]/unit_cell_volume/@units":"angstrom^3", + "/ENTRY[entry]/SAMPLE[sample]/space_group":"@data:_space_group_IT_number", "/ENTRY[entry]/definition/@url": "Remove_this_if_pynxtools_issue_#469_is_solved", "/ENTRY[entry]/experiment_type": "Raman spectroscopy", "/ENTRY[entry]/raman_experiment_type": "other", - "/ENTRY[entry]/title": "@data:_cod_original_formula_sum", + "/ENTRY[entry]/title": "['@data:_cod_original_formula_sum','@data:_chemical_formula_sum','@data:_chemical_formula_structural','@data:_chemical_name_mineral','@data:_chemical_name_systematic']", "/ENTRY[entry]/start_time": "@data:_raman_measurement.datetime_initiated", "/ENTRY[entry]/@default": "data", "/ENTRY[entry]/DATA[data]/@signal": "y_values", "/ENTRY[entry]/DATA[data]/y_values": "@data:_raman_spectrum.intensity", "/ENTRY[entry]/DATA[data]/y_values/@units": "arb. units", - "/ENTRY[entry]/DATA[data]/y_values/@long_name": "Intensity", + "/ENTRY[entry]/DATA[data]/y_values/@long_name": "Intensity [arb.u.]", "/ENTRY[entry]/DATA[data]/@axes":"x_values_raman", - "/ENTRY[entry]/DATA[data]/x_values_raman/@long_name": "Raman Shift", + "/ENTRY[entry]/DATA[data]/x_values_raman/@long_name": "Raman Shift [1/cm]", "/ENTRY[entry]/DATA[data]/x_values_raman": "@data:_raman_spectrum.raman_shift", "/ENTRY[entry]/DATA[data]/x_values_raman/@units": "1/cm", "/ENTRY[entry]/experiment_identifier/identifier": "@data:_journal_paper_doi", diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index d90ed06..b38a0b8 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -22,6 +22,7 @@ from typing import Dict, Any from pathlib import Path from typing import Any, Dict, List, Tuple # Optional, Union, Set +import re from pynxtools.dataconverter.readers.multi.reader import MultiFormatReader from pynxtools.dataconverter.readers.utils import parse_yml @@ -91,6 +92,14 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: # get the key and value pairs from the rod file self.raman_data = rod.extract_keys_and_values_from_cif() + if self.raman_data.get("_raman_theoretical_spectrum.intensity"): + logger.warning( + f"Theoretical Raman Data .rod file found. File parsing aborted." + ) + # prevent file parsing to setting an invalid config file name. + self.config_file = "" + + # unit_cell_alphabetagamma # replace the [ and ] to avoid confliucts in processing with pynxtools NXclass assignments self.raman_data = { key.replace("_[local]_", "_local_"): value @@ -99,6 +108,37 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: self.missing_meta_data = copy.deepcopy(self.raman_data) + if self.raman_data.get("_cell_length_a") is not None or "": + # transform 9.40(3) to 9.40 + length_a = re.sub(r"\(\d+\)", "", self.raman_data.get("_cell_length_a")) + length_b = re.sub(r"\(\d+\)", "", self.raman_data.get("_cell_length_b")) + length_c = re.sub(r"\(\d+\)", "", self.raman_data.get("_cell_length_c")) + self.raman_data["rod_unit_cell_length_abc"] = [ + float(length_a), + float(length_b), + float(length_c), + ] + del self.missing_meta_data["_cell_length_a"] + del self.missing_meta_data["_cell_length_b"] + del self.missing_meta_data["_cell_length_c"] + if self.raman_data.get("_cell_angle_alpha") is not None or "": + # transform 9.40(3) to 9.40 + angle_alpha = re.sub( + r"\(\d+\)", "", self.raman_data.get("_cell_angle_alpha") + ) + angle_beta = re.sub(r"\(\d+\)", "", self.raman_data.get("_cell_angle_beta")) + angle_gamma = re.sub( + r"\(\d+\)", "", self.raman_data.get("_cell_angle_gamma") + ) + self.raman_data["rod_unit_cell_angles_alphabetagamma"] = [ + float(angle_alpha), + float(angle_beta), + float(angle_gamma), + ] + del self.missing_meta_data["_cell_angle_alpha"] + del self.missing_meta_data["_cell_angle_beta"] + del self.missing_meta_data["_cell_angle_gamma"] + # This changes all uppercase string elements to lowercase string elements for the given key, within a given key value pair key_to_make_value_lower_case = "_raman_measurement.environment" environment_name_str = self.raman_data.get(key_to_make_value_lower_case) diff --git a/tests/data/rod/example.nxs b/tests/data/rod/example.nxs index b1905353b19d2f811fafd81a88e177ac935f55a5..9fcde00708b0a467d4744cd136625e990fcbbcc4 100644 GIT binary patch delta 3826 zcmb7HYfw~27VdLLa2`DF@R}JAW~CCefCl3JD44{Y)gH`^wnHZRqAj-R&*(HX zRyQ?mXsn)rZKe$LM^|CHDII1hGi=#hSI2wbI>k3aW@D;ohdG!_+qviyE$|{9q4Yd_ zPjo_#O6TGgO3z1w*$E3&3>M;Ia|XPm%(X4z7PZsxxI8mlGYH8;$!vjq>^Coi#b}Gk zu)WMRHH50`n;SP$*(>Oaac*70M;*M+bZ5?(=EoZP>8lzyRC?8YS?dF{VU)44b@G>SQKlSRKiEq zn5A^Fug+KRD5+gn)9fhsWV}{a$rMWQH?j8I<*}kUGV1D9;FVa5&C5px-q)>Q#7Z>BS)feOfpW}^v)C%QhIY=sETmygze;?A zYOYdGV>Mokn+H{Bi+=%HBZ_7%w;8!VjWFCrLY$OclY8oGG7(UWT5I#V&orB+HBLwFmd z)nMe~iIi813+Iz4KR-l&9Hk>e_+&~eD{1yqDQO7d(%$^*Dp_s&m{!tppIVGRIEGG*4*$5mN~Nfny!Ety2S;Q zSHRcYT}a80WywpjFaGy}+z|h7*qd$zVK@d8CzU}8jk+Ym$v-GF38@XVnV?Nhocz0J zA#1aIaMr6v@XF?eX=CK_`~o@&BUoM=CFu^JSn>z98pLGZU?#3pY-DRoSwKjrI;WieYwP)eo?MB{LwL!Y%(9VB>rfn5q-1RU6G4Qn_` zh05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BqIs?zlYO!?5LJ>9%Xree3xZk7f*D@-NLu% z>nej$G51&m(DbAGk=`ERa10?8BIcZ^*7|wu^oe4aPGdO@PAL*SnA5#S^Hb{;^}S|5 zUr!m~5;5;&DXhWd8aq}svzx^!kJyWfnaFm=YRy+{Dk?@K5 z;lYcf^c=O=(-8tZIsU2a6{;MJ_~QIJ{P^SsJZ?7e7ZvBY(A{a{FDZyl5P}KT-{Ohw zf*ARE3}`39Ci|!TWGEzww=YG3?ELnNs`Gt+lDF|Dt*1|^Sp{DOUtzw7e8u;=J|l7V zGhpk01)B$Wvf~T4a9;8geQg}M zPmj{S0Y_#^JC4OumtHA_3i*g*S16s9cl(!$5k_&_DOx#~uj7ep)mpy_P(z*~o8ZDT z57*)3FE+?$YrUb`p=-8?zKc14>0kHa=G=8ya<7}Z(5UeaGatHJteVl=3X&xV=TdDL?<-XliE9bz+L=qt-E;ZnG^A1<^M6%iP~8!q^K zfoT6OB|zF&YZdZZ(b z22nM%rO-2Zii4r&WT6Ih;HeJ*+Dv)+43is&QGa}w;;%t=(X@JYhJbZnmnMnjts2#d zJXSvFPyp8%A}e!-0`IYeg2m$sg~OiHTIiAYjtqky>dccP;cymUrRRVS)qrB4Lx~!$=4vzCzFQNGOH^Pkt0+(wqPNpk-nH UFP+tRE`F+qp9ISTH&L_x12S8T0RR91 From 8928af151daf6f5fe5755a403f6195bcf691526b Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Wed, 18 Dec 2024 13:23:21 +0100 Subject: [PATCH 14/18] fix linting --- src/pynxtools_raman/reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index b38a0b8..8492737 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -97,7 +97,7 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: f"Theoretical Raman Data .rod file found. File parsing aborted." ) # prevent file parsing to setting an invalid config file name. - self.config_file = "" + self.config_file = Path() # unit_cell_alphabetagamma # replace the [ and ] to avoid confliucts in processing with pynxtools NXclass assignments From ee0b6898fafb498595196b4f791c5a9bdfe02aa0 Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Thu, 19 Dec 2024 12:36:45 +0100 Subject: [PATCH 15/18] add COD ID to sample from ROD --- src/download_rod_files/analyse_rod_db.py | 36 +++ .../rod_keys_statistics_sorted.txt | 206 ++++++++++++++++++ .../config/config_file_rod.json | 2 + src/pynxtools_raman/reader.py | 4 + 4 files changed, 248 insertions(+) create mode 100644 src/download_rod_files/analyse_rod_db.py create mode 100644 src/download_rod_files/rod_keys_statistics_sorted.txt diff --git a/src/download_rod_files/analyse_rod_db.py b/src/download_rod_files/analyse_rod_db.py new file mode 100644 index 0000000..af78d62 --- /dev/null +++ b/src/download_rod_files/analyse_rod_db.py @@ -0,0 +1,36 @@ +import os +from pynxtools_raman.rod.rod_reader import RodParser + + +# Path to the folder +rod_dir = "pynxtools-raman/src/download_rod_files/rod_statistics" + + +print(os.listdir()) + +# Get a list of .nxs files in the folder +nxs_files = [file for file in os.listdir(rod_dir) if file.endswith(".rod")] + +# Initialize a counter for keys +key_counts = {} + + +for nxs_file in nxs_files: + rod = RodParser() + # read the rod file + rod.get_cif_file_content(rod_dir + "/" + nxs_file) + # get the key and value pairs from the rod file + dict = rod.extract_keys_and_values_from_cif() + + # Iterate through all dictionaries + for key in dict.keys(): + key_counts[key] = key_counts.get(key, 0) + 1 + +output_file = "rod_statistics.txt" + +# Write to the file +with open(output_file, "w") as file: + for key, value in key_counts.items(): + file.write(f"{key}\t{value}\n") # \t for tab spacing + +print(f"Data successfully written to {output_file}") diff --git a/src/download_rod_files/rod_keys_statistics_sorted.txt b/src/download_rod_files/rod_keys_statistics_sorted.txt new file mode 100644 index 0000000..0cf2108 --- /dev/null +++ b/src/download_rod_files/rod_keys_statistics_sorted.txt @@ -0,0 +1,206 @@ +_publ_author_name 1133 +_publ_section_title 1133 +_journal_year 1133 +_rod_database.code 1133 +_journal_name_full 1133 +_chemical_formula_sum 1133 +_rod_data_source.block 1132 +_rod_data_source.file 1132 +_raman_spectrum.intensity 1131 +_raman_measurement.integration_time 1131 +_raman_measurement.baseline_correction_details 1131 +_raman_spectrum.raman_shift 1131 +_raman_measurement.baseline_correction 1131 +_raman_measurement.background_subtraction_details 1131 +_raman_measurement.background_subtraction 1131 +_raman_measurement.pressure 1131 +_raman_measurement.temperature 1131 +_raman_measurement.environment_details 1131 +_raman_measurement.environment 1131 +_raman_measurement_device.spot_size 1131 +_raman_measurement_device.direction_polarization 1131 +_raman_measurement_device.power_on_sample 1131 +_raman_measurement_device.resolution 1131 +_raman_measurement_device.configuration 1131 +_raman_measurement_device.excitation_laser_wavelength 1131 +_raman_measurement_device.excitation_laser_type 1131 +_raman_measurement_device.company 1131 +_raman_measurement_device.microscope_objective_magnification 1130 +_chemical_compound_source 1130 +_raman_measurement_device.microscope_numerical_aperture 1130 +_raman_measurement_device_calibration.standard 1130 +_raman_measurement_device.microscope_system 1130 +_raman_measurement_device.location 1129 +_raman_determination_method 1124 +_raman_measurement_device_calibration.id 1116 +_raman_complementary.method 1116 +_raman_complementary.id 1116 +_raman_measurement_device.diffraction_grating 1115 +_raman_measurement_device.model 1115 +_raman_measurement_device.optics_type 1110 +_rod_related_entry.id 1108 +_rod_related_entry.code 1108 +_rod_related_entry.database 1108 +_rod_related_entry.uri 1108 +_rod_related_entry.description 1108 +_cell_length_c 1107 +_cell_angle_gamma 1107 +_cell_angle_beta 1107 +_cell_angle_alpha 1107 +_cell_length_b 1107 +_cell_length_a 1107 +_space_group_IT_number 1086 +_symmetry_space_group_name_H-M 1073 +_chemical_name_mineral 1071 +_symmetry_space_group_name_Hall 1053 +_cell_volume 850 +_journal_page_first 848 +_journal_volume 848 +_journal_page_last 843 +_cod_database_code 797 +_cod_original_formula_sum 768 +_exptl_crystal_density_diffrn 744 +_journal_paper_doi 389 +_chemical_formula_structural 358 +_chemical_name_systematic 339 +_[local]_chemical_compound_state 325 +_[local]_chemical_compound_color 325 +_cell_formula_units_Z 319 +_raman_measurement.datetime_initiated 303 +_raman_measurement.range_max 197 +_raman_measurement.range_min 197 +_solsa_sample.id 156 +_symmetry_cell_setting 149 +_cod_original_sg_symbol_H-M 138 +_rod_maintainer_comment.text 73 +_rod_maintainer_comment.date 73 +_rod_maintainer_comment.id 73 +_rod_maintainer_comment.author 73 +_cod_original_cell_volume 69 +_journal_issue 51 +_diffrn_ambient_temperature 45 +_space_group_name_H-M_alt 30 +_space_group_crystal_system 28 +_space_group_name_Hall 28 +_cod_data_source_file 23 +_cod_data_source_block 23 +_chemical_formula_weight 22 +_chemical_name_common 22 +_chemical_formula_moiety 19 +_raman_spectrum.raw_intensity 16 +_raman_measurement_device_calibration.standard_details 14 +_journal_coden_ASTM 14 +_[local]_database_code_rod 13 +_cell_measurement_temperature 13 +_raman_prediction.mode_count 12 +_raman_prediction.method 12 +_journal_coeditor_code 12 +_citation_journal_id_ASTM 12 +_raman_prediction.active_bands 12 +_raman_prediction.id 12 +_audit_creation_method 10 +_chemical_formula_iupac 10 +_cell_measurement_reflns_used 9 +_cell_measurement_theta_min 9 +_cell_measurement_theta_max 9 +_raman_determination.method 9 +_symmetry_Int_Tables_number 8 +_atom_sites_solution_secondary 7 +_cod_related_entry 7 +_atom_sites_solution_primary 7 +_atom_sites_solution_hydrogens 7 +_computing_cell_refinement 7 +_computing_data_collection 7 +_computing_data_reduction 7 +_diffrn_reflns_limit_k_min 6 +_diffrn_reflns_limit_l_max 6 +_diffrn_reflns_limit_l_min 6 +_diffrn_reflns_number 6 +_diffrn_reflns_theta_full 6 +_diffrn_reflns_theta_max 6 +_diffrn_reflns_theta_min 6 +_diffrn_measured_fraction_theta_full 6 +_diffrn_measured_fraction_theta_max 6 +_diffrn_measurement_device_type 6 +_diffrn_measurement_method 6 +_diffrn_radiation_type 6 +_diffrn_radiation_wavelength 6 +_diffrn_reflns_av_R_equivalents 6 +_diffrn_reflns_limit_h_max 6 +_diffrn_reflns_limit_h_min 6 +_diffrn_reflns_limit_k_max 6 +_computing_structure_solution 6 +_computing_structure_refinement 6 +_exptl_crystal_size_min 5 +_exptl_absorpt_coefficient_mu 5 +_computing_publication_material 5 +_computing_molecular_graphics 5 +_exptl_absorpt_correction_T_max 5 +_exptl_absorpt_correction_T_min 5 +_exptl_absorpt_correction_type 5 +_diffrn_radiation_monochromator 5 +_exptl_absorpt_process_details 5 +_exptl_crystal_density_method 5 +_exptl_crystal_description 5 +_diffrn_reflns_av_sigmaI/netI 5 +_exptl_crystal_F_000 5 +_exptl_crystal_size_max 5 +_exptl_crystal_size_mid 5 +_diffrn_ambient_pressure 4 +_refine_diff_density_min 4 +_refine_ls_R_factor_all 4 +_refine_diff_density_max 4 +_refine_ls_weighting_scheme 3 +_reflns_number_total 3 +_reflns_threshold_expression 3 +_refine_ls_weighting_details 3 +_refine_ls_shift/su_mean 3 +_refine_ls_shift/su_max 3 +_refine_ls_R_factor_gt 3 +_refine_ls_wR_factor_gt 3 +_refine_ls_restrained_S_all 3 +_refine_ls_number_restraints 3 +_refine_ls_number_reflns 3 +_refine_ls_number_parameters 3 +_refine_ls_matrix_type 3 +_refine_ls_hydrogen_treatment 3 +_reflns_number_gt 3 +_refine_ls_goodness_of_fit_ref 3 +_refine_ls_structure_factor_coef 3 +_space_group_symop_operation_xyz 3 +_refine_ls_extinction_method 3 +_refine_ls_extinction_coef 3 +_space_group_symop_id 3 +_refine_ls_wR_factor_ref 3 +_dft_atom_basisset 2 +_tcod_model 2 +_dft_XC_exchange_functional_name 2 +_raman_theoretical_model.temperature 2 +_raman_theoretical_model.pressure 2 +_raman_theoretical_model.excitation_laser_wavelength 2 +_citation.id 2 +_citation.doi 2 +_raman_theoretical_mode.shift 2 +_raman_theoretical_mode.symmetry 2 +_raman_theoretical_mode.intensity 2 +_raman_theoretical_spectrum.raman_shift 2 +_raman_theoretical_spectrum.intensity 2 +_dft_cell_magn_spin_moment 2 +_dft_BZ_integration_method 2 +_dft_BZ_integration_grid_Z 2 +_dft_BZ_integration_grid_Y 2 +_dft_BZ_integration_grid_X 2 +_dft_atom_basisset_citation_id 2 +_audit_update_record 2 +_refine_ls_R_Fsqd_factor 2 +_tcod_software_package 2 +_tcod_structure_type 2 +_diffrn_reflns_av_unetI/netI 1 +_diffrn_reflns_Laue_measured_fraction_full 1 +_diffrn_reflns_point_group_measured_fraction_max 1 +_diffrn_reflns_point_group_measured_fraction_full 1 +_diffrn_reflns_Laue_measured_fraction_max 1 +_audit_creation_date 1 +_solsa_sample_id 1 +_diffrn_detector_area_resol_mean 1 +_exptl_crystal_density_meas 1 \ No newline at end of file diff --git a/src/pynxtools_raman/config/config_file_rod.json b/src/pynxtools_raman/config/config_file_rod.json index 6e23900..2285d62 100644 --- a/src/pynxtools_raman/config/config_file_rod.json +++ b/src/pynxtools_raman/config/config_file_rod.json @@ -43,6 +43,8 @@ "/ENTRY[entry]/SAMPLE[sample]/unit_cell_volume":"@data:_cell_volume", "/ENTRY[entry]/SAMPLE[sample]/unit_cell_volume/@units":"angstrom^3", "/ENTRY[entry]/SAMPLE[sample]/space_group":"@data:_space_group_IT_number", + "/ENTRY[entry]/SAMPLE[sample]/identifier/service":"@data:COD_service_name", + "/ENTRY[entry]/SAMPLE[sample]/identifier/identifier":"@data:_cod_database_code", "/ENTRY[entry]/definition/@url": "Remove_this_if_pynxtools_issue_#469_is_solved", "/ENTRY[entry]/experiment_type": "Raman spectroscopy", "/ENTRY[entry]/raman_experiment_type": "other", diff --git a/src/pynxtools_raman/reader.py b/src/pynxtools_raman/reader.py index 8492737..3cf8f4c 100644 --- a/src/pynxtools_raman/reader.py +++ b/src/pynxtools_raman/reader.py @@ -108,6 +108,10 @@ def handle_rod_file(self, filepath) -> Dict[str, Any]: self.missing_meta_data = copy.deepcopy(self.raman_data) + if self.raman_data.get("_cod_database_code") is not None or "": + self.raman_data["COD_service_name"] = "Crystallography Open Database" + del self.missing_meta_data["_cod_database_code"] + if self.raman_data.get("_cell_length_a") is not None or "": # transform 9.40(3) to 9.40 length_a = re.sub(r"\(\d+\)", "", self.raman_data.get("_cell_length_a")) From 098ac205ebbd82d80c747ce9d4a713382f67401f Mon Sep 17 00:00:00 2001 From: Ron Hildebrandt Date: Thu, 19 Dec 2024 13:38:04 +0100 Subject: [PATCH 16/18] add entrypoint for nomad and Raman app --- pyproject.toml | 3 + src/pynxtools_raman/nomad/__init__.py | 163 ++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 src/pynxtools_raman/nomad/__init__.py diff --git a/pyproject.toml b/pyproject.toml index e126104..a041ed9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,9 @@ dependencies = [ [project.entry-points."pynxtools.reader"] raman = "pynxtools_raman.reader:RamanReader" +[project.entry-points.'nomad.plugin'] +#raman_example = "pynxtools_raman.nomad:raman_example" +raman_app = "pynxtools_raman.nomad:raman_app" [project.scripts] download_rod_file = "pynxtools_raman.rod.rod_get_file:trigger_rod_download" diff --git a/src/pynxtools_raman/nomad/__init__.py b/src/pynxtools_raman/nomad/__init__.py new file mode 100644 index 0000000..3453b8a --- /dev/null +++ b/src/pynxtools_raman/nomad/__init__.py @@ -0,0 +1,163 @@ +try: + from nomad.config.models.plugins import ( + AppEntryPoint, + ) +except ImportError as exc: + raise ImportError( + "Could not import nomad package. Please install the package 'nomad-lab'." + ) from exc + +from nomad.config.models.ui import ( + App, + Column, + Menu, + MenuItemHistogram, + MenuItemPeriodicTable, + MenuItemTerms, + SearchQuantities, +) + +schema = "pynxtools.nomad.schema.NeXus" + +raman_app = AppEntryPoint( + name="RamanApp", + description="Simple Raman app.", + app=App( + # Label of the App + label="Raman", + # Path used in the URL, must be unique + path="ramanapp", + # Used to categorize apps in the explore menu + category="Experiment", + # Brief description used in the app menu + description="A simple search app customized for Raman data.", + # Longer description that can also use markdown + readme="This is a simple App to support basic search for Raman based Experiment Entries.", + # If you want to use quantities from a custom schema, you need to load + # the search quantities from it first here. Note that you can use a glob + # syntax to load the entire package, or just a single schema from a + # package. + search_quantities=SearchQuantities( + include=[f"*#{schema}"], + # include=[f"data.Raman.*#{schema}"], + ), + # Controls which columns are shown in the results table + columns=[ + Column(quantity="entry_id", selected=True), + # Column(quantity=f"entry_type", selected=True), + # Column( + # title="definition", + # quantity=f"data.*.ENTRY[*].definition__field#{schema}", + # selected=True, + # ), + Column( + title="start_time", + quantity=f"data.*.ENTRY[*].start_time__field#{schema}", + selected=True, + ), + Column( + title="title", + quantity=f"data.*.ENTRY[*].title__field#{schema}", + selected=True, + ), + Column( + title="scattering_config", + quantity=f"data.*.ENTRY[*].INSTRUMENT[*].scattering_configuration__field#{schema}", + selected=True, + ), + Column( + title="unit_cell_volume", + quantity=f"data.*.ENTRY[*].SAMPLE[*].unit_cell_volume__field#{schema}", + selected=True, + ), + # Only 311 of 1131 ROD entries have this field... + # Column( + # title="physical_form", + # quantity=f"data.*.ENTRY[*].SAMPLE[*].physical_form__field#{schema}", + # selected=True, + # ), + # add this: + # exfitation wavelength --> need deeper search for quantities in nexus + ], + # Dictionary of search filters that are always enabled for queries made + # within this app. This is especially important to narrow down the + # results to the wanted subset. Any available search filter can be + # targeted here. This example makes sure that only entries that use + # MySchema are included. + filters_locked={"section_defs.definition_qualified_name": [schema]}, + # Controls the menu shown on the left + menu=Menu( + title="Material", + items=[ + Menu( + title="elements", + items=[ + MenuItemPeriodicTable( + quantity="results.material.elements", + ), + MenuItemTerms( + quantity="results.material.chemical_formula_hill", + width=6, + options=0, + ), + MenuItemTerms( + quantity="results.material.chemical_formula_iupac", + width=6, + options=0, + ), + MenuItemHistogram( + x="results.material.n_elements", + ), + ], + ) + ], + ), + # Controls the default dashboard shown in the search interface + dashboard={ + "widgets": [ + { + "type": "histogram", + "show_input": False, + "autorange": True, + "nbins": 30, + "scale": "linear", + "quantity": f"data.Root.datetime#{schema}", + "title": "Procesing Time", + "layout": { + "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 0, "x": 0} + }, + }, + { + "type": "terms", + "show_input": False, + "scale": "linear", + "quantity": f"entry_type", + "title": "Entry Type", + "layout": { + "lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 12} + }, + }, + { + "type": "periodic_table", + "scale": "linear", + "quantity": f"results.material.elements", + "layout": { + "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 4, "x": 0} + }, + }, + { + "type": "histogram", + "show_input": False, + "autorange": True, + "nbins": 30, + "scale": "linear", + "quantity": f"data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#{schema}", # data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#pynxtools.nomad.schema.NeXus + "title": "Unit Cell Volume", + "layout": { + "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 8, "x": 0} + }, + }, + ] + }, + ), +) From a11c3901b1dc91c3b76282d288bae0b2e0a48d5c Mon Sep 17 00:00:00 2001 From: sanbrock Date: Wed, 8 Jan 2025 23:21:17 +0100 Subject: [PATCH 17/18] added some Raman filters --- src/pynxtools_raman/nomad/__init__.py | 31 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/pynxtools_raman/nomad/__init__.py b/src/pynxtools_raman/nomad/__init__.py index 3453b8a..e290104 100644 --- a/src/pynxtools_raman/nomad/__init__.py +++ b/src/pynxtools_raman/nomad/__init__.py @@ -1,7 +1,5 @@ try: - from nomad.config.models.plugins import ( - AppEntryPoint, - ) + from nomad.config.models.plugins import AppEntryPoint except ImportError as exc: raise ImportError( "Could not import nomad package. Please install the package 'nomad-lab'." @@ -84,7 +82,8 @@ # results to the wanted subset. Any available search filter can be # targeted here. This example makes sure that only entries that use # MySchema are included. - filters_locked={"section_defs.definition_qualified_name": [schema]}, + # filters_locked={"section_defs.definition_qualified_name": [schema]}, + filters_locked={f"data.Raman.ENTRY.definition__field#{schema}": ["NXraman"]}, # Controls the menu shown on the left menu=Menu( title="Material", @@ -121,8 +120,8 @@ "autorange": True, "nbins": 30, "scale": "linear", - "quantity": f"data.Root.datetime#{schema}", - "title": "Procesing Time", + "quantity": f"data.Raman.ENTRY.start_time__field#{schema}", + "title": "Start Time", "layout": { "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 0, "x": 0} }, @@ -131,10 +130,20 @@ "type": "terms", "show_input": False, "scale": "linear", - "quantity": f"entry_type", - "title": "Entry Type", + "quantity": f"data.Raman.ENTRY.INSTRUMENT.scattering_configuration__field#{schema}", + "title": "Scattering Config", "layout": { - "lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 12} + "lg": {"minH": 3, "minW": 3, "h": 4, "w": 4, "y": 0, "x": 12} + }, + }, + { + "type": "terms", + "show_input": False, + "scale": "linear", + "quantity": f"data.Raman.ENTRY.raman_experiment_type__field#{schema}", + "title": "Raman Type", + "layout": { + "lg": {"minH": 3, "minW": 3, "h": 4, "w": 8, "y": 0, "x": 16} }, }, { @@ -142,7 +151,7 @@ "scale": "linear", "quantity": f"results.material.elements", "layout": { - "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 4, "x": 0} + "lg": {"minH": 3, "minW": 3, "h": 6, "w": 12, "y": 4, "x": 0} }, }, { @@ -154,7 +163,7 @@ "quantity": f"data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#{schema}", # data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#pynxtools.nomad.schema.NeXus "title": "Unit Cell Volume", "layout": { - "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 8, "x": 0} + "lg": {"minH": 3, "minW": 3, "h": 6, "w": 12, "y": 4, "x": 12} }, }, ] From 3849c832b7ba360ed5b2601873f8fd83ff55ac25 Mon Sep 17 00:00:00 2001 From: sanbrock Date: Fri, 10 Jan 2025 22:34:43 +0100 Subject: [PATCH 18/18] use pynxtools.nomad.schema.Root --- src/pynxtools_raman/nomad/__init__.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pynxtools_raman/nomad/__init__.py b/src/pynxtools_raman/nomad/__init__.py index e290104..bfc4914 100644 --- a/src/pynxtools_raman/nomad/__init__.py +++ b/src/pynxtools_raman/nomad/__init__.py @@ -15,7 +15,7 @@ SearchQuantities, ) -schema = "pynxtools.nomad.schema.NeXus" +schema = "pynxtools.nomad.schema.Root" raman_app = AppEntryPoint( name="RamanApp", @@ -50,22 +50,22 @@ # ), Column( title="start_time", - quantity=f"data.*.ENTRY[*].start_time__field#{schema}", + quantity=f"data.ENTRY[*].start_time__field#{schema}", selected=True, ), Column( title="title", - quantity=f"data.*.ENTRY[*].title__field#{schema}", + quantity=f"data.ENTRY[*].title__field#{schema}", selected=True, ), Column( title="scattering_config", - quantity=f"data.*.ENTRY[*].INSTRUMENT[*].scattering_configuration__field#{schema}", + quantity=f"data.ENTRY[*].INSTRUMENT[*].scattering_configuration__field#{schema}#str", selected=True, ), Column( title="unit_cell_volume", - quantity=f"data.*.ENTRY[*].SAMPLE[*].unit_cell_volume__field#{schema}", + quantity=f"data.ENTRY[*].SAMPLE[*].unit_cell_volume__field#{schema}", selected=True, ), # Only 311 of 1131 ROD entries have this field... @@ -83,7 +83,7 @@ # targeted here. This example makes sure that only entries that use # MySchema are included. # filters_locked={"section_defs.definition_qualified_name": [schema]}, - filters_locked={f"data.Raman.ENTRY.definition__field#{schema}": ["NXraman"]}, + filters_locked={f"data.ENTRY.definition__field#{schema}": ["NXraman"]}, # Controls the menu shown on the left menu=Menu( title="Material", @@ -120,7 +120,7 @@ "autorange": True, "nbins": 30, "scale": "linear", - "quantity": f"data.Raman.ENTRY.start_time__field#{schema}", + "quantity": f"data.ENTRY.start_time__field#{schema}", "title": "Start Time", "layout": { "lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 0, "x": 0} @@ -130,7 +130,7 @@ "type": "terms", "show_input": False, "scale": "linear", - "quantity": f"data.Raman.ENTRY.INSTRUMENT.scattering_configuration__field#{schema}", + "quantity": f"data.ENTRY.INSTRUMENT.scattering_configuration__field#{schema}#str", "title": "Scattering Config", "layout": { "lg": {"minH": 3, "minW": 3, "h": 4, "w": 4, "y": 0, "x": 12} @@ -140,7 +140,7 @@ "type": "terms", "show_input": False, "scale": "linear", - "quantity": f"data.Raman.ENTRY.raman_experiment_type__field#{schema}", + "quantity": f"data.ENTRY.raman_experiment_type__field#{schema}#str", "title": "Raman Type", "layout": { "lg": {"minH": 3, "minW": 3, "h": 4, "w": 8, "y": 0, "x": 16} @@ -160,7 +160,7 @@ "autorange": True, "nbins": 30, "scale": "linear", - "quantity": f"data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#{schema}", # data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#pynxtools.nomad.schema.NeXus + "quantity": f"data.ENTRY.SAMPLE.unit_cell_volume__field#{schema}", # data.Raman.ENTRY.SAMPLE.unit_cell_volume__field#pynxtools.nomad.schema.NeXus "title": "Unit Cell Volume", "layout": { "lg": {"minH": 3, "minW": 3, "h": 6, "w": 12, "y": 4, "x": 12}