sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3030f2683915234a9e60bd9119235cc3c3f7066464a04ea66fb39c4cd2adbd89
Python
8,410
192
import argparse import time import json import random from collections import Counter from dataset import Mol3DDataset, SimpleTokenizer import argparse from utils import set_seed import numpy as np import wandb import os import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.nn import fun...
4f6027113c234cada9a3abeccac946f2f8a1ea37788bf5e85dd59dc720376997
Python
8,412
213
import settings from pandas.core.frame import DataFrame import re from torch.utils import data import pandas as pd class Dataset(data.Dataset): """ A class implementing :class:`torch.utils.data.Dataset`. Dataset subclasses the abstract class :class:`torch.utils.data.Dataset`. The class overrides ``__len__...
3c7ee8b1d5d87ea0fb48c4aaceab8d39a8e82060b287e0ecef1bdc79de933db4
Python
8,415
197
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models_no_res import * def seed_everything(seed):...
53f5e07c44866f51cfe470b289eeb2ef6d04256e3033426166b1eb84797de643
Python
8,417
266
# coding: utf-8 """ MIT License """ ''' Project: Parenchymal Attention Network Authors: Axel Masquelin Description: ''' # Libraries # ---------------------------------------------------------------------------- # from argparse import Namespace import matplotlib.pyplot as plt import pandas as pd import numpy...
a2ec1bc57fa6eb9a7e07a75d755f951532250b83333906da9ea4b9a765f65908
Python
8,420
192
from copy import copy import numpy as np import pandas as pd from statsmodels.stats.multitest import multipletests def ttest(params): """Perform a T-test on the data Args: params (list): list containing control and experimental groups, normalized dataframe and if the variables are dependent...
bc6a4db7f1c311a7d8efe4ac96cc287598184c15a1ee2126e93a20eb1fc0f8a3
Python
8,422
279
from datetime import datetime, timezone from unittest.mock import patch import pytest import pytest_asyncio from langchain_core.indexing import InMemoryRecordManager @pytest.fixture def manager() -> InMemoryRecordManager: """Initialize the test database and yield the TimestampedSet instance.""" # Initialize...
9493f5832bc10696f419f3194e04c06de69812971d1bcf475c35bddd9f308901
Python
8,423
258
from pathlib import PosixPath import matplotlib.pyplot as plt import mlflow.pytorch import numpy as np import pandas as pd import torch from mlflow import start_run from monai import transforms from monai.data import PersistentDataset from torch.utils.data import DataLoader def log_mlflow( model, arg...
e9c5f28db507a9a9d68e3fa0f4b53f1286d8071b0a900e80afe92a30facc177f
Python
8,425
283
import logging import os import warnings from importlib import resources as impresources from typing import Tuple, Union import pandas as pd import pytorch_lightning as pl import torch from rdkit.Chem import PandasTools from torch_geometric.loader import DataLoader from torch_geometric.transforms import Compose, Norma...
20ab584638f0602ca5cda3bcd3519b7dd0efb61f17faeede882ef12e2e538558
Python
8,429
219
import torch from torch_geometric.loader import DataLoader import os import pickle from sklearn.model_selection import KFold import numpy as np import random from torch_geometric.nn import global_mean_pool, GATConv import torch.nn.functional as F import torch.nn as nn from torch import optim import datetime class GATC...
b31778cbbc03ab683f63ba2bb99a3cb0b015c85922cbe401522a2376a17b0d42
Python
8,430
203
""" Defines model classes to compute and store nearest neighbor sets that can be inherited across different `Embedding` objects. """ import numpy as np from sklearn.neighbors import NearestNeighbors from .utils import * class Neighbors: """ An object representing a serializable set of nearest neighbors within...
157408e3e2247422ad85d97f85201bfec849e38d75894de657393727fe3511f4
Python
8,432
222
# Description: This script is used to test the influence of sample size on the classification performance of the three harmonization methods. # The script is comparable to ABCD_ROCAUC_Comparison_controlled.py, but additionally iterates over different sample sizes and subsequently plots the results in a bubble plot. # T...
9880c26441a84a2daa96d69caf1829148951e7e5dad7c247b4230dadd54f0967
Python
8,442
224
""" Trace: read trace summaries (.tr/.MN) or LD scores (.ldscore.gz) and compute blockwise traces for FLEX. Reference: https://github.com/sriramlab/SUMRHE/blob/main/src/trace.py """ import numpy as np import pandas as pd from os import listdir, path def _calc_trace_from_ld(ldsum, n, m1, m2): """ Calculate t...
95e14345c8caeeb28955fa8cf95de8e49184886ae2cfc6b066b8ac89af6a47a1
Python
8,443
204
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
40b1ed188d4023858868254f3431103ccad71fc0fdd50721a9a7192dce62b006
Python
8,445
258
""" :AUTHORS: Martin M. Müller :ORGANIZATION: Department of Neurobiology, Bielefeld University :CONTACT: martin.mueller@uni-bielefeld.de :SINCE: Tue Nov 23 12:23:57 2021 """ import numpy as np from scipy.stats import vonmises import scipy.integrate as integrate from scipy.stats import norm from scipy.stats import gamma...
730116b4aa56bb1fc296b3e62420c9ac93eac4f9de97096507e091acaf2e6808
Python
8,447
161
"""Concise permanent logs and disposable stage records preserve the output data.""" import json from pathlib import Path import subprocess import sys import tempfile import unittest from unittest.mock import patch import SimpleITK as sitk import trimesh from inference.native import main as native_main from preprocess...
c926e74a2ef8c33e1ad0f661e189302e6ca69435f57a9769533ab33141add03d
Python
8,448
236
""" Examining the variation explained of gene expression for sex-specific expression differences by: 1. All DEGs 2. Allosomes only 3. Autosomes only Also examine correlation for all DEGs accumentively. """ import numpy as np import pandas as pd from pyhere import here import errno, os, argparse from functools i...
834384cefb5c3fe85ec4f4d37b8e07733c972616597b44eb58463ee650a4d396
Python
8,450
204
# Copyright (c) MONAI Consortium # 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, so...
9ce3ea2056d7f5958a97c6843c7ce166f2500d7c750388ab4cc1291408aa0bbc
Python
8,450
254
import os import cv2 import torch import random import numpy as np from glob import glob from torch.utils.data import Dataset import h5py from scipy.ndimage.interpolation import zoom from torchvision import transforms import itertools from scipy import ndimage from torch.utils.data.sampler import Sampler import augment...
3f66a24a9a05d33751ed7d94fd0c9963d3e08f3db3bbd52722126dc6258333f2
Python
8,454
206
# -- coding: utf-8 -- # @Time : 2022/10/15 16:11 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : heco_config.py import time from yacs.config import CfgNode as CN # -------------------------------------------------------------- # Config of model # ------------------------------------------------------...
b09ca596162f97b0477ef6fa4a2c65dd365bf566bd1b25f0db0d5b2c4006e19c
Python
8,459
197
import csv import numpy as np import os import pandas as pd from tqdm import tqdm from mimic3benchmark.util import dataframe_from_csv def read_patients_table(mimic3_path): pats = dataframe_from_csv(os.path.join(mimic3_path, 'PATIENTS.csv')) pats = pats[['SUBJECT_ID', 'GENDER', 'DOB', 'DOD']] pats.DOB = p...
e7b71114d36a00a944456e4397f2671e5b805e79771457d053d0171ee26817d6
Python
8,460
199
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models import * def seed_everything(seed): ra...
1078c5cf7e12c335aae46cb54367ea66b6c68e007b9e68b9db8bd78d1698916f
Python
8,462
198
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models import * def seed_everything(seed): ra...
e60de31d953983abaa613d7373a54e3f15d95cbaa9c7817fe7aa7dc19166056e
Python
8,463
182
import numpy as np import networkx as nx import torch as pt import pytorch_lightning as ptl import torch_geometric as ptg import torch from torch.nn import Sequential as Seq, Linear, ReLU from torch_geometric.nn import MessagePassing from pytorch_lightning import LightningModule from torch.optim.adam import Adam from t...
143f006226705cdfd0aa42f63c58a2ed85a92b031c8cd5779c7752722e168cf6
Python
8,464
241
import numpy as np try: import openmm from openmm import unit except ImportError: # OpenMM < 7.6 from simtk import unit from simtk import openmm import os, os.path import logging from nose.tools import assert_raises from openmmtools import testsystems from functools import partial def _equiv_topol...
0247a26d9520a31ee98358307e39d5b24853994f733efafcedfdf077413218d4
Python
8,466
248
"""Caduceus config for Hugging Face. """ from typing import Optional, Union from dataclasses import dataclass from transformers import PretrainedConfig from mamba_ssm.models.config_mamba import MambaConfig @dataclass class ExtendedMambaConfig(MambaConfig): interact: str = "" use_bio_mask: bool = False ...
8918808a6ccc4f003e556431f2a26fa8bc7df3772a30d8ef3e1332d78f7462c9
Python
8,467
199
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models import * def seed_everything(seed): ra...
5554cc98651a961f892845d8542d880bce330bb0ca935d09eec9ad9b8a128c55
Python
8,468
197
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models import * def seed_everything(seed): ra...
c1a6daf23aaf3b01de5caadeac90cc6c36111b62c009f08d9debb5534182e983
Python
8,478
250
# MIT License # # Copyright (c) 2022 Matthieu Kirchmeyer & Yuan Yin from torchvision.utils import make_grid from torch.utils.data import DataLoader from torch.utils.data.sampler import Sampler from torch.nn import init import copy import random from torch import nn import torch import torch.nn.functional as F from log...
7cb0c91dd670d185cdf1d665699eac320438831f82f5e7bbe41d32ceb93a5776
Python
8,480
258
"""Schema definitions for representing agent actions, observations, and return values. !!! warning The schema definitions are provided for backwards compatibility. !!! warning New agents should be built using the [`langchain` library](https://pypi.org/project/langchain/), which provides a simpler an...
f5d202bf5a4057db3dbe46275d1668bb211ecb4bd2a47949d5bd3a75fd752ac3
Python
8,482
260
import logging import os import socket import sys import matplotlib import matplotlib.pyplot as plt from matplotlib.transforms import Affine2D import numpy as np import pandas as pd import seaborn as sns from configs.configs import get_config_dict def plot_quantitative_results( config_dict: dict, performanc...
8c8e8c97fa89d1ce17b507694d923926886a1c654c5ceb0b3e8bc8e139fe3540
Python
8,487
200
#!/usr/bin/env python3 import os import torch import hydra import logging from models import get_model from torch_geometric.loader import DataLoader from ori_dataset import Mixed_MD17_DFT, get_mask from torch_ema import ExponentialMovingAverage from transformers import get_polynomial_decay_schedule_with_warmup logger =...
f198e44a4b07247e86252d1e1c60524c9a1321d2eba7246dd146b3788fc89235
Python
8,488
241
def extract_local_csf_mask( csf_mask_path, binary_roi_path, dilated_roi_path, csf_threshold=0.6, save_path=None, verbose=True ): ''' Extracts a local CSF mask by identifying CSF voxels that lie within a dilated ROI but outside the original binary ROI. Saves the result as a binary...
3bba2a45edd577157854eb27f913391623441956d37d6cce703c80c2b51f95c7
Python
8,489
209
"""Tool error middleware for agents.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, cast from langchain_core.messages import ToolMessage from langgraph.errors import GraphBubbleUp from langchain.agents.middleware.types import ( AgentMiddleware, AgentState, ContextT, Res...
64cb9bd701cb7079f3f5393d3eeecb8e4f4abd784d9e62e7d866cdc7b2574084
Python
8,491
212
# 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. from __future__ import absolute_import, division, print_function import os import pandas as pd import re from pymatgen.core import Structure from .conformer impor...
6f34abfb4408773aa75aad9854e37a73014ff44cf5547dd2cd92aa72bf68c50a
Python
8,495
212
import os import numpy as np import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.applications import ResNet50 from tensorflow.keras.layers import BatchNormalization, Conv2D, Conv3D, \ Dense, Input from explainability.model.utils import fuse_batchnorm ...
048349989f193e9daf0922ead57ca66b6914290359a60742b1e993a3d3164a43
Python
8,496
221
import torch from torch_geometric.loader import DataLoader import os import pickle from sklearn.model_selection import KFold import numpy as np import random from torch_geometric.nn import global_mean_pool, GATConv import torch.nn.functional as F import torch.nn as nn from torch import optim import datetime # 定义图神经网络模...
3431c3b01dd0d2f15c20bacd5df17b4bbd373b3aa1d56cc7f89a92abacca5ada
Python
8,498
248
#!/usr/bin/env python3 """CUDA-synced inference timing for an SCDP (ChgLightningModule) checkpoint. Mirrors scdp/scripts/bench_flow_infer.py but uses direct coeff regression. """ from __future__ import annotations import argparse import json from pathlib import Path import time import numpy as np import omegaconf i...
d848634cde63d811dc6f6611300d21096e1c1295be258331889aadc4d45b2912
Python
8,498
233
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...
8cf18bd8c78bb86ce9ad2bca0ab5316cd783af2b9207b4f503033ab4c1aaa0af
Python
8,499
235
import numpy as np import torch as T from nflows.distributions.base import Distribution DATALOADER_args = {"pin_memory": True, "num_workers": 4, "prefetch_factor": 12, "persistent_workers":True } class Iterator: def __init__(self) -> No...
e9bf631470ce5ff51402e80e004763af9cc40bdf1786591453aa3f0d6b27c29e
Python
8,499
183
import os import argparse import numpy as np import matplotlib.pyplot as plt FONT_AXIS_TITLE = 14.5 FONT_LEGEND = 14.5 def plot_regions_per_group(data, regions, group, x_pos, vp, ID): Nsamples = len(group) dx = 0.1 x0 = Nsamples*0.1 / 2. g = [] fig, ax = plt.subplots(figsize=(9,5)) my_cmap ...
726e970bc02e07cbeb33a8f031fc617f02adf59334186f987ccce99d49317b9a
Python
8,502
222
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Adapted from https://github.com/florentmeyniel/TransitionProbModel """ import itertools from operator import mul from functools import reduce from scipy.stats import dirichlet import numpy as np def get_clipped_grid_indices(Dir_grid, p1_min=None, p1_max=None): if...
b8e0708132a22efe40a49826ab22788c300ec1c168b1ee45a0749e3613a6c765
Python
8,506
280
import os import sys import re import types import itertools import math import numpy from RnaseqReport import * class MappingStatus(Status): '''status information for mapping stage.''' @property def tracks(self): d = self.get("SELECT DISTINCT track FROM view_mapping") return tuple([x[0...
b99685914683bea66ba657c78ab6c5b14774fbb0f9ef287c2b542198315b8629
Python
8,508
289
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # 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 # # U...
28687e818c3de38cd637e7a426da85d1142789715dd11e2cca0502c8f81ee98a
Python
8,514
383
#!/usr/bin/env python # coding: utf-8 # In[1]: import pickle import os import yaml from sklearn.impute import SimpleImputer import numpy as np import math import pandas as pd import matplotlib.pyplot as plt import seaborn as sns np.random.seed(100) get_ipython().run_line_magic('matplotlib', 'inline') # %config Inli...
758cea62a6961b69efe71a00453f07f10f3bac614a8c5422b3fbbb313b7629ca
Python
8,521
178
import argparse import random import time import numpy as np from . import logger import torch import os class RunManager(object): def __init__(self): self.parser = argparse.ArgumentParser() self.parser.add_argument("--workers", type=int, help="number of data loading workers", default=0) ...
6cd844e7c83d9ffe940b67b2f9ce7bcb096aea0cf2b21269474c99b78816a2a5
Python
8,527
193
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
0e8e3fd7a0fb17f0d853cb4b2b9564c2d506284167798568b4b336edc1172305
Python
8,533
176
import argparse from models import twostage_Unet from tensorflow.keras import optimizers import glob import numpy as np from utils.utils import prctile_norm from utils.loss import read_mrc import tifffile as tiff import os import tensorflow as tf import math os.environ["TF_ENABLE_AUTO_MIXED_PRECISION"] = '1' os.enviro...
cd31325f0b0e5b56981a940f446e05d801c13a20fb119c9f91152f39fff6990c
Python
8,533
177
import os from time import time from copy import deepcopy import gc import numpy as np import matplotlib.pyplot as plt import pandas as pd import matplotlib.gridspec as gridspec from natsort import natsorted from utils.read_mda import readmda N_CH = 24 F_SAMPLE = 30000 # MAP_PATH="../geom_channel_maps/map_corolla24c...
1c3111642e67fbe759d7462b47e0b9b098d662296df945cf0df5de3d1f4443b0
Python
8,534
244
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import numpy.ma import Stats import Histogram import cpgReport from cgatReport.Tracker import * from cgatReport.odict import OrderedDict as odict ##################################################################...
b3c3df0c4261028a0e361f7706bcbc945d4e5f163bba0e32bc4d7460a22f03a9
Python
8,534
179
#pylint: disable=E1101, E0401, E1102, W0621, W0221 import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import random import time from random import SystemRandom import models import utils parser = argparse.ArgumentParser() parser.add_argument('--niters', type=int, default...
d13903b57c1e619aec21131196783d75fb95470dc03bd0d7c45eb22f7afffdc4
Python
8,536
259
"""Question answering with sources over documents.""" from __future__ import annotations import inspect import re from abc import ABC, abstractmethod from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForCha...
23bd878bcfe153c82e7dd05011bc4508c41fe1c9af94e96bc21e4ee665363689
Python
8,540
212
# -*- coding: utf-8 -*- """ Class definition of YOLO_v3 style detection model on image and video """ import colorsys import os from timeit import default_timer as timer import numpy as np from keras import backend as K from keras.models import load_model from keras.layers import Input from PIL import Image, ImageFont...
2070786c9666a9aaf61ccd77167f8dd7519bc3b31d32b76ed9332f605a2a10ef
Python
8,542
289
""" This module provides implementations for corrupting the training data. :Implemented: - Identity - Sampling Binary - BinaryNoise - Additive Gauss Noise - Multiplicative Gauss Noise - Dropout - Random Permutation - KeepKWinner - KWinnerTake...
c53bb5d5e122b156c5f3849342f431265ba25ec057165da9d13645cd694ecddc
Python
8,543
227
########################################################################################### # Adapted from MACE ########################################################################################### import opt_einsum_fx import torch import torch.fx from e3nn import o3 from e3nn.util.codegen import CodeGenMixin fr...
66eb3b69434897539d0069e394418b9dac9ea9ad4a1b1ae411a4fb487ef6eb76
Python
8,545
171
# srun --nodes=1 --ntasks=1 --cpus-per-task=24 --mem=80g --time=04:00:00 --pty bash -i # Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/code/; python import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import csv i...
c3d2ce4b081d83881f5fe304e4892dddb2bd8b84e9632b0a48bd35c682df38aa
Python
8,546
266
"""A PyTorch Dataset class for annotated spectra.""" from typing import Optional, Tuple import depthcharge import numpy as np import spectrum_utils.spectrum as sus import torch from torch.utils.data import Dataset class SpectrumDataset(Dataset): """ Parse and retrieve collections of MS/MS spectra. Param...
33c38c788078a0e37ef872129445e9fc5e757f8939b6b8fb3b92f32de51fb718
Python
8,548
280
import datetime as dt import warnings from collections.abc import Sequence from typing import Any, Literal from langchain_core.utils import check_package_version from typing_extensions import TypedDict try: check_package_version("lark", gte_version="1.1.5") from lark import Lark, Transformer, v_args _HAS...
1bd078082251d6176b565153fa462b457063485d92367b33de0da1b15fa47457
Python
8,549
253
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys if '../../../embeddings' not in sys.path: sys.path.append('../../../embeddings') from seq2tensor import s2t import keras from keras.models import Sequential, Model from keras.layers import Den...
d5ccae607a04c40403ef099987894edf13c2a4a538a17592a45b7e833fa092ec
Python
8,559
248
''' Author: Alexandra Fischbach Github repo: https://github.com/AlexFischbach/local_csf_pipeline/tree/main Date: 04-18-2025 Contact: fischbach.a@northeastern.edu ''' def extract_local_csf_mask( csf_mask_path, threshold_roi_path, dilated_roi_path, csf_threshold=0.8, save_path=None, verbose=Tr...
9e0dab920d0073822a8a09a9dac305c398947b6c8fdf33dc631160d12a417dec
Python
8,560
192
import numpy as numx from scipy.signal import convolve2d import pydeep.base.numpyextension as numxExt from pydeep.base.activationfunction import Sigmoid from sklearn.linear_model import LogisticRegression class Unit_layer_binary_1D(object): def __init__(self, input_weight_layer, ...
237b88c57e33c5f8f98ff05b270dc93a0fb1cbcd07a160f23b84883ef86caa41
Python
8,562
200
# *========================================================================= # * # * Copyright Erasmus MC Rotterdam and contributors # * # * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3; # * you may not use this file except in compliance with the License. # * # * Unless required by applicable law or agre...
3f8cd76769acef7e7607104772a966091ea450fdf38401f8f684f3bd674f255e
Python
8,569
197
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset """ In this file is presented the management of the N-Cars dataset. The dataset is presented by a tree of directories: -train : train part of dataset + cars : contains al...
68594678b5cc78660a1c36bbbf1c16c6e7d899e75c3c33f4b9b25bf36f704972
Python
8,586
251
import sys import cv2 import numpy as np from affine import Affine from numba import jit import json import datetime import platform import os import base64 class Field: """Standardized field names for embeddings and projections. These data can all be versioned within a ColumnarData object.""" POSITION ...
38d2cd8912010f87005f8cdd5474aa7248a5eae959f4b492fffc7e4247025961
Python
8,588
255
# -*- coding: utf-8 -*- """ Created on Wed May 5 20:08:52 2021 @author: Xingyan Liu """ import came from came import pipeline, pp, pl import logging import os import sys from pathlib import Path import numpy as np import pandas as pd from matplotlib import pyplot as plt # optional import seaborn as sns # optional...
83a96b7cea3e75f18d24bddbaace4c845a7bff2323d435647a77226e58c5b939
Python
8,588
189
import torch import torch.nn as nn import logging from .gpt_model import Block logger = logging.getLogger(__name__) class Bert(nn.Module): """ the full GPT language model, with a context size of block_size """ def __init__(self, config): super().__init__() self.beta_params = (3, 9) ...
d0b19a4cd889a279a32f7071d36d7ed1234ad09793478b75e0958ff948b91d3b
Python
8,607
188
import torch from torch.distributions.distribution import Distribution from torch.distributions import Categorical from torch.distributions import constraints # Taken from https://github.com/pytorch/pytorch/blob/master/torch/distributions/mixture_same_family.py class MixtureSameFamily(Distribution): r""" The...
b7ae90e1058500d4dbe748336d5c17fd0b6c4d214fec61ded46ff19bb91f9df8
Python
8,609
180
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to...
867e18d53c894a91215c7d9a51458dc51b3e9e87a1fa42f8aeb21c29228c7344
Python
8,623
220
from __future__ import annotations import re import networkx as nx import pandas as pd from skbase.utils.dependencies import _safe_import from pgmpy.base import DAG from pgmpy.causal_discovery._base import BaseCausalDiscovery litellm = _safe_import("litellm") class LLMPairwise(BaseCausalDiscovery): """ LL...
a4ac09ff96324e0dd78feeadce32bbda4cab5608437edfeca59c4b66abf6d3a0
Python
8,623
221
import scanpy as sc import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.decomposition import PCA from pyslingshot import Slingshot import palantir ##################################################### Utils ##################################################### def get_iroot(adata, idx_...
61c5dc4ad377c43b2235b0db22c59c3387a5a1dd1ba5c8d9ff74396ac3071ce1
Python
8,626
264
# coding: utf-8 """ MIT License """ ''' Project: Parenchymal Attention Network Authors: Axel Masquelin --------------------------------------- Functions related to pytorch dataloader and generating dataframe for dataloader. Includes inference dataloader (InferLoader), Nrrd dataloader (NrrdLoader) an...
577e250e439570bfba10aab1593c15e74397a58701c83bc1638c9c553185e7a8
Python
8,629
176
import os from copy import deepcopy from collections import OrderedDict from itertools import groupby import warnings import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.font_manager from matplotlib.cm import get_cmap import scipy.stats as stats print("- matplotlib version:", matpl...
b6d3cbeb6b18dd397723584e6dd260db614686235612df671bd4955bea9d142f
Python
8,632
192
# -*- coding: utf-8 -*- """ Created on Wed Aug 26 12:07:50 2020 @author: nishe """ import numpy as np from cfc_analysis.bandpassSig import bandpassSig from cfc_analysis.find_Hilbert import find_Hilbert from cfc_analysis.find_MI_cfc import find_MI_cfc #%% class cfc(object): def __init__(self): """...
e652aba22168cadffd9f65605cb74887c06328ab1473a15c2b5f86eb1b0ddc0a
Python
8,632
211
# Visualization of DNN features (PCs) using activation maximization # Copyright (c) 2021 Laurent Caplette import torch import torchvision from torch import nn from robustness.model_utils import make_and_restore_model from robustness.datasets import RestrictedImageNet, ImageNet import numpy as np from kornia.augmentati...
637116dce7a34a4d6284fd11e277198bae1024277f396bc849abb9c741bb5187
Python
8,633
186
#!/usr/bin/env python # Author: Francois Aguet ## Edited by Kynon J Benjamin (05/05/2021) import gzip, os import subprocess import rnaseqnorm import numpy as np import pandas as pd import argparse, feather import scipy.stats as stats def prepare_bed(df, bed_template_df, chr_subset=None): bed_df = pd.merge(bed_te...
6b47874f767984a3fe8a1e72713801eb3f9613b9b6782dd802cb29e121205d16
Python
8,633
201
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import Data from models import * def seed_everything(seed): ra...
22224ac5e4862d0c87399dc35d8bfe4ca0a0d8f8c1aabd5fa1e708053e3f7cb7
Python
8,647
203
import argparse import logging import os import random import shutil import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tensorboardX import SummaryWriter from torch.nn import B...
a439d546f00f7fdf2826f9d919d127e3753c37001bb06be262168d4374e3aaca
Python
8,651
260
from abc import ABC, abstractmethod from typing import Any, Dict, Tuple import gymnasium as gym import numpy as np import torch from bindsnet.datasets.preprocess import binary_image, crop, gray_scale, subsample from bindsnet.encoding import Encoder, NullEncoder class Environment(ABC): # language=rst """ ...
c83118448cff41793c429ac566498033b2fd15da3e77766954e33b0cfbed435d
Python
8,654
239
""" ############################################################################## # # Generate final MAPP report in html with jinja2 templating mechanism. # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATE...
959fca1da0272f7ceadaacb93c6cb76da64986548756efcb2ebbf578774d0cdb
Python
8,661
269
import os import sys import mmap import time import numba import pickle import argparse import numpy as np import multiprocessing from skimage.morphology import remove_small_objects, remove_small_holes, ball import adv me = "cell_detection.py" def stamp(s): if Verbose: sys.stderr.write("%s: %d: %s\n" % (...
3877b00a1fac9b99abe3c7f4c7888b66fb3db58d4f362be6fe890f6b77b45263
Python
8,675
245
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...
fef27de5bff92021ca864b606e1a37bdb7cae1269c10b8dc247db9550e801662
Python
8,675
246
# Jared Sagendorf """A simple set of methods and classes for dealing with and performing basic operations on triangular meshes.""" # builtin modules import os # third party modules import numpy as np try: import igl except BaseException as E: from ..exceptions import ExceptionModule igl = ExceptionModule...
e83902e0945d31cac5736d4a4d5308a8a7b1047de40e6d955e242c0f1edac1e5
Python
8,684
209
import sys,os,gc sys.path.insert(1, os.path.join(sys.path[0], '../../../')) import numpy as np import pickle from Simulator.SimulatorPattern import simulatorPattern from FiguresFunctions.FiguresPattern import * import matplotlib.pyplot as plt import argparse import itertools from datetime import datetime parser = argp...
1bd9d1b0be98e2c248853164ed609fa08a331bdb0e49ebc6b336e7451dd112e1
Python
8,688
246
# -*- coding: utf-8 -*- # author: Felix Repp felix.repp@mpikg.mpg.de # !/usr/bin/env python import networkx as nx import scipy.optimize as op import numpy as np import tinanet import matplotlib.pyplot as plt import pdb from scipy.ndimage import morphology as morph """@package tinana %This module provides the tools to ...
ba66326a70ddef36593c16b074bfa69a51726d4c8459debb3a651853cc6d6bcd
Python
8,690
240
#!/usr/bin/env python """ scanner.py - Assemble a "feature scanner" using Aho-Corasick string matching. This takes a list of features (byte sequences) and builds a DFA that when run on a byte stream can identify how often each of the features is present in a single pass over the stream. Marco Lui, January 2...
e9fe6c4f8f8368e346f3d9b37a3131b29db0cc29b23ac284c8f8571545be9b37
Python
8,691
268
# builtin modules import os.path as osp import hashlib from pickle import dump, load # third party modules import numpy as np import torch from torch_geometric.data import Data, InMemoryDataset from sklearn.preprocessing import StandardScaler # pnabind modules from pnabind.nn.utils import balancedClassIndices class ...
c6b857fde78c44563172c873588ad36b5e8d7f89fba0e330c0e9a8a56d547d6b
Python
8,693
215
import itertools import numpy as np from functions.series import cython_upper_bessel, cython_upper_bessel_k, cython_gsl_sf_gamma, cython_gsl_sf_gamma_inc from joblib import delayed, Parallel NUM_CPUS = 32 def zeta_cal(v, w, vecs, vecs_inv, d, det, p=1.0, eps=1e-12): result = sum( np.e ** (2 * np.pi * 1...
4281de7be635e13d77c146a02d025d9941ca7f615b0ca4479e42ee95b0bf68b1
Python
8,701
165
import numpy as np import pandas as pd from sklearn.cluster import KMeans import random import seaborn as sns import torch import matplotlib.pyplot as plt import h5py from sklearn.preprocessing import MinMaxScaler, StandardScaler import shap import sys from modal_type_list import * import argparse def get_shap_gene(...
b5172c0f30942144a3964cb3996efbbf6295d76d71a9f3192c21d623f740ca7f
Python
8,702
268
import sys import torch import torch.nn as nn import math from typing import Optional, Tuple from copy import deepcopy from h3xsemble.model.primitives import Linear, ipa_point_weights_init_ from h3xsemble.utils.residue_constants import ( restype_rigid_group_default_frame, restype_atom14_to_rigid_group, rest...
9cf365f2ce989c49b71bf1f53c24b2cc0f79f74b09efec7626215b10ca53c8cc
Python
8,703
240
from __future__ import print_function import tensorflow as tf from nn import linearND, linear from mol_graph_direct_useScores import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph from models import * import math, sys, random from optparse import OptionParser import threading from multiprocessing import Que...
0fd0364a958fc42ec3f7f5cafc3cb4475f4b686135f6a9a4ae8cd0e66300ce3d
Python
8,708
226
import uncertainpy as un import numpy as np import matplotlib.pyplot as plt from prettyplot import * import os import h5py from scipy.stats import zscore def compute_first_AP(t,variable,interval): index_left = np.where(t >= interval[0])[0][0] index_right = np.where(t >= interval[1])[0][0] local_time = t[...
f8fbd1299704f6ecd57fa41652ffa033aa98089b595cb539018a24513ac85e91
Python
8,709
197
''' *************************************************************** Author: LU Date: Nov 2020 Description: CNN architecture used for thalamic nuclei segmentation in MPRAGE images. *************************************************************** ''' # import files import sys, os import tensorflow as tf from keras...
6c6455825364a5cf95be225832614f13f08b28f62b2932ac22127eed008b0a1b
Python
8,711
195
import logging import os import socket import sys import numpy as np import pandas as pd from configs.configs import get_config_dict from helpers.data import load_data from helpers.evaluation import get_corr_matrices_tril_spearman_correlation from helpers.evaluation import get_cov_matrices_rmse, get_corr_matrices_rms...
94971d82b43b1722a2e081652e66da6659de9fb2172e341d2f8a71cdd7cd4330
Python
8,711
228
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
9e69182b8b64bd5e1083e0fec60d49cfce7601d761a23031e57c0d1498c0a941
Python
8,711
169
"""Conformal prediction intervals for SOH regression. Implements split conformal (absolute-residual score, optionally scaled by a dispersion estimate) -> marginal coverage Mondrian conformal (per-group quantile, e.g. by chemistry or dataset) -> group-conditional coverage weighted conforma...
b1282855a4cfcf70960e9a59b281da59e19e70af4efc7d6f22e8763985038876
Python
8,715
540
bohr2ang = 0.529177 # Divisor for (probe - atom) vectors before GTO radial eval (same convention as QM9). GTO_VEC_LENGTH_SCALE_TO_AU = bohr2ang # GTO locality mask uses raw stored coords (before / bohr2ang). QM9 stores Å → 5.0 ≈ 5 Å. ORB_CUTOFF_ANGSTROM = 5.0 # Bohr-stored MD LMDB: same physical sphere as ORB_CUTOFF...
c470936f14d867dec2ff304646ab8084de8b9a7b8ee70d67c76c90609ecc3124
Python
8,715
218
from copy import deepcopy from pathlib import Path from typing import List, Union import numpy as np from omegaconf import DictConfig, ListConfig from libs.dataset.barsignal import BarSignal from libs.dataset.spotsignal import SpotSignal from libs.function.cluster import ts_cluster_lib from libs.function.function imp...
e8720fc61a9fe7efd8a4f5ded811384b4f29acd72cb197e8352d19d99ac18169
Python
8,716
247
# Copyright (c) MONAI Consortium # 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, so...
365206c9d266f88cf65a8add3249acad175fd4f76cefa21a0a13310313e6f27e
Python
8,717
277
import math import numpy as np import h5py import torch from torch import nn from torch import Tensor import torch.optim as optim import torch.utils.data as Data import torch.nn.functional as F from sklearn import metrics from sklearn import manifold from sklearn.cluster import KMeans from sklearn.metrics import davies...
d378d8201326a5c1f6326f2a797db1ec1c3f88e916dcb2ea3615f30f454f34bf
Python
8,717
154
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 12 12:42:09 2020 @author: shni2598 """ import numpy as np #import brian2.numpy_ as np #import matplotlib.pyplot as plt import connection as cn import warnings from scipy import sparse #from brian2.only import * #import time #import mydata #import f...
6aa0ca4d152f45b8bfddd0b3e59f48fb0c5b43f65c8640c7109d036c93c0d9d4
Python
8,718
187
import numpy as np import pandas as pd import pytest from sklearn.utils.estimator_checks import parametrize_with_checks from pgmpy.base import ADMG from pgmpy.causal_discovery import ANM, PC, BootstrapEstimator, HillClimbSearch from pgmpy.causal_discovery._base import BaseCausalDiscovery @parametrize_with_checks( ...