-
Notifications
You must be signed in to change notification settings - Fork 0
Fix bugs found by ai #69
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
base: master
Are you sure you want to change the base?
Changes from all commits
c288491
7eafed3
1c4bc93
00a70eb
68374f4
a17a77b
940a0b8
0e41a18
bc52b79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,7 +126,7 @@ def corr_map_rois(stack, cut_x, cut_z, n_pix_max_x=5, n_pix_max_z=5, n_pix_max=2 | |
| ignore_map[corr_map < line_threshold] = True | ||
| ignore_map[:cut_x[0], :] = True | ||
| ignore_map[nx - cut_x[1]:, :] = True | ||
| ignore_map[:, cut_z[0]] = True | ||
| ignore_map[:, :cut_z[0]] = True | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this previously did set the whole axis to True. |
||
| ignore_map[:, nz - cut_z[1]:] = True | ||
|
|
||
| p_threshold = grow_threshold if grow_threshold is not None else line_threshold | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,7 +152,7 @@ def add_experiment(self, key, header_path, pre_data_dir, raw_data_dir, only_new, | |
| info_entry["prep"] = "wholemount" | ||
|
|
||
| eye = header_dict.get("eye", "unknown") | ||
| if 'eye' == '': | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if eye == '': | ||
| eye = 'unknown' | ||
|
|
||
| if ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,7 @@ def fetch_and_compute(self, key): | |
| """Compute offset w.r.t. stimulus center in microns""" | ||
| stim_dict = (self.stimulus_tab & key).fetch1('stim_dict') | ||
|
|
||
| if ('pix_scale_x_um' not in stim_dict) or ('pix_scale_x_um' not in stim_dict): | ||
| if ('pix_scale_x_um' not in stim_dict) or ('pix_scale_y_um' not in stim_dict): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it previously checked twice if |
||
| raise ValueError("Pixel size not found in stimulus dict") | ||
|
|
||
| pix_scale_x_um, pix_scale_y_um = stim_dict['pix_scale_x_um'], stim_dict['pix_scale_y_um'] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ def fit_rf_model(srf, kind='gaussian', polarity=None, center=None): | |
| qi = -1. | ||
|
|
||
| for polarity_i in polarities: | ||
| if kind == 'gauss': | ||
| if kind == 'gauss' or kind == 'gaussian': | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default argument of the function for kind is so we should either support it or change the default to |
||
| model_i = srf_gauss_model(srf, polarity=polarity_i, center=center) | ||
| elif kind == 'dog': | ||
| model_i = srf_dog_model(srf, polarity=polarity_i, center=center) | ||
|
|
@@ -58,7 +58,7 @@ def fit_rf_model(srf, kind='gaussian', polarity=None, center=None): | |
| if qi_i > qi: | ||
| model, model_fit, model_params, qi = model_i, model_i_fit, model_i_params, qi_i | ||
|
|
||
| if kind == 'gauss': | ||
| if kind == 'gauss' or kind == 'gaussian': | ||
| return model_fit, model_params, qi | ||
| elif kind == 'dog': | ||
| model_c_fit = model[0](xx, yy) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,7 +138,7 @@ def compute_polarity_and_peak_idxs(trf, nstd=1., npeaks_max=None, rf_time=None, | |
| trf = trf.copy() | ||
| std_trf = np.std(trf) | ||
|
|
||
| if (rf_time is not None) or (np.isfinite(max_dt_future)): | ||
| if (rf_time is not None) and (np.isfinite(max_dt_future)): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Below line would have checked |
||
| trf[rf_time > max_dt_future] = 0. | ||
|
|
||
| pos_peak_idxs, _ = find_peaks(trf, prominence=nstd * std_trf / 2., height=nstd * std_trf) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,14 +51,20 @@ def compute_frame_times(n_frames: int, pix_dt: int, npix_x: int, npix_2nd: int, | |
| """Compute timepoints of frames and relative delay of individual pixels. | ||
| npix_2nd can be npix_y (xy-scan) or npix_z (xz-scan) | ||
| """ | ||
| if npix_x_offset_left < 0: | ||
| raise ValueError(f"npix_x_offset_left has to be positive or 0, but was {npix_x_offset_left}") | ||
| if npix_x_offset_right < 0: | ||
| raise ValueError(f"npix_x_offset_right has to be positive or 0, but was {npix_x_offset_right}") | ||
|
|
||
| frame_dt = pix_dt * npix_x * npix_2nd | ||
|
|
||
| frame_dt_offset = (np.arange(npix_x * npix_2nd) * pix_dt).reshape(npix_2nd, npix_x).T | ||
|
|
||
| if precision == 'line': | ||
| frame_dt_offset = np.tile(frame_dt_offset[0, :], (npix_x, 1)) | ||
|
|
||
| frame_dt_offset = frame_dt_offset[npix_x_offset_left:-npix_x_offset_right] | ||
| npix_x_offset_right_idx = npix_x_offset_left if npix_x_offset_left > 0 else None | ||
| frame_dt_offset = frame_dt_offset[npix_x_offset_left:-npix_x_offset_right_idx] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for which works, but returns an empty array. returns the full array, which is what we probably want for |
||
|
|
||
| frame_times = np.arange(n_frames) * frame_dt | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,4 +71,4 @@ def check_dims_ch_stack_wparams(ch_stack, wparams): | |
| nzpix = wparams.get("user_dzpix", 0) | ||
|
|
||
| if not (ch_stack.shape[:2] in [(nxpix, nypix), (nxpix, nzpix)]): | ||
| ValueError(f'Stack shape error: {ch_stack.shape} not in [{(nxpix, nypix)}, {(nxpix, nzpix)}]') | ||
| raise ValueError(f'Stack shape error: {ch_stack.shape} not in [{(nxpix, nypix)}, {(nxpix, nzpix)}]') | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the error was not raised before. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did not make sense as it would throw an index error.