sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
38fbf0bff38b7400195e88c147f68c15bc69d208d0dcdaaddf1683c8c443faa5 | Julia | 43,966 | 1,317 | ###################
## PARAMETERS
###################
const VALID_PARAM_TYPES = Set{Symbol}([
:frequency,
:time_constant,
:rate,
:damping,
:gain,
:delay,
:node_coupling,
:population_coupling,
:sensory_coupling,
:noise_std,
:probability,
:offset,
:potential,
... |
d6ef00a66bdb271a5967687d629ec9496792536658ef0ad3559ea9742475a0c0 | Julia | 45,988 | 1,265 | """
load_data(ds::DataSettings)
Load data from CSV file specified in DataSettings.
# Arguments
- `ds::DataSettings`: Data settings containing data_file path
# Returns
DataFrame with loaded data
"""
function load_data(ds::DataSettings)
# Validate inputs
isnothing(ds.data_file) && error("data_file not spec... |
619066090d90ea311adbc525f1f4cfcb3b2ae618e2c3cd6784af6c5e807c9be2 | Julia | 61,610 | 1,468 | """
-------------
LOSSES - Module containing loss functions and
metrics used in optimization.
-------------
"""
# Main function that takes the loss function as an argument
"""
get_metric_function(loss_settings::LossSettings)::Function
Returns the metric function based on loss_settings.loss_function.
S... |
fd0206b4f8904483c97eab429b2a9ba722cac36acee72ac9c35787d4e5d811e3 | Julia | 65,843 | 1,488 | function list_canonical_node_models()::Vector{String}
return ["WilsonCowan ('WC')",
"AlphaRhythm ('ARM')",
"JansenRit ('JR')",
"Wendling ('W')",
"MoranDavidFriston ('MDF')",
"LileyWright ('LW')",
"RobinsonRennieWrightCortex ('RRWC')",
... |
ab6c89289c7451f3a3f7ef43b4d129a19070a6b0318557f8832dc3b5680cef4c | Julia | 67,019 | 1,466 | # MAIN FUNCTION
function save_optimization_results(optsol::SciMLBase.OptimizationSolution,
optlogger::Vector{OptLogEntry},
setter::Function,
net::Network,
data::Data... |
bfed058a3b5c9ac33d91e125e66c01295555db2abbe78ec9ff512af8a2938a7a | Julia | 73,128 | 1,666 | function _coerce_settings_idx_value(val)::Union{Nothing, Int}
val === nothing && return nothing
if val isa Integer
return Int(val)
elseif val isa AbstractString
parsed = tryparse(Int, strip(val))
return parsed === nothing ? nothing : Int(parsed)
elseif val isa Real
return... |
af1d29b9db59a9ae49b7031ddf414c3f5a24f9920648d731d8bf4bdf96069aee | Jupyter | 493 | 20 | # %%
from datasets import Dataset
from datasets import load_dataset
dataset = load_dataset("MLDS-NUS/Fs_T_Reduced")
import os
os.environ["HF_HOME"] = "~/nfs/hf_cache"
import pickle
# define the directory and file name to save the dataset
save_dir = 'OriginalData'
os.makedirs(save_dir, exist_ok=True)
save_path = os.... |
9b4bc657ba6bdc1329e5966a0188e5d2d9daa1bd64ecc7340d386685564e5cae | Jupyter | 572 | 26 | # %%
import spikeinterface as si
import spikeinterface.preprocessing as spre
import spikeinterface.widgets as sw
%matplotlib widget
# %%
sw.set_default_plotter_backend("ipywidgets")
# %%
rec = si.read_zarr("../data/ecephys_666859_2023-06-15_16-02-43/ecephys_compressed/experiment1_Record Node 104#Neuropix-PXI-100.Pro... |
7fa4ef3beb9f89d729d31fea304e8c40f1c69bfac926f9eeac196a30d03e4e34 | Jupyter | 879 | 29 | # %%
from src.dataload.grouped_pattern import GroupedPatternDataset
# %%
dataset = GroupedPatternDataset(
input_paths=["examples/simulations/pt_files/01_TrainingSet/input"],
target_paths=["examples/simulations/pt_files/01_TrainingSet/target"],
)
print("Dataset summary:", dataset.summary())
print("First sample... |
e6bbff57a8f1c97bea93c883cf49e4ce9dda6df648a07629a3121ac57449c0a8 | Jupyter | 902 | 48 | # %%
from pathlib import Path
import numpy as np
from pynwb import NWBHDF5IO
from hdmf_zarr import NWBZarrIO
# %%
%matplotlib inline
# %%
results_path = Path("../results/")
# %%
nwbfile_paths = [p for p in results_path.iterdir() if ".nwb" in p.suffixes]
# %%
nwbfile_path = nwbfile_paths[0]
# %%
if nwbfile_path.is... |
a554418f883949ba4f6fc573a5030da6e0c96db8a64325f53f8055ee76c6fa8e | Jupyter | 1,044 | 42 | # %%
from nidaqmx import Task
from nidaqmx.constants import LineGrouping
from time import sleep
# %%
'''
for photo-ablation and -activation
the shutter controlled here is the first one, not the one controlled by brunoise
exposure: exposure time in second
interval: the time between each pulse in second
n_reps: the num... |
946237412c0c25a6bee8468ccc43e7a9951e6aa0b6ea705fb85e4f7ec746edcc | Jupyter | 1,261 | 55 | # %%
import scanpy as sc
import pandas as pd
import memento
import numpy as np
import os
# %%
data_path = '/home3/ciervo/scMULTIOME/Analisi/scRNA/memento/'
# %%
# Load matrix
adata = sc.read_mtx(data_path + 'count_mtx.mtx')
# Load metadata
metadata = pd.read_csv(data_path + 'metadata.csv')
adata.obs = metadata
# Lo... |
5d42e0a0a274a80df10d6660d7cfb28f4ae9773fa72500eacadba72a8641810a | Jupyter | 1,459 | 67 | # %%
import pickle
# 加载 train_data.pkl
with open("60V_Dec24.pkl", "rb") as f:
data_60 = pickle.load(f)
if isinstance(data_60, dict):
print(data_60.keys())
print(len(data_60))
print((data_60["60V_Tra_1"]).shape)
import numpy as np
data_60["60V_Tra_46"] = np.delete(
data_60["60V_Tra_46"], [-4, -3,-2,-1], a... |
92f47bcff5cfd2072a11ef790e477d705ce7ba44cad62cd66056aa9cee36c122 | Jupyter | 2,097 | 69 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import numpy as np
import jax
import equinox as eqx
from omegaconf import OmegaConf
# %%
import os
import pickle
from sklearn.model_selection import train_test_split
load_path = os.path.join('OriginalData'... |
7ae5c7fd70aebcebf8dc84dc5a151e1c89485dae6b31e42d2ec86e6569fe70c3 | Jupyter | 2,595 | 73 | # %%
from nilearn import plotting, image
import nibabel as nib
import scipy.io as sio
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.clear()
sys.path.append("/Users/jingyiwu/Desktop/SUITPy-Jingyi_Reslice")
import SUITPy.reslice as reslice
# %% [markdown]
# ### Load files: source image, mask ima... |
72778506182ddee8f833a8754976533b59a7e9f61916182e426013f3cd650902 | Jupyter | 2,816 | 99 | # %% [markdown]
# Connected to ni-vedo-env (Python 3.14.0)
# %% [markdown]
# # Notebook 03: Tissue thickness mapping
#
# **Paper section:** Results — The cranial neural tube maintains a
# dorso-ventral thickness gradient
# **Paper figures:** Fig. 5
#
# This script quantifies local tissue thickness by measuring ... |
4aad15ee122eca883e13ebdfab6e1f5c982acc98b0b9dcc5988e256ca4fada8e | Jupyter | 2,856 | 91 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
848846fefe0e6ddeef265244628bbb577483b02d994c5977790cda1aa66eceb4 | Jupyter | 2,973 | 114 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
fe93106b9e82acaefcdc210865913813eb4bf6750770b771ebc11c96a99d0a24 | Jupyter | 2,999 | 112 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
edf0b63271d68ba9611ad77f670ba3942ea82bb68f5794f85b11df05c7668d55 | Jupyter | 3,001 | 123 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import decoupler as dc
from scipy.io import mmread
from sklearn.uti... |
a5454023be51c866bd3263c0b5c57c98d4414e1cfbc82a7cd6851b69607679d8 | Jupyter | 3,208 | 123 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import decoupler as dc
from scipy.io import mmread
from sklearn.uti... |
7cba6f29549732cd80e054393792aa6ca4a3f700016032111a4ad3e3a5b312c4 | Jupyter | 3,254 | 123 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
53c8d25020d199c41f8205926f5a7748f8df1eb8279779866736ea560e9d0c88 | Jupyter | 3,307 | 107 | # %%
import numpy as np
import matplotlib.pyplot as plt
# -------------------------
# Function Definitions
# -------------------------
def is_valid(pos, env_min=0, env_max=4):
x, y = pos
return env_min <= x <= env_max and env_min <= y <= env_max
def generate_grid_cells(n_cells=1000, arena_size=4, seed=None):... |
9f0e4da0b78a200a1a96e946186011373d1eea96c1fa86f33d992e6b00e6c1ed | Jupyter | 3,345 | 68 | # %% [markdown]
# # Use isolate as a python module
# This example shows the use of the ``isolate`` function by importing it directly to your python environment.
# `isolate` generates a mask for the cerebellum and brain stem for a T1w and/or T2w anatomical image. The mask is then used in the subsequent normalization st... |
5c21fd1f5093fb527930aac5f5254fa785136dcfa4a906084e10695a8b9ddaa8 | Jupyter | 3,496 | 139 | # %%
"""
************************************* READ ME *************************************
This code is for averaging 3 frames with the highest Pearson's correlation to the mid slice
The Pearson file looks like this
**************************************************
Image A: mid
Image B: reg-1-1
Pearson's Coeffici... |
282e1db63eb2a376c3ea1e85ae1f235af2fe38835a85a519e3049ab0f07e3316 | Jupyter | 3,661 | 130 | # %%
import numpy as np
import matplotlib.pyplot as plt
from nxcore.arch.n3b.n3board import N3Board
import nxkernel as nxk
from nxkernel import kernels as K
from nxkernel.kernels.utils.learning_utils import LoihiLearningRule, TraceCfg
import rank_item as RI
# %%
# Loihi system setup
import os
os.environ['NOSLURM']... |
c910e5ed83d3a249f4031954ec7727e0ff5c89d9d657958e8e27ce1e314dc9fd | Jupyter | 3,774 | 97 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
667fd623e4ee903ae2ea197583f88b636e966c33c7f65413dd213e133ccd843a | Jupyter | 3,872 | 110 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
# %%
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import matplotlib
matplotlib.rcParams["image.interpol... |
c7382b2136cdd1e6f9be48c98519086c28ecf4e769b99be244355e5794e38275 | Jupyter | 3,886 | 139 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
cfb23b30cec3b3845118cd5832a1d6317e76eba597f4e14f18154657ec6e3e9c | Jupyter | 3,969 | 118 | # %% [markdown]
# Connected to ni-vedo-env (Python 3.14.0)
# %% [markdown]
# # Notebook 04: pHH3+ mitotic cell density mapping
#
# **Paper section:** Results — Spatial patterns of mitotic activity are
# preserved across global expansion
# **Paper figures:** Fig. 6
#
# This script maps the local density of pHH3+... |
e79fc53f9722c4d50d51354a82752c23f01a336e823ca7dc5d52fb24377da11b | Jupyter | 3,995 | 143 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
5ed098d03e00c01eee9ad15a5bba89079d40cd0d77cd1e1df7c257ed0cf1cba6 | Jupyter | 4,026 | 145 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
be2a20a7f42a5b93f60217ea8fcd31e96032b1fb68469ee2d682d2c553c69c07 | Jupyter | 4,326 | 158 | # %%
from pathlib import Path
import pandas as pd
import numpy as np
import scipy.sparse as sp
import h5py
import anndata as ad
import matplotlib.pyplot as plt
import scanpy as sc
from sklearn.mixture import GaussianMixture
import numpy as np
import ot
from sklearn.metrics.pairwise import cosine_distances
import scipy.... |
c8764991368c5dd702a18164f1bb6ed695c936ac7d270b9be2e62af2109bc2fc | Jupyter | 4,401 | 128 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
e2bcf5279558cd7f5894272ff96af1ebf815ae430cb461924ade40ecacdefb65 | Jupyter | 4,522 | 137 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
# %%
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import matplotlib
matplotlib.rcParams["image.interpol... |
4b41b438c9a78d68ae56e7b33c13c01e82ed3bfa7e03a5f98d0e35312722f3b5 | Jupyter | 4,648 | 161 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
# %% [markdown]
# # NOTE
#
# **If you have not looked at the [regular example notebooks](../2D), please do so first.**
# The notebooks in this folder provide... |
14f50616a7b11b7e94a71e9dec5da3fdbd044a7e91c2373f763b1f1654208431 | Jupyter | 4,723 | 138 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %%
from __future__... |
bc595cace28972799eb102df2e7a0bec4ada5b55583767e9aea97624759bb62d | Jupyter | 4,835 | 114 | # %% [markdown]
# # Reslice Module
#
# The function ``reslice_image`` is used to deform images aligned to the individual anatomical image into SUIT space. We assume you have produced in the previous steps an isolation mask (``sub-ex_T1w_cerebellum_dseg.nii.gz``) and a deformation file (``sub-ex_T1w_to-SUIT_mode-image_... |
d4ca2d793e271039aa19177a02d7bf317f6f64caca98350d6ce86456f0c4267e | Jupyter | 4,920 | 158 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %%
from __future__... |
99d161290615cf18cefc0b8d896bba39d893acf88dd4f90262dae46f98995175 | Jupyter | 4,975 | 136 | # %%
# Set vedo backend to VTK — required for Jupyter notebooks
from vedo import settings
settings.default_backend = "vtk"
# Import all spatchcocking utilities (includes getTightercmap, getAxis, etc.)
from spatchcocking import *
# %%
# Discover all VTK mesh files in the meshes folder.
# Files are sorted: 3 × HH17 (in... |
5451dc4dd3e7d8b1bb836d7ad1830c106112c5749ff84780fff74081eeb73018 | Jupyter | 5,067 | 150 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
import jax.numpy as jnp
from matplotlib import colors
import matplotlib.pyplot as plt
import seaborn as sns; sns.set_theme()
def PlotV(net, config, level_end =500.0, Title = None):
z1_min, z1_m... |
6cef582967115a2785d2bc6dd1f6be86d83abbe87b8123bfc4f98e32dfb5c43b | Jupyter | 5,189 | 149 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
import jax.numpy as jnp
import jax.random as jr
import equinox as eqx
import seaborn as sns; sns.set_theme()
from omegaconf import OmegaConf
from utils_reduced_polymer import PlotV
import jax.nump... |
e0639a97dc0622052f9beecccb6008fe8520f91e037fd97f31b88e669215d67d | Jupyter | 5,281 | 164 | # %% [markdown]
# # Plot from `evaluate_mmd.py` outputs
#
# Loads `outputs/mmd_summary_dt<0.01>.npz` and re-renders the MMD-vs-time figure and the structural-error bar chart.
#
# Each plot lives in its own cell so you can tweak it independently. All the data needed is in the npz; no model is reloaded here.
# %%
impo... |
a3271c907372a854dbc54140196d86b2546aaf02d3136b2023194cc4c656193d | Jupyter | 5,330 | 162 | # %% [markdown]
# Connected to ni-vedo-env (Python 3.14.0)
# %% [markdown]
# # Notebook 02: Surface curvature mapping
#
# **Paper section:** Results — Surface curvature mapping
# **Paper figures:** Figs. 3 (Gaussian curvature), 4 (Mean curvature)
#
# This script computes the local Gaussian and Mean curvature at ... |
a2ebd533a68b6b2e9d8b98f9ce8ed54fe79843d0235b5b8142293adc916ff2a4 | Jupyter | 5,333 | 184 | # %% [markdown]
# Connected to ni-vedo-env (Python 3.14.0)
# %% [markdown]
# # Notebook 01: Mesh generation from TIFF mask
#
# **Paper section:** Methods — Neural tube segmentation
# **Paper figures:** Fig. 1c–d (segmented lumen meshes)
#
# This script converts two binary 3D TIFF segmentation masks (inner lumen ... |
f2b1e6d58ec9649d64ccde18bc40567d46967953f7a66481442e35e025d421da | Jupyter | 5,358 | 155 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
d49cccf2e4f82fd5f6d92ee9860a43fd2be24cf00826b1847973e22a3661263d | Jupyter | 5,658 | 180 | # %%
import sys
from pathlib import Path
from src.preprocessing.prepare_pt_from_tiff import collect_jobs, execute_parallel
tiff_root = Path("examples/simulations/tiff_files")
out_root = Path("examples/simulations/pt_files")
# Creating the pt files for the input image sequences
jobs = collect_jobs(
tiff_root=ti... |
e06255f2a067f90fef67f1e2923a7e5421c0b6b887e0892d39324b9bd812bb8a | Jupyter | 5,716 | 195 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import geopandas as gpd
import celltypist
import decoupler as dc
from scipy.io import mmrea... |
4e12a2437fad2ffc16e3075c8043c972e62c53d815ea2b248cadb0ce279c56ab | Jupyter | 6,185 | 181 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
aaad53e7ab14a4aaeacc2e9c102643d93326161c7c7039e01d92ee266f7b8836 | Jupyter | 6,262 | 306 | # %%
top_bits = [
128, 844, 848, 1019, 327,
80, 5, 807, 989, 314,
784, 587, 736, 220, 885,
721, 850, 711, 206
]
# %%
pip install numpy==1.26.4
# %%
import pandas as pd
import os
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.Draw import DrawMorganBit
# load your dataset
df = p... |
a0934617197e78f81b50ea8ec7558dc6c01cf72f5987bb07820df13bf35031f8 | Jupyter | 6,392 | 179 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
7c7083360aecbc205bdba17932395b84d08321f46f19e99eaed321a7c55000a4 | Jupyter | 6,576 | 173 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import numpy as np
import pandas as pd
from scipy.spatial import KDTree
from tqdm import tq... |
b963c6cd9a7eefb11d37077707e2a3c6d58d92f331f927c36baddeabc26d6d8d | Jupyter | 6,696 | 190 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
515fa3b9c426b4ab189535da33aa79b8336b2d56734d0121380193338431a047 | Jupyter | 6,969 | 181 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import geopandas as gpd
import scanpy as sc
import leidenalg
from tifffile import imread, imwrite
from csbdeep.utils import normalize
from stardist.models import StarDist2D
import squidpy as sq
from stardist.models import StarDis... |
38f562f616b715d643eaa51bcc547ab04546dce1fa0cfa01dcd01729343ea2af | Jupyter | 7,010 | 198 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
8d7d8c3bcd78b849f8cde002cefe258483b8f24fcfe3dc22b1e42051e9e71ec2 | Jupyter | 7,142 | 169 | # %%
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
def generate_data_adjusted(num_objects, num_dimensions, num_encoded_per_dim):
data = np.zeros((num_objects, num_dimensions))
for dim in range(num_dimensions):
for rank in range(num_encoded... |
023c4e15363f4227824a6c949857364c79e249c53ab1f804a161a94dd3cd1ff9 | Jupyter | 7,168 | 228 | # %%
import pandas as pd
# %%
df = pd.read_csv('lipinski_data_corona.csv')
df.head()
# %%
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataset
df = pd.read_csv('lipinski_data_corona.csv')
# Calculate the percentage of each bioactivity class
bioactivity_counts = df['bioactivity_class'].value_count... |
63e4d7089443f33ba7ee4997107a7df9bd357892b7f4586f2b38f7cebcaa1109 | Jupyter | 7,248 | 211 | # %%
import os
import random
from datetime import datetime
from src.utils import io
from src.dataload.grouped_pattern import GroupedPatternDataset
from src.train.trainer import set_seed
from src.models.RESURF_MISRGRU import MISRGRU
from src.train.trainer import init_model_weights, build_optimizer, build_scheduler, Los... |
81dbbd2b200d51326bb3513a653797ff91dd936a09063702ea4d9a6ee84fff40 | Jupyter | 7,380 | 155 | # %% [markdown]
# # Normalization module
# The normalization module of the SUIT toolbox calculates a deformation field that maps the cerebellum of an individual subject to the SUIT template, using the mask generated by the isolation module. The Python-version uses the ANTSPy package to perform the normalization. The de... |
22d5b2da5c0d95a73b6b187d965697d223a1e0414ba2b8dbee18fe5548bb8cd9 | Jupyter | 7,422 | 164 | # %% [markdown]
# # Quick start tutorial for fMRI
# This tutorial is a minimal example of how to use SUITPy to perform a group fMRI analysis for the cerebellum.
# It involves the following steps:
#
# * Isolate the cerebellum
# * Normalize the anatomical to SUIT space
# * Reslice the contrast maps into SUIT space
# * ... |
6b8723a6fcf4060036779df67b7e68ba54e31038ba833af7a5bddcbf31f69dda | Jupyter | 7,609 | 218 | # %% [markdown]
# # Plot from `evaluate_mmd.py` outputs (OnsagerReg variants)
#
# Loads `outputs/mmd_summary_OnsagerReg_dt<DT>.npz` produced by `run_reg.sh` and
# renders the MMD-vs-time figure and the structural-error bar chart for the
# regularized OnsagerNet variants (L2 and Sobolev at different weights).
#
# Layo... |
3fe3e3113e697aeae451051e9ac5d96de4aedb5520042f35935ed9aade0d9574 | Jupyter | 7,673 | 193 | # %% [markdown]
# # Quick start tutorial for anatomical analysis
# Run 2.Quickstart_anatomical.ipynb first to get the Jacabian and xfm transform file.
# To start you need:
# * An anatomical T1-weighted image of each subject (``sub-ex_T1w.nii.gz``)
#
# *Note: You can find additional details and explanations for each s... |
cc1af8a2e5db7cf5c85351c972eae683e3e4d8c76dbc9eae81a8e8e929ecba34 | Jupyter | 7,742 | 215 | # %% [markdown]
# # Polymer dynamics example
#
# First run the example to train and save the trained model
# The rest of the notebook will test the predictions of the mean, standard deviation and the unfolding time distribution.
# %%
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ['XLA_PYTHON_CLIENT_ALL... |
16c1f55bc893799dd754bb0eabafa642fa61a12f6540f893eed6c8b22f977dc9 | Jupyter | 7,777 | 188 | # %% [markdown]
# # Quick start tutorial for anatomical analysis
# This tutorial shows how to use SUITPy to preprocess anatomical MRI data
# for cerebellar deformation-based morphometry (DBM). It covers the
# single-subject pipeline and describes how the outputs feed into
# group-level analysis.
#
# It involves the fo... |
6725f6f41c6d17a3eb04a701a1c7d40bc99d51a68f97bbe23767132f92c244be | Jupyter | 7,848 | 212 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
84ffcea13ad4feee80f28702910772eafc8d936d0828ff9cf1bf7f13e71fad61 | Jupyter | 7,922 | 262 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import numpy as np
import pandas as pd
from scipy.spatial import KDTree
from tqdm import tq... |
0a36d8c18a0244f177ace6cebb9b236e87b05ea44ab38330d93ec5d0da1e83c7 | Jupyter | 7,977 | 189 | # %% [markdown]
# ## Mapping
# The first step to display data on the cerebellar surface is to map it to the flatmap.
# %%
# Import the Suit package
import SUITPy.flatmap as flatmap
import matplotlib.pyplot as plt
import nibabel as nb
import numpy as np
import nitools as nt
# %% [markdown]
# The following command ma... |
10efc96c785d9563e2bf02c408e7ba7a857fd5b82edb7f62ee5b471b3df0494b | Jupyter | 8,023 | 310 | # %%
from pathlib import Path
import pandas as pd
import numpy as np
import scipy.sparse as sp
import h5py
import anndata as ad
import matplotlib.pyplot as plt
import scanpy as sc
from sklearn.mixture import GaussianMixture
import numpy as np
# %%
# ==============================
# Paths
# ============================... |
8a883f19ec846863277419693d8b818860c4725216f00baacc2c7dc35e715ab9 | Jupyter | 8,121 | 237 | # %% [markdown]
# # SCENICplus output
# %%
import pandas as pd
import mudata
import os
os.chdir('/home3/ciervo/scMULTIOME/Analisi/scRNA_scATAC/SCENICplus')
# %%
scplus_mdata = mudata.read("SCENICplus_output_2/scplusmdata.h5mu")
# %%
type(scplus_mdata)
# %%
scplus_mdata.mod
# %%
scplus_mdata.uns['direct_e_regulon_m... |
6f9776bd3d305d8a0bf72c7b14c0e74377a1db03d293ed5d80054a6319c086cc | Jupyter | 8,430 | 266 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import seaborn as sns
import geopandas as gpd
from scipy.io import mmread
from scipy.spatia... |
c8380106f6e90c036c30ded92394ec65da91421a13e7784e1e03c92d407e2aca | Jupyter | 8,698 | 260 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
8630bc663a896039b33ed9ff17e3e0d0c34b26d444615a6ada862927955e6e1c | Jupyter | 8,727 | 217 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
a4ceea25c65484fa90a2b75974b164364c047dd8cf217b6ac4836d72647d515a | Jupyter | 9,097 | 300 | # %%
import argparse
import json
import pickle
import numpy as np
from pathlib import Path
import spikeinterface as si
import spikeinterface.preprocessing as spre
import spikeinterface.generation as sgen
import spikeinterface.widgets as sw
# %%
%matplotlib widget
# %%
data_folder = Path("../data")
results_folder = P... |
0e3833d8d23e780f2dc9e5980379f79ba4aa2b79cb54bde726a43e6dc1d24a8e | Jupyter | 9,152 | 248 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
5ce19cc31464bf6076d193454587174418d78fbb4830d675bf26b6cfe9d9275d | Jupyter | 9,453 | 263 | # %% [markdown]
# # Notebook 05: Spatchcocking — 3D to 2D projection
#
# **Paper section:** Methods — Spatchcocking transformation
# **Paper figures:** Fig. 2 (coordinate system), Figs. 3–6 (heatmaps)
#
# This script flattens the 3D basal surface mesh into a 2D map using the
# spatchcocking transformation, combi... |
f92b2d33dfde771d24902abceaf4297b99088a103863abbb38aa3311e92919dc | Jupyter | 9,585 | 250 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
dcaeca1abd73c9ccdef70cfbce1e0a4b12295e3e896c69087b0a9cde323e55e1 | Jupyter | 9,994 | 301 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
print(jax.devices())
import jax.numpy as jnp
import jax.random as jr
import equinox as eqx
from omegaconf import OmegaConf
import jax.numpy as jnp
import matplotlib.pyplot as plt
import numpy a... |
28d2ee4c83dc11cef8b8ba89f7dbec4eb8fc4f73edc23b991f635bf1903b7820 | Jupyter | 10,138 | 291 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import anndata
import scanpy as sc
import leidenalg
import squidpy as sq
from scipy import sparse
from matplotlib.colors import ListedColormap
import os
import numpy as np
import pandas as pd
from scipy.spatial import KDTree
from tqdm import tq... |
790148784af2c819656c4858fca017eca55ddd82292ded8767762b2b0254762b | Jupyter | 10,344 | 329 | # %%
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
def generate_data_adjusted(num_objects, num_dimensions, num_encoded_per_dim):
data = np.zeros((num_objects, num_dimensions))
for dim in range(num_dimensions):
for rank in range(num_encoded... |
0eec9d5313c6e0dc26ccbe77be7162bd335dce7c2997cbba8bd2eb696d77bb26 | Jupyter | 10,692 | 293 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %%
from __future__... |
8ee1f412b6f7a47179298372297e1801862cb6c3054eb78f49c2efaefa8434bd | Jupyter | 11,044 | 348 | # %%
import torch
import numpy as np
def average_cosine(vectors):
# Normalize each vector
vectors_norm = vectors / vectors.norm(dim=1, keepdim=True)
# Compute the cosine similarity matrix (dot product of normalized vectors)
cosine_similarities = vectors_norm @ vectors_norm.T
# Extract the upper ... |
0f13ddd38bcf2612ff009e6a794512071a4c050849fca4d5f3bbd891bcabff8e | Jupyter | 11,175 | 363 | # %%
%load_ext autoreload
%autoreload 1
# %%
%matplotlib widget
import numpy as np
import matplotlib.pyplot as plt
import nidaqmx
# %%
plt.style.use("dark_background")
# %%
from nidaqmx.stream_readers import AnalogMultiChannelReader, AnalogSingleChannelReader
from nidaqmx.stream_writers import AnalogMultiChannelWrit... |
8689e5ceeb3bff769aa1e0bb969d6a5e7a1cbfda3628b0485417d67a652417fb | Jupyter | 11,232 | 322 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
import jax.numpy as jnp
from jax import grad, jacfwd, jacrev
import equinox as eqx
# %%
def barrier_heighth(energy_model, p1, p2):
def energy_fn(x):
return energy_model(x)
# gradi... |
e7d526e7a509e45e667ef0b677421d3a9b374b0dde43df6a84a004c46c2149e7 | Jupyter | 11,498 | 330 | # %% [markdown]
# ### Experimental validation by coarse-graining of the global EPR for 30V data
# %%
# download experimental data files
# import requests
# urls = [
# "https://huggingface.co/datasets/MLDS-NUS/Experimental_Images/resolve/main/30V_Jan24.pkl",
# # "https://huggingface.co/datasets/MLDS-NUS/Exper... |
2ba5999386f6505e587490f29ed698e778effbb737e9492ec0a8bd338971d1ec | Jupyter | 11,599 | 315 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %%
from __future__... |
472718e1809716c599bbd8e0ef2b2a671198ca642871e1795ed79dad0aff2a86 | Jupyter | 11,688 | 210 | # %% [markdown]
# Run inference and segmentation tasks locally
# ==================================
# This tutorial goes through steps to run inference and segmentation tasks with SEURON deployed locally by docker compose. **You should only use this notebook in JupyterLab hosted by a local SEURON deployment**. In orde... |
a092a8a2ec8ff31b7e0abc118b0474bbd5d653919e7e2cfa5589d432b89023f9 | Jupyter | 11,716 | 338 | # %% [markdown]
# ### Experimental validation by coarse-graining of the global EPR for 60V data
# %%
# download experimental data files
# import requests
# urls = [
# "https://huggingface.co/datasets/MLDS-NUS/Experimental_Images/resolve/main/30V_Jan24.pkl",
# # "https://huggingface.co/datasets/MLDS-NUS/Experi... |
5e4fb64cce86e9c4962c04cdd81ee2739bc6037ff246e85ffc17bae2365cbde4 | Jupyter | 12,116 | 360 | # %% [markdown]
# **Results for SGLD case 1 (Kaczmarz, linear)**
#
# about 30 minutes
# %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
print(jax.devices())
import jax.numpy as jnp
import jax.random as jr
import equinox as eqx
import numpy as np ... |
5495f0c514594bbf99d5913c760ee23d24f453db003f8c3ccecb311cf5a64054 | Jupyter | 13,151 | 383 | # %% [markdown]
# # UIDD hyperparameter sensitivity plots
#
# 这个 notebook 只读取已经保存的结果文件,不重新训练、不重新计算误差。主要数据源:
#
# - `outputs/uidd_sensitivity/analysis/metrics_by_seed.csv`
# - `outputs/uidd_sensitivity/analysis/metrics_summary.csv`
#
# 常用微调入口在下一个单元:可以改字体、图片大小、是否显示 seed 点、是否显示标准差误差棒、是否排除某些 seed,以及每个指标的 y 轴范围。
# %%
fro... |
b4def508ffdc7126e3783fc0970a61bd6b52dafcb813d7ff920278bb0210fa16 | Jupyter | 13,911 | 463 | # %%
"""
************************************* READ ME *************************************
PREMISES:
1. You should save your files as *whatever*destain1.csv
2. BACKGROUND ROI MUST be the last one measured
I have two different files:
1. destain.csv -> all ROIs have been measured in time so I have them listed.... |
2dacc61b78a0d6365d6cc7a775a5bc2ff32e8348435f8e537e5fd77cc71bed60 | Jupyter | 14,244 | 450 | # %%
import torch
import numpy as np
def average_cosine(vectors):
# Normalize each vector
vectors_norm = vectors / vectors.norm(dim=1, keepdim=True)
# Compute the cosine similarity matrix (dot product of normalized vectors)
cosine_similarities = vectors_norm @ vectors_norm.T
# Extract the upper ... |
fe6a1548b4c047c4ec549598779f9ce07cea92a9be4e9487b66d3fe3a875820b | Jupyter | 14,696 | 383 | # %% [markdown]
# **In case of problems or questions, please first check the list of [Frequently Asked Questions (FAQ)](https://stardist.net/docs/faq.html).**
#
# Please shutdown all other training/prediction notebooks before running this notebook (as those might occupy the GPU memory otherwise).
# %% [markdown]
# # ... |
a5ec3004dca54185afe89bcaeb84a11ead8de769a696896b349a54e2a3b2ccae | Jupyter | 14,703 | 388 | # %% [markdown]
# # Go through all steps of building an AMN model
# %% [markdown]
# With *in silico* datasets generated with the E. coli core model.
# %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One ca... |
8bf92b2b610a5c4d87ee7f792f53ba7988abc6ca38581f6c4ede734ef64502d2 | Jupyter | 14,898 | 435 | # %%
import torch
import numpy as np
def average_cosine(vectors):
# Normalize each vector
vectors_norm = vectors / vectors.norm(dim=1, keepdim=True)
# Compute the cosine similarity matrix (dot product of normalized vectors)
cosine_similarities = vectors_norm @ vectors_norm.T
# Extract the upper ... |
922e3116256464cb76ab342fa7560aa4e5c615ae056742f0c57f4eb3df6709b6 | Jupyter | 15,107 | 383 | # %% [markdown]
# # Install conda on your Colab environment
# %% [markdown]
# Ignore this first cell if you are running the notebook in a local environment.
#
# One can still run it locally but it will have no effect.
# %%
# Run this cell first - it will install a conda distribution (mamba)
# on your Drive then rest... |
4a8991f8251bb974195211c464c5800077fc61a1b272e9decbe3326ba0fb1a7a | Jupyter | 15,262 | 284 | # %% [markdown]
# **Note:** file paths in this notebook have been replaced with `/path/to/...` placeholders. Edit them to match your own system before running.
# %%
# First, import some stuff
import numpy as np
import h5py
import nibabel as nib
from mvpa2.suite import Hyperalignment, Dataset
from scipy import stats
im... |
467247d46afcfa1c35ed855573bd88b8c8dce95f6c2cc0aae1ee2737dcc35e3c | Jupyter | 15,297 | 429 | # %% [markdown]
# # Demo: Stardist custom training workflow (2D)
#
# To run the workflow on your own workstation/data, consider using our jupyter notebooks:
# https://github.com/stardist/stardist/tree/main/examples
# %% [markdown]
# # 0. Installation and preparation
# %% [markdown]
# 1. Set the google runtime to G... |
d27730dfdc2d123f3061d299f63f0241a06b8ab775159f5f67646bc5622dd3ed | Jupyter | 15,743 | 385 | # %%
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform"
import jax
import jax.numpy as jnp
from matplotlib import colors
import matplotlib.pyplot as plt
import seaborn as sns; sns.set_theme()
sns.set_theme(style="white")
import numpy as np
import pickle
from skl... |
1c6ca4accace4044695830487ad1c89a94945b1625e928bd96a1b32a9612a205 | Jupyter | 16,207 | 414 | # %% [markdown]
# **Note:** file paths in this notebook have been replaced with `/path/to/...` placeholders. Edit them to match your own system before running.
# %%
# First, generate distance files
import os
from brainsmash.workbench.geo import cortex
from brainsmash.mapgen.base import Base
import nibabel as nib
impo... |
ce5f66751a49b283399783f4660360b5e12b4cb1fb4d790ad8fdda3eb30361dd | Jupyter | 16,246 | 470 | # %%
import numpy as np
import matplotlib.pyplot as plt
from sklearn.manifold import MDS
plt.rcParams.update({'font.size': 16})
def forward(x, W, P, Wc, c):
# print((W@x).shape)
# print(Wc[:, c][None].T.repeat(1,6).shape)
states = torch.concatenate((W @ x, Wc[:, c][None].T.repeat(1,6)), dim=0)
output =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.