Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

get_velocity_profile() and annulus.get_vlos() with GP method fails at return

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

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start in annulus.py at annulus.get_vlos() and get_vlos_GP(), especially the return-handling code around the reported line 479. Reproduce the failure with tutorial_4 or the shown get_vlos(fit_method='GP') call, then verify that the GP method returns successfully without the ambiguous-array error.

Written by the indexing model from the issue text.

Description

When running annulus.get_vlos(fit_method=''GP") returns this error. I got this error in tutorial_4 and with my own notebook trying to use get_velocity_profile().

100%|███████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:14<00:00, 69.43it/s]

ValueError Traceback (most recent call last)
Cell In[26], line 1
----> 1 print('v_phi = {:.0f} +- {:.0f} m/s'.format(*np.squeeze(annulus.get_vlos(fit_method='GP'))))

File ~/opt/anaconda3/envs/py310/lib/python3.10/site-packages/eddy/annulus.py:236, in annulus.get_vlos(self, p0, fit_method, fit_vrad, fix_vlsr, vrot_mask, vlsr_mask, vrad_mask, dv_mask, resample, optimize, nwalkers, nburnin, nsteps, scatter, signal, optimize_kwargs, mcmc, mcmc_kwargs, centroid_method, repeat_with_mask)
234 if fit_method == 'gp':
235 resample = False if resample is None else resample
--> 236 popt = self.get_vlos_GP(p0=p0,
237 fit_vrad=fit_vrad,
238 vlsr_mask=vlsr_mask,
239 dv_mask=dv_mask,
240 nwalkers=nwalkers,
241 nsteps=nsteps,
242 nburnin=nburnin,
243 scatter=scatter,
244 plots='none',
245 returns='percentiles',
246 resample=resample,
247 mcmc=mcmc,
248 optimize_kwargs=optimize_kwargs,
249 mcmc_kwargs=mcmc_kwargs)
251 cvar = 0.5 * (popt[:, 2] - popt[:, 0])
252 popt = np.array([popt[0, 1],
253 popt[1, 1] if fit_vrad else np.nan,
254 np.nan])

File ~/opt/anaconda3/envs/py310/lib/python3.10/site-packages/eddy/annulus.py:479, in annulus.get_vlos_GP(self, p0, fit_vrad, vlsr_mask, dv_mask, optimize, nwalkers, nburnin, nsteps, scatter, niter, plots, returns, resample, mcmc, optimize_kwargs, mcmc_kwargs)
477 idx = returns.index('percentiles')
478 returns[idx] = np.percentile(samples, [16, 50, 84], axis=0).T
--> 479 if 'samples' in returns:
480 idx = returns.index('samples')
481 returns[idx] = samples

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Dominant language
Python
Stars
23
Forks
10
Avg merge
28m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

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.

More from PlanetFormationLab/eddy

All issues in PlanetFormationLab/eddy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.