Fixed a few import dependencies after relocating this file.

This commit is contained in:
2024-08-23 10:57:13 +02:00
parent a0f44a1f4b
commit 15b76f7704

View File

@ -1,11 +1,14 @@
import sys
import os import os
root_dir = os.path.abspath(os.curdir)
sys.path.append(root_dir)
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import collections import collections
from igor2.binarywave import load as loadibw from igor2.binarywave import load as loadibw
import src.g5505_utils as utils import utils.g5505_utils as utils
#import src.metadata_review_lib as metadata #import src.metadata_review_lib as metadata
#from src.metadata_review_lib import parse_attribute #from src.metadata_review_lib import parse_attribute
@ -126,8 +129,9 @@ def read_txt_files_as_dict(filename: str, instruments_dir: str = None, work_with
# If instruments_dir is not provided, use the default path relative to the module directory # If instruments_dir is not provided, use the default path relative to the module directory
if not instruments_dir: if not instruments_dir:
# Assuming the instruments folder is one level up from the source module directory # Assuming the instruments folder is one level up from the source module directory
module_dir = os.path.dirname(__file__) #module_dir = os.path.dirname(__file__)
instruments_dir = os.path.join(module_dir, '..', 'instruments') #instruments_dir = os.path.join(module_dir, '..', 'instruments')
instruments_dir = os.path.join(root_dir,'instruments')
# Normalize the path (resolves any '..' in the path) # Normalize the path (resolves any '..' in the path)
instrument_configs_path = os.path.abspath(os.path.join(instruments_dir,'text_data_sources.yaml')) instrument_configs_path = os.path.abspath(os.path.join(instruments_dir,'text_data_sources.yaml'))