sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
75ef68da1aa86575ba14516c95ca4fd09a419641638729931b011f1cc7205683 | Jupyter | 1,928 | 81 | # %% [markdown]
# Notebook to process the levodopa equivalent dose information from PPMI.
# %%
import numpy as np
import pandas as pd
from calc_ledd import calc_ledd
# %% [markdown]
# ### Demographics
# Use preprocessed demographics. Enrolled patients have an enroll date that is not null.
# %%
path = "data/"### PUT... |
09b769072e1145dd79e3b9434da1760a4a31bef99d3c87df760b66440d71ae68 | Jupyter | 1,930 | 77 | # %%
%load_ext autoreload
import deepdish as dd
import numpy as np
import pandas as pd
import json
from skimage import io
from notebook_utilities.display import stack_browser, display_array
from matplotlib import pyplot as plt
from fimpy.core.split_dataset import H5SplitDataset
from pathlib import Path
# %%
% autorel... |
0cfd3e75e7870b00a2a051777c02b8ddecd79d3ca125a2170ac602b5531d2b0a | Jupyter | 1,935 | 61 | # %%
import pandas as pd
import anndata
from anndata import AnnData
import scanpy as sc
import matplotlib.pyplot as plt
from os.path import join
import numpy as np
import glob
# %%
raw_dir = "raw/habib_2017/"
# %%
df_mat = pd.read_csv(join(raw_dir, "SCP90/expression/Human_Processed_GTEx_Data.DGE.UMI-Counts.txt.gz"), ... |
f5a0aa75547fd8dbba98e1fd61243f7d233457d8065de8c8830106c4edcc29d2 | Jupyter | 1,963 | 84 | # %%
import h5py
import csv
import numpy
import os
import torch
# %%
# %%
os.environ['MAX_LENGTH'] = '384'
os.environ['DATA_PATH'] = 'embeddings_test.txt'
os.environ['OUTPUT_PATH'] = 'embeddings_test.h5'
os.environ['BATCH_SIZE'] = '64'
os.environ['MKL_SERVICE_FORCE_INTEL']='1'
# %%
# %%
# If there's a GPU avail... |
a3c2073d50499992a1ace2685e8e36b872e4717760ee17afbc6e491bc6432c87 | Jupyter | 1,969 | 65 | # %%
import tensorboard as tb
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# %%
experiment_id_tabnet = 'oYB2aPfzTQmXj07sJ7KOFg'
experiment_id_linear = 'JnDDBWSgQPag4qWXJKb0bg'
experiment_tabnet = tb.data.experimental.ExperimentFromDev(experiment_id_tabnet)
experiment_linear = tb.data.exper... |
97901da40b34bef15c2f1acc7069f816b6566258417f9de9785a89f763b3d0ae | Jupyter | 1,971 | 89 | # %%
import pysolr
# %%
solr = pysolr.Solr('http://librairy.linkeddata.es/solr/cord19-paragraphs', always_commit=True, timeout=50)
# %%
foo = solr.search(q="biobert_disease_ents:*")
# %% [markdown]
# # Diseases
# %%
paragraphs = solr.search(q="biobert_disease_ents:*", rows=6000000)
# %%
len(paragraphs)
# %%
n_dis... |
9831f39a2329c9b09894596c490d2e9aabaeeaafc0c3ceb3e6a1b2d157ce9d28 | Jupyter | 1,972 | 77 | # %% [markdown]
# ## YData Profiling: NASA Meteorites example
# Source of data: https://data.nasa.gov/Space-Science/Meteorite-Landings/gh4g-9sfh
# %% [markdown]
# Make sure that we have the latest version of pandas-profiling.
# %%
!pip install -U data-profiling
# %% [markdown]
# ### Import libraries
# %%
import num... |
ea4ed2b1bb7eae5b63f92e2681c7c037122dfaa2a7dd3baeb4bcd2ebec6a856d | Jupyter | 1,978 | 64 | # %%
import numpy as np
import pandas as pd
from anndata import AnnData
import anndata
import scipy
from tqdm import tqdm
from scipy.sparse import csr_matrix
import scanpy as sc
from os.path import join
def to_adata(df):
adata = AnnData(csr_matrix(df.values), obs=pd.DataFrame(index=df.index.values), var=pd.DataFram... |
1d6a804869c67c16f177967c0831e75789ce05d22dd410e22afed3c2818b2007 | Jupyter | 1,984 | 67 | # %%
import pandas as pd
import anndata
from anndata import AnnData
import scanpy as sc
import matplotlib.pyplot as plt
from os.path import join
# %%
raw_dir = "raw/zeisel_2015/"
# %%
# meta information
df_meta = pd.read_csv(join(raw_dir, "expression_mRNA_17-Aug-2014.txt"), nrows=10, sep='\t', header=None)
df_meta = ... |
1c7e50261931bbc6e21e822ccb8ffef0c9f26a63602afb5350c9dbb7dc9b2a57 | Jupyter | 1,994 | 75 | # %% [markdown]
# # Results
# - Plot training/test telemetry values, predictions, smoothed errors, and predicted and actual anomalies
# - A specified results file from the `results` dir is used to highlight anomalous regions and read in data from the `data` dir
# %%
import sys
import numpy as np
import os
sys.path.in... |
7140ce14249fc3d1d2d13e84b86457f1bad5f6cd33b2607f151436aebf832ff8 | Jupyter | 1,998 | 80 | # %%
import numpy as np
import emilys.optics.mtf as mtf
import matplotlib.pyplot as plt
import emilys.image.arrayplot as aplt
%matplotlib inline
# %%
# load MTF values from file
# ! Set the file name to where it is on your local drive !
lmtf = mtf.loadmtf('F:/Data/Python/emilys/data/Merlin-300keV-SPCM100.mtf')
# %%
#... |
8ac80522cc3d48e6103a1794e72ed838328c53498698a8f2b863419e76101d8f | Jupyter | 1,999 | 58 | # %% [markdown]
# > Connect to the TFU node
# %%
# Set your GCP project id.
export PROJECT_ID="ppt-project-382019"
# Modify Zone as applicable
export ZONE="europe-west4-a"
export ZONE="us-central1-f"
gcloud alpha compute tpus tpu-vm create tfu-esmfold \
--project=${PROJECT_ID} \
--zone=${ZONE} \
--version=v2-alph... |
2269cadb981280a285c29a661b53147234b535694cf96ea576f2dc5b7d6e3773 | Jupyter | 2,007 | 82 | # %% [markdown]
# This tutorial is about
# - Apply non-zero momentum in CNN
# - Symmetry projection to excited state
# %%
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as jnp
import quantax as qtx
lattice = qtx.sites.Square(4)
N = lattice.nsites
# %%
from quantax.symmetry import TotalSz, SpinIn... |
3f13b50afa0bc2d8be14772b710ec728a071cb6ffe712ed33b1fc4877e66f92b | Jupyter | 2,019 | 77 | # %%
# Boilerplate imports
import numpy as np
import torch
from torch.utils.data import DataLoader
from tqdm.autonotebook import trange
import time
seed = 42
np.random.seed(seed)
torch.manual_seed(seed)
torch.manual_seed(seed)
torch.use_deterministic_algorithms(True)
import matplotlib.pyplot as plt
# %%
# Load NI... |
115a4664638347b9689ffb04a9072fe26a1d2af5b1a394cf128cdd217504625d | Jupyter | 2,027 | 62 | # %%
import pytorch_lightning as pl
from cnn import CNN
from nmnist import NMNISTFrames, NMNISTRaster
import sinabs
from tqdm import tqdm
import torch
import logging
logging.getLogger("pytorch_lightning").setLevel(logging.ERROR)
# %% [markdown]
# Let's load the trained CNN and get the validation accuracy
# %%
batch_... |
ea5ddd318a488ae74be7052dff414713dffc6097d2d9ee7787a5d1090d9bec99 | Jupyter | 2,030 | 51 | # %% [markdown]
# # Load libraries and data for Figure 4
# %%
from library import *
area_dict, active_area_dict = load_area_dicts(session_ids)
path = './files/adjacency_matrices'
G_ccg_dict, offset_dict, duration_dict = load_graphs(path, active_area_dict, weight=True)
measure = 'ccg'
n = 4
S_ccg_dict = add_sign(G_ccg... |
aa4aa048ef210a9307d1705ffef514c824ea8f32b1e741985b61fdf98d5afc26 | Jupyter | 2,033 | 62 | # %%
import scanpy as sc
from anndata import read_h5ad
import pandas as pd
import numpy as np
import os
from os.path import join
import time
import argparse
# inhouse tools
import scdrs.util as util
import scdrs.data_loader as dl
import scdrs.method as md
# autoreload
%load_ext autoreload
%autoreload 2
# %%
# # tms... |
f758b76cd275307afd405961de77c550e2e9d87a22a8625bc669a62363cb0237 | Jupyter | 2,033 | 71 | # %% [markdown]
# # 2. Exploratory data analysis - In-depth profiling
# %% [markdown]
# The first step in a data preparation pipeline is the exploratory data analysis (EDA). In a nutshell, data exploration and data cleansing are hand-to-hand and both are mutually iterative steps.
#
# *But what does data exploration i... |
2e53fe4fc306545d9985f5fb48a7168ffaa92a7083acd6b87d8b9b5f338e9efb | Jupyter | 2,078 | 81 | # %% [markdown]
# This tutorial is about
# - Define J1-J2 Hamiltonian
# - Define CNN with the ability to learn signs
# %%
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as jnp
import quantax as qtx
lattice = qtx.sites.Square(4) # 4x4 square lattice
N = lattice.nsites
# %%
from quantax.symmetry i... |
cdaf58a23bcffd93aa7ede93c634f8f337f9fc9e79512d66cb78ecb16002a26a | Jupyter | 2,107 | 82 | # %% [markdown]
# We start by simply importing our package.
# %%
from pgn.args import TrainArgs
from pgn.train.run_training import run_training
import os
import os.path as osp
# %%
CWD = os.getcwd()
OVM_TOY = osp.join()
# %%
args = TrainArgs()
args.from_dict({'data_path': DATA_PATH,
'dataset_type':... |
07d58c155b25f038b9d7badb7f14b8949b9f0bcb3c63809e83d9145a39dfa83e | Jupyter | 2,136 | 61 | # %%
from transformers import AutoTokenizer, AutoModelForTokenClassification, TrainingArguments, Trainer
import torch
from datasets import load_dataset
# Load the pre-trained ESM-2 model and tokenizer
model_name = "facebook/esm-2-large"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenCla... |
0c31980937e107fc55f06303b531c3aef30af4b872538381ae0dbeda704044d3 | Jupyter | 2,137 | 83 | # %%
import numpy as np
import matplotlib.pyplot as plt
# %%
fig, ax = plt.subplots(figsize=(10, 5))#, dpi=300)
N = 12
x = [
np.concatenate([np.array([0]*e + [1]) for e in np.random.poisson(1.5, 40)])
for idx in range(N)
]
for idx in range(N):
ax.eventplot(np.where(x[idx] == 1)[0], lineoffsets=idx, linelen... |
9910ca55c6319ad9e69b294319f5217ddbe9f032273251fc2cd13f6706de95a8 | Jupyter | 2,147 | 70 | # %% [markdown]
# # FICLE vignette
#
# This vignette is a demonstration of how to run FICLE using the demo data from the input folder to generate the files in the output folder. The input files are a subset of the data generated from an AD mouse model (Leung et al. 2023).
# %% [markdown]
# ### Load modules and FICLE
... |
5665a69b0a2c11e77c9299d4ee3127f50f9ef02007ae68fd864799c946580006 | Jupyter | 2,152 | 65 | # %% [markdown]
# ## This script filtered edit sites from SAILOR; Only keeping Sailor score > 0.5 sites + <80% editing fraction as peakcaller input
# %%
import os
cwd = os.getcwd()
main_dir = cwd
print(main_dir)
# %%
from glob import glob
import pandas as pd
import os
import subprocess
input_dir = main_dir + '/sail... |
143a4c5e455696f2ead3488c122bd29d9fca80bc9c962fedb9e164a87eb648d3 | Jupyter | 2,165 | 77 | # %%
import matplotlib.pyplot as plt
import numpy as np
import nir
from lif_exact_sim import *
# %%
def lif_nir():
"""Run LIF experiment from NIR paper."""
# load NIR model
nir_model = nir.read("lif_norse.nir")
# some checks to be sure we can use the input and neglect the Affine
affine_node = ni... |
40ccab58b67899b56f47308cd50e8b7fd05b8c9ae72b65e40c1c4350fbe3a657 | Jupyter | 2,181 | 89 | # %% [markdown]
# ### 2018-03-23 Random Splitting by Tile and Size Filtering
# %% [markdown]
# Candidate plaques are grouped by their WSI-source, as well as their tile. This ensures that all plaques within a uniform 256 x 256 image are labeled (or multi-labeled) for the subsequent classification task.
#
# We use a p... |
ac9a6387a1236a7cb2704ddb9e7fd1b4edd93daab05240d0b8aea4a422b58adc | Jupyter | 2,195 | 72 | # %%
import lava.lib.dl.slayer as slayer
import matplotlib.pyplot as plt
import numpy as np
import nir
# import norse
import tonic
import os
import torch
import tqdm
import sys
sys.path.append("/Users/steve/Code/NIR/paper")
from nir_to_lava import ImportConfig, LavaLibrary, import_from_nir
# %%
graph = nir.read('cnn... |
53bfb66c9eead181655c12359e4f21a782b02ed0d2bf0ff3a6068dff1c934723 | Jupyter | 2,199 | 63 | # %% [markdown]
# # ASXL1 analysis
# Check individuals with heart failure for variants known to be implicated known mutations in CH or lymphoid and myeloid cancer in the ASXL1 gene
# %%
import pandas as pd
import pickle
import numpy as np
import h5py
# %%
query_gene_id = #put in gene id of ASXL1 as assigned by the p... |
a9cc16835385131f065bfa9c1c284c4ef343abd3d782b8425e7c26c1c9d4c9cb | Jupyter | 2,239 | 60 | # %%
import os, json, time
import numpy as np
from emilys.image.arrayplot import arrayplot2d
from emilys.image.polar import polar_resample, polar_rebin
# %%
with open('../data/STO_110_5x7_60_keV_px003_py012_pdif_tot.json') as f:
dict_sim = json.load(f)
l_data_in = np.fromfile('../data/' + dict_sim['file'], dtype =... |
8718d0bdf94e8d2d204d83cf80bcba050070a94004444d933c185c89372a3fff | Jupyter | 2,241 | 90 | # %%
%load_ext autoreload
%autoreload 2
# %%
import sys
sys.path.insert(0, '../scripts')
from simulation import *
# %%
N = 80000
p = 0.005
K = N*p
P = 16
tau = 0.01
dt = 1e-3
A = 1 #2
theta = 0
sigma = 0.1
# %%
patterns = np.random.RandomState(seed=1).normal(0,1,size=(P,N))
# %%
# Structural connectivity
k = np.ran... |
28e4adfba170963dab959901bf3533c262a530da00f8282afabed079dcec42e5 | Jupyter | 2,260 | 89 | # %%
%matplotlib inline
import matplotlib.pyplot as plt
import sys
sys.path.append('../..')
# %%
import nir
#### Change this to run the different model types
#model_type = 'noDelay_bias_zero'
model_type = 'noDelay_noBias_subtract'
graph = nir.read(f'braille_{model_type}.nir')
import nir_to_nengo
import importl... |
9860e60bde68dc003fe5e4b8b743b7d714a33704323886a09507e5183f8179fe | Jupyter | 2,274 | 95 | # %%
import numpy as np
import pandas as pd
import scanpy as sc
sc.settings.verbosity = 3
sc.logging.print_header()
sc.settings.set_figure_params(figsize = [10,8],dpi =100, facecolor='white')
import matplotlib as mpl
import matplotlib.pyplot as plt
from copy import copy
vir = copy(mpl.cm.viridis)
vir.set... |
899d95d56755dfebe1fc25ad15e4485252056959cc838e5d4dcfc2f03451f4d6 | Jupyter | 2,290 | 70 | # %%
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.pylab as pl
import matplotlib.gridspec as gridspec
import scipy.ndimage as ndimage
from matplotlib.ticker import AutoMinorLocator, FormatStrFormatter
import matplotlib.mlab as mlab
from matplotlib i... |
94ed500ad79a6c56d6cf4498d98d627d2fced29c7ee52b4f2c121df341c38137 | Jupyter | 2,293 | 62 | # %%
import urllib
import numpy as np
import tensorflow as tf
tf.enable_v2_behavior()
from rcnn_sat import preprocess_image, bl_net
# %% [markdown]
# # Restore model and extract activations
# This example shows how to extract activations from a pre-trained model. We'll use the BL model trained on eco-set.
# %% [mar... |
9c1488b913d92dfafb129dca09c69c6a19b65a8b475b9a5fcdbb5ad0f8a32d8e | Jupyter | 2,293 | 78 | # %% [markdown]
# ## Run this script to execute detailed sampling of ablation conditions used for publication
# %%
import numpy as np
import os
import tensorflow as tf
import keras
from keras import backend as K
import matplotlib.pyplot as plt
from model import trainableInput
from keras_dynamicLayers_RNNcell_dualModel... |
080f154ad70c20d16191e3e89e28390fb773a67f91c6d6a7f87079cc03a165fa | Jupyter | 2,311 | 70 | # %%
import numpy as np
import scanpy as sc
import pandas as pd
import matplotlib.pyplot as plt
from os.path import join
# %%
raw_dir = "raw/ayhan_2021/"
# %%
adata = sc.read_text(join(raw_dir, "exprMatrix.tsv.gz"))
meta = pd.read_csv(join(raw_dir, "meta.tsv"), sep="\t")
adata.var = meta
adata = adata.T
adata.obs = a... |
ccc42f3b7df364b3cebbfcb273a9ecc0b53580659bbe2c2dae407c83a15f8ad9 | Jupyter | 2,335 | 60 | # %% [markdown]
# # Check if all necessary ERA5 data files exist in the input_data_ERA5 directory
# %%
proj_dir='/path/to/main_project_folder/' # edit this line
import os
import itertools
import json
import multiprocessing as mp
import sys
sys.path.append(proj_dir)
from project_fxns import parameters as param
from pr... |
8c2aed89412508c0c4908a45ce3885aaf50d8762bfc00242c0b554b669da98ff | Jupyter | 2,339 | 89 | # %% [markdown]
# In this tutorial we present the meeglet for creating wavelets API for creating wavelets.
#
# For a deep-dive into mathematical background and comparison against alternative definitions, please see [Morlet wavelet definition](../background/1_background_wavelets.html)
# %%
import numpy as np
import ma... |
563dc1ba477223dc1145004b6ef423548e54dbdfba5e9c46da54498eb942eca4 | Jupyter | 2,340 | 91 | # %% [markdown]
# (document-tag-to-refer-to)=
#
# # Creating an Example
#
# This is an example template file for writing Jupyter Notebooks in markdown, using MyST.
# For more information on MyST notebooks, see the
# [MyST-NB documentation](https://myst-nb.readthedocs.io/en/latest/index.html).
# If you want to learn m... |
138ae397c8bc74c5f2af0afa9ebc3310421eefee5f445bd42c222ccd20e26d7b | Jupyter | 2,343 | 67 | # %%
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from plot_funcs import label_axes
# %%
plt.style.use('default')
# plt.style.use('nature_style.mplstyle')
# plt.style.use('thesis_style.mplstyle')
# %%
df = pd.read_csv('treatment.csv')
# %%
df.head()
# %%
df['growthrat... |
4b7126f2962709c081b2b9cf8015a2fc7f11c1e582c938f6aacfd964a3527e17 | Jupyter | 2,355 | 111 | # %%
import pypylon.pylon as py
# %%
from pypylon import pylon
# %%
camera_serials = [24535665, 24548223]
# %%
NUM_CAMERAS = 2
# %%
tlf = py.TlFactory.GetInstance()
# %%
tlf
# %%
# create a device filter for Pylon CamEmu devices
di = py.DeviceInfo()
# %%
di
# %%
devs = tlf.EnumerateDevices([di,])
# %%
devs
# ... |
388641795cf604ed988976ebcc24960a0f7d6f2380b0ebb072dca5acc88a0974 | Jupyter | 2,360 | 78 | # %% [markdown]
# ### 1.1 Preprocessing - Reinhard Normalization and WSI Tiling
#
# As a first preprocessing step, all slides were color normalized with respect to a reference image selected by an expert neuropathologist. Color normalization was performed using the method described by [Reinhard et. al](https://ieeexpl... |
288b4ce3e3474301a435065582ef5a5aed1384261cfa0052667ff1d883863a59 | Jupyter | 2,363 | 88 | # %%
# Case Studies
# %%
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import numpy as np
from numpy import genfromtxt
import tensorflow as tf
from tensorflow import keras
import pandas as pd
from feature import get_motif_feature
# %%
# Prepared RNA motifs
case1 = ['(C,G) AGACA (G,C) CCA'] # OC-3, TRAF3
case2 =... |
b3a7f33b268793bbc29b97dbd51e1289c7cc97fb2e3fd5854a173e619bacf039 | Jupyter | 2,368 | 61 | # %% [markdown]
# # Load necessary libraries and functions
# %%
# Only two files are needed for reproducing the example results: "./files/adjacency_matrices/756029989_natural_scenes.npz" and "./files/adjacency_matrices/756029989_natural_scenes_confidence.npz"
from signed_motif_detection import *
# %% [markdown]
# # L... |
aa558698b5f156fba6f87a0b4238684c0067a5e9ebacc785bad58d1f13139d60 | Jupyter | 2,371 | 74 | # %%
# https://github.com/basler/pypylon/issues/513
# https://github.com/basler/pypylon/issues/569
# %%
lass MetaArrayQueue(ArrayQueue):
"""A small extension to support metadata saved alongside arrays"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def put(self, element,... |
a7f0ad515a010317c97d931e2303c6c243ab27988e5dcf208211d6c362408413 | Jupyter | 2,373 | 85 | # %%
%matplotlib inline
import matplotlib.pyplot as plt
# %%
import nir
graph = nir.read('cnn_sinabs.nir')
import nengo
import numpy as np
import nengo_import
# %%
import tonic
import torch
bs = 1
collate = tonic.collation.PadTensors(batch_first=False)
to_frame = tonic.transforms.ToFrame(sensor_size=tonic.datasets.N... |
d08ecd1e82e75ba90a12cc36fe1f3327a4024d841d8017103a9558234b5c5d75 | Jupyter | 2,379 | 80 | # %% [markdown]
# # Training Data Generation
#
# In this step we will extract the training/validation data from the even/odd tomograms.
# %%
from generate_train_data import *
import mrcfile
from os.path import join, isdir
from os import makedirs
from matplotlib import pyplot as plt
import numpy as np
# %%
# Load ... |
2c21de3493ea9c96f6e9b76fb8839a0dc9be394c4c06a29830a0baadd2893783 | Jupyter | 2,392 | 95 | # %% [markdown]
# # Test notebook lazy pipeline
# %%
# Installed packages
import pandas as pd
# Testing
from IPython.utils.capture import capture_output
# Our package
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
# %%
# Read the Titanic Dataset
file_name = cache_file(
... |
98532a977f7c1cdf8f07cdeb5424f561cebe7a5374b3c8cc2a12292fede142f8 | Jupyter | 2,401 | 73 | # %% [markdown]
# ## This script makes intersected .bed files for replicates as "confident editing clusters"
# %%
import os
cwd = os.getcwd()
main_dir = cwd
print(main_dir)
# %%
import pybedtools
import os
from glob import glob
peakcaller_bed_dir = main_dir + '/flare_filtered/peak_calling/'
all_sample=sorted(glob(os... |
a377bb57756fc3a4b4e26a7e898ed65743d4184a67f06a0253c74e51966e62ea | Jupyter | 2,404 | 95 | # %% [markdown]
# # Test notebook Meteorites
# %%
from pathlib import Path
import numpy as np
import pandas as pd
import requests
from IPython.display import display
from IPython.utils.capture import capture_output
import data_profiling
from data_profiling.utils.cache import cache_file
# %%
file_name = cache_file(
... |
d6f28346a4e70860e0d519625bfe19f960347c0619291feb7c84492db81649ce | Jupyter | 2,405 | 47 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from SARSA_function_qiyun import generate_action_reverse_TD0,generate_action_uncertain_TD0,generate_action_stable_TD0
import pandas as pd
import os
import glob
# %%
# A list used for storing generated data, with each element representing a dat... |
0ecc0cfbac910365f0edb4be47b3bea4ce25b99a0cf16a063029e9f1edc6b608 | Jupyter | 2,407 | 58 | # %%
from pybioportal import clinical_data as cd
# %%
df1a = cd.fetch_clinical_data(attribute_ids=["SEX", "RACE"],
entity_study_ids=[
{"entity_ids": ["P-0000004", "P-0000950"], "study": "msk_met_2021"},
{"entity_... |
ede056283de1dc6fd40315b0ca0be4eacb7d4528e619e1af6af740f693e780b6 | Jupyter | 2,411 | 76 | # %%
from fairchem.core import FAIRChemCalculator
import ase.io
from ase.optimize import LBFGS
from fairchem.data.oc.core import Adsorbate, AdsorbateSlabConfig, Bulk, Slab
import os
from glob import glob
import pandas as pd
from fairchem.data.oc.utils.vasp import write_vasp_input_files
# %% [markdown]
# ## Define des... |
17f719043270dde4d2a0830c888e06258afe129d1f5f394bf1343e4b543d46f9 | Jupyter | 2,436 | 75 | # %%
import numpy as np
import matplotlib.pyplot as plt
from lgca import get_lgca
from itertools import product
import pickle as pkl
PATH = '.\\data\\gog\\nonlocaldensity_10reps\\'
parameters = np.load(PATH+'params.npz', allow_pickle=True)
PATH = '.\\data\\gog\\nonlocaldensity_recurrence\\'
constparams = parameters['co... |
7151225c0a1327d606b6401aab7e3c3319a3cb2d319d702656b4aa5f555ff102 | Jupyter | 2,441 | 83 | # %%
import nir
import torch
import numpy as np
from rockpool.nn.modules.torch.nir import from_nir, to_nir
# %%
!ls
# %%
nir.read("braille.nir").edges
# %%
nirgraph = nir.read('braille.nir')
net = from_nir(nirgraph)
net
# %%
### TEST DATA
test_data_path = "data/ds_test.pt"
ds_test = torch.load(test_data_path)
# %... |
6cc1fad78dbd2afc9b909563a047181929461c072bbcd777290922a124891317 | Jupyter | 2,459 | 100 | # %% [markdown]
# ## YData Profiling: NASA Meteorites example
# Source of data: https://data.nasa.gov/Space-Science/Meteorite-Landings/gh4g-9sfh
# %% [markdown]
# The autoreload instruction reloads modules automatically before code execution, which is helpful for the update below.
# %%
%load_ext autoreload
%autoreloa... |
8ed93f72e4f62d71cf376ba65d00d1664a1af3abe4153f68d44a131d4bee7bdf | Jupyter | 2,470 | 89 | # %% [markdown]
# (tune-comet-ref)=
#
# # Using Comet with Tune
#
# <a id="try-anyscale-quickstart-tune-comet" href="https://console.anyscale.com/register/ha?render_flow=ray&utm_source=ray_docs&utm_medium=docs&utm_campaign=tune-comet">
# <img src="../../_static/img/run-on-anyscale.svg" alt="try-anyscale-quickstar... |
9787eb8e89a0d45d8c30791d66924eb49c073e97553a85346f4672e048a3e912 | Jupyter | 2,477 | 87 | # %%
import numpy as np
import pandas as pd
import os
import math
# %%
results = pd.read_csv('Batch_4655371_batch_results.csv')
uids = pd.read_csv(
'../final/youtubemix-unconditional-16s-exp-1/uids.txt',
sep=' ',
header=None,
names=['method', 'filename','uid'],
)
# %%
responses = []
for col in resu... |
ae7378fc6ccbeee6480306e45c53a33f6ab3dff6df2e38dbe41041ded5b82343 | Jupyter | 2,504 | 91 | # %% [markdown]
# This tutorial is about
# - Work with complex numbers in quantax
# - Solve triangular J1-J2 model
# - Impose prior sign structure in NQS
# %%
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as jnp
import quantax as qtx
from IPython.display import clear_output
# Computations outsid... |
c95f8f7d06d497176bbf3b746dd640ba4498a0d3c7c6d32b4046917ad528baad | Jupyter | 2,505 | 103 | # %%
!pip install -q zarr
# %%
import os
from os.path import join
import dask
import dask.array as da
import pandas as pd
import numpy as np
import numba
from numba.typed import Dict
from numba import prange
# %%
PATH = '/mnt/dssfs02/cxg_census/data_2023_05_15'
# %% [markdown]
# # Get idxs for subsampling
# %%
ob... |
441c97f82375e105562f7ea110e51a994d85620e727424e2242e8ce375f7e349 | Jupyter | 2,512 | 79 | # %% [markdown]
# # Predict cryo-CARE
#
# In this notebook we will take the two reconstructed (even/odd) tomograms and apply the trained network to them. Afterwards we will average them voxel-wise to get our final restored tomogram.
# %%
from train_cryo_care import CryoCARE
from generate_train_data import normalize, ... |
d8b6feb730392200cd1d4cd8eb9182333c99b28a12aa9243ea5acbc65694a898 | Jupyter | 2,529 | 92 | # %%
import sys
import os
import pandas as pd
from Bio import SeqIO
from tqdm import tqdm
import json
path_project = "/media/concha-eloko/Linux/depolymerase_building"
phagedepo_df = pd.read_csv(f"{path_project}/Dpo_domains.phagedepo.0805.final.tsv", sep = "\t", header = 0)
phagedepo_df
# %%
from transformers impo... |
e59adcdc945a4151ff6846ee4603d52e766d2b5c39d3f3b9dd41667548222397 | Jupyter | 2,545 | 78 | # %%
from txgnn import TxData, TxGNN, TxEval
TxData = TxData(data_folder_path = '/n/scratch3/users/k/kh278/kg/')
TxData.prepare_split(split = 'complex_disease', seed = 42, no_kg = False)
# %%
TxGNN = TxGNN(data = TxData,
weight_bias_track = False,
proj_name = 'TxGNN',
exp_na... |
94ef4c5377822a2c4a789dcf4ca034f5e92330c1a7ca09be541f05076233603f | Jupyter | 2,554 | 66 | # %%
import numpy as np
from tirl import fsl
from tirl.timage import TImage
import os
import sys
import nibabel as nib
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
# %%
# load defaults
bmpath = '/vols/Data/km/ahoward/BigMac-clean'
struct_ref_fpath = bmpath + '/MRI/Postmorte... |
ac1035349c89431aab1eec1c9ad08deaec05e70f075719adab2c5c7de4ea6335 | Jupyter | 2,569 | 92 | # %%
#import
import logging
import numpy as np
import pandas as pd
import os
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.impute import KNNImputer
from sklearn.neighbors import KNeighborsClassifier
from umap import... |
382ea59f41ce6c25b9964c37c788eadb23a3114674c17f3d49b042d758b78bcc | Jupyter | 2,591 | 74 | # %%
import numpy as np
import pandas as pd
import scanpy as sc
from os.path import join
# %%
raw_dir = "raw/zhong_2020/"
# %%
adata = sc.read_mtx(join(raw_dir, "GSE119212_hippocampus_aggr_8_matrix.mtx.gz")).T
df_cell = pd.read_csv(join(raw_dir, "GSE119212_hippocampus_aggr_8_barcodes.tsv.gz"), sep='\t', header=None, ... |
cbb32936afbc7b0835cf46d34eefc1d00148b5d943574b916c4c2cb6423cee3f | Jupyter | 2,612 | 79 | # %%
import os
import numpy as np
import emilys.image.shift as sh
import matplotlib.pyplot as plt
import emilys.image.arrayplot as aplt
#%matplotlib inline
# %%
sworkdir = r'C:\Data\Python\data\PICO\stab\200_190211_1'
# %%
sfpre = 'img_' # image name prefic
sfsuf = '.raw' # image name suffix
nimg0 = 1 # first image i... |
13c35a3385742db1270f1eef392145e617dfc52da82c34c3733b8d2cc984dc16 | Jupyter | 2,617 | 96 | # %% [markdown]
# We perform the same computations using MATLAB.
#
# With a few exceptions, the arguments are named the same.
#
# The same default options are set.
#
# The examples below processes the MNE sample EEG data in MATLAB and then computes
# power spectra as in the [EEG power](../tutorials/plot_eeg_power.ht... |
fead802e2c037cb0c9384c2123b8c9b8878cdd9717f087af06c404232fe1eee8 | Jupyter | 2,621 | 89 | # %%
import numpy as np
winSize = 500
def matPic (line):
cols = line.split(',')
counts = [int(i) for i in cols]
import math
import numpy as np
pic = np.zeros((100, 100), float)
if sum(counts) == 0:
return pic
binSize = math.floor(winSize/100)
binTotal = math.floor(winSize/binSize)
binned = []
#B... |
1bef8d6e1ce2a08abd65dff32b315c83243f8231b7576b2606e06323b84fe727 | Jupyter | 2,625 | 99 | # %% [markdown]
# # Transformations
# %%
!pip install napari
!pip install SimpleITK
# %%
%reload_ext autoreload
%autoreload 2
%matplotlib inline
%gui qt
import os
if 'TEST_ENV' in os.environ:
TEST_ENV = os.environ['TEST_ENV'].lower() == "true"
else:
TEST_ENV = 0
print(f"Running test environment: {bool(TEST_EN... |
7c2014ffb34fb4086a1daa83619e562f2213a49dba77fa737d1bae4d67294cba | Jupyter | 2,627 | 89 | # %%
import numpy as np
winSize = 500
def matPic (line):
cols = line.split(',')
counts = [int(i) for i in cols]
import math
import numpy as np
pic = np.zeros((100, 100), float)
if sum(counts) == 0:
return pic
binSize = math.floor(winSize/100)
binTotal = math.floor(winSize/binSize)
binned = []
#B... |
c30eb8dede91f294a2d0f6c9591b9b5cc00feaa9692a680838113c457f90481b | Jupyter | 2,635 | 68 | # %% [markdown]
# # Download ERA5 data files from Copernicus Climate Data Store (CDS)
# ### Only downloads requests with status "completed"
# ### view the status of each request at https://cds.climate.copernicus.eu/cdsapp#!/yourrequests
# ### see https://cds.climate.copernicus.eu/api-how-to for details on using the CDS... |
1ceb686a7718a665f75af6417f23f9ffb6fac805cecd931655aff63f907fa489 | Jupyter | 2,648 | 65 | # %%
import os
import random
import subprocess
from multiprocessing import Pool
import time
import pandas as pd
# Generate a list of path of filtered MSA
path_decipher = "/home/conchae/prediction_depolymerase_tropism/prophage_prediction/prophage_decipher/phageboost/phageboost_70_20102022"
path_files = "/home/conchae/pr... |
43932d4a5dc9d052bfc84fad04a6f7c10a2f6dee4194fa050925e9ce55590509 | Jupyter | 2,649 | 94 | # %% [markdown]
# <a href="https://colab.research.google.com/github/alvaroalon2/NER4COVID/blob/main/NER4COVID.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# %%
!pip install transformers
# %%
!pip install wget
# %%
from transformers import AutoT... |
1e7037654b83af2be59185eb11d40dd7e6e407e4575a4fe75e5e3585b8668eaf | Jupyter | 2,658 | 75 | # %% [markdown]
# # Webscrapp the depolymerase sequences :
# %%
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from seleni... |
452087c5fa0227b4e7ed5fd83c66e9fb1e32277da0bc95913be0d8a0aa1890c9 | Jupyter | 2,658 | 74 | # %% [markdown]
# # Load libraries and data for Figure 1
# %%
from library import *
area_dict, active_area_dict = load_area_dicts(session_ids)
path = './files/adjacency_matrices'
G_ccg_dict, offset_dict, duration_dict = load_graphs(path, active_area_dict, weight=True)
measure = 'ccg'
n = 4
S_ccg_dict = add_sign(G_ccg... |
a6c0f5afd1a74479f8993f26568b6608175a2babbfb2e1ffd09ee776bee17711 | Jupyter | 2,659 | 112 | # %%
import spyx
import spyx.nn as snn
import jax
import jax.numpy as jnp
import numpy as np
import nir
import matplotlib.pyplot as plt
# %%
input_data = jnp.transpose(jnp.array(np.load("cnn_numbers.npy"), dtype=jnp.float32), axes=(1,0,2,3,4))
# %%
input_data.shape # had to transpose data because it's stored in ti... |
aaa14e8aa2540781c65f354d0e5ceef95f7b6abe5adfd43ce6050fb58d12e5f3 | Jupyter | 2,667 | 111 | # %%
!pip install celltypist==1.5.3
# %%
from os.path import join
import anndata
import scanpy as sc
import numpy as np
import pandas as pd
import dask.dataframe as dd
from scipy.sparse import csr_matrix
from tqdm.auto import tqdm
# %%
DATA_PATH = '/mnt/dssmcmlfs01/merlin_cxg_2023_05_15_sf-log1p'
CKPT_PATH = '/mnt/... |
a34555882268c9b383841db2b0f252dc521ffef819a8fc25294784aa3941f71d | Jupyter | 2,668 | 83 | # %%
import scanpy as sc
import pandas as pd
import numpy as np
import scipy as sp
from statsmodels.stats.multitest import multipletests
import matplotlib.pyplot as plt
import seaborn as sns
from anndata import AnnData
import os
import time
from gprofiler import GProfiler
# scTRS tools
import scTRS.util as util
import... |
52811079e93fcc4866246dd3d2f83becf00f36aadda2999af8c3e43aee6295fa | Jupyter | 2,675 | 43 | # %%
from pybioportal import generic_assay_data as gad
# %%
df1a = gad.fetch_generic_assay_data_in_molecular_profile(molecular_profile_id="brca_tcga_phosphoprotein_quantification",
generic_assay_stable_ids = ["TULP4_pS563", "TEP1_pS397"],
... |
bd63679c073e96726baff1e92ea49e3d9da01b57e43e4e57185a46d9d3fc89ad | Jupyter | 2,676 | 106 | # %% [markdown]
# # Generate config files for new SAILOR pipeline (snakemake), hg38, with default settings
# %% [markdown]
# ### This script will make sailor.qsub, sailor_snakemake.sh and hg38_sailor_config_ct.json
# %%
import os
cwd = os.getcwd()
main_directory = cwd
print(main_directory)
# %%
import subprocess
c... |
3fa4c42d1c6cf2f513873341ba10662a907112a54f6e216f10b5f0c0f13e81bf | Jupyter | 2,699 | 96 | # %%
import scanpy as sc
import pandas as pd
import numpy as np
import scipy as sp
from statsmodels.stats.multitest import multipletests
import matplotlib.pyplot as plt
import seaborn as sns
from anndata import AnnData
from anndata import read_h5ad
import os
import time
from gprofiler import GProfiler
# scTRS tools
im... |
276757f38d9ddc44fcbbc2e8faec475d01d0ca9681340aaa72b4be0faed3083a | Jupyter | 2,703 | 97 | # %% [markdown]
# # Import backage
# %%
import sys
sys.path.append("../..")
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import random
%matplotlib inline
# %%
import torch
from torch import nn
from torch import distributions
from torch.nn.parameter import Parameter
from exp.sir.train i... |
76f82e044420e54dbc97c15b2bcd3d41f795e67cf1a845e167c84160a945ec1b | Jupyter | 2,714 | 91 | # %% [markdown]
# # How To Leak The Neurons On The Devkit
#
# To leak the neuron, all you need to do are:
#
# - Make sure you have a bias term for the torch.nn.Module.
# - Setting the external slow-clock frequency.
#
# Then the bias term will be added to the neuron's membrane potential at every clock cycle.
# %%
im... |
d655f1ed64d08aac25a66af1a2b687d6a205ddd2f834ebfb8680707a7f501d3e | Jupyter | 2,721 | 95 | # %%
%pip install davos
import davos
davos.config.suppress_stdout = True
# %%
smuggle numpy as np # pip: numpy==1.24.2
smuggle matplotlib.pyplot as plt # pip: matplotlib==3.7.0
smuggle pandas as pd # pip: pandas==1.5.3
smuggle seaborn as sns # pip: seaborn==0.12.2
from sklearn.... |
251cc25047954e3077c254791e893611fbda62247b5017d9da13256273884a06 | Jupyter | 2,725 | 108 | # %% [markdown]
# This tutorial is about
# - Define Heisenberg Hamiltonian
# - Define CNN neural quantum state
# - Symmetrize wave functions
# %%
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as jnp
import quantax as qtx
lattice = qtx.sites.Square(4) # 4x4 square lattice
N = lattice.nsites
# %%... |
ce2d812dcebe7cac4d7fb6d4e2b85b30ea815aed9892f76203f397e3d4c0a5db | Jupyter | 2,726 | 95 | # %% [markdown]
# ## Data Analysis
#
# ### Eigen-shapes
# Loads and converts radial measurement data from segmentation into PCA based on reference data set
# %%
from tools.wormParam import *
from tools.imgCalibration import *
from tools.shapeAnalysis import *
from tools.waveletFunct import *
import numpy as np
import... |
a78e4d4c0fdacfc24f4efcd0eeb0aee6dd2f7c98ae8db266791e8ebbfe92d1ff | Jupyter | 2,737 | 105 | # %%
!pip install -e /dss/dsshome1/04/di93zer/git/cellnet --no-deps
# %%
import os
import seaborn as sns
import torch
from lightning.pytorch.callbacks import ModelCheckpoint, LearningRateMonitor, TQDMProgressBar
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch.utilities.model_summary imp... |
e58521e28de07c32086ac4f752f12df84a5e504005a05cd6341670d17beb3611 | Jupyter | 2,738 | 68 | # %% [markdown]
# # Inference
#
# Use this notebook to run inference in the Cloud (e.g., on Google Colab).
#
# On Google Colab, set runtime type too "Python3" and optionally select "GPU".
# A GPU is not required, but reduces the processing time.
# %%
# Install deeplabcut (fixed, tested version)
!pip install deeplabc... |
e8cfc42b439243e5de96a882e59d6a49247244e10e7e6e86a2ebc4818dc6fad0 | Jupyter | 2,739 | 83 | # %%
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.pylab as pl
import matplotlib.gridspec as gridspec
import scipy.ndimage as ndimage
from matplotlib.ticker import AutoMinorLocator, FormatStrFormatter
import matplotlib.mlab as mlab
from matplotlib i... |
53b396996614571f1ace31189d8f77b782c20fa24307f8342501e45275a2503c | Jupyter | 2,744 | 138 | # %%
import matplotlib.pyplot as plt
import cv2
import numpy as np
from IPython.display import display, Image
import ipywidgets as widgets
import threading
import time
# %%
# Stop button
# ================
stopButton = widgets.ToggleButton(
value=False,
description='Stop',
disabled=False,
button_style=... |
b5a58b1d611298a3003b6d6a38305c38a47a6502cbc06f11ea0562531072c7cc | Jupyter | 2,750 | 77 | # %%
import numpy as np
import matplotlib.pyplot as plt
import scipy
import os
import cv2
import tifffile
# %%
def make_cell(img, cell_size_min, cell_size_max):
curr_mean = np.random.uniform(0, img.shape[0], 2)
curr_cov = np.array([[np.random.uniform(cell_size_min, cell_size_max), 0], [0, np.random.uniform(cel... |
3b6ad80f31f8530e0c5bdff3666b5fc8172ea004f52490901aa0429a4b23c005 | Jupyter | 2,760 | 108 | # %%
from nested_cv import NestedCV
import pandas as pd
import numpy as np
from sklearn.datasets import load_boston, load_iris, load_breast_cancer
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from sklearn.model_selection import KFold
# When using Random Search, we get a user warning with... |
52bea38d366c76affb1ba5d60d8122b1505e0c9bf37f80910b3f4ee8ca8a2302 | Jupyter | 2,783 | 120 | # %%
%load_ext autoreload
%autoreload 2
# %%
import sys
sys.path.insert(0, '../scripts')
from simulation import *
# %%
P = 16
N = 80000
x_f = 1.5
q_f = 0.8
theta = 0
sigma = 0.05
tau = 1e-2
dt = 1e-3
p = 0.005
K = N*c
A = 10
# %%
patterns = np.random.RandomState(seed=1).normal(0,1,size=(P,N))
# %%
# Structural conn... |
05000e77497552bd013a788d44518cf18e446dc121e562ba7a87523522bff0e7 | Jupyter | 2,787 | 82 | # %% [markdown]
# # Load model package
# %%
import sys
sys.path.insert(1,'./src_VI/')
from ZIV import ZIV
# %% [markdown]
# # Load data simulation package
# %%
sys.path.insert(1,'./src_simulation/')
from data_sim import sim_tobit_data, show_sim
# %% [markdown]
# # Load other packages
# %%
import pandas as pd
impor... |
98ee093e83d22eb4ff0908ed4fcdc18f50f9aed60a8e76e8f23adceab2778e20 | Jupyter | 2,788 | 18 | # %% [markdown]
# # `GCDM-SBDD` Tutorial, Part 1 - Generating Molecules in Target Protein Pockets
# %% [markdown]
# ## Overview
#
# `GCDM-SBDD` provides a flexible means of sampling new 3D molecules for unseen protein pockets of interest. As an illustrative real-world example, one can do so using the following 3-step... |
38414ed62e4785fe2f2d7be0a897d757adcea71a6c8d32b6bf93b8ce39d3d014 | Jupyter | 2,824 | 114 | # %%
import torch
import torch.nn as nn
import snntorch as snn
import numpy as np
from snntorch import import_from_nir
import nir
# %%
graph = nir.read("cnn_sinabs.nir")
graph.nodes.keys()
# %%
net = import_from_nir(graph)
# %%
net
# %% [markdown]
# ## 1) Spike activity of the hidden layer
# %%
inp_data = torch.fr... |
15f35d4721fe74aa3559ef9af833a4de88cb733f33a8a97dafe0309693a79ef9 | Jupyter | 2,845 | 73 | # %%
from method.utils import split_dataset, train_model, get_metrics, calculate_permutation_importance
from method.classifier import Single_GRU
import matplotlib.pyplot as plt
from collections import Counter
import numpy as np
import warnings
import os
warnings.filterwarnings('ignore')
os.environ['TF_CPP_MIN_LOG_LEVEL... |
ecd50097e5762cabb32826e764761be2b2ceb9d9b0a16e833a06f8464aaaa480 | Jupyter | 2,860 | 90 | # %%
import numpy as np
import pandas as pd
from SERGIO.sergio import sergio
# %% [markdown]
# # Simulate Clean Data _ Steady-State Simulation
# %%
sim = sergio(number_genes=100, number_bins = 9, number_sc = 300, noise_params = 1, decays=0.8, sampling_state=15, noise_type='dpd')
sim.build_graph(input_file_taregts ='d... |
81dca499d726bbeb7207508e8dbcae62c488d6aced3622fb778a0aac11944c72 | Jupyter | 2,889 | 86 | # %%
import scanpy as sc
import pandas as pd
import numpy as np
import scipy as sp
from statsmodels.stats.multitest import multipletests
import matplotlib.pyplot as plt
import seaborn as sns
from anndata import AnnData
import os
import time
from gprofiler import GProfiler
# scTRS tools
import scdrs.util as util
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.