Hoeijmakers / tayph

Analysis of high resolution spectroscopic time-series of exoplanets
9 stars 8 forks source link

Fit convergence problem in convolve operation #99

Closed bprinoth closed 2 years ago

bprinoth commented 2 years ago

When convolving over an array with a kernel, the data doesn’t exist over the edge. When smoothing the mean out-of-transit spectrum, we are running into a fit convergence problem when fitting over the edges within the convolve function.

The following error message is provided in the terminal:

Intel MKL ERROR: Parameter 6 was incorrect on entry to DGELSD. Traceback (most recent call last): File "tayph_start.py", line 30, in runner(i, atoms=False, TiO=True, ions=False, xcor=False) File "tayph_start.py", line 19, in runner run.start_run(str(i)+'-TiO.dat', parallel = False, xcor_parallel=xcor, pattern=True) File "/Users/bprinoth/Documents/GitHub/tayph/tayph/run.py", line 140, in start_run run_instance(params,parallel=parallel,xcor_parallel=xcor_parallel, pattern=pattern) File "/Users/bprinoth/Documents/GitHub/tayph/tayph/run.py", line 582, in run_instance patterns = ops.correct_high_freq(ops.normalize_orders(list_of_orders_pattern,list_of_sigmas_pattern,colourdeg)[0], list_of_wls, dp)
File "/Users/bprinoth/Documents/GitHub/tayph/tayph/operations.py", line 962, in correct_high_freq list_corr_orders = [correct_high_freq_parallel(k) for k in range(len(normalised_orders))] File "/Users/bprinoth/Documents/GitHub/tayph/tayph/operations.py", line 962, in list_corr_orders = [correct_high_freq_parallel(k) for k in range(len(normalised_orders))] File "/Users/bprinoth/Documents/GitHub/tayph/tayph/operations.py", line 933, in correct_high_freq_parallel wiggle = ops.smooth(meanspec,20,mode='gaussian') File "/Users/bprinoth/Documents/GitHub/tayph/tayph/operations.py", line 75, in smooth return(convolve(fx,k,edge_degree)) File "/Users/bprinoth/Documents/GitHub/tayph/tayph/operations.py", line 457, in convolve fit_right=np.polyfit(x[-2len(kernel)-1:-1],array[-2len(kernel)-1:-1],edge_degree) File "<__array_function__ internals>", line 6, in polyfit File "/Users/bprinoth/anaconda3/envs/venv3/lib/python3.7/site-packages/numpy/lib/polynomial.py", line 660, in polyfit c, resids, rank, s = lstsq(lhs, rhs, rcond) File "<__array_function__ internals>", line 6, in lstsq File "/Users/bprinoth/anaconda3/envs/venv3/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 2306, in lstsq x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj) File "/Users/bprinoth/anaconda3/envs/venv3/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 100, in _raise_linalgerror_lstsq raise LinAlgError("SVD did not converge in Linear Least Squares") numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares