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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Run tests
run: |
cd pytest
pytest .
pytest -m "not slow"
9 changes: 4 additions & 5 deletions linx/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import equinox as eqx

from diffrax import diffeqsolve, ODETerm, Tsit5, PIDController, SaveAt, DiscreteTerminatingEvent
from diffrax import diffeqsolve, ODETerm, Tsit5, PIDController, SaveAt, Event

import linx.thermo as thermo
import linx.const as const
Expand Down Expand Up @@ -109,14 +109,13 @@ def __call__(

Y0 = (lna_init, T_EM_init, T_nu_init)

def T_EM_check(state, **kwargs):

return state.y[1] < T_end
def T_EM_check(t, y, args, **kwargs):
return y[1] < T_end

sol = diffeqsolve(
ODETerm(self.dY), solver, args=(lna_init, rho_extra_init),
t0=0., t1=jnp.inf, dt0=None, y0=Y0,
saveat=SaveAt(steps=True), discrete_terminating_event = DiscreteTerminatingEvent(T_EM_check),
saveat=SaveAt(steps=True), event=Event(T_EM_check),
stepsize_controller = PIDController(
rtol=rtol, atol=atol
),
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
6 changes: 5 additions & 1 deletion pytest/test_numpyro.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import sys
sys.path.append('../scripts')
import os
import pytest
# Add absolute path to the scripts directory
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'scripts'))

from run_numpyro import run


@pytest.mark.slow
def test_run_numpyro():
try:
run(bbn_only=True, n_steps_svi=5, n_warmup_mcmc=5, n_samples_mcmc=5, n_chains=1)
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ cloudpickle
corner
cosmopower-jax
Cython
diffrax==0.4.1
diffrax>=0.6.2
dynesty
emcee
equinox
jax==0.4.28
jaxlib==0.4.28
jax>=0.4.38
jaxlib>=0.4.38
jaxopt
jaxtyping
joblib
Expand Down