Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERPparamGroup().get_ERPparam() throwing error #2

Open
dillancellier opened this issue May 22, 2024 · 0 comments
Open

ERPparamGroup().get_ERPparam() throwing error #2

dillancellier opened this issue May 22, 2024 · 0 comments

Comments

@dillancellier
Copy link
Collaborator

ERPparamGroup().get_ERPparam().plot() errors when there was no model fit for that ERP, returns plot of raw data and peak-less model fit, but errors in ERPparam/plts/model.py:
in plot_ERPparam(model,ax, y_label)
line 42 ax.scatter(model.time[model.peak_indices_[:,1]], model.signal[model.peak_indices_[:,1]], color='r', label='Peak fit')
yields IndexError: too many indices for array

ERPparamGroup().get_ERPparam() also erroring on random other trials-- don't understand why (example trial attached)
erroring.zip

fit_params = {'max_n_peaks':4, 'peak_width_limits':(0.01,np.inf), 'peak_threshold':1.5, 'min_peak_height':20, 'skewed_gaussian':False}
es = ERPparamGroup(**fit_params)
es._gauss_overlap_thresh = 0.75
es.fit(signals=erroring,time=time, time_range=[0,1], baseline=[-0.5,0])

yields:

~\OneDrive\UCSD\Voytek_Lab\code_dev\ERPparam\ERPparam\objs\group.py in get_ERPparam(self, ind, regenerate)
    502         fm.add_results(self.group_results[ind])
    503         if regenerate:
--> 504             fm._regenerate_model()
    505 
    506         return fm

~\OneDrive\UCSD\Voytek_Lab\code_dev\ERPparam\ERPparam\objs\fit.py in _regenerate_model(self)
   1338 
   1339         self._peak_fit = sim_erp(
-> 1340             self.time,  np.ndarray.flatten(self.gaussian_params_))

~\OneDrive\UCSD\Voytek_Lab\code_dev\ERPparam\ERPparam\sim\gen.py in sim_erp(time, params, periodic_mode)
    152     pe_func = get_pe_func(periodic_mode)
    153 
--> 154     pe_vals = pe_func(time, *params)
    155 
    156     return pe_vals

~\OneDrive\UCSD\Voytek_Lab\code_dev\ERPparam\ERPparam\core\funcs.py in gaussian_function(xs, *params)
    123     for ii in range(0, len(params), 3):
    124 
--> 125         ctr, hgt, wid = params[ii:ii+3]
    126 
    127         ys = ys + hgt * np.exp(-(xs-ctr)**2 / (2*wid**2))

ValueError: not enough values to unpack (expected 3, got 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant