sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
8c726e04471ab137e6e8fdd50e321ce804eaa268a3d3102f224b76d27eb8d4d7
Python
4,728
127
import subprocess from pathlib import Path import nibabel as nib import numpy as np import pandas as pd import matplotlib.pyplot as plt from nilearn import plotting from nilearn.image import mean_img # Define the directory containing the derivatives base_dir = Path('/data/elevchenko/MovieProject2/') deriv_dir = base_d...
8fed69f6fe99faa5aa49569af9ff3b53973804ae59a9de158e5a4f00305df53d
Python
4,729
134
#!/usr/bin/env python3 """ Make a 2-way Venn diagram comparing fusion transcripts between SFARI (Xu and Rynard et al.) and Patowary et al. datasets. Transcripts are compared by intron chain: multi-exon : 'chrom:strand:e1end-e2start,e2end-e3start,...' mono-exon : 'chrom:strand:start-end:mono' Only transcripts wit...
0e689cf26ba8e59cdccb351c073cac57a7377a8b74dd75684ff9f15ea392b06a
Python
4,731
100
# Copyright 2021 HIP Applied Computer Vision Lab, 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...
9dc4d4cd45a5183d58e36f3b7dd670f43ce225c874a73a0d150d5e8bfb412156
Python
4,733
152
import json import os import pkgutil import re import yaml from stripedhyena.utils import dotdict from stripedhyena.model import StripedHyena from .tokenizer import CharLevelTokenizer MODEL_NAMES = [ 'evo-1.5-8k-base', 'evo-1-8k-base', 'evo-1-131k-base', 'evo-1-8k-crispr', 'evo-1-8k-transposon',...
ef24ad00b3bfe1a393c873f0848f1de78924fad43945d216f38dc3f9f2c3ff23
Python
4,733
135
# coding=utf-8 PROJECT_PATH =r"D:\FangX24\code\LO-Det-main\mnt\Datasets\NWPU/" DATA_PATH = r"D:\FangX24\code\LO-Det-main\mnt\Datasets\NWPU/" DATA = {"CLASSES":['airplane', 'ship','storage tank','baseball diamond', 'tennis court', 'basketball court', 'ground track field', 'harbor', 'bridge', 'vehicle'], "NUM"...
98fbe0df1896827a6b668770f6847ea52456aa103c3f94ab6bd42facac8068ab
Python
4,738
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. import logging from dataclasses import dataclass, field from typing import Dict, List, Optional import torch from fairseq.dataclass import Fa...
00a0121c262a2201944caa0ecaf9ac6f2cc47a43254c388405c72a0c8f89c9d9
Python
4,740
148
"""The package config `brenda_references` ships, and the host that is not. `config.py` reads `config.toml` at import and the package's `__init__` reaches it, so a tree without that file cannot execute `import brenda_references` at all. It was invisible to git for years because `.gitignore` hid the machine-local root `...
204d855b446e01ae6ee6499da0106514093c0e5a2ed97c5ab755b889fcd8bef0
Python
4,740
141
#!/usr/bin/env python3 # 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 argparse import os import re import shutil import sys pt_regexp = re.compile(r"checkpoint(\d+|_\d+_\d+|_[a-z]+...
a95309dccbde799119356c3d694b27c1421fd83a19aa939fcaab25128f468c7d
Python
4,740
137
#!/usr/bin/env python # ENCODE DCC compare signal to roadmap wrapper # Author: Daniel Kim, Jin Lee (leepc12@gmail.com) import warnings from matplotlib import pyplot as plt import sys import os import argparse from encode_lib_common import ( strip_ext_bigwig, ls_l, log, mkdir_p) import numpy as np import pandas as...
61f29266634948c4ee84b6db83b16b7d6096b33ea65412641014247835fee077
Python
4,741
159
from __future__ import annotations from typing import TYPE_CHECKING from typing import Any from typing import Protocol if TYPE_CHECKING: from collections.abc import Callable from contextlib import AbstractContextManager from pathlib import Path from cleo.io.inputs.argument import Argument from c...
1491a3a457c36b412bf0ac77dbf01780ca1b59c331934cad9b9deeaeaa8e85cf
Python
4,744
125
# 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 torch import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import with_incremental_state ...
2a269c4f942b5024413a9db4d6bd654ddb9116c9201b38134e6c14579b211e9b
Python
4,744
141
# 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. # The code in this file is adapted from the BeiT implementation which can be found here: # https://github.com/microsoft/unilm/tree/master/beit...
bf7325ece3f85a00257d300e5cd2f5f7994ea7ed838ea0e73575e371bc584b20
Python
4,744
122
'''Code Tests''' # Authors: Ryan Thorpe <ryvthorpe@gmail.com> # Darcy Diesburg <darcy.diesburg@gmail.com> import os.path as op import numpy as np from scipy.io import loadmat import SpectralEvents.spectralevents as se def test_event_comparison(): '''Test if the output from MATLAB and Python event det...
f785317659ff19572a6a162d0f63779e3f48a7287926c39ec38c193c06466161
Python
4,746
109
from copy import deepcopy import numpy as np def merge(dict1, dict2): keys = np.unique(list(dict1.keys()) + list(dict2.keys())) keys = np.unique(keys) res = {} for k in keys: all_configs = [] if dict1.get(k) is not None: all_configs += list(dict1[k]) if dict2.get(k)...
d250b2cda961fa8971a875eb58ed994e7f6ee3cdac6249b0d21a4d4d7480d08e
Python
4,749
124
# Copyright 2020 The Google Research Authors. # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Adapted from https://github.com/yang-song/score_sde_pytorch which is released under Apache license. # Key changes: # - Introduced batch_idx argument to work with graph-like data (e.g. molecules) # ...
36d4973fe8d453c364d4ff33ef8d41e8d5402655271f574e0a9e1bb3cdec9963
Python
4,753
113
''' This script optimizes logistic nonlinearities for a variety of Gaussian distributions and plots the optimal parameters. Author: Jonathan Gant Date: 29.08.2024 Optimized for performance ''' import numpy as np from joblib import Parallel, delayed from tqdm import tqdm from scipy.stats import norm import os import sy...
120fa652eb3c52fdbd81bce9151e9429ea45915a1ae0db56125e80b8dc272c09
Python
4,754
127
import os from abc import ABC import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * from slicer.util import VTKObservationMixin # # NetstimPreferences # class NetstimPreferences(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/blo...
41d7292aa491825eae44a759acf70337697df553a6f87d8b1e53cfa9efe1f6f6
Python
4,754
87
import torch import numpy as np import torch.nn.functional as Func from .light import Light from scipy.special import j1 # J1: First-order Bessel function of the first kind class Dun_propagator_1D: # This function must be carefully used to satisfy input_pitch <= wavelength/(2*NA) gurantee the accuracy, where NA i...
675f0825690a701dccea2d22a531e3769965381e68ef7ab735b967c9fa0d563c
Python
4,754
150
import os import zipfile from functools import lru_cache from pathlib import Path from typing import Callable, Dict, Iterable, Literal, Optional import omegaconf import pandas as pd import torch import wget from graphein.protein.tensor.data import Protein from loguru import logger as log from sklearn.preprocessing imp...
1d12cd80aba80a9cee91ba0e0273089c382a0a9675f1bd835a6778a32fb5b245
Python
4,755
116
import os from torch.utils.data import Dataset from pycocotools.coco import COCO import config.cfg_lodet as cfg from utils.utils_coco import * class COCODataset(Dataset): """ COCO dataset class. """ def __init__(self, data_dir='COCO', json_file='instances_train2017.json', name='train2...
1c64117678841fd9a7181906480bd0cecf9018b713a044a39a1e84d32d4f296d
Python
4,759
142
import logging from typing import List import numpy as np import scipy.io # set up logger logging.basicConfig( level=logging.INFO, format="%(asctime)-15s %(levelname)s:%(message)s" ) logger = logging.getLogger(__name__) def collapse_and_trim_neighborhoods( nb_list, keep_fraction=0.95, keep_limit=None, target...
d62faad073ef898d15c202e5ca205c2f2087cbf597abea81d8aae25215e6c97c
Python
4,759
116
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class Tree(Chart): """ <<< Tree diagrams >>> Tree diagrams are used primarily to visualize tree data structures, which are special hierarchical types with unique root no...
6752ff9fa6b77690bec0bb03a2368b64e1729dc17c6ffbcf9d805e6b5149430e
Python
4,760
151
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: Jieran Sun; Implemented quality control code import argparse # TODO adjust description parser = argparse.ArgumentParser(description="quality control (gene/cell filtering) using scanpy") parser.add...
f44d6f89a6d0261f5f7f15df36885aa921eb8f19840006650492f7ebcf52e3a2
Python
4,761
128
import torch def to_device(tensor, device): """ Moves the tensor to the specified device if the tensor is not None. """ return tensor.to(device) if tensor is not None else None def apply_mask(tensor, mask, mask_dim=-1): """ Applies a mask to a tensor by broadcasting the mask along the last d...
5c2e18c48f647139e8645453cc50e16ce94ec22b36247527a406963feeffa165
Python
4,763
116
import os from torch.utils.data import Dataset from pycocotools.coco import COCO import config.cfg_npmmrdet_dior as cfg from utils.utils_coco import * class COCODataset(Dataset): """ COCO dataset class. """ def __init__(self, data_dir='COCO', json_file='instances_train2017.json', name...
3eec4717ffaf38a18cea6cc8ac560ff50ec511366458bf20fa7fd8c7a26195d8
Python
4,764
142
import logging import os import re from typing import List import numpy as np import yaml import loompy class Annotation: unknown_tags: set = set() def __init__(self, category: str, filename: str) -> None: with open(filename) as f: doc = next(yaml.load_all(f, Loader=yaml.SafeLoader)) if "name" in doc: ...
eda1ce51a6ae052dafe438d41abfcd3fbea0251945b4b9c860a0206986dd71c0
Python
4,766
128
from typing import Union import numpy as np import pandas as pd from scipy.optimize import minimize from uncertainties import ufloat from ..log import MetricLogStream HARTREE_TO_KCAL = 627.509608031 def relative_energy(E, loc=None): if loc is None: return E - E.mean(-1, keepdims=True) elif loc == "...
62cd730b8af40e6803153b06d8d12beeb38e21ca831f16ac5793eb4f51f8f28a
Python
4,767
146
import numpy as np import pandas as pd import pytest from pgmpy.factors import FactorDict from pgmpy.factors.discrete import DiscreteFactor @pytest.fixture def phi1(): return DiscreteFactor(["x1", "x2", "x3"], [2, 2, 2], range(8)) @pytest.fixture def phi2(): return DiscreteFactor(["x4", "x5", "x6"], [2, 2,...
92fde8bbee887fde51ba5437458395bdaf35210c59adf05769dee302404d7ced
Python
4,767
135
""" Implement unsupervised metric for decoding hyperparameter selection: $$ alpha * LM_PPL + ViterbitUER(%) * 100 $$ """ import argparse import logging import math import sys import kenlm import editdistance from g2p_en import G2p logging.root.setLevel(logging.INFO) logging.basicConfig(stream=sys.stdout, level=lo...
bf78aa7af5fa375b3141eca3826efae6178f99d63855c548afe482f74565a9dd
Python
4,767
150
import numpy as np import pandas as pd from scipy import stats from ._base import _CITestResult from .pearsonr import Pearsonr class PearsonrEquivalence(Pearsonr): r""" Pearson equivalence test [1] for conditional independence on continuous data. This test first computes the partial correlation coeffici...
7b005ecf1ccf638ded7688afba3d498e3b4fdd7e1943d10a285f26e2a3bc4aaf
Python
4,768
143
from __future__ import annotations import os import sys import textwrap from pathlib import Path from typing import TYPE_CHECKING import findpython import packaging.version import pytest from poetry.core.constraints.version import Version from poetry.utils.env.python import Python if TYPE_CHECKING: from unit...
9958467f372d9adfa1c57e3825aa45cbdeeb0e6af10e84ea6fc766ab3152bc13
Python
4,768
145
import sys import tsfdata 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.Argu...
61c82c744347ed6e9f686877c884d7674fb4c48fe80daf71b4dee6058f099890
Python
4,770
176
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # author: adefossez import functools import logging from contextlib import contextmanager import inspect import time logge...
624ceb395232f2f8fd46d4c87e1f1335987ca9cbc555314cc5ceab92ab37de4c
Python
4,771
149
from npyx.c4.dataset_init import ( N_CHANNELS, WAVEFORM_SAMPLES, extract_and_check, get_paths_from_dir, prepare_classification_dataset, ) from torch.utils.data import Dataset import npyx import torch import numpy as np import os import pandas as pd from celltype_ibl.params.config import DATASETS_DIR...
817696908c5913317309a61097f3bb9570e8d9edf66e86488afc53221e979e21
Python
4,771
140
import numpy as np def gaussian_2d(positions: np.ndarray, center, sigma: float) -> np.ndarray: """ Inputs: positions: N x 2 center: [center_x, center_y] sigma: spread of gaussian """ sigma_sq = sigma**2 return ( 1.0 / (2.0 * np.pi * sigma_sq) * np.ex...
e92038d7c27d7397858f1861973dc9b061d8ac6e39ad40d47990eb54ba479ce7
Python
4,771
141
import os import zarr import torch import numpy as np import matplotlib.pyplot as plt import seaborn as sns from math import ceil from torch import Tensor from torch.utils.data import DataLoader from lightning import LightningModule, Trainer from sbi.inference import DirectPosterior from sbi.utils import BoxUniform i...
241cb58614e0e24241bb5f77e9cba7200d03a5016603225d86e13919d1e2df3c
Python
4,772
70
"""Validate and copy the official TCIA single-series archive without rewriting DICOM. Usage: python lite-web/scripts/prepare-pancreas-ct-demo.py downloaded.zip Requires pydicom and numpy (inspection only). No credentials or network access. """ import hashlib import io import json from pathlib import Path import shutil...
3ffd7e90465d94309de32f0c75c96bb151913b57693fc99814745205ffbd93e0
Python
4,775
97
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/ShatterValveTestUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.se...
e02434924fd808ed0e7c8b747b0ea9dece2bb7d0ac0a080065109dc776ba4785
Python
4,775
131
# 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 fairseq import utils from fairseq.logging import metrics from fairseq.criterions import register_criterion from .label_smoo...
be7ffea9bdcc4b2546e664881d8b63f8ef0db2fee871a19ad1dfa0d3c60314a7
Python
4,776
163
from functools import partial import numpy as np import pytest from scvi.data import synthetic_iid from scvi.model import SCVI from scvi.model.base._de_core import _prepare_obs from scvi.model.base._differential import ( DifferentialComputation, estimate_delta, estimate_pseudocounts_offset, ) def test_f...
519ca21be7364e6750ff2ef36309090e8120bc738b928f88fc09eb1761958852
Python
4,777
133
import argparse import csv from pathlib import Path from importlib import resources from typing import List, Optional, Union import numpy as np import torch import torch.nn.functional as F from evo2 import Evo2 def read_prompts(input_file): """Read prompts from input file or built-in test data. Args: ...
532b53a855da6079277aee5bc172c7fbee4bf2cbe62b8bae83c44f68dd2156fe
Python
4,778
136
""" Unit tests for src/math_ops/time_converters.py. NOTE — known bug in current code: CONVERSION_FACTORS = {"minutes": 1, "seconds": 60, "hours": 1/60} with formula: value * CF[from_unit] / CF[to_unit] This gives the wrong direction for convert_time, e.g.: convert_time(60, "seconds", "minutes") → 3600 (sho...
43f18c01e2e50b4b3a9558e2bef6d8dbc9cbb6a93178a161cc6ed1973f888841
Python
4,779
124
"""Get GO IDs from command-line arguments or from an ASCII file.""" from __future__ import print_function __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang. All rights reserved." __author__ = "DV Klopfenstein" import os import re from goatools.gosubdag.go_tasks import get_go2obj_unique from goatools....
5c7f7051bb98089f456c095708f4f954dcd97aa6561b028b877ec4be753ef8f1
Python
4,779
152
from __future__ import annotations import functools import logging import os import sys import threading import time from concurrent.futures import wait from concurrent.futures.thread import ThreadPoolExecutor from typing import TYPE_CHECKING import pytest from poetry.utils.threading import AtomicCachedProperty fro...
d0a790414c91cdfb96ef15fd0a910f4876778a00c92c80ed0aa8706a0bd6c971
Python
4,781
167
import sys ROOT_DIR = __file__.rsplit("/", 3)[0] if ROOT_DIR not in sys.path: sys.path.append(ROOT_DIR) import uvicorn import os import requests import json from utils.server_tool import get_ip, check_port from fastapi import FastAPI app = FastAPI() BACKEND_DIR = f"{ROOT_DIR}/demo/backend" # Map the function ...
32c2a8aec2684c6cb8d28c3a44d86c074310477d23972f7afedb45bf9bdf9258
Python
4,782
133
import cv2 import numpy as np import string def get_optimal_font_scale(text, width, height, fontFace, thickness, margin=0.9): """ Find the largest font scale such that the text (in a single line) fits inside the rectangle [0, width] x [0, height], given a margin. This function does a simple binary sea...
7de71e5670e54e28ead4a2ac5567855a06dc078e53f337773ec2e4407f2b4d69
Python
4,782
103
import logging import warnings from typing import List import numpy as np import scipy.sparse as sparse from numba.core.errors import NumbaPendingDeprecationWarning, NumbaPerformanceWarning from pynndescent import NNDescent from scipy.sparse import SparseEfficiencyWarning import loompy from cytograph.decomposition im...
45155086f217dd1c54f6a1df28665597d65ab40102eb8b1113b3f74060eaf619
Python
4,785
157
from functools import partial from typing import Literal import jax from folx import register_function from .custom_gradients import mhsa_backward, mhsa_forward, mhsea_backward, mhsea_forward from .forward_laplacian import mhsa_forward_laplacian, mhsea_forward_laplacian from .mhsa import mhsa from .mhsea import mhse...
0620999623e44b691fa36c522f265cefa41cbe99c5642d31deaf6d06af1eabcc
Python
4,786
105
import os import sys from typing import Iterable, Tuple import pytest # Force headless offscreen rendering for Qt on macOS CI environments if sys.platform == 'darwin': os.environ['QT_QPA_PLATFORM'] = 'offscreen' def pytest_configure(config): os.environ['QT_DEBUG_PLUGINS'] = '1' def pytest_runtest_logstart...
ff47c1dc9e19ebcebe051232086d8077a78d6fd2d89680cd24b7245d17c71696
Python
4,787
123
""" MAP Pipeline — Merge & Adapt Pipeline (supervised selection) 1) Score each feature × DA × classifier by cross-session CV 2) Merge ALL training sessions, apply best DA, train classifier 3) Return DA accuracy and no-DA baseline """ from __future__ import annotations import logging from typing import Any, Dic...
2f3051f37218cc939501370cc1671b14ba91bfe1adcb25b7e9ecf496501f568a
Python
4,788
144
"""`Trainer.fit` against a real model's `run_epoch`, not a stub. `test_trainer.py` drives a model defining its own `run_epoch`, so a reverted three-argument signature would pass that whole file. This puts one real `BrendaClassificationModel` batch through `fit`, on a tiny injected BERT and a tiny on-disk encodings fil...
bad2f8129997dfd1b4f0ca26d6e8de2b41aba7f725336aae8df3c1ede64de8e0
Python
4,788
139
import sys from os import makedirs from os.path import dirname, realpath, exists current_dir = dirname(dirname(realpath(__file__))) sys.path.insert(0, dirname(current_dir)) import pandas as pd import os from config_path import * from data_extraction_utils import get_node_importance, get_link_weights_df_, \ get_dat...
f6b208e8b742bd77efa9a0e04d56ef6c4fde72db7253d0f3da67d6fd08337f2d
Python
4,789
122
import torch import torch.distributed as torch_dist import graphein import lovely_tensors as lt from typing import Literal, Optional, Union from loguru import logger as log from omegaconf import DictConfig from proteinworkshop.models.base import BenchMarkModel from proteinworkshop.types import EncoderOutput, ModelOutp...
8741aa7e6ab408218a7bf5629a38f5ac8de3f127b710569eb72b4917ebbb873c
Python
4,792
144
from celltype_ibl.models.WvfAug import get_wf_transform from celltype_ibl.models.AcgAug import get_acg_transform from celltype_ibl.params.config import DATASETS_DIRECTORY from torch.utils.data import Dataset import npyx import torch import numpy as np import os import pandas as pd class EmbeddingDataset(Dataset): ...
fc2238a286e78c9ff7c1b15ee5244b760a6c0c7c958a5b33fa39e0b3256352aa
Python
4,792
127
import contextlib import tempfile import unittest from io import StringIO import numpy as np from tests.utils import create_dummy_data, preprocess_lm_data, train_language_model try: from pyarrow import plasma from fairseq.data.plasma_utils import PlasmaStore, PlasmaView PYARROW_AVAILABLE = True except ...
2ad6dc54cf839d7e524597d80f3e796853a88b2d11edfb624749e4d1b5905f1d
Python
4,793
185
""" This is a module that contains the exceptions thrown by gmx_MMPBSA """ # ############################################################################## # GPLv3 LICENSE INFO # # # #...
6fc0a66303323cb8fd9f21e36885fdfc388f84f519bede54a32755553b32c2c3
Python
4,793
105
#!/usr/bin/env python3 """Build multi-dataset training spec and combined eval directory for CVAE-only experiments. Run after downloading all datasets. Does three things: 1. Writes datasets_train.json (training spec consumed by train_hippie.py). 2. Writes source_id.csv and super_regions.csv into each individual dat...
430cef2cd5348d0c21b3d335627749aebcca5e9130da2bff40b24d5595f73996
Python
4,794
109
from __future__ import annotations import logging from typing import TYPE_CHECKING from scvi.external.drvi._generative_mixin import GenerativeMixin from scvi.external.drvi._interpretability_mixin import InterpretabilityMixin from scvi.external.drvi._module import DRVIModule from scvi.external.drvi._trainingplan impor...
64c4c0b72e1a19d209fadaf880720a66f4b0b827b96935ac9d9c117c645ec47e
Python
4,795
136
import cv2 import numpy as np import pytest import torch import torchvision from pytorch_grad_cam import ( EigenCAM, GradCAM, GradCAMPlusPlus, LayerCAM, ScoreCAM, SESS, XGradCAM, ) from pytorch_grad_cam.sess import sliding_window from pytorch_grad_cam.utils.image import preprocess_image fro...
732207fc9a482b5853434da7d2cc1aebe4f78747953b8738e122020ea94f797a
Python
4,796
131
# 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. """ This module contains collection of classes which implement collate functionalities for various tasks. Collaters should know wh...
e5b7f154c96d42b84ccff8ed2d6098e23920fead05903747e32143f7836dcc98
Python
4,796
117
# 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...
d96a4508f197c063cdc5a4153e981e8fe2201a68b0c853675f510c5033866690
Python
4,797
118
# 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...
f4f828261fe4b7072339a113d4fcd50aee829e9aba546d3744369e45bd35cc5d
Python
4,797
112
import torch import torch_geometric.nn as gnn from Bio.PDB import PDBParser import numpy as np from torch_geometric.utils import remove_isolated_nodes from matplotlib import pyplot as plt import warnings warnings.filterwarnings('ignore') from .utils import * class Node(): def __init__(self,coord,chain,indx,re...
1e9d7f084683ea79d93a702094c2f8d33818e30ce54953a28e5fb4be56176ca6
Python
4,798
149
import itertools import joblib import numpy as np import os import unittest from numpy import testing from sklearn import datasets, preprocessing #from matplotlib import pyplot from mentor import _cluster as cluster from mentor import _datasets as datasets from mentor import _metrics as metrics from mentor import _rw...
44396eb1a646de038c733567c14648a184351f802bd8b924344b9c3762900262
Python
4,798
136
import pandas as pd import numpy as np import ast import re from scipy.stats import norm from pathlib import Path def calculate_rates(tono_responses, times): hit_count = 0 false_alarm_count = 0 # values from the experiment (257(?) sequences in total) num_signals = 12 num_noises = 244 # Dict...
bd6246b27abb0cdda60fc5d4c1747b0d95ee949b3c3085a25245c50068793e5c
Python
4,799
137
# 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 lightconv_cuda import torch import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import wi...
501dc2f334bdd5b487d14d89716f103460ff1134b277af92ecad8d829ed61669
Python
4,803
154
#!/usr/bin/env python3 # Copyright (c) 2018-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import io import numpy as np import collections def load_vectors(fname, maxload=200000, norm=True, cente...
6f8fe8f7a4a26e677a593a8384553d034b9d441e29552bd518bf7b75a0ce84f7
Python
4,805
110
"""Sorts GO IDs or user-provided sections containing GO IDs.""" __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" import collections as cx class SorterGoIds(object): """Sorts grouped GO IDs. * Get a 2-D sorted list: goids...
7905776fe4aa594c69323d4e149cf4f1f284e93e8b6c1c12f8239f4e2db80722
Python
4,805
150
from __future__ import annotations from subprocess import CalledProcessError import pytest from poetry.console.exceptions import ConsoleMessage from poetry.console.exceptions import PoetryRuntimeError @pytest.mark.parametrize( ("reason", "messages", "exit_code", "expected_reason"), [ ("Error occurr...
9dfbc4dbe720308da2588ad846e7ac45d694964a5e50685c32ece05cc446404b
Python
4,805
96
import sys import os import argparse from parcellate.cfg import get_cfg from parcellate.util import get_path base = """#!/bin/bash # #SBATCH --job-name=%s #SBATCH --output="%s-%%N-%%j.out" #SBATCH --requeue #SBATCH --time=%d:00:00 #SBATCH --mem=%dgb #SBATCH --ntasks=%d """ if __name__ == '__main__': argparser...
2d208c2cceeb1bbba7237450af97be783128316617400beb043627fd9552fe29
Python
4,808
100
import sys import json from msi_visual.normalization import total_ion_count, spatial_total_ion_count from msi_visual.supervised.annotations import get_img, get_visualization, get_dataset from xgboost import XGBClassifier import joblib from sklearn.model_selection import train_test_split from sklearn.metrics impo...
6a848f67a8a6adcfef3e86c74f2a133b8475f4efec8ccbc0126ec30ba3acb8bd
Python
4,809
129
"""What an evaluation reports about the documents it actually scored. `dataset/test_documents` is logged at setup from the split frame; the scores are computed over whatever the encodings file backs. These pin the counts that state the difference, over a split holding one pmid the HDF5 does not and drawn the way `eval...
89023950722846e6c0e3c6011148f13d99c890a4d08bf6baf9d6df2458d36986
Python
4,809
100
# Copyright 2021 HIP Applied Computer Vision Lab, 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...
884901da5fa64a44008bd4060838a30fb0c81d0b96d50b4834b9796aa883ab60
Python
4,810
128
import streamlit as st import glob import os import json import sys import numpy as np import joblib from collections import defaultdict from pathlib import Path from argparse import Namespace from PIL import Image from msi_visual.normalization import spatial_total_ion_count, total_ion_count, median_ion fro...
86c1cf0b8b4eb3f9da8ee12ec5263028afb474e63659e0303fd16999245ea99c
Python
4,811
143
#!/usr/bin/env python # ENCODE DCC GC bias wrapper # Author: Daniel Kim, Jin Lee (leepc12@gmail.com) import warnings from matplotlib import pyplot as plt import sys import os import argparse from encode_lib_common import ( strip_ext_bam, ls_l, log, logging, rm_f) from encode_lib_genomic import ( remove_read_g...
ae497b649756d3d71150b6cfbdba485615ba38d7889279645203c4d83cedc780
Python
4,813
149
"""Configurational CE example: H/F decoration of benzene. Six aromatic carbons form a fixed hexagonal scaffold; each of the 6 ortho positions is either H or F. This gives 2⁶ = 64 binary configurations σ. By C6v symmetry there are 13 unique necklaces (orbits under D6h): C6H6 (1) C6H5F (1) C6H4F2 — ortho, me...
4718f05b30538042083944ef27dc56eae86b8d460d27e5374d0632d5bdb61111
Python
4,814
120
#%% import glob import mne import pandas as pd import numpy as np from fooof import FOOOF from scipy.signal import welch workingpath = 'D:\\aperiod\\' segmentcode = [56, 63, 78] segment = ['baseline', 'training', 'stress'] segmentlength = [5, 5, 5] roi_channels = ['Fp1', 'Fp2', 'Fz', 'F4', 'F3', 'F8', 'F...
8e7831208e82c79f3d2a55fa7a87c1965d5cf131a8b373f44416d3711d7de1c2
Python
4,822
106
import numpy as np from wholeslidedata.samplers.callbacks import BatchCallback import time from batchgenerators.transforms.abstract_transforms import AbstractTransform, Compose from batchgenerators.transforms.color_transforms import BrightnessMultiplicativeTransform, \ ContrastAugmentationTransform, GammaTransform...
a0b92904d0f91682a3387e077ebf363d26f2180f850e79f9add8338452a50b50
Python
4,823
88
#!/usr/bin/env python3 """Tabela FINAL do controle de SOC: 12 CsBX3, nosoc de work2/ e soc de work3/. Por que tres rodadas (registrado para nao repetir): work/ conjunto FR `standard`: SOC certo, mas valencia menor que a de producao e o controle escalar falha (Ge 0,5-0,7 eV fora). Descartado. work2/ co...
3bcf1e01fb9393db937b56c78d81e2e74d733d0b9121002cf4f7613358e6834a
Python
4,824
94
""" Input: whitespace-delimited csv file with CHR, BP, A1, A2 and ID columns. Output: tab-separated csv file with two columns ID and UID, where ID column is taken from the input file, UID column is constructed as CHR:BP:AA1:AA2, where CHR and BP are from the input file, AA1 is min(A1, A2, A1_complementary, A2_compl...
508f1a51a3dbe4ecc6607bc9385254048b9a1a95e810652d4aefc16a6767f9a8
Python
4,825
168
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import Version from tests.console.commands.env.helpers import check_output_wrapper if TYPE_CHECKING: from pathlib import Path from cleo.testers.command_tester import CommandTester fr...
0a991d4d31b0f927578b66db5068cc4bb51e31516b7c1609b9094d3d58c029ee
Python
4,826
117
# coding=utf-8 # Copyright 2019 Facebook AI Research 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 copy of the Licens...
7b47bedb7c4b20068b3f32de7317432dffd0d8f1a1002700152f1e925ea895f4
Python
4,827
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. import unittest import numpy as np from fairseq.data.data_utils_fast import batch_by_size_fn, batch_by_size_vec class TestBatchBySize(unit...
9852de04f8fb384726721d0be6b195c36da92ca2f2a1ee226d980df40b9b979e
Python
4,827
118
# coding=utf-8 # Copyright 2019 Facebook AI Research 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 copy of the Licens...
f473a28a044d98cad1eba261b90f6b353be7ec61d4e584934c4def918bf6c870
Python
4,828
172
# 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 random import torch from torch.utils import benchmark from fairseq.modules.multihead_attention import MultiheadAtten...
8a517b3dd3c38b3631d5ddc270926a708e3c99596a18562818952b62a1ea03a0
Python
4,831
129
#!/usr/bin/env python3 import subprocess from pathlib import Path import polars as pl import argparse def main(): parser = argparse.ArgumentParser(description='Filter the scans to detected peptides only, also generate corresponding Identification.csv file') parser.add_argument('--mzXML_file', action='store', d...
270f76c76042adf9360d843bd22dbb5a84e3d559391e09bc0fc9a358f769a632
Python
4,832
132
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_mask_block_spec, get_value_or_laplacian_block_spec...
7739a3f0a24061579c5f9720d60163d7b67b09a246c802e217340e2f22a5c9fd
Python
4,832
127
# 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...
260890b368da82fe1ce87da129857dc049bb486f0f198f05e04c92a0027d9e66
Python
4,833
146
from __future__ import annotations import re from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import parse_constraint from poetry.installation.wheel_installer import WheelInstaller from poetry.utils._compat import WINDOWS from poetry.utils.env import Mock...
1073f52b6902865697643588d48df1d898e3481ce17dd01607a2b06074fc6ad8
Python
4,838
122
#!/usr/bin/env python3 """Trains up a simple regression model to match a bias model to an experiment. The transformation input file is a JSON file that names a solo model and gives the experimental data that it should be fit to. Note that it may occasionally be appropriate to chain several transformation models togeth...
dbd6178143b1e6984ab15f43d5bb262c287e389dbe784432c4759fff10ca0dda
Python
4,840
115
import numpy as np import io_mesh as io import subprocess import argparse import os import copy def calculate_area(surfname,fwhm, software="CIVET", subject="fsid",surf="pial",hemi="lh"): """calculate and smooth surface area using CIVET or freesurfer""" tmpdir='/tmp/' + str(np.random.randint(1000)) os.mkdir...
d136393ccefbf9c122fffabea74541f726f2ffb9c71921804e8ecfd57ea7a37c
Python
4,841
139
import numpy as np import pandas as pd import pytest from scipy import stats from sklearn.cross_decomposition import CCA from pgmpy.ci_tests import RoysLargestRoot from pgmpy.tests.test_ci_tests import _multivariate_fixtures pillai_data = _multivariate_fixtures.pillai_data skip_gh_actions = _multivariate_fixtures.ski...
0f84c8925a83268d80d211956c8962548395062ee99012d61c00036bc377b602
Python
4,845
139
import networkx as nx import numpy as np import pandas as pd from pgmpy.base import DAG, PDAG from pgmpy.metrics import BaseSupervisedMetric class AdjacencyConfusionMatrix(BaseSupervisedMetric): """ Computes confusion matrix based metrics for comparing causal graph skeletons. Treats edge presence/absenc...
f4d4caec5af48916c8fa19e105dd038ad7e6b6aedd0eedb78578c736c1704042
Python
4,845
164
import logging import os from pathlib import Path import numpy as np from skbase.utils.dependencies import _check_soft_dependencies logger = logging.getLogger("pgmpy") logger.addHandler(logging.NullHandler()) PGMPY_DATA_HOME = os.path.join(Path.home(), ".pgmpy") class Config: def __init__(self): """ ...
31fe228ce4f4ad38f73f2286043002ebf1d1f6546e07253609401e60d9319ace
Python
4,847
141
import SimpleITK as sitk import matplotlib.pyplot as plt import numpy as np # # Set of methods used for displaying the registration metric during the optimization. # # Callback invoked when the StartEvent happens, sets up our new data. def start_plot(): global metric_values, multires_iterations, ax, f...
9cbf47d2237bf05572eaf0f956b19808d054593f4a47b91eb6d3bae35317fdf3
Python
4,847
123
import warnings from itertools import cycle from scvi import settings from scvi.data import AnnDataManager from scvi.dataloaders import ConcatDataLoader class _ContrastiveIterator: """Iterator for background and target dataloader pair in contrastive analysis. Each iteration of this iterator returns a dictio...
f9520c1c427c41c1e6eaf797c866022f2efa0beb497d12bb7d102149f7f66fbb
Python
4,847
141
#!/usr/bin/env python3 """A little script that removes unhelpful warnings from program outputs. Can be used either in a pipe, as in ``cat log.out | filterProc`` or as a parent process as in ``filterProc trainSoloModel config.json``. In the second case, this program will capture both stdout and stderr. """ import os i...
ba0cacbfe5088593b64b2f3dfd2b5942bf236a2b6c1fd8a1686df26ffc855ae0
Python
4,848
137
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 7 16:44:30 2020 @author: bianca ---------------------------------------------- Decoding action predictions - Stimulus localiser Stimulus: gratings from main experiment (8° diameter, with annulus of 0.5°), static, duration 12s Fixation: duration 12...
d3900624db14e05e4bc60e863d1277d40ffb3b4fd72dfd2ae7654d2f1224672d
Python
4,849
131
import os import numpy as np import tifffile import cv2 import skimage as ski import matplotlib.pyplot as plt from tqdm import tqdm from segment_anything import sam_model_registry, SamAutomaticMaskGenerator import colorcet as cc from matplotlib.colors import LinearSegmentedColormap import argparse def setup_sam(dev...
1f46368d917fc8c066e57d05e30b36c45d3e582bebb0ba7be233bf65da3291f9
Python
4,853
93
#!/usr/bin/env python3 """Literature-standard pseudobulk for Kaufmann GSE144744: SUM of RAW INTEGER UMI COUNTS per biological sample x cell cluster (Crowell/muscat; Squair 2021). The GEO matrix is deposited log-normalised, but the raw counts are exactly recoverable because Seurat LogNormalize is invertible given each ...