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
7 changes: 7 additions & 0 deletions autofit/database/model/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,22 @@ def model(self, model: AbstractPriorModel):
lazy="joined",
foreign_keys=[JSON.fit_id],
)
# ``overlaps=``: ``HDU`` extends ``Array`` by joined-table inheritance, so
# ``Fit.arrays``/``Array.fit`` and ``Fit.hdus``/``HDU.fit`` all write the
# same ``array.fit_id`` column. The overlap is intentional (an HDU is an
# Array); the annotations carry exactly the names SQLAlchemy's SAWarning
# from ``configure_mappers()`` suggests.
arrays: Mapped[List[Array]] = sa.orm.relationship(
"Array",
lazy="joined",
foreign_keys=[Array.fit_id],
overlaps="fit",
)
hdus: Mapped[List[HDU]] = sa.orm.relationship(
"HDU",
lazy="joined",
foreign_keys=[HDU.fit_id],
overlaps="arrays,fit",
)
fits: Mapped[List[Fits]] = sa.orm.relationship(
"Fits",
Expand Down
1 change: 1 addition & 0 deletions autofit/non_linear/search/abstract_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def decorated(self, *args, **kwargs):
return func(self, *args, **kwargs)
finally:
root_logger.removeHandler(handler)
handler.close()

return decorated

Expand Down
12 changes: 12 additions & 0 deletions autofit/non_linear/search/mle/bfgs/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,15 @@ class LBFGS(AbstractBFGS):
"""

method = "L-BFGS-B"

# SciPy 1.15 deprecated the L-BFGS-B ``disp`` / ``iprint`` options (removal
# slated for 1.18) — the solver no longer emits its Fortran-side verbose
# output, so passing them buys nothing but a DeprecationWarning per
# ``minimize`` call. The constructor still accepts both for API stability;
# they simply never reach scipy for this method.
@property
def options(self):
options = dict(super().options)
del options["disp"]
del options["iprint"]
return options
2 changes: 1 addition & 1 deletion autofit/non_linear/search/nest/nautilus/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def output_search_internal(self, search_internal):

def samples_info_from(self, search_internal=None):
return {
"log_evidence": search_internal.evidence(),
"log_evidence": search_internal.log_z,
"total_samples": int(search_internal.n_like),
"total_accepted_samples": int(search_internal.n_like),
"time": self.timer.time if self.timer else None,
Expand Down
15 changes: 11 additions & 4 deletions test_autofit/non_linear/search/optimize/test_lbfgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ def test__explicit_params():
assert search.options["eps"] == 4.
assert search.options["maxfun"] == 25000
assert search.options["maxiter"] == 26000
assert search.options["iprint"] == -2
assert search.options["maxls"] == 21
assert search.options["disp"] is True

# Accepted for API stability but never forwarded: scipy deprecated the
# L-BFGS-B ``disp`` / ``iprint`` options in 1.15.
assert search.iprint == -2
assert search.disp is True
assert "iprint" not in search.options
assert "disp" not in search.options
assert isinstance(search.initializer, af.InitializerBall)
assert search.initializer.lower_limit == 0.2
assert search.initializer.upper_limit == 0.8
Expand All @@ -46,7 +51,9 @@ def test__explicit_params():
assert search.options["eps"] == 1e-08
assert search.options["maxfun"] == 15000
assert search.options["maxiter"] == 15000
assert search.options["iprint"] == -1
assert search.options["maxls"] == 20
assert search.options["disp"] is False
assert search.iprint == -1
assert search.disp is False
assert "iprint" not in search.options
assert "disp" not in search.options
assert isinstance(search.initializer, af.InitializerBall)
10 changes: 10 additions & 0 deletions test_autofit/non_linear/test_fork_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
prior_transform,
)

# pytest's own machinery keeps a background thread alive, so CPython 3.12+
# flags every os.fork() here as fork-in-a-multi-threaded-process, and JAX
# (itself multithreaded once imported) registers an equivalent RuntimeWarning
# hook. The tests exercise the fork-pinned pool deliberately; the deadlock
# caveat does not apply to these short-lived, likelihood-only workers.
pytestmark = [
pytest.mark.filterwarnings("ignore:This process:DeprecationWarning"),
pytest.mark.filterwarnings(r"ignore:os\.fork\(\) was called:RuntimeWarning"),
]

pins_fork = (
sys.platform != "darwin"
and "fork" in multiprocessing.get_all_start_methods()
Expand Down
Loading