sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bbfded852bae13c6806392b7ad28a87a96e9b67e2f91df5f22e1abcc0a76c452
Python
2,847
80
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations from typing import TYPE_CHECKING, Optional import pandas as pd from monty.dev import requires from fa...
2f05ec43571eb695575828f54d3c6e060b66f4332d367fc5ec0da7efa8de1cc1
Python
2,848
90
import scdrs import pandas as pd import scanpy as sc from anndata import AnnData import os, subprocess, tempfile CORTEX_URL = "https://storage.googleapis.com/linnarsson-lab-www-blobs/blobs/cortex/expression_mRNA_17-Aug-2014.txt" # save to files if not os.path.exists("data/"): os.makedirs("data/") # download gene...
57956f15882370427e5fc7cad34403c03e3b2663269f6bb39a629b66e35625da
Python
2,848
70
import pandas as pd from warnings import warn def sc_QC(X: pd.DataFrame, min_lib_size: float = 1000, remove_outlier_cells: bool = True, min_percent: float = 0.05, max_mito_ratio: float = 0.1, min_exp_avg: float = 0, min_exp_sum: float = 0) -> pd.DataFrame: ...
8cf587b081af4b0218eaa00ef59630c39f462032b7b622c6533146f5447c97fe
Python
2,848
84
import numpy as np from abc import ABC, abstractmethod from ml4h.defines import EPS from tensorflow.keras.applications import imagenet_utils class Normalizer(ABC): @abstractmethod def normalize(self, tensor: np.ndarray) -> np.ndarray: """Shape preserving transformation""" pass def normal...
172467031053e5eca075d893cfa307446b062bd1896e5369b50f1022f82ffac4
Python
2,849
95
# !/usr/bin/python # ----------------------------------------- # Turn the h5ad files into chunked-by-gene hdf5 # TODO: Both raw and normalized # NOTE: Works at 80G vmem # ----------------------------------------- import glob import h5py from scipy import sparse import re import gzip import pickle import numpy as np imp...
822c7ca07cebe52294199ad031485db3d1a4c7f425c3aaa84e975f3d3cfd8cfa
Python
2,849
87
"""Script to run synthetic recordings for each model of an ensemble.""" import argparse import logging from importlib import resources from typing import List from flyvis.utils.compute_cloud_utils import launch_range logging.basicConfig( format="[%(asctime)s] [%(filename)s:%(lineno)d] %(message)s", level=logging...
8a50ce93a7440b2d53148560b7285fc3a650ed7ebed15a11f40cc375e13df319
Python
2,849
86
# Generated by Django 4.1.6 on 2023-02-06 19:18 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("infer", "0011_weights_args_weights_log_weights_spm"), ] operations = [ migrations.CreateModel( n...
b88b51937eaf5b1fc053748fd7242d72d45fa634fe81c9f1c91cb25af9fda893
Python
2,851
86
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pandas as pd import os import argparse import numpy as np import glob def cal_metrics(df): mae = np.abs(df["predict"] - df["target"]).mean() mse = ...
b401d5543d7eefba750853e793907495dd2088da20754ac90423c50859bf0ac1
Python
2,852
87
""" Canonicalize USPTO-MIT text splits. USPTO-MIT uses the shared chemistry canonicalization helpers, but keeps a dataset-specific input flow and removes reactant fragments unrelated to the product atom maps. """ import argparse import os import pandas as pd from rdkit import Chem from canonicalize_data_csv import ...
cc32e6f4ca0a51c552d342e5f4722a0b27e4dd5be34e9ffe78c715425b070fe6
Python
2,852
106
# -*- coding: utf-8 -*- """ Created on Tue Aug 5 15:22:00 2025 @author: ju-bar Dielectric and related functions This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ def dielelectric_penn(E, q, Ep, Eg, Gamma): """ This...
cbaf9e5d9ede0d593cf8756f3b35874c9a92bb9af7640b34e2168cd930fd5b88
Python
2,853
73
#################################################################################################### # Copyright (c) 2020 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
7e010c9ca0a8864d289b911ffeb0225bfce3f79f6f3ed8aeeb1da169cc711ed5
Python
2,854
77
import numpy as np import scanpy as sc import squidpy as sq import pandas as pd def get_gaston_input_adata(data_folder, get_rgb=False, spot_umi_threshold=50): adata=sq.read.visium(data_folder) adata.obsm['spatial']=adata.obsm['spatial'].astype(float) sc.pp.filter_cells(adata, min_counts=spot_umi_thres...
6c91233044f91ea9757ba0286b124072dbbc5bc994e1b3290376ae98a9c86d79
Python
2,855
77
# -*- coding: UTF-8 -*- # © Kohulan Rajan - 2020 import argparse import os import pickle import tensorflow as tf parser = argparse.ArgumentParser() parser.add_argument("file", nargs="+") args = parser.parse_args() print(args) # Initial Setup for GPU os.environ["CUDA_VISIBLE_DEVICES"] = "0" gpus = tf.config.experime...
8de752bcab88a11fc60f03529c16921c03c275c1f47e19a17d204d7f095a7e03
Python
2,856
97
import torch import torch.nn as nn import numpy as np from convex_optim_base.prox_optim import BatchParallelProxProblem from typing import Tuple class PixelwiseLinearL1Regression(BatchParallelProxProblem): CELL_COEFFS_IDX_ARGS = 0 # shape (n_pixels, n_trials) IMAGES_KWARGS = 'images' # shape (n_...
fec9387fb3204a53c6312c372138527b271d011722c2289a10533911d40d2770
Python
2,856
65
# Ultralytics YOLO 🚀, GPL-3.0 license import re from pathlib import Path import pkg_resources as pkg from setuptools import find_packages, setup # Settings FILE = Path(__file__).resolve() PARENT = FILE.parent # root directory README = (PARENT / 'README.md').read_text(encoding='utf-8') REQUIREMENTS = [f'{x.name}{x....
5369d91dda06a7e2265ffcfcf17871fcfa1115dd0843c00d58c335cb5c710cbb
Python
2,858
76
import logging import json from agent.data.entities.config import BACKUPS_PATH from agent.data.sql.sql_mgmt import execute_query, execute_read_query, get_connection, select_fields_where logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) logger.setLevel(...
c0982ca47d740fa19f028557644c88fd0790097f3da008448ec959bd4bac3afc
Python
2,858
86
import numpy as np from .auto_encoder import AutoEncoder, VariationalAutoEncoder from .molecule_gnn_model import GNN, GNN_graphpred from .schnet import SchNet import torch import torch.nn as nn from torch_geometric.nn.inits import uniform from torch_geometric.nn import global_add_pool, global_max_pool, global_mean_poo...
444c50cbf6af6a9fa7fd47cde63510d55c8f52216237e19fb3e2428dd6194604
Python
2,859
84
# -*- coding: utf-8 -*- """ Created on Fri May 10 12:37:58 2024 @author: nlancaster """ raw_file = "P:/Projects/NML_TPC_2023_ThermoFisher_Phosphoproteomics_q-OT-Astral/20230412_HEK293T_phospho_rep/20230412_HEK239T_April_phosphobatch_250ng_15min_2Th_500AGC_rep01.raw" def RT_MS1_MS2(rawfile,ms2_mass):#add rawfile obje...
147b646619677c71bd5c150bd68599f14e743be6042eabf6e9f8f849c821784a
Python
2,861
67
import scanpy as sc import pandas as pd import flowsig as fs adata = sc.read('data/chen22_svg_E9.5.h5ad') # We construct 10 gene expression modules using the raw cell count. fs.pp._flow_preprocessingconstruct_gems_using_nsf(adata, n_gems = 20, layer_key = 'count...
775f9bac6d6bc67b22c14529bb3548ff9a95be497ad1a5ec70ab62886d9b7c20
Python
2,861
95
"""MetaCell-2 (tanaylab/metacells) backend. The upstream ``metacells`` package is large (~50 modules + C extensions) and is **not** vendored. Users who want this backend should ``pip install metacells`` separately — the backend raises a clear ImportError otherwise. """ from __future__ import annotations import time...
54203a2bd19a5cc45daabe3dde27ab20c84aed94b77193cd175019328b12f500
Python
2,862
86
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import sys import pysam import pandas as pd import numpy as np def rewrite_SR_coords(record, metrics, pval_cutoff, bg_cutoff): row = metrics.loc[record.id] # Do not use bg_cutoff for common variants if row.SRQ >= pval_cutoff and (r...
a1c1328fd3e053fe83a5eae77e7bbce645fd3da56b403346d8d548f730db0064
Python
2,862
54
#----------------------------------------------------------------------------------------- #Author: Brandon S Coventry #Date: 12/18/23 #Purpose: Demonstrate the role of sample size on two comparison t-tests and Bayes t-tests #Requires: Data from DBS_LFP_GenData.py #------------------------------------------------------...
fafbf19981b395650c3fac37a5a0c45affccac9f28f33a3f12d847dc455df56b
Python
2,862
69
import django.db from django import forms from infer.models import Organism, Architecture, Weights class ProteomeSubmitForm(forms.Form): try: organism_choices = [(organism.id, f"{organism.scientific_name} ({organism.common_name})") for organism in Organism.objects.all()] e...
52e8c21a3bea47618a29788230a8e80bbc7d350837ef907458ebc2d1b6104f5d
Python
2,863
95
_base_ = [ '../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], ...
f88e6703c76e66090339bf4565ee2cc4b9bc2b96be4a3146f6b955e742e12c92
Python
2,863
72
import torch from ..utils import common_functions as c_f class WeightMixin: def __init__(self, weight_init_func=None, **kwargs): super().__init__(**kwargs) self.weight_init_func = weight_init_func if self.weight_init_func is None: self.weight_init_func = self.get_default_weigh...
fa8760765d73bab890a2abbf183dd6e4e5bfde35a1a5eb7aa1c9ae519ac83111
Python
2,863
96
""" Train a diffusion model on images. """ import argparse from .guided_diffusion import dist_util, logger from .guided_diffusion.cell_datasets_loader import load_data from .guided_diffusion.resample import create_named_schedule_sampler from .guided_diffusion.script_util import ( model_and_diffusion_defaults, ...
897ab28bfe88521bb54177f09fd08aedf657ee842f63755dbf2851a0f5cb621c
Python
2,864
76
# imports import torch import pickle from ..collator_for_classification import DataCollatorForGeneClassification from .. import TOKEN_DICTIONARY_FILE """Geneformer collator for multi-task cell classification.""" class DataCollatorForMultitaskCellClassification(DataCollatorForGeneClassification): class_type = "cel...
ad98d849b7f26a363e6115a4cb5cab9095515fe8d033031fa4e3858351d04066
Python
2,865
128
""" OVAgent harness contracts, traces, replay, and cleanup helpers. """ from .cleanup import CleanupFinding, CleanupReport, HarnessCleaner from .contracts import ( HARNESS_EVENT_TYPES, STREAM_EVENT_TYPES, ArtifactRef, ApprovalRequest, HarnessEvent, HarnessCapabilities, HarnessEventType, ...
b8be5f411936b74b91855da65246a50b92b8ab49bfa08bd32a5ff71ceecd8311
Python
2,865
102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 6 17:44:12 2022 Used to create the first figure in the paper @author: pbolan """ from utility_functions import * from os import path import glob import nibabel as nib import matplotlib.pyplot as plt #%% vmin = 0 vmax_T = 4 vmax_S0 = 1 vmax_img...
b584e1539ad00926997445753a04b647feaf35654d44cd32ffb0af0bbbc52b7b
Python
2,866
79
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tests for continuing to train.""" from typing import Union from pytest import mark from torch import allclose, manual_seed, mean, rand, tensor from torch.nn...
e5f36d563fb1d7721e878653355e1fcbd2f3502f4ba093656d5a6d7838226fbf
Python
2,867
71
import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter import scatter_mean from gvp import GVP, GVPConvLayer, LayerNorm class MQAModel(nn.Module): """ GVP-GNN for Model Quality Assessment. From https://github.com/drorlab/gvp-pytorch node_in_dim: node dimensions in input grap...
794c5de0691350c581102b25a10ab57d6e2fb9b95b3d25bca6f5982550642960
Python
2,868
74
#visualize from descartes import PolygonPatch import geopandas as gpd import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection import os import pandas as pd import rasterio from rasterio.plot import show from src import neon_paths import tempfile def index_to_example(index,...
8c9b4926a9138763d24dfc75b36bb640f5f37cb38d6af896fc5fcd8180fb1466
Python
2,868
97
from types import SimpleNamespace import neo import numpy import quantities as pq import mozaik from mozaik.tools.recording import _is_supported, _pack, gather_recording class RootComm: rank = 0 size = 2 def __init__(self, other_packet=None, supported=True): self.other_packet = other_packet ...
5910742f2379837816867ebd466f89fd264a1f7a422c18d4fe104ae7e72f7550
Python
2,870
74
import cv2 import numpy as np import os import tensorflow.keras as keras import tensorflow.keras.layers as L import tensorflow.keras.backend as B import tensorflow.keras.models as M import tensorflow.keras.optimizers as O import net_org_v2 as net import tensorflow.keras.losses as Ls route_all = 'D:/VO_ver...
5c04e2ae0807a3c6025eb0447517445729e9ed4c92c557d5ca70398a7153a708
Python
2,870
78
import unittest import numpy as np import random import vamb class TestAAE(unittest.TestCase): tnfs = np.random.random((111, 103)).astype(np.float32) rpkm = np.random.random((111, 14)).astype(np.float32) lens = np.random.randint(2000, 5000, size=111) contignames = ["".join(random.choices("abcdefghijkl...
ba8f4f8c3fc80927d6b51d554a85b38469e1e95bce56fa2d5f797fcf0093115b
Python
2,870
95
_base_ = [ '../_base_/datasets/duo_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.37...
eb0c0fb8973fd35b1d1e56e580bbd2e6f020f8a6d4b676e4c0e3ae1f8aa2920b
Python
2,870
84
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
cc29cffe841f961d6fbf23fa6daafa44ac0248553d136888f268481795e8ba77
Python
2,871
83
"""Query and gallery crops must reach represent in the same color order.""" import cv2 import numpy as np import pytest from deepface.models.Detector import DetectedFace, FacialAreaRegion from deepface.models.FacialRecognition import FacialRecognition from deepface.modules import detection, modeling, recognition cl...
09c4d3c6165341ed7f15fc683a4dd835edf1838480f042d879741c3d945c4684
Python
2,872
29
import json,numpy as np import matplotlib; matplotlib.use('Agg'); import matplotlib.pyplot as plt plt.rcParams.update({"font.family":"DejaVu Serif","font.size":8.5}) exec(open('zh.py').read().split('# ---------------- Tables S3/S4')[0].replace("print(","(lambda *a,**k:None)(")) o=json.load(open('zh.json')) fig,ax=plt.s...
2644819ba16505c8df8af1d81bba7ad6b5aa1d379432da187e9d3bcfe06d64c6
Python
2,872
98
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import io import logging import pickle import warnings logger = logging.getLogger(__name__) # Allowli...
a366ec98f383b281c2ba7d01cc491859c48f145da615d28059763bc60f0fd82b
Python
2,872
95
_base_ = [ '../../_base_/datasets/rtts_coco.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.37...
489e9a84a62becd3d424096faba4674c7b792d19d4c7ec2123c789fd7c84689f
Python
2,873
66
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
2a221e379174bd36e6267bc433d655fe26b7e5d4b65b5b4c938cff6a9a28b2f5
Python
2,874
95
_base_ = [ '../_base_/datasets/ruod_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.3...
b0d31271be75e71c6316391b24df52998d4e5822f0f2abb810eb3bfb912e00d4
Python
2,874
91
# Copyright 2024 The bayesnf Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
a1a87c708b3f18c2cb5fed11d12a9e2ea255acbb9f15757dc4281ca802987225
Python
2,875
72
import copy from torch.utils.data import Dataset import numpy as np class Sim_Dataset(Dataset): def __init__(self, X, y, device = 'cpu'): self.X = X self.y = y self.device = device def __len__(self): return len(self.y) def __getitem__(self, idx): return sel...
5af86da6b6e1e57149f3176b29eac10f4d35419f34da7bb7b3be531168de88f0
Python
2,876
101
import torch import os import DUnet from torch.utils.data import DataLoader, Dataset import numpy as np from torch import nn, optim import argparse dataset_path = 'dataset/' torch.manual_seed(42) bz = 1 class DiceLoss(nn.Module): def init(self): super(DiceLoss, self).init() def forward(self, pred,...
16b673794ae2cf4b66ef6b25474f2abb1b0669417741a15f9ed3f75b76388761
Python
2,877
70
from keras.layers import Dense, Dropout, Flatten, Input from keras.layers.convolutional import Conv3D, MaxPooling3D from keras.layers.advanced_activations import PReLU as prelu from keras.layers.normalization import BatchNormalization as BN from keras import backend as K from keras.models import Model K.set_image_dim_o...
cdbcd4d72cc277c11a2170fe9eff89b304c468874a21bd0101823b615cd22aea
Python
2,877
71
""" The code for the research presented in the paper titled "Enabling inverse design of plasmon-based nonlinear square resonators with deep neural networks." This code corresponds to the article's Forward Deep Neural Network (DNN) section. This code regenerates the Fig. 4b and c of the paper. Please cite the pape...
0a2f2ac14ce88a84eeda8a560362155d76ffad44e54ec156c4bb4023d01ee8db
Python
2,878
84
from numpy.lib.function_base import re import pyvisa from pyvisa.constants import * import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt import struct from time import sleep import socket import serial import os import scipy.io as scio import math import cv2 import pdb import time ...
6959ed709d8ae28e71be2527c1acab305b7d37e013aac2970ac636a56c20b55b
Python
2,878
100
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. M→L permutation + Wigner inverse transform operation. This operation is the final step in the edge message passing pipeline: 1. Permute from M...
ce3019115215d725aa2c5330fcd91d8f9444a60b84559fc4a71c044c0ad987be
Python
2,878
100
r""" Miscellaneous utilities """ import random #from pynvml import * from anndata import AnnData from typing import List, Optional, Union import numpy as np import torch def norm_to_raw( adata: AnnData, library_size: Optional[Union[str,np.ndarray]] = 'total_counts', check_size: Optional[int] = 100 ) ->...
eb9f93024ad8216c4ef2940823cb00524264d55dfc7c5fd311c1175d3e6e57d8
Python
2,878
89
from itertools import product import subprocess import os import sys import argparse TEST_PATH = os.path.join('blah', 'test_files') common_options = dict( use_motifs = ['','--use_motifs'], save_metadata = ['', '--save_metadata'], assays = ['--assays ' + a for a in ['DNase H3K27ac Direct', 'Dir...
c5db210758819b5f7a6e7196d3606c5030a561712652e53adb09c02b44f4c70e
Python
2,881
75
import time from threading import RLock from typing import Any, Callable, Dict, List class EventSummarizer: """Utility that aggregates related log messages to reduce log spam.""" def __init__(self): self.events_by_key: Dict[str, int] = {} # Messages to send in next summary batch. self...
6cdde2d98768fa822c929746fdd3074871d7e5ef6f49ac611a14f3a9d2fa8342
Python
2,882
67
import numpy as np import networkx as nx import os.path import matplotlib.pyplot as plt import time import math import gc gc.collect() import warnings warnings.filterwarnings('ignore') import os from matplotlib.ticker import FormatStrFormatter, MaxNLocator from matplotlib.ticker import FixedLocator,FuncForm...
e8b4127f2c57f5913826aea52d6067cf50b6769f3b4ae7c0ce009dc7b6d696cb
Python
2,882
98
import argparse import torch import os from copy import deepcopy def main(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", required=True) parser.add_argument("-o", "--output", required=True) args = parser.parse_args() ckpt = torch.load(args.input, map_location="cpu") ...
b895d1c63360884bbb7b490e0be00ecbe8de65faf831fbf76c01b27caa809ac4
Python
2,883
96
# -*- coding: utf-8 -*- """ Created on Sun Mar 5 16:18:59 2023 @author: LeyangXue """ import sys import os import numpy as np from multiprocessing import Pool # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercol...
5b3f9243fdd61a5054f7e963fefa32c6f037c14f81f7e89b87287a93dabc7179
Python
2,884
81
#!/usr/bin/env python3.7 """Installs ASCENT. The copyrights of this software are owned by Duke University. Please refer to the LICENSE and README.md files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent """ import os import subprocess...
5b1fdf90997d75f2d9d24eade50cdbe4656575edabea6ed21fe87a79e3c3cb91
Python
2,885
104
import numpy as np from torch.utils.data import DataLoader, Dataset import scanpy as sc import pandas as pd import torch import sys sys.path.append('..') from ..VAE.VAE_model import VAE from sklearn.preprocessing import LabelEncoder def load_VAE(vae_path, num_gene, hidden_dim): autoencoder = VAE( num_gen...
8195bbbb05c914ed30b63df56be65a3fa6c469471c173fa9aa20a11a9804c2f4
Python
2,885
103
# -*- coding: utf-8 -*- from vtkplotlib._get_vtk import vtk import numpy as np from vtkplotlib.plots.BasePlot import Base2DPlot class Text(Base2DPlot): """2D text at a fixed point on the window (independent of camera position / orientation). :param text_str: The text, converts to string if not one alre...
736056767d59177c9366be2085f905f8d9933caa1dcd70cb8f6f8a66b4d9a14e
Python
2,886
97
import traceback import os from typing import Dict import boto3 s3 = boto3.client("s3") dynamo = boto3.client("dynamodb") class Outputter: def __init__(self, event: Dict, environ: Dict): """Responsible for moving outputs to persistent storage and updating databases. """ self....
7f167611972a024a91eafaf5eefb650f5a3a8b8a7cd56ca54cc2b9e63d1b9a37
Python
2,886
102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ For the selected k, gather the idiosyncrasies across all subjects across runs and within run. Output: meansim.csv Contains idiosyncrasies for all subjects, across runs. crun+'_meansim.csv' Contains idiosyncrasies for all subjects, within run. Usage: LE_group_stat...
78c5e91f3ac78e4bc9d399ba367b75f03ecb86da2c484f29d6057702ae125bf0
Python
2,887
71
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
888301e0d2f6d5624a8f409de970c4094ad5b9e6d8591d4a186a20852c1248f3
Python
2,887
99
import nibabel as nib import numpy as np from sklearn.mixture import GaussianMixture def assign_gaussian(data, n_components, covariance_type, init_params='kmeans', n_init=50, ): classifier = GaussianMixture( n_components=n_components, covariance_type=covariance_type, init_params=init_params, n_init=n_init,...
03ebe50e5bb87deb62e52fc00d5358a7ada8b4e101046f80601c846693818dd1
Python
2,890
88
""" Polish manually edited MRI white & gray matter segmentations. """ import os import nibabel as nb import numpy as np from scipy.ndimage import morphology, generate_binary_structure from scipy.ndimage import gaussian_filter # Set data path DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/...
1320ac81fc5bca61b675306a97d538508f7374abc29bf96aaea44f8a33f69d8f
Python
2,890
95
# Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
14a202305dc1d122a34979754d2e62933e07899e058e06f99d0ae47cc961910f
Python
2,890
84
#!/usr/bin/env python #usage:python RNAelem_fa2fq.py <positive.fa> <negative.fa> import sys,numpy as np,itertools,random,re from scipy.stats import fisher_exact as fish fanameP=sys.argv[1] fanameN=sys.argv[2] if 2<len(sys.argv) else None kmin,kmax,thresh,rich,poor,base=3,10,5e-2,[],[],10 def gen_kmer(k): for kmer i...
54698702d1631ee1c1fa35846d71d6e186440ec93b40eb34caf87818f6be0f93
Python
2,890
67
from __future__ import annotations import argparse def build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(description="Python port of the MetaboLiteLearner MATLAB workflow.") subparsers = parser.add_subparsers(dest="command", required=True) convert_parser = subparsers.add_parser...
282f238c7c7679cf2e1429204e7c68df41a73ede8bf9515d2cf31930c40ec68f
Python
2,891
80
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
34bef20cf29291f483aa4e8eee9a8fabf098386a06613f24a804f89e8ae48941
Python
2,892
72
#!/usr/bin/env python3 import argparse import nbformat def convert_notebook(input_path: str, output_path: str) -> None: """ Read a Jupyter notebook and write a Python script, converting all %%bash cells and IPython "!" commands into subprocess.run calls that raise on error. Cells that load or autorelo...
ad614e8e3c03be15e8a21352eb4fc4c8fcaf6ca59367b2411701706f57f2e0d9
Python
2,892
73
import numpy as np import torch from ..distances import LpDistance from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..miners.base_miner import BaseTupleMiner class AngularMiner(BaseTupleMiner): """ Returns triplets that form an angle greater than some threshold...
3b1d35ff397e564113bd4249d490acbcccfe8b1233579482ecb7df10a976aeef
Python
2,893
66
import os import pandas as pd import matplotlib.pyplot as plt import numpy as np annotations = ["chess", "gencode", "refseq_ucsc"] colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple'] os.makedirs("intron_s_p_diff", exist_ok=True) ind = np.array(list(range(10))) width = 0...
43b4591a7c81ea82085baa5c49705118c4a1f72db41424fcdee39f62cdfb6688
Python
2,893
99
from typing import Optional import jax import jax.numpy as jnp import jax.random as jr from .status import SamplerStatus, Samples from ..state import State from ..symmetry import Symmetry from ..utils import ints_to_array, rand_spins from ..global_defs import get_subkeys class Sampler: """Abstract class for samp...
0be3c58ce3bc43cfb182bae13983cec1d9fdf11764837c2491e51db997d02bae
Python
2,894
55
import tensorflow as tf from mol_graph import max_nb from utils.nn import * def rcnn_wl_last(graph_inputs, hidden_size, depth, training=True): input_atom, input_bond, atom_graph, bond_graph, num_nbs = graph_inputs atom_features = tf.nn.relu(linearND(input_atom, hidden_size, "atom_embedding", init_bias=None)) ...
2e44f0d0ac999272ce8b87c716871db25d18a8909c33f299104b3c29c9b7a075
Python
2,894
65
import scanpy as sc import pandas as pd import flowsig as fs adata = sc.read('burkhardt21_merged.h5ad') condition_key = 'Condition' # We construct 10 gene expression modules using the raw cell count. fs.construct_gems_using_pyliger(adata, n_gems = 10, la...
ac5503861379417dd73140a6fcf12b4932731c12dc65d62eedd8bc35d452ad4f
Python
2,895
106
# Copyright 2026 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
05dece3e9c73cc65018325fb96452678210244c53d5a0b9dc43aafd363560df6
Python
2,898
66
# compare SOTA algorithms from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import RidgeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression from sklearn.neural_network import MLPClassifie...
0e0fb595956d4b481e2581fcc8e7f68b76f26662a62111b9c4408c9285b9c189
Python
2,899
81
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
9472a417b507dcf99019d0db2af78202a60e8dcd61305c1edb8258edb78ad187
Python
2,899
105
"""Configuration management for the bioinformatics data collector.""" import os from pathlib import Path from typing import Optional from pydantic import Field, field_validator from pydantic_settings import BaseSettings from dotenv import load_dotenv # Load environment variables load_dotenv() class APIConfig(BaseSe...
a5fca0a152088cefa357e09379c5bec87397b1f1afb74b2140194bc50c63b795
Python
2,899
88
# parse_statics_log.py # Copyright (c) 2010 Jes Frellsen # # This file is part of Muninn. # # Muninn is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # Muninn is distributed in the hope that it will...
c2d5c6514b73cac07f8b9c004213485c07582d5d42d3c9549f6bd4e31f2e9e83
Python
2,901
88
""" Append-only JSONL session history for OmicVerse Agent (P2-2). Records each ``run()`` call (request, generated code, result summary, token usage) so that future turns can inject prior context into the system prompt. Inspired by Codex ``message_history.rs``. """ from __future__ import annotations import json impo...
d2be586e51eb53f289bbe8335afbe34de7e1a4add740bef8907134c8fc2e2ce1
Python
2,901
117
import inspect import logging import sys import numpy as np from ray._private.ray_microbenchmark_helpers import timeit from ray.util.client.ray_client_helpers import ray_start_client_server def benchmark_get_calls(ray, results): value = ray.put(0) def get_small(): ray.get(value) results += tim...
8720f13c3305ffcfb4b8d9784337005a31362c510c232a54b168582f513e9131
Python
2,902
90
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ When joining VCFs after genotyping, some batches will have different maximum copy states at multiallelic sites. This script ensures that the maximum allele count is chosen so all genotype indices are present in the record alts. """ import argparse import pysam def...
83a7cc27d8f232af0092e7523895ef6829fd8cd46841606712293caaf61121c8
Python
2,903
97
import sys import pandas as pd import numpy as np import pickle from rdkit import Chem from mordred import Calculator, descriptors from tensorflow.keras import models Factor = float(1/1000.0) def calc_descriptors(mols, name): len1 = len(mols) features = [] for i in range(len1): des1 = calc.pandas([mols[i]]...
62f39cbac682bcc4067b070fc6dde04a5a0057918c3d0b5fd6858fa751578d9f
Python
2,904
78
# Copyright 2026 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ac0f1bb04626ca6c54dacf8cb6669c9a48ed498856896db155eb6c352736bf9f
Python
2,904
111
""" Module for simplifying Docker image building, tagging, and pushing. Our Dockerfile expects a ``VERSION`` build-arg, and by convention we tag our Docker images using the output of ``git describe``. Running :: $ python _docker.py build builds both the normal and slim Docker images, making sure that the correct...
fe73248d2cc430e21405b5ccfc9018835940893943b28e253ad919d4cbf07a55
Python
2,906
99
import pdb import numpy as np from tqdm import tqdm import torch import matplotlib.pyplot as plt import yaml from latent_time_stepping.datasets.AE_dataset import AEDataset from latent_time_stepping.oracle import ObjectStorageClientWrapper from latent_time_stepping.utils import ( load_trained_AE_model, load_tr...
f43d34ac332117c569e68bdb36f349529362f4f75696bf790656217815d73050
Python
2,907
82
import numpy as np import os import logging logger = logging.getLogger('telemanom') class Channel: def __init__(self, config, chan_id): """ Load and reshape channel values (predicted and actual). Args: config (obj): Config object containing parameters for processing ...
1ca030d66e29d50edcc9742441ece0840f084b694867607e4b30d440b559f27f
Python
2,908
61
#!/usr/bin/env python # coding: utf-8 # author: Maruthi Mutnuri (maruthi2008@gmail.com) # loading libraries import pandas as pd import numpy as np # loading database files adm = pd.read_pickle('/project/M-ABeICU176709/ABeICU/data/ADMISSIONS.pickle', compression = 'zip') pat = pd.read_pickle('/project/M-ABeICU176709/...
2ecebe15c71733c80fe9eac7688e74fe156675ed350a6d60cc73167269977c57
Python
2,908
116
'''fitting two periodic functions using an crp-rnn, so this is a context dependent task this is the basis of a bunch of learning hierachical seqs with crp-rnn ''' import numpy as np import torch import torch.nn as nn import matplotlib.pyplot as plt import seaborn as sns from utils import to_np, to_pth from model import...
8f3cb342ba947ff0d31c7c588e0fc4824e99b3076d9d34d27de2d0d013b66763
Python
2,908
91
# flake8: noqa """ This file serves as a documentation example and CI test for bundle_per_worker placement group config. Structure: 1. Monkeypatch setup: Ensures serve.run is non-blocking and removes accelerator requirements for CI testing. 2. Docs example (between __bundle_per_worker_example_start/end__): Embedded in...
9c30cb0d497fed08c6e58a42f5a4206ee5c010df2e6e2093074899a172e47d95
Python
2,908
82
"""SAMPLING ONLY.""" import torch from .dpm_solver import NoiseScheduleVP, model_wrapper, DPM_Solver class DPMSolverSampler(object): def __init__(self, model, **kwargs): super().__init__() self.model = model to_torch = lambda x: x.clone().detach().to(torch.float32).to(model.device) ...
b54ef3bba112c9cf442cfed4bfb45c46e82661b1cbb92787b01fd665ecf7bee2
Python
2,910
109
import ray # __max_replicas_per_node_start__ from ray import serve @serve.deployment(num_replicas=6, max_replicas_per_node=2, ray_actor_options={"num_cpus": 0.1}) class MyDeployment: def __call__(self, request): return "Hello!" app = MyDeployment.bind() # __max_replicas_per_node_end__ # __placement_gr...
12b0a9369c1950c90262bbf41593064f374c69c6cde21756c0d03e376c0639af
Python
2,911
72
import numpy as np import torch from ..distances import LpDistance from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..losses.base_metric_loss_function import BaseMetricLossFunction class AngularLoss(BaseMetricLossFunction): """ Implementation of https://arxiv.o...
8a34790424ac9df6478dda09f254de21267e217b5ada7a2d9da8bcfc5766d7f8
Python
2,912
83
import numpy as np import pandas as pd import pytest from data_profiling import ProfileReport from data_profiling.report.presentation.core import CorrelationTable, Image from data_profiling.report.structure.correlations import get_correlation_items @pytest.mark.skip def generate_df(n: int): return pd.DataFrame( ...
810fbb75b4bf268bafaf13b1e088acdf6ae5d4c3bd85595985a436376c3a19cb
Python
2,913
86
import bpy import bmesh import nmv.mesh import nmv.bmeshi #################################################################################################### # @create_bmesh_copy_from_mesh_object #################################################################################################### def create_bmesh_...
0d4ee2acf4bf48c5551a293f082236fd413c3f73f62c3c8e77236e6f4cc15e0c
Python
2,914
85
# In R: # load("your_dir/tutorial.gbm.rdata") # write.csv(bk.dat, file = "./data/bk_dat.csv") # write.csv(sc.dat, file = "./data/sc_dat.csv") # write(cell.type.labels, file = "./data/cell_type_labels.csv") # write(cell.state.labels, file = "./data/cell_state_labels.csv") import pandas as pd import numpy as np import...
ad96b03391574de21fa943f754da3fdc7d2c5c847dfb587b0a2394a5e9a8862b
Python
2,914
86
''' Defining ROI masks. This is done in several steps: - Select voxels from activation map based on threshold. Here, we chose half the maximum z-score as cut-off - Propagate active voxels across cortical depth using LayNii's UVD filter - Remove floating bits that might occur in the process ''' import numpy as np imp...
3259eeb63833e3d302d863d05b6efe53fe345461e9aa2b9a43ef2446dd5b8b7e
Python
2,915
92
''' compare 1) len(X), 2) human boundaries data and 3) event labels the time data of len(X) and humam boundaries need to match - if range(human boundaries) > range(X), hb need to be removed - if range(human boundaries) < range(X), ''' import os import pickle import numpy as np import pandas as pd import seaborn as s...
54d363685e8806cf9f2ee91bf9aa9d7cd0ce3ef702dc724499a9722090797874
Python
2,915
85
# -*- coding: utf-8 -*- """ Created on Mon Jun 30 09:01:00 2025 @author: ju-bar Functions handling input of structure data via the Vesta file format. The Vesta file format is a text format defining a volume in space which is filled by atoms. There is additional drawing information for the Vesta program in the file, w...
cd4b0e2bee054535f560a1799ddf87c66c899f78732e7d26a55d35a5bb58649b
Python
2,915
65
"""Versioned Mothra model runtime and explicit historical compatibility mode.""" import argparse import json import platform import importlib.metadata import keras from .activations import legacy_tanh, legacy_sigmoid from .optimizers import DeduplicatingAdam @keras.saving.register_keras_serializable(package="Mothra") ...