sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
89af97502f8f33f08185497901d9077c1d442c53c49ab5bb691cb61232ef0683 | Python | 13,986 | 403 | # 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... |
8179901b18a76cd171ca919a7e3fb6e88e598de3adbb13a0f9ce6cc42cc52f26 | Python | 13,988 | 425 | # Copyright 2023 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
dd4b1ac27f498461905bff9d65b95a693d27edd0ce2c023dbbda64330966bd10 | Python | 13,989 | 382 | """
From https://github.com/ehoogeboom/e3_diffusion_for_molecules/
"""
import numpy as np
import torch
import os
import logging
from typing import Dict, List
from torch_geometric.data import Batch
from torch_geometric.utils import unbatch
from urllib.request import urlopen
from src.datamodules.components.edm.downloa... |
781e9b42891d86fb829eb588be1d1d15c10d3a0d60858ac5ead2d73d8c30389d | Python | 13,990 | 260 | # Copyright 2023 BioMap (Beijing) Intelligence Technology Limited
import argparse
import random,os
import numpy as np
import pandas as pd
import argparse
import torch
from tqdm import tqdm
import scipy.sparse
from scipy.sparse import issparse
import scanpy as sc
from load import *
####################################... |
5b43ff51e37ccafda0d3e15a5c59cd54ea3a829cacbde5812a6c41fcb5bc4c81 | Python | 13,994 | 272 | import sys
sys.path.insert(1,'./')
sys.path.insert(1,'../src_VI/')
sys.path.insert(1,'../src_MCMC/')
import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader
import data_sim
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LassoCV,RidgeCV
import pyreadr
from skl... |
46be376ad14e282d16f8a21198132e0d8b545f09a5f68c8489d04b995f4d21ee | Python | 13,998 | 335 | import matplotlib as mpl
mpl.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
import os
import struct
import gzip
def download():
'''
Download files from url
'''
os.makedirs(f"{DownloadDir}", exist_ok=True)
for filename in filenames.values():
os.system(f"wget -nc -P {Download... |
a873e80fc7635ce7c79a71177a714d8d6e20963ad3dd039465350287ed346aa7 | Python | 13,998 | 520 | ######################################################################################################################
# This script coordinates training and testing of cell segmentation with Pytorch Lightning #
# Author: Melinda Kondorosy, Daniel Schirmacher ... |
12280261f19731f8e918512913a42d49399b34ed24489f7ae33fac49232d513f | Python | 14,002 | 442 | import argparse
import os
import shutil
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import pdb
import random
import cv2
from PIL import Image
from scipy.io import loadmat
from torch.autograd import Variable
from torchvision import transforms
from torchvision.models.segmentation im... |
70c9f8f9504b64a0d25cc19ff23c794f4978c702de4709d7377b87ea2c6b87a0 | Python | 14,002 | 328 | """Persistent Jupyter-kernel execution for adata-backed MCP tools."""
from __future__ import annotations
import asyncio
import json
import logging
import os
import tempfile
from pathlib import Path
from typing import Any, Dict, Optional
from .session_store import SessionStore
logger = logging.getLogger(__name__)
... |
e2d790d777d6259b51c636c941404c64ac3e2642798c64d9f374f965154c9279 | Python | 14,003 | 411 | # Copyright 2021 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
11468cb956a8ee87198515bf3566426019836351e45aac8d1d7ef55ee34760eb | Python | 14,016 | 298 | __author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
import tensorflow as tf
import numpy as np
from mdgru.helper import argget, compile_arguments, generate_defaults_info
import copy
from tensorflow.python import pywrap_tensorflow
import logging
from tensorflow.python.ops import random_o... |
fc140c41369ddd3f57b04f8de4b10f40b580472fdb9bc7aef84d8fe5ec8aa476 | Python | 14,017 | 525 | from __future__ import annotations
import contextlib
import io
import os
import shlex
import shutil
import subprocess
import sys
import textwrap
import traceback
import venv
from dataclasses import dataclass
from pathlib import Path
from typing import Final
PROJECT_ROOT: Final = Path(__file__).resolve().parents[2]
RE... |
4d0f6822837fd110f2cdf86d1b7c25209131b451cc128e6b7dc1c49b64df6d15 | Python | 14,018 | 410 | # Modified from https://github.com/open-mmlab/mmediting/tree/1.x/
import torch
import torch.nn as nn
import torch.nn.functional as F
from lqit.registry import MODELS
from .utils import masked_loss
_reduction_modes = ['none', 'mean', 'sum']
@masked_loss
def l1_loss(pred, target):
"""L1 loss.
Args:
p... |
2a19202113ca8cda06dfd6828f91eeac337da33639905262644f32e5d89d5a59 | Python | 14,019 | 245 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'annot_form.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, Q... |
6fa71c26b15855c8fda77a6d7abc1e2bf56df85cbed13e65cf21df1827f46abf | Python | 14,020 | 358 | import os
from progress.bar import Bar
import numpy as np
import pandas as pd
from pyfaidx import Fasta
import itertools
'''Run all parts in sequence'''
def run_all(db_name, overwrite_all=False):
types = ['noN', 'N']
versions = [1, 2, 3, 4, 5]
print('AGGREGATING SPLAM DATA...')
splam_aggregator(db_na... |
feaf12cacf4ecc6751b9a97246e59175ccb063622c46ae820aa6c2115f2726b5 | Python | 14,039 | 386 | """
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 dataclasses import dataclass
import torch
import torch.distributed._functional_collectives as fun... |
3116f8665211957aa1ec71ae0fcbd250a354e4095413e12115e747aaca1c8f80 | Python | 14,040 | 397 | import rdkit
import rdkit.Chem as Chem
import numpy as np
import random
from edit_mol import get_product_smiles
elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', '... |
0f24f144d5dd10203c6eee9cfcf689f567a20cd30192f2ddf4d18f930aaf909a | Python | 14,045 | 339 | """
Like image_sample.py, but use a noisy image classifier to guide the sampling
process towards more realistic images.
"""
import argparse
import numpy as np
import torch as th
import torch.distributed as dist
import torch.nn.functional as F
from .guided_diffusion import dist_util, logger
from .guided_diffusion.scr... |
e7460e4b3dc93ed1717f3f22600b4ae98bf23f40d9a6be78099e0f33d3cb8442 | Python | 14,045 | 363 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
73148196bc7fd1e9b7be69430f20f6dbc0a90e501ca65f7ce30a31e647991c93 | Python | 14,046 | 411 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from tqdm import tqdm
from torch.optim import AdamW
from torch.utils.data import Dataset, DataLoader
import pandas as pd
import numpy as np
from math import exp
import copy
class VAE(nn.... |
a26605f1e97cb0d8967f89cfe07bc876d3235a35de3a858d0c5cbeb23860b4c2 | Python | 14,050 | 329 | # Copyright 2023 ETH Zurich Computer Vision Lab and 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... |
fbb9c8ff75331f14f4883945438acd997c9f4230e88ca5240cb7993c7718b51c | Python | 14,054 | 283 | #!/usr/bin/env python
# rampageLaunch.py 0.0.1
import argparse,os, sys, json
import dxpy
from launch import Launch
#from template import Launch # (does not use dxencode at all)
class RampageLaunch(Launch):
'''Descendent from Launch class with 'rampage' methods'''
PIPELINE_NAME = "rampage"
''' This must ... |
d00b169cbda97c5ae4abeafe04c9ed35cbb11127e91af6ef36310ac1ddb1277e | Python | 14,065 | 342 | # --------------------------------------------------------
# SimMIM
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# Modified by Zhenda Xie
# --------------------------------------------------------
import os
import time
import argparse
import datetime
imp... |
34bd54e4f8abc78f273bd177126569da4cfcb7635d272b3e8a9721fcc88e6821 | Python | 14,066 | 326 | import json
import logging
import os
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from pyspark.util import inheritable_thread_target
from ray.util.spark.cluster_init import _start_ray_worker_nodes
class SparkJobServerRequestHandler(BaseHTT... |
789f8415551df968d1ac88dadb49a26df70fb50483ad63ce7ed851e2d87a23cb | Python | 14,067 | 405 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Implementation of analog MVM for torch tiles."""
from typing import Union, Any, Optional
from numbers import Number
from torch import Tensor, zeros, randn_l... |
cbc7a10f7f631e903567dcead63b0574f947eb3308eb944c8cf23f6851ea9874 | Python | 14,071 | 372 | import math
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
class HiddenLayer(nn.Module):
def __init__(self, input_size, output_size):
super(HiddenLayer, self).__init__()
self.fc = nn.Linear(input_size, output... |
0d019ff29f473febdaaca769dd9a33102674c9d2e675cadf82d9a17dca70520a | Python | 14,074 | 371 | # Copyright 2023 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
972f7a2b4b039eb5a94bd9e1011128f0be95993d39f31711be1754803007dbf0 | Python | 14,078 | 339 | # -*- coding: utf-8 -*-
"""
Created on Fri May 10 09:29:08 2024
@author: nlancaster
"""
#% Combined FLR and Quant Eval Plot Data Prep beginning
import pandas as pd
import numpy as np
standards = pd.read_csv('P:/Projects/NML_TPC_2023_ThermoFisher_Phosphoproteomics_q-OT-Astral/SyntheticPhospho/SyntheticPhosphoStds_Refer... |
4930a4a1bbe699a127c6c0dd891c410a8b91e7058f3be78ba6ea62bc46cbe4ff | Python | 14,080 | 398 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For the selected k, generate the state-wise sFC matrices, average dFC states, full sFC matrix, and
occurrence-weighted average dFC matrix. Save and plot the matrices, and find the correlations between
sFC and dFC matrices.
Output:
'S'+str(kidx+1)+'_sFC.csv' State-wise... |
74be93977349e141babedf0c9370db21e0d941d8ed236e725bfdd77d13068c97 | Python | 14,082 | 357 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import itertools
from utils import to_pth
from utils.io import pickle_load
from utils import TrainValidSplit
from scipy.cluster.hierarchy import dendrogram, linkage
from utils._METAConstants import hier_struct, hlc2hlcid, mlc2mlcid, llc_names, ll... |
700a6361f16f4839745d8c51e7569c7099bd01a4cf856062d15137f1d381c74d | Python | 14,089 | 403 | """
Unified execution coordinator for MCP tool calls.
Handles the full lifecycle: resolve → validate → check prerequisites →
select adapter → invoke → return structured response.
"""
from __future__ import annotations
from typing import Any, Dict, List, Optional
from .session_store import SessionStore, SessionError... |
5c175a0d99523cdaabfe79c6320fa0ef28b138c0289eeb8cecc03bea99be59b3 | Python | 14,093 | 284 | # -*- coding: utf-8 -*-
"""
# SCRIPT: FIRST LEVEL GLM FOR FEATURE SELECTION
# PROJECT: FMRIREPLAY
# WRITTEN BY LENNART WITTKUHN, 2018 - 2019
# REVISED BY QI HUANG 2022
# CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY
"""
# In[1]: import relevant packages
# import basic l... |
f3786d03c5e2ead84848b9409b93fc0c4e577d6a7ea1bebfb4a56b8fc034510f | Python | 14,093 | 354 | """Ro/e — ratio of observed to expected cell numbers (tissue/condition preference).
The Ro/e statistic quantifies whether a cell cluster is *enriched* or *depleted*
in a given tissue / sample / condition relative to a random distribution. It was
introduced by Zhang et al. 2018 (*Nature*, colorectal-cancer T cells) an... |
7ced459e0b1325cd6b12bcd765f0f91efdbbdb3a29c3c2790b1fea00e7c97fe5 | Python | 14,095 | 361 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import anndata
import os
import torch
import scipy.sparse as sp
from sklearn.preprocessing import normalize
from tqdm import tqdm
torch_install=False
def global_imports(modulename,shortname = None, asfunction = False):
if s... |
18ddce768a1bb4326b6c7855be50a44342473bd9dc6d68d208bcce509bd8f88a | Python | 14,098 | 364 | from logging import Logger
import os
from typing import Dict, List
import numpy as np
import pandas as pd
from tensorboardX import SummaryWriter
import torch
from tqdm import trange
from torch.optim.lr_scheduler import ExponentialLR
from .evaluate import evaluate, evaluate_predictions
from .predict import predict
fro... |
01ec386cdf7fd36f919f98ec9ea0a5d9fcd48f7f2f0d7d3d7b1fb6cb72e96d8f | Python | 14,104 | 373 | # -*- 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 the RPU array bindings."""
from unittest import SkipTest
from numpy import array, std, dot, reshape
from numpy.random import uniform
from numpy.te... |
29f45682102de1b03fb0bef3c4288e7dba6135e6fb69bc22b8dc2c4b70b02dad | Python | 14,133 | 370 | import tempfile
import unittest
from unittest import mock
import numpy as np
import pytest
import pfrl
from pfrl.experiments import evaluator
@pytest.mark.parametrize("save_best_so_far_agent", [True, False])
@pytest.mark.parametrize("n_steps", [None, 1, 2])
@pytest.mark.parametrize("n_episodes", [None, 1, 2])
def t... |
811498eb5470442fd9f96217e1f1a81540ab6e00fa1c1586951c5465837bf5ff | Python | 14,144 | 336 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 04 10:21:00 2021
@author: ju-bar
Modified on Mon Jun 20 11:48:00 2022 (ju-bar) added make_g_matrix, read_XTL
Functions handling input and output of structure data
via the XTL file format.
The XTL file format is a text format defining a volume in space
which is filled by... |
085f392686d9e2616bc1bfb4d06e662282714472f7b30378694da2f9d33efa86 | Python | 14,145 | 312 | import torch
from torch import nn as nn
from torch.nn import functional as F
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups, paddin... |
2a8edcd960cc0a108e5eb7212e6cc9012a81a35e548abf82d42313d4f58cd7a6 | Python | 14,146 | 382 | confidences = {
"VGG-Face": {
"cosine": {
"w": -6.61254026479904,
"b": 3.145549102667549,
"normalizer": 0.979183,
"denorm_max_true": 88.28484099529868,
"denorm_min_true": 20.787978733113846,
"denorm_max_false": 20.556681914175016,
... |
892f38741a455b876aab9960af1653f9ebff214b6ca3b490cecdbfab837bc184 | Python | 14,147 | 374 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 1 16:12:26 2020
@author: istone
Class for fitting hidden Markov models (HMMs).
Updated: Sep 1, 2020
"""
import numpy as np
from glmhmm.init_params import init_transitions, init_emissions, init_states
class HMM(object):
"""
Base class ... |
f728f3ee780b126e233db8fad59abdcf0afb4adf2af962a8c83efb3ee2c2aa7e | Python | 14,163 | 363 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Complete pipeline for CaImAn online processing and comparison with consensus
annotation. The script processes one (or more) of the provided datasets and
compares against the consensus annotations. It generates three figures:
i) contour plots of the detected components... |
af44f2c61748ebb191b9b22eac33ba478bf23c001113573f56674c68c9f156f3 | Python | 14,169 | 338 | #--------------------------------------------------------------------------------------------------------------------------------------------
# Authors:
# Brandon S Coventry Wisconsin Institute for Translational Neuroengineering
# Date: 05/4/2024 Happy Easter! Wisconsin is finally... |
4300db500361e11b91971a55731197b139b6948f4efdff50561b45766c8501bd | Python | 14,171 | 334 | import argparse
import torch
import torch.nn as nn
from .components import Generator, Embeddings, FactorizedEmbeddings, PositionalEncoding, \
WeightSharingEncoder, WeightSharingDecoder
class Whole(nn.Module):
def __init__(self, transformer, emb, generator, d_model, device):
super().__init__()
"... |
c751bdd44b3c2160e4fafcc93fb116a2ee787d08959cb761824eb7c1ea0f3fdd | Python | 14,175 | 270 | # conftest.py
from tabulate import tabulate
import numpy as np
from collections import defaultdict
import pytest
import json
import os
import pandas as pd
from datetime import datetime
# Each pytest-xdist worker runs its own pipeline, so the workers share the cores instead of each spawning a torch thread per core
if o... |
42ca89e9822dfa2767bd7598754c77e6b3e5b9a246d638e02a4da12e308e0259 | Python | 14,179 | 327 | '''
A belief state RL task from the lab of Adil Ghani Khan.
Version 0:
We're using VisualOlfactoryAttentionSwitchNoBlankEnv which inherits from this but modifies _step()
Block Visual:
3 time steps in a trial:
step 1: blank cue
step 2: lick is punished, one of 2 visual stimuli is shown
step 3: lick leads to reward... |
a6c308146b066c293279aaddb29b6698cd4069e3ddbf81fa27892e1914f7f899 | Python | 14,184 | 406 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 17 11:53:51 2021
@author: mmall
"""
CODE_DIR = 'C:/Users/mmall/Documents/github/'
SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/fits/'
import socket
import os
import sys
import pickle as pkl
import numpy as np
import scipy as sp
import matplotlib... |
418ac652d661c897df7b045824f36440f303dd9cd658cc022b0c13fc09ee0635 | Python | 14,185 | 388 | import csv
import gzip
import json
import os
from pathlib import Path
from typing import Optional
import plyvel
import pandas as pd
from rich.progress import track
from . import utils
def load_upkb_aliases(raw_folder: Path, processed_folder: Path, version: str, console) -> dict:
if os.path.isfile(processed_fold... |
5944c19ccf3ecdba1460267005e4571ea29ff6e5a293b7b560f578acdd610f46 | Python | 14,185 | 398 | #!/usr/bin/env python3.7
"""Defines Fascicle class.
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 itertools
im... |
4415185fd9cd4fc8c5f28745e708444f5dbd12418a7938d74f372c4056cf55bd | Python | 14,193 | 246 | import torch
import math
from torchEnKF import misc
from torchdiffeq import odeint_adjoint
from torchdiffeq import odeint
from torch.nn.functional import normalize
from tqdm import tqdm
import time
def construct_Gaspari_Cohn(loc_radius, x_dim, device):
def G(z):
if z >= 0 and z < 1:
return 1. ... |
ffbe2525cf65ef99243cf19b0dc653aab2bdcf1475682f26074d65450a6834f9 | Python | 14,193 | 318 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
class Network(nn.Module):
"""
Atomic coordinate network.
It registers the CA coordinates and the relative rotations of all residues as learnable parameters.
batch (int): number of prot... |
3e1f7f05d00f0b758a0cc7ce0b50dd2db6ddbdb06f6350d911c8b7fab1287d7e | Python | 14,197 | 408 | # -*- 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.
#... |
e291c5b3cd8086b5d43525069598804f6121e4cf2fcf19f63d086aeafea3b592 | Python | 14,197 | 431 | # This file is part of the INTREPPPID programme.
# Copyright (c) 2023 Joseph Szymborski.
#
# This programme is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, version 3.
#
# This programme is distributed i... |
c0a593b4a621457675f85928f10e1de11284dc9c7e316a7a21f5b547a5f7ddff | Python | 14,204 | 368 | """Transcriptome-wide association study for ``ov.genetics`` — TWAS backend.
Wraps the standalone :mod:`pytwas` package — the (S-)PrediXcan /
S-MultiXcan family (Gamazon *et al.* 2015; Barbeira *et al.* 2018, 2019).
:func:`twas` is a single dispatcher: ``method='spredixcan'`` runs a
single-tissue summary-statistics TWA... |
d4a4b932ee3ff5b4d10a2ac294d22109a71834c3600631063c2ae0052ce15229 | Python | 14,207 | 522 | import sys
import pytest
import ci.ray_ci.doc.run_docstring_examples as runner
from ci.ray_ci.doc.run_docstring_examples import (
_EXCLUDED_DIRS,
MissingLibrary,
covered_files,
extract,
is_skipped,
label_path,
main,
missing_library,
module_name,
run_docstring,
)
_SOURCE = '''"... |
1e1761e507d20afbaeaf7d27c6d277c72f6cb68950c108960f2d9f130e19c83a | Python | 14,209 | 303 | from pathlib import Path
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.colors import Normalize
from matplotlib.ticker import StrMethodFormatter
from matplotlib.cm import get_cmap
import matplotlib.colors as mcolors
import os
from matplotlib import rcPa... |
722301daabde51dd6970f1e76002a61a55da3bee33527941315ad426abf58843 | Python | 14,209 | 411 | import nibabel as nib
import nipype.interfaces.io as nio
import numpy as np
import pandas as pd
from copy import deepcopy
from matplotlib import rcParams
from nilearn.input_data import NiftiLabelsMasker, NiftiMapsMasker, NiftiMasker
from os import path
import matplotlib.colors as mcolors
import matplotlib.pyplot as pl... |
373eb84d6df8e65ea18927d04f61d539ee33f6b1ed18a19b8d94085586252d1e | Python | 14,210 | 309 | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.srgan_model import SRGANModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_proce... |
1e9af047ff75f5425365f45fbcfc900736b063218bd80b1efa5d0bda85f132ad | Python | 14,216 | 417 | """Optional bridge to Zhengchen Cai's threemica HTML viewer."""
# Author: The BrainSpace developers
# License: BSD 3 clause
import re
import shutil
import tempfile
from dataclasses import dataclass
from pathlib import Path
import numpy as np
_BRAINSPACE_MAPS = {
"curvature": {
"filename": "conte69_32k_... |
b3b2b5a3c9f4aaf70144a9fc2f0f5544273e2c70181e5a1531aa208f57892580 | Python | 14,233 | 390 | from __future__ import annotations
import json
import logging
import os
import warnings
from dataclasses import asdict
from pathlib import Path
from typing import TYPE_CHECKING
import cellxgene_census
import rich
import scanpy as sc
from huggingface_hub import ModelCard, snapshot_download
from rich.markdown import Ma... |
d39e17da1f3d44832b1ee4e605feead66c7d2604d6277e8b8ea83c34e961eb56 | Python | 14,233 | 407 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Filter putative de novo variants.
1) Evaluates the results of a single-sample test against metric cutoffs derived
from a random-forest classifier, removing false positives in children and
adding false negatives in parents.
2) For PE/SR BCA and small CNV, tests the r... |
6b153c29d3c93d7fbfab32794fc932936cd386f945deec2b833014a48517b4a0 | Python | 14,234 | 372 | ###socialDoors - RF1 Aging - Ori Zaff 8/23/22
from psychopy import visual, core, event, gui, data
from psychopy.visual import ShapeStim
from instructions import *
import pandas as pd
import os
import datetime
import time
#gui set up for subject id and picture order
subjDlg = gui.Dlg(title="Picture Task")
subjDlg.addF... |
83f85c1bee8fad904c005151d7013d34c795c5536b5168e6575a5c485e18d36a | Python | 14,243 | 421 | """
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 math
import torch
import torch.nn.functional as F
from e3nn.o3._spherical_harmonics import _sph... |
bb6a73d7726910f315d9dc84c45be14457e926c3e5a1abe72cf86e24ea141096 | Python | 14,244 | 283 | import torch
import torch.nn as nn
from DWonder.SEG.buildingblocks import Encoder, Decoder, FinalConv, DoubleConv, ExtResNetBlock, SingleConv
from DWonder.SEG.buildingblocks import TS_Encoder, TS_Decoder, DoubleConvTS
from DWonder.SEG.utils import create_feature_maps
class UNet3D(nn.Module):
"""
3DUnet model... |
a3135e3e2a5a77894c88b25c22d2de2a66c52eb70f735a92f32435838e5b3542 | Python | 14,245 | 368 | """
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 dataclasses import asdict, dataclass, field, replace
import torch # - needed at runtime for data... |
0d082b2a1c2330d84f387f2fa5bc15b133bcd587f7403771cefa2810e727c68a | Python | 14,246 | 418 | r"""
Useful functions
"""
import time
import math
from typing import List, Mapping, Optional, Union
from pathlib import Path
import scanpy as sc
import torch
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
from sklearn.metrics.pairwise import euclidean_distances
from anndata imp... |
ec46174ee2822df125f82a45c39df09c42cfb1ef0bab782c46d217af17f5e1b7 | Python | 14,251 | 380 | # Copyright 2024 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
093c5345d2372b5b8c189404a96e5eda29d47bee78af43cf6c09f4c3ddeece09 | Python | 14,252 | 372 | import re
__author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
TINY = 1e-20
import matplotlib
matplotlib.use('Agg')
import numpy as np
import copy
import os, errno
import scipy.linalg as la
from scipy.stats import special_ortho_group as sog
import logging
import urllib.request
import f... |
ee71b6fa8ecd0650c241c2b66da1466f451a00852e983e5d4972818d70ade24a | Python | 14,255 | 431 | # -*- 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.
#... |
0eb9cf12ff01cec8696db4375ebda871a0ec17a2bb4c1cb715514b77788efe9a | Python | 14,271 | 345 | import torch
import random
from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader, Dataset
import calibration as cal
import logging
import yaml
import os
import pandas as pd
import ... |
f596aa2175b6ad87c51b3dbbd6d83fb9cf15fbd3353de7c5b1fb0bbe6865ad73 | Python | 14,272 | 346 | import torch
import random
from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader, Dataset
import calibration as cal
import logging
import yaml
import os
import pandas as pd
import ... |
fca800a55d806a6c9ad1e9acc8d0cb8fb28c124cbcb6ff3c47ffa04b7975bf2f | Python | 14,275 | 356 |
#%%
import scvelo as scv
import pandas as pd
import numpy as np
#%% CHECK THE DIFFERENT AEs file to chooose the right arch and more details of the method.
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Model
from te... |
7ad1803fcce1efa3e42f408f903f51e661928159ed0bb819c97146f42d39e0bb | Python | 14,279 | 334 | #Lightning Data Module
from . import __file__
import geopandas as gpd
import glob as glob
from deepforest.main import deepforest
from descartes import PolygonPatch
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.collections import PatchCollection
from pytorch_lightning import LightningModule
imp... |
82615c61c67e8c59b535f0c8b2504301414740760080d92330788226fd6e7b44 | Python | 14,282 | 360 | """Classes storing gene expression data."""
from abc import ABC
from typing import (Any, Callable, Collection, Dict, Iterable, Iterator, Mapping,
MutableSequence, Pattern, Sequence, cast)
import pandas as pd
from tqdm import tqdm
from .sparsetools import rescale_rows, filter_cols, iterate_sparse
f... |
94a4b86cdcc6e3e612f1118f891e61573615c7b0b6284e664804c79a78c6821c | Python | 14,282 | 262 | from torch.nn import Conv2d, Linear
from torch import where, rand, topk, long, empty, zeros, no_grad, tensor
import torch
import sys
from lop.utils.AdamGnT import AdamGnT
from torch.nn.init import calculate_gain
from lop.utils.miscellaneous import get_layer_bound
class ConvGnT(object):
"""
Generate-and-Test a... |
41ef31838a90482b85d5d191b25e841d042242af897c17d7923072f4971862fb | Python | 14,286 | 447 | # -*- 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.
#... |
6f79084d5dc0d11c5cbb5905f77bae84807ed707c768d7e70e8500ce052d73eb | Python | 14,297 | 494 | #!/usr/local/bin/python
"""
***********************************************
- PROGRAM: matrix2tab.py
- CONTACT: Bryan lajoie (bryan.lajoie@umassmed.edu)
***********************************************
"""
from __future__ import print_function
from __future__ import division
import numpy as np
import scipy as sp
impor... |
bbd34b8412a5b9e5a0fef204fbf05a60d24b7e1d0dea1485118033eefc91810c | Python | 14,303 | 333 | # Copyright 2023 Katherine Crowson, The HuggingFace Team and hlky. 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
#
# ... |
613c215db091f3cb61ae7023aa71fe02572973ce52920cff936670245b37fc19 | Python | 14,306 | 378 | import math
import pytorch_lightning as pl
import torch
import tqdm
import yaml
from torch import nn
from .fourier import apply_fourier_mask_to_tomo
from .masked_loss import masked_loss
from .missing_wedge import get_missing_wedge_mask
from .normalization import get_avg_model_input_mean_and_std_from_dataloader
clas... |
e5c9f7d757cf3039c2394e7977e83ab9bbd469529f8832c54159cf63de2f9f6d | Python | 14,306 | 410 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 16: Train a GAN using Linear Layers to generate MNIST characters.
This experiment creates a Generative Adversarial Network (GAN)
-https://arx... |
adbdd69a08dd59438fef7232241f16d01c64814eac44e6a626bb421bd9dc5333 | Python | 14,315 | 274 | """
Immune-repertoire analysis for omicverse — a unified AIRR-seq (TCR / BCR) suite.
``ov.airr`` is the analogue of ``ov.protein`` / ``ov.genetics`` for adaptive
immune receptor repertoire sequencing. It threads the major AIRR-seq
analyses behind one registered, dispatch-based API and spans two regimes:
**Single-cel... |
a8346fda3627cd9975f4d4dbcf7415368449072f60a9edb4dd5fcb4d14753761 | Python | 14,320 | 411 | # 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... |
826167af949471b38868035c89f8f590b4bc1aa867220fd16786e0f2cdcc569b | Python | 14,327 | 237 | #! /usr/global/bin/python
# Pipeline Wrapper Version (last revision's modified date)
last_modified = 'Last modified by Eric Earl, 6/25/2015'
# Add system paths for python modules while script is running.
import sys,os,numpy,argparse,csv,re
from scipy.io import loadmat
# Program Description
prog_descrip = """%(prog)... |
d97651efe1852019bf6e14a384f4a9990ff195155f99a3d48fe964fe195594e0 | Python | 14,332 | 480 | import numpy as np
from scipy import sparse
from sys import getsizeof
from scipy.stats import spearmanr, pearsonr
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.preprocessing import normalize
from sklearn.neighbors import NearestNeighbors
import igraph
import networkx as nx
... |
e8590ce553e471912ca69ab3c8a96abc912cf2301adffc3334a79342cf4383fd | Python | 14,338 | 413 | """OpenTargets Platform data collector."""
import logging
from typing import Any, Dict, List, Optional
import json
from src.api.opentargets import OpenTargetsClient
from src.models.genomic import Gene
from src.models.disease import Disease
from .base import BaseCollector
from config.config import settings
logger = ... |
df5cf8137ae88144d61a1ca25f3133a1a29e6faf23251e6dde9bd11382274b56 | Python | 14,339 | 423 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
#import ._networks as nw
from ._networks import plot_network
from collections import defaultdict
import scipy
import scanpy as sc
def plot_top_genes(adata, top_genes = 6, ncols = 2, figsize = (8,8), color_map = 'tab10', color ='attractor', att... |
828a9e72b3f04ad867bacdde21051f9091309de233eb51b50eda0807e6b27114 | Python | 14,340 | 316 | import numpy as np
import tqdm
from pysted import base, utils
import os
import argparse
from matplotlib import pyplot as plt
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
... |
7fb3bfc9ded5f1957490a673584f3e62f89938ecfede08cc2838615754d458df | Python | 14,342 | 496 | """Utility to compare pep440 compatible version strings.
The LooseVersion and StrictVersion classes that distutils provides don't
work; they don't recognize anything like alpha/beta/rc/dev versions.
This module is copied from scipy:
https://github.com/scipy/scipy/blob/f78862d5dd687fedaeafc06a31df53cc7ebe8d57/scipy/_... |
81e44078b356db33bb3d0966b2125ab6054611ce1ba3181c8258af5f390c6d55 | Python | 14,342 | 428 | import numpy
import matplotlib.pyplot as plt
import math
import os
import scipy
import scipy.ndimage.filters
import scipy.ndimage.morphology
import skimage.io, skimage.util, skimage.filters, skimage.transform, skimage.feature, skimage.exposure
import sys
import networkx
def detect_local_minima(arr):
# http://stack... |
2c82f0b2015f3cb4e5ec93efbeef767b7189da53154677b06214db8c4af7a274 | Python | 14,343 | 408 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A set of routines for estimating the temporal components, given the spatial
components and temporal components
"""
from builtins import str
from builtins import map
from builtins import range
import logging
from scipy.sparse import spdiags, diags, coo_matrix, csc_matri... |
28be1eb65049e9beb9d148cf869eedbb5f0bd018af598cdf8441a42f6b3c7794 | Python | 14,345 | 326 | r"""Ancestral sequence reconstruction — thermostability without a large model.
Resurrecting an inferred ancestor is one of the most reliable ways to get a more
thermostable enzyme, and it long predates deep learning: ancestral proteins are
consistently more stable than their descendants, plausibly because ancient
envi... |
1ab91999dbf804e4216b520db4ca6f9fb22c6816c5c10ee8efb976c66539973c | Python | 14,351 | 307 | from sklearn.preprocessing import MinMaxScaler
from torch.utils.data import DataLoader, Dataset, random_split
import pandas as pd
import numpy as np
import os
import torch
import joblib
class MyData(Dataset):
def __init__(self, X_seq, y_seq):
self.X = np.array(X_seq)
self.y = np.array(y_seq)[:, :,... |
28b3236389db3ee5ab09b96ac1aeef540f207e0944e5edfb7e03475c07e9ecdf | Python | 14,351 | 356 | """
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.
Check links in the documentation sources and fail on broken ones.
The checker is split into two tiers so the per-PR gate is deterministic and ... |
fe233f04438d787db5d842921fea28cef1aa5fa1eb90992ff7467953f1f45f3b | Python | 14,353 | 345 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
import random
transition = namedtuple('transition', ('state', 'EKFstate', 'action', 'reward'))
class ReplayMemory():
def __init__(self, MEMOR... |
72bcaee7987c6e061d5be1b8ddae9f6a756cc42eeb6c71bfe9476cc22d363c54 | Python | 14,354 | 424 | import copy
import itertools
import logging
import math
import pickle
import os
import sys
from pathlib import Path
from pprint import pprint
from typing import Dict, List, Optional, Tuple, Union
from scipy.stats import beta
import click
import dask.dataframe as dd
import numpy as np
import pandas as pd
import psutil
... |
474c36da4d8f6585d338512df266589f49b5e6f12bd592158af89f02528a7ac4 | Python | 14,361 | 371 | ####################################################################################################
# Copyright (c) 2020, 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 free softw... |
478f97e86a26347f80655162d929a2349d9af348b0489b58e5bf1c812168245b | Python | 14,364 | 273 | import numpy as np
import pandas as pd
from scipy import special
from scipy.stats import norm
def calculate_LDI_REC(df_MST_concat, num_forms=1, n_trials=320):
"""
Given a MST dataset with the following columns, compute LDI and REC measures. It is not adapted for reliability
split use.
Parameters
-... |
f93c0e7191476438e4d12c384eb325ebe954bfbaf36da8889bdb22fd501a6b17 | Python | 14,365 | 441 | """
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.
SLURM job submission utilities for FastCSP.
This module provides utilities for submitting and managing parallel jobs
using the submitit librar... |
41bdf2561ee8247a975c418e6e24e04738c73af201ecfb9850fcd076e8ce2689 | Python | 14,368 | 368 | """Methods for integration of plots of mri data processed to 3D tensors from within notebooks."""
from collections import OrderedDict
from enum import Enum, auto
import os
import tempfile
from typing import Any, Dict, List, Optional, Tuple, Union
from IPython.display import display
from IPython.display import HTML
im... |
293342b07736f65a07e88903d9f9237abaa7a3d5e5cc4acb4c8b09c0ffe4620f | Python | 14,382 | 408 | import os
import time
import random
import numpy as np
import torch.utils.data as data
import torch
import threading
import queue
from dataclasses import dataclass, field
from typing import Any
import torchvision.transforms as transforms
@dataclass(order=True)
class PrioritizedItem:
priority: int
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.