Skip to content

Commit

Permalink
#17 Merge pull request from deshima-dev/astropenguin/issue15
Browse files Browse the repository at this point in the history
Fix to handle cases where fit errors are None
  • Loading branch information
astropenguin authored Jul 3, 2024
2 parents d2915d0 + 9512de8 commit 0e79560
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ jobs:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: pip install setuptools==70.0.0 # temporary
- run: pip install poetry==1.8.3 && poetry install
- run: deshima-rawdata download 20231117042946 -e
- run: python scripts/aste/Configure.py cosmos_20231117042946 out
Expand Down
48 changes: 24 additions & 24 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kidanalysis-delft"
version = "2024.6.0"
version = "2024.7.0"
description = "KID analysis scripts made in Delft"
authors = ["Kenichi Karatsu", "Shinji Fujita"]
maintainers = ["Akio Taniguchi <[email protected]>"]
Expand Down
4 changes: 3 additions & 1 deletion scripts/aste/FitSweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def Calc(kids, nfwhm=5, fitter='gaolinbg', verbose=0, force=False,
dQi_ = r.params['Qi'].stderr

#if dfr_/fr_<0. or dQr_/Qr_<0. or dQc_/Qc_<0. or dQi_/Qi_<0.:
if dfr_/fr_<0. or dQr_/Qr_<0. or dQc_/Qc_<0.:
if dfr_ is None or dQr_ is None or dQc_ is None or dQi_ is None:
failed.append(i)
elif dfr_/fr_<0. or dQr_/Qr_<0. or dQc_/Qc_<0.:
failed.append(i)
elif fr_!=fr_ or dfr_!=dfr_ or Qr_!=Qr_ or dQr_!=dQr_: # reject Nan
failed.append(i)
Expand Down
6 changes: 5 additions & 1 deletion scripts/libs/fit/fitresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ def __init__(self, minimized=None, error_given=None, function=None):
else:
self.error_is_asymptotic = True

if minimized.covar is not None:
self.covar = minimized.covar
else:
self.covar = np.full([minimized.nvarys] * 2, np.nan)

self.function = function
self.init_vals = minimized.init_vals
self.params = minimized.params
self.covar = minimized.covar
self.info = dict((k, getattr(minimized, k)) for k in
# json-friendly data taken from
# http://lmfit.github.io/lmfit-py/fitting.html#MinimizerResult
Expand Down

0 comments on commit 0e79560

Please sign in to comment.