brainrender
brainrender copied to clipboard
BUG streamlines URL has changed
Describe the bug streamlines example test fails with URL not found: Forbidden
To Reproduce
- Run
pytest -vv tests/test_examples.py --runslow --runlocal(MacOs M2 on https://github.com/brainglobe/brainrender/commit/8866e3a762476820c20cc52994e5e3a3cc21c199 with vedo 2023.4.6) - Output is
========================================================================================================= FAILURES ==========================================================================================================
_______________________________________________________________________________________________________ test_examples _______________________________________________________________________________________________________
@pytest.mark.slow
@pytest.mark.local
def test_examples():
> import examples
tests/test_examples.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../mambaforge/envs/brainrender-py311/lib/python3.11/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: in _import
return original_import(name, *args, **kwargs)
examples/__init__.py:1: in <module>
from examples import (
../../mambaforge/envs/brainrender-py311/lib/python3.11/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: in _import
return original_import(name, *args, **kwargs)
examples/streamlines.py:19: in <module>
streams = get_streamlines_for_region("TH")[:2]
brainrender/atlas_specific/allen_brain_atlas/streamlines.py:109: in get_streamlines_for_region
return get_streamlines_data(
brainrender/atlas_specific/allen_brain_atlas/streamlines.py:70: in get_streamlines_data
response = request(url)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
url = 'https://neuroinformatics.nl/HBP/allen-connectivity-viewer/json/streamlines_174957972.json.gz'
def request(url):
"""
Sends a request to a url
:param url:
"""
if not connected_to_internet(): # pragma: no cover
raise ConnectionError(
"No internet connection found."
) # pragma: no cover
response = requests.get(url)
if response.ok:
return response
else: # pragma: no cover
exception_string = "URL request failed: {}".format(
response.reason
) # pragma: no cover
> raise ValueError(exception_string)
E ValueError: URL request failed: Forbidden
brainrender/_io.py:57: ValueError
Expected behavior Tests pass
@adamltyson (I think I've asked you this before - sorry) - any idea at what URL I can find the connectivity data now? Think the currently hard-coded URL is now out-of-date... presumably somewhere around https://connectivity.brain-map.org/projection/? Pointer appreciated!
This thread seems to contain the info we need to fix this.
From my understanding:
- That URL is (was) a cache of data from AIBS
- We should be able to get the data from AIBS ourselves
- If the server isn't up to it, maybe we need to cache it ourselves on GIN?
Considering the thread is 4 years old, maybe it's worth posting to see if there's a more up to date method to get this data?
Asked for advice on the AIBS community forum.
Moving this out of the https://github.com/brainglobe/brainrender/milestone/1 milestone as I had no response about the data and don't consider this issue blocking.
https://github.com/brainglobe/brainrender/pull/348 enables these "slow" tests by default. The streamlines tests are currently disabled (commented out).
This post by @fcollman illustrates how to download the data with cloud-volume. It's in a different format, and it looks like we'll need to rewrite all/most of the streamlines module.