Skip to content

Commit d4255e7

Browse files
authored
Merge branch 'master' into pr-427
2 parents 723f3f8 + 1362661 commit d4255e7

Some content is hidden

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

46 files changed

+238
-160
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
shell: bash -el {0}
102102
run: |
103103
pip install ruff
104-
ruff check cobaya/ tests/ --output-format=github
104+
ruff check cobaya/ --output-format=github
105105
106106
- name: Install dependencies (pip)
107107
if: matrix.pydist != 'ANACONDA'
@@ -171,8 +171,10 @@ jobs:
171171
steps:
172172
- name: Check test results
173173
run: |
174-
if [[ "${{ needs.tests.result }}" == "success" ]]; then
175-
echo "All tests passed!"
174+
result="${{ needs.tests.result }}"
175+
echo "tests job result: $result"
176+
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
177+
echo "Tests succeeded or were skipped."
176178
exit 0
177179
else
178180
echo "Some tests failed or were cancelled"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ coverage.xml
4545
**/chains/
4646
my*
4747
scratch/
48+
*docker*
4849

4950
# IDE-specific
5051
.idea/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Added standardized formatting with ruff (removing flake8)
77
- Added pre-commit hooks for automated code quality checks (trailing whitespace, end-of-file-fixer, pyupgrade, ruff)
88
- Documentation can now be built as markdown for LLM context. Flat context file provided.
9+
- Periodic sampled parameters implemented (for now fully supported by MCMC only), as well as tagging of derived parameters as periodic for analysis with GetDist.
910

1011
### Cosmology
1112

DEVEL.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Development flow for contributors
2020

2121
1. Fork and clone the repo from github.
2222
2. From its folder, install in editable mode: ``pip install -e .``
23-
3. Install development dependencies: ``pip install ruff pre-commit pytest pytest-xdist pytest-cov flaky dill``
23+
3. Install development dependencies: ``pip install -e .[devel]``
2424
4. Set up pre-commit hooks: ``pre-commit install``
2525
5. Modify stuff.
2626
6. Test with pytest
27-
7. Make a pull requests and check (about about 15 minutes) if the tests have passed.
27+
7. Make a pull requests and check (about 15 minutes) if the tests have passed.
2828
8. Iterate until tests pass, then wait for or request feedback/merge
2929

3030
Contributors must agree to the license (see ``LICENCE.txt`` in the root folder).

LICENCE.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@ The documentation of this program is released under the GNU Free
1313
Documentation License (see below)
1414

1515

16-
Exceptions:
17-
-----------
18-
- The copyright of the logos of the supporting institutions belong
19-
to the institutions themselves
20-
21-
22-
Re-licensing of specific files:
23-
-------------------------------
24-
25-
The following files have been translated (some with large
26-
modification) and re-licensed from the more liberally licensed
27-
CosmoMC (https://github.com/cmbant/CosmoMC):
28-
29-
- mcmc.py and proposal.py
30-
- sn.py, cmblikes.py in base_classes
31-
- most of the files under grid_tools/
32-
33-
3416
For this code and its documentation (with the exceptions above):
3517
----------------------------------------------------------------
3618

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ Thanks too to `G. Cañas Herrera`_, `A. Finke`_, `X. Garrido`_, `S. Heimersheim`
104104
:target: https://stfc.ukri.org/
105105
:height: 150px
106106
:width: 150px
107+
108+
(Copyright for the logos above belongs to their respective institutions.)

cobaya/collection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def ensure_cache_dumped(method):
194194

195195
@functools.wraps(method)
196196
def wrapper(self, *args, **kwargs):
197-
self._cache_dump() # pylint: disable=protected-access
197+
self._cache_dump()
198198
return method(self, *args, **kwargs)
199199

200200
return wrapper
@@ -668,7 +668,6 @@ def has_int_weights(self) -> bool:
668668
weights = self[OutPar.weight]
669669
return np.allclose(np.round(weights), weights)
670670

671-
# pylint: disable=protected-access
672671
def _detempered_weights(self, with_batch=None):
673672
"""
674673
Computes the detempered weights.
@@ -722,7 +721,6 @@ def _detempered_minuslogpost(self):
722721
-self._data[OutPar.minuslogpost].to_numpy(dtype=np.float64), self.temperature
723722
)
724723

725-
# pylint: disable=protected-access
726724
def reset_temperature(self, with_batch=None):
727725
"""
728726
Drops the information about sampling temperature: ``weight`` and ``minuslogpost``

cobaya/component.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ def get_defaults(
329329
else:
330330
return defaults
331331

332-
# noinspection PyUnusedLocal
333332
@classmethod
334333
def get_modified_defaults(cls, defaults, input_options=empty_dict):
335334
"""

cobaya/cosmo_input/autoselect_covmat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_covmat_database(installed_folders, cached=True) -> dict[CovmatFileKey, d
7979
log.debug("Loaded cached covmats database")
8080
_loaded_covmats_database[_hash] = covmat_database
8181
return covmat_database
82-
except:
82+
except Exception:
8383
log.info(
8484
"No cached covmat database present, not usable or not up-to-date. "
8585
"Will be re-created and cached."
@@ -95,7 +95,7 @@ def get_covmat_database(installed_folders, cached=True) -> dict[CovmatFileKey, d
9595
header = covmat.readline()
9696
assert header.strip().startswith("#")
9797
params = header.strip().lstrip("#").split()
98-
except:
98+
except Exception:
9999
continue
100100
name = os.path.splitext(filename)[0]
101101
tags = name.replace(".post.", "_").replace("_post", "").split("_")

cobaya/cosmo_input/gui.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
font_size = "9pt"
3131

3232
try:
33-
# noinspection PyUnresolvedReferences
3433
from PySide6.QtCore import QPoint, QSettings, QSize, Qt, Slot
35-
36-
# noinspection PyUnresolvedReferences
3734
from PySide6.QtGui import QAction, QColor
3835
from PySide6.QtWidgets import (
3936
QAbstractItemView,
@@ -63,14 +60,11 @@ def text(key, contents):
6360
return desc or key
6461

6562

66-
# noinspection PyArgumentList
6763
def get_settings():
6864
return QSettings("cobaya", "gui")
6965

7066

71-
# noinspection PyArgumentList
7267
class MainWindow(QWidget):
73-
# noinspection PyUnresolvedReferences
7468
def __init__(self):
7569
super().__init__()
7670
self.setWindowTitle("Cobaya input generator for Cosmology")
@@ -176,14 +170,13 @@ def __init__(self):
176170
def getScreen(self):
177171
try:
178172
return self.screen().availableGeometry()
179-
except:
173+
except Exception:
180174
return QApplication.screenAt(
181175
self.mapToGlobal(QPoint(self.width() // 2, 0))
182176
).availableGeometry()
183177

184178
def read_settings(self):
185179
settings = get_settings()
186-
# noinspection PyArgumentList
187180
screen = self.getScreen()
188181
h = min(screen.height() * 5 / 6.0, 900)
189182
size = QSize(min(screen.width() * 5 / 6.0, 1200), h)
@@ -379,13 +372,11 @@ def show_defaults(self):
379372
self.current_defaults_diag = DefaultsDialog(kind, component, parent=self)
380373

381374

382-
# noinspection PyUnresolvedReferences,PyArgumentList
383375
class DefaultsDialog(QWidget):
384376
def __init__(self, kind, component, parent=None):
385377
super().__init__()
386378
self.setWindowTitle(f"{kind} : {component}")
387379
self.setGeometry(0, 0, 500, 500)
388-
# noinspection PyArgumentList
389380
self.move(parent.getScreen().center() - self.rect().center())
390381
self.show()
391382
# Main layout
@@ -433,7 +424,6 @@ def copy_clipb(self):
433424
QApplication.clipboard().setText(self.display_tabs.currentWidget().toPlainText())
434425

435426

436-
# noinspection PyArgumentList
437427
def gui_script():
438428
warn_deprecation()
439429
try:

0 commit comments

Comments
 (0)