oneibl.one

class oneibl.one.ONE(username=None, password=None, base_url=None, silent=False, printout=True)
download_dataset(dset, cache_dir=None, **kwargs)

Download a dataset from an alyx REST dictionary :param dset: single dataset dictionary from an Alyx REST query OR URL string :param cache_dir (optional): root directory to save the data in (home/downloads by default) :return: local file path

download_datasets(dsets, **kwargs)

Download several datsets through a list of alyx REST dictionaries :param dset: list of dataset dictionaries from an Alyx REST query OR list of URL strings :return: local file path

get_details(eid, full=False)

Returns details of eid like from one.search, optional return full session details.

static keywords()

Returns possible keywords to be used in the one.list method

Returns:a tuple containing possible search terms:
Return type:tuple
list(eid=None, keyword='dataset-type', details=False)

From a Session ID, queries Alyx database for datasets-types related to a session.

Parameters:
  • eid (str or list of strings) – Experiment ID, for IBL this is the UUID String of the Session as per Alyx database. Example: ‘698361f6-b7d0-447d-a25d-42afdef7a0da’ If None, returns the set of possible values. Only for the following keys: (‘users’, ‘dataset-types’, subjects’)
  • keyword (str) – The attribute to be listed.
  • details (bool) – returns a second argument with a full dictionary to provide context
Returns:

list of strings, plus list of dictionaries if details option selected

Return type:

list, list

for a list of keywords, use the methods one.search_terms()

load(eid, dataset_types=None, dclass_output=False, dry_run=False, cache_dir=None, download_only=False, clobber=False, offline=False, keep_uuid=False)

From a Session ID and dataset types, queries Alyx database, downloads the data from Globus, and loads into numpy array.

Parameters:
  • eid (str) – Experiment ID, for IBL this is the UUID of the Session as per Alyx database. Could be a full Alyx URL: ‘http://localhost:8000/sessions/698361f6-b7d0-447d-a25d-42afdef7a0da’ or only the UUID: ‘698361f6-b7d0-447d-a25d-42afdef7a0da’. Can also be a list of the above for multiple eids.
  • dataset_types (list) – [None]: Alyx dataset types to be returned.
  • dclass_output (bool If None or an empty dataset_type is specified, the output will be a dictionary by default.) – [False]: forces the output as dataclass to provide context.
  • cache_dir (str) – temporarly overrides the cache_dir from the parameter file
  • download_only (bool) – do not attempt to load data in memory, just download the files
  • clobber (bool) – force downloading even if files exists locally
  • keep_uuid (bool) – keeps the UUID at the end of the filename (defaults to False)
Returns:

List of numpy arrays matching the size of dataset_types parameter, OR a dataclass containing arrays and context data.

Return type:

list, dict, dataclass SessionDataInfo

load_dataset(eid, dataset_type, **kwargs)

Load a single dataset from a Session ID and a dataset type.

Parameters:
Returns:

A numpy array.

Return type:

numpy array

load_object(eid, obj, **kwargs)

Load all attributes of an ALF object from a Session ID and an object name.

Parameters:
Returns:

A dictionary-like structure with one key per dataset type for the requested object, and a NumPy array per value.

Return type:

AlfBunch instance

search(details=False, limit=None, **kwargs)
Applies a filter to the sessions (eid) table and returns a list of json dictionaries
corresponding to sessions.

For a list of search terms, use the methods

>>> one.search_terms()
Parameters:
  • dataset_types (list of str) – list of dataset_types
  • date_range (list) – list of 2 strings or list of 2 dates that define the range
  • details (bool) – default False, returns also the session details as per the REST response
  • lab (list or str) – a str or list of lab names
  • limit (int List of possible search terms) – default None, limits results (if pagination enabled on server)
  • location (str) – 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
  • number (str or int) – number of session to be returned; will take the first n sessions found
  • / performance_gte (performance_lte) – search only for sessions whose performance is

less equal or greater equal than a pre-defined threshold as a percentage (0-100) :type performance_gte: float

Parameters:
  • subjects (list or str) – a list of subjects nickname
  • task_protocol (str) – a str or list of task protocol name (can be partial, i.e. any task protocol containing that str will be found)
  • users (list or str) – a list of users
Returns:

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

Return type:

list, list

static search_terms()

Returns possible search terms to be used in the one.search method.

Returns:a tuple containing possible search terms:
Return type:tuple
static setup()

Interactive command tool that populates parameter file for ONE IBL.