Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[bumpversion]
current_version = 0.5.1
current_version = 0.5.2
files = pyproject.toml aurora/__init__.py
2 changes: 1 addition & 1 deletion aurora/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.5.1"
__version__ = "0.5.2"

import sys
from loguru import logger
Expand Down
51 changes: 20 additions & 31 deletions aurora/general_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
init_file = inspect.getfile(aurora)
AURORA_PATH = Path(init_file).parent.parent
DATA_PATH = AURORA_PATH.joinpath("data")
DOCS_PATH = AURORA_PATH.joinpath("docs")
TEST_PATH = AURORA_PATH.joinpath("tests")
CONFIG_PATH = AURORA_PATH.joinpath("aurora", "config")
BAND_SETUP_PATH = CONFIG_PATH.joinpath("emtf_band_setup")
Expand Down Expand Up @@ -101,37 +102,25 @@ def execute_subprocess(cmd, **kwargs):
return


# TODO: Add test for execute_command or delete.
# def execute_command(cmd, **kwargs):
# """
# Executes command in terminal from script.
#
# Parameters:
# ----------
# cmd : str
# command to execute from a terminal
# kwargs: exec_dir (str): the directory from which to execute
# kwargs: no_exception: suppress output if exception
#
# Other Parameters:
# exit_status: :code:`0` is good, otherwise there is some problem
#
# .. note:: When executing :code:`rm *` this crashes if the directory we are removing
# from is empty
#
# .. note:: if you can you should probably use execute_subprocess() instead
# """
# exec_dir = kwargs.get("exec_dir", os.path.expanduser("~/"))
# allow_exception = kwargs.get("allow_exception", True)
# logger.info("executing from {}".format(exec_dir))
# cwd = os.getcwd()
# os.chdir(exec_dir)
# exit_status = os.system(cmd)
# if exit_status != 0:
# logger.info(f"exit_status of {cmd} = {exit_status}")
# if allow_exception:
# raise Exception(f"Failed to successfully execute \n {cmd}")
# os.chdir(cwd)
def replace_in_file(file_path: pathlib.Path, old: str, new: str) -> None:
"""
Replace all instances of 'old' with 'new' in the given file.
:param file_path: Path to the file where replacements should be made.

"""
if not file_path.exists():
logger.warning(f"File not found: {file_path}")
return

with open(file_path, "r", encoding="utf-8") as f:
lines: list[str] = f.readlines()

updated: list[str] = [line.replace(old, new) for line in lines]

with open(file_path, "w", encoding="utf-8") as f:
f.writelines(updated)

logger.info(f"Updated: {file_path}")


def save_to_mat(data, variable_name, filename):
Expand Down
3 changes: 0 additions & 3 deletions aurora/test_utils/synthetic/processing_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def tf_obj_from_synthetic_data(
return tf_cls


# TODO: Move this to test_utils/synthetic/
def process_synthetic_1(
config_keyword: Optional[str] = "test1",
z_file_path: Optional[Union[str, pathlib.Path]] = "",
Expand Down Expand Up @@ -182,7 +181,6 @@ def process_synthetic_1(
)
return tf_result

# TODO: Move this to test_utils/synthetic/
def process_synthetic_2(
force_make_mth5: Optional[bool] = True,
z_file_path: Optional[Union[str, pathlib.Path, None]] = None,
Expand Down Expand Up @@ -219,7 +217,6 @@ def process_synthetic_2(
)
return tfc

# TODO: Move this to test_utils/synthetic/
def process_synthetic_1r2(
config_keyword="test1r2",
channel_nomenclature="default",
Expand Down
Loading
Loading