Skip to content

Commit

Permalink
Updated setup function to reset parameters and updated the FAQs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rai-pranav committed Nov 11, 2024
1 parent c9d611b commit 8c15086
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ Usually you can re-run your setup with the following command:
from one.api import ONE
ONE.setup(base_url='https://alyx.example.com')
```
#### ⚠️<span style="color: red;"> Note: 'alyx.example.com' is just an example URL - replace with your actual database URL</span>

## How do I reset my ONE parameters to use Open Alyx?
To reset your ONE configuration to use the public Open Alyx database with default settings:
```python
from one.api import ONE
ONE.setup(base_url='https://openalyx.internationalbrainlab.org', make_default=True)
```
**Note**: The `make_default=True` argument saves these settings as your default configuration. This means future ONE instances will use these settings unless specified otherwise.

## How do I change my download (a.k.a. cache) directory?
To **permanently** change the directory, simply re-run the setup routine:
Expand All @@ -64,6 +73,8 @@ from one.api import ONE

one = ONE(base_url='https://alyx.example.com', cache_dir=Path.home() / 'new_download_dir')
```
#### ⚠️<span style="color: red;"> Note: 'alyx.example.com' is just an example URL - replace with your actual database URL</span>

**NB**: This will (down)load the cache tables in the newly specified location. To avoid this, specify the cache table location separately using the `tables_dir` kwarg.

## How do I load cache tables from a different location?
Expand Down
5 changes: 4 additions & 1 deletion one/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ def setup(client=None, silent=False, make_default=None, username=None, cache_dir

# If a client URL has been provided, set it as the default URL
par_default = par_default.set('ALYX_URL', client or par_default.ALYX_URL)
par_current = iopar.read(f'{_PAR_ID_STR}/{client_key}', par_default)

# When silent=True, use default parameters instead of current ones to reset credentials
par_current = (par_default if silent else
iopar.read(f'{_PAR_ID_STR}/{client_key}', par_default))
if username:
par_current = par_current.set('ALYX_LOGIN', username)

Expand Down

0 comments on commit 8c15086

Please sign in to comment.