Skip to content

Commit

Permalink
Merge pull request #79 from efiring/nodiagn
Browse files Browse the repository at this point in the history
Do not try to calculate diagnostics when conf_int is 'none'.
  • Loading branch information
efiring committed Jan 14, 2020
2 parents c5ac303 + 7b7a51c commit 45525f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions tests/test_solve.py
Expand Up @@ -9,15 +9,18 @@

from __future__ import (absolute_import, division, print_function)

import pytest

import numpy as np

from utide import reconstruct
from utide import solve
from utide._ut_constants import ut_constants
from utide.utilities import Bunch


def test_roundtrip():
# We omit the 'MC' case for now because with this test data, it
# fails with 'numpy.linalg.LinAlgError: SVD did not converge'.
@pytest.mark.parametrize('conf_int', ['linear', 'none'])
def test_roundtrip(conf_int):
"""Minimal conversion from simple_utide_test."""
ts = 735604
duration = 35
Expand All @@ -44,7 +47,7 @@ def test_roundtrip():
'nodal': False,
'trend': False,
'method': 'ols',
'conf_int': 'linear',
'conf_int': conf_int,
'Rayleigh_min': 0.95,
}

Expand Down
2 changes: 1 addition & 1 deletion utide/_reconstruct.py
Expand Up @@ -92,7 +92,7 @@ def _reconstruct(t, goodmask, coef, verbose, constit, min_SNR, min_PE):
# Determine constituents to include.
if constit is not None:
ind = [i for i, c in enumerate(coef['name']) if c in constit]
elif min_SNR == 0 and min_PE == 0:
elif (min_SNR == 0 and min_PE == 0) or coef['aux']['opt']['nodiagn']:
ind = slice(None)
else:
if twodim:
Expand Down
1 change: 1 addition & 0 deletions utide/_solve.py
Expand Up @@ -57,6 +57,7 @@ def _translate_opts(opts):
oldopts.linci = False
elif opts.conf_int == 'none':
oldopts.conf_int = False
oldopts.nodiagn = 1
else:
raise ValueError("'conf_int' must be 'linear', 'MC', or 'none'")

Expand Down

0 comments on commit 45525f7

Please sign in to comment.