sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
664113d0df987c01fdb6a305b0d3a5d47d5c85cefc0ec4cb7ef61a65d35bc2f1 | Python | 4,338 | 110 | import networkx as nx
from template_generation_utils import read_csv_to_dict, generate_dendrogram_tree
def nomenclature_2_nodes_n_edges(taxonomy_file_path):
out = dict()
out['nodes'] = []
out['edges'] = set()
child_cell_sets = list()
headers, nomenclature_records = read_csv_to_dict(taxonomy_file_... |
c8bed844df71404ceebc339dbea1affa1e5786f0c005e29ea68cb506493fbf59 | Python | 4,339 | 89 | """
Train models on synthetic data.
"""
import os, h5py
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from gradient_correction import helper, model_zoo
#------------------------------------------------------------------------
num_trials = 50
model_names = ['cnn_deep', 'c... |
5e731f065cdc24a7befdc667d9e76b4b3c890aab3e94f935c3ab344b80c299cf | Python | 4,341 | 89 | #!/usr/bin/env python3
from pathlib import Path
import rdflib
from pyontutils.core import makeGraph
from pyontutils.utils import relative_path
from pyontutils.namespaces import makePrefixes, TEMP
from pyontutils.namespaces import rdf, rdfs, owl
from neurondm import *
from neurondm.lang import *
from neurondm.core impor... |
0afb1599a2702f201d946fe888b323aa8120739884c9853119672cd120128c5b | Python | 4,342 | 114 |
def plot_SAC():
#fig, ax = plt.subplots(len(pattern_list)+1, 3)
fig = plt.figure()
gs_outer = gridspec.GridSpec(4, 1) # 4 rows, one column
gs_inner = []
ax = {}
for i, outer in enumerate(gs_outer):
gs_inner.append(gridspec.GridSpecFromSubplotSpec(4, 4, subplot_spec=outer))
ax... |
788e34bbb5d72cb52d163c3f4eef462fc22f3da8a276f183a232b257d3c16d8a | Python | 4,344 | 130 | # Copyright 2026 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... |
8a6abf7e901185a03b3cd3f11efcd11600a30c8d4161773d8464b16538c10ac1 | Python | 4,344 | 129 |
import numpy as np
from matplotlib.colors import to_rgba
from matplotlib.text import Text as MPLText
from numpy.testing import assert_array_almost_equal
from seaborn._core.plot import Plot
from seaborn._marks.text import Text
class TestText:
def get_texts(self, ax):
if ax.texts:
return lis... |
a3e7c6723baa463e3388c853bd6171ac51e2738fa412d4183a31a4a2300b8efc | Python | 4,344 | 119 | """Classifier Experiments: code to run experiments as an alternative to orchestration.
This file is configured for runs of the main method with command line arguments, or for
single debugging runs. Results are written in a standard results format.
"""
__author__ = ["TonyBagnall"]
import os
import sys
os.environ["MK... |
519b694a3f30a899e41936345a2fbb6b9ea9c5809dc6c66a6de97a32caaa5175 | Python | 4,345 | 135 | """
Parameters:
---------
ndl: vertex neighbors from {h}.pial.neighbor.asc file
nb: number of neighbors from {h}.pial.neighbor.asc file
a: Surface area at each vertex read from {h}.pial.area.asc file
Returns:
-------
{h}.pial.H.asc: Mean curvature (H) at each vertex saved to {h}.pial.H.asc file, the for... |
a1215ec8eae6848792a556c6ada62e2e3f41b9603a19a3f602c522677405de92 | Python | 4,354 | 107 | """
@file: next_vit_official.py
Created on 11.08.22
@project: CrazyAra
@author: queensgambit
# Based on official NextViT code (Copyright (c) ByteDance Inc. All rights reserved.)
https://github.com/bytedance/Next-ViT/blob/main/classification/nextvit.py
"""
from torch import nn
from DeepCrazyhouse.src.domain.variants.co... |
abb8c17c97635c3723e60d8fd7989f07e2eaf244ed044cd8df15d8700bb72444 | Python | 4,355 | 118 | import tomopy
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
SAVE_AS_PNG = FALSE
def plot_two(img1, img2, figsize=(10, 6), titles=['', ''],
cmap=plt.cm.gray):
ax1 = plt.figure(figsize=figsize)
ax1 = plt.subplot(121)
ax1.imshow(img1, cmap=cmap)
ax1.set... |
dd4c8325b49e8444c69c2ace02888482fea7fb0578b625d2941e69e4dd1b8d2f | Python | 4,355 | 109 | # Copyright (c) OpenMMLab. All rights reserved.
import bisect
import math
from collections import defaultdict
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
from mmcls.datasets import (BaseDataset, ClassBalancedDataset, ConcatDataset,
RepeatDataset)
@patch.mu... |
381d3be781413e1d065cfb886a1c7ede521680dfd7155470a5ae356c32b0def3 | Python | 4,356 | 110 | import argparse
from biom import load_table
import pandas as pd
import numpy as np
from multiprocessing import Pool
from q2_matchmaker._stan import merge_inferences
from q2_matchmaker._stan import _case_control_single
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'... |
da17381c63c22991053ea4679dd191a4f5b27d8da2546037b1a2f23a4f2ef1e8 | Python | 4,356 | 116 | # Copyright 2019 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... |
81f0536ff58957ccd37b34a74400644d722634c175e44eb137a62435b88241bc | Python | 4,357 | 106 | """
Script to plot paper figure panels from reticulospinal backfill analysis file generated via rspinal_build_main.py
"""
import argparse
import os
from os import path
from typing import Any
import h5py
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as pl
from pandas import DataFrame
import rspi... |
1e906959f896f6eb84a045bdd62a7f9f8a950bd9652ab3f465443d09548abdf6 | Python | 4,360 | 135 | from __future__ import division
import numpy as np
import pandas as pd
import pylab as plt
from helper_lib import filelib
from SPHARM.classes.ellipsoid import Ellipsoid
def plot_heatmaps(size, rotation, gridsize, path, value='power', cutoff=None, normalize=False, ri=False):
filelib.make_folders([path + 'heatma... |
20f4fc397b84fb83c1eb4677ab77ca4408926aeb66cbff2d74efd183bfcee7ea | Python | 4,360 | 115 | import pytest
from flair.data import Dictionary, Sentence
from flair.embeddings import FlairEmbeddings, TokenEmbeddings
from flair.models import LanguageModel
from flair.trainers.language_model_trainer import LanguageModelTrainer, TextCorpus
@pytest.mark.integration()
def test_train_language_model(results_base_path,... |
fdbb42edaf800eddef2d0488f250c947f0a3cba776256b5d1131b66d3313d417 | Python | 4,363 | 125 | # Copyright 2019 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... |
f73005d6a18ab6f8a792d2de2c84eafe128e6551f49a60c57a5430dfb9ac8230 | Python | 4,364 | 139 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
from functools import partial
import mmcv
import numpy as np
import torch
from mmcv.runner import load_checkpoint
from torch import nn
from mmcls.models import build_classifier
torch.manual_seed(3)
def _demo_mm_inputs(i... |
adcfd9c959eb4c22c49948a57caab2420d81d761a72555aed11ccc6096f5af40 | Python | 4,366 | 141 | """
Utility functions for computing far-context statistics.
Used in data pipeline (numpy) before data enters the model.
Features must match ContextStatisticsExtractor exactly (same order, same semantics).
"""
import numpy as np
def _autocorr_numpy(z, lag):
"""Compute autocorrelation at a specific lag for z-score... |
c9d984da25c24269bf062ca322f389e02c05a423506265ce9e8acc0421f7ddf1 | Python | 4,367 | 125 | # Copyright 2019 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... |
05bb8e3a0d137ed8c86c2b63811d9802c211b70545cf57d5c79ebdbc5659afd2 | Python | 4,368 | 166 | # Mocapy: A parallelized Dynamic Bayesian Network toolkit
#
# Copyright (C) 2004 Thomas Hamelryck
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... |
98649132df1aee81d85adc6a1572fe952993ecfb5405b03ef1f7005a9593139a | Python | 4,369 | 132 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.datatypes._adapter.gluonts import (
convert_pandas_collection_to_pandasDataset,
convert_pandas_dataframe_to_pandasDataset,
convert_pandas_multiindex_to_pandasDataset,
convert_... |
85e102e9dff8fa488c8cd20ec0f3b6271b33a9ebf5fb7f9a6a2b0fb527db40fa | Python | 4,370 | 139 | import argparse
import logging
from pathlib import Path
import torch
import numpy as np
from utils.jet_analysis import get_ROC_AUC, anomaly_scores_sig_bkg
from utils.utils import get_eps
def main(args: argparse.Namespace) -> None:
# background
bkg_type = args.bkg_type
bkg_path = Path(args.bkg_dir)
bkg... |
674f0c3203c01cbf655ea25f5df76ab0a3e21ec7dca5e5fe251138176f00e000 | Python | 4,373 | 100 | import logging
import torch
import torch.nn as nn
from onmt.encoders import TransformerEncoder
from onmt.modules.embeddings import Embeddings as ONMTEmbeddings
from rxnebm.model import model_utils
from typing import Dict, Optional
Tensor = torch.tensor
def sequence_mask(lengths, maxlen: int):
"""https://discuss.p... |
27839e8857691aac5650135b0633ced9de17c9b07ac24a370d6c71843ed52b89 | Python | 4,374 | 123 | import unittest
import qiime2
from q2_matchmaker._method import (
negative_binomial_case_control,
matching)
from q2_matchmaker._stan import _case_control_sim
import biom
import numpy as np
import pandas as pd
import pandas.util.testing as pdt
class TestMatching(unittest.TestCase):
def setUp(self):
... |
7157cceda184aaa898b4187beb5fb4f8dd49041cf1ef64eaad101ba369376eea | Python | 4,375 | 132 | import numpy as np
import time
from ..geometry import *
from ..tensor import WritableTensorData as WTD
from ..tensor import WritableTensorDataWithMask as WTDM
def prepare_outputs(spec, locs, blend=False, blend_mode=''):
if blend_mode not in ['','bump']:
raise RuntimeError('unknown output blend type [%s]'... |
47646ae1486663273e566c03a51755b65ee25f9a866804ecabc2ff0b90cf898d | Python | 4,377 | 140 | # Author: Behrad Soleimani <behrad@umd.edu>
# Author: Proloy Das <proloy@umd.edu>
"Deviance calculation"
import numpy as np
import warnings
from scipy import linalg
from .opt.m_step import calculate_ss
def sample_path_bias(q, a, x_bar, zeroed_index, n_eigenmodes):
"""Computes the bias in the deviance
Param... |
7e3d2ca221342c5afc20576188360e40b996977eb064c67fdab875112a3157cb | Python | 4,377 | 87 | import tensorflow as tf
from tensorflow.contrib import distributions as distr
class NTNDecoder(object):
def __init__(self, config, is_train):
self.batch_size = config.batch_size # batch size
self.max_length = config.max_length # input sequence length (number of cities)
self.input_di... |
15b6c9b828c30e26749790cfa26c1d21b019dc7e841fe3af7c2ed71a9d64a495 | Python | 4,378 | 100 | """Test suite for clustering algorithms."""
import numpy as np
import pytest
from sktime.datatypes import check_is_scitype
from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester
from sktime.utils._testing.scenarios_clustering import ClustererFitPredictMultivariate
class ClustererFixtureGener... |
0b8dbf153b65dd6bf669654917ebc9132dcd7d0153d09875e9fa9c5d052a2d60 | Python | 4,382 | 116 | from mayavi import mlab
import matplotlib as mpl
import pandas as pd
import numpy as np
import os
import nrrd
def _scalar2rgb(v, vmin, vmax, cmap="jet"):
cmap = mpl.cm.get_cmap(cmap)
v = (v - vmin) / (vmax - vmin)
v = np.clip(v, 0, 1)
return cmap(v)
def render_probes_on_surface(df, samples, column, at... |
39a040f24e61cb8b314315513804be0189d25dc925b700bf14fef73c4798649e | Python | 4,382 | 131 | """Isolated numba imports for _twe."""
__author__ = ["chrisholder", "TonyBagnall"]
import warnings
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba.core.errors import Numb... |
6ef9e2bd8414a6378c1575e89d6d530b3ea383889a059e5d1f2dedb295ea26d1 | Python | 4,383 | 99 | from multiprocessing import Pool,Manager
import data_adapter
import numpy as np
from scipy import io as sio
from scipy import signal
import time
import signal_tools
import random
def get_amp_band(pac,ch,pha_band):
res_f = []
for k in pha_band.keys():
tar_sig= pac[k][ch].mean(axis=1)
amp_f = []
... |
b26456f878c580cfec5621e106593e1c14891eb7c8cc1df92dcb5dfb2ca3a1fb | Python | 4,386 | 144 | from argparse import Namespace
import argparse
from pathlib import Path
import torch
import os.path as osp
from utils.utils import get_model_folder, get_best_epoch
from utils.argparse_utils import (
parse_data_settings,
parse_eval_settings,
parse_model_settings,
parse_training_settings,
)
from utils.ini... |
398500f7c0130aaa46db8caa08126d62e3600832578dde5bcd42208fd49c11c3 | Python | 4,388 | 100 | """
@file: _PlayerAgent
Created on 14.10.18
@project: crazy_ara_refactor
@author: queensgambit
Abstract class for defining a playing agent.
"""
from abc import ABC, abstractmethod
from copy import deepcopy
import numpy as np
from DeepCrazyhouse.src.domain.abstract_cls.abs_game_state import AbsGameState
class AbsAgen... |
977286f73d97911c8b04278b9ad499d7f643d5d1986c80053dcc546bf78cc16f | Python | 4,388 | 106 | import time
import pickle
from os import listdir
from random import shuffle
from parameterSetup import ParameterSetup
import timeFormatting
class DummyReadDAQServer:
def __init__(self, client, fileID, recordWaves, channelNum, offsetWindowID, sleepTime,
sampRate=128, numEpoch=600000, eeg_std=None, ... |
f937fbdb860db48271c72ca2a6034aefbcf4e031401f1c01ba67b63e3c963997 | Python | 4,389 | 100 | #!/usr/bin/env python3
import rdflib
import ontquery
from neurondm.lang import *
from neurondm import *
from pyontutils.core import OntId, OntTerm
from pyontutils.utils import relative_path
from pyontutils.namespaces import makePrefixes, makeNamespaces, OntCuries
from pyontutils.namespaces import interlex_namespace, PR... |
3a17ad37d807455d94780ed44e0ebee246e6864ae5b3e648631bc64015f35683 | Python | 4,394 | 131 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import warnings
import mmcv
from mmcv import DictAction
from mmcls.datasets import build_dataset
from mmcls.models import build_classifier
def parse_args():
parser = argparse.ArgumentParser(
description='MMCls evaluate... |
b45d6a03ba8fa30f2b28211e29d57cfc5b86b870d6baa8ec8a5b930ffb4e2404 | Python | 4,397 | 153 | import torch
from torch.utils.data import Dataset, DataLoader
from pathlib import Path
from scipy.io import loadmat
import copy
import mri_utils
from fft_utils import numpy_2_complex
import numpy as np
DEFAULT_OPTS = {'root_dir':'data/knee',
'name':'coronal_pd',
'patients':[1,2,3,4,5,6,7,8,9,10],
... |
c6dc116df81f7891c906f6c2bd7b9739d4a672e412aea11c9f81fd4cfd3d1468 | Python | 4,400 | 147 | # Copyright 2026 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... |
0d3f4f10ee5910ab59da0bf34c4f56881ccba7f3af98399cfec843dc25d7a960 | Python | 4,403 | 119 | # Copyright 2019-2020 The ASReview Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
3c5d81c73d6a7b8750c181621d6ebf96140e71db92365ca627f5f142816a73f3 | Python | 4,404 | 96 | import os
import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
mpl.rcParams['font.family'] = 'Arial'
mpl.rcParams.update({'font.size': 24})
cmap = mpl.cm.get_cmap('tab20')
# df... |
50784389a1b4efdec030fa3bc5b52bb1cdb75ca6bb46bdac3b06814a59faf9f1 | Python | 4,405 | 122 | # Copyright (c) OpenMMLab. All rights reserved.
import math
from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner import Sequential
from ..builder import HEADS
from .cl... |
a6addb910a4e458bff9209654c04b697ec5a383952f0616dc1516d7e3fc96213 | Python | 4,406 | 133 | import time
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
from enum import Enum
from typing import Any, Optional, Union
RecordType = Enum("RecordType", ["scalar", "image", "histogram", "string", "scalar_list"])
class MetricName:
def __init__(self, name) -> None:
self.pa... |
b068dadccfb5b6e2a9d9cabb56b8d49bd0c0b0e0d5f273928def751d86fdd7f3 | Python | 4,406 | 110 | from typing import List, Optional
import torch
import torch.nn as nn
from rxnebm.model import model_utils
Tensor = torch.Tensor
class FeedforwardEBM(nn.Module):
"""
Only supports
sep: takes as input a tuple (reactants_fp, product_fp)
hidden_sizes : List[int]
list of hidden layer sizes fo... |
3ffce0f5a8cea483ed2a796365699736a3082e62bbbd3aae9e6a830535e24a5f | Python | 4,407 | 165 | import time
import matplotlib
import matplotlib.pyplot as plt
from subprocess import Popen
import csv
import numpy as np
import random
import RPi.GPIO as GPIO # import RPi.GPIO module
from time import sleep # lets us have a delay
import gc
from gpiozero import LED
import sys
from array import *
import os
gc.disable(... |
1c8509bbaada42e546d8f50be48b40c8c73415feff66c20c81900653ed0688cb | Python | 4,409 | 118 | # Copyright 2026 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... |
d3a524387f825e25612d0a2597e8372a889cd67a632dd321cfb35681c7f482e1 | Python | 4,412 | 125 | # Copyright 2026 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... |
b8eab4fa0f8714e64d8db0d9cb7be70ea9872a824013489f43754dc09f5b609b | Python | 4,414 | 112 | #!/usr/bin/env python
from __future__ import print_function
import sys,os
import argparse
import logging
import shutil
desc = 'symlinking genomes fasta files'
epi = """DESCRIPTION:
"""
parser = argparse.ArgumentParser(description=desc,
epilog=epi,
form... |
caba852627be072aceffcc81a4b81726f6b47da1fd8c405f6b0ebe761962e745 | Python | 4,414 | 141 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
d8f711f5373e1d43805e43d2c265966047df4f488f6a8b33f91f02763566c0c9 | Python | 4,415 | 136 | #!/usr/bin/env python3
"""map ids
Usage:
map-identifiers [options] [methods npokb]
Options:
-h --help print this
"""
# equivalent indexed as default
# equivalent indexed in map only
import augpathlib as aug
from pyontutils import clifun as clif
from pyontutils.core import OntGraph, OntResGit
from pyontuti... |
07970b903541703dcbfffc9dce825f084a4cd365be6948fab526c72759ebc529 | Python | 4,416 | 129 | from graynet import config_graynet as cfg
from graynet.domain import RunConfig
from graynet.pipeline import run
__all__ = ["extract", "extract_multiedge", "roiwise_stats_indiv"]
def extract(
subject_id_list,
input_dir,
base_feature=cfg.default_feature_single_edge,
weight_method_list=cfg.default_weigh... |
b5ab562061eb2410e5bf55995a6d231f72139ae57a68814e126bb0d30265edbf | Python | 4,416 | 100 | """
make_figure.py -- main paper figure: the pass@k crossover story.
Panel A: a SINGLE crossing (the canonical RLVR inversion; order-preserving case,
= Yang & Chen 2609.22547). RL wins pass@1, loses large-k.
Panel B: a DOUBLE crossing (S-(G)=2), crossings decades apart, clearly visible.
Multiple cros... |
d99ccad24ffe064117ccb5440a4876bc1cacc75db57a9233b7e03cc989ac530a | Python | 4,417 | 135 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_adam(
r,... |
a67821fe5118222c5f1d2e512293dc0c28a7c8c299e1b89812e61f6277dcb2d1 | Python | 4,419 | 142 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import numpy as np
def get_GiB(x: int):
"""return x GiB."""
return x * (1 << 30)
def onnx2tensorrt(onnx_file,
trt_file,
input_shape,
max_batch_size,
... |
bac1b5fc37e19e534405c1d5df201f547216ddd81ab5b3647531bee77dbc439e | Python | 4,421 | 136 | #!/usr/bin/env python3
"""map ids
Usage:
map-identifiers [options] [methods npokb]
Options:
-h --help print this
"""
# equivalent indexed as default
# equivalent indexed in map only
import augpathlib as aug
from pyontutils import clifun as clif
from pyontutils.core import OntGraph, OntResGit
from pyontuti... |
bcf0394865719f7af61e545f94237615e5155a6db63a125323f5167a2943cbf0 | Python | 4,421 | 150 | import numpy as np
import pandas as pd
import atom3d.util.vectors as vec
import itertools
import operator
class dotdict(dict):
""" dot.notation access to dictionary attributes """
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def get_center(pos):
""" Retur... |
6383d6ed706bd257e8821a797ed6589256279b7970472435d4e3bc74c2d397db | Python | 4,423 | 146 | import math
import numpy as np
from . import blend
from ..geometry import *
class ForwardScanner(object):
"""
Forward scanner.
"""
def __init__(self, dataset, scan_spec, **params):
self._init()
self.dataset = dataset
self.scan_spec = dict(scan_spec)
self.params = param... |
783193133b3dc66b4bd54b1af25f96383b31656e5278eab7b8b18e6e0439eb67 | Python | 4,424 | 90 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Find the center-lines of a set of of contours.
The center-line o... |
df6d223dfbfb881824707f8f955f034b60f20fb3b7ff8baca2100d6c2d55bb07 | Python | 4,427 | 94 | """
diagnostic.py -- the reusable artifact (FORM): read-off tool for pass@k curves.
Given a base model's and an RL model's pass@k curves (or their per-prompt success
distributions), report:
- the number of crossings and their locations k*,
- the inferred REGIME:
0 crossings -> no inversion (RL dominates... |
77a6a9c3df8079c967609b8ed89318f6089a9ee76b593a3804a2bd03a4c55f50 | Python | 4,428 | 133 | """Random Interval Spectral Ensemble (RISE)."""
__author__ = ["TonyBagnall"]
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import jit
if _check_soft_dependencies("numba", severity="none"):
from numba import int64, prange
@jit(parallel=True, cach... |
7ca56793b320bdc316b28e4ba2a221d1fa4e66a24de075f9c57f3907c1faf057 | Python | 4,428 | 159 | """Continuous interval tree (CIT) vector classifier (aka Time Series Tree).
Continuous Interval Tree aka Time Series Tree, base classifier originally used in the
time series forest interval based classification algorithm. Fits sklearn conventions.
"""
__author__ = ["MatthewMiddlehurst"]
import math
import numpy as ... |
c3551f3cb3b5686a881f85ff794910f64f75f391e5ac90a7d030a159a42a5259 | Python | 4,428 | 125 | import logging
import click
import random
from typing import List
import pandas as pd
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from src.definitions import REPO_ROOT, PROCESSED_DATA_DIR
from src.data.data_loader import RepeatedStratifiedKFoldDataloader
from src.models.base import ModelIt... |
ffddeaf26a87b6608a849a59f0d02d15cb8b39e24160ed5319a415a1e8e75fd3 | Python | 4,428 | 148 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class StringNormalizer(Base):
@staticmethod
def export_nostopwords_n... |
7b800dfcf90c5705950f50f5f027a876222f32917c5cc4625e078a9c03263c1a | Python | 4,430 | 200 | import numpy as np
import pandas as pd
import pytest
@pytest.fixture(autouse=True)
def close_figs():
yield
import matplotlib.pyplot as plt
plt.close("all")
@pytest.fixture(autouse=True)
def random_seed():
seed = sum(map(ord, "seaborn random global"))
np.random.seed(seed)
@pytest.fixture()
def... |
120b3ca33242da7d4f7c5237e9576b812c2ebb4dbbfdb6b6526bd5282905a40f | Python | 4,431 | 149 | #!/usr/bin/env python
__doc__ = """
Learning Monitor
Nicholas Turner <nturner@cs.princeton.edu>, 2017
Jingpeng Wu <jingpeng.wu@gmail.com>,
Kisuk Lee <kisuklee@mit.edu>, 2015-2017
"""
import os
import h5py
class LearningMonitor:
"""
LearningMonitor - a record keeping class for training
neural networks, i... |
b6cffb23789f53a4d31714c21f0e8d5a528090723142a224b211486ab4064142 | Python | 4,431 | 144 | from pathlib import Path, PosixPath
from typing import Generator
import onnxruntime as ort
from omegaconf.dictconfig import DictConfig
from omegaconf.listconfig import ListConfig
# If DeepSparse is installed, import it
try:
import deepsparse
DEEPSPARSE_AVAILABLE = True
except ImportError:
DEEPSPARSE_AVAIL... |
f15519a937c5b781cc5ffd3fc040aeda2db91c127ba9d1144bce921508f36beb | Python | 4,432 | 138 | """
Debugging utilities for constructs
"""
from __future__ import annotations
import inspect
import pdb # noqa: T100 - debugger integration is this module's purpose
import sys
import traceback
from typing import IO, Any
from .core import Construct, Subconstruct
from .lib import Container, HexString, ListContainer
... |
7a6c7d5b19fc87e425267a1f5d348e849c7d78c8af596c32a95ff5d3afe34a99 | Python | 4,433 | 118 | from IPython.core.debugger import set_trace
from math import *
import numpy as np
from findiff import FinDiff, coefficients
########################################################
"""
Some basic arguments needed for any testcase
"""
class solver_arguments():
def __init__(self, T, nt, x_left = -1, x_right = 1, ... |
78d8612f94e3fd98b232f52cebf404b98d643f3cd28436a9e903a2b862b7b779 | Python | 4,434 | 146 | import torch
import torch.nn as nn
from torchvision import datasets
from torchvision import transforms
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
import sys
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_width, stride=1, pool_size=0):
... |
2082cd273075ec3316f26f8255f4624ebc8a72ccbde2bf1e2f018d7f1801898b | Python | 4,435 | 119 | import colorsys
import math
import numpy as np
import pandas as pd
from figures.util import get_subplots, plot_grid, produce_figure, plot_annotations, fig_config, mcc, plot_scatter, \
to_col_name
def param_ranked_list(data, param):
regions = data.region.unique()
regions = regions[find_leaves(regions)]
... |
4bceb1cb042c92870c6f0c7e3271658f6818bfa8eb103e3c91d1347e0575d0ba | Python | 4,437 | 100 | #!/usr/bin/env python3
import rdflib
import ontquery
from neurondm.lang import *
from neurondm import *
from pyontutils.core import OntId, OntTerm
from pyontutils.utils import relative_path
from pyontutils.namespaces import makePrefixes, makeNamespaces, OntCuries
from pyontutils.namespaces import interlex_namespace, PR... |
b04317b4a5c6d464069b504fdbfdbe066634c1d7f871e5c1492dc8648bf36dec | Python | 4,438 | 139 | # coding=utf-8
# 2021.03 modified (1) logging config
# 2021.03 deleted (1) __main__
# Huawei Technologies Co., Ltd.
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# Copyright (c) Ignavier Ng (https://github.com/ignavier/golem)
#
# Licensed under the Apache License, Version 2.0 (the "Li... |
d8e136e2fb231ef22123caf2476a645be14092ba39b1e63dba66a7e63ed6e002 | Python | 4,440 | 114 | # Copyright 2019 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... |
000ecc18dc9d029f31b92d07c1fe6f56258cd5e5c2e4867a7c8b9634e8ef3248 | Python | 4,443 | 125 | """
@file: rl_utils.py
Created on 28.03.2021
@project: crazy_ara
@author: queensgambit, maxalexger
Utility functions to facilitate the reinforcement learning process.
Main purposes: get and change binary name; simple methods to manipulate files & folders.
"""
import re
import os
import glob
import ntpath
import loggi... |
507f79fad16cf466dd22bfea7f4a28c2d4f10555084dbfc0eeb92eaa6637618c | Python | 4,445 | 180 | """
Check NMDA_kampa mechanism (voltage clamp)
Make a single site version of the multisite synapse, set AMPA to 0.
Go voltage clamp, vary V and watch currents
"""
from __future__ import print_function
from collections import OrderedDict
import numpy as np
from neuron import h
import cnmodel.util as util
from cnmod... |
9f629d1dcdced53e83494787b0dedd52261d57a394c90de521acdcfe2aef443d | Python | 4,445 | 113 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
c8deb1a6e4aa77f349cc5be79bbd3d1e1f6c7dd459c0f6b0ed9e93180c9667d1 | Python | 4,445 | 127 | """
2. MNE Interface Cycle Feature Distributions
============================================
Compute bycycle feature distributions using MNE objects.
"""
####################################################################################################
# Import Packages and Load Data
# ----------------------------... |
ca924be4affa959824ae7fd9a2748e0eb233555fd944b46570a8f53306a0fe88 | Python | 4,448 | 124 | # Copyright 2023 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... |
583703fe2b2152e8ed0e19d1cd84c606d6ef3449c092627e463d267c89d29f46 | Python | 4,452 | 119 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
4d597cc5e39ce8ffbee458d12b96a6ae3cb78ced7988573362f47bf3235ae1a0 | Python | 4,454 | 110 | import logging
import numpy as np
import tensorflow as tf
from helpers.dir_utils import create_dir
from helpers.analyze_utils import count_accuracy
class ALTrainer(object):
"""
Augmented Lagrangian method with first-order gradient-based optimization
"""
_logger = logging.getLogger(__name__)
def ... |
c5b85afd83558bf666b13cae33224a765db01268e1e17ee4cf3886754de1f584 | Python | 4,459 | 131 | #!/usr/bin/env python3
import inspect
import neurondm
from pyontutils.utils import TermColors as tc
from neurondm import *
from neurondm import phenotype_namespaces as phns
try:
breakpoint
except NameError:
from IPython import embed as breakpoint
config = Config('neurons-example-script')
def printe(*args, **... |
9f7cdab028ff9e4a67d8f282c238675d614a61347ae69d79bc1985f5ce56b181 | Python | 4,460 | 95 | import os
import random
import torch
from torchvision.io import read_video
from pathlib import Path
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
from vp_suite.utils.utils import set_from_kwarg, read_video
class Physics101Dataset(VPDataset):
r"""
Dataset class for the Vid... |
a4f74a2df1004788ddd78410b88d8026e3d350ea6a41b96188822dd23929687d | Python | 4,461 | 134 | #!/usr/bin/env python
# bax_to_bam 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) document... |
169edc7570ae5857b26db30224d71b3fd1b25c16f1d70e5342639f95c6b959a5 | Python | 4,463 | 91 | # Copyright 2023 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... |
7adffb01577f3363f2fa20c0321786334acc631aa9a6bc701c71c8debd49af35 | Python | 4,464 | 104 | features_freesurfer = ('freesurfer_thickness',
'freesurfer_sulc',
'freesurfer_curv',
'freesurfer_area',
'freesurfer_pial_area',
'freesurfer_pial_lgi',
'freesurfer_jacobian_white',
... |
c4585b910dc1914d6fe40f088032aeb957f4f1009162f4bf83ab1456c1521421 | Python | 4,465 | 120 | import matplotlib.gridspec as grsp
import matplotlib.pyplot as plt
import numpy as np
from gpytGPE.gpe import GPEmul
from Historia.shared.design_utils import read_labels
from Historia.shared.plot_utils import get_col, interp_col
from Historia.shared.predict_utils import upvl
def f_emul(emulator, x):
return np.ar... |
be2b338da0b0dba61fe8b7c0579a33f9327c23334c8cef6f114d6e256bfbce78 | Python | 4,468 | 147 | # Copyright 2026 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... |
afdadda9205923c38cc8986200e457f57da372de58a148cb8620889da65f6238 | Python | 4,469 | 159 | import os, time
import pickle
import cv2
import numpy as np
def main():
mot_trace_name = "MOT16-10"
path_to_results_dir = "results/mot16_eval/temp/latency100"
path_to_data_dir = "data"
path_to_result_metadata_file = os.path.join(
path_to_results_dir, f"{mot_trace_name}.metadata"
)
met... |
fdfc8c730f186d869e59373cd51223746fc9773b1fe7927b83973f163758241b | Python | 4,469 | 111 | # Copyright (C) 2022-2025 Shijiazhuang Xianyu Digital Biotechnology Co., Ltd
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
cc86bf49bf5ed9e7c1bb772901cf2b737d9493965bc5092fb512b61cc6c7325d | Python | 4,470 | 144 | # Copyright 2019-2021 The ASReview Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
76928e01225c901d96018b09fc80d82cacd03adc6384b05ceec6a3e865c10fe0 | Python | 4,471 | 116 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
import configargparse
import pandas as pd
import numpy as np
from collections import Counter
from rdkit import Chem
def canonicalize_smiles(smiles):
mol = Chem.MolFromSmiles(smiles)
if mol is not None:
ret... |
3a16a333620700965a470a7ca596722e61335f4bf57bba6d4e0d81dc4dfe1a93 | Python | 4,473 | 132 | #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Generate the compressed CUDA fixture for LAMMPS ``dpa4spin/kk``.
The Kokkos adapter requires the compact canonical graph ABI, which is only
available for a compressed float32 DPA4C model with a fused fitting network.
Keep this archive separate from... |
a92ace58169b4808b32f8d017d77f9bd8deb07cedc91062732706f0ac17d6ca5 | Python | 4,473 | 126 | from copy import deepcopy
import torch
from torch import nn
from functools import wraps
from torch_geometric.nn import SchNet, radius_graph
from torch_scatter import scatter
from models.egnn import E_GCL
def conditional_grad(dec):
"Decorator to enable/disable grad depending on whether force/energy predictions are... |
44fc5c3b1e874db4b347aac6d53ae1d5523860c598f311bf87be5c04c00f7a86 | Python | 4,477 | 138 | """Dummy anomaly detector which detects anomalies after steps."""
import pandas as pd
from sktime.detection.base import BaseDetector
class DummyRegularAnomalies(BaseDetector):
"""Dummy change point detector which detects a change point every x steps.
Naive method that can serve as benchmarking pipeline or ... |
0aafbe9ed13e3a524cf8f964e79c14cfc5bf623bf745eb5358acc1e13962bc44 | Python | 4,478 | 123 | import re
import sys
from setuptools import setup
def find_version(filename):
_version_re = re.compile(r"__version__ = '(.*)'")
for line in open(filename):
version_match = _version_re.match(line)
if version_match:
return version_match.group(1)
__version__ = find_version('neurondm... |
11027efbd098c67ab2ece81184fd796933593069f6ba7054584d864f8f52044c | Python | 4,478 | 136 | # Copyright 2025 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... |
2ec29943eaabf24a1f3b5152a0c3532ce0982a1f85386567320dd3bb2ceeb716 | Python | 4,478 | 131 | """Composer that creates distance from aligner."""
__author__ = ["fkiraly"]
import numpy as np
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
class DistFromAligner(BasePairwiseTransformerPanel):
"""Distance transformer from aligner.
Behaviour: uses aligner.get_distance on pairs to obta... |
14409dcc8fe27b6446482e0790b45dd4fc90ee3fa3ca03ee995215b9753d4c30 | Python | 4,479 | 123 | """
@file: label_test.py
Created on 25.09.18
@project: crazy_ara_refactor
@author: queensgambit
Tests the functionality of the LABEL and LABEL_MIRRORED list based on the conversion to board and move planes
"""
import unittest
import chess.variant
from DeepCrazyhouse.src.domain.variants.output_representation import (
... |
65083d4e3e8a4af5ea0de76fd0722dd1bfc602e32a220da722fc43b50cab3f52 | Python | 4,482 | 115 | """
Filtering functions for protein structural classification by SCOP.
These all are applied to individual atom dataframes, and remove entries from that dataframe as necessary.
"""
import numpy as np
import pandas as pd
import atom3d.protein.scop as scop
import atom3d.util.file as fi
def form_scop_filter(level, all... |
d87f2431d1114f3862f43ea64220882b622d3074ae59fa6db2f20b1ca13d24bc | Python | 4,482 | 121 | import sys
import datamol as dm
import pyarrow.parquet as pq
import pyarrow.dataset as ds
import pyarrow as pa
from pyarrow.parquet import ParquetWriter
from rdkit.Chem import rdMolDescriptors
from rdkit import DataStructs
import pandas as pd
from rich import print
from rich.console import Console
from tqdm.contrib imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.