Skip to content

generate: Add temporal correlations to noise simulator#4487

Draft
cwindolf wants to merge 8 commits intoSpikeInterface:mainfrom
cwindolf:generate-temporal-noise
Draft

generate: Add temporal correlations to noise simulator#4487
cwindolf wants to merge 8 commits intoSpikeInterface:mainfrom
cwindolf:generate-temporal-noise

Conversation

@cwindolf
Copy link
Copy Markdown
Collaborator

@cwindolf cwindolf commented Apr 1, 2026

Closes #4482

This adds temporal noise to the simulations. It is parametrized by a spectral density which the user would supply as a numpy array.

I added logic for circular padding to the generator class so that everything is still totally circular like in tile_pregenerated. This required moving the old get_traces() into a helper.

There's also a flag I ended up putting in to allow the user to turn on overlap-add convolutions. It's off by default, because it can introduce inconsistencies in the output if the user is not careful (in particular, the unit test I added will fail). But I think it's worth keeping this since it will be substantially faster when generating large noise simulations, and it's totally safe if one plans to just call save_to_folder() or something.

@cwindolf cwindolf requested a review from samuelgarcia April 1, 2026 16:53
@cwindolf
Copy link
Copy Markdown
Collaborator Author

cwindolf commented Apr 1, 2026

Sorry, I think my formatter has the wrong presets! Hopefully diff shrinks after pre commit bot.

@cwindolf
Copy link
Copy Markdown
Collaborator Author

cwindolf commented Apr 1, 2026

Hmm, so I don't think there's a good way to do this without scipy, but core tests don't include scipy dependency. I'm wondering, is there another good place for me to put my unit test so that it will run with scipy?

@cwindolf cwindolf added the generators Related to generator tools label Apr 1, 2026
@alejoe91
Copy link
Copy Markdown
Member

alejoe91 commented Apr 2, 2026

@cwindolf you can keep the implementation in core, but move the tests in the generation/tests module ;)

@samuelgarcia
Copy link
Copy Markdown
Member

Hi Charlie,
thanks for this.
Lets have a call to discuss the implementation of the margin.

@cwindolf
Copy link
Copy Markdown
Collaborator Author

cwindolf commented Apr 8, 2026

To do before merging:

  • noticed that *=noise_levels doesn't happen if cov_matrix is supplied and noise method is tile_precomputed. But it does happen in all cases under on_the_fly.
  • Add spectral_density kw to generate_noise() in noise_tools.py

@cwindolf cwindolf marked this pull request as draft April 8, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generators Related to generator tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temporally correlated noise in simulations

3 participants