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 {}