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
10 changes: 5 additions & 5 deletions .github/workflows/python-tests-consolidated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Setup and install Ard
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
needs: setup-install
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
needs: test-unit
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions ard/api/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def set_up_system_recursive(
# Add subsystems directly from the input dictionary
if hasattr(parent_group, "name") and (parent_group.name != ""):
print(
f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name} to {parent_group.name}."
f"{''.join(' ' * 4 * _depth)}Adding {system_name} to {parent_group.name}."
)
else:
print(f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name}.")
print(f"{''.join(' ' * 4 * _depth)}Adding {system_name}.")
if "systems" in input_dict: # Recursively add nested subsystems]
if _depth > 0:
group = parent_group.add_subsystem(
Expand All @@ -188,7 +188,8 @@ def set_up_system_recursive(
_depth=_depth + 1,
)
if "approx_totals" in input_dict:
print(f"\tActivating approximate totals on {system_name}")
prefix = "\t"
print(prefix + f"Activating approximate totals on {system_name}")
group.approx_totals(**input_dict["approx_totals"])

else:
Expand Down
12 changes: 9 additions & 3 deletions ard/collection/optiwindnet_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _own_L_from_inputs(inputs: dict, discrete_inputs: dict) -> nx.Graph:
)
if np.any(repeat_accumulate > 0): # only if there are any repeats
warn_string = (
f"\nDetected {np.sum(repeat_accumulate > 0)} coincident "
f"Detected {np.sum(repeat_accumulate > 0)} coincident "
f"turbines and/or substations in optiwindnet setup."
) # start a warning string for the UserWarning
# TODO: make Ard warnings?
Expand All @@ -57,11 +57,17 @@ def _own_L_from_inputs(inputs: dict, discrete_inputs: dict) -> nx.Graph:
for idx, dxy in enumerate(adjustments[:T, :]):
if np.sum(dxy != 0) == 0:
continue
warn_string += f"\n\tadjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}"
warn_string += (
"\n\t"
+ f"adjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}"
)
for idx, dxy in enumerate((adjustments[-R:, :])[::-1, :]):
if np.sum(dxy != 0) == 0:
continue
warn_string += f"\n\tadjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}"
warn_string += (
"\n\t"
+ f"adjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}"
)
# output the final warning
warn(warn_string)

Expand Down
3 changes: 2 additions & 1 deletion ard/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def wrapper(*args, **kwargs):
output = sys.stdout.getvalue()
sys.stdout = old_stdout

tabset = "".join(["\t" for t in range(tabs)])
prefix = "\t"
tabset = "".join([prefix for t in range(tabs)])
if output:
for line in output.splitlines():
print(f"{tabset}{line}")
Expand Down
6 changes: 4 additions & 2 deletions ard/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ def pyrite_validator(

if not validation_matches:
print(f"for variable {k}:", file=sys.stderr)
prefix = "\t"
print(
f"\t{sum_isclose} values match of {vd_size} total validation values",
prefix
+ f"{sum_isclose} values match of {vd_size} total validation values",
file=sys.stderr,
)
print(f"\tto a tolerance of {rtol_val:e}", file=sys.stderr)
print(prefix + f"to a tolerance of {rtol_val:e}", file=sys.stderr)
print(f"pyrite data for {k}: {v}", file=sys.stderr)
print(
f"computed data for {k}: {data_for_validation[k]}", file=sys.stderr
Expand Down
6 changes: 4 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path


Expand All @@ -6,9 +7,10 @@ def pytest_sessionfinish(session, exitstatus):

# for each tempdir
for pytest_out_dir in Path().glob("pytest*_out"):
for root, dirs, files in pytest_out_dir.walk(
top_down=False
for root, dirs, files in os.walk(
pytest_out_dir, topdown=False
): # walk the directory
root = Path(root)
for name in files:
(root / name).unlink() # remove subdirectory files, and
for name in dirs:
Expand Down
Loading