Searching with ONE

ONE contains a method that allows you to search for sessions of interest. The possible search terms can be listed using,

from one.api import ONE
one = ONE(base_url='')

('dataset', 'date_range', 'laboratory', 'number', 'project', 'subject', 'task_protocol')

We can search for sessions within a specified date range

from pprint import pprint
eids =['2020-01-01', '2021-01-01'])

To get more information about the sessions we can add a details=True flag

eids, details =['2020-01-01', '2021-01-01'], details=True)
 [{'date':, 9, 21),
   'lab': 'hoferlab',
   'number': 1,
   'project': 'ibl_neuropixel_brainwide_01',
   'subject': 'SWC_043',
   'task_protocol': '_iblrig_tasks_ephysChoiceWorld6.4.2'},
  {'date':, 9, 19),
   'lab': 'zadorlab',
   'number': 1,
   'project': 'ibl_neuropixel_brainwide_01',
   'subject': 'CSH_ZAD_029',
   'task_protocol': '_iblrig_tasks_ephysChoiceWorld6.4.2'},
  {'date':, 1, 8),
   'lab': 'churchlandlab',
   'number': 1,
   'project': 'ibl_neuropixel_brainwide_01',
   'subject': 'CSHL049',
   'task_protocol': '_iblrig_tasks_ephysChoiceWorld6.2.5'}])

Multiple search terms can also be combined, for example we can search for any sessions from the subject SWC_043 that contain the datasets spikes.times and spikes.clusters

eids ='SWC_043', dataset=['spikes.times', 'spikes.clusters'])

More search terms are available when making remote queries (using the remote Alyx database instead of the local cache). You can view all the remote search terms with the ‘remote’ arg:

[ ]:
eids =, query_type='remote')

To find out more information about the method we can use the help function

Help on method search in module one.api:

search(details=False, query_type=None, **kwargs) method of one.api.OneAlyx instance
    Searches sessions matching the given criteria and returns a list of matching eids

    For a list of search terms, use the method


    For all of the search parameters, a single value or list may be provided.  For dataset,
    the sessions returned will contain all listed datasets.  For the other parameters,
    the session must contain at least one of the entries. NB: Wildcards are not permitted,
    however if wildcards property is False, regular expressions may be used for all but
    number and date_range.

    dataset : str, list
        list of dataset names. Returns sessions containing all these datasets.
        A dataset matches if it contains the search string e.g. 'wheel.position' matches
    date_range : str, list, datetime.datetime,, pandas.timestamp
        A single date to search or a list of 2 dates that define the range (inclusive).  To
        define only the upper or lower date bound, set the other element to None.
    lab : str, list
        A str or list of lab names, returns sessions from any of these labs
    number : str, int
        Number of session to be returned, i.e. number in sequence for a given date
    subject : str, list
        A list of subject nicknames, returns sessions for any of these subjects
    task_protocol : str, list
        The task protocol name (can be partial, i.e. any task protocol containing that str
        will be found)
    project : str, list
        The project name (can be partial, i.e. any task protocol containing that str
        will be found)
    performance_lte / performance_gte : float
        search only for sessions whose performance is less equal or greater equal than a
        pre-defined threshold as a percentage (0-100)
    users : str, list
        A list of users
    location : str, list
        a str or list of lab location (as per Alyx definition) name
        Note: this corresponds to the specific rig, not the lab geographical location per se
    dataset_types : str, list
        One or more of dataset_types
    details : bool
        If true also returns a dict of dataset details
    query_type : str, None
        Query cache ('local') or Alyx database ('remote')
    limit : int
        The number of results to fetch in one go (if pagination enabled on server)

    List of eids and, if details is True, also returns a list of dictionaries, each entry
    corresponding to a matching session