Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: int-brain-lab/ibllib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: chiyu1203/ibllib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 17, 2024

  1. edit peri_event_time_histogram to not allow error bars turns to negat…

    …ive value and not plot raster when no spikes
    chiyu1203 committed May 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    544d23a View commit details
Showing with 12 additions and 1 deletion.
  1. +12 −1 brainbox/plot.py
13 changes: 12 additions & 1 deletion brainbox/plot.py
Original file line number Diff line number Diff line change
@@ -578,7 +578,11 @@ def peri_event_time_histogram(
else:
bars = np.zeros_like(mean)
if error_bars != 'none':
ax.fill_between(peths.tscale, mean - bars, mean + bars, **errbar_kwargs)
negative_bar=mean-bars
if np.any(negative_bar<0):
ax.fill_between(peths.tscale, 0, mean + bars, **errbar_kwargs)
else:
ax.fill_between(peths.tscale, negative_bar, mean + bars, **errbar_kwargs)

# Plot the event marker line. Extends to 5% higher than max value of means plus any error bar.
plot_edge = (mean.max() + bars[mean.argmax()]) * 1.05
@@ -588,6 +592,13 @@ def peri_event_time_histogram(
# blank space below the zero where the raster will go.
ax.set_xlim([-t_before, t_after])
ax.set_ylim([-plot_edge if include_raster else 0., plot_edge])
if int(plot_edge)==0:
include_raster=False

if mean.min()!=0:
ax.set_yticks(0,mean.min(),mean.max())
else:
ax.set_yticks([0,mean.max()])
# Put y ticks only at min, max, and zero
if mean.min() != 0:
ax.set_yticks([0, mean.min(), mean.max()])