sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0ef6aab515daa4e2415fb0bfd4323e1dd766c65bba72de7a1a59706172ccbc2f
Python
10,258
280
""" Script for calculating self consistency TM scores """ import argparse import functools from glob import glob import os import logging from pathlib import Path import multiprocessing as mp import json from typing import * import numpy as np import pandas as pd from matplotlib import pyplot as plt import seaborn as...
6b73c6ffed2846f5f91b4d79bd80f487618e939336c75391b98d881d5d06b6ce
Python
10,263
231
"""Bundle assembly: what ships, what it is called, and whether it can be built twice. The legacy release script gathered a bundle with ``cp *.txt``, which would have swept in seven side tables the shipped zip does not contain -- so the script that produced the release was not the one that defined it. These tests asser...
def47e1dfb2f406bedfb45bcbf86d1c1f5aa9fe35849e8168750ecd1b49a9df6
Python
10,264
245
"""mass_ss.py: Defines the MASS class that manipulates the MASS database.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import numpy as np from sleeprnn.common import constants from sleeprnn.data import utils from sleeprnn.data ...
fd3b3247d66926fb1b2488d76c79742620efc93158437129fe62026241fdcc90
Python
10,272
290
"""The optimizer, scheduler and EMA flags, checked where they take effect. Seven flags that every training run carries and no test asserted anything about. They all end up as a number inside an optimizer, a scheduler or the moving average, and none of them changes whether a run succeeds, so a flag that stopped being r...
237e45db646c3943d1bd8eea228aa9c325773b70b84498514c25fcc4235b8051
Python
10,276
309
# import os # import pdb # import re import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import signal def supply_zero_value_by_former(x): # to replace the zero value by the previous valid keypoints new_x = x.copy() for each_kpt in x.columns: for zero_value_index in ...
a0041eeccc9da1bd7ad93ba20e49db4470d53d2e0dec3f8f165c78670c09f77d
Python
10,281
200
"""Publication year for every ``reference.id`` in the database, resolved once and committed. The dashboard plots records by year. Until now it resolved PubMed ids by calling NCBI eutils at render time and covered everything else with a literal fourteen-entry table inside the Rmd, last updated in 2021. Measured on the ...
fdd31cfb755a7e083f278cc987ef2635a646f032e27d54d7bc4bc4503f342bc2
Python
10,288
268
""" Implementation of the decorator using a Encoder-Decoder architecture. """ import math import logging import torch import torch.nn as tnn import torch.nn.utils.rnn as tnnur from reinvent.models.model_parameter_enum import ModelParametersEnum logger = logging.getLogger(__name__) class Encoder(tnn.Module): "...
a46a4ceab69017c535c6b451ff2d922c8e11aa513784c6496e3970b76ba62243
Python
10,291
329
from __future__ import annotations import logging from itertools import product from typing import Literal, Optional, Union import pandas as pd from neuron import h from tqdm import tqdm from src.cells.pv_nrn import get_pv, get_pv_mixed, mut, set_nrn_prop, set_stim from src.constants import ( CURRENT_LABEL, ...
1f325c23aedc4f577ce91b96b8db9619ec3c92715925a3a8c20b4e9f199f7f89
Python
10,295
250
import sys import os import math import numpy as np import torch import torch_geometric from torch_cluster import radius_graph from torch_scatter import scatter sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils import get_iso_permuted_dataset from e3nn.nn.models.gate_points_2101 im...
7a15f93a34131bd6b6fbdb274f6eb59d6dee984f28ab3b100b4c77a632b0d2ba
Python
10,296
286
import tensorflow as tf import numpy as np tf.keras.backend.clear_session() class featureExtraction(tf.keras.layers.Layer): def __init__(self, chans, F, T, D, use_bias=False, **kwargs): super(featureExtraction, self).__init__(**kwargs) self.conv1 = tf.keras.layers.Conv2D(filters=F, kernel_size=(T, ...
ffb0ac46fdb86c89a46b29bf20fb35cb749bfca14ddf9992df6af034666a43b8
Python
10,310
291
import os import random import time from functools import partial from pathlib import Path import numpy as np import torch import webdataset as wds import yaml from torch import optim import mlspm.data_loading as dl import mlspm.preprocessing as pp import mlspm.visualization as vis from mlspm import graph, utils fro...
e6facb95c964e2cfb5894e56d4ec66a4d6ecfea8cdd337fb4240c3914c6d5665
Python
10,313
177
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
f751c2b9444374d81c82cc7d31d4aa48c44284fa53b15a8728209020a0f63eef
Python
10,317
236
import numpy as np from numpy.random import multivariate_normal from scipy.stats import ortho_group from sklearn.metrics import r2_score from typing import Optional from theory_simulation.regression import regression_performance from theory_simulation.utils import fsolve_bounded_monotonic, project_onto_subspace class...
e8b18753dbc9247eea9b2299b4e04f88c08cd0788a661c52d8f4d7393ab7255d
Python
10,321
264
import sys import json import os import time import six import argparse import glob import re import modelhouse import torch from metroem import loss, augmentations from metroem.alignment import aligner_train_loop from metroem.dataset import MultimipDataset import torch.multiprocessing as mp from torch.nn.parallel i...
0fe962de81afdeff925150092682953b6449accaf1d7275d728e5b3db44aea17
Python
10,330
326
import argparse import logging import os import pathlib import re from typing import Any, Dict, List, Optional import attr import snakemake # We define Path here in addition to pathlib to put both variables in globals() # This way, users specifying a path type in their config.yaml can indicate # either Path or pathli...
32997f7864be1d07f2a14ab01a1aedb957dec9d2e9d19ddad7fa9b90ebe2c865
Python
10,351
321
import os from glob import glob import sys from processing import * from tqdm import tqdm import pandas as pd from scipy.stats import spearmanr, ttest_ind import seaborn as sns import anndata import scanpy as sc import umap import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from sklearn.prepro...
5f96f0820ea8a277048dc8daa09768a0d2e31f06b71ddaa9dec4b26c141f07cf
Python
10,364
320
# copyright (c) 2023 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
ff6286264b9470f0257e7c19acca0682c18c5b3d8d916765c36d71f84bc27838
Python
10,364
242
#!/usr/bin/python3 ### # Master controller for the TreeMaze. It communicates with the arduino through serial port. # Receives data through GPIO inputs and serial. ### import threading from MazeHeader import * PythonControlSet = ['T2','T3a','T3b','T3c','T3d','T3e','T3f','T3g','T3h','T4a','T4b','T4c','T4d', 'T5Ra','T...
0d59b41ccb0e6cc574370a521837a7ef07f0f028c8ae1369791892d5f9ec530d
Python
10,369
251
#### python_ncut_lib.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It provides the library functions for # performing normalized cut clustering according to: # # Stella Yu and...
1321ff23b2737227b1695ec412ea33eb0b1d0f245399f39e9738dee0ce6a2cd5
Python
10,374
209
import os os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' #DLL bug in my environment - might be unnecessary for most other people import openslide import xml.etree.ElementTree as ET from PIL import Image, ImageDraw from skimage.measure import label, regionprops from scipy.ndimage import binary_erosion, maximu...
c39518b7f6b2dd3861fa9e2ad0c80dcde95355bc888b76e0c933a242463d0250
Python
10,374
297
# Copyright (C) 2020-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from bisect import bisect import matplotlib.pyplot as plt import numpy as np import torch from privacy_meter.audit import Audit from privacy_meter.constants import InferenceGame from privacy_meter.dataset import Dataset from privacy_me...
5a77ea4aa0c04bf0b22f6def7e0a9695cecd5f2705a2b20b7f0dc48833d1984e
Python
10,378
229
import numpy as np from numpy.random import randint from scipy.special import softmax from sklearn.metrics import confusion_matrix, classification_report from sklearn.model_selection import StratifiedKFold, KFold import os def dotProductLit(df, literature_sequences, literature_labels, random_seed: int = None): """...
75cb44256550e4a090a8a9f2e0f650ff7e1e90afcb0a3e859d7f75babfe4e9b9
Python
10,381
296
# Copyright (c) 2023 PaddlePaddle 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 appli...
9b3221cec3a894d3a3294a4de6eaea3865c4f1053e92c2fc578cf37f6c72833d
Python
10,381
222
"""The AIRR export: schema conformance, the value mappings, and the two source paths agreeing.""" from __future__ import annotations from pathlib import Path import airr as A import polars as pl import pytest from airr.schema import RearrangementSchema as RS from vdjdb.emit import airr from vdjdb.schema import AIRR_...
a836c949970da0164001a5eb547a1853a38c2e24061b5792b8fbf0f2172c1e9c
Python
10,390
299
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from argparse import Namespace from pathlib import Path from typing import Dict, Optional from fairseq.data import Dictionary def get_config...
3f6d0dd9d70ea2284c8abc321980de05d6987934100fc7ece714bcddbfeafb99
Python
10,394
283
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging import pytest import os import shutil import random from metaflow import Step from tests.end_to_end.utils.wf_common_fixtures import ( fx_local_federated_workflow, fx_local_federated_workflow_prvt_attr, fx_local_fe...
153402639737de34829e64401e99c52074ce9b1262bea2d6b9ecc8c3d0683181
Python
10,403
212
''' Module focused on the implementation of the MultiBox Loss Function. ''' import torch import torch.nn as nn import numpy as np from smithers.ml.utils_objdet import cxcy_to_xy, find_jaccard_overlap, cxcy_to_gcxgcy, xy_to_cxcy device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class ...
fbc2c627738c38c6641e182431e353c689f37d973b22d2f363ffb8399a2a513e
Python
10,404
275
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import copy import tempfile import pathlib import subprocess import os import sys import uuid import torch from omegaconf import OmegaConf, open_dict from nequip.data import AtomicDataDict BEST_CHECK...
96d138b8c7bc834e4b6c2b9a631ea68bfb9f35d766f109711be9ebbb2b3c40c6
Python
10,407
268
import torch import numpy as np import os import pandas as pd import scipy.sparse as sp import random from torch_geometric.data import download_url device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class POKEC(): r"""Pokec is a social network dataset. Two `different datasets <https://github.co...
fa9ae3209704829730dd82aa0816598c719bff81d3e1d277dccafd9f6c043760
Python
10,410
259
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
252e85f078ec2fafe8d00e80226b5869914e919c599916f8c20f8b8259ba62a5
Python
10,413
385
""" MOL METHODS ==================== Compendium of methods for SMILES parsing and molecular metrics handling. This module is mainly a reorganization of Gabriel Guimaraes and Benjamin Sanchez-Lengeling's original implementation (http://github.com/gablg1/ORGAN). Carlos Outeiral has cleaned up and documented the code,...
475f02e307ea0293c71d74af50825e47e76579bc10e1779afe2542f96f563edc
Python
10,416
177
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
1032a258dbf4bdad005992d8f5a7fd26a5d8f9f78ace92c6bf4eb72ebe594ccc
Python
10,417
306
import numpy as np from torch import nn, Tensor import math from torch.nn import functional as F from typing import Optional, Dict, Tuple, Union, Sequence from .transformer import LocationPreservingVit from .mobilenetv2 import InvertedResidual from .base_module import BaseModule from ..misc.profiler import module_prof...
1df50885f692143e4b2ccec4a06b7e310759b3ec66d4b8fee10c5dc33aa506df
Python
10,431
331
import pytest import geomstats.backend as gs from geomstats.test.data import TestData class NumpyRaisesTestData(TestData): def raises_test_data(self): data = [ dict(autodiff_func=gs.autodiff.value_and_grad), dict(autodiff_func=gs.autodiff.jacobian), dict(autodiff_func=...
bf1e22bcb9eef85d40a2ddcd46d672338009d8b833ad4c7cd8da8e09b4b5b9d3
Python
10,441
321
# Copyright (c) 2021 PaddlePaddle 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 appli...
0f725d402c42f518d463fc0eb6cd91bf2bfd86889b9830dd73f2331a4450368b
Python
10,449
225
# Copyright (c) 2022 PaddlePaddle 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 appli...
5d080e9e323dd33b9cc76c95e5b6d438e9abdcab34721c6193522587b9cddc91
Python
10,451
262
import warnings import numpy as np warnings.simplefilter('always', UserWarning) # ---------------------------------------------------------------------------------------------------------------------------------------------------- # Generate Stimulus # -----------------------------------------------------------------...
808f305d2b8d7c5cb2ab0ceaa52f885b6f9b105a8092221959c6deb3b2972a9b
Python
10,452
243
import os, glob, numpy as np, shutil, matplotlib.pyplot as plt, cv2.cv2 as cv2, seaborn as sns import tensorflow as tf, keras from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping from tensorflow.keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator from tensorflow.keras.layers im...
15ac52edfe91d6a24503e935a117b107b85ba191f0b74836707a17574b2ebca1
Python
10,453
261
# Copyright (c) 2019 PaddlePaddle 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 appli...
6660cc00f1c62b2663bc39f9c1c732dbcc3cfd1db5c6ca190b9953b50e8f6886
Python
10,453
211
# Generated by Django 4.1.1 on 2022-10-02 16:56 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='CellType'...
8eb2dde5e44fe5d3f2e60eb123f7db38a8a57d2c5931503ac1f7c77a278be7c5
Python
10,456
286
"""Define and apply the versioned SanPy JSON payload stored in NWB scratch.""" from __future__ import annotations import math from typing import Any, Literal import numpy as np from pydantic import BaseModel, ConfigDict, Field, model_validator from sanpy.bAnalysisResults import AnalysisResults from sanpy.bDetection...
67d96e1e82fb1a601d1a43b1ead2677c81f04a19cf4ae4a5706050d7f02df840
Python
10,463
272
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human C...
d13fcd967e1aa71c63805224c663b0258913542a4b8ac40cad65c6456120c15e
Python
10,463
213
import math import torch from torch import Tensor import torch.nn as nn import copy from torch_geometric.utils.loop import add_remaining_self_loops from ..models.utils import subgraph from ..models.models import GraphSequential from .base_explainer import WalkBase EPS = 1e-15 class GNN_LRP(WalkBase): ...
889a73bb24bb943831056f8520935cd814e707643759c8be89d16f0282b8cf02
Python
10,464
249
"""One training step on a committed anchor, reduced to a comparable digest. A loss-decrease smoke test and a final-error table cannot see a gradient bug the size of initialisation noise: both stay green while `d(loss)/d(theta)` is wrong in a way that only slows convergence. This module produces the thing that can see ...
9d52b7922084aebddfe4d720e8cc8c450d0f2bf2a9c9a24d077497faddd48479
Python
10,466
298
import os aff = os.sched_getaffinity(0) print( "**********************before import torch******************************" + str(aff) ) import torch print( "**********************after import torch******************************" + str(os.sched_getaffinity(0)) ) os.sched_setaffinity(0, aff) from DeepPurpose...
4cddc7f9aa5c74f9746c19dfa2de1b39a767ce17ba69444c247c543ea38cc498
Python
10,467
272
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human C...
e030d825875664d7cfa01be33b063133fad03e17c6019b44265758ff5c82adf9
Python
10,474
303
import time from threading import Thread import pylsl import numpy as np from ._stream import StreamEEG, StreamMarker from .. import logger class StreamReceiver: """ Class for data acquisition from LSL streams. It supports the streams of: - EEG - Markers Parameters ---------- ...
fc02a54108282971a736e0095d3fbc8b4065d15aba771c541fc3a16fe3cae271
Python
10,479
199
import sys import os import numpy as np from sklearn import metrics from .model import GeneSGAN from .utils import highest_matching_clustering, parse_validation_data, n_sig_calculation from .clustering import Gene_SGAN_train __author__ = "Zhijian Yang" __copyright__ = "Copyright 2019-2020 The CBICA & SBIA Lab" __credi...
c0fc78a35352c504e23d7249eca68ee25ddb655c10cbfcb061cb7ac85c29066b
Python
10,483
258
import copy import math import torch import torch.nn as nn import torch.nn.functional as F import rdkit import rdkit.Chem as Chem from .mol_tree import MolTree from .nnutils import create_var from .jtnn_enc import JTNNEncoder from .jtnn_dec import JTNNDecoder from .mpn import MPN from .jtmpn import JTMPN from .dataut...
07bce02e9faf61d5d1f5c7214b3611723b3ee784246897236c27eb62820e6b31
Python
10,487
334
import hashlib import os import time import numpy as np from PymoNNto.Exploration.StorageManager.StorageManager import * from PymoNNto.Exploration.UI_Base import * from PymoNNto.Exploration.Network_UI.Basic_Tabs.Helper.syntax import * class Behavior_Parser_Object: md5_hash='' code='' name='' tags=None...
7b26f999611127622c524855c845af469703faddf90fd9ad18ab90025e897b6e
Python
10,487
326
import numpy as np from data import indicator_basis, ou_process from utils import allclose_sign, allclose_trajs, allclose_trajs_sign import pytest import ref_corr import ivac def make_data(ns, dt, nbins): """Generate featurized data for testing.""" return [indicator_basis(ou_process(n, dt), nbins) for n in n...
240c542314a1ccf359d7e435bcc0a9047ed69ad3e5bcc95c66086980432d9ac0
Python
10,507
189
"""Score a motif clustering, and score legacy's the same way, on one cohort. Phase 11's acceptance criterion is a comparison, and both sides have to be scored identically on identical rows. So this module does two things: turn a ``cluster_members``-shaped file into the ``(label, cluster)`` frame :mod:`vdjdb.validate.m...
5760ad7d21a1a6e1e8f236191178f76bcf4007e7c23417b2dd10695400af441f
Python
10,507
366
import os aff = os.sched_getaffinity(0) print('**********************before import torch******************************'+str(aff)) import torch print('**********************after import torch******************************'+str(os.sched_getaffinity(0))) os.sched_setaffinity(0, aff) from DeepPurpose import utils, dataset...
6a251d31e7d8810af4c2b4d2e9b77f1e69b8672295aefa68fe692b8f5715c2d5
Python
10,510
366
import os aff = os.sched_getaffinity(0) print('**********************before import torch******************************'+str(aff)) import torch print('**********************after import torch******************************'+str(os.sched_getaffinity(0))) os.sched_setaffinity(0, aff) from DeepPurpose import utils, dataset...
7a04502e8bf659fb65ed414646869b3ea0d6a1745211848685939bb1edb2b397
Python
10,514
268
import argparse import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl from types import SimpleNamespace import sys import copy from pathlib import Path from cobrawap.pipeline.utils.neo_utils import analogsignal_to_imagesequence from cobrawap.pipeline.utils...
3868de85fb38c95fac4b0dca62a9fc89993f8a2147dececb78385c135434fda1
Python
10,515
284
import matplotlib.pyplot as plt import numpy as np import pickle import pandas as pd import seaborn as sns from scipy import stats import xlsxwriter as xw import seaborn patient_list = ['402','8902','11002','16202', '21902','26102','30802', '32702','45402','46702','50802', '52302','53402','55202','56402',...
a0a831e86bc55d17dad600518f709c75b45c4da694b276c336162bed66bccfe7
Python
10,521
286
""" Tests for Shared Response Model (SRM) algorithms. Testing philosophy: Property-based tests with mathematical invariants rather than golden outputs (following BrainIAK, PyMVPA, Hypertools best practices). Based on research documented in claude-guidelines/srm-hyperalignment-testing-strategy.md """ import pytest im...
89eb28498064dc7dc869d48ed973a05e9495680caa14b38c428e8ee501635f17
Python
10,523
359
""" dFC class Created on Jun 29 2023 @author: Mohammad Torabi """ import numpy as np from .dfc_utils import ( SW_downsample, node_info2network, node_labels2networks, rank_norm_dFC_dict, visualize_conn_mat_dict, ) ################################# DFC class ###################################### ...
f9ce9ad22836f04f0e8bc04238341f9d40e777bb4785fac58ec97f497dc5e2c9
Python
10,528
228
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.model_selection import StratifiedKFold from sklearn.metrics import confusion_matrix, classification_report from sklearn import preprocessing, linear_model, model_selection, svm, tree, ensemble, neighbors import pick...
24a994d0473f22838dd9ba5751a998d448d711ce6351ce342339a8e65b387e1e
Python
10,545
286
from PymoNNto.NetworkCore.Base_Attachable_Modules import * from PymoNNto.NetworkBehavior.Recorder.Recorder import * import copy blue = (0.0, 0.0, 255.0, 255.0) red = (255.0, 0.0, 0.0, 255.0) green = (0.0, 200.0, 0.0, 255.0) yellow = (255.0, 255.0, 0.0, 255.0) purple = (255.0, 0.0, 255.0, 255.0) aqua = (0.0, 255.0, 255...
f28db706880a6074b4df48f3e460556adab8c43a6021bc7ddd48625b407d385c
Python
10,548
310
import logging as log import os import cv2 import numpy as np import pandas as pd import torch from collagen import Compose, ApplyTransform, Normalize from solt import core as slc, transforms as slt, data as sld def parse_metadata(entry, metadata): n_segments = 4 mean_bmi = 28 mean_age = 60 mean_woma...
3eb0c53189e4f08387275956776b36c5ac2533038fe45421da35aa10a7b00c40
Python
10,554
273
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import logging import tempfile import tests.end_to_end.utils.exceptions as ex import tests.end_to_end.utils.helper as helper import tests.end_to_end.utils.ssh_helper as ssh log = logging.getLogger(__name__) # Define the Collabo...
c55a7d39b7eaabf21ff3d12fa00b92fc33a70e7c1e4eab0546e0e6eeb7b7d102
Python
10,560
298
import os import torch import numpy as np from abc import ABC from typing import Union, Optional, Iterable, Dict from .nodes import Nodes from .topology import AbstractConnection class AbstractMonitor(ABC): # language=rst """ Abstract base class for state variable monitors. """ class Monitor(Abstr...
66ce66ea79cfb58a7cca8a969d4523445b74d80cb5a562243f9a14e985dc4613
Python
10,561
317
import os import copy import numpy as np import cloudvolume as cv from cloudvolume.lib import Bbox from torch.nn.functional import interpolate from corgie import layers from corgie import exceptions from corgie.log import logger as corgie_logger from corgie.mipless_cloudvolume import MiplessCloudVolume from corgie....
90983401be46fb69fc0fd300d4d5331d087ddfd51b31368fce96e377e73300da
Python
10,566
205
import os import torch import hydra from omegaconf import OmegaConf from sklearn.metrics import roc_auc_score from benchmarks.xgraph.gnnNets import get_gnnNets from benchmarks.xgraph.utils import check_dir, fix_random_seed, Recorder, perturb_input from benchmarks.xgraph.dataset import get_dataset, get_dataloader, SynG...
ece158ac6d61aba4cfcadc14690f95c0bc94450c456be6697ba9becc040e6142
Python
10,569
288
# Method signatures differ between Qt bindings, so overrides can't match them all # pyright: reportIncompatibleMethodOverride=false import logging from importlib import metadata from pathlib import Path from qtpy import API_NAME from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtCore ...
e3aded1d93264d67ce6eff1395efb7ead30d33537980e1670b067666208cb345
Python
10,578
239
"""Build the tiny ``MagneticScaleShiftMACE`` anchor by direct instantiation. The magnetic family is a full parallel model stack -- its own models, its own interaction and product blocks, its own derivative kernels (``compute_forces_magforces``, ``compute_forces_virials_magforces`` in ``mace/modules/utils.py``), its ow...
6188f0e86bda4e4eab0ea34bccf9cd5d86a3bb7ceb6f1b764d88bf0d254bc339
Python
10,581
245
import os import torch import numpy as np import pandas as pd import pickle from utils import resize, normalize, load_config, save_pickle, CustomSummaryTracker import init_training import argparse def train(dataset, models, training_pipeline, logging, cfg): # Unpack trainloader = dataset['trainloader'] exa...
9614eb5c05f40c0803afecf93fb4a8e463789db2f154534c5514f700c1c01a14
Python
10,583
333
import os import torch import numpy as np import argparse import matplotlib.pyplot as plt from torchvision import transforms from tqdm import tqdm from bindsnet.datasets import MNIST from bindsnet.encoding import PoissonEncoder from bindsnet.models import DiehlAndCook2015 from bindsnet.network.monitors import Monito...
ef069f4c05e0ce3d14707bb17ab20ea856f29f3d4224c167d3f0cde60074f408
Python
10,584
289
from typing import Optional, Tuple, List, Iterable import os import torch import numpy as np import shutil import zipfile from urllib.request import urlretrieve from scipy.io import wavfile import warnings class SpokenMNIST(torch.utils.data.Dataset): # language=rst """ Handles loading and saving of the...
16befb013b99d5b068682bbb01562ad4d462ff998f00e06399a33f86801b2bb0
Python
10,585
250
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch import lightning from lightning.pytorch.callbacks import Callback import ase from nequip.data import AtomicDataDict, to_ase from nequip.data import ( _register_field_prefix, regis...
a608b4882920939998a311d62209223ef5970efb69a364c938ba88110eeb6adf
Python
10,588
223
# Modified from DeepMind repo https://github.com/deepmind/kfac-jax/2022 # Copyright DeepMind Technologies Limited. 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 # # ...
ea85d7a406a3a2cb6ea551222ce8e7c4f36b24e42b5d718285661a7877d376ec
Python
10,588
234
"""J calls the junction itself contradicts (#681). A junction carries the J's own evidence: its 3' end is templated by the J germline, so a record's J call can be checked against the sequence the same record reports. Match the junction's 3' end - **the anchor excluded**, so a corrupt anchor cannot vote on its own diag...
b866c235f87ad1d8bfab158d3cf3cd897d6ac5d6726c0610a90b23d4b0fc853f
Python
10,589
254
# Copyright (c) 2020 PaddlePaddle 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 # # Un...
3954adf4a764a93769f331cf77bb0f811e1aa6d31a5fd7d764347ae68fdd430c
Python
10,591
282
""" Tests for nltools.datasets module This test file covers: - download_nifti: Basic file downloading functionality - fetch_neurovault_collection: Main collection fetching function """ import pytest import polars as pl import tempfile import os from unittest.mock import patch, MagicMock from nltools.datasets import ...
667c7be3638f305ded428d0c354c2f7b7850853f76dbd5296bc0f4d483e52564
Python
10,592
275
import numpy as np import scipy.sparse as sp import tensorflow as tf import os import psutil flags = tf.app.flags FLAGS = flags.FLAGS """ Disclaimer: functions defined from lines 18 to 54 in this file come from the tkipf/gae original repository on Graph Autoencoders. Moreover, the mask_test_edges function is borrow...
4bb4ef45e6a74f8d5c3f95dc5daef21662e88c56def39cb7569fc1e29df2feb5
Python
10,593
269
from threading import Lock from chromadb.segment import ( SegmentImplementation, SegmentManager, MetadataReader, SegmentType, VectorReader, S, ) import logging from chromadb.segment.impl.manager.cache.cache import ( SegmentLRUCache, BasicCache, SegmentCache, ) import os from chromad...
66bcf9390c1a7d51a4860712979d677b89cabc0edf95c64334dae291ae80dd7a
Python
10,598
228
"""The identity invariants, as checks over a built directory. ``ROADMAP.md`` section 10.5 names seven. Six of them are properties of a build and live here; the seventh, that a permuted chunk order changes no id, is a property of two builds and lives in ``tests/unit/test_identity_levels.py`` where it runs on a small fi...
c0132dea411ec77943da9fddf0d9bd450b458e8e99cb84de961745bbcefdf7ab
Python
10,599
279
# -*- coding: utf-8 -*- import sys import os import random import subprocess import numpy as np """ example running 10 reps of 10kb sims with migration from pop 1 to pop 2 (change donorPop to 2 to reverse the order): python runAndParseSlim.py introg.slim 10 10000 1 introg.log 1> test.ms 2> test.log output: introg.log ...
b934072830b0a1365e2fa08a0788430666c8c74fd81e42ffeef03a0d4d4fdc2e
Python
10,601
204
import os import torch import hydra from omegaconf import OmegaConf from sklearn.metrics import roc_auc_score from torch_geometric.utils import add_remaining_self_loops from dig.xgraph.method import GradCAM from dig.xgraph.evaluation import XCollector from dig.xgraph.dataset import SynGraphDataset from dig.xgraph.util...
c607718746afedf5e38cd88b8844cd9b5ed8d8b878512f46c66f407bd3296e31
Python
10,613
206
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Aug 3 19:21:51 2023 @author: benozzo """ import scipy.stats as stats import numpy as np from function_library import spearman_rank_permutation def symm_level(ec, sparsified=False): #compute the symmetry level by the spear corr row/col #sparsif...
531e8cb64f6a159024cb3bb04fa6dd259f81c6a4da725538d534acaa14093f3c
Python
10,627
312
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
c0a9d859315d658819314c25fad8d476aa5f8ec56e24bd44be226574e45dcbd0
Python
10,629
293
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # # Used for 2D data only: converting from high spatial/temporal resolutions to lower resolutions...
0377abd2486bee1bd0e18fbb85f6992656e0a1d3ff78580060dde45d35c7623f
Python
10,637
250
import argparse import torch import torch.nn as nn import torch.optim as optim import pandas as pd import numpy as np from sklearn.model_selection import KFold from sklearn.model_selection import train_test_split from sklearn.metrics import precision_recall_curve, roc_curve, auc from torch.utils.data import DataLoader ...
c82c104a30ec92dae3b7655056d21f31f0df37a37d3de2f2f5f0b96d2434d29c
Python
10,650
364
""" These tests check Sniffles BND calls/leads against the HG008 and HG002 dataset. Requires the BAM file to be present at the path specified in BNDLeadTestCase.bam_file. The BAM file should be indexed and contain the necessary tags (e.g. NM). """ from typing import Tuple from unittest import TestCase import pysam f...
06af0d19ae3734cafe50484edd02e6d53221ffdc4513a1eb386b50ff8601804b
Python
10,651
315
"""Prepare and process graph-structured data. Lead author: Hadi Zaatiti. """ import logging import random import geomstats.backend as gs from geomstats.geometry.poincare_ball import PoincareBall class Graph: """Class for generating a graph object from a dataset. Prepare Graph object from a dataset file. ...
575faa42a4f079cb2a3afc5f93cd25ce0ac6785c3d3ed3af0613621475b4ec7f
Python
10,674
259
""" Refer from https://github.com/rusty1s/pyg_autoscale/blob/master/torch_geometric_autoscale/models/base.py """ from typing import Optional, Callable, Dict, Any import torch from torch import Tensor from torch_sparse import SparseTensor from dig.lsgraph.method.FM import FeatureMomentum from ..pool import AsyncIOPoo...
dcf8953035066621c5795a16d9f71a40d91890b2cc03324ff5788ab77bdebf21
Python
10,706
303
import os aff = os.sched_getaffinity(0) print( "**********************before import torch******************************" + str(aff) ) import torch print( "**********************after import torch******************************" + str(os.sched_getaffinity(0)) ) os.sched_setaffinity(0, aff) from DeepPurpose...
c610faf09b106b66aff288629d17dd4a3011bd62eddfffecafa64bcc28a521ed
Python
10,717
209
import os import nibabel as nib import pandas as pd from tqdm import tqdm def group_patient_visit(df): # IDs = df['PTID'].unique().tolist() # projects = ['axial', 'sagittal', 'coronal'] # rows = [] # for ID in IDs: # row = {} # missing_data = False # for i, project in enumerat...
62fee15a39f517f2761a794a22b1dceb4b62d673ff256010ee9756ad8632c959
Python
10,719
372
"""Wrapper around autograd functions to be consistent with backends.""" import autograd as _autograd import autograd.numpy as _np from autograd import jacobian def _get_max_ndim_point(*points): """Identify point with higher dimension. Same as `geomstats.vectorization._get_max_ndim_point`. Parameters ...
9799134390372421cac9c261ec839e211e896df5cc2521aa74c140d072fbac4f
Python
10,719
248
"""Experiments for interpretability theory. These experiments evaluate the ability of common interpretability methods to infer the behaviour of real models on real data. This class is used to store the base information needed to understand the experiment. It will be inherited by downstream classes that instantiate it...
2d17eb5c0041e11212a0c61761e7f91a55d5c311f6935f82e76447300ada7798
Python
10,729
246
"""Verify the rendered dashboard fragment before it reaches ``vdjdb-web``. uv run python summary/check_summary.py [fragment.html] [--baseline summary/fingerprint.json] uv run python summary/check_summary.py --write-baseline There is no committed image baseline -- ``.gitignore`` excludes ``summary/*.html`` -- ...
453c771fd0d0fdb813a2c82a2c5e8b1ba52dd9a4cdcb11018ea27b765cd3ae7e
Python
10,729
319
"""Write and read one SanPy intracellular recording as an NWB file.""" from __future__ import annotations from datetime import datetime import json import os from pathlib import Path import tempfile from typing import Any import numpy as np from pydantic import BaseModel, ConfigDict, field_validator from pynwb impor...
3cf31a8a5a4b688254b1d4dcd6151ecde2ce01616df6c399f64c7a5a1c06041e
Python
10,733
331
#!python3 """ Python 3 wrapper for identifying objects in images Requires DLL compilation Both the GPU and no-GPU version should be compiled; the no-GPU version should be renamed "yolo_cpp_dll_nogpu.dll". On a GPU system, you can force CPU evaluation by any of: - Set global variable DARKNET_FORCE_CPU to True - Set ...
406c8617bb661e664f7ea4653bfdeb29e2c54fc603e0e84a4bcbe3fc0856e80e
Python
10,733
263
import logging import warnings import numpy as np from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtGui import QKeyEvent from qtpy.QtWidgets import ( QAbstractItemView, QCheckBox, QHBoxLayout, QHeaderView, QLabel, QSpinBox, QTableWidget, QTableWidg...
f40683c9a0b22334163b3e6405f396669282a7a01b05707bf6ddacbae7ffb94b
Python
10,735
276
import os import numpy as np import wandb import pandas as pd from wandb.apis.public import gql import re import json api = wandb.Api() def _get_runs(project_name, entity='schroedinger_univie'): query = gql( """ query Runs($project: String!, $entity: String!) { project(name: $project, entityName: $...
49f2552c46507b69efaabe8ac30e4e7884a45058ddb3717dd80bf4d04d6cbac1
Python
10,744
284
# -*- coding: utf-8 -*- """ Created on Tue May 18 12:25:43 2021 @author: nicol """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl import pandas as pd import seaborn as sns import scipy.ndi...
7d04df042febe07680a20c0019e453a3c94e39c0d8578e3d6c68ced3b19cd9b6
Python
10,751
271
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # OS stuff import os import sys import warnings from pathlib import Path # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import font_manag...
5f9a6e30b02a165fdac9e7dfc148efd859f407edfcbff777b3d7492a0a9f46b2
Python
10,756
337
from pathlib import Path import imageio import numpy as np from split_dataset import EmptySplitDataset from fimpy.loading import loading_function from fimpy.pipeline.common import run_in_blocks from fimpy.loading.utilities import _stack_from_tif, _imshape_from_tif @loading_function def load_volumetric( data_dir,...
a779ff8b34c4171bd1e16e9dd121961e0494bfa60e8e43ad4d876694e6c8bd02
Python
10,756
273
import numpy as np from numpy import ndarray from scipy.spatial import KDTree from model_angelo.utils.misc_utils import assertion_check from model_angelo.utils.residue_constants import restype_3_to_index class MatchToSequence: def __init__( self, new_sequences, residue_idxs, seque...