Starfish-develop / Starfish-develop/Starfish

Issue with star.py --optimize=Cheb

Open
#88 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
78
Forks
23
PR merge metrics
No merged PRs in 30d

Description

I have been adapting Starfish for use on low resolution DeVeny and Hydra spectra with input BT-Settl models containing temperature and log g information. When I get to the optimize Cheb step I encounter the following error which I can't trace to its origin:

$ star.py --optimize=Cheb
/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/numpy/polynomial/polyutils.py:334: RuntimeWarning: invalid value encountered in double_scalars
  off = (old[1]*new[0] - old[0]*new[1])/oldlen
/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/numpy/polynomial/polyutils.py:335: RuntimeWarning: divide by zero encountered in true_divide
  scl = newlen/oldlen
/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/numpy/polynomial/_polybase.py:292: RuntimeWarning: invalid value encountered in multiply
  arg = off + scl*arg
grid pars are [ 2800.      4.5]
Process Process-1:
Traceback (most recent call last):
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/kevin/Fishy/Starfish/Starfish/parallel.py", line 555, in brain
    alive = self.interpret()
  File "/home/kevin/Fishy/Starfish/Starfish/parallel.py", line 573, in interpret
    response = func(arg)
  File "/home/kevin/Fishy/Starfish/Starfish/parallel.py", line 482, in optimize_Cheb
    result = fmin(fprob, p0, maxiter=10000, maxfun=10000)
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 408, in fmin
    res = _minimize_neldermead(func, x0, args, callback=callback, **opts)
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 532, in _minimize_neldermead
    fsim[k] = func(sim[k])
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 292, in function_wrapper
    return function(*(wrapper_args + args))
  File "/home/kevin/Fishy/Starfish/Starfish/parallel.py", line 474, in fprob
    lnp = self.evaluate()
  File "/home/kevin/Fishy/Starfish/Starfish/parallel.py", line 293, in evaluate
    factor, flag = cho_factor(CC)
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/scipy/linalg/decomp_cholesky.py", line 142, in cho_factor
    check_finite=check_finite)
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/scipy/linalg/decomp_cholesky.py", line 19, in _cholesky
    a1 = asarray_chkfinite(a) if check_finite else asarray(a)
  File "/home/kevin/.conda/envs/starfish/lib/python3.6/site-packages/numpy/lib/function_base.py", line 1215, in asarray_chkfinite
    "array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs

I'm wondering if this is related to #21, but I don't have any infs or NaNs in my input flux or sigma arrays.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with star.py --optimize=Cheb, then inspect Starfish/parallel.py at optimize_Cheb, fprob, and evaluate, where the traceback reaches cho_factor(CC). Trace how the Chebyshev optimization produces invalid values in CC, using the reported NumPy warnings and the input flux and sigma arrays. Done means the cause of the NaNs or infinities is identified and the failure is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.