Skip to content

Commit

Permalink
Add trapz kernel and switch to PR testing for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aphearin committed Jan 30, 2024
1 parent 360763f commit 15dbb37
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/monthly-warning-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
schedule:
# Runs "First of every month at 3:15am Central"
- cron: '15 8 1 * *'
push:
branches:
- main
pull_request: null

jobs:
tests:
Expand Down
21 changes: 21 additions & 0 deletions dsps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,27 @@ def cumtrapz(xarr, yarr):
return cumtrapz


@jjit
def trapz(xarr, yarr):
"""Trapezoidal integral
Parameters
----------
xarr : ndarray, shape (n, )
yarr : ndarray, shape (n, )
Returns
-------
result : float
"""
res_init = xarr[0], yarr[0], 0.0
scan_data = xarr, yarr
cumtrapz = scan(_cumtrapz_scan_func, res_init, scan_data)[1]
return cumtrapz[-1]

Check warning on line 302 in dsps/utils.py

View check run for this annotation

Codecov / codecov/patch

dsps/utils.py#L299-L302

Added lines #L299 - L302 were not covered by tests


@jjit
def cumulative_mstar_formed(t_table, sfh_table):
"""Compute the cumulative stellar mass formed at each input time
Expand Down

0 comments on commit 15dbb37

Please sign in to comment.