sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f547dc1fbc3d47b7ec17d2b993a8201ee0b657d8c8b35a2a14a4a3c321222759
Jupyter
2,586
76
# %% [markdown] # ### Figure 4D Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one expression point >...
0955490681926572fa9413a401c763dedf7157bd240cebf96e55ff909f545930
Jupyter
2,595
108
Omnibus for RACE chi2=54.11935146185722 p=2.2274480814469196e-09 dof=7 expected_lt5=True RACE,col AmericanIndianOrAlaskanNative: chi2=4.547126962489126 p=0.2637922502218775 dof=1 expected_lt5=True proportion ADNI vs NACC: 0.0 vs 0.011811023622047244 counts for ADNI vs NACC: 544 vs 508 RACE,col Asian: chi...
5272326eb3ec9129340e861dd540f05e47252afe9c59f0656057f1081531635e
Jupyter
2,617
120
# %% [markdown] # ## TODO: # # - Add noise to individual diffraction patterns. # %% %load_ext autoreload %autoreload 2 # %% import numpy as np import matplotlib.pyplot as plt from pathlib import Path import matplotlib as mpl import skimage from skimage import filters from tqdm import tqdm import tifffile as tif impo...
bc0eb886286c82393d2494097d5a2fb14955b78dc3ad039f2778475ce4aade87
Jupyter
2,635
66
# %% import glob import json from os.path import dirname import numpy as np ood_path = "../../logs/exp001/exp001a/sweep-2026-04-28_17-42-26_ood_test_predictions/" ood_labels_glob = f"{ood_path}/*/labels.npz" ood_preds_glob = f"{ood_path}/*/predictions.npz" ood_labels_files = sorted(glob.glob(ood_labels_glob), key=la...
129d7a11e4f7832dabbb658f49505adadcbb0212bff086ce25edd389e372450d
Jupyter
2,637
66
# %% import glob import json from os.path import dirname import numpy as np ood_path = "../../logs/exp002/exp002a/sweep-2026-03-30_17-16-31_ood_test_predictions/" ood_labels_glob = f"{ood_path}/*/labels.npz" ood_preds_glob = f"{ood_path}/*/predictions.npz" ood_labels_files = sorted(glob.glob(ood_labels_glob), key=la...
805d3638412d82ebb7ea35c54fb61473363861fcfbf5928fbd5c8e11ef281599
Jupyter
2,773
93
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% root_dir = f'{PODCAST_ROOT}' base_dir...
090c0908c64331d796624463331a52e9e6d051719a1556a06a9491bb02045a7c
Jupyter
2,805
104
# %% import os import pandas as pd from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.Draw import IPythonConsole IPythonConsole.ipython_useSVG=True IPythonConsole.drawOptions.addAtomIndices=True from matplotlib import pyplot as plt from openff.toolkit.topology import Molecule, Topology from openff....
43f0106b4f9a8ccea3497092e107ad28a2c372f583166021ebb5bbd0f3a18070
Jupyter
2,851
83
# %% [markdown] # ### Figure 5F Cell Markers Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one expre...
c714e9262c6b03d20802566ee6aa0f7a66229c5746fe50ec662d0cd16290f832
Jupyter
2,852
83
# %% [markdown] # ### Figure 5I Ion Channels Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one expre...
bdc0b39c996d6f76ec5153b99a9b379280598e8d3cc7ae6bd58ccee3ffe2a446
Jupyter
2,857
83
# %% [markdown] # ### Figure 4G Neruogenesis Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one expre...
d0df6e64bf69a97a71f8e8338c57b5d95740e4fbbbc30ec4ea720417cfbb0346
Jupyter
2,858
83
# %% [markdown] # ### Figure 4G Growth Factors Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one exp...
9a058a1e16c10addb496c497646eeef772e01ec583935159e2a02534ab6568f5
Jupyter
2,861
83
# %% [markdown] # ### Figure 4G Axon Guidance Heatmap Generator # - Reads in data from file specified by `INPUT_CSV` and outputs heatmap to destination specified by `OUTPUT_PATH` # - `FIG_SIZE` determines dimension of final plot width, height in inches # - If `FILTER_CPM` is set to true, genes without at least one expr...
18df68e316e70ddbdce22e1d85e511ba927fa6a64c5053257042ad388a8c5768
Jupyter
2,873
103
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% [markdown] # # Mel-spectrogram predic...
238ac7a2ed5d1a1e02917b8af257366405d3620c64da8e7d69b396547d8e935f
Jupyter
2,876
82
# %% [markdown] # Importing relevant packages and modules # %% %load_ext autoreload %autoreload 2 #%matplotlib notebook %matplotlib inline # %% import sys from pathlib import Path # Plotting import numpy as np from matplotlib import pyplot as plt plt.style.use('bioAI.mplstyle') import copy ''' CUSTOM PACKAGES ''' #...
00478dfba75993a6681bf9965e930e044dd25a7a6ebdad7cada2cb7d977ca7b2
Jupyter
2,877
103
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% [markdown] # # Mel-spectrogram predic...
8c6166abacc777d17ecfe24fc0a88694af938fe641d57fcd1a6a55fa186fd71d
Jupyter
2,921
104
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% [markdown] # # Mel-spectrogram predic...
66a618924de4e3f42ec6273923907a08b8b446fb785746748636b7edfcede351
Jupyter
3,005
75
# %% [markdown] # # How to use embedding nets for high-dimensional observations # %% [markdown] # Many simulators return high-dimensional outputs such as time-series or images. To efficiently learn the posterior given such simulation outputs, `sbi` can employ _embedding networks_ which reduce these high-dimensional ou...
0ccc164454a69370a08e5064e6c311ec6bfc453b28fe5cb069c5263af561a211
Jupyter
3,113
71
# %% [markdown] # # How to use permutation-invariant embeddings for iid observations (for NPE) # %% [markdown] # > Important: This how-to guide is only relevant if you have iid observations, are planning to use NPE, **and** want to use the default `sample_with="direct"` method. However, standard NPE can natively handl...
4208db7d5bc7e0bde0d7594bf5f59130f451c12d1cb9684b9d478e5a0f9ed5eb
Jupyter
3,128
92
# %% import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from rdkit import Chem from rdkit.Chem.Draw import SimilarityMaps from rdkit.Chem import Draw from rdkit.Chem import rdDepictor from rdkit.Chem.Draw import IPythonConsole IPythonConsole.ipython_useSVG = True IPythonConsole.ipython_sho...
8c55114a540ae2e287335cf649cefe2624c38588c7e03e0baa4b3ca5df892300
Jupyter
3,168
98
# %% [markdown] # # Example 1: Load data # # This example illustrates the data preprocessing steps needed to bin grid cell activity and location before processing using GP regression. (We will fit the regression in example 2). # # Neuron `r2405_051216b_cell1816` was recorded by Dr. Marius Bauza and the Krupic lab; t...
9228c873031fa08f0e508a1201d4197cafa6e33829c5afa836ba2be762be9704
Jupyter
3,181
88
# %% import scanpy as sc import scvelo as scv import numpy as np import latentvelo as ltv # %% adata = sc.read('../data/DentateGyrus/10X43_1.h5ad') # %% adata # %% scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) # %% scv.pp.pca(adata) scv.pp.neighbors(adata, n_pcs=30, n_neighbors=30) scv....
fb1b44822f6b99e85c1ad4a585a76c478d27fcd70c7fb8ac505a5c5b47e0da8a
Jupyter
3,197
109
# %% from copy import deepcopy from moleculekit.molecule import Molecule from moleculekit.periodictable import periodictable import numpy as np import torch as pt from torch.utils.benchmark import Timer from torchmdnet.models.model import create_model # TensorNet model_1 = create_model({ 'embedding_dimension': 32...
8ef2d8d5d7086bc2be5e576b247497856531181e4b6420b7b07c4d1290a56841
Jupyter
3,216
90
# %% import scanpy as sc import scvelo as scv # %% adata = sc.read('../../../../../retina/retina.h5ad') # %% adata # %% scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) # %% scv.pp.pca(adata) scv.pp.neighbors(adata, n_pcs=30, n_neighbors=30) scv.pp.moments(adata, n_pcs=None, n_neighbors=No...
24ec0a54602d1fde4bced5f940bd82ee5ffaf413a7932c3b4b3dc00d91b0a54f
Jupyter
3,243
103
# %% import latentvelo as ltv import numpy as np import scanpy as sc import scvelo as scv import torch as th # %% [markdown] # # Read and plot data # %% adata = sc.read('../../scEUseq_organoids/scEU_organoid.h5ad') cell_mapper = { '1': 'Enterocytes', '2': 'Enterocytes', '3': 'Enteroendocrine', '4': '...
0c6f3de52bd3d89f2997c4f1711f7691b365d673bea0a653942a908dc833b9e3
Jupyter
3,251
85
# %% [markdown] # # How to run TARP # %% [markdown] # TARP is an alternative calibration check proposed recently in https://arxiv.org/abs/2302.03026. # # In contrast to SBC (Talts et al.) and expected coverage based highest posterior density regions # (Deistler et al.,), TARP provides a necessary *and sufficient* co...
17520677722abb34b5c143225f347414f6ba48e84916da4cec5270e71b5083ff
Jupyter
3,254
97
# %% [markdown] # # How to use time-series embeddings # # This short guide shows how to use **time-series embedding networks**: # - `CausalCNNEmbedding` # - `TransformerEmbedding` # # We’ll use a simple `torch.randn` simulator to demonstrate the workflow. # # > In real use, replace `torch.randn` with a dynamical sim...
0c4c8c17f9b28d6b4b51fccb370e029df7e52eae871da18520940c4e3811b66a
Jupyter
3,301
91
# %% import scanpy as sc import scvelo as scv import numpy as np import latentvelo as ltv # %% adata = sc.read('../../../..//Pancreas/endocrinogenesis_day15.5.h5ad') # %% adata # %% scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) # %% scv.pp.pca(adata) scv.pp.neighbors(adata, n_pcs=30, n_...
0f654061d0fd63d14c79650527e54dbdedf9673af63b10bcfd10a20189edb166
Jupyter
3,328
101
# %% %load_ext autoreload %autoreload 2 import sys; sys.path.append('../../'); from config import * configure_pylab() rc('text.latex',preamble=r"\usepackage{amsmath}") matplotlib.rc('text', usetex = True) params= {'text.latex.preamble' : r'\usepackage{amsmath}'} plt.rcParams["xtick.major.size"] = 0 plt.rcParams["ytick...
d341b19df4b578d8c99efe29237a55b2969f5b4c06eb042dfdc775b4c19716a2
Jupyter
3,328
79
# %% [markdown] # # How to use GPUs # %% [markdown] # `sbi` supports GPU training. GPU will speed up training if you use a very large # batch-size, if you use a large embedding network, or if your simulation outputs are # high-dimensional. This guide shows you how to train and perform inferencce on GPU. # %% [markdow...
a669c2830a118d76a1d0904ebc978e813102bc78ada1f7215b404b7b1899ad93
Jupyter
3,331
98
# %% %load_ext autoreload %autoreload 2 import sys; sys.path.append('../../'); from config import *; configure_pylab() # %% L = 128 fn = datafiles[6] #3 fn = 'r2405_051216b_cell1816.mat' fn = 'r2288_180515b_tet2_cell2_GC.mat' # Best nsamples = 4000 upsample = 2 Nh = 90 hh = linspace(0,2*pi,Nh+1)[:-1] ...
8f19b98419821fecf241d1f8a26a98e00b85ae59a4191b86106f410a2a5f05e9
Jupyter
3,338
89
# %% import re import numpy as np log_file = "logs/anysleep_mnc_nt1_sfs.log" # srs = [1, 2, 4, 8, 16, 32, 64, 128, 256, 384, 640, 960, 1920, 3840] srs = [1, 128] n_classes = 5 possible_triplets = [f"{i}{j}{k}" for i in range(n_classes) for j in range(n_classes) ...
5e6bc02c81deb4a0b3d380996f9db4d409933cfe7337be93180e76e8d88a97a7
Jupyter
3,342
89
# %% import re import numpy as np log_file = "logs/anysleep_cap_insomnia_sfs.log" # srs = [1, 2, 4, 8, 16, 32, 64, 128, 256, 384, 640, 960, 1920, 3840] srs = [1, 32] n_classes = 5 possible_triplets = [f"{i}{j}{k}" for i in range(n_classes) for j in range(n_classes) ...
2fea984bc37c8eb84fcb79d09c7f217ee0eea23c2bea2c1a3f329babdd34a6ee
Jupyter
3,343
89
# %% import re import numpy as np log_file = "logs/anysleep_dodo_vs_dodh_sfs.log" # srs = [1, 2, 4, 8, 16, 32, 64, 128, 256, 384, 640, 960, 1920, 3840] srs = [1, 256] n_classes = 5 possible_triplets = [f"{i}{j}{k}" for i in range(n_classes) for j in range(n_classes) ...
ef19c9972f2606f6c3253356625f54a55a34563b85869dc8baeb3d27275b35a4
Jupyter
3,343
72
# %% from imagen_post_hoc_helper import * %matplotlib inline # %% DATA_DIR = r"/ritter/share/data/IMAGEN" SAVE_DIR = r"/ritter/share/jihoon/imagen_ml/posthoc_analysis/figures" posthoc = IMAGEN_posthoc() # %% for tp in ['FU3', 'FU2', 'BL']: f, axes = plt.subplots(7,1, figsize=(10,20), sharex=True, sharey=True) ...
d8c224dacfc7656b2accd52fe7fc97c19e61f0951496bced462c2af1548c203a
Jupyter
3,348
97
# %% [markdown] # # Example 3: Optimized hyperparameters # # In this example, we optimize the period and variance of the GP prior using the evidence lower bound. # # Neuron `r2405_051216b_cell1816` was recorded by Dr. Marius Bauza and the Krupic lab; They have kindly shared this data to evaluate these GP methods. Ple...
9ba5317f7ce105688fd86dd0c0441a4de7a0d614cae3489505efb274d11ae5ef
Jupyter
3,365
82
# %% import pandas as pd import numpy as np import scipy.stats # %% survey_df = pd.read_csv('../data/duke_study-202112/survey-202112 - Data.csv') print(survey_df) # %% property_types = ['image_quality', 'acquisition_ease', 'software', 'tactile', 'overall_onsd'] #[x.replace('-butterfly', '') for x in survey_df.columns...
577552d085a70f1ec32ef00c5547b3165ab1e2f4fd3512003808b25ccb5994cd
Jupyter
3,374
90
# %% [markdown] # # Example 4: Confidence intervals # # This example approximates confidence intervals for peak location using either sampling within each grid-field's Voronoi region, or a Quadratic approximation at the peak. # # Neuron `r2405_051216b_cell1816` was recorded by Dr. Marius Bauza and the Krupic lab; Th...
2060219bad7ca917228f3890bc948c87aa654001e262c322c9798fd334f6260e
Jupyter
3,401
120
# %% %load_ext autoreload %autoreload 2 import sys; sys.path.append('../../'); from config import *; configure_pylab() # %% # Plot helpers def quickpeaks(s): return ( (s>roll(s, 1,1))& (s>roll(s,-1,1))& (s>roll(s, 1,2))& (s>roll(s,-1,2))& (s>roll(s, 1,(1,2)))& (s>rol...
604b86941ba64caddffca3e789b89d87700312ea4a024c0334e4f69def5cd66a
Jupyter
3,426
111
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% [markdown] # # Create GPT-2 embedding...
c104592bdf151dca66a380b36578c9a7f9abdf396d04a7430fbc36d7879bc49c
Jupyter
3,443
97
# %% [markdown] # # How to run expected coverage # %% [markdown] # Expected coverage provides a simple and interpretable tool to diagnose issues in the posterior. In comparison to other diagnostic tools such as L-C2ST, it requires relatively few additional simulations (~200) and it does not rely on any additional hype...
1ad0d62fa05386d4e3bbed21fc6996b2162d300dfd169e8c72b34ad3a15b4d31
Jupyter
3,473
104
# %% [markdown] # # Training a ML Model using the serenityff-charge package # # ## Import necessary packages and set file paths: # # The [Trainer](../gnn/training/trainer.py) is a class that facilitates the training of an ML model and the [ChargeCorrectedNodeWiseAttentiveFP](../gnn/utils/model.py) is the model, that ...
303f571a56e1e680d1a396e5ab04df33c711c220364c8a3f37d099572c56f752
Jupyter
3,497
90
# %% import scanpy as sc import scvelo as scv import latentvelo as ltv import numpy as np # %% adata = sc.read('../../../../DeepVeloData/deepvelo_data/h5ad_files/Hindbrain_GABA_Glio.h5ad') # %% scv.pp.filter_and_normalize(adata, min_shared_counts=30, n_top_genes=2000) # %% scv.pp.pca(adata) scv.pp.neighbors(adata, n...
397d02f8c3f3e5ace0e804073aed13261cb90c9d1d0c817c4926382c8f0061ca
Jupyter
3,508
77
# %% [markdown] # # Customizing the density estimator # %% [markdown] # `sbi` allows to specify a specific density estimator for each of the implemented methods. # We support a variety of density estimators, e.g., mixtures of Gaussians, normalizing # flows, and diffusion models. Some of the density estimators are impl...
7cce6d2be728268d4daf663d949b9e06bce0a379e4d77164c1667ed28bf8634d
Jupyter
3,569
89
# %% [markdown] # # How to run simulation-based calibration (SBC) # %% [markdown] # Similar to expected coverage, simulation-based calibration (SBC) provides a simple and interpretable tool to diagnose issues in the posterior. It also requires relatively few additional simulations (~200) and it does not rely on any ad...
6c656acde73808d3d5bbe91ec4b8ff48fc4a4e41cc8d62f08b8ad25a0c9e53fa
Jupyter
3,573
122
# %% %matplotlib inline import scanpy as sc import scrublet as scr import scipy.io import matplotlib.pyplot as plt import numpy as np import pandas as pd import os import gzip # %% ## rewrite 'load_genes' in scrublet to make it compatiable to gzip files def load_genes(filename, delimiter='\t', column=0, skip_rows=0): ...
d007f663d953366d02b543a9ae2967bd35f1444e2cc961aadc65a9bb2d249475
Jupyter
3,601
105
# %% import scanpy as sc import scvelo as scv import pandas as pd import numpy as np import latentvelo as ltv # %% labelling = sc.read('../../../../scNT-seq/Neu_one_shot.h5ad') splicing = sc.read('../../../../scNT-seq/neuron_splicing_4_11.h5ad') splicing.obs = labelling.obs.loc[splicing.obs.index, :] meta = pd.read_...
13af3b4572169ebc542800ad562a169e2a0013e800640d24901ec5cc260ca886
Jupyter
3,642
134
# %% [markdown] # ### Imports # %% %load_ext autoreload %autoreload 2 #%matplotlib notebook %matplotlib inline # %% # Computational packages import numpy as np import matplotlib.pyplot as plt import torch import tqdm plt.style.use('../bioAI.mplstyle') # General packages import datetime import sys import os # custom...
74349084f51784230f28558276e4bd61f7e3946bab7f1de802f336a260f39298
Jupyter
3,643
79
# %% [markdown] # # How to define custom neural nets # %% [markdown] # `sbi` allows you to specify a specific density estimator for each of the implemented methods. # We support a variety of density estimators, e.g., mixtures of Gaussians, normalizing # flows, and diffusion models. Some of the density estimators are i...
c826823d42bb90b9a8d8706ac08722b3eda6754f072a0779513a360fdf9eec03
Jupyter
3,647
130
# %% %load_ext autoreload %autoreload 2 # %% import sys; sys.path.append('../../'); from config import * configure_pylab() plt.rcParams["xtick.major.size"] = 0 plt.rcParams["ytick.major.size"] = 0 # %% L = 128 #fn = 'r2289_250515b_tet2_cell2_GC.mat' fn = 'r2405_051216b_cell1816.mat' data = Dataset.from_fi...
96065b2187d67ba0f4e73ffe2429a6e18614dc8705f7352334d3b59ad82fc8c3
Jupyter
3,668
131
# %% import numpy as np import matplotlib.pyplot as plt # %% [markdown] # # LatentVelo runtimes # %% names = ['mouse_erythroid', 'scnt', 'organoid', 'pancreas', 'mouse_hematopoiesis', 'bonemarrow', 'dentate_gyrus', 'retina', 'hindbrain', 'hindbrain_gaba'] nice_names = ['Mouse erythroid', 'scNT neurogenesis...
d1fcde68edde747ba1ac5e696f1fb7f90f7c1f3ede5f6fdd9f7db81ddc897586
Jupyter
3,678
117
# %% !pip install split-folder # %% import os import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import numpy as np import pathlib import cv2 #import splitfolders # %% train_dir = "data/raw/Original/TRAIN" img_width = 48 img_heigh...
ab06f8bc808b3a3f72e78820471a3f62eb12a392a41ee8ce048335728566baf1
Jupyter
3,690
212
# %% import matplotlib %matplotlib inline try: reload # Python 2.7 except NameError: try: from importlib import reload # Python 3.4+ except ImportError: from imp import reload # Python 3.0 - 3.3 import MacUtils as mut reload(mut) # %% reload(mut) wt1, l1 = mut.getCls13a14a3() #wt1, l1 =...
3afbb8a0323af06f537d5893a0db8c5b88757368c1cc3f51e84e8a1968d34844
Jupyter
3,746
94
# %% import mne import os import pandas as pd import numpy as np from scipy import signal, stats import matplotlib.pyplot as plt # %% data_df = pd.read_excel(r'C:\Users\Lenovo\1代码 REM中beta升高\upload_data\figure1ef_data.xlsx', index_col = [0]) # %% freqs = np.array(data_df['freqs']) # %% dys_wak...
2b13cd26fed5c6a74c8b4fe7d1556c1801749937535cf6b2c2f9f097b138e9b2
Jupyter
3,863
122
# %% [markdown] # # TorchMD API tutorial # %% [markdown] # ## System setup # %% [markdown] # We use the `moleculekit` library for reading the input topologies and starting coordinates # %% from moleculekit.molecule import Molecule import os testdir = "../tests/data/prod_alanine_dipeptide_amber/" mol = Molecule(os.p...
3acf243912b90edfa8bf5b4f76a187dfe869e95968a2d04d1edc5fc86466e8e6
Jupyter
3,874
127
# %% [markdown] # # Single Cell Analysis of D7, D14 and D21 RGC-iNs # %% import scanpy as sc import pandas as pd sc.settings.verbosity = 3 # hints # %% [markdown] # ### Data collection # %% ### Read data into an AnnData objects (this step may take a few minutes the first time) ### adata_7 = sc.read_10x_mtx( f...
85e8f0715ef6aee1495571dcbb0e4db99beb97f726980ab689805f85d9429d25
Jupyter
3,893
101
# %% import scanpy as sc import scvelo as scv import latentvelo as ltv import numpy as np # %% adata = sc.read('../../../../Ranek_purvis2022/adata_nestorowa.h5ad') scv.pp.filter_genes(adata, min_shared_counts=30) ltv.utils.standard_clean_recipe(adata, spliced_key='spliced', unspliced_key='unspliced', ...
38b668edf1ff6553387c099742b7ffcf6afb14a6ebc3d953d793f972b655b26a
Jupyter
3,897
101
# %% import latentvelo as ltv import scvelo as scv import numpy as np import scanpy as sc np.random.seed(1) # %% adata = scv.datasets.pbmc68k() scv.pp.remove_duplicate_cells(adata) adata.obsm["X_tsne"][:, 0] *= -1 # %% adata.obs['celltype_names'] = adata.obs.celltype.values # %% scv.pp.filter_genes(adata, min_shared...
89be33cd3102e603efd630f94117629950cc2c7a4058178d171261e1af666df0
Jupyter
3,923
39
# %% [markdown] # # How to choose an inference method # %% [markdown] # `sbi` implements three main neural inference families: # # - `NPE` (Neural Posterior Estimation), # - `NLE` (Neural Likelihood Estimation), and # - `NRE` (Neural Ratio Estimation). # # Each family learns a different probability distribution from...
8c122eab8ca5635b69244d0cb222c72195c92c3d8ad6669d7c81fa7cd17be53d
Jupyter
3,939
158
# %% [markdown] # # Single Cell RGC Subtype Marker Expression Analysis in Day 21 RGC-iNs # %% import scanpy as sc import matplotlib.pyplot as plt sc.settings.verbosity = 3 # hints # %% [markdown] # ### Data Collection # %% # Read data into an AnnData object (this step may take a few minutes the first time) adata =...
0083995b91265c1736eb91e8a1f9805c319c13304666c1044e3b86b3e28efcb1
Jupyter
3,953
120
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% [markdown] # # This script is for get...
e2943e762eba061c78a3b4f29d7363a0bb8bbb76aa1c5cdd518c546325220778
Jupyter
4,006
115
# %% #import scib import numpy as np import scanpy as sc import scvelo as scv import latentvelo as ltv # %% adata = sc.read('../../../../scEUseq_organoids/scEU_organoid.h5ad') cell_mapper = { '1': 'Enterocytes', '2': 'Enterocytes', '3': 'Enteroendocrine', '4': 'Enteroendocrine progenitor', '5': 'Tu...
3aa5bd8e843cf17d47571d2420e32d2104dbae371d73b30be8ec1f688feff993
Jupyter
4,049
117
# %% [markdown] # # ### Implementation of sparse coding and learning with different regularizers # #### Regularizers: ISTA, Hard thresholding, $\lambda_{1/2}$ thresholding, and CEL0 # %% import numpy as np import matplotlib.pyplot as plt from tqdm.notebook import tqdm import utils from generativeModels import Sparse...
83642545ce9e24a43a03eb40737af59389c9f1ee43a524d4125a56e54229e577
Jupyter
4,070
107
# %% import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import sys sys.path.append('../') from jax.config import config import tensorflow as tf import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' tf.config.set_visible_devices([], device_type='GPU') import u...
5ecfaf4892b5feddb6e6116b135c9a095814581c0356729242d5db3639f2792f
Jupyter
4,087
104
# %% import scanpy as sc import scvelo as scv import pandas as pd # %% adata = sc.read('../../../../hindbrain_pons/OligoPons_metafromSten.loom') embedding= pd.read_csv('../../../../hindbrain_pons/embedding.csv', sep=',', index_col=0) annotations = pd.read_csv('../../../../hindbrain_pons/annotations.csv', sep=',', inde...
43695247fe2f319e34040bd69b97181ca9e774ce9c030e7fd7f8ca7382748330
Jupyter
4,098
96
# %% %load_ext autoreload %autoreload 2 import sys; sys.path.append('../../'); from config import * configure_pylab() # %% W = 100 # grid idth H = 100 # grid height P = 10 # cell period L = (H,W) # Plot helper figure(0,(12,6),200) nr = nc = 4; ip = 1 kernels = [] def im(k,t): global nr,nc,ip,kernels subplot(...
b2a091759aec8b3f35042d7944a7d22052ddfd1e03982798bb1997bf3d4ea3d0
Jupyter
4,103
160
# %% import pandas as pd import matplotlib.pyplot as plt import hddm import numpy as np import pickle from patsy import dmatrices, dmatrix, demo_data # %% [markdown] # # EXP2 iTBS # %% data = hddm.load_csv('exp2_DDM.csv') # %% [markdown] # ## Left consonant quiet # %% D_L=data.loc[data['turn_type'].isin(['Left iTBS...
c1495a210542254a0f6d9fbf3c3bb4d39428d1f2ed077f573f4a1da51f69be45
Jupyter
4,109
157
# %% [markdown] # ### Imports # %% %load_ext autoreload %autoreload 2 #%matplotlib notebook %matplotlib inline # %% # Computational packages import numpy as np import torch import tqdm # Plotting import matplotlib from matplotlib import pyplot as plt plt.style.use('bioAI.mplstyle') # General packages import datetim...
ce03e1504bc4545481f05665365fd239a9bf80bf0c7f51c3503c52d3035a58fc
Jupyter
4,118
131
# %% [markdown] # # BLIP: Inference Demo # - [Image Captioning](#Image-Captioning) # - [VQA](#VQA) # - [Feature Extraction](#Feature-Extraction) # - [Image Text Matching](#Image-Text-Matching) # %% # install requirements import sys if 'google.colab' in sys.modules: print('Running in Colab.') !pip3 install ...
e9968babac5e60fec020c915358567edcca35805943fedf8bc8fefdf260d0f2b
Jupyter
4,122
134
# %% import pandas as pd import matplotlib.pyplot as plt from clustering_traditional import TraditionalClustering from clustering_statistics import get_cluster_statistics from clustering_word2vec import Word2VecModel # %% # An example how to perform traditional list-based clustering of semantic VFT # create the clust...
3f80d9a65f4f36178bfa684f1bd412fb88d0d56b921b569048122e5a1dea2dab
Jupyter
4,166
108
# %% import mne import os import pandas as pd import numpy as np from scipy import signal, stats import matplotlib.pyplot as plt # %% data_df = pd.read_excel(r'C:\Users\Lenovo\1代码 REM中beta升高\upload_data\figure2adg_data.xlsx', index_col = [0]) # %% freqs = np.array(data_df['freqs']) # %% dys_wa...
702c8a18ab38ece7cb550ab4225141298a96112b0ffb73b89c88c90c9c1f5d67
Jupyter
4,212
133
# %% from importlib import reload import os from rdkit import Chem from copy import deepcopy import numpy as np import pandas as pd import time from serenityff.charge.tree_develop.develop_node import develop_node from serenityff.charge.tree.tree import tree from serenityff.charge.tree.node import node from serenityff...
abbd91ca7ef730c88d4de2b169803673710b888e8d14c036c2a94f036830412d
Jupyter
4,230
108
# %% %load_ext autoreload %autoreload 2 import os base_path = os.path.abspath(os.path.join(os.getcwd(), '../')) os.chdir(base_path) # %% from src.utils import * import pandas as pd # %% batch_size = 4096 max_iter = 1000 learning_rate = 0.005 n_repeat = 10 model = tf.keras.models.load_model('models/siren') # %% a...
9a219a9185bb42a77b0ad184c4a6665747e1a62464f62254646da80423c2e2fd
Jupyter
4,249
90
# %% [markdown] # # 1. Oligo Sequences Generation # # The first step in building a pipeline is generating oligo sequences which can be loaded into an OligoDatabase. The `OligoSequenceGenerator` class can be used for generating new oligo sequences and allows the user to either design oligos from reference genomic seque...
57bfd50863b96a6ec6b49db1a51673791d0a07ab8365980ae2ee11ca6048df1a
Jupyter
4,266
115
# %% [markdown] # # Computational Requirements Comparison Across Architectures # # This notebook visualizes how computational cost scales with the number of input channels # for different sleep staging architectures. # # ## Purpose # # Compare the computational complexity of four fusion strategies as the number of E...
c755d30e86fded858f9a283b00924db12c5ef8b4760876e6c37babb8ac4b94eb
Jupyter
4,302
129
# %% [markdown] # # Numerical simulation of FAST applied to a 2d film (see paper text for details) # %% %load_ext autoreload %autoreload 2 # %% import fast.s26_analysis.utils as utils from fast.utils.generate_scan_pattern import generate_scan_pattern as gcn import numpy as np import matplotlib.pyplot as plt from p...
7702b7a81e219dae8ccfca63bc10959c8405dbfd14b45d581f1669c02307c9c3
Jupyter
4,315
126
# %% [markdown] # # High-Frequency Sleep Staging: Downstream Task Performance # # This notebook creates publication figures showing how downstream task performance # varies with the temporal resolution of sleep stage predictions. # # ## Panels # # 1. **ISRUC Age Prediction** (left) # - Task: Predict subject age f...
a9857887a30a6b69f9dc7c20c74a162f896405f83f154269307ad0c36fb22316
Jupyter
4,355
106
# %% [markdown] # # How to detect model misspecification # %% [markdown] # "Model misspecification" means that the simulator can, for no parameter set, match the observation. In that case, all methods implemented in `sbi` will likely perform poorly. As such, it is essential to detect whether the model is misspecified ...
2c33bc18edd517f724b51a16529cc6dfc636e5264d39fca4d75654b0de9c9908
Jupyter
4,383
91
# %% [markdown] # ## BayesDesign # # Protein design for stability and conformational specificity, maximizing the p(structure|sequence) objective. # # # <figure> # <img src="https://github.com/dellacortelab/bayes_design/blob/master/data/figs/bayes_design.png?raw=true" width="700"> # </figure> # # # # [Stern J., Fr...
8d45876e2d904f5ce234215f611e590a1ad35560e904318fc343ee5101d93b0e
Jupyter
4,390
205
# %% from keras.datasets import mnist # %% from keras.utils import np_utils # %% import numpy as np import keras # %% (train_X, train_y), (test_X, test_y) = mnist.load_datad_data() # %% from matplotlib import pyplot # %% from matplotlib import pyplot for i in range(9): pyplot.subplot(330 + 1 + i) pyplot....
02631925892089af7aa975121d01e0c3f1144be8bb131fe1aff3f32345f8cf60
Jupyter
4,414
119
# %% import os import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # %% df = pd.read_excel(r'C:\Users\Lenovo\1代码 REM中beta升高\upload_data\figure2bdefhi_data.xlsx') # %% nrem_all = df.groupby('state').get_group('nrem').reset_index(drop = True) rem_all = df.groupby('state').get_gr...
350472619c11b6c9864a128d32676f722887a06f3e060a1a6c032b6d66e46a05
Jupyter
4,474
165
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% [markdown] # #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. # %% base_dir = f"{PODCAST_ROOT}/Encoding_...
03be2d9b762e3a2d5250e3a8f403161c88b844c8b08c67d4672cf279998516df
Jupyter
4,523
120
# %% [markdown] # # How to run L-C2ST # # Tests like expected coverage and simulation-based calibration evaluate whether the posterior is **on average across many observations** well-calibrated. Unlike these tools, L-C2ST allows you to evaluate whether the posterior is correct **for a specific observation**. While thi...
7d9348b50989c3d23d82a84d094ed9c84991ba86fbab8b21e2a65c4ccca7e0da
Jupyter
4,537
174
# %% #%matplotlib widget %load_ext autoreload %autoreload 2 #%matplotlib notebook #%matplotlib inline %matplotlib widget # %% import tqdm import torch import numpy as np import matplotlib.pyplot as plt from ripser import ripser from persim import plot_diagrams import utils plt.style.use("bioAI.mplstyle") import...
794ab5a133a1ad8949a9cb7b7ba7551f0915a9b29f0f237e8d90b2f49bcf7fe1
Jupyter
4,619
240
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline # %% df = pd.read_csv('C:\\Users\\arif\\OneDrive\\Journal Paper\\Code\\Irshad\\Dataset\\2_Dataset_cyclic_holi.csv', parse_dates=['Date'], index_col='Date') # %% [markdown] # # Days Counts (manually) in...
631968a8db3d0b5eefa8d27d58717bdf63ae2692e922010c7358c6e70d1bec59
Jupyter
4,624
136
# %% [markdown] # # Numerical simulation of FAST applied to a generic image from scikit-image # %% %load_ext autoreload %autoreload 2 # %% import fast.s26_analysis.utils as utils from fast.utils.generate_scan_pattern import generate_scan_pattern as gcn import numpy as np import matplotlib.pyplot as plt from pathlib...
c1b0b962055ffd6e7bf19ba5d44bd773a2dba8dd4bbc7f878f21bd6284dab638
Jupyter
4,626
161
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline # %% df = pd.read_csv('C:\\Users\\arif\\OneDrive\\Journal Paper\\Code\\Irshad\\Dataset\\6_Dataset_cyclic_holi.csv', parse_dates=['date_and_hour'], index_col='date_and_hour') # %% df # %% [markdown] # ...
71c919c42b6abd9a4dea3d06cfbf9d9189a1ec783d7bb3c2727d08d45a01b645
Jupyter
4,688
151
# %% import sys if "../../" not in sys.path: sys.path.append("../../") import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import cm import sys import os from os import path from scipy import stats, signal, ndimage from tqdm.notebook import tqdm import math ...
7e6c1fadee8ed3a64a0796440b4b5573b698fa413634bd072b0316dc9391e33e
Jupyter
4,703
113
# %% [markdown] # # How to tune hyperparameters with Optuna # %% [markdown] # This guide shows a minimal `optuna` ([documentation](https://optuna.org/)) loop for hyperparameter # tuning in `sbi`. Optuna is a lightweight hyperparameter optimization library. You define # an objective function that trains a model (e.g., ...
c19274733a04e3add1f4fa49c0fb16de4e93c87c49b19d2ccea3ad52e8962a34
Jupyter
4,803
146
# %% import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast") # set to your copy of the dataset # %% melspec.shape # %% """ Check dimensions of mel-spectrogram and Whisper features before and after PCA reduction. Run this in Jupyter Notebook to see how PCA transforms your featu...
1e271ac79279cad940864e4313c9faefa8b14ff26fe53478ef5be919ea6e1707
Jupyter
4,812
150
# %% import numpy as np import torch.nn as nn import torch.optim as optim from lr_scheduler import CyclicCosineDecayLR import matplotlib.pyplot as plt import warnings # pytorch warns when scheduler.step() is called before optimizer.step() # ignore warnings in this notebook warnings.filterwarnings('ignore') # %% cla...
a49dfd4ecd7fd5fd754569e231e14b631c742f98e777e3e965cb1a0e40217bbf
Jupyter
4,933
180
# %% [markdown] # # PQMF filter design example # # This notebook is for checking the filter response of PQMF. # %% import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (16, 9) %matplotlib inline from scipy.signal import freqz from parallel_wavegan.layers import design_prototype_filter # check prototype ...
b76bea0333d02e1a4e99a1e54a7821a467771c6e0ede3a1e1ea8189b98739075
Jupyter
4,957
157
# %% import os import numpy as np import pandas as pd import seaborn as sns import matplotlib import matplotlib.pyplot as plt from scipy.stats import spearmanr # %% def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel="", **kwargs): """ Create a heatmap from a numpy array and tw...
999733d6f594a5c596e070e42ca4d1c4311b85df96de7c71a2302f1c0831fe79
Jupyter
4,994
133
# %% %load_ext autoreload %autoreload 2 import sys; sys.path.append('../../'); from config import * configure_pylab() # %% [markdown] # # Posterior confidence via sampling # %% [markdown] # ### Retrieve model # %% L = 128 nsamples = 500 # Samples to draw res = 1 # Upsampling resolution relative to gri...
d56a81fe272aed45c4594f588c9ce0c18af0428ede65364953ce51de163d1e50
Jupyter
5,020
129
# %% [markdown] # # How to specify a custom prior (e.g., multiple independent priors) # %% [markdown] # `sbi` works with torch distributions only, so we recommend using those whenever # possible. If you want a different prior in each parameter dimension, then you # can use the `sbi` utility `MultipleIndependent`: # %...
6e0cc91ac2ea5c5f0eca4f6c02f7dafb1cdc1947ca9203f59c4391d6a3ef1461
Jupyter
5,043
135
# %% import numpy as np import umap import matplotlib.pyplot as plt import matplotlib from sklearn.decomposition import PCA from ripser import ripser from persim import plot_diagrams # %% def synth_grid(xx, yy, phase = 0, orientation = 0, f = 3): """ Create ratemaps for n synthetic grid cells params: xx,...
f3aca236c96fd39c9b855c4539b01bd0566efb0f9f641052766339b519fdf4a5
Jupyter
5,099
153
# %% [markdown] # # Example 5: Heading dependence # %% [markdown] # Inspect how grid maps change depending on the animal's heading. # See `heading.py` for subroutines used in this notebook. # # Neuron `r2405_051216b_cell1816` was recorded by Dr. Marius Bauza and the Krupic lab; They have kindly shared this data to ...
ca36ef91ef5d07a306d769d1228c08434df84aaf9ded614b4f568fdf616e74ee
Jupyter
5,105
121
# %% [markdown] # # Multi-round inference # # In the previous tutorials, we have inferred the posterior using **single-round inference**. In **single-round inference**, we draw parameters from the prior, simulate the corresponding data, and then train a neural network to obtain the posterior. However, if one is intere...
1ab96384e4bbb862f08fb6899a08abbce33a8a76ce0669b8e9259ff639799350
Jupyter
5,113
146
# %% import scanpy as sc import scvelo as scv import numpy as np # %% adata = sc.read('../../../../human_cd34_bone_marrow.h5ad') # %% adata # %% scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) # %% scv.pp.pca(adata) scv.pp.neighbors(adata, n_pcs=30, n_neighbors=30) scv.pp.moments(adata, n...
09c23c73571d9b7735b793b09861e35f74a5314368fc453e42b43b202dcbd91f
Jupyter
5,137
156
# %% [markdown] # # Single Cell Analysis of D7, D14 and D21 RGC-iNs # %% import scanpy as sc import pandas as pd sc.settings.verbosity = 3 # hints # %% [markdown] # ### Data collection # %% ### Read data into an AnnData objects (this step may take a few minutes the first time) ### adata_7 = sc.read_10x_mtx( f...
f7a4f6c4315c0ebb1f3781dbc16d76ff5f5b4b460f670c76fee2bc4866256d01
Jupyter
5,137
138
# %% import numpy as np run_folders_dict = { "run_0": [ "../../logs/exp002/exp002a/sweep-2025-10-14_11-33-51_attention-weights/0", "../../logs/exp002/exp002a/sweep-2025-10-14_11-38-43_attention-weights/0", "../../logs/exp002/exp002a/sweep-2025-10-14_11-39-46_attention-weights/0", "....