sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
6d2625581fc7034d13fb897e47ab4f1bc5ef81e1726a1088748d7092bb9c39f9
Python
14,133
331
#!/usr/bin/env python # coding: utf-8 import os, sys import numpy as np import matplotlib.pyplot as plt from scipy.spatial.transform import Rotation as R from ast import literal_eval import meshio import open3d, cv2 from visualization import DepthMapOpen3D import json, codecs from skimage.transform import resize from ...
115bb45f5981270ffc70d211d7724994468e7e41dd23deba7a5a9047693c6d54
Python
14,138
293
# 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...
94f9c0f4df2c76b25c2d598ff97ff0e564040e14679ce0a75bb8fe20d05e1e30
Python
14,143
383
########################################################################################### # Implementation of different loss functions # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ################################################################################...
51cfb56973b5d10264a03eaea048697e2a1e2bb9fbc1586da35aa25b17675216
Python
14,144
421
from numpy import float32 import torch import torchvision from torch import Tensor, dropout, nn import torch.nn.functional as F import math import torchinfo from torchvision.models.feature_extraction import get_graph_node_names from torchvision.models.feature_extraction import create_feature_extractor import torchvisio...
ed46deca8f1a2801dab08410fc23ccecd23d677899c7b086cef0939d3c150376
Python
14,145
461
import numpy as np from nearl import commands np.random.seed(0) # For dummp data generation atom_nr = 300 frame_nr = 50 # For the settings of the grid dims = np.array([32, 32, 32], dtype=np.int32) spacing = 1.0 cutoff = 2.5 sigma = 1.0 def test_benchmark_frame_voxelize(benchmark): tmp_coords = np.random.norma...
916ca51087406d36d46da07017a8157efeffa44676e8cd8cb9040b224c906ae2
Python
14,146
463
import os import numpy as np from . import log, utils class _MissingExtension: """Stands in for an unbuilt extension so use-sites fail with a clear reason.""" def __init__(self, name, build_hint): self._name = name self._build_hint = build_hint def __getattr__(self, attr): rais...
1aa8b268672ce09b0319f44343c08c56bcbe55cf59e280ca5392761e8cd9e348
Python
14,156
296
# -*- coding: utf-8 -*- # encodermap/plot/jinja_template.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade # # Encodermap is free soft...
aa5e6fb213f2168caabd97ad11103634faaed2d9124d7a94d274ef79a23b9e06
Python
14,158
421
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Dataset slicing test module. Tests all ...
abeb7801352d7013e1146b07ad0c035862c227eb282f547f044caa6ef6f15680
Python
14,163
364
import decimal from functools import reduce import json from typing import Any, Dict, List, Optional, Tuple, Union from django.db import connection from catmaid.error import ClientError class StateMatchingError(ClientError): """Indicates that a state check wasn't successful""" def __init__(self, message, st...
eb37a1030e96690af802445625c09f3bd3e1984560f0c69247d9ea35de8fe71a
Python
14,172
351
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 16:28:47 2023 @author: george """ from qtpy.QtCore import * from qtpy.QtGui import * from qtpy.QtWidgets import * import numpy as np import pandas as pd import pyqtgraph as pg import os # import pyqtgraph modules for dockable windows from pyqtg...
b275c28fe9654ee4b2cc70c815906e88a3aacd977cedd2fb3b8beab6e3f6b9dc
Python
14,193
403
from typing import Any, Dict, List import numpy as np import pytest from hypothesis import given, settings, strategies from scipy import sparse import xgboost as xgb from xgboost.testing import ( IteratorForTest, make_batches, make_batches_sparse, make_categorical, make_ltr, make_sparse_regres...
9d21e0d1e94d28237348074ccf1844d2fb5e79ec0a817c5d7cd8f0a025efd82c
Python
14,195
354
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QHBoxLayout, QWidget, QPushButton, QAction, QFileDialog, QComboBox, QListWidget, QAbstractItemView, QSplitter, QApplication, QStyleFactory) from PyQt5.QtGui import (QPixmap, QPainter, QPen, QColor, QBrush, QFont, QIcon) from PyQt5.QtCore impo...
3c2d9ae632f88bc0289b107b30f1779fab80cbb164cf8f0530be23b866455113
Python
14,197
271
# 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...
c980ab0087a8cc1f56488ade7482cab6e760565f6904c3ba7eee0524bd5a319a
Python
14,201
425
import typing from typing import Any, Dict, List, Optional, Iterator, Tuple, Generator try: import duckdb except ImportError: duckdb = None from kgx.config import get_logger from kgx.source.source import Source from kgx.utils.kgx_utils import ( generate_uuid, generate_edge_key, sanitize_import, ...
1dbc1668cc2e3129ac581386351a47c181d4626d43534510630538c981e4a602
Python
14,204
407
from user.serializers import UserSerializer from mlcube.serializers import MlCubeSerializer from asset.serializers import AssetSerializer from model.serializers import ModelSerializer from dataset.serializers import DatasetFullSerializer from result.serializers import ModelResultSerializer from benchmark.serializers im...
d19b99ad67bd225bae6d811346ad11fc58de4af5b901505a8312e8231895943c
Python
14,214
403
import logging from fastapi import APIRouter, Depends, Form from fastapi.responses import HTMLResponse, JSONResponse from fastapi import Request from typing import Optional from medperf.commands.benchmark.submit import SubmitBenchmark from medperf.commands.execution.utils import filter_latest_executions impo...
3220b1e69a3e48166dc94805502ded7c3a2fcaa5be804eda42f0ba32c4dd3a9c
Python
14,219
376
import copy from collections.abc import Callable, MutableMapping, MutableSequence from functools import partial from typing import cast from cwl_utils.types import CWLObjectType, CWLOutputType from ruamel.yaml.comments import CommentedMap, CommentedSeq from schema_salad.exceptions import ValidationException from schem...
401a7c648873804deb67238ed9bafd7ae05a1c2c679099a43df54b259a62ab7d
Python
14,222
363
from torch.utils import data as data from torchvision.transforms.functional import normalize from basicsr.data.data_util import (paired_paths_from_folder, paired_DP_paths_from_folder, paired_paths_from_lmdb, pai...
7d54f00cbc39892de8b664ca33f25eb8b79662c3abef60af1f07cdd8531e033f
Python
14,222
286
import os import json import argparse import random import torch import torch.nn as nn import numpy as np from data import generate_datasets, get_pretrain_loaders, get_finetune_loaders from prompts import seps from models import get_model from pretrain import pretrain from finetune import finetune parser = argparse....
0ccf1d2ae9fb483273eae3fa63c86d0ae84823495f8cc80e88ac6d9762753dcd
Python
14,227
347
from mendeleev import element import matplotlib.cm as cm import matplotlib.patches as patches import matplotlib as mpl import matplotlib.ticker as ticker from sklearn.metrics import r2_score, mean_absolute_error from matplotlib.pyplot import MultipleLocator import numpy as np from collections import defaultdict import...
1a00869faf1ac98fb43aba6021fa333c9a697e41c416bcab8a281e237678977e
Python
14,242
458
"""Functions to create intermediate GM volumes for use in registration to the structural reference volume.""" import os import shutil from glob import glob import brainbuilder.utils.ants_nibabel as nib import numpy as np import pandas as pd from brainbuilder.align.align_2d import concatenate_sections_to_volume from br...
89f4112b948de49bd4fd966e13d0b8696393d36d943a1daef7665e7dc8b74d5e
Python
14,244
455
"""Tests for client-side source mount/unmount and fetch handler.""" import time import ase import numpy as np import pytest from ase.data import covalent_radii from zndraw.client import ZnDraw # --------------------------------------------------------------------------- # Helpers # ---------------------------------...
89a722b5fadc0e31ad2da55903cef20fbf122a68700477b9d7b6581fc4a6f9b3
Python
14,245
308
import numpy as np from collections import Counter, defaultdict from time import time import re from sklearn.base import clone as CLONE import warnings from sklearn.exceptions import ConvergenceWarning import sklearn.metrics as metrics # Imputation from sklearn.experimental import enable_iterative_imputer from sklearn...
cf33c272aadcd41f8a89e5e5785a516d4eeeb4fe8d0f90687f3b335383e73605
Python
14,267
331
# This module is to process different transcript state, and set information # for the transcript states, and finally get ready to run MCMC sampling. import sys import numpy as np from .sam_utils import load_samfile, fetch_reads from .bias_utils import FastaFile, BiasFile from .gtf_utils import Gene, Transcript def no...
c20e993925c5a52fa288d48d9d2309f82578a373f0e4e8b1730ea65df40894fd
Python
14,269
353
import gzip import json import logging import os import re import src.datahandlers.umls as umls from src.babel_utils import glom, read_identifier_file, write_compendium from src.categories import GENE from src.metadata.provenance import write_concord_metadata from src.prefixes import DICTYBASE, ENSEMBL, FLYBASE, HGNC,...
6dd279d6b9584372677dba7b7f7c8175374e420e8fd4e0d328c837e71d521022
Python
14,270
377
import logging import os import pandas as pd from medperf.entities.dataset import Dataset import medperf.config as config from medperf.entities.cube import Cube from medperf.utils import approval_prompt, dict_pretty_print from medperf.exceptions import ( CommunicationError, ExecutionError, InvalidArgumentEr...
f1c0eb2ccde5419c09d149461bae1ad78d67772f85b9089f4916da0798181452
Python
14,281
316
import tempfile import unittest from pathlib import Path import numpy as np import pandas as pd import bbb_state_transition_model as bbb class TestStateTransitionModel(unittest.TestCase): def test_file_fingerprint_is_portable_and_exact(self): with tempfile.TemporaryDirectory() as tmp: path =...
bb8d133385444273f1c086e4106adb73d86b27c555accd958cda577ae0731be8
Python
14,290
381
import pandas as pd from matplotlib import pyplot as plt import os import numpy as np def process_df(train_df, val_df, test_df, params): loss_metrics = [] acc_metrics = [] for group_idx in range(params['n_groups']): loss_metrics.append(f'avg_loss_group:{group_idx}') acc_metrics.append(f'av...
45e500f630f8fe564a3d98b0e22ce3f181c03b04ee50fe118ebce78eb1eaa8e5
Python
14,297
425
# pyre-strict import bisect import math from typing import List, Optional, Sequence, Union # pyre-ignore-all-errors[58] # handle optional __all__ = [ "ParamScheduler", "ConstantParamScheduler", "CosineParamScheduler", "ExponentialParamScheduler", "LinearParamScheduler", "CompositeParamSche...
9a7efd2f0c33b05e3eaf494aed7289e6bec24bd12d39ff6c552c5a59bd212a1d
Python
14,299
327
""" Iterative closest point algorithm This file contains an implementation of the iterative closest point algorithm. This algo registers two sets of points (3D coordinates) together. Adapted from: https://stackoverflow.com/questions/20120384/iterative-closest-point-icp-implementation-on-python NOTES ON ITK Transform...
61637cfeffbb1a8113f9fdfac749f37866fd27c2208f4d6d841c020a5b84c333
Python
14,303
406
from numpy import float32 import torchvision import torch from torch import Tensor, dropout, nn import torch.nn.functional as F import math import torchinfo from torchvision.models.feature_extraction import get_graph_node_names from torchvision.models.feature_extraction import create_feature_extractor import torchvisio...
3b8fbcddc7b5f413a31d2b19a0286e40080194ffd5dd7ca9087e07f582ac9243
Python
14,309
365
from collections import Counter import argparse import os import json import numpy as np from pathlib import Path from tqdm import tqdm from p_tqdm import p_map from scipy.stats import wasserstein_distance from pymatgen.core.structure import Structure from pymatgen.core.composition import Composition fro...
2592b46172557fe5b1be2b21d15169b0a8ee751c9f7f93aa8845e6c93bce341b
Python
14,312
404
from __future__ import annotations import csv from io import StringIO import logging import os import os.path as op from os.path import join as opj from pathlib import Path import stat from unittest.mock import patch import pytest from heudiconv import __version__ from heudiconv.bids import ( SCANS_FILE_FIELDS, ...
83d0024668835a1e2f37c014f60ff58dffffe82bc8589dfbb176dd6213844aba
Python
14,312
393
""" Qt widgets for manual labeling of images Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import logging from time import time from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import Navigati...
4083663305246cee21caae4419bc726616d26949439565fae19e9b8579ca2bf8
Python
14,330
362
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from pathlib import Path from typing import Dict, Any from ..logger import logger from hmmlearn import hmm import pickle import scipy import os def get_autosomal_chroms(config): """ Get autosomal chromosomes only (excl...
58f9d38ce56ac27014d3e503bddd5932e02ab9f00459594b5598dbf607c466e2
Python
14,330
314
import numpy as np from collections import Counter, defaultdict from time import time import re from sklearn.base import clone as CLONE import warnings from sklearn.exceptions import ConvergenceWarning import sklearn.metrics as metrics # Imputation from sklearn.experimental import enable_iterative_imputer from sklearn...
59058e007099da432bfedd9e6d77074ff0aa780873678371a2548f1e6c3ea9f1
Python
14,332
299
""" This scripts validates the graphTRIP VGAE representations on and independent dataset (psilodep1). Dependencies: - experiments/configs/psilodep1_finetuning.json Outputs: - outputs/validation/evaluate_graphtrip/ - outputs/validation/pretraining/ - outputs/validation/finetuning/ Author: Hanna M. Tolle Date: 2025-12...
2704502598dde115b55559bff8b56563a94eed5cdae4087ec8941a2a077f9972
Python
14,350
319
import torch import torch.nn.functional as F from torch.utils.data import TensorDataset, DataLoader import numpy as np from models import TSEncoder from models.losses import hierarchical_contrastive_loss from utils import take_per_row, split_with_nan, centerize_vary_length_series, torch_pad_nan import math class TS2Ve...
93eff5a66c7908be6e513cb2e868fa640ba9a3875a98f7f41d074cbf719e378d
Python
14,351
429
import torch import torch.cuda import glob import os from collections import namedtuple import pandas as pd import json from collections import * import random import diskcache from torch.utils.data import Dataset from torch.utils.data import DataLoader import numpy as np import cv2 import torchvision.transforms.functi...
59bbc6e962e2e626b4963111943f6c46056b1502d9762c494d043c1b1f3636fd
Python
14,360
375
import torch import torch.utils import torch.utils.data as data import torchaudio from torchvision import get_image_backend from transformers import BertTokenizerFast, BertModel from senticnet.senticnet import SenticNet from PIL import Image import random import json import os import functools import librosa import num...
6433ccc2df4cd955d84a650b0203784feb1ac96baf7351de2bed5332652458b6
Python
14,363
273
"""Mixin of contract tests for BaseRecordingExtractor subclasses.""" from pathlib import Path import h5py import numpy as np import pytest class RecordingExtractorTestMixin: """ Mixin of contract tests for BaseRecordingExtractor subclasses. Child test classes must define the following class-level attri...
c8b2f13a934b03136adfeaa06e0dd76264b6885fed1cbb9e9b1c9fb3c315a94d
Python
14,373
336
# -*- coding: utf-8 -*- import json import time from django.conf import settings from django.http import HttpResponse from django.shortcuts import get_object_or_404 from catmaid.models import * from catmaid.control.authentication import * from catmaid.control.common import * from catmaid.control.object import get_a...
e396f8e6575a1efaed0506124ffd2a787fc2deb833c711c41c6fdabc32cda3f2
Python
14,388
383
""" 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 math import os import torch try: from e3nn import o3 from e3nn.o3 import FromS2Grid, ToS2Grid # Borrowed...
aae5f7e75401e72217c57359992ce91ffa1560325fb5bb970bdebd29fabc599e
Python
14,400
401
import numpy as np import pandas as pd import random import re import pickle from rdkit import Chem import sys import time import torch from torch.utils.data import Dataset from .utils import Variable class Vocabulary(object): """A class for handling encoding/decoding from SMILES to an array of indices""" d...
d9d7dadd1b5c32c986bbce373e267254f41cb80fcff4b77251d2fa82c2d59e3c
Python
14,414
350
# Copyright (c) OpenMMLab. All rights reserved. from typing import List, Optional import torch.nn.functional as F from torch import Tensor from mmseg.registry import MODELS from mmseg.utils import (ConfigType, OptConfigType, OptMultiConfig, OptSampleList, SampleList, add_prefix) from .base im...
a4d65da19a7eceb24f26cd00fdbf5123f08202f5a8b1448ce7a2cd6edeac2674
Python
14,421
235
import sys sys.path.insert(0, ".") from sklearn import svm from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA from sklearn.metrics import f1_score import pandas as pd from .backend import DataInstance from typing import List import numpy as np import time class advanced: de...
0bb8562198dc6cdb04327330f5f0bc353aba200f6252e7abb0c7728f0d39823e
Python
14,428
474
from .trainer import Trainer, Trainer_r from .mixin import envMixin, scMixin import numpy as np import torch from torch_geometric.loader import ClusterData from torch_geometric.data import Data from sklearn.cluster import KMeans from typing import Optional, List, Tuple from anndata import AnnData import scanpy as sc c...
10f0aa1536733ccba634acb05a08bdd60309a407f39c7d0a404478b5cf676a54
Python
14,447
362
import numpy as np import pytest from guppy.utils.validation import ( validate_data_not_combined, validate_group_definitions, validate_group_folders_selected, validate_group_member_run_folders, validate_non_negative, validate_output_root_folder, validate_peak_windows, validate_positive,...
1c044eb4acb7b30c0ede9034658c9efdece107dc591266fb059fccd156a0e683
Python
14,449
354
import numpy as np import cv2 import sys import os import pickle import torch import torch.nn as nn import SimpleITK as sitk from torch import optim from torch.utils.data import DataLoader, Subset, Dataset from PIL import Image import random from albumentations import ( GridDistortion, ElasticTransform, Com...
330c5f35dba8cfd1dd29e65b9634527535aca55a8967c8b47f68b05d1c25b0b3
Python
14,456
258
# Jason Keller # Feb 2021 # ============================================================================= # Program to set BlackFly S camera settings and acquire frames from 2 synchronized cameras and # write them to a compressed video file. Based on FLIR Spinnaker API example code. I have # also tested with ...
4318e430fb1be5a7826d9079762f349801c447fe22558fb2241be6b4b03d3bf5
Python
14,470
341
from collections.abc import Iterable from textwrap import indent import pandas as pd import ujson from ..client import inject_client from ..utils import compile_columns, cypher_identifier from .neuroncriteria import neuroncriteria_args # Core set of columns CORE_NEURON_COLS = ['bodyId', 'instance', 'type', ...
7fa2d03ee54057aff86adc5ac9232ea2e74145dc017d97e5cc75fc7bcfff6d45
Python
14,473
355
import numpy as np import cv2 import sys import os import pickle import torch import torch.nn as nn import SimpleITK as sitk from torch import optim from torch.utils.data import DataLoader, Subset, Dataset from PIL import Image import random from albumentations import ( GridDistortion, ElasticTransform, Com...
d60b2d51cf6afce71ab275dddadbab3bd2706c37c8fbbb3823da5409640b22dc
Python
14,474
394
# /// script # requires-python = ">=3.10" # dependencies = [ # "matplotlib", # "numpy", # "scipy", # ] # /// """Generate SVG figures for the cross-correlation explanation page. The cross-correlation math (scipy.signal.correlate + per-trial peak normalisation) mirrors src/guppy/analysis/cross_correlation.py...
8505ec255536c362b4f14fe9175c6b99cc3b3a44ac13213cf239d37b95d5d13e
Python
14,483
543
from sys import stderr import pytest from kgx.validator import Validator @pytest.mark.parametrize("prefix", ["GO", "HP", "MONDO", "HGNC", "UniProtKB"]) def test_get_all_prefixes(prefix): """ Test get_all_prefixes in Validator. """ validator = Validator.get_the_validator() validator.clear_errors(...
290be4b9501e6a04ff2244b519fec5076e65dad9341742de248e41856705e96c
Python
14,491
327
"""Unit tests for the Biolink-prefix survival prediction in the source-impact report. ``prefix_survives`` mirrors ``NodeFactory.create_node``'s prefix filtering: an identifier whose prefix is not in the Biolink Model ``id_prefixes`` for its biolink type is dropped by ``write_compendium``. These tests exercise the pure...
a096daebaba803b945828d696126ada6c80d8c78307f7a63ffac435f7973afc9
Python
14,503
271
# 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...
55a82f5058f356d66b8f2b90064eda9186f4d5e58aa6ff8b2ff5aaef839e5b38
Python
14,510
332
import panel as pn import pytest from guppy.frontend.visualization_dashboard import VisualizationDashboard BASENAME = "test_session" EVENTS = ["event1", "event2"] class _FakeRange: def __init__(self, start, end): self.start = start self.end = end class _FakeFigure: def __init__(self): ...
b8a21e563d101e6a07b9ffbddaaf7b87f4b3ca3b05a75fcdb4d9b6454055a88c
Python
14,524
351
from __future__ import annotations from time import perf_counter from unittest.mock import patch import numpy as np from pymatgen.core import Structure from chgnet import ROOT from chgnet.graph import CrystalGraphConverter structure = Structure.from_file(f"{ROOT}/examples/mp-18767-LiMnO2.cif") converter = CrystalGr...
0e10d833b638f8448ec66cc79f48d8d6ff050732f865376d3b14e6495ddc3ab3
Python
14,529
422
import json import locale import os import pickle import tempfile from pathlib import Path from typing import List import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm def json_model(model_path: str, parameters: dict) -> dict: datasets = pytest.importorskip("sklearn.datasets"...
73383b6d651c38fdf929062851c9d45261c9e9ea05bde2ec4294c13211dee42e
Python
14,531
437
import logging import threading from typing import Optional from fastapi import APIRouter, Depends, Form, Request from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse from medperf.account_management import get_medperf_user_data from medperf.entities.certificate import Certificate from m...
b62f545c963fa2f4ea2905cad78b9ebd1a4dd17f49bfaf0d178db330475e82d7
Python
14,539
347
""" This script runs the first bit of code from our "Building Models" documentation and uses that to output SBML (very much work in progress; only a single compartment for now). The code for SBML output was lifted from SBML documentation. """ import libsbml from jaxkineticmodel.kinetic_mechanisms import JaxKineti...
096580e44fc86683af53027b550dd8cba5da37d08feed5f5c13dac4c3b832d6e
Python
14,544
423
from numpy import float32 import torch import torchvision from torch import Tensor, dropout, nn import torch.nn.functional as F import math import torchinfo from torchvision.models.feature_extraction import get_graph_node_names from torchvision.models.feature_extraction import create_feature_extractor import torchvisio...
fe7a7b20012bb745ad4bf7787fe7dd3f5a912ba72e973a8da8a3e55997fb017f
Python
14,545
424
""" 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 numpy as np import torch from torch_scatter import segment_coo, segment_csr from torch_sparse import SparseTensor def ragged_range(si...
665e7d2690f050e25a9906d40770069bcaa428786a8891b8c47792697415fa97
Python
14,552
384
import copy import math from typing import List, Optional import torch import torch.nn as nn from torch.nn import Linear from .radial_function import RadialFunction from .so3 import SO3_Embedding class SO2_m_Convolution(torch.nn.Module): """ SO(2) Conv: Perform an SO(2) convolution on features...
96e3d515d515bcde5286dd27053d5d5bb675fb3a031cfb1eb53e7d9f4c333410
Python
14,553
315
import pytest import src.prefixes as pref from src import categories from src.LabeledID import LabeledID from src.node import NodeFactory from src.util import get_config BIOLINK_VERSION = get_config()["biolink_version"] # Node schema (as of the current codebase): # {"identifiers": [{"identifier": CURIE, "label": s...
9994b217f259ab9be45610bfa3b71151bbecab77f4db9f4c76fca2d434e54667
Python
14,556
388
import cv2 cv2.setNumThreads(1) import numpy as np import torch from os import path as osp from torch.nn import functional as F from basicsr.data.transforms import mod_crop from basicsr.utils import img2tensor, scandir def read_img_seq(path, require_mod_crop=False, scale=1): """Read a sequence of images from a g...
df39a96493fe1e22037a04058114c74260f585475eb62c88e080cf5bbf9260be
Python
14,556
477
import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.optimize def difference(x,xref): """ help """ import numpy as np return 1/len(x)*np.sum([x[i]/xref[i] for i in range(len(xref))]) def compute_alpha(p,pref): """ help: courbe passe par 0 -> 1 """ return (p-pre...
daa48428d48060fbf1dfab478016758d1ad6b0183f4e3777a5d0e66c04ad7c11
Python
14,557
311
""" The ArrayData class reads and stores all replicates, annotation and combined data for an array library. Yuxi Ke, Feb 2022 """ from distutils.log import error from pickletools import float8 import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os from typing import Tup...
c830777eb4d36a26ade661b1afd2d886f8eb6ca37fd4b194d2c4f35b08c3aa13
Python
14,565
354
"""Unit tests for the panel that finds a dandiset on the DANDI Archive. Every network call it makes — the catalog search and the photometry verification that reads the listed dandisets' files — is a constructor injection point, so every test here runs against in-memory stand-ins with no archive access. """ from threa...
387911b66d01243c004c36ffc5285f5195a4f863ccf6a2cbc11a778f26541fef
Python
14,576
366
# Copyright (c) OpenMMLab. All rights reserved. import warnings from abc import ABCMeta, abstractmethod from typing import List, Tuple import torch import torch.nn as nn from mmengine.model import BaseModule from torch import Tensor from mmseg.registry import MODELS from mmseg.structures import build_pixel_sampler fr...
099f4a91e92b779d98b264df0503ee75e938550c1457669e329b43bb6950fa2e
Python
14,590
432
"""Tests for Screenshot REST API endpoints.""" import json from pathlib import Path import pytest from helpers import ( MockSioServer, auth_header, create_test_room, create_test_user_in_db, ) from httpx import AsyncClient from sqlalchemy.ext.asyncio import AsyncSession from zndraw.redis import RedisK...
9f7ff5f0d8d2bc7dadd756e88e07635a710f74b29926f81204652db9061689c7
Python
14,604
300
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Contributors: Micah Sheller, Patrick Foley, Brandon Edwards """ # TODO: Clean up imports import os import subprocess import shutil import time import pickle as pkl from copy import deepcopy import hashlib import yaml import numpy ...
e89bab953f2add3e4a3d6f19891089b8726b87670914f04bd097e7fb3d817d20
Python
14,605
261
# Jason Keller # September 2021 # ============================================================================= # Program to set BlackFly S camera settings and acquire frames from 2 synchronized cameras and # write them to a compressed video file. Based on FLIR Spinnaker API example code. This # example uses ...
cc2a33f458f7e549960d00eea9424465fae041555486d6f0658caebb2ee40135
Python
14,619
491
import argparse from pathlib import Path def convert_arg_line_to_args(arg_line): for arg in arg_line.split(): if not arg.strip(): continue if arg[0] == "#": break yield arg def parse_opts(): parser = argparse.ArgumentParser(fromfile_prefix_chars="@") parse...
ec20942c69f2ac75ac4a8b759a72fb3761cdc842ea829c92aca718746eb56ee1
Python
14,623
497
from typing import NamedTuple import pytest from cutadapt.align import ( EndSkip, Aligner, PrefixComparer, SuffixComparer, hamming_sphere, edit_environment, edit_distance, naive_edit_environment, slow_edit_environment, py_edit_environment, ) from cutadapt.adapters import Where ...
f91474dbb0223c31c435d535fc656c5758a0b8d708f3d3e21807982371252405
Python
14,630
430
"""Utilities related to disk I/O.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from collections import defaultdict import sys import contextlib import six try: import h5py HDF5_OBJECT_HEADER_LIMIT = 64512 except ImportError...
efe4bc3f09608239d0a8ef3770800d452c79813bff69ad2590a776bb99bb164b
Python
14,640
280
"""Primitives for diffing the cliques of two finished Babel compendium builds. This is a *build-vs-build* clique diff: given the same compendium file(s) from two different builds, it reports which cliques split, merged, or otherwise changed membership, and which CURIEs moved between cliques or left the output entirely...
66ef07febef66b2cbb8974deb8cef917a42fd58c7c3e22b533db7cac6e0431fa
Python
14,644
424
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Data fetchers """ import os.path as op from pathlib import Path import shutil import numpy as np from neuromaps import datasets, images import nibabel as nib from .utils import (get_data_dir, _groupby_match, get_dataset_info, _match_files) from ei...
7c1ddac2f7834379095a1e6634e79b35a55deafbdff6d10b92d5539dedee0f9e
Python
14,648
258
# coding=utf-8 # Copyright 2022 IDEA-CCNL The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
7074f5cc9912f7207521c1572aebbcb573e04f16bbfa85abb144f7733f3b79a7
Python
14,677
308
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
d306f9711195e1f4b1b733716b279a65c32c98466632f9f4a503cf9a675f4b99
Python
14,679
423
import os, sys import h5py import numpy as np import pytraj as pt from .. import utils from .. import printit, config __all__ = [ "Trajectory", "MisatoTraj", ] class Trajectory(pt.Trajectory): """ This class represents the base-class for trajectory handling in the Nearl package. This class inherits from...
ebacb5916f3e9d18417526bb636dda888b6c26e796186c1c08261cc2d8857501
Python
14,683
325
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Contributors: Micah Sheller, Patrick Foley, Brandon Edwards """ # TODO: Clean up imports import os import shutil from copy import deepcopy import numpy as np import torch from openfl.utilities import TensorKey from openfl.utiliti...
31384acc1d41e0df71f53e42c1f42f4ea2c25cffc6c06acb3f51dab4d575c818
Python
14,686
440
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ High-level access to HDF5 dataspace selectio...
cacc95b95b73f7d4054ebda1567461c7ad8204903e95064e779436450e75288d
Python
14,687
349
import torch import torch.nn.functional import numpy as np import matplotlib.pyplot as plt from . import modules # rvinn modules.py class Model(): def __init__(self, device, **kwargs): # data and collocation points self.device = device self.t_train = torch.tensor(kwargs.get('t_train'), req...
0f4d3afdf0a1c293ee2a019b2050a40aa5a74b15056710e547ecd748358e6d37
Python
14,692
262
# Jason Keller # Feb 2021 # ============================================================================= # Program to set BlackFly S camera settings and acquire frames from 2 synchronized cameras and # write them to a compressed video file. Based on FLIR Spinnaker API example code. I have # also tested with ...
28461af4e4255bd0accd0efdf5eb2b4462afd24515921c272d5ee97d72a76619
Python
14,696
447
#!/usr/bin/env python """ MeteWIBELE: prepare_uniref_annotation module Extract the annotation info from UniRef fasta file and UniProt annotation file Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen...
bee52bf32ea943510db806ef50c88adf3400d9d51928dd42d1dafdd29fbb08d5
Python
14,698
407
import os import colorsys import numpy as np import matplotlib as mpl import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from palettable.colorbrewer import qualitative from auditory_cortex import DNN_MODELS from utils_jgm.tikz_pgf_helpers import tpl_save class PlotterUtils: """Contains uti...
26e4b6ff69871b3dcef53a647ef4b1a21ff4f278abae93662328d7b4495ab344
Python
14,704
276
""" Tests for the manual UMLS semantic-type overrides used when building the leftover UMLS compendium (src/createcompendia/leftover_umls.py). These are marked ``network`` because they build a Biolink Model Toolkit, which fetches ``biolink-model.yaml`` from GitHub on first use (for the biolink_version pinned in config....
0698adc5e00495bd75d90caf9faf7d9d0bcb6c6e9354d0361e1de89137966011
Python
14,712
386
import os import tempfile from collections import namedtuple from typing import Tuple, Union import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm from xgboost.testing.callbacks import ( run_eta_decay, run_eta_decay_leaf_output, tree_methods_objs, ) # We use the dataset...
e837a4e5bf612930da7302b904ab09e8473cc86fa382ef7b9ad80bd77ef3a04d
Python
14,724
486
import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.optimize def difference(x,xref): """ help """ import numpy as np return 1/len(x)*np.sum([x[i]/xref[i] for i in range(len(xref))]) def compute_alpha(p,pref): """ help: courbe passe par 0 -> 1 """ return (p-pre...
25cefb37b07a8e102dcd9feb373d21ab78027e76f1033520e643b7a6e6048078
Python
14,737
339
############################################################################## # 1. Combine the protein-ligand to complex PDB file' # 2. Featurize the required PDB complexes ############################################################################## import os, time import h5py as h5 from itertools import chain impo...
f9061ae4781d2c613e3233b261f94e73c0165b77df26be512da7fa59a644ca54
Python
14,737
430
# This document holds the functions defined # by the user for the ease of computation # such as the solver settings # # Author: Thomas Lavigne # Date: 18/09/2024 # def readme_F(): print('This document holds the functions used as part of the poro-mechanical modelling of living tissues according to the theory in ./The...
dd114f0f40f5c7f8a9d0cbf6d5564ad665fedcaa83636f92192fadfa139b38e0
Python
14,740
323
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import warnings from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from transformers.tokenization_utils import PreTrainedTokenizer from transformers.utils import logging SPIECE_UNDERLINE = "▁"...
f990fdbcff7d22e1a456169c5dd41f0c3ebed7036606bc8e341598c0155b82e9
Python
14,741
395
# Copyright (c) OpenMMLab. All rights reserved. # ------------------------------------------------------------------------------ # Adapted from https://github.com/wl-zhao/VPD/blob/main/vpd/models.py # Original licence: MIT License # ------------------------------------------------------------------------------ import ...
2cc84dc9a9aff277686c5314befad092fc8814d680ca9d1fc442e079fa6a87f5
Python
14,745
415
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 8 11:04:24 2023 @author: schwab """ from pathlib import Path from typing import Optional import mrcfile import numpy as np import torch from torch.utils.data import DataLoader import torch.nn.functional as F from scipy.spatial import KDTree from d...
6461d2bc359dbe1f6edbdf399e11b577a4f23be085a9cac50eb800b2ef0989ad
Python
14,751
333
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 15:40:06 2023 @author: george """ from qtpy.QtCore import * from qtpy.QtGui import * from qtpy.QtWidgets import * import numpy as np import pandas as pd import pyqtgraph as pg import os # import pyqtgraph modules for dockable windows from pyqtg...
0dc016c0a13758a4e6c2f9221fae2cecc633e28030948ec1795d1f0ed0ae4463
Python
14,764
378
import logging import os import torch from collections import OrderedDict from copy import deepcopy from torch.nn.parallel import DataParallel, DistributedDataParallel from basicsr.models import lr_scheduler as lr_scheduler from basicsr.utils.dist_util import master_only logger = logging.getLogger('basicsr') class ...
3cf210b3b3b898b123d4e1c27fe02c2c066d52dafbca1acba504297e2ca5031d
Python
14,766
316
""" This module contains miscellaneous functions borrowed from the taffi package that are useful for yarp. """ import numpy as np from scipy.spatial.distance import cdist from copy import copy,deepcopy from ReactBench.utils.properties import el_radii,el_max_bonds def table_generator(elements,geometry,scale_factor=1...
89ee9d2eef4f751de0ebd5246c0be8ad6dfd9442b8ab0885aa1b63b5d3f76614
Python
14,783
416
import os import torch import numpy as np import csv import jiwer import soundfile import scipy # from pydub import AudioSegment import pandas as pd import torchaudio from auditory_cortex.deprecated.dataloader import DataLoader data_dir = '/scratch/gilbreth/ahmedb/data/' # voxpopuli: /scratch/gilbreth/ahmedb/data/v...
e72400f145726c95db6548d3a97f9e02e95d220b0a06931ec9bb68d386b145f0
Python
14,794
362
from mendeleev import element import matplotlib.cm as cm import matplotlib.patches as patches import matplotlib as mpl import matplotlib.ticker as ticker from sklearn.metrics import r2_score, mean_absolute_error from matplotlib.pyplot import MultipleLocator import numpy as np from collections import defaultdict import...