sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
9f7ec370dcee3501cf0f549f852dcf65222c4fe6c66424866c07e4ae404eb6be
Python
4,994
125
# source:https://github.com/zhuogege1943/dgc/blob/439fde259c/layers.py # arxiv:https://arxiv.org/abs/2007.04242 import torch import torch.nn as nn import torch.nn.functional as F class DynamicMultiHeadConv(nn.Module): global_progress = 0.0 def __init__(self, in_channels, out_channels, kernel_size, stride=1, ...
e4de91f7598a63ed350f7cc6677dfe92fff3fa24b4d80245ceabaa01819c199f
Python
4,996
123
"""Featurize the GFN-FF-relaxed polymorphs with the OCE Wave-1.5 basis. Reuses the validated builders: data/build_features.py -> 1F, 2F, 3F, MAD, CT2F (features.npz) data/perovskites/build_wave15 -> CT2F_A, MADCT2F, CT3F (features_wave15.npz) MADCT2F uses the formal charges (A=+2, B=+4, O=-2) carried in ...
4ce4c5d087a60db2ad9722514dba5f0edb82f6370e00ffbf9095db53099b8b5e
Python
4,998
169
# -*- coding: utf-8 -*- import nibabel import os import sys from glob import glob from .utils import add_suffix, run_shell, run_matlab, TPL_PATH class Realign(object): def __init__(self, petPath, dataset, ignore): self.dataset = dataset self.ignore = ignore self.petPath = petPath ...
5bb991874caf8859d9615b26099376dd3a262df534e9f51c2473e67fcf204fef
Python
4,998
198
"""Culture-collection accession shape, gating what a StrainInfo match may join. `fix_missing_strains.py` is the only caller. `apiadapters.straininfo. StrainInfoAdapterBase.retrieve_strain_models` joins a record StrainInfo returns to whichever BRENDA strain shares its *first* matching designation, with no organism cons...
d91a9b7e399cab75a84b1418928a3f1391c5300f5125e4935580ab094a85345f
Python
4,998
93
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI\AnimalWindow.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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 QtCo...
147b7d24703ea6b65cacdf428be95890f02532415348b4c1fdaa715516cda71e
Python
5,000
128
import os import importlib import numpy as np import matplotlib.pyplot as plt from sklearn.manifold import TSNE import torch import torchvision from torchvision import datasets, transforms from torch import nn, optim from torch.utils.data import DataLoader from torchvision.utils import save_image, make_grid from tqdm i...
90b02d258ebf4ff03c238cbeacf46aa03e00820171ab741628aae82726e3faa9
Python
5,000
153
""" Utility functions for neurotransmitter analysis Author: Yuan Zhang Date: 2025-07-25 This module provides helper functions for: - Generating surrogate brain maps using spatial null models (Burt2020 or Moran). - Computing adjusted R² values for linear regression models. - Performing spin-tests (permutation-bas...
2f4618047878a2b67348d0167af34953ff59461825cbb21f2a8d3ac675ab4347
Python
5,002
146
import numpy as np # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
3b312224ba7ad252178f481c40125a771ff7302ebfb30286196fbd40c6fb4aca
Python
5,002
163
# scSGL - a python package for fene regulatory network inference using graph signal processing based # signed graph learning # Copyright (C) 2021 Abdullah Karaaslanli <evdilak@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pu...
44668721616f969ce0f1adb77322181b2adcf77cf962cb5f111f82bd5ec6d523
Python
5,002
145
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib from typing import Optional import torch from fairseq.dataclass.configs import DistributedTrainingConfig from fairseq.distr...
7dd3e32276336a6479f639edf6adf53f1ba9c3cd65fe6552cdee41d93cba289f
Python
5,002
136
import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader, Subset from pipelines.dataloader import JacquardDataset from modules.vgg16_baseline_even_longer import VGG16Baseline from grasping_pvgg16_feedback_conn_4_2PC_even_longer_bb import PVGG16SeparateHP as PVGG16 import toml fro...
5a4ba8245a6dc3769a2e31fa20ba5910233ad0b389478319608cbbf0491117be
Python
5,004
147
#!/usr/bin/env python import gzip import os import io import string import numpy import pandas from sqlalchemy import create_engine #for reproducibility numpy.random.seed(100) sample_size = 100 def to_line(x): return "{}\n".format("\t".join([str(_x) for _x in x])) def variant_name(chrom, pos, a, b): return...
e7ad5dded041d726ecb799c78c0d134b14e248865a64abc5f2c0ce9d263858e1
Python
5,005
125
import numpy as np import os from argparse import Namespace from typing import Optional import tqdm from abc import ABC, abstractmethod class BaseMSIToNumpy(ABC): def __init__(self, min_mz: Optional[float] = None, max_mz: Optional[float] = None, bins_per_mz: int = 1, mz_...
fd86aa12177520add66991614708eb0fff6b9965ea32406abf7c6134e48d3e75
Python
5,009
124
from neuron import h import numpy as np ## define the CA1 cell class CA1(object): def __init__(self): h('xopen("simulator/model/CA1.hoc")') propsCA1(self) # self._geom() self._topol() self._biophys() def _topol(self): self.soma = h.soma self.hill = h.hi...
46e24866049f7a4be136a1b0fc14b8a70adc00201cee6c8d22026fe89093c51f
Python
5,010
152
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import logging import os import numpy as np from fairseq import tokenizer, utils from fairseq.data import ConcatDataset, Dic...
06ebbad9e2582698c187ab6c7d36cf09be197f70a7bdbf130927cf1b56aaa554
Python
5,013
139
import os import torch import numpy as np import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns from torch_geometric.loader import DataLoader from sklearn.metrics import mean_absolute_error, mean_squared_error from scipy.stats import pearsonr from tqdm impor...
ad6d651ab8e7a05457d42e03e62016510a91eabd2c7d41af7c8426aa92cf7ec0
Python
5,014
128
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from argparse import Namespace from typing import Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.fu...
9074aac0e2b908a001d1526b9eb2de168afb1eada5778578169f3e65cb948777
Python
5,015
136
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq import utils from fairseq.models import ( FairseqLanguageModel, register_model, register_model_architecture, ) from f...
515d2dbc215645ac16684211fc5dde03e3d9843c2e6ab069056eafaf9d7de204
Python
5,017
133
"""Command-line interface to create an initial Python sections file Usage: goatools wr_sections [GO_FILE] goatools wr_sections [GO_FILE] [options] Options: -h --help show this help message and exit -i <file.txt>, --ifile=<sections_in.txt> Read or Write file name [default: sec...
4d13693afa6b81ee45e3a69232ae355b06e22ca4ad095389ba5e64e3a3bdccf1
Python
5,018
160
from scipy.interpolate import griddata from scipy.signal import correlate import numpy as np from .spike_ISI import * def find_depth(template): """ Finds depth based on channel with maximum range. """ return np.argmax(np.max(template,0)-np.min(template,0)) def find_height(template): ...
96b4faa7c6ce2a180ba3b5014e2e2ced1b96e405553325244a9cb9d943533066
Python
5,019
130
from sfcn import SFCN from monai.networks.nets import ResNet, ResNetBottleneck import torch from fdataset import FetalBrainDataset from pathlib import Path import random import warnings import torch.nn as nn from math import sqrt from torch.nn import functional as F import numpy as np import os from torch.utils.data ...
aeeecb56efbf5d21c72e1b2dd92b69c045980b5b6ac30d4ec505038937d40430
Python
5,019
140
import base64 import random from pathlib import Path from ... import options as opts from ... import types from ...charts.chart import Chart from ...commons.utils import JsCode from ...exceptions import WordCloudMaskImageException from ...globals import ChartType SHAPES = ("cardioid", "diamond", "triangle-...
4a56fb62bd8806afeaf508f083d03d10ae55546edf98a6ed43a1b7f8d0bb7113
Python
5,020
175
import pickle as pkl import scipy.sparse import numpy as np import pandas as pd from scipy import sparse as sp import networkx as nx from collections import defaultdict from scipy.stats import uniform import tensorflow as tf from sklearn import preprocessing def masked_softmax_cross_entropy(preds, labels, mask): ...
4ff41b26e8897c0aa97c2b0ea3ff08b13a9b3857a878eb5107c21f9ec6c1478a
Python
5,021
141
#!/usr/bin/env python3 import argparse from pathlib import Path import polars as pl import pybedtools from scipy.stats import spearmanr, gaussian_kde import numpy as np def read_bed(path, extra_column=None): if extra_column is None: return pl.read_csv( path, separator="\t", has_hea...
88c899cb8fb360d5ee2cb4397f7c3fbd366a403c7ca6f2809b2282955a34c8a7
Python
5,022
136
import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader, Subset from pipelines.dataloader import JacquardDataset from modules.vgg16_baseline_even_longer import VGG16Baseline from grasping_pvgg16_feedback_conn_4_2PC_spec_targ_even_longer_bb import PVGG16SeparateHP as PVGG16 impor...
92cef0abd84c2fdc54d95f527d4c396098be8c68ab0f8b01bc37b7912ba97c82
Python
5,023
129
"""A layer-boundary cache hit must agree with a live forward under `train()`. `unfrozen_top_layers` makes the frozen bottom of the trunk a candidate for caching only if its output is a pure function of the input -- which needs its dropout off even while `Model.train()` is engaged, since that is the only mode the train...
3896448e12a661379b8000d9d6917ea9c0ca214f43a4c215cd304fb85875de32
Python
5,024
139
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass, field import torch import torch.nn.functional as F from fairseq import utils from fairseq.log...
9b77cfa96d36d4e53e322347d07b0f783cf1d44c60357d62741579cae9378d00
Python
5,024
148
from __future__ import annotations import re from typing import TYPE_CHECKING import pytest from poetry.repositories.pypi_repository import PyPiRepository if TYPE_CHECKING: import responses from cleo.testers.command_tester import CommandTester from poetry.poetry import Poetry from poetry.reposit...
07e1dd611dff030551ad5fbb24759713a179bfb45bfaeeff31114361183823d0
Python
5,026
146
from typing import Dict, Optional, Tuple import torch import torch.nn as nn import wandb from utils.data.dataholder import DataHolder class LossFunction(nn.Module): """TrainLoss class for computing and logging training metrics. Attributes: train_position_mse (MeanSquaredError): Mean squared error for...
2570c7356d08cf12e9d122a550c54dd1505c08e56e182aeade74e256f70ab3fb
Python
5,027
107
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the r...
7afd30aeca8ca7791bc13662e685d298e0e381cf80b1ed7e80584666fff879e9
Python
5,027
127
""" Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py To create the package for pypi. 1. Change the version in __init__.py, setup.py as well as docs/source/conf.py. 2. Commit these changes with the message: "Release: VERSION" 3. Add a tag in git to mark the release: "git...
f28e2c509181d7c4d9715d51ef3bee6e732404929476f42be1437a28a954df56
Python
5,028
160
# encoding: utf-8 """ @author: chenjiayang @contact: chenjiayang@163.com """ import sys import collections import random import torch import numpy as np if sys.version_info < (3, 3): Sequence = collections.Sequence Iterable = collections.Iterable else: Sequence = collections.abc.Sequence Iterable = ...
14fe0af51a9ddb1502482f4a2752b20105d4f4b549214da439ddc70ff5d7da4f
Python
5,031
143
import os import shutil import tempfile import unittest from fairseq import options from fairseq.dataclass.utils import convert_namespace_to_omegaconf from fairseq.data.data_utils import raise_if_valid_subsets_unintentionally_ignored from .utils import create_dummy_data, preprocess_lm_data, train_language_model def ...
1faae043741fc6392a99a5cfcd683cfd97f15a7b4ece892d497265b378236a10
Python
5,032
107
#!/usr/bin/env python3 """Quanta variância a SELEÇÃO de alpha injeta no número do artigo? Descoberto por acidente ao montar a curva de aprendizado: permutar as linhas do treino, sem mudar QUAIS estruturas o compõem, movia o RMSE de 0,1423 para 0,1589 — 11 %. A causa é que `ridge_alpha_and_fit` parte a CV interna por P...
c1caa6b54b3b5077b123a60dabb5205576be794df200b8e23156e408389a2c38
Python
5,034
136
import cv2 import numpy as np import torch import tqdm from pytorch_grad_cam.base_cam import BaseCAM class AblationLayer(torch.nn.Module): def __init__(self, layer, reshape_transform, indices): super(AblationLayer, self).__init__() self.layer = layer self.reshape_transform = reshape_trans...
fc75a1d4c78981059db94817c1726bd9cf416bb6db638ccb3494fc7c8c076b42
Python
5,037
111
# -*- coding: utf-8 -*- """ .. _tutorial04_ref: Tutorial 4: Layouts and Views ============================= This tutorial covers the layout and view options provided by ``surfplot``. For variety, let's import the left and right Conte69 midthickness surface directly using :func:`~brainspace.datasets.load_conte69`. Th...
2fbdda8ca8079feb46e985f8814a7b7ed0d5f179fe0e3d909c6491ef5f131317
Python
5,038
167
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import contextlib import numpy as np import torch from fairseq.data import FairseqDataset, data_utils logger = l...
73702f5f680a96a64507edb91ba9b6f9908f0348574727717fde46dc9015dd40
Python
5,038
150
# 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 # # Unless required by applicable law or agr...
50df14631abba44dceac0cb972e5a719acb0c89e51fcc9b76b04815df48d1da5
Python
5,039
148
#!/usr/bin/env python import urllib.request from urllib.parse import urlparse import os import anndata import argparse import shutil import pandas as pd import scipy import json import tempfile # 6 available but only 2 contain region label and coordinates sample_name = ['E9.5_E1S1', 'E9.5_E2S1', 'E9.5_E2S2', 'E9.5_E...
276fc1ebdd5682a8133d84e86c382b94290813d6114a69904b728d98a9bd124c
Python
5,040
108
import argparse import random,os,sys import numpy as np import pandas as pd import argparse import torch from tqdm import tqdm import os import sys sys.path.append("../pretrain/") from load import * ####################################Settings################################# parser = argparse.ArgumentParser(descri...
bae40d14aadaa8a68f115d336c1d15686dd89cc1a93dc3604a8e066bd8cd3b25
Python
5,041
136
# -*- coding: utf-8 -*- """ Created on Thu Nov 11 14:17:10 2021 @author: wyz & yh Batch processing script for calcium imaging data analysis: 1. Processes multiple Excel files in a directory 2. Applies temporal smoothing to fluorescence traces 3. Performs spike deconvolution using constrained FOOPSI 4. Optionally visua...
4da2c6c1d9909d61458a69e0fe8674af060d4b3a055001eed6ea985b90d9c11a
Python
5,042
185
from pgmpy.datasets._base import BaseDataset class SachsMixed(BaseDataset): _tags = { "name": "sachs_mixed", "n_variables": 20, "n_samples": 7466, "has_ground_truth": True, "has_expert_knowledge": True, "has_missing_data": False, "has_index_col": False, ...
8ed329e717bc0927cdcf94bd551a3660695f46856793496161021d145598051f
Python
5,042
146
import argparse import os import pickle from pathlib import Path import h5py import numpy as np from spacestream.analyses.effective_dimensionality import (compute_eigvals, effective_dim) from spacestream.core.feature_extractor import get_features_from_layer f...
f3ce065009acd17a05b175557d2734fefbccf69ef69d7eff2f61ca011359bd03
Python
5,042
154
import torch import torch.nn as nn try: from torch.distributed.fsdp.fully_sharded_data_parallel import checkpoint as fsdp_checkpoint except ImportError: from torch.utils.checkpoint import checkpoint as fsdp_checkpoint class PerceiverAttention(nn.Module): """ Single cross-attention layer for Perceiver...
c304f3a2e58d2fe6ea0c08aa6ff296eb95a0bd894a6bc68dfb7fe89150a4eb59
Python
5,044
120
# _*_ coding: UTF-8 _*_ # Version information START -------------------------------------------------- VERSION_INFO = \ """ Author: ZHANG YUBO Version-01: 2019-08-18 simulate four-taxon data set Version-02: 2019-11-04 simulate four-taxon data set, with variable mutation rates, recombi...
d22a0ae43a57838c1d6d0e41419b1a0f78b2f9fdf1b1ddb50ef2090c9b263801
Python
5,044
127
""" This is a module that contains the timer facility for gmx_MMPBSA. It's useful for profiling the performance of the script. """ # ############################################################################## # GPLv3 LICENSE INFO # # ...
532013131eb8f5eba562b3cb9621e9552eb45daef7246f09b8dc569ca7801877
Python
5,045
199
# Copied from https://github.com/manzt/zarrita.js/blob/ac2559c310bd945470a2651526f730a505b2d5c9/fixtures/v2/generate-v2.py # # MIT License # # Copyright (c) 2020 Trevor Manz # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Softw...
6fd79ebf57d551593edb0ac6ffa31e9a1b7418da7e9bb56531c19497a3a93f65
Python
5,045
178
import numpy as np def RSE(pred, true): return np.sqrt(np.sum((true - pred) ** 2)) / np.sqrt(np.sum((true - true.mean()) ** 2)) def CORR(pred, true): u = ((true - true.mean(0)) * (pred - pred.mean(0))).sum(0) d = np.sqrt(((true - true.mean(0)) ** 2 * (pred - pred.mean(0)) ** 2).sum(0)) return (u / d...
b5a7bb4fd5c5a3ff67e198f2f81fafd470f978475d67de2cd71012fe7e7cce2b
Python
5,045
153
import numpy as np import pandas as pd import pytest from pgmpy.base import PDAG from pgmpy.estimators import GES from pgmpy.example_models import load_model @pytest.fixture def random_data_estimator(): rand_data = pd.DataFrame( np.random.randint(0, 5, size=(int(1e4), 2)), columns=list("AB"), ...
6616f81b9480208136080f237c7f0ab7336e77b193c9688af4590cc15f23d14c
Python
5,047
143
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from typing import List import torch.optim.lr_scheduler from omegaconf import II from fairseq.datac...
89af4d1d3aa5e87bd206950d6a7aaa3861583eca0525a42e549992797781040e
Python
5,047
125
from pathlib import Path import requests import pandas as pd import logging from typing import List from src.data.manager import DatasetManager log = logging.getLogger(__name__) class SCOPeManager(DatasetManager): def __init__(self, filepath: str): """ Initialize the SCOPe handler with the file p...
f9795e95de02f0f37e0e9e896fbdb842bd43a8575db071f5bf84533d67e663c4
Python
5,048
111
import cv2 import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans from skimage.segmentation import mark_boundaries def convert(image_rgb, color_space): if color_space == 'Lab': image_preprocessed = cv2.cvtColor(image_rgb, cv2.COLOR_RGB2Lab) l, a, b = cv2.split(image_p...
b77afd98774d139d4ebfe0a91a1fb920636a97858688748df82d856d69eb9032
Python
5,049
137
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
f7f29e23455f3de259a66220406d5db80e8b21074689e28beefe59aaa6a32408
Python
5,049
169
import os import sys import pandas as pd import numpy as np import argparse import csv # import motif_utils as utils def kmer2seq(kmers): """ Convert kmers to original sequence Arguments: kmers -- str, kmers separated by space. Returns: seq -- str, original sequence. """ kme...
718986c990f42885286dabd75a89159d5575841c6578050f7d20e0d6c5a4cbbe
Python
5,050
166
""" * author: Abolfazl Danayi * created on 01-01-2026-07h-48m * copyright 2026 """ import tools import numpy as np from keras import models as KM from keras import layers as KL from keras import backend as KB from keras import optimizers as KO import numpy as np import tensorflow as tf import os # import analysis as ...
d10a8d7e38394744cfc9123ff872dd12a879c292866fefa989434797013cce3e
Python
5,051
129
# 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 # # Unless required by applicable law or agr...
cdd4d6623f12887f18dd4fa53a773681125ea062461efc8c1c62b5a274c07199
Python
5,052
145
import collections from os.path import join import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from sklearn import metrics from config_path import PROSTATE_LOG_PATH, PLOTS_PATH from utils.stats_utils import score_ci def read_predictions(dirs_df): model_dict = {} ...
69a63379849d67de857e73a43056b3db703bb5af8623c32634d400d8d301ab51
Python
5,053
162
import copy import torch import logging from argparse import Namespace import yaml from fairseq import options from examples.speech_to_speech.benchmarking.core import ( Processing, SpeechGeneration, Cascaded2StageS2ST, Cascaded3StageS2ST, S2UT, ) from examples.speech_to_speech.benchmarking.data_util...
0411d63adbcf7dde00d4e418b13cb553cab98030dda85f3b430103463b0f15a4
Python
5,054
109
import utils.gpu as gpu from modelR.lodet import LODet from tensorboardX import SummaryWriter from evalR.evaluator_fs import Evaluator import argparse import os import config.cfg_lodet as cfg from utils.visualize import * import time import logging from utils.utils_coco import * from utils.log import Log...
1c4251095a7dcd9b884ac5eab7815fc6d014ea50bb2704fe6820fa61e9eae36c
Python
5,055
102
"""Unit tests for the live-service availability probes in ``tests/__init__.py``. These probes gate the ``@pytest.mark.skipif(not <SERVICE>_AVAILABLE, ...)`` network tests. A probe that reports a *healthy* service as unavailable silently skips real coverage on every CI run, so the probes themselves are worth pinning do...
4d91c3c40510ca890f4945954b25e9de7c4fc0fe751e0873c6880441c3dae4b9
Python
5,056
162
from pathlib import Path from typing import Optional import numpy as np import torch import torchvision from pytorchvideo.transforms import ShortSideScale, UniformTemporalSubsample from torchvision.transforms._transforms_video import (CenterCropVideo, NormalizeVide...
f7c5550026adf4ef11ecdcf8efd8ae896a1215b4cb143b5c8bb49738e8a2d79e
Python
5,056
126
import pytest from rnalysis.gui.gui_report import * def test_Node(): # Test creating a node object predecessors = [1, 2, 3] node = Node(4, 'Node 4', predecessors, 'popup', 'Count matrix', 'filename.txt') assert node.node_id == 4 assert node.node_name == 'Node 4 (#4)' assert node.predecessors ...
4cdaa532c02c2319ae43c78461c6bae58f87e02f9493cedae4cda1467727e144
Python
5,058
136
import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader, Subset from pipelines.dataloader import JacquardDataset from modules.vgg16_baseline_even_longer import VGG16Baseline from grasping_pvgg16_feedback_conn_3_2PC_spec_targ_fixed_dist_PC2_fb_even_longer_bb import PVGG16Separate...
76f3c24060be7c39a2d2f0a52bc7aa143fa6f796b16366138b476337afbef1f1
Python
5,059
126
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class MapMixin: """ <<< Map >>> Map are mainly used for visualization of geographic area data. """ def add( self, series_name: str, dat...
e93b201250be118e73f628d1372c37eca034b2136aa692631ef9387c381a647c
Python
5,060
152
import torch import matplotlib.pyplot as plt import seaborn as sns import argparse import os import numpy as np from transformers import BertTokenizer, BertModel, DNATokenizer from process_pretrain_data import get_kmer_sentence def format_attention(attention): squeezed = [] for layer_attention in attention: ...
70c926230d1634c5d174c32e5727218e20dff8c02cfd5f826e128fb201645a38
Python
5,061
132
from PIL import Image from sklearn.cluster import KMeans import cv2 import numpy as np from matplotlib import pyplot as plt import torch from msi_visual.visualizations import visualizations_from_explanations from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity import cmapy from msi_visua...
14cfd7cf829100d3b597702259c8d98cbf22dc578d23444faaa9760af250cf4d
Python
5,071
126
import os import json import pandas as pd import numpy as np from tqdm import tqdm def get_correlation_matrix(data_dir, correlation_pairs): corr_results = {f'{pair[0]} ~ {pair[1]}': [] for pair in correlation_pairs} for f in tqdm(os.listdir(data_dir)): df = pd.read_csv(os.path.join(data_dir, f)) ...
4d2ad0aa4aa501107fe38c60b449c32f6eb72b7040bcf2f92aa3800a9eabb7d3
Python
5,075
168
from __future__ import annotations from subprocess import CalledProcessError from typing import TYPE_CHECKING from typing import Literal from typing import cast import pytest from poetry.core.constraints.version import Version from poetry.console.exceptions import PoetryRuntimeError from poetry.utils.env.python.ins...
85386de2bfbe1800813f2ed88ed96d5ff6a2181f4883fb6990c990b42aac58bd
Python
5,079
123
# _*_ coding: UTF-8 _*_ # Version information START -------------------------------------------------- VERSION_INFO = \ """ Author: ZHANG YUBO Version-01: 2019-08-18 simulate four-taxon data set Version-02: 2019-11-04 simulate four-taxon data set, with variable mutation rates, recombi...
057140ca31c7b0a1baad2debc484b69ab749afe6fa09767cad2ef143f7dbe3cd
Python
5,080
143
import numpy as np from tqdm import tqdm from functools import partial import torch import torch.nn as nn from torch.nn import functional as F from ..common.data_utils import ( lattice_params_to_matrix_torch, lattice_params_from_matrix, ) from ..gnn.embeddings import MAX_ATOMIC_NUM from .base import BaseMode...
1c2f46903d3a4a090aac5dbe28aaa1f1ce7da572f89122b593c764975066be45
Python
5,080
127
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn from tractseg.libs.pytorch_utils import conv2d from tractseg.libs.pytorch_utils import deconv2d class UNet_Pytorch_DeepSup(torch.nn.Module): def __init__(self, n_input_...
786b6e38100861ad5df8276ac67a81957843ac8300708a4067c4b3eb501f1317
Python
5,080
147
import numpy as np # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
b1f77b04387413e516cd949412dde94fba08d470af3b28c295ea253620e9df8b
Python
5,081
158
"""Tests for ``aestetik.modules.aestetik_module.AESTETIKModel``. We construct a real ``AESTETIKDataModule`` so that ``configure_model`` has a populated ``X_st_grid`` to read its input-channel count from. """ from __future__ import annotations import pytest import torch from aestetik.data_modules.data_module import A...
665af84bd7cc221e15c9859f7df4af19f12c984c5d70e2eba1b59dd97b9a1122
Python
5,084
146
import datetime import uuid import simplejson as json from jinja2 import Environment from ..commons import utils from ..globals import CurrentConfig, Locale, RenderType, ThemeType, DefaultLocale from ..options import InitOpts, RenderOpts from ..options.series_options import BasicOpts, AnimationOpts from ..render impo...
b22113f5bb634b4704bebcb7364d64efb996ca891111345388fc1d0450649b7c
Python
5,085
131
import torch import torch.nn as nn import torch.nn.functional as F from core.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d from core.modeling.aspp import build_aspp from core.modeling.decoder import build_decoder import timm from core.modeling.attention import SAGate class DeepLab(nn.Module): d...
3b0b9204b8751781970b7f7a33f21b6e1654b662c69fbd8b8dd737e5223e3255
Python
5,089
147
import warnings import numpy as np import rich.table from anndata import AnnData from scvi import REGISTRY_KEYS, settings from scvi.data import _constants from scvi.data._utils import ( _check_fragment_counts, _check_nonnegative_integers, _verify_and_correct_data_format, ) from ._base_field import BaseAn...
b068e30270fbaea39a4db8a02c5d14ff91b2a8165274940770204fdeb2a448e6
Python
5,089
152
"""Functions for shortening GO names.""" __copyright__ = "Copyright (C) 2016-2017, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" greek2uni = { "alpha": "α", "beta": "β", "gamma": "γ", "delta": "δ", } greek2tex = { "alpha": r"$\alpha$", "beta": r"$\beta$", "...
5fd373d12b42941e4d0e92b7c409c9e6760838ed7e41e8dc74a649a551214015
Python
5,090
102
#!/usr/bin/env python3 """Microarray harmonization (track 2) — read the 6 array series_matrix expression tables, map platform probe IDs -> HGNC symbol (GPL570 via mygene reporter; GPL10558/GPL17586/GPL23126 via the GEO platform SOFT annotation), assign MS/HC from series_matrix metadata.""" import os, re, gzip, io, requ...
8e1d366fe4f645c8741cc7292fa74055d13a3da8c6b08ae0fe2f84d83299f76e
Python
5,093
171
import argparse import os import re import sys from typing import Optional import pandas as pd def get_args(): parser = argparse.ArgumentParser(description="Subset fastq files for a specific sample.") indexes_group = parser.add_mutually_exclusive_group(required=True) parser.add_argument( "-f", ...
cab662405782e6c4993abaed0b70ecb74454cbec920ad7b0ceaa57e572381525
Python
5,094
151
"""Tests for the validation surface of the sklearn-style ``AESTETIK`` estimator. These tests poke the lightweight validation paths (param checks, obsm / obs presence checks, fit-vs-predict dim guards, sklearn ``check_is_fitted`` behavior). They never run Lightning training so they live in the fast suite. """ from __fu...
5c9b04481ade2577f7f2d4428b62d88005abc62a93e11dce2782d9909891fa4e
Python
5,095
135
"""Map Hydra OmegaConf to a flat namespace for the training loop and get_gene_celltype.""" from __future__ import annotations from types import SimpleNamespace from omegaconf import DictConfig, OmegaConf from dlbase.training.standard_lightning import early_stopping_patience_epochs def hydra_cfg_to_args...
12de7b0ff09c8903515bbd1322d4933676f21386db65bc5ecc24ebbdf235dcfa
Python
5,098
178
#!/usr/bin/env python # -*- coding: utf-8 -*- """Image filters. Intended for internal use only.""" from typing import Optional import warnings import numpy as np import matplotlib.pyplot as plt from scipy import ndimage from skimage.restoration import rolling_ball __all__ = [ "apply_gaussian_filter", "remov...
e7d24a90426de8068022d5cb909862d5f25da4d946715cfe8faff89b872f57b5
Python
5,098
127
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn from tractseg.libs.pytorch_utils import conv2d from tractseg.libs.pytorch_utils import deconv2d class UNet_Pytorch_DeepSup_TEST(torch.nn.Module): def __init__(self, n_i...
ade52542d18c9b9f5ff4ae772b2ef729e1aa5835fb57f3d837257bc843a343f4
Python
5,099
153
import collections import os from os.path import join, basename, dirname import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from sklearn import metrics from config_path import PROSTATE_LOG_PATH, PLOTS_PATH from utils.stats_utils import score_ci def read_predictions(dir...
9ada2c0732111b7e04dbe8f016a49078b157d8fbcb3c217f57bff28be8c88144
Python
5,100
139
#!/usr/bin/env python3 """ @file test_neural.py @author Simon Yu @date 02/12/2024 @brief Script for testing neural models. """ import argparse import dataset import header import logger import model import torch import tqdm import utility import wandb def initializeRunName(run_name = ""): if run_name != "":...
66ade7f5501a4e6afdb175a7fe0a058ef32a0227581057840aa6e35fd745f7c5
Python
5,101
134
import pysam import argparse import os def sort_and_index_bam(input_bam, sorted_bam, n_threads=1): pysam.sort("-@", str(n_threads), "-o", sorted_bam, input_bam) pysam.index(sorted_bam) def parse_fasta(reference_fasta): """ Parses a multi-FASTA file into a dict {seq_name: seq_string}. """ seque...
a57eae867506423286bf3aa2fdb1854455bd8584ee952207d187fd4e3e55083c
Python
5,101
155
import sys import timsdata import sqlite3 import numpy as np from PIL import Image import cv2 import tqdm from bisect import bisect_left, bisect_right from typing import Optional import os import math import os from multiprocessing import Pool import argparse def get_args(): parser = argparse.Argum...
abb4f8082500148848198479c2cb7c4cdfbf2bd9f169bd28ddd480aeaaa6c467
Python
5,101
137
"""Atomic orbital eigenenergy table at ωB97M-D3BJ / def2-TZVPPD. DFT analogue of `atomic_table.py` (which uses GFN2-xTB single atoms). Built with PySCF UKS: - functional: base ωB97M semilocal XC (libxc `wb97m_v` with the VV10 NLC switched OFF). ωB97M-D3BJ uses the *same* semilocal XC as ωB97M-V but replace...
33911dd06147fcf46930065c7de0b701186ddf19dbcd724199755f048424afcb
Python
5,104
136
import scipy.signal as signal import numpy as np import itertools import scipy.ndimage as filters def butter_bandpass(lowcut, highcut, fs, order=5): sos = signal.butter(order, [lowcut, highcut],fs=fs, analog=False, btype='band', output='sos') return sos def butter_bandpass_filter(data, lowc...
9faa6061e5adfb5428d133a17e79109ab9534dcb6f613ab05de684ac0e07d14c
Python
5,104
104
import streamlit as st import joblib from msi_visual.saliency_opt import SaliencyOptimization from msi_visual.spearman_opt import SpearmanOptimization from msi_visual.nmf_3d import NMF3D from msi_visual.nonparametric_umap import MSINonParametricUMAP from msi_visual.kmeans_segmentation import KmeansSegmentation ...
4a2532a892abe004c5b5182c084278de3a067126a008e9e7bab901d45950881e
Python
5,105
144
import logging from pathlib import Path import numpy as np import pandas as pd import scanpy as sc import scipy as sp from gsMap.config import CauchyCombinationConfig logger = logging.getLogger(__name__) # The fun of cauchy combination def acat_test(pvalues, weights=None): """acat_test() Aggregated Cauchy ...
c9b948c9b5e1682c8095f7dcdfc98b55fb567f3962b716128bf57e9468dd86fd
Python
5,105
144
import logging from functools import partial from typing import Literal import jax import jax.numpy as jnp from jax.experimental import pallas as pl from .utils import ( big_number, compiler_params, compute_q_and_kv_block_len, create_grid, get_lse_block_spec, get_mask_block_spec, get_value...
c2b04e420bb79647d4461b8753466276fd0553353c216ea360d0702975614711
Python
5,109
130
import re import logging import os re_db = re.compile(".db$") re_tw = re.compile("^TW_") re_0_5 = re.compile("_0.5$") re_g_ = re.compile("^gtex_v7_") re_i_ = re.compile("_imputed_europeans_tw_0.5_signif.db$") def extract_model_name(path, name_pattern=None): p = os.path.split(path)[1] if name_pattern: ...
dc5ab053327186ecbc3a627c2b5f8317048228f2d2846a391b3a02e09393419d
Python
5,115
179
""" This module contains thread workers to recieve or plot measurement data """ from PyQt5.QtCore import QObject, QThread, pyqtSignal as Signal, pyqtSlot as Slot import time from Sensors.Measurements import MeasObj from Sensors.GravityMeasurements import GravitySensor from queue import Queue from Sensors.PlotControl i...
953dbd15d5aded7bbf329cd4cadef7aa6231dc766066831eedcc8cae3a93dcbd
Python
5,116
127
from ... import options as opts from ... import types from ...charts.chart import RectChart from ...globals import ChartType class Line(RectChart): """ <<< Line Chart >>> Line chart is a graph that connects all data points with single line to show the change trend of data. """ ...
fd442cbe54c0fd540b89cb7ff895e4f7a3bc36bfbfdc57a9bf6df1295f2ea07d
Python
5,119
112
import keras.backend as K from keras.models import Model, Sequential from keras.layers import Input,InputLayer,Multiply,ZeroPadding2D from keras.layers import Conv2D, MaxPooling2D,Conv1D,MaxPooling1D from keras.layers import Dense,Activation,Dropout,Flatten,Concatenate from keras.layers import BatchNormalization from k...
3748388b65571c661c54d00f5d071994b507d167442ab87dbd0845135bdac16a
Python
5,120
134
import numpy as np import pandas as pd import pytest from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.estimators import MirrorDescentEstimator from pgmpy.factors import FactorDict from pgmpy.factors.discrete import DiscreteFactor from pgmpy.models import FactorGraph, J...
3d384ef6281346e573850a4980706304bb220b0bfb71c7c34d380a57b539be49
Python
5,121
148
from distutils.util import strtobool from pathlib import Path def bool_from_str(value): if isinstance(value, bool): return value elif isinstance(value, str): return bool(strtobool(value)) def expanded_user_path(value): return Path(value).expanduser() def range_str(range_str, sort=True)...
70ef1cf53e042a7cf6dee3f0040214899da92e392c9998873cd7b29a398ef1db
Python
5,122
158
"""tests for vak.eval.parametric_umap module""" import pytest import vak.config import vak.common.constants import vak.common.paths import vak.eval.frame_classification def assert_eval_saves_one_csv(model_name, output_dir): eval_csv = sorted(output_dir.glob(f"eval_{model_name}*csv")) assert len(eval_csv) == ...
02401985d97f37b7f8d12538787b1d384a216b93077194710ea603befaf67e99
Python
5,123
145
import unittest from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Line class TestLineChart(unittest.TestCase): @patch("pyecharts.render.engine.write_utf8_html_file") def test_line_base(self, fake_writer): c = ( Line() .add_xaxis...