Skip to content

Commit 77fcc19

Browse files
authored
Merge pull request #294 from CCPBioSim/27-orientational-entropy
Introduce Basic Orientational Entropy Calculations
2 parents 5d6697a + 9b462c5 commit 77fcc19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2120
-919
lines changed

.github/workflows/daily.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
python -m pip install -e .[testing]
3636
3737
- name: Pytest (unit) • ${{ matrix.os }} • py${{ matrix.python-version }}
38-
run: python -m pytest tests/unit -q
38+
run: python -m pytest tests/unit

.github/workflows/pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
python -m pip install -e .[testing]
3434
3535
- name: Pytest (unit) • ${{ matrix.os }}, ${{ matrix.python-version }}
36-
run: python -m pytest tests/unit -q
36+
run: python -m pytest tests/unit
3737

3838
regression-quick:
3939
name: Regression (quick)
@@ -62,7 +62,7 @@ jobs:
6262
python -m pip install -e .[testing]
6363
6464
- name: Pytest (regression quick)
65-
run: python -m pytest tests/regression -q
65+
run: python -m pytest tests/regression
6666

6767
- name: Upload artifacts (failure)
6868
if: failure()

.github/workflows/weekly-regression.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
regression:
1414
name: Regression tests (including slow)
1515
runs-on: ubuntu-24.04
16-
timeout-minutes: 180
1716
steps:
1817
- name: Checkout repo
1918
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
@@ -36,7 +35,7 @@ jobs:
3635
pip install -e .[testing]
3736
3837
- name: Run regression test suite
39-
run: pytest tests/regression -q --run-slow
38+
run: pytest tests/regression --run-slow
4039

4140
- name: Upload regression artifacts on failure
4241
if: failure()

CodeEntropy/config/argparse.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import logging
2626
import os
2727
from dataclasses import dataclass
28-
from typing import Any, Dict, Optional, Set
28+
from typing import Any
2929

3030
import yaml
3131

@@ -48,11 +48,11 @@ class ArgSpec:
4848
help: str
4949
default: Any = None
5050
type: Any = None
51-
action: Optional[str] = None
52-
nargs: Optional[str] = None
51+
action: str | None = None
52+
nargs: str | None = None
5353

5454

55-
ARG_SPECS: Dict[str, ArgSpec] = {
55+
ARG_SPECS: dict[str, ArgSpec] = {
5656
"top_traj_file": ArgSpec(
5757
type=str,
5858
nargs="+",
@@ -145,6 +145,12 @@ class ArgSpec:
145145
default=True,
146146
help="Use bonded axes to rotate forces for UA level vibrational entropies",
147147
),
148+
"search_type": ArgSpec(
149+
type=str,
150+
default="RAD",
151+
help="Type of neighbor search to use."
152+
"Default RAD; grid search is also available",
153+
),
148154
}
149155

150156

@@ -159,7 +165,7 @@ class ConfigResolver:
159165
- validating trajectory-related numeric parameters
160166
"""
161167

162-
def __init__(self, arg_specs: Optional[Dict[str, ArgSpec]] = None) -> None:
168+
def __init__(self, arg_specs: dict[str, ArgSpec] | None = None) -> None:
163169
"""Initialize the manager.
164170
165171
Args:
@@ -168,7 +174,7 @@ def __init__(self, arg_specs: Optional[Dict[str, ArgSpec]] = None) -> None:
168174
"""
169175
self._arg_specs = dict(arg_specs or ARG_SPECS)
170176

171-
def load_config(self, directory_path: str) -> Dict[str, Any]:
177+
def load_config(self, directory_path: str) -> dict[str, Any]:
172178
"""Load the first YAML config file found in a directory.
173179
174180
The current behavior matches your existing workflow:
@@ -188,7 +194,7 @@ def load_config(self, directory_path: str) -> Dict[str, Any]:
188194

189195
config_path = yaml_files[0]
190196
try:
191-
with open(config_path, "r", encoding="utf-8") as file:
197+
with open(config_path, encoding="utf-8") as file:
192198
config = yaml.safe_load(file) or {"run1": {}}
193199
logger.info("Loaded configuration from: %s", config_path)
194200
return config
@@ -253,7 +259,7 @@ def build_parser(self) -> argparse.ArgumentParser:
253259
)
254260
continue
255261

256-
kwargs: Dict[str, Any] = {}
262+
kwargs: dict[str, Any] = {}
257263
if spec.type is not None:
258264
kwargs["type"] = spec.type
259265
if spec.default is not None:
@@ -266,7 +272,7 @@ def build_parser(self) -> argparse.ArgumentParser:
266272
return parser
267273

268274
def resolve(
269-
self, args: argparse.Namespace, run_config: Optional[Dict[str, Any]]
275+
self, args: argparse.Namespace, run_config: dict[str, Any] | None
270276
) -> argparse.Namespace:
271277
"""Merge CLI arguments with YAML configuration and adjust logging level.
272278
@@ -306,8 +312,8 @@ def resolve(
306312

307313
@staticmethod
308314
def _detect_cli_overrides(
309-
args_dict: Dict[str, Any], default_dict: Dict[str, Any]
310-
) -> Set[str]:
315+
args_dict: dict[str, Any], default_dict: dict[str, Any]
316+
) -> set[str]:
311317
"""Detect which args were explicitly overridden in the CLI.
312318
313319
Args:
@@ -322,8 +328,8 @@ def _detect_cli_overrides(
322328
def _apply_yaml_defaults(
323329
self,
324330
args: argparse.Namespace,
325-
run_config: Dict[str, Any],
326-
cli_provided: Set[str],
331+
run_config: dict[str, Any],
332+
cli_provided: set[str],
327333
) -> None:
328334
"""Apply YAML values onto args for keys not provided by CLI.
329335
@@ -336,7 +342,7 @@ def _apply_yaml_defaults(
336342
if yaml_value is None or key in cli_provided:
337343
continue
338344
if key in self._arg_specs:
339-
logger.debug("Using YAML value for %s: %s", key, yaml_value)
345+
logger.debug(f"Using YAML value for {key}: {yaml_value}")
340346
setattr(args, key, yaml_value)
341347

342348
def _ensure_defaults(self, args: argparse.Namespace) -> None:

CodeEntropy/config/runtime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import logging
1919
import os
2020
import pickle
21-
from typing import Any, Dict, Optional
21+
from typing import Any
2222

2323
import MDAnalysis as mda
2424
import requests
@@ -112,7 +112,7 @@ def create_job_folder() -> str:
112112

113113
return new_folder_path
114114

115-
def load_citation_data(self) -> Optional[Dict[str, Any]]:
115+
def load_citation_data(self) -> dict[str, Any] | None:
116116
"""Load CITATION.cff from GitHub.
117117
118118
If the request fails (offline, blocked, etc.), returns None.
@@ -335,7 +335,7 @@ def _build_universe(
335335
kcal_units = args.kcal_force_units
336336

337337
if forcefile is None:
338-
logger.debug("Loading Universe with %s and %s", tprfile, trrfile)
338+
logger.debug(f"Loading Universe with {tprfile} and {trrfile}")
339339
return mda.Universe(tprfile, trrfile, format=fileformat)
340340

341341
return universe_operations.merge_forces(

CodeEntropy/core/logging.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import logging
1818
import os
19-
from typing import Dict, Optional
2019

2120
from rich.console import Console
2221
from rich.logging import RichHandler
@@ -55,7 +54,7 @@ class LoggingConfig:
5554
handlers: Mapping of handler name to handler instance.
5655
"""
5756

58-
_console: Optional[Console] = None
57+
_console: Console | None = None
5958

6059
@classmethod
6160
def get_console(cls) -> Console:
@@ -80,7 +79,7 @@ def __init__(self, folder: str, level: int = logging.INFO) -> None:
8079

8180
self.level = level
8281
self.console = self.get_console()
83-
self.handlers: Dict[str, logging.Handler] = {}
82+
self.handlers: dict[str, logging.Handler] = {}
8483

8584
self._setup_handlers()
8685

0 commit comments

Comments
 (0)