This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.api.queries.rma_api import RmaApi | |
import allensdk.core.json_utilities as ju | |
all_structs = [] | |
root = RmaApi().model_query("Structure", criteria="[graph_id$eq1],[acronym$eqgrey]")[0] | |
all_structs.append(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache | |
mcc = MouseConnectivityCache(manifest_file="/data/dynamic-brain-workshop/mouse_connectivity_cache/manifest.json", | |
resolution=10) | |
tv, _ = mcc.get_template_volume() | |
fig, ax = plt.subplots(figsize=(10,10)) | |
plt.imshow(tv[:,515,:], cmap='gray') | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import matplotlib.patches as mpatch | |
from matplotlib.collections import PatchCollection | |
import matplotlib.colors as mcolors | |
import matplotlib.colorbar | |
import matplotlib.gridspec as gridspec | |
def mega_paw_plot(sdata_list=None, sdata_bg_list=None, cdata_list=None, | |
cmap=None, clim=None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import imageio | |
import numpy as np | |
from scipy.signal import medfilt | |
# from here | |
# https://www.nasa.gov/multimedia/imagegallery/image_feature_539.html | |
im = imageio.imread('jupiter_bottom.jpg') | |
off = [16,-1] | |
rtrim = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
def read_swc(file_path) | |
rows = CSV.read(file_path, col_sep: ' ') | |
good_rows = rows.select { |row| not row[0].starts_with?('#') } | |
return good_rows.collect do |row| | |
{ | |
'id' => row[0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache | |
import nrrd | |
mcc = MouseConnectivityCache(manifest_file="/data/dynamic-brain-workshop/mouse_connectivity_cache/mouse_connectivity_manifest.json") | |
exps = mcc.get_experiments() | |
pd, _ = mcc.get_projection_density(exps[0]['id']) | |
nrrd.write('some_file.nrrd', pd, options={ 'encoding': 'raw' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
from allensdk.config import enable_console_log | |
from allensdk.api.queries.rma_api import RmaApi | |
import matplotlib.pyplot as plt | |
# print out API queries | |
enable_console_log() | |
# download experiments with passing eye tracking | |
results = RmaApi().model_query('OphysExperiment', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
boc = BrainObservatoryCache(manifest_file='boc/manifest.json') | |
containers = boc.get_experiment_containers(include_failed=True) | |
tagged_containers = [ c for c in containers if c['tags'] ] | |
for tc in tagged_containers: | |
print(tc['id'], tc['tags']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from allensdk.brain_observatory.locally_sparse_noise import LocallySparseNoise | |
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
import allensdk.brain_observatory.stimulus_info as stiminfo | |
experiment_id = 12345 # dummy id | |
analysis_file = '/path/to/analysis.h5' | |
boc = BrainObservatoryCache(manifest_file='boc/manifest.json') | |
data_set = boc.get_ophys_experiment_data(experiment_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import shutil | |
from IPython.display import HTML | |
url = 'https://media.giphy.com/media/demgpwJ6rs2DS/giphy.gif' | |
file_name = 'img.gif' | |
# download | |
response = requests.get(url, stream=True) | |
with open(file_name, 'wb') as out_file: |
NewerOlder