sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
97640679f945ed3bb3e01169e229d92cf2ca0a0d17ee16071132e34ca82f4d1a
Jupyter
7,437
231
# %% [markdown] # # 梯度计算效率比较 # %% [markdown] # ## 概述 # # 在本教程中,我们比较了通过 TensorCircuit 提供的自动微分框架和 Qiskit 提供的传统参数平移框架对梯度和类梯度对象(例如量子费雪信息)进行估测的效率。 # %% [markdown] # ## 设置 # # 我们从 Qiskit 和 TensorCircuit 导入必要的包和模块。 # %% import time import numpy as np from functools import reduce from operator import xor from qiskit.opfl...
db5737edb287d88a69049a8a9c642090e7b6ea7b75adb183d6190f255a6c76cc
Jupyter
7,459
237
# %% [markdown] # # Protein ↔ Pathway Relation-Wise Merge # # Merges Protein–Pathway triples from CrossBAR (×2) and TARKG; fills protein head names # from UniProt; deduplicates by `(head, relation, tail)`; and saves the result. # %% [markdown] # ## 0. Configuration # %% import os import pandas as pd import numpy as ...
4dc7fd48d02f21a1f0f894bad1c707055fe4ef840da65871bf132b69f74f917f
Jupyter
7,471
264
# %% [markdown] # # QML in PyTorch # %% [markdown] # ## Overview # # In this tutorial, we show the MNIST binary classification QML example with the same setup as [mnist_qml](mnist_qml.ipynb). This time, we use the PyTorch machine learning pipeline to build the QML model. # Again, this note is not about the best QML p...
3a7a2e01d44f97423162d09e063766576cab2747ddc8f529cc5ca429b84e259c
Jupyter
7,475
299
# %% import pandas as pd import numpy as np import glob import os from tqdm import tqdm # %% !pwd # %% [markdown] # %% # Monarch/Monarch_final/Mouse/Gene_Mouse_Phenotype.csv # hmdhp/hmdhp_MOUSE_GENE_PHENOTYPE.csv # mgi_do/mgido_MOUSE_GENE_PHENOTYPE.csv # %% BASE_DIR = '/storage/Arushi/090526_EvoAge/kg_formatio...
2c8c8b737874c8c95b80e7d7fde3f5b8e73e9e26e229dbaab64e31e0edf314ae
Jupyter
7,485
220
# %% [markdown] # # Regression Pipeline # %% [markdown] # This notebook serves as a template for performing a group difference comparison using BFP and BrainSync. The steps in this pipeline can be easily customized to suite your study. Here, we use data from ADHD200 dataset available through http://fcon_1000.projects...
c18c48e1d22de831f16f7c1c96446e214a2d04b9e5f845b7c2edb17c5cc899cc
Jupyter
7,490
292
# %% import numpy as np import pandas as pd from tqdm import tqdm tqdm.pandas(ascii=True) from rdkit import Chem import seaborn as sns from sklearn.cluster import AgglomerativeClustering, DBSCAN, SpectralClustering from scipy.stats import ks_2samp, chisquare, power_divergence import tmap, os from faerun import Faer...
35f6c234120b73cd172e0476285852976a989908fabb26797fde58eb6108f620
Jupyter
7,517
237
# %% import pandas as pd import numpy as np import re # %% !pwd # %% [markdown] # # Mappings # %% your_path_here = '/storage/Arushi/090526_EvoAge/kg_formation/data_collection/' # %% # %% Pubchem = pd.read_pickle(f'{your_path_here}databases_for_mapping/pubchem/combined_df.pkl') # %% ## Gprofiler_protein to gene ...
48bea27d57f5b211e02f0c79af6f285da30c5749353a18abebf24c88af1b1e26
Jupyter
7,530
272
# %% [markdown] # # multi-task alternate training strategy--clearence prediction # %% from molmap import model as molmodel import molmap import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm from joblib import load, dump tqdm.pandas(ascii=True) import numpy as np import tensorflow as tf import o...
fab7647e8bb2fbeb7a9729fa37e156bd36ce41f6b1d6ae120fbc9b631cc93301
Jupyter
7,533
230
# %% [markdown] # # CellularComponent → CellularComponent Relation Pipeline # # Builds a unified, deduplicated edge table for the **CellularComponent–CellularComponent** relation. # # **Output schema:** `head | relation | tail | head_type | relation_type | tail_type | kg_source | head_id_is | tail_id_is | head_detail...
6ac6b9596419db0a2d808e9e55c45edf3b2acad24d3fbb1229d6cf32e11931c3
Jupyter
7,572
199
# %% [markdown] # # Build surface # ###### Last updated 2024-04-24 (ASH) # ###### Updated by ETU on 2024-05-06 # This notebook walks though constructing a surface using a single long chain of bead type "A". This can be used to build homogenous surfaces in PIMMS. # # ### Approach # Broadly, the approach here is to: # ...
ea6a0862b6d58a0a749e24cc1a41619b16c9ec77203d8f02721231b35721971b
Jupyter
7,572
304
# %% [markdown] # # Phenotype ↔ Disease Relation-Wise Merge # # Merges Phenotype–Disease triples from PrimeKG; resolves disease tail names via DO; # deduplicates by `(head, relation, tail)`; and saves the result. # # %% [markdown] # ## 0. Configuration # %% import os import pandas as pd BASE_DIR = '/storage/Arush...
735a56ec261d61ce638390c4f326dd4570792e9ebb4b442fa599c193dffa8109
Jupyter
7,606
234
# %% [markdown] # # Evaluation on Pauli String Sum # %% [markdown] # ## Overview # %% [markdown] # We need to evaluate the sum of many Pauli string terms on the circuit in various quantum algorithms, the ground state preparation of a Hamiltonian $H$ in VQE is a typical example. # We need to calculate the expectation ...
763a8d16949924a4a643613dc47ea37349d622676d2e16c212941ebb5c47e73a
Jupyter
7,623
231
# %% [markdown] # # Gradient Evaluation Efficiency Comparison # %% [markdown] # ## Overview # # In this tutorial, we compare the efficiency of gradient and gradient-like object (such as quantum Fisher information) evaluation via automatical differentiation framework provided by TensorCircuit and the traditional param...
eac79fc9c4a831e352ef581bfe702e6e9a5cc9abb135848abcf99a181574df05
Jupyter
7,633
275
# %% [markdown] # Spike trains are generated using univariate, self‐exciting Hawkes point process with an exponential kernel, using Ogata’s thinning algorithm. # %% import numpy as np import pandas as pd import pickle from isttc.scripts.cfg_global import project_folder_path from isttc.spike_utils import simulate_haw...
ae4ab0358392c6f342bea724698968f46b823624df7e5b31c01efd8d4879ceb6
Jupyter
7,650
221
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 14:35:35 2025 laminar analysis @author: yuhui """ import os import glob import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats from statsmodels.stats.multitest import multipletests import pandas as pd from statsmodels....
6de755ca7ce9bac5e33db5c171cfa55b6ef45e3c06bc065e54ed93915cd8230b
Jupyter
7,651
289
# %% import cedalion.dot from pathlib import Path import trimesh import pymeshlab import pyvista as pv import cedalion.vis.blocks as vbx import numpy as np import nibabel.freesurfer import nibabel from collections import Counter import matplotlib.pyplot as p import cedalion.dataclasses as cdc import cedalion.geometry.s...
2049c052300b21c7127c362a347dbc6082e2b17bf29648273927b47a8c0e2b06
Jupyter
7,667
226
# %% [markdown] # # Phenotype ↔ Phenotype Relation-Wise Merge # # Merges Phenotype–Phenotype triples from PrimeKG, BOCK, and TARKG; # deduplicates by `(head, relation, tail)`; and saves the result. # %% [markdown] # ## 0. Configuration # %% import os import pandas as pd import numpy as np BASE_DIR = '/storage/Aru...
a5759aef0720943f2259e0c0b0bb542ba852e5853a083ce720205be49e1acf83
Jupyter
7,678
246
# %% [markdown] # # Probing Many-body Localization by Excited-state VQE # %% [markdown] # ## Overview # %% [markdown] # This tutorial introduces a new method to probe many-body localization (MBL) by excited-state VQE. The model hosting MBL transition considered here is the interacting Aubry-Andr$\acute{e}$ model whic...
d91aee70a7fe3eee713efed28c3baabfc87753f7d15da7f79e9044b3db1aa96f
Jupyter
7,746
206
# %% from neurovelo.train import Trainer from neurovelo.utils import ModelAnalyzer,latent_data,evaluate,decode_gene_velocity,vector_fields_similarity import scvelo as scv import scanpy as sc import glob import seaborn as sns import matplotlib.pyplot as plt import numpy as np # %% adata = scv.datasets.gastrulation_eryt...
50f325bad7cb90ee9c285c0935391e8ca29cf587296c9e451c474c9412bf62c0
Jupyter
7,751
281
# %% [markdown] # # Set Up # %% #import packages import pandas as pd from nilearn import surface import numpy as np import os import glob import usefulFunctions as uf import matplotlib.pyplot as plt import seaborn as sns from matplotlib.patches import PathPatch from matplotlib.collections import PatchCollection # %...
1edcad55ad52971eb9d3dcd369901651526fb393728c2a65fadad7ed468dbc9f
Jupyter
7,768
251
# %% import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from sklearn.decomposition import PCA from scipy.io import loadmat from scipy.sparse import vstack import os from scipy.optimize import curve_fit # %% # Initialize lists to store PCA results cum_vars = [] weights = [] # L...
1309d64f9ed246d8a8ff5e97aeff74f179134c1ec890d6ab9a33ca392868d9d5
Jupyter
7,777
204
# %% [markdown] # # 分子上的变分量子本征求解器 (VQE) # %% [markdown] # ## 概述 # # VQE 是一种变分算法,用于计算满足 $H \left|\psi_g\right> =E_g\left|\psi_g\right>$ 的给定哈密顿 H 的基态,我们称之为 $\psi_g$。对于任意归一化波函数 $\psi_f$,期望值 $\left<\psi_f|H|\psi_f \right>$ 总是不低于基态能量,除非 $\psi_f = \psi_g$ (这里我们假设基态没有简并)。基于这个事实,如果我们使用参数化波函数 $\psi_\theta$,例如由具有参数 $\theta$ 的...
79b830639a94a8cf2b28cc832b38d1bcc46aca533917587445d20c4581ee4975
Jupyter
7,783
234
# %% [markdown] # # <center> Neural Network encoded Variational Quantum Eigensolver (NN-VQE) # %% [markdown] # ## Overview # # In this tutorial, we'll show you a general framework called neural network encoded variational quantum algorithms (NN-VQAs) with TensorCircuit. NN-VQA feeds input (such as parameters of a Ham...
72077dad9999aab437024c03ef10be56aa8a9a10df9ed8cc6b243d0237c4e07d
Jupyter
7,801
254
# %% from sklearn.metrics import roc_auc_score, precision_recall_curve from sklearn.metrics import auc as calculate_auc from sklearn.metrics import mean_squared_error from sklearn.metrics import accuracy_score from scipy.stats.stats import pearsonr import os import subprocess import pandas as pd import numpy as np ran...
112dd8de0b73a98809f381d2179cffa655b59bbb4f9821c59bc8c5dfc6dcfa68
Jupyter
7,809
246
# %% [markdown] # # MolecularFunction_MolecularFunction # %% import pandas as pd import numpy as np # %% [markdown] # # Monarch KG # %% Monarch_MolFxn_MolFxn = pd.read_csv('/16Tbdrive2/arushis/070225/Data_compile/Monarch/Processed/Human/Human_MolecularActivity_MolecularActivity_Monarch.csv') Monarch_MolFxn_MolFxn.co...
e2a36df37398bd8716f2b034f9c1f70b41169a913583dc66c1274e405f99b04a
Jupyter
7,811
234
# %% [markdown] # # <center> 神经网络编码的变分量子本征值求解器(NN-VQE) # %% [markdown] # ## 概述 # # 在本教程中,我们将使用TensorCircuit展示一个量子计算通用框架——神经网络编码的变分量子算法(neural network encoded variational quantum algorithms,NN-VQAs)。NN-VQA将一个给定问题的参量(如哈密顿量的参数)作为神经网络的输入,并使用其输出来参数化标准的变分量子算法(variational quantum algorithms,VQAs)的线路拟设(ansatz circuit)。在本文中,我...
c1fdfe121fe169d9a7481f1679107980b6da451f9e551f808d48bf225358d67d
Jupyter
7,835
180
# %% [markdown] # # TensorCircuit SDK with TianYan Quantum Cloud # # This tutorial follows the provider-agnostic TensorCircuit cloud workflow and uses the shared `tc.cloud.apis` entry point to connect to the China Telecom TianYan quantum computing platform. It covers device discovery, task lifecycle management, cloud ...
f0165e8076e5190ea1e678bc2adba435576052bbe7a1ec4b9e5246aefd10e23e
Jupyter
7,842
156
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/mask.ipynb>`, or as a {download}`python script <converted/mask.py>` with code cells. We highly recommend ...
94637b3615318a7cf1dcd4c55a87d03496cbe016ca915d9c8557f8526e1ad518
Jupyter
7,878
217
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Control‐ROI analysis for benson14_v1 across three contrasts: • Stake_comp(Low‐ vs High‐stake) • GL_comp (A GAIN sh vs A LOSS sh) • RT_comp (Fast vs Slow RT) For each: compute mean±SEM, run paired t-test, print stats, and plot as a paired bar. fig s4 in...
dc77d3bce6d90414d37cb7f24e23c02f9c4e618eaa7797d2f6866e6772e38423
Jupyter
7,927
200
# %% [markdown] # # 密度矩阵和混态演化 # %% [markdown] # ## 概述 # TensorCircuit 提供了两种含噪声、混态量子演化的方法。 # $n$ 量子比特的全密度矩阵模拟是通过使用 ``tc.DMCircuit(n)`` 提供的,然后将量子操作——包括幺正门以及由 Kraus 算子指定的一般量子操作——添加到电路中。 # 相对于通过 ``tc.Circuit`` 对 $n$ 个量子比特进行纯态模拟,全密度矩阵模拟会占据两倍内存,因此可模拟的最大系统大小将是纯态情况下可以模拟的一半。 # 内存需求较小的选项是使用标准的 ``tc.Circuit(n)`` 对象并通过蒙特卡罗轨迹方法随机模...
2c1bb6f1543472d21af4a470cfc258e0518790f92b6d8233102788d22e7faa99
Jupyter
7,936
293
# %% [markdown] # # QML on MNIST Classification # %% [markdown] # ## Overview # # The aim of this tutorial is not about the machine learning perspective on better design of QML method for MNIST classification. Instead, we use a simple parameterized circuit and demonstrate the QML-related technical ingredients of ``te...
d4bc3292058297f8806530e03610204c976882ac737a1f44d63c0c4e1084ef35
Jupyter
7,940
321
# %% import sys sys.path.append('/Users/midani/OneDrive/proj/leap/manuscript') import os import numpy as np import pandas as pd import repo_code.lib_aux as lib_aux subsetDf = lib_aux.subsetDf remove_zero_cols = lib_aux.remove_zero_cols # %% path_output = "../output" # %% def norm_log2_data(df): """Normalizatio...
8a9f3758834083c8a760b752f52db4fdfeec585be68beae3b7c7b65806117e5b
Jupyter
7,972
229
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 14:35:35 2025 @author: yuhui """ import os import glob import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats from statsmodels.stats.multitest import multipletests import pandas as pd from statsmodels.stats.anova impor...
17351bdd9cb36ea88b61870f5b4ee4905e943ec9dd771f77584b993599500136
Jupyter
8,000
241
# %% [markdown] # # Set Up # %% # import necessary packages import glob import os import usefulFunctions as uf import matplotlib.pyplot as plt import numpy as np # %% [markdown] # # Plot overlap of ALL labels # %% #set paths base_dir = f'{os.path.dirname(os.getcwd())}/' roi_dir = f'{base_dir}data/labels/average/allD...
2f755a4a0d1c4eca6d79dff28cc7bfb13d188b770d2cadfb5870f18a1c4f364d
Jupyter
8,003
292
# %% [markdown] # # MNIST 分类的量子机器学习 # %% [markdown] # ## 概述 # # 本教程的目的不是从机器学习的角度来更好地设计用于 MNIST 分类的量子机器学习方法。相反,我们使用一个简单的参数化电路,并演示 ``tensorcircuit``的量子机器学习相关的技术组件。此外,这个 jupyter notebook 绝不代表是量子机器学习的好的实践。 # [WIP note] # %% [markdown] # ## 设置 # %% from functools import partial import numpy as np import tensorflow as tf...
17eb918eb563b1f6f66d9f6f1fc70ab1e698b23ba816b60666e3c64642d821db
Jupyter
8,005
269
# %% import pandas as pd import numpy as np import glob import os from tqdm import tqdm # %% !pwd # %% BASE_DIR = '/storage/Arushi/090526_EvoAge/kg_formation/' MAPPING_DIR = BASE_DIR + 'data_collection/databases_for_mapping/' PROC_DIR = BASE_DIR + 'processed_data/' # ── Required output schema ─────────────...
9732f1bdfe9de3d1668bf986058bab3ddbb73c61ffb5b0d5db3aba2d5cd528ac
Jupyter
8,019
273
# %% import pandas as pd import numpy as np import glob import os from tqdm import tqdm # %% !pwd # %% BASE_DIR = '/storage/Arushi/090526_EvoAge/kg_formation/' MAPPING_DIR = BASE_DIR + 'data_collection/databases_for_mapping/' PROC_DIR = BASE_DIR + 'processed_data/' # ── Required output schema ─────────────...
2b41a931c7ec74d06c0a7385bccae7d8dad31f65f25280ee16faae994d458cbe
Jupyter
8,024
223
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 14:35:35 2025 Compare signal changes between gain and loss in SH fig 4 in the manuscript @author: yuhui """ import os import numpy as np import scipy.stats as stats import pandas as pd import matplotlib.pyplot as plt import glob from statsmod...
b013db8625b0677379b381f0097eecb75d71297564a76711f5fc064ee4ef5253
Jupyter
8,038
321
# %% import sys sys.path.append("../fractal") import fractal import utils import numpy as np import pandas as pd import matplotlib.pyplot as plt # %% [markdown] # # Sanity check # %% xs=utils.gen_koch(6,shape='curve') scale=np.mean(np.linalg.norm(xs[:-1,:]-xs[1:,:],axis=1)) # %% [markdown] # oversampling method retu...
3962ba6698e6464b519d40308b693ae854439cde9c7eea759ccd272be4732e53
Jupyter
8,055
240
# %% [markdown] # # Fermion Gaussian State (FGS) Simulator # # This tutorial demonstrates how to use the Fermion Gaussian State (FGS) simulator implemented in `tensorcircuit-ng`. The FGS simulator allows for efficient simulation of non-interacting fermionic systems, which is particularly useful for studying free fermi...
9f73d9f055f5b78f16051c7a3a867f7a6756ba108129b374d9b96faf1d61227b
Jupyter
8,074
276
# %% import pandas as pd import numpy as np import glob import os from tqdm import tqdm # %% !pwd # %% BASE_DIR = '/storage/Arushi/090526_EvoAge/kg_formation/' MAPPING_DIR = BASE_DIR + 'data_collection/databases_for_mapping/' PROC_DIR = BASE_DIR + 'processed_data/' # ── Required output schema ─────────────...
8de42cfe1202679a96074502b4babef1f21f3148930511af9ec051105650a1d0
Jupyter
8,180
183
# %% [markdown] # Calculate and plot taus per area using full signal of different length. ACFs with NaNs are removed as preprocessing. # %% import numpy as np import pandas as pd import pickle import json import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from isttc.scripts.cfg_global impo...
df4cfebdc7e5b6cda524ff52155dab2b66635a053077ac5f77ea0c231adef5ea
Jupyter
8,181
313
# %% import pandas as pd import numpy as np import glob import os from tqdm import tqdm # %% !pwd # %% BASE_DIR = '/storage/Arushi/090526_EvoAge/kg_formation/' MAPPING_DIR = BASE_DIR + 'data_collection/databases_for_mapping/' PROC_DIR = BASE_DIR + 'processed_data/' # ── Required output schema ─────────────...
a8069bbb1c3d5923ba0b98c1684048f2f60c3d41bafc895225285f81bee72bb4
Jupyter
8,192
282
# %% # Load packages for data analysis import pandas as pd import numpy as np from tableone import TableOne import matplotlib.pyplot as plt from datetime import datetime, timedelta # Load packages for Big Query from google.cloud import bigquery import os # %% [markdown] # ### Set-up # %% [markdown] # **Set-up: GCP ...
8eb19231eff34dd5baf89e0b0312b72271e36ddd19649e0eebabaeb3c41ebab4
Jupyter
8,217
235
# %% from Bio.Seq import Seq from Bio.Alphabet import IUPAC from Bio import pairwise2 from Bio.pairwise2 import format_alignment import numpy as np import regex import pandas from progress.bar import Bar # %% [markdown] # # NEED TO NOTE OFF OF THE RIP, THIS PROGRAM IS CURRENTLY HEAVILY CUSTOMIZED FOR ADIMAB PNAS PAPER...
a5e9bfe80766bcb4db1e8a691bbde38d715d98f981e790456bdc3172e7a9a9df
Jupyter
8,217
295
# %% import scanpy as sc import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import anndata # %% [markdown] # # Brain # %% pd_atlas = sc.read_h5ad('/Pech_Janssens_PD_atlas/scRNA_PD_annotated.h5ad') # %% ctrl_young_raw = pd_atlas[(pd_atlas.obs.genotype == 'W1118CS') & (pd_atla...
6eec5197256b048ebc0b15607cd8ddc2c356c3389dc67a83f32989299105451c
Jupyter
8,219
317
# %% [markdown] # ### Import all required libraries and set constants for server connection # %% import os, sys import numpy as np import pickle import time import matplotlib.pyplot as plt while os.getcwd()[-6:] != 'inkube': os.chdir('..') print(os.getcwd()) sys.path.insert(0, './Communication') from ControlPort i...
7ecaa5e007894c2a6b379d49da29a1e07aed7662bb9f3fd6ca37937b4c2be3d0
Jupyter
8,228
176
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/activation.ipynb>`, or a {download}`python script <converted/activation.py>` with code cells. We highly r...
e8fec2fe7efbba54cd935a544cd7b4e4f649000f2b8e20abbf2b54308683fcab
Jupyter
8,260
275
# %% [markdown] # # Scaling and Transforming Head Models # %% # This cells setups the environment when executed in Google Colab. try: import google.colab !curl -s https://raw.githubusercontent.com/ibs-lab/cedalion/dev/scripts/colab_setup.py -o colab_setup.py # Select branch with --branch "branch name" (def...
f43297fe1c5f8468fa421cf421f91a34727b44b580ffe8a5e21ebab37ffac496
Jupyter
8,297
251
# %% [markdown] # # C. elegans Gene–Gene — Relation-Wise KG Triple Construction # # ## Purpose # # This notebook processes Gene–Gene interaction data for *C. elegans* from **two sources** and combines them into standardized relation-wise Knowledge Graph (KG) triples: # 1. **STRING** — Protein–protein interactions (ma...
34de319311e79d18182465870a5f7205b97fff76ff3a44aa6f0343141ad0ed17
Jupyter
8,324
211
# %% [markdown] # # Calculate phase dependent modulation of AP threshold poisson excitation and rhythmic inhibition with variable frequency # # The simulations had either: # 1. Rhythmic inhibition at the soma (64 Hz) or dendrites (16 Hz) # 2. Poisson excitation at the soma and dendrites # # Here we calculate voltag...
070b283e88f0325f72e9f0053df2eb7164bc17f46eab1a14eb90bc2164a34477
Jupyter
8,331
256
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 14:35:35 2025 Compare stake difference fig s3 in the manuscript @author: yuhui """ import os import numpy as np import scipy.stats as stats import pandas as pd import matplotlib # matplotlib.use('Agg') # <- force non‐interactive, file‐outp...
8a5906c2b4318297f57f7ce23d534d42557df1243b8ca3a3dc94fdee1e88bb94
Jupyter
8,334
249
# %% [markdown] # # Benchmark XGBoost explanations # %% [markdown] # This notebook compares several different explanation methods when applied to XGBoost models. These methods are compared across many different evaluation metrics. Explanation error is the primary metric we sort by, but we also compare across many othe...
f4bed557b0e0b3c824ade0aaec3d038823f10add58daba1e0ee3eaef53f9a3ae
Jupyter
8,353
324
# %% [markdown] # # 第一章 线性代数 (Linear Algebra) # %% # 本章代码通过numpy展示,导入numpy库 import numpy as np from scipy import linalg as la # %% [markdown] # ## 1 向量 # ### 1.1 向量 (vector) # # 具有大小和方向的量,用 $\vert v\rangle$ 表示列向量,$\langle v\vert$ 表示行向量。 # %% # 下面是一个二维向量的例子 print("行向量:") print(np.array([2, 3])) print() print("列向量...
db9d1cb8fe5f5f55623d90fd527a775cd309cb3e8c82b8d2934b6525fbaabac9
Jupyter
8,366
189
# %% [markdown] # # Simulation of Clifford Circuits # %% [markdown] # ## Overview # # Simulating quantum circuits on a classical computer is fundamentally hard. The memory required to store a quantum state vector for $n$ qubits grows as $2^n$, an exponential scaling that quickly becomes intractable. However, a specia...
2e93109195ec3e75f614764196a51dd77a84233af7944662a233bdb2617bfd66
Jupyter
8,374
203
# %% [markdown] # # Variational Quantum Eigensolver (VQE) on Molecules # %% [markdown] # ## Overview # # VQE is a variational algorithm for calculating the ground state of some given hamiltonian H which we call it $\psi_g$ that satisfied $H \left|\psi_g\right> =E_g\left|\psi_g\right>$. For an arbitrary normalized wav...
cb54955f7e06306f3ae207428895db9017114a16831cf57dcce38584e80e84e9
Jupyter
8,381
122
# %% [markdown] # # `text` plot # # This notebook is designed to demonstrate (and so document) how to use the `shap.plots.text` function. It uses a distilled PyTorch BERT model from the transformers package to do sentiment analysis of IMDB movie reviews. # # Note that the prediction function we define takes a list of...
4f6eb86d913799e6f0e6add28a9dc89d09f40b8d116228238fe63270e30229ad
Jupyter
8,465
215
# %% [markdown] # Reproduce Fig2: Pearson based and STTC based area ACFs and timescales. # %% import pandas as pd import numpy as np from scipy.optimize import curve_fit, OptimizeWarning from sklearn.metrics import r2_score from scipy import stats import matplotlib.pyplot as plt import seaborn as sns from isttc.scrip...
554ec041b7457ae468d08a3dbb84ae3da44ebd0177f02d0f2cbaefdd62c3ff2f
Jupyter
8,475
223
# %% import numpy as np import pandas as pd import pickle %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns from pathlib import Path import re import pickle from src import util_analysis # %% import matplotlib matplotlib.rcParams.update({'font.size': 10}) matplotlib.rcParams['pdf.fonttype'...
cbfbaed9a2fddaeae12e20e19cee94a8a86b3867a734307bb75e407f4625a4ee
Jupyter
8,480
278
# %% import os import pickle import pandas as pd import numpy as np import matplotlib as mpl from matplotlib import rcParams import matplotlib.pyplot as plt import h5py import os import tqdm import scipy from scipy import signal import pickle from tqdm import tnrange from tqdm import tqdm import seaborn as sns from sc...
f11d29ec121fa08861f02c3923a015ecb667064e732f26287269cdc238095953
Jupyter
8,482
284
# %% import pandas as pd from collections import defaultdict # Load the DataFrame dir_ids_seq = 'data_ids_seq/mirna_mirna_sequences_WITHIDS.pkl' df = pd.read_pickle(dir_ids_seq) # Dictionary: sequence → list of {"ID": ..., "Category": ...} dict_seq_to_id_type = defaultdict(list) # Iterate over both x and y columns f...
76c6ea960c21cb5677c1121eccedc7d7298ffd2d60f6c9cc53d97ac86a6e9a2a
Jupyter
8,488
235
# %% [markdown] # # Calculate relationship between AP and dendritic spikes with poisson excitation # # The simulations had either: # 1. Poisson inhibition at the soma and dendrites # 2. Poisson excitation at the soma and dendrites # # Here we calculate the spike-triggered average between dendritic spikes and action...
785666e5c58fced49506d015364ec23e6ce0ba91241a557e0765fd86441e0827
Jupyter
8,512
246
# %% [markdown] # # Anatomy → Anatomy Relation Pipeline # # Builds a unified, deduplicated edge table for the **Anatomy–Anatomy** relation # by ingesting processed files from multiple KG sources, normalising identifiers # if needed, and writing the final triple table to disk. # # **Output schema:** `head | relati...
28c1c5e0c9844106117def05f8032716ec82cbc1978017bd824b184a3c30a78d
Jupyter
8,531
149
# %% [markdown] # # Demonstration of DCBC evaluation usage (Replication) # This notebook shows an example of a Distance controlled boundary coefficient (DCBC) evaluation of a cortical parcellation using the Multi-domain task battery (MDTB) functional dataset. It replicates the results reported in the article # # - Zhi...
3eafd886b6b90c6d19e84410033774d279b368a5fe3a2042f32be479f84cf173
Jupyter
8,577
189
# %% [markdown] # # Density Matrix and Mixed State Evolution # %% [markdown] # ## Overview # # TensorCircuit provides two methods of simulating noisy, mixed state quantum evolution. Full density matrix simulation of $n$ qubits is provided by using ``tc.DMCircuit(n)``, and then adding quantum operations -- both unita...
732332d937883db3d908a3e58da7289779b8c87768db47c8249fe76a7f8269ca
Jupyter
8,605
259
# %% [markdown] # Generate plots # %% import numpy as np import pandas as pd import pickle import joypy from pathlib import Path from isttc.scripts.cfg_global import project_folder_path import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.colors import TwoSlopeNorm import seaborn as sns mpl.rcPa...
b2859b11232b8674329fb77fe16f7296b92393907910ca789fb8faf2585c833d
Jupyter
8,628
237
# %% [markdown] # Modified "Tutorial 1: How to use abcTau package to fit autocorrelations or PSDs" from the abcTau repo # %% import matplotlib.pyplot as plt import seaborn as sns import pickle import numpy as np import pandas as pd from scipy import stats # add the path to the abcTau package import sys #sys.path.ap...
54ad69c6d20a319a24ee6eab630034cc3080e66ec672edd5ec5217dc875bbdcf
Jupyter
8,650
284
# %% [markdown] # # 可微量子架构搜索 # %% [markdown] # ## 概述 # # 本教程演示了如何利用 TensorCircuit 提供的高级计算功能,例如 ``jit`` 和 ``vmap`` 来超级有效地模拟可微量子架构搜索(DQAS)算法,其中具有不同结构的量子电路的集合可以同时编译模拟。 # [WIP note] # %% [markdown] # ## 设置 # %% import numpy as np import tensorcircuit as tc import tensorflow as tf # %% K = tc.set_backend("tensorflow") ...
d2bd46f18fd71c2cf046bba83fc865993650b7b907439fa488f34dcf7f042b0f
Jupyter
8,662
250
# %% import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.cross_decomposition import PLSRegression # %% data = pd.read_csv('Male+Female.csv') #Load Data filename = 'GroupRegulation_male.csv' # %% #define inputs and outputs for pls inputs=['HDAC1','HDAC2','HDAC3','HDAC4','HDAC5','HDAC6',...
5f56dc8786d389f58f77efd8a0e5c35bbf2af3afadd61682ea45a7342a1f24fd
Jupyter
8,672
217
# %% [markdown] # Plot area taus for all sampling iterations. # %% import numpy as np import pandas as pd import pickle import json import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import FixedLocator import seaborn as sns from isttc.scripts.cfg_global import project_folder_path from is...
b1320dddfc9b728a12cdfe8149582ce0dc4362151b105c4b3eb90ec345ca4a15
Jupyter
8,678
251
# %% [markdown] # Using abcTau to fit ACFs for trials (Figure 2 from the paper). # # Three options to do that: # * use abcTau package for both ACF and fitting # * use ACF calculated before using acf function # * use ACF calculated before using iSTTC concat function # %% import matplotlib.pyplot as plt import seaborn...
32dfe0ac60476d59289ccc156a75ec09708cf2cc4b5eba2f9c31195f504999ed
Jupyter
8,714
221
# %% [markdown] # # Load modules # %% import numpy as np import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import scipy import os import scanpy as sc import squidpy as sq import scipy from sklearn.preprocessing import LabelBinarizer import warnings warnings.filterwarnings...
06c9ad25e337a7bf1b286985849b31336f97e47c0900da8d642eb038906994f6
Jupyter
8,744
310
# %% import nibabel as nib import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import TwoSlopeNorm # %% # Lista de archivos NIfTI file_BAN_ADNI_MCI = "./BrainAgeNeXt/lrp_mean_ADNI_MCI.nii.gz" file_BAN_ADNI_AD = "./BrainAgeNeXt/lrp_mean_ADNI_AD.nii.gz" file_BAN_ANDI_CN = "./BrainAgeNeXt/lrp_mean_A...
e69ffd5fd077cfdcd5847f7c69f263babd2a50cd9fb9e416fff819bf96a48f91
Jupyter
8,801
293
# %% [markdown] # # Gene ↔ MolecularFunction Relation-Wise Merge # # Merges Gene–MolecularFunction triples from Monarch, DRKG, Hetionet, BOCK, TARKG, and # Harmonizome; resolves missing gene head names via NCBI synonyms; deduplicates by # `(head, relation, tail)`; and saves the result. # %% [markdown] # ## 0. Configu...
37ddc5eaf3b07eac7008e0b7d3e87bf13568c4be0809f9be3fa3c7f3c5a5fa70
Jupyter
8,802
249
# %% [markdown] # # BiologicalProcess → Gene Relation Pipeline # # Builds a unified, deduplicated edge table for the **BiologicalProcess–Gene** relation # by ingesting processed files from multiple KG sources, normalising gene identifiers # via NCBI/Ensembl mapping dictionaries, and writing the final triple table ...
84d81c77378148ce25608fd54c72928c5d476ccfb67c4bd837e131941da2a705
Jupyter
8,842
188
# %% import os import pandas as pd import yaml # %% [markdown] # # Constructing single-gene spike-in simulated data # First, run file in `src/data_processing/make_perturbed_genotype_datasets.py`. This will produce a folder containing all the perturbed dataset versions. # Here, we build two config files so that we ca...
82346ba7768bfb1c5d1e1102eb459e881ce72cfc48ef60c7b26064a636dc35c3
Jupyter
8,843
234
# %% import pickle as pkl import viz_sequence from scipy.stats import spearmanr, pearsonr import matplotlib.pyplot as plt from scipy.spatial.distance import jensenshannon import h5py from scipy.special import softmax import numpy as np from statsmodels.distributions.empirical_distribution import ECDF #uncorrected mode...
27ebdfa816df6b074792928aa36f8e79b036ef911507aee0e40c4d1a3cd583f8
Jupyter
8,862
274
# %% [markdown] # # Gene–Gene Interactions — Mouse KG Processing # **Project:** MetaboGlue / EvoAge KG &nbsp;|&nbsp; **Contributor:** Arushi # # **Sources processed:** # - **File 1 (STRING):** `10090.protein.links.detailed.v12.0.txt` → Mouse Protein–Protein interactions, ENSMUSG IDs resolved to gene symbols via gProfi...
64cec0bf7dfffe676247e97295ae506e0400368e6b7158d03f0f25596733ee4e
Jupyter
8,895
233
# %% import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np # %% BAN_MAE_list = [] DBN_MAE_list = [] pyment_MAE_list = [] ENIGMA_MAE_list = [] BAN_ME_list = [] DBN_ME_list = [] pyment_ME_list = [] ENIGMA_ME_list = [] BAN_ASTD_list = [] DBN_ASTD_list = [] pyment_ASTD_list = [] ENIG...
b0bc076e86c77126d86b1fcea39932472a23c1ce8fda93c2ecdf302592aa9c9e
Jupyter
8,904
245
# %% [markdown] # # Using Convpaint & Python - Introduction # %% [markdown] # Here, we show you the basics of using Convpaint programmatically with Python. Concretely, we will present 3 ways to use the Convpaint GUI and/or API: # - **a)** Using Convpaint **as a napari plugin (GUI)**, only accessing and processing ...
dc5139c2b3be5d6f1a99cc290b654a59b8b5da2144611d7cf8db34c231f5cb1b
Jupyter
8,922
285
# %% [markdown] # # Differentiable Quantum Architecture Search # %% [markdown] # ## Overview # # This tutorial demonstrates how to utilize the advanced computational features provided by TensorCircuit such as ``jit`` and ``vmap`` to super efficiently simulate the differentiable quantum architecture search (DQAS) algo...
4750fd2ae2ee2591d40873631ef1e3b7a92da528ab71a83fb4fbdb4c8f23de32
Jupyter
8,939
252
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 14:35:35 2025 Compare signal changes between stakes fig 1 in the manuscript @author: yuhui """ import os import numpy as np import scipy.stats as stats import pandas as pd import matplotlib # matplotlib.use('Agg') # <- force non‐interactiv...
303d5222468f70435b7e432848e1ce018827f020a2f9d3816b34b317346a7d6c
Jupyter
8,978
245
# %% [markdown] # # CellularComponent → Gene Relation Pipeline # # Builds a unified, deduplicated edge table for the **CellularComponent–Gene** relation # by ingesting processed files from multiple KG sources, normalising gene identifiers # via NCBI/Ensembl mapping dictionaries, and writing the final triple table ...
ef63de515220b9cb10fe4f19d5c367ab401464024727b3ea3ab4dc5137ebdf22
Jupyter
8,984
278
# %% import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns # %% data = pd.read_csv('Male+Female.csv') # %% data = data.drop(['ID'], axis = 1) Sex = data['Sex'] data_s = data.drop(['Sex'], axis = 1) Male_Data = data[Sex==0] Female_Data = data[Sex==1] # %% lut = dict(zip(Sex.uni...
2857d1cc559119c5982b6d0ad521c54a970edb7961d858a2ce3b6838e9768aae
Jupyter
9,016
258
# %% [markdown] # # MolecularFunction → MolecularFunction Relation Pipeline # # Builds a unified, deduplicated edge table for the **MolecularFunction–MolecularFunction** relation. # # **Output schema:** `head | relation | tail | head_type | relation_type | tail_type | kg_source | kg_type | head_id_is | tail_id_is | h...
566debe09bcbbca32ec18199ff13ade42d0f514b9d0b0da4c9b9458d52df3706
Jupyter
9,022
256
# %% [markdown] # # Gene → CellularComponent Relation Pipeline # # Builds a unified, deduplicated edge table for the **Gene–CellularComponent** relation. # # **Output schema:** `head | relation | tail | head_type | relation_type | tail_type | kg_source | kg_type | head_id_is | tail_id_is | head_detail_name | tail_det...
2edcadfda67cfaea3266a788a8c6b8ffd60d2f07fa53b46e34da496e102074fb
Jupyter
9,028
403
# %% from pathlib import Path from docutils.nodes import reference from CrystalTracer3D.io import CrystalReader import napari in_img = Path(r'D:\Zuohan\Z9\raw\Nude32_Z9_2025_05_30__00_49_24(15).czi') a = CrystalReader(in_img) segchan = a.find_channel('ChS2-T1') img = a.read(channel=segchan) viewer = napari.Viewer()...
6bee2735362fe1ad4cd0e398729ddad7703d8bfb19642f49625be5a2200ca11e
Jupyter
9,053
227
# %% [markdown] # ## ================================================================ # ## BRIAN2 SIMULATION OF A RECURRENT EXCITATORY NEURONAL NETWORK # ## ================================================================ # This notebook simulates current-driven excitatory neurons with # spike-frequency adaptation (**A...
2e2df36e7dc527756760449f7e25072c5bf81598c3911240f5821b9269b0f37c
Jupyter
9,082
292
# %% [markdown] # # Gene ↔ Phenotype Relation-Wise Merge # # Merges Gene–Phenotype triples from BOCK, TARKG, Harmonizome (×5), and BioGrakn (×2); # resolves phenotype tail names via HPO and missing gene head names via NCBI; # deduplicates by `(head, relation, tail)`; and saves the result. # %% [markdown] # ## 0. Conf...
f29b53f2f48cab6059eaec298dc374556f0cd2b0b8b59ab5ae474ce9cb8503fa
Jupyter
9,131
224
# %% [markdown] # Modified "Tutorial 1: How to use abcTau package to fit autocorrelations or PSDs" from the abcTau repo # %% import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy import stats # add the path to the abcTau package import sys #sys.path.append('./abcTau') sys.path.append('...
e6edf00a0d25e76d56bd3197dde26a178afd36ad4cbc2053c169598cd7c4962f
Jupyter
9,146
387
# %% import pandas as pd import numpy as np from collections import defaultdict # %% import matplotlib.pyplot as plt import matplotlib.patches as mpatches import seaborn as sns from rdkit import Chem from rdkit.Chem import Draw from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem.MolStandardize import rdMolStan...
43c797b43d112ff80ede03109cf1b74669aa97edb2670d1f480cb41d1643614a
Jupyter
9,158
232
# %% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Calculate accept rate for each value condition, and also mean RT, then run the ANOVA & paired t-tests. note the valueH here refer to Magnitude Medium in the manuscript Fig. S1 in the supplementary materials """ import os import numpy as np import scipy.stats as...
87351929b01fa6fdd97cd45172d9fd629b3e68cf8b4bd98153fb7dc2589774c5
Jupyter
9,193
296
# %% [markdown] # # BiologicalProcess → ChemicalEntity Relation Pipeline # # Builds a unified, deduplicated edge table for the **BiologicalProcess–ChemicalEntity** relation # by ingesting processed files from multiple KG sources, normalising identifiers # via PubChem mapping dictionaries, and writing the final tri...
ecbe1f16b508c031eef4bc5e83d7b772fc767be0a38292d89f408b7f94f1d5d9
Jupyter
9,213
295
# %% %matplotlib inline import matplotlib.pyplot as plt import os, sys, logging, torch import pandas as pd import numpy as np from torch import nn, tensor from functools import partial sys.path.append(os.path.join(os.getcwd(), '..')) from utils.create_batch import sort_atoms, momentum_transform, geom_transform, get_ba...
c5eb22e979807330a679fb3a42adf4f3f758af2d9ce8842dbc276387003a15c2
Jupyter
9,251
208
# %% [markdown] # Calculate flags for every unit: # # 1. at least 20 completed trials # 2. at least 1hz of mean activity during the fixation period # 3. each 50-ms time bin during fixation with nonzero mean activity # # Flags are calculated based on binned data (to mimic the paper). # # Flags are calculated on the d...
c4c237f9fd77001fa737e96ecc56b1f63598cd50ed8ea32fc3b58e6a5d3baeb8
Jupyter
9,268
300
# %% [markdown] # # GNN Explainer # # Generate edge explanations. # %% import sys import os import numpy as np import pandas as pd from tqdm import tqdm import pickle as pkl from collections import defaultdict import matplotlib.pyplot as plt import seaborn as sns from matplotlib.patches import Patch import ast impo...
2484282b3613fc5c402c635d19ad73b215b22cb39eaf81af1e549e582d10d954
Jupyter
9,283
226
# %% import numpy as np import pandas as pd import pickle %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns from pathlib import Path import re from tqdm.auto import tqdm %matplotlib inline import matplotlib.pyplot as plt from matplotlib.lines import Line2D import matplotlib # So that we can e...
2f505a350928cde4af36f51c459a4bd5c2784faa9b4f9aff7513e40dda5680a6
Jupyter
9,288
241
# %% [markdown] # # Statsmodels Methods Overview # %% # This cells setups the environment when executed in Google Colab. try: import google.colab !curl -s https://raw.githubusercontent.com/ibs-lab/cedalion/dev/scripts/colab_setup.py -o colab_setup.py # Select branch with --branch "branch name" (default is ...
cb89640f437b54a2cd348754f45a9806de56dd8fa63a00e7f2a70ae279ac2504
Jupyter
9,289
231
# %% [markdown] # # `scatter` plot # # This notebook is designed to demonstrate (and so document) how to use the `shap.plots.scatter` function. It uses an XGBoost model trained on the classic UCI adult income dataset (which is a classification task to predict if people made over \\$50k in the 90s). # %% import xgboos...
1b4e9f7fd0d84b822af2e6aa193688a1402b2b33e51d3d77fd2facebf505419e
Jupyter
9,290
268
# %% import numpy as np import sklearn as sk # from skopt import gp_minimize, forest_minimize from src.layers import padding as pad_utils from src.spatial_attn_lightning import BinauralAttentionModule import yaml # %% [markdown] # ## Randomly generate architectures # # ### Required conditions: # * N parameters < 20...