sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
85bc5d63797798d1cb174f2bdc3c3121a248d150480d13c9cbd2d238b1577bd2 | Jupyter | 5,144 | 262 | # %%
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\\Syed Hasnat\\OneDrive\\Journal Paper\\Code\\Irshad\\Dataset\\3_Outlier_Identified.csv', parse_dates=['date_and_hour'])
# %%
df
# %%
df['Date'] = df['date_and_hour'].d... |
b328ec4437e6ef952ca0b36a1191d5528e66ae880587d5f829a0c903f38f72b8 | Jupyter | 5,150 | 232 | # %%
### imports
import numpy as np
#import tensorflow.keras as keras
import keras
from matplotlib import pyplot as plt
import os, sys
import copy
import pickle
import sys
sys.path.append(os.path.abspath('../'))
from keras2c import keras2c_main
from keras import backend as K
# %% [markdown]
# layers: bidirectional r... |
4e9a79fb31c4b20001737ed11c1af50037dc169589f9ed4909c5273b13e68ebc | Jupyter | 5,159 | 232 | # %%
### imports
import numpy as np
#import tensorflow.keras as keras
import keras
from matplotlib import pyplot as plt
import os, sys
import copy
import pickle
import sys
sys.path.append(os.path.abspath('../'))
from keras2c import keras2c_main
from keras import backend as K
# %% [markdown]
# layers: bidirectional r... |
ed91980a6a6460862fdc18a0c59c1732abe4b6eec1ad2768e2036065cb5c2e98 | Jupyter | 5,182 | 153 | # %%
import pickle
import torch
import sbibm
import numpy as np
from consbi.simulators import *
import matplotlib.pyplot as plt
from scipy.stats import binom
import numpy as np
from tqdm import tqdm
import os
from sbi.utils import posterior_nn
from sbi.inference import SNPE, prepare_for_sbi
from sbi.simulators.simutil... |
aa39f5a53d4c9711bee44bf0c3e24c814592bfe1c6ee1251a173aa2f89b5beca | Jupyter | 5,216 | 168 | # %% [markdown]
# # Using GA model wrapper with Huggingface TF models
# %%
#install dependencies
! pip install transformers datasets gradient-accumulator
# %% [markdown]
# ## How to use GA with HF TF models
# %%
from gradient_accumulator import GradientAccumulateModel
from tensorflow.keras.layers import Input
from t... |
601a9487600cb45a410ba4fbd06e61633ec0a60b0fbe65ad2401d92a3894f168 | Jupyter | 5,321 | 143 | # %% [markdown]
# # How to use variational inference
#
# Variational inference (VI) fits a tractable distribution $q$ to the posterior by
# optimizing a divergence against the potential. In `sbi` it is a **sampler**: it works with
# any potential, so it is available for NLE and NRE, and it is the option to reach for w... |
d99dac6ddc703c0d9658369ac57988e55bfa98419080ac7538aacf1f3cf1f4eb | Jupyter | 5,343 | 146 | # %%
"""
Provenance Replay Python API tutorial/examples
Here's a brief walkthrough of some common or useful uses of Provenance Replay available through the Python 3 API.
Please be aware that Provenance Replay is currently available in an alpha release, and these concepts and commands
may change in the future.
# Pleas... |
377287e61b922fc917d1c5624cbc7fe7f383223ccbdf6f116071f3693da0dd25 | Jupyter | 5,378 | 170 | # %%
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 syntactic embed... |
886cf50b9ca0c25314dedd1f60d51af9c757cc067fdab712dc238cdb8f98fff6 | Jupyter | 5,469 | 294 | # %%
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\\1_Originol_DataSet.csv')
df.head(2)
# %%
print('Data Points= ',len(df))
# %%
df.info()
# %%
df['Date']=pd.to_date... |
c4af4338c797e214232447e06a93f17a3c16e7b53fd1df938b760392819b7ede | Jupyter | 5,527 | 153 | # %% [markdown]
# # 3. Property Filters
#
# Property filters are the first major step in refining the initial pool of oligos based on their intrinsic sequence properties. This step eliminates sequences that do not meet specific experimental criteria, such as GC content or melting temperature (Tm), which ensures that o... |
39441889d83a8adb80a260ad250b42b8e84d4cec9d60e4a2c140183238377421 | Jupyter | 5,556 | 156 | # %%
import scib
import latentvelo as ltv
import scanpy as sc
import scvelo as scv
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# %% [markdown]
# # Read process and plot data
# %%
adata = sc.read('../synthetic_datasets/bifurcation_2batches.h5ad')
# %%
ltv.utils.anvi_clean_recipe(adata, sp... |
97123b2935212d0c5887e5668c08aa3ac6f224ac7cf5bf94dd7c80c0c156c3c5 | Jupyter | 5,584 | 140 | # %%
import matplotlib.pyplot as plt
import numpy as np
import scanpy as sc
import scvelo as scv
import latentvelo as ltv
import pandas as pd
import seaborn as sns
# %%
lin = sc.read('synthetic_trajectories/fits/linear_latent_adata.h5ad')
scv.pl.velocity_embedding_stream(lin, color='sim_time', title='Linear', fontsize... |
de1fc71b83cd4a03082cf9a1a875e6657bff6f749e5e35e23d9b435c9a68fd5c | Jupyter | 5,587 | 162 | # %%
%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 import Path
import matplotlib as mpl
import skimage
from tqdm import tqdm
import tifffile... |
243a772159f514980c678e2a197c4c4c9dcbd985833ced3999133fa821f9afa4 | Jupyter | 5,611 | 145 | # %% [markdown]
# # Refining posterior estimates with importance sampling
# %% [markdown]
# ## Theory
#
# SBI estimates the posterior $p(\theta|x) = {p(\theta)p(x|\theta)}/{p(x)}$ based on samples from the prior $\theta\sim p(\theta)$ and the likelihood $x\sim p(x|\theta)$. Sometimes, we can do both, *sample* and *ev... |
ea46557ae953ef9e369af5b6d36fbe62bc14bab4e86c59067f54530f1dc653a2 | Jupyter | 5,644 | 141 | # %% [markdown]
# # Training procedure for the SLADS-Net algorithm (which is the backend of FAST)
#
# The training procedure can be essentially summarized in two steps:
# 1. Generate a database of feature vectors and labels
# 2. Train and validate the neural network
#
# One complication here is that the "reduction in... |
a4407fd2003bde112809fcd3966a1641d167dc7473d20174f3ce8aae70709eb4 | Jupyter | 5,679 | 138 | # %%
import glob
import json
from os.path import dirname
import matplotlib.pyplot as plt
import numpy as np
exp002a_path = "../../logs/exp002/exp002a/sweep-2025-11-24_17-53-45_nchannels/"
exp002a_glob = f"{exp002a_path}/*/anysleep_test_results_n_channels.json"
exp002a_files = sorted(glob.glob(exp002a_glob), key=lamb... |
af3e52fe30cc1a414af4c83acf96fe9d3b6ea36344e49f1d6bb356070a47dc00 | Jupyter | 5,767 | 167 | # %% [markdown]
# # Getting the final file to use in our analysis
#
# In this section we are going to access the clinical data needed for our analysis, and join it with the imputed outcome variables as well as the PCs
# %% [markdown]
# # Setup
# %% [markdown]
# ## Loading libraries
# %%
library(tidyverse) # Da... |
c8c2a04994502b8f994f0f6b87e4df0bd1bbd5c1946b1940bc9d7bbf52c47ccf | Jupyter | 5,779 | 142 | # %% [markdown]
# # Posterior Predictive Checks (PPC) in SBI
#
# A common **safety check** performed as part of inference are [Posterior Predictive Checks (PPC)](https://rss.onlinelibrary.wiley.com/doi/full/10.1111/rssa.12378). A PPC compares data $x_{\text{pp}}$ generated using the parameters $\theta_{\text{posterior... |
d0b2839525191fced004a6ce1ea651e0256708513a70deea4ff640fba0cafeb2 | Jupyter | 5,817 | 182 | # %% [markdown]
# ## daart training example
# This notebook demonstrates how to create a daart model (as well as the data generator), train the model on some example data provided in the repo, then assess model performance.
#
# The python script located at `daart/examples/fit_models.py` generalizes these steps and all... |
fc89b255998cb282c41fa263f1422d0d0c08b1d4c207bb0897f22f78ed4c05af | Jupyter | 5,822 | 125 | # %% [markdown]
# # How to use FMPE and NPSE
#
# This guide gives practical recommendations for using vector field methods (`FMPE` and `NPSE`) in `sbi`. For a comprehensive tutorial covering the API and concepts, see the [advanced tutorial on vector field methods](../advanced_tutorials/19_vector_field_methods.ipynb).
... |
0c75ffe02bfb6e96afe286f18d220ac83201c180572818711d57cf89d2e1dd49 | Jupyter | 5,829 | 179 | # %% [markdown]
# ## daart training example
# This notebook demonstrates how to create a daart model (as well as the data generator), train the model on some example data provided in the repo, then assess model performance.
#
# The python script located at `daart/examples/fit_models.py` generalizes these steps and all... |
b6b8d705e0ba217ae19a217b4d9c2bdc7d6d58e53a6e5d3bd2bdd3971a23caad | Jupyter | 5,884 | 197 | # %% [markdown]
# # How to track experiments
# %% [markdown]
# Experiment tracking helps compare model variants and keep a record of hyperparameters and training metrics. By default, `sbi` logs to TensorBoard. You can also bring your own tracker by implementing the lightweight `Tracker` protocol and passing it as `tra... |
60d7d514b2968d012d48d750653f152e859a81e083ecf914d31ffb4dffaee37f | Jupyter | 5,908 | 183 | # %%
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib import rcParams
import numpy as np
import pickle
import sys
import torch
sys.path.append("../")
from plotting_utils import custom_marginal_plot
from sbi.simulators import simulate_in_batches
from sbi.inference import prepare... |
c59da50fe24000f0b8ace3abb8f747684477562e1e86f638f2421fbffd53584c | Jupyter | 5,999 | 93 | # %% [markdown]
# # How to run sequential methods
#
# In the previous tutorials, we have inferred the posterior using **amortized inference**. In **amortized 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 inte... |
d3dd50b1552a59f7f9ff56649a7a149a715d5126d408fc8bc61f4a1bf161f1d7 | Jupyter | 6,011 | 161 | # %%
import scanpy as sc
import scvelo as scv
# %%
adata = sc.read('../../../../erythroid_lineage.h5ad')
# %%
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=None)
# %%
s... |
24bacc47724e23308e1cc8755e8241fca34951cf2120c7ff8b5475a7c00855bb | Jupyter | 6,034 | 231 | # %%
import torch
torch.manual_seed(0)
# %%
import pandas as pd
from os.path import dirname, join
import numpy as np
# %%
from transformers import DataCollatorForLanguageModeling
from transformers import Trainer, TrainingArguments
# %%
from transformers import AutoModelForMaskedLM, AutoTokenizer
# %%
# model_nam... |
1e230332aac341d7e4147e2c8680feede99cfa75dca90cf744c490f3684255f9 | Jupyter | 6,035 | 176 | # %%
from torchmetrics import AUROC
from torchmetrics.classification import BinaryAveragePrecision
import os
from os.path import basename, dirname, join, exists
import pickle
import time
import glob
import argparse
from tqdm import tqdm
import torch
from torchmdnet import datasets, attention_weights
from torchmdnet.mo... |
d9afffc6bf7f9f7ccb145beb31f2f8d22322797a0c5f786b6dc4bf82c5ee2ecf | Jupyter | 6,036 | 167 | # %%
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 semantic embedd... |
6819258e918386304af3c59c2456a0837b4a5a4ee17d386b0b65b55d8c8daf05 | Jupyter | 6,054 | 174 | # %%
from __future__ import absolute_import, division, print_function, unicode_literals
import IPython
import random
import pandas as pd
from tqdm import tqdm
import numpy as np
def isNAN(num):
return num != num
import rdkit
from rdkit import Chem
from rdkit.Chem import Descriptors
from sklearn.model_selection impo... |
e0b3eebfc9fb9cd1d281db23110c0c9a58b28e075b88078987bda6a70e3593d6 | Jupyter | 6,056 | 166 | # %% [markdown]
# ### Download the demo movie
# %%
%%bash
mkdir ../../data
GDRIVE_DEMO_MOVIE_FILEID=1v8E61-mKwyGNVPQFrLabsLsjA-l6D21E
FILE_NAME=../../data/demoMovie.npy
function gdrive_download () {
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.... |
038adbc934f9d5bfc83ce31e2b4e204ec9d2f3670a12e31dcd5cdb8ec910aa0f | Jupyter | 6,080 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
f00a832a30d29920c6fb417bf8f268c96c4f2aedfb6b69cd0d7f61aae900b630 | Jupyter | 6,080 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
2b16794b635fcbd8d9ad6989f67e19c34c6ad96af0bdeaee137711330ee7595f | Jupyter | 6,092 | 122 | # %% [markdown]
# # Efficient handling of invalid simulation outputs
#
# For many simulators, the output of the simulator can be ill-defined or it can have non-sensical values. For example, in neuroscience models, if a specific parameter set does not produce a spike, features such as the spike shape can not be compute... |
9c61b8fea7bb0bd5bf419ad3873f947c2c20b24faf956f65b1bc68518ecb9815 | Jupyter | 6,093 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
9fb2b730fe0d222d14fd6e90eafa273d1874f2f632a41d795492e29638cb3ce6 | Jupyter | 6,093 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
3d14bc2e9fa8300705ae11ee09567f6f548d020918e61ecf0ab3c7df6a474693 | Jupyter | 6,095 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
da3d46248df72266f016559a5da659e78c533efc77c6762c7f72fec5ecf4eb00 | Jupyter | 6,095 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
348ff08ad8c547e3dc545a5fa4c97878b7402f7d101388312c1f444cc88593d3 | Jupyter | 6,108 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
6120c2846d6b6521d21832be42433550b5f6dc0b1060f9e13b3563a013a51bc6 | Jupyter | 6,108 | 152 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'].isin(['4']),'step_att']=2
data.at[data['step_... |
cda9c5aa930e3bcb279a03fdc792916c08d8cc2d6d9da9c99c8d69f41c01ae90 | Jupyter | 6,139 | 189 | # %%
#%matplotlib widget
%load_ext autoreload
%autoreload 2
#%matplotlib notebook
%matplotlib inline
# %%
import sys
from pathlib import Path
import torch
import numpy as np
import tqdm
from ripser import ripser
from persim import plot_diagrams
# Plotting
import matplotlib
from matplotlib import pyplot as plt
plt.st... |
897dfa3bf7e9077a7a4db7c2f312f271a401adb91eaad2c0fdd7a5926a7beeb6 | Jupyter | 6,173 | 170 | # %% [markdown]
# This is the code for reproducing the Fig 3D of the paper:
#
# # KCC2 reverse mode helps to clear postsynaptically released potassium at glutamatergic synapses
#
# Egor Byvaltcev, Mahraz Behbood, Jan-Hendrik Schleimer, Thomas Gensch, Alexey Semyanov, Susanne Schreiber, Ulf Strauss
#
# If you use it,... |
d5b8b98759861a41f1387de2c6be8381368aba6e0ea83c8ca5bd873e3059c972 | Jupyter | 6,173 | 142 | # %%
import json
import numpy as np
import scipy
from tabulate import tabulate
# %%
sleep_metrics_file_anysleep = "table_s4b_anysleep.json" # generated by table_s4b_anysleep_metrics.ipynb
sleep_metrics_anysleep = json.load(open(sleep_metrics_file_anysleep, "r"))
se_map_anysleep = sleep_metrics_anysleep["se_map"]
s... |
21642053c370e217b1b5acaf205a862ccdedb10148739eced16c8386a493d5db | Jupyter | 6,230 | 125 | # %%
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 serenityff.charge.gnn.attention_extraction.extractor import Extractor
sdf_file = "../data/example.sdf"
model_path = "../data/example_model.pt"
extraction_path = "... |
c14023d1348a87be143f285d9d2bd8a6a338e474205fb6476e683b0bc6c5645b | Jupyter | 6,333 | 206 | # %%
%load_ext autoreload
%autoreload 2
# %% [markdown]
# # MolMorganDataset to cover chemical space of qmugs, patrick and CHEMBL with least possible molecules
#
# ## Import necessary packages and data sets
# | Name | Content |
# | --- | --- |
# | corrected |Data set from patrick with some faulty molecules removed |
... |
278f33eb434ac6303045b5542e1d387378889d888657951e65169939aa93710d | Jupyter | 6,346 | 135 | # %%
import pandas as pd
import pickle
import numpy as np
from my_tools import *
from ranked_structural_connectivity import *
# %%
class Patient:
def __init__(self, plot_path,assessment_path,baseline_file,files_to_remove,vta_path):
self.plot_path = plot_path
self.assessment_path = assessment_path
... |
20569adcb5e865ca22de29d3eb0e7ec092b1ba2b8f202374834265b8f515f41a | Jupyter | 6,477 | 315 | # %% [markdown]
# # ERROR ANALYSIS
# The preliminary results in our IMAGEN paper advocates for a more in-depth understanding of what contributes to the significant performance of the ML models for the three time-points. <br>
# In error analysis we will look at subjects that the model / models always fail to predict cor... |
d650c2e66b7a4d1a42e7112759ab7b4f708b795bde58b2d0cbffe441aa155cf3 | Jupyter | 6,483 | 217 | # %% [markdown]
# ## Test Data Parser
# %%
import os
import pandas as pd
pd.set_option('display.max_columns', None)
import pickle
from oligo_designer_toolsuite.utils import GffParser, parse_fasta_header
%load_ext memory_profiler
# %%
# Initialize parser
parser = GffParser()
# %%
##### Test GFF3 parser
file_gff = o... |
c758a3cdfbdb510532441e3af44a8e75a9ff443ea8c9abfed9dde88e61e26ef4 | Jupyter | 6,515 | 180 | # %%
%load_ext autoreload
%autoreload 3
# %%
import pandas as pd
import numpy as np
from glob import glob
from os.path import join
import os
from scikits.bootstrap import ci
import matplotlib.pyplot as plt
import seaborn as sns
from statsmodels.stats.multitest import fdrcorrection
import sys
from tqdm.notebook impo... |
0894297337371c87b28c764d19dca5d6b46e9eb6d2c80f3332754a8aa15c2742 | Jupyter | 6,573 | 139 | # %% [markdown]
# # Active subspaces for sensitivity analysis
#
# A standard method to analyse dynamical systems such as models of neural dynamics is to use a sensitivity analysis. We can use the posterior obtained with `sbi`, to perform such analyses.
# %% [markdown]
# ## Main syntax
# %% [markdown]
# ```python
# f... |
242ad8b044b72362d4974bcd89fa780980e3cdbeadc1b429139ca9df245e2f38 | Jupyter | 6,603 | 192 | # %%
import latentvelo as ltv
import numpy as np
import scanpy as sc
import scvelo as scv
import matplotlib.pyplot as plt
# %% [markdown]
# # Read data synthetic data
#
# Load synthetic data created with dyngen
# %%
adata = sc.read('../synthetic_datasets/example_bifurcation.h5ad')
# %% [markdown]
# # Setup data and... |
0ef553222c6f2758610e234ff3fc09be347ac42ed64f1ecffb42ca4a046f6fb0 | Jupyter | 6,630 | 235 | # %%
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('../../')
from config import *
configure_pylab()
def poissonll(r,y,n,Fs = 50):
ll = sum(n*(y*slog(r) - r))/sum(n) # nats/experiment
return ll*Fs/log(2)
def llnodc(r,y,n):
meanrate = sum(y*n)/sum(n)
c = slog(meanrate)-slog(sum(r*n)/sum(n... |
adfffa0f4c6b37d6c85869a0e8aec13a4ee59771adab3906213e72da608349b3 | Jupyter | 6,669 | 211 | # %%
# IMPORT STATEMENTS
import cv2
import re
import numpy as np
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable, axes_size
import matplotlib.patches as patches
import matplotl... |
fe751e54fafa636fa3fcaa28139d01e9663727263322379ee1b1283980fd29d5 | Jupyter | 6,683 | 222 | # %%
import glob
import json
import os.path
from os.path import basename
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from sklearn.metrics import f1_score
# %%
exp001a_paths = [
"../../logs/exp001/exp001a/sweep-2025-07-30_14-11-25_test_eval_recordings/0/usleep_test_results.json",
"... |
5a569e95c41c28164c05394ac3420550e0f8b220d8ab93942593b790b98b51e5 | Jupyter | 6,714 | 159 | # %% [markdown]
# # How to use Pyro with SBI
#
# **Prerequisite:** This tutorial requires Pyro. Install it with `pip install "sbi[pyro]"`.
#
# This how-to-guide shows how to integrate **neural likelihood estimators** (NLE) in Pyro models when analytical likelihoods are intractable. Combining SBI with Pyro enables run... |
ab858ed3da60da6c0d810da37568ed32d768b0dd59470980c1d627a44a20fce6 | Jupyter | 6,760 | 207 | # %% [markdown]
# [](https://colab.research.google.com/github/kan-bayashi/ParallelWaveGAN/blob/master/notebooks/convert_melgan_from_pytorch_to_tensorflow.ipynb)
# %% [markdown]
# # Convert MelGAN generator from pytorch to tensorflow
#
# This no... |
69a686a5c3d5e15399464b0e0d1ae20970aee5e39672d835467f49d1e5eaeed5 | Jupyter | 6,767 | 175 | # %%
import glob
import numpy as np
from sklearn.metrics import cohen_kappa_score, f1_score
from tabulate import tabulate
score_order = ["Wake", "N1", "N2", "N3", "REM"]
# %%
anphy_path = "../../examples/output"
anphy_preds_anysleep_glob = f"{anphy_path}/anphy/predictions_anysleep.npz"
anphy_preds_anysleep_files = s... |
51fae69032ac94f3f5e967a6507aa418594864ed13f23cd8c8c559c11e7a6093 | Jupyter | 6,772 | 218 | # %% [markdown]
# # Benchmarking of Graph Network
# %%
from copy import deepcopy
from matplotlib import pyplot as plt
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 ... |
7cc280042a993981aa390177be70fc46924012597e528591666b40c122bea370 | Jupyter | 6,804 | 159 | # %% [markdown]
# # 4. Specificity Filters
#
# Specificity filtering is critical in oligo design to prevent off-target binding, a common problem in experiments using short oligos. Off-target binding occurs when oligos hybridize to unintended genomic regions, reducing the accuracy and reliability of the experiment. Spe... |
934e323200ef50e04f67a516f49a04a75f0a28844d6a6752ee975b52d82ca11f | Jupyter | 6,902 | 246 | # %% [markdown]
# # Training of original model
# ## Dataset: Intel
# %%
#pip install opencv-python tensorflow
import argparse
import numpy as np
import tensorflow as tf
import keras.backend as K
import matplotlib.pyplot as plt
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers imp... |
d65c0359f9d1985aad59821382dd2816bb36aaf0ab5da727232aac52a3ca7634 | Jupyter | 6,930 | 218 | # %% [markdown]
# This notebook covers the use of the library to perform feature selection evaluated by cross-validation on a classification problem.
# %% [markdown]
# # Problem information
#
# The "Adult" dataset, also known as the "Census Income" dataset, is used to predict whether an individual's income exceeds $5... |
593b7a0ee77898ee96375510e42fb183e23236f3096954a2ba44610efbf1e43f | Jupyter | 6,937 | 160 | # %%
import glob
import matplotlib.pyplot as plt
import numpy as np
import sklearn.metrics
n_classes = 5
# %%
from os.path import dirname
path_sweep_soft_voting = "../../logs/exp002/exp002a/sweep-2026-09-04_18-37-48_30s-soft-voting"
labels_glob_soft_voting = f"{path_sweep_soft_voting}/*/labels.npz"
preds_glob_soft_... |
88f3e63177b9a4bf5112593df7d43e08ee9689f637594283ba679fca96ccb58e | Jupyter | 7,154 | 263 | # %% [markdown]
# # Training of original model
# ## Dataset: GTSRB
# %%
#pip install opencv-python tensorflow
import argparse
import numpy as np
import tensorflow as tf
import keras.backend as K
import matplotlib.pyplot as plt
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers i... |
cca804666af0e44feca091c07175ba99fe4044a349df7dbba72163d70be30f11 | Jupyter | 7,163 | 202 | # %%
%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 import Path
import matplotlib as mpl
import skimage
from tqdm import tqdm
import tifffile... |
71733d45f2d7ac8ebf9a6889401c3f01c0d3f15d3db8dcced1321f0aad191341 | Jupyter | 7,217 | 164 | # %%
import json
import numpy as np
import scipy
from tabulate import tabulate
# %%
sleep_metrics_file_anysleep = "table_s4a_anysleep.json" # generated by table_s4_anysleep_metrics.ipynb
sleep_metrics_anysleep = json.load(open(sleep_metrics_file_anysleep, "r"))
sleep_metrics_file_usleep = "table_s4a_usleep.json" #... |
d439b8488d47b31d5b91026d12591fd30804ff5416de9b83c6925075747acfe6 | Jupyter | 7,226 | 251 | # %%
import tbitk.data_manager as dm
# %%
data_dir = '../data/unskilled_operator-20220421/manual_onsd-Brad Moore-1/'
glob_pat = f'{data_dir}/**/*cornerText.json'
files = dm.posix_glob(glob_pat, recursive=True)
# %%
import re
import json
import pdb
import pandas as pd
import numpy as np
import itk
def get_other_files... |
facb3cd8538ab33a06ac4ad7cc1fb0ce6bdae206e1e030626a6411e0e219090f | Jupyter | 7,232 | 257 | # %%
from importlib import reload
import os
from rdkit import Chem
from copy import deepcopy
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from serenityff.charge.tree.tree import tree
from serenityff.charge.tree.node import node
from serenityff.charge.tree_develop.tree_constructor... |
a222c107d955eed01b2d0c67f33bbab0c34e27b563b448002b77fda1aa9706de | Jupyter | 7,273 | 205 | # %%
import sys
sys.path.append('/Users/mahsazarei/Grantlab Brugada Dropbox/TerraMera/Gitlab/Mahsa/AA_APLID/Amino_Acid_manuscript/helper_functions')
from load_data import *
from utils import *
from models import *
root_dir = "/Users/mahsazarei/Grantlab Brugada Dropbox/TerraMera/Gitlab/Mahsa/AA_APLID/Amino_Acid_manuscri... |
9279917f5e348c3f1513f33e092ee88fc6256d153093c6e87f3bb38fd9e92c49 | Jupyter | 7,310 | 216 | # %%
import latentvelo as ltv
import scanpy as sc
import scvelo as scv
import numpy as np
import torch as th
import anndata as ad
# %%
adata = sc.read('../data/Pancreas/endocrinogenesis_day15.5.h5ad')
#scv.datsets.pancreas()
# %%
scv.pl.umap(adata, color='clusters', frameon='artist')
# %%
scv.pp.filter_genes(adata... |
1587dee3772c71dbe0f9f8c33e823f44bd4c4d527903d9ffdb5cf7f670d8f713 | Jupyter | 7,339 | 174 | # %% [markdown]
# - Get assignments VTA_*_assignments_BAsubcortex.csv
# - Swap endpoiunts under conditions
# - Get bilateral enpoints vectors
# - Transform to unilateral
# - Get dates
# - Get outcome data
# - Prepare data for plotting as in heatmap notebook
# %%
import pandas as pd
import numpy as np
from pathlib impo... |
105b6a4e8a337d0ca242a6e2ff044d07f71988af28730dc058cf8f979417e0dc | Jupyter | 7,360 | 234 | # %% [markdown]
# # Integration of D14 RGC-iNs with Published Datasets
# %%
import scanpy as sc
import scanorama as sr
import pandas as pd
import anndata as ad
sc.settings.verbosity = 3 # hints
# %% [markdown]
# ### Data Collection
# %%
### Read data into an AnnData objects (this step may take a few minutes the fi... |
b377228ae03a5854c7777b47c80054a19fd74a3d139bbcdc0197969b12ddf140 | Jupyter | 7,380 | 221 | # %% [markdown]
# # Semi-Supervised Label Transfer of RGC Subtype Annotations from Liang et. al. 2023 to Day 21 RGC-iNs
# %%
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
import scvi
import anndata as ad
sc.settings.verbosity = 3 # hints
# %% [markdown]
# ### Data Collection
# %%
### Rea... |
fd38ee1cd3ab6910445ece93d6a2f6950f67481bcf5a5f8ffaf86c611b9f8732 | Jupyter | 7,537 | 291 | # %%
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]
# # Plot examples of each ... |
56406d797b63e9808af38a057a19d7a6d9e634be7ffd2429f775cde87501df1b | Jupyter | 7,569 | 206 | # %%
%matplotlib widget
%load_ext autoreload
%autoreload 2
#%matplotlib notebook
%matplotlib widget
# %%
import sys
from pathlib import Path
import torch
import numpy as np
import tqdm
from ripser import ripser
from persim import plot_diagrams
# Plotting
import matplotlib
from matplotlib import pyplot as plt
plt.sty... |
2b9f0a0f9c1753e6af6acc26e3356ef27ebf6cecf88cb6f70b324edbbadb4b49 | Jupyter | 7,578 | 197 | # %%
import numpy as np
import pandas as pd
from rdkit import Chem
from tqdm import tqdm
from glob import glob
# %%
data_folder = "/localhome/mlehner/sff_data/psi4/"
# %%
mol_sup = Chem.SDMolSupplier(data_folder + "../combined.sdf", removeHs=False)
# %%
error_ddec = []
error_0 = []
error_1 = []
error_2 = []
error_3 ... |
d0812917bd3b61fa31f14f9b1e461233dbd172bf343f567fb36a4c314813925c | Jupyter | 7,735 | 190 | # %%
import glob
import json
from os.path import dirname
import matplotlib.pyplot as plt
import numpy as np
exp002a_path = "../../logs/exp002/exp002a/sweep-2026-04-10_19-11-06_nchannels_mass"
exp002a_glob = f"{exp002a_path}/*/anysleep_test_results_n_channels.json"
exp002a_files = sorted(glob.glob(exp002a_glob), key=... |
08743f52515a36fa6a2307d4b408e3ff33814e9fb27827ed2cc5ff778b92072e | Jupyter | 7,737 | 222 | # %% [markdown]
# Algorithm
#
# 1. Compute a 1.7 mm space around a contrast target (not too big to catch things other than background
# 2. Bounding box or dilation
# 3. Calculate mean and std deviation between bg and contrast target
# %%
%load_ext autoreload
%autoreload 2
import itk
import numpy as np
from usqc.data ... |
472567b6a9cbf6c64918731e2f202fd57d7df70988acfe12e1b4f38844a7ba87 | Jupyter | 7,766 | 231 | # %%
import pandas as pd
import numpy as np
import anndata as ad
import scanpy as sc
import scvelo as scv
import latentvelo as ltv
# %%
adata = sc.read('data/preprocessed_clusters.h5ad')
# %%
adata.X = adata.layers['spliced'].copy()
# %%
adata = ltv.utils.anvi_clean_recipe(adata, umap=True, celltype_key='clusters',... |
a170ffd8ae0e78b83bdc11a35b48f22145edabbd4cd17a8e2e505e407bf8524f | Jupyter | 7,780 | 193 | # %%
import json
import numpy as np
from tabulate import tabulate
score_order = ["Wake", "N1", "N2", "N3", "REM"]
# %%
reprod_results_paths = [
"../../logs/exp001/exp001a/sweep-2025-07-30_12-29-20_test_eval/0/usleep_test_results.json",
"../../logs/exp001/exp001a/sweep-2025-07-30_12-29-20_test_eval/1/usleep_t... |
14649f9b07138f76bc125ca5a24a9ab1a2fd0974dca48f845db209604b2aa7c4 | Jupyter | 7,797 | 227 | # %% [markdown]
# # Analysis of IMAGEN's questionnaires:
# 1. Demographics
# 2. Substance use
# 3. Psychological assessments
# 4. Socio-economic status
#
# Reference documentation links:
# * IMAGEN's native documentation: https://imagen-europe.com/resources/imagen-dataset/documentation/
# * Our local documentation: ht... |
35dd664d659427fa8af9196d4f33403165866f13e7f78b0d84d73bb55df6304f | Jupyter | 7,816 | 180 | # %% [markdown]
# # Posterior evaluation and analysis
#
# Once we have obtained a posterior estimate using SBI (see `2_inference`), it is important to evaluate the accuracy and reliability of this estimate before we can analyze it.
# The `sbi` package provides methods to do this:
#
# - we can sample parameter value... |
c7b81f7087400941d2694368073418516b8803fd3fa8ba44ce100fa40d89ddd2 | Jupyter | 7,867 | 206 | # %%
import glob
import json
import re
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
def calc_mode(data, axis=0):
bins = np.apply_along_axis(
lambda x: np.bincount(x, minlength=5), axis=axis, arr=data
)
# resolve ties randomly by adding a small random number to ... |
a29eb013c13170c935c42b1998cfb19d78d24bbf55000846fbd43ef1f32a3df1 | Jupyter | 7,879 | 192 | # %%
import glob
import json
from functools import partial
from os.path import dirname
import matplotlib.pyplot as plt
import numpy as np
def calc_mode(data, axis=0):
bins = np.apply_along_axis(
lambda x: np.bincount(x, minlength=5), axis=axis, arr=data
)
# resolve ties randomly by adding a small... |
7edd403b80aa22309eb1d28cfc78bcc38fd7d8ab5ddb2bda843c1fde5b7912e7 | Jupyter | 7,885 | 180 | # %% [markdown]
# # Getting started with `sbi`
# %% [markdown]
# In this tutorial, you will learn the basics of the `sbi` toolbox. Here is a code-snippet that you will learn to understand:
#
# ```python
# from sbi.inference import NPE
# from sbi.analysis import pairplot
#
#
# num_simulations = 1000
# theta = prior.... |
2433eebef94613528feb703c40f8bf8c8237d49834548bee80b1d7f3f29b16fe | Jupyter | 8,227 | 200 | # %% [markdown]
# # main.py explained
#
# The included `main.py` is a sample script that programmatically controls the OSC1Lite stimulation controller using Python. This is a detailed document of `main.py`. This document assumes you have basic knowledge of Python.
# %% [markdown]
# This script requires the OpalKelly ... |
086d67cf579a1cebd0fa1cc5d401c56717f241e42d74bfa61bf509dca6637a86 | Jupyter | 8,236 | 215 | # %% [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
'''
#... |
43feef41799704ee6eadb79aa6e437ba5a401cf4028b392ec46c6fed4c8600aa | Jupyter | 8,244 | 276 | # %%
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('../../')
from config import *
configure_pylab()
# %% [markdown]
# # Simulation
# %%
rate = 1.2 # Spikes/second
Fs = 50 # Samples/second
duration = 1800 # Seconds
T = int(duration*Fs) # Samples
L = 128 # Bins/arena
Po ... |
8f016f5b823f208196e906c7fb03e4ccde47123cfd2164f0973157073cf5e998 | Jupyter | 8,259 | 243 | # %% [markdown]
# Analyze a ultrasound probe's signal-to-noise ratio over vertical distance. The US video must be centered over the vertical wire group in the CIRS 040GSE phantom.
# %%
%load_ext autoreload
%autoreload 2
import itk
from glob import glob
import usqc.data
import usqc.qc
import usqc.phantom
from usqc.ma... |
1d8ee2eddd41fbecac3d795555c1c7f828642658ce5d2fa9a76e5b9375a9637e | Jupyter | 8,396 | 214 | # %%
import sys
if "../" not in sys.path: sys.path.append("../")
import pickle
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy
from tqdm import tqdm
# import seaborn as sns
# sns.set(rc={'figure.facecolor':'white'})
# plt.rcParams["figure.facecolor"] = "white"
%matplot... |
41176680807a293dae089321af6f8bafa35fd9c0e8c499dd2f103ef88c500edc | Jupyter | 8,426 | 218 | # %%
import glob
import json
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
def calc_mode(data, axis=0):
bins = np.apply_along_axis(
lambda x: np.bincount(x, minlength=5), axis=axis, arr=data
)
# resolve ties randomly by adding a small random number to the counts... |
2f22798fa85da93d7b784498f28b3b1b666ff44b1ce5135d7e1a376c1e0a2a7a | Jupyter | 8,534 | 288 | # %% [markdown]
# # Example 0: Ground truth
#
# In this example, we will test inference on simulated data.
# %% [markdown]
# ## Simulate a grid map with known parameters
# %%
from pylab import *
import sys
sys.path.append('../')
from lgcpspatial.simulate import simulate_data
from lgcpspatial.plot import *
L ... |
d95b238123f511a4632d984188dbfdc1b520d97c0d0e927a85d18efb28a272cd | Jupyter | 8,534 | 288 | # %% [markdown]
# # Example 0: Ground truth
#
# In this example, we will test inference on simulated data.
# %% [markdown]
# ## Simulate a grid map with known parameters
# %%
from pylab import *
import sys
sys.path.append('../')
from lgcpspatial.simulate import simulate_data
from lgcpspatial.plot import *
L ... |
ec2c74934eb92003d2f6b81d6400c80c7ffe2a4f1e381aa9f3c26f0b7afa7f03 | Jupyter | 8,562 | 253 | # %% [markdown]
# # Supp. figure 2 and 3: prior and posterior predictives, conditional posteriors
#
# The training data and inference objects are pre computed and only loaded for visualization in this notebook.
#
# For details on how to perform inference, see `/tutorials` or `/scripts`
# %%
import matplotlib.pyplot ... |
8c886e7897c7f363f19072344b339d5a450e7a817159c6c571f687717ba57bf4 | Jupyter | 8,630 | 243 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
6356ee5668587db6d54470e8eaa731d2c67a51f820a9dcad45ab9bac9290aa2e | Jupyter | 8,649 | 221 | # %%
import glob
import json
from functools import partial
from os.path import dirname
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def calc_mode(data, axis=0):
bins = np.apply_along_axis(
lambda x: np.bincount(x, minlength=5), axis=axis, arr=data
)
# resolve ties random... |
a60995a3e412ab91381ca40bd51483222ce2ac120f27826496250c69936b3307 | Jupyter | 8,653 | 243 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
869c069f35ff8fd1115d09f3a0ffd88798ec73e16fcc82053d22d824e33f7813 | Jupyter | 8,679 | 244 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
c040ca4713285fa93f27211b2816a46a120ad7f08a9fbf3f8a7418af22feedeb | Jupyter | 8,680 | 244 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
38804f61b8b0fef22b7849477f531b816211f9d70f5be64b9b32f00072c7daaa | Jupyter | 8,681 | 244 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
6be6435ab00e36806d14710fc4ce71c319a3491894f6c71f830b97940ccd6361 | Jupyter | 8,685 | 244 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
99dea478d5e151113b5d9896abb51107f7797b5a3857d14c78f95ef933f21b3b | Jupyter | 8,686 | 244 | # %% [markdown]
# # TBS
# %% [markdown]
# ## preparing
# %%
import pandas as pd
import matplotlib.pyplot as plt
import hddm
import numpy as np
import pickle
from patsy import dmatrices, dmatrix, demo_data
cm = 1/2.54
# %% [markdown]
# ## loading data
# %%
data = hddm.load_csv('exp2_DDM.csv')
data.at[data['step_att'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.