brainglobe / brainrender

a python based software for visualization of neuroanatomical and morphological data.
https://brainglobe.info/documentation/brainrender/index.html
BSD 3-Clause "New" or "Revised" License
538 stars 75 forks source link

Problems with streamlines examples #289

Closed adamltyson closed 9 months ago

adamltyson commented 9 months ago

When I first try to run python streamlines.py I get a warning about allensdk (https://github.com/brainglobe/brainrender/issues/288). When this is installed and I try again I get:

(brainrender-test) tigger:examples adamtyson$ python streamlines.py 
Running example: streamlines.py
downloading ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/adamtyson/projects/brainglobe/brainrender/examples/streamlines.py:19 in <module>          │
│                                                                                                  │
│   16 scene.add_brain_region("TH")                                                                │
│   17                                                                                             │
│   18 # Get stramlines data and add                                                               │
│ ❱ 19 streams = get_streamlines_for_region("TH")[:2]                                              │
│   20 scene.add(*make_streamlines(*streams, color="salmon", alpha=0.5))                           │
│   21                                                                                             │
│   22 # Render!                                                                                   │
│                                                                                                  │
│ /Users/adamtyson/projects/brainglobe/brainrender/brainrender/atlas_specific/allen_brain_atlas/st │
│ reamlines.py:109 in get_streamlines_for_region                                                   │
│                                                                                                  │
│   106 │   │   logger.debug("No experiments found from allen data")                               │
│   107 │   │   return None                                                                        │
│   108 │                                                                                          │
│ ❱ 109 │   return get_streamlines_data(                                                           │
│   110 │   │   region_experiments.id.values, force_download=force_download                        │
│   111 │   )                                                                                      │
│   112                                                                                            │
│                                                                                                  │
│ /Users/adamtyson/projects/brainglobe/brainrender/brainrender/atlas_specific/allen_brain_atlas/st │
│ reamlines.py:70 in get_streamlines_data                                                          │
│                                                                                                  │
│    67 │   │   jsonpath = streamlines_folder / f"{eid}.json"                                      │
│    68 │   │                                                                                      │
│    69 │   │   if not jsonpath.exists() or force_download:                                        │
│ ❱  70 │   │   │   response = request(url)                                                        │
│    71 │   │   │                                                                                  │
│    72 │   │   │   # Write the response content as a temporary compressed file                    │
│    73 │   │   │   temp_path = streamlines_folder / "temp.gz"                                     │
│                                                                                                  │
│ /Users/adamtyson/projects/brainglobe/brainrender/brainrender/_io.py:57 in request                │
│                                                                                                  │
│   54 │   │   exception_string = "URL request failed: {}".format(                                 │
│   55 │   │   │   response.reason                                                                 │
│   56 │   │   )  # pragma: no cover                                                               │
│ ❱ 57 │   raise ValueError(exception_string)                                                      │
│   58                                                                                             │
│   59                                                                                             │
│   60 def check_file_exists(func):  # pragma: no cover                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: URL request failed: Forbidden

M1 macbook, Python 3.11. Fresh conda env.

alessandrofelder commented 9 months ago

Closing as duplicate of #266 .