Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 6fe46d5
  • /
  • tests
  • /
  • test_parameters.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:276ffde7c3faefac16f29360e2472041ebd59841
directory badge
swh:1:dir:8f6b71cce4bd4ec2c0cf114e5047b7cb070569b0

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
test_parameters.py
'''Check that configurable parameters are propagated correctly.'''

import numpy as np

from kilosort.spikedetect import template_centers
from kilosort.io import load_probe
from kilosort.utils import PROBE_DIR


def test_dmin():
    settings = {'dmin': None, 'dminx': 32}
    ops = {'xc': np.array([10, 20, 30]), 'yc': np.array([40, 40, 60]),
           'settings': settings, 'kcoords': np.array([0, 0, 0])}
    ops = template_centers(ops)
    assert ops['dmin'] is not None  # set based on xc, yc
    assert ops['dminx'] is not None
    assert ops['settings']['dmin'] is None  # shouldn't change
    
    # Neuropixels 1 3B1 (4 columns with stagger)
    np1_probe = load_probe(PROBE_DIR / 'NeuroPix1_default.mat')
    ops = {'xc': np1_probe['xc'], 'yc': np1_probe['yc'], 
           'kcoords': np1_probe['kcoords'], 'settings': settings}
    ops = template_centers(ops)
    assert ops['dmin'] == 20     # Median vertical spacing of contacts
    assert ops['xup'].size == 4  # Number of lateral pos for universal templates

    # Just one shank of NP2
    np2_probe = load_probe(PROBE_DIR / 'NeuroPix2_default.mat')
    ops = {'xc': np2_probe['xc'], 'yc': np2_probe['yc'],
           'kcoords': np2_probe['kcoords'], 'settings': settings}
    ops = template_centers(ops)
    assert ops['dmin'] == 15
    assert ops['xup'].size == 3

    # Linear probe
    lin_probe = load_probe(PROBE_DIR / 'Linear16x1_test.mat')
    ops = {'xc': lin_probe['xc'], 'yc': lin_probe['yc']*20,
           'kcoords': lin_probe['kcoords'], 'settings': settings}
    ops = template_centers(ops)
    assert ops['dmin'] == 20
    assert ops['xup'].size == 1

    settings = {'dmin': 5, 'dminx': 7}
    ops = {'xc': np.array([10, 20, 30]), 'yc': np.array([40, 40, 60]),
           'settings': settings, 'kcoords': np.array([0, 0, 0])}
    ops = template_centers(ops)
    assert ops['dmin'] == 5
    assert ops['dminx'] == 7

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API