From d65a1a4e64a3996d305ea476126b1e9808e23e6b Mon Sep 17 00:00:00 2001 From: Veronika Juraskova Date: Thu, 27 Jun 2024 14:57:21 +0100 Subject: [PATCH] Minor changes --- ...ommit-config.py => .pre-commit-config.yaml | 8 ++-- test_string_to_function.py | 44 ------------------- 2 files changed, 3 insertions(+), 49 deletions(-) rename .pre-commit-config.py => .pre-commit-config.yaml (73%) delete mode 100644 test_string_to_function.py diff --git a/.pre-commit-config.py b/.pre-commit-config.yaml similarity index 73% rename from .pre-commit-config.py rename to .pre-commit-config.yaml index df3428a..35a94a5 100644 --- a/.pre-commit-config.py +++ b/.pre-commit-config.yaml @@ -8,15 +8,13 @@ - id: no-commit-to-branch - id: check-executables-have-shebangs - id: check-shebang-scripts-are-executable - - id: check-added-large-files - args: ['--maxkb=500', '--enforce-all'] - id: check-yaml - id: check-toml - - repo: https://github.com/astral-sh/ruff-pre-commit + # - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.2.1 - hooks: + #rev: v0.2.1 + #hooks: # - id: ruff # args: [--show-source, --fix] # - id: ruff-format diff --git a/test_string_to_function.py b/test_string_to_function.py deleted file mode 100644 index 619b597..0000000 --- a/test_string_to_function.py +++ /dev/null @@ -1,44 +0,0 @@ -import numpy as np - - -expression = 'a + b / (variable1_range/10000.0) + c * np.log10(variable2_range/10000)' - -# Fixed values for a, b, c -coefficients = {'a': 1, 'b': 4, 'c': 7} - -# Specify the variable names that should vary -variable_names = ['variable1', 'variable2'] # These names should match usage in expression - -# Create a function that varies with specified variables -specific_function = generate_specific_function(expression, coefficients, variable_names) - -# Example usage with arrays for each variable -variable1_values = np.array([10000, 20000, 30000]) # Example values for variable1 -variable2_values = np.array([10000, 20000, 30000]) # Example values for variable2 - -# Compute the result using the custom specific function -result = specific_function(variable1_values, variable2_values) -print(result) - #[5.0 5.107209969647869 5.67318211637097] - -expression = 'a + b / (variable1/10000.0) + c * np.log10(variable2/10000)' - -# Extract variables -coef_names = extract_coef_names(expression) -print(coef_names) -coef_values = [1,2,3] -print(coef_values) -#X['a', 'b', 'c'] -create_coef_dict(coef_names,coef_values ) -# Answer should be {'a': 1, 'b': 2, 'c': 3} - -expression = 'a + b / (variable1_range/10000.0) + c * np.log10(variable2_range/10000)' - -# Extract variables ending with '_range' (default suffix) -range_variables = extract_variables_names(expression) -print(range_variables) -#['variable1_range', 'variable2_range'] - - -create_coef_dict (coef_names, coef_values) -#{'a': 1, 'b': 2, 'c': 3} \ No newline at end of file