sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
82b085017ddc11b77596e7c922ea973bde4836442862ebb41904ff758cb31347 | Python | 4,890 | 133 | """SanPy description, contact, and build information widget.
Used by the About SanPy dialog and the detection view's SanPy Info panel.
"""
from qtpy import QtCore, QtGui, QtWidgets
from sanpy import build_info
from sanpy.sanpy_paths import SanPyPaths
from sanpy.sanpyLogger import getLoggerText, get_logger
logger = ... |
8f3fe93725cab7c50e0b717824f3ee43e61c252b7e4ae845fc7440d646ff6891 | Python | 4,890 | 139 | # 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... |
268cb990de9531b7e4db4fa47e79c2e1ac0661f09ab6f96fa81cbe32da3263e6 | Python | 4,891 | 114 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import os
import logging
from tests.end_to_end.utils.tr_common_fixtures import (
fx_federation_tr,
fx_federation_tr_dws,
)
from tests.end_to_end.utils import federation_helper as fed_helper
from tests.end_to_end.utils.... |
8d2bc2ffdc3e6bdad2bf4919cf9fd9b4df8bb93d8bdcca3834846dbbbb15883d | Python | 4,891 | 108 | import tensorflow as tf
import numpy as np
class AttentionGlobalPooling:
def __init__(self,
number_of_heads,
number_of_features,
sequence_length,
outputs_list):
self.number_of_heads = number_of_heads
self.number_of_features = numb... |
da28f6a1b9f5200b55a3541693b22cb49634e5bcfecb220e4b8186dc5e95e648 | Python | 4,892 | 175 | #!/usr/bin/python3
from __future__ import absolute_import, division, print_function
import argparse
import glob
import io
import os
import pickle
import sys
import numpy as np
from model_angelo.utils.fasta_utils import read_fasta
from model_angelo.utils.pdb_utils import (
load_cas_from_structure,
load_full_... |
1ed678e042de33bbef76095ff1eedd626ac0a202e011755ce02b86a61da663c8 | Python | 4,893 | 123 | # -*- coding: utf-8 -*-
"""Provides `EllipsesDataset`."""
from itertools import repeat
import numpy as np
from odl import uniform_discr
from odl.phantom import ellipsoid_phantom
from dival.datasets.dataset import GroundTruthDataset
class EllipsesDataset(GroundTruthDataset):
"""Dataset with images of multiple rand... |
e860b0b7cfdc0dd6a3b4dbdf4ff4061839fd32555140f5f999497c7205c502a9 | Python | 4,893 | 171 | import os
import numpy as np
import sys
from seriate import seriate
from scipy.spatial.distance import pdist
import logging
def seriate_x(x):
Dx = pdist(x, metric = 'cosine')
Dx[np.where(np.isnan(Dx))] = 0.
ix = seriate(Dx)
def load_npz(ifile):
ifile = np.load(ifile)
pop1_x = ifile['simMatrix'].... |
32256cf8686dd2d3bcfb94aa92154e8a7130103d09685a5bcf215afc4bfa577c | Python | 4,895 | 139 | """Tests for graph padding utilities and padded calculator inference."""
import numpy as np
import pytest
import torch
from ase import build
from mace.data import AtomicData
from mace.data.padding_tools import build_fake_padding_graph
from mace.tools import torch_geometric, utils
@pytest.fixture(scope="module")
def... |
8f76d9852b047587788649ebbc6c00951f87d7cf66d5f1b03213045f1ac7345e | Python | 4,896 | 156 | """Open remote NWB files through an fsspec-backed local cache."""
from __future__ import annotations
from collections.abc import Iterator
from contextlib import contextmanager
from pathlib import Path
from typing import BinaryIO, Protocol
import fsspec
import h5py
import lindi
from fsspec.implementations.cached impo... |
757c57d4bfedaca627fa134285aeb95bb08b61e4ca113d1f4649644d4bf0726f | Python | 4,897 | 230 |
from os import environ as env
from os.path import (
join as join_path,
splitext as split_extension
)
from subprocess import (
DEVNULL,
PIPE,
Popen,
check_call
)
from struct import (
calcsize,
pack,
iter_unpack
)
from tempfile import TemporaryDirectory
COOC_RECORD = 'iid'
COOC_RECO... |
df7a5fc7d99816457898cdb001a30c8b2892fbeed121017a6fa3bd253ec403bf | Python | 4,897 | 126 | import ast
import logging
import os
from e3nn import o3
def check_args(args):
"""
Check input arguments, update them if necessary for valid and consistent inputs, and return a tuple containing
the (potentially) modified args and a list of log messages.
"""
log_messages = []
# Directories
... |
0184eb663cf38dc9d5154e526ecd7a187373cd638171f7370c3905facaa0ea79 | Python | 4,898 | 142 | import os
import csv
import unittest
from types import SimpleNamespace
from pathlib import Path
import pytest
from reinvent.Reinvent import main as reinvent_main
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
PEPTIDE_FILE = os.path.join(TEST_DIR, "peptide_single_mask.smi")
MULTI_PEPTIDE_FILE = os.path.join(TE... |
556f679f206cc7c96b735c946875abbea27ec5d7320ade9ca10c0fe25f986ecb | Python | 4,898 | 172 | # 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
#
# Unless required by appli... |
656aed5f1ba78af843fda24100b8efcb3ec48b8ea911c2f0054a0bca498c086c | Python | 4,901 | 132 | #!/usr/bin/env python3
from pathlib import Path
import matplotlib.pyplot as plt
from torch import scatter
from ppafm.ocl.oclUtils import init_env
from plot_predictions import get_data as get_data_prediction, MM_TO_INCH
from plot_predictions import plot_graph as plot_graph_prediction
from plot_relaxed_structures impo... |
7de7a114b8ecb51a97eb91827660d0a0dd1b1fc5a33f691c26839735b10b0a5e | Python | 4,902 | 149 | from typing import Optional, Dict
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
from ..network import Network
from .base_pipeline import BasePipeline
from ..analysis.pipeline_analysis import PipelineAnalyzer
from ..datasets import DataLoader
class DataLoaderPipeline(BasePipeline):
# la... |
b2d0f899c937360b4df6bb0ca4f4b9ef344239bb9bd59e429f9ce43cbb101c9a | Python | 4,904 | 128 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
from typing import Union, Tuple, List, Optional
from nequip.nn import graph_model
from nequip.utils.versions import check_pt2_compile_compatibility
from nequip.utils.aoti_metadata import (... |
dbdb433d3836eee6d3fce487ec7bb112f2164a0b7e5bd2f73ef9a4b14cd0d496 | Python | 4,908 | 121 | from PymoNNto.Exploration.Network_UI.TabBase import *
import scipy.fftpack
class fourier_tab(TabBase):
def __init__(self, parameter, title='Fourier', timesteps=1000):
super().__init__(title)
self.parameter = parameter
self.timesteps=timesteps
def add_recorder_variables(self, neuron_gr... |
f556ec649fcdc8805bb680985af5d6b4e2f369f3548b5d692b690abe2e2d0ace | Python | 4,908 | 124 | import random
import numpy as np
from PymoNNto.Exploration.Evolution.Interface_Functions import *
from PymoNNto.Exploration.Evolution.Evolution_Individual import *
class Default_Breed_And_Select:
def __init__(self, parent, death_rate, mutation, individual_count, constraints, additional_evo_params={}):
sel... |
869ea2b9ec3ec1eaed9b296d9e1041a06ca5d4d340c27d231773de710019cc2b | Python | 4,910 | 166 | import os
import numpy as np
import sys
from seriate import seriate
from scipy.spatial.distance import pdist
def seriate_x(x):
Dx = pdist(x, metric = 'cosine')
Dx[np.where(np.isnan(Dx))] = 0.
ix = seriate(Dx)
def load_npz(ifile):
ifile = np.load(ifile)
pop1_x = ifile['simMatrix'].T
pop2_x = ... |
fe7062351a63cb4e40cb4cbe16e94f9b486fb89a65a719e330141a8223bbbc79 | Python | 4,911 | 172 | """Complex Hermitian space.
Lead author: Yann Cabanes.
"""
import geomstats.backend as gs
from geomstats.geometry.base import ComplexVectorSpace
from geomstats.geometry.complex_riemannian_metric import ComplexRiemannianMetric
class Hermitian(ComplexVectorSpace):
"""Class for Hermitian spaces.
By definition... |
d4625f221318ba174f5e96b821b3efa65306cde0b56fcc2f7cb75091d25d1735 | Python | 4,916 | 147 | """The diversity filter is a memory for repeated SMILES
Depending on the concrete filter, scaffolds or SMILES that are repeatedly found
are memorized. Filtering happens on a given minimum score.
"""
from __future__ import annotations
from typing import List, Optional, Tuple
from abc import ABC, abstractmethod
import ... |
b5c2baf0761d67b4c55dbe20241be5c5fb4967314c020deb51d3406c09626f01 | Python | 4,917 | 118 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import torch, torchvision, random
import numpy as np
from torch.utils.data import TensorDataset
RANDOM_SEED = 10
STD_DEV = torch.from_numpy(np.array([0.2023, 0.1994, 0.2010]))
MEAN = torch.from_numpy(np.array([0.4914, 0.4822, 0.4465]))
... |
519c57af561bc409b207fcdba4926e5d25e150919169336f7fa0c40786cfc2b1 | Python | 4,918 | 116 | #!/usr/bin/env python3
import os
RNG_SEED = 0 # random seed to be used
USE_GPU = False # whether or not to use a GPU
GPU_ID = 0 # GPU index (if multiple GPUs available)
GPU_MEM = 10000 # GPU memory to use (MB)
os.environ["PYTHONHASHSEED"] = str(RNG_SEED)
if USE_GPU is True:
os.environ["CUDA_VISIBLE_DEVICES"] = s... |
78efab337ed62afda617f64ae53d4d8e3fde283748ae2e10c59e5baca0755f11 | Python | 4,918 | 139 | from PymoNNto import *
def get_unique_non_partitioned_Groups(groups):
temp = {}
result = []
for g in groups:
key = ','.join(g.tags)
if key not in temp:
temp[key] = [g]
result.append(g)
else:
temp[key].append(g)
return result
#############... |
11414fd97e8f7768c57f5d41cc4fa18d5282d3a8c3065607e9039925fde73006 | Python | 4,925 | 135 | #!/usr/bin/env python
'''
Alex Crits-Christoph
License: GPL3
Finds Circular Contigs in assembled metagenomes by checking for start/end forward alignment.
'''
import sys
import argparse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
import os
import tempfile
import subprocess
import fractions
#Build dictiona... |
ca9d13ab9b279f5465957b1b841962fb98788fc56ecc998dbffd253b370cbc46 | Python | 4,928 | 91 | # Copyright © 2023 German Cancer Research Center (DKFZ), Division of Medical Image Computing
#
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pandas as pd
from radtract import parcellation, features, tractdensity
import nibabel as nib
import os
def load_data():
data_folder = os.path.dirname(__fi... |
68d5046456cee8672435adb23feadc6517817a1b54ce09cf7918966c2212f4ca | Python | 4,929 | 99 | from DeepPurpose import utils, dataset
from DeepPurpose import DTI as models
import warnings
import itertools
import numpy as np
import pandas as pd
import wandb
from tqdm import tqdm
import sys
warnings.filterwarnings("ignore")
import random
import argparse
import threading
import os
def main(cuda_id, num_workers, so... |
2ea4a9b97fced1576656c179c7a091e0df78b48842b58f468941e8186254ed3e | Python | 4,935 | 119 | #!/usr/bin/env python
"""This is a simple python script to perform an integration
test on bam-readcount. It uses a small BAM generated by merging
two 1000 Genomes sequencing for NA12878 and NA12892.
See https://github.com/genome/somatic-snv-test-data for info
on the BAMs and reference. These are subsets of the ones fro... |
f8f784d3655359aefe3f90a69997e081fa6ef98b5163fae9a5228289644253df | Python | 4,935 | 163 | """Reinvent transfer learning
Reads in a SMILES file and performs transfer learning.
"""
import os
import logging
from functools import partial
import torch
import torch.optim as topt
from reinvent.runmodes import TL, create_adapter
from reinvent.utils import setup_reporter, read_smiles_csv_file
from reinvent.chemi... |
2aad28f00fad0a40c819e49708b529f764abf3e98d57e27168818ae8bfaf1b7e | Python | 4,938 | 131 | import itertools
import unittest
import numpy as np
from ..image_measures import measure_of_chaos, _level_sets, _default_measure
class MeasureOfChaosTest(unittest.TestCase):
@unittest.skip("Deprecated. This test compares exact values and fails since scientific details have changed.")
def test_measure_of_cha... |
59d3a297f0d8a5780465614067cd03dbdd7db6d0b24c64db10f2156f25981fff | Python | 4,939 | 181 | """Iain Watson's Lilly Medchem rules
Compute the demerit score for each SMILES. Could be implemented as a filter
using the default demerit of 100 or the relaxed demerit of 160 as boundary.
"""
__all__ = ["LillyMedchemRules"]
import os
import shlex
import re
import tempfile
from dataclasses import dataclass
from typi... |
9cec6eadd3e842fd8ee9d5adc3f3480a9054928c81377e9547cc2eca8b50464e | Python | 4,942 | 150 | from typing import Callable, Dict, Optional, Type
import torch
from .blocks import (
AtomicEnergiesBlock,
EquivariantProductBasisBlock,
GeneralNonLinearBiasReadoutBlock,
InteractionBlock,
LinearDipolePolarReadoutBlock,
LinearDipoleReadoutBlock,
LinearLesReadoutBlock,
LinearNodeEmbeddin... |
74dff21808dc8c7738716a46f8a27b7f9111a7ffb9814b208b97ea1a83849d6d | Python | 4,946 | 86 | """celsusdjango URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... |
e16ef52c8b63c67beadfc99a869f529c09af0c29d002c614f5bd7ca73bd6f35b | Python | 4,946 | 130 | """The Pepinvent sampling module"""
__all__ = ["PepinventSampler"]
from typing import List, Tuple
import logging
import torch.utils.data as tud
from rdkit import Chem
from reinvent.chemistry import tokens
from .sampler import Sampler, validate_smiles
from . import params
from reinvent.models.transformer.core.dataset... |
c036eed858fbbfef6a6ef760695ba70dc161cb3531f07205cdd88ce3eadc8f89 | Python | 4,947 | 141 | # 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... |
c071fa10d056420a7bda49f47038e1400becf9f488716db827158c4bfca088be | Python | 4,947 | 156 | """File globbing functions based on snakemake.io library."""
from __future__ import annotations
import collections
import os
import re
from itertools import chain
from pathlib import Path
from typing import Sequence
from snakebids.types import ZipList
from snakebids.utils.containers import MultiSelectDict
def rege... |
0d4367230f5dc58e813251d48f4415936d0c764234f738623243be67d0e787dd | Python | 4,949 | 145 | from __future__ import annotations
import warnings
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import snakebids.paths._templates.spec_func as spec_template
from snakebids.paths import bids_factory, specs
from snakebids.paths._config import reset_bids_spec, set_bids_spec
from snakebid... |
8578060c467e94404b6310342088e87733812a6ba9b5e116104a8958492bd64c | Python | 4,950 | 152 | """Learning embedding of graph using Poincare Ball Model."""
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.datasets.prepare_graph_data import HyperbolicEmbedding
from geomstats.datasets.utils import l... |
8366de8a926bacd231ee5cc12d95acf78e86c3715e026b7dbffc987bb4621665 | Python | 4,952 | 144 | """
FileName: utils.py
Description: The utils we may use for GNN model or Explainable model construction
Time: 2020/7/31 11:29
Project: GNN_benchmark
Author: Shurui Gui
"""
import torch
from torch_geometric.utils.num_nodes import maybe_num_nodes
class ReadOut(torch.nn.Module):
def __init__(self):
supe... |
69d99a6eed9c7d901784747464e95166e7707df55a0148dd5b35d6b7888640a4 | Python | 4,953 | 167 | """Focused tests for local Dandiset and remote NWB collection boundaries."""
from __future__ import annotations
from collections.abc import Iterator
from contextlib import contextmanager
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
import h5py
import numpy as np
import pyte... |
886cc29a32c77c60fbb1709c857aa48553c6131c1acd17cc04ddea7cee5972ef | Python | 4,954 | 148 | #
# This module contains I/O helper classes for this project.
#
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
import numpy as np
def load_training_density(filedir):
"""
# Load the MD density data of the classification.
#
# Input
# =====
... |
68c2f430e1eba3abd53274158a0c5a55ce9b7c8a93ce203d07fa65df8e591ddb | Python | 4,955 | 108 | import numpy as np
import json
from sklearn.preprocessing import normalize
import pickle
# import pickle5 as pickle
import os
#
bn_atlas_file = 'PROJECT_DIR/scripts/features/bnatlas_tree.json'
with open(bn_atlas_file) as f:
bn_atlas=json.load(f)
if __name__ == '__main__':
# save np.load
np_load_old ... |
9f455ca241e8b7bf8e3f0b52eb21430b139f7f76019a6fe27d670e8d972b4e8d | Python | 4,955 | 153 | """Test linear IVAC solver against a reference implementation."""
import data
import numpy as np
import ref_ivac as ref
import utils
from ivac.linear import _ivac_weights as ivac_weights
from ivac.linear import _solve_ivac as solve_ivac
def ref_is_close(test_output, ref_output):
test_evals, test_evecs = test_ou... |
a258dbbdfc2bd9d4aeb40fb74e43ce95f2afbaea8dd2350631da0beac14cfdc1 | Python | 4,955 | 84 | from os import PathLike
from pathlib import Path
from typing import Optional
from urllib.request import urlretrieve
from .utils import _print_progress
WEIGHTS_URLS = {
"graph-ice-cu111": "https://zenodo.org/records/10054348/files/weights_ice-cu111.pth?download=1",
"graph-ice-au111-monolayer": "https://zenodo.... |
6c26ea08e442163d181f79358e41f908c1cec9df1f6fd4591e546093577f69ce | Python | 4,956 | 88 | """Do the shipped motif tables still put the same records together?
``vdjdb diff`` keys ``cluster_members.txt`` on ``cid``, and a cid is
``<species>.<chain>.<epitope>.<n>`` where ``n`` is a position in a sorted list - so renumbering one
cluster relabels every cluster after it and the row comparison reports the whole f... |
952acc26d3ffd38240ddf37565f7e1ff5f7fec07389ecee07fd93f251bbb2d4b | Python | 4,961 | 170 | # 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... |
61434fc0c6c0455738e563bcd9f101892c1c4491592d7c7eb4962c446f006d6c | Python | 4,963 | 136 | """`mace_prepare_data` reads the property keys it is told to read.
The preprocessing CLI takes its own `--virials_key`, `--dipole_key`,
`--charges_key` and `--polarizability_key`, and nothing passed them. The training
side of the same convention is covered, but preprocessing is a separate parser
writing a separate art... |
da2819542f03e7d76bca4c455425452abc9dd39f6fbd49b298d074f320549cfa | Python | 4,963 | 132 | """
This file contains functions that collect or extract information from a tree,
functions that "reduce" or ("fold" or "accumulate" or "aggregate") a tree to some value,
e.g. a scalar value like the depth of the tree,
or a list with SMILES strings of all intermediates in the tree.
AiZynthFinder trees contain three ty... |
98b0857f2f249cd05e2e75a434544ffedfaae82978c0697a00b3bb7e31cafddc | Python | 4,964 | 150 | """Tests for loading, detecting, and reading results from ``bAnalysis``."""
from pathlib import Path
import pytest
import sanpy
@pytest.fixture(scope="module")
def detected_analysis(test_data_dir: Path) -> sanpy.bAnalysis:
"""Load and analyze the stable single-sweep ABF fixture.
Args:
test_data_di... |
fc916401dc5e4e41085ce87f0370604a119f81cd3112ff2244aa9d4b83624dbb | Python | 4,964 | 116 | """
Script that instates and train a LSM to recognize the 18 classes of the
MIT-BIH arrhythmya dataset.
To work out the data shown in Fig 12, one needs to unhide the sections
commented away. Likely, due to changes of the platform, the hyperparameters
need tweaking to converge towards the same results as the one... |
9e243f15f8c96d71f752156f7c166b67dd1c3be281bd40767fc2478dc20f01a7 | Python | 4,966 | 140 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy.signal import find_peaks
from sleeprnn.data.utils import filter_iir_lowpass, apply_bandpass
def kcomplex_stamp_split(
signal,
stamps,
fs,
highcut=4,
left_edg... |
c43d2f7920fe865ca32d05d7addcc0aa5b6afd6d59300e08ea38a8b73950b3b5 | Python | 4,968 | 141 | from re import compile
from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage]
from qtpy.QtGui import QColor, QColorConstants
from qtpy.QtWidgets import QInputDialog, QVBoxLayout, QWidget
from idtrackerai.GUI_tools import (
AddBtn,
CanvasMouseEvent,
CanvasPainter,
CustomList,
... |
437c6429b3e2728aa2c198a2b7c54cbd48e37784ad5691cd50d17b9c4b01dd4a | Python | 4,969 | 165 | #!/usr/bin/env python
#
# fimpy documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
f25dee4ac918bafe5b74c686d8fa5c415aa216f64561bd92020ee44796ed2ed4 | Python | 4,970 | 143 | import math
from collections import OrderedDict
import einops
import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
from model_angelo.gnn.backbone_distance_embedding import BackboneDistanceEmbedding
from model_angelo.models.common_modules import LayerNormNoBias
from model_angelo.utils.affine_ut... |
f2b4189bb8d30fa8879c3405e1982757ee2d94dd2013fa2313e815b901f293ea | Python | 4,971 | 116 | # -*- coding: utf-8 -*-
import os
import numpy as np
import logging, argparse
import configparser
import time
def parse_args():
# Argument Parser
parser = argparse.ArgumentParser()
# my args
parser.add_argument("--verbose", action = "store_true", help = "display messages")
parser.add_argument(... |
002160e6c45ef970e7120998afdd0ff08aa3dc981f8df5af204ff913a512db6c | Python | 4,975 | 120 | from ._ase_datamodule import ASEDataModule
from nequip.utils.file_utils import extract_tar
from nequip.utils.logger import RankedLogger
import os
from typing import List, Callable
logger = RankedLogger(__name__, rank_zero_only=True)
_URLS = {
"HfO": "https://drive.google.com/uc?id=1-DVMGyXjvNYaBtaAkWu8uQVgvz8pEg... |
044a20ebc20a38691b7dfc8770001bbde89c4b185b4ee5edc6e7ea35b80cdcd6 | Python | 4,975 | 155 | """Check that every trainable model parameter is registered in the optimizer.
The training entry point (mace/cli/run_train.py) builds the optimizer from
explicit named parameter groups in mace.tools.scripts_utils.get_params_options.
A submodule missing from those groups would silently receive no gradient
updates, so g... |
a4be9d83b3747016e8179ee5273f7def6859516a4029ca21183996042685ae33 | Python | 4,975 | 164 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
"""Shared pytest... |
1e1db18550ca376ff24921c244fc1fd337575bd12af6086a26065033df6d5d03 | Python | 4,979 | 102 | import numpy as np
import json
from sklearn.preprocessing import normalize
import pickle
import os
#
bn_atlas_file = 'PROJECT_DIR/scripts/features/bnatlas_tree.json'
with open(bn_atlas_file) as f:
bn_atlas=json.load(f)
if __name__ == '__main__':
best_split_id = [2, 2, 2, 2] # correspoding to split inde... |
144ce660a231d8494dd42221bee753349c49f0862be2fd51fbe7d31b6ce5682b | Python | 4,982 | 157 | import numpy as np
from sklearn.metrics import matthews_corrcoef, confusion_matrix, roc_curve, auc
import prettytable as pt
import torch
def eval_metrics(probs, targets,cal_AUC=True):
threshold_list = []
for i in range(1, 50):
threshold_list.append(i / 50.0)
if cal_AUC:
if isinstance(pro... |
051b0b737317d793883c8fd8aba7a69dba5b027059facf8a9360f4815aa3e58b | Python | 4,983 | 137 | import siVAE
import logging
import os
import tensorflow as tf
import scanpy as sc
import pandas as pd
import anndata as ad
import numpy as np
## System
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # no debugging from TF
os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3'
logging.getLogger('tensorflow').disabled = Tr... |
acfb8b059af279bae9d25e37a7831d5760fdfb40fbfa86f98a07ee760da22f42 | Python | 4,983 | 186 | from Purkinje_morpho_1 import Purkinje_Morpho_1
from neuron import h
import multiprocessing
from Purkinje_morpho_1_number import number_ind_1
import numpy as np
import matplotlib.pyplot as plt
Hines = h.CVode()
Hines.active(0)
spines_on = 0 # switch between 0 (no spines) and 1 (spines)
stimdata = dict()
stimdata['st... |
b9dcef8f36ee9e969b90bc0892f4a9868b7b14ae7092ce545509a68c4dbbd1f6 | Python | 4,984 | 98 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
68eb9c11ecb6eb787c42876023265b2b69035d05bc9e6e476087a6e9e7b6025a | Python | 4,985 | 155 | import tensorflow as tf
class FCNN(tf.keras.models.Model):
def __init__(self, num_samples, dropout_rate=0.35):
super(FCNN, self).__init__()
self.flatten = tf.keras.layers.Flatten()
self.dense1 = tf.keras.layers.Dense(1110, activation='tanh')
self.dropout1 = tf.keras.layers.Dropout(d... |
db48ca333d5025b4c0bcca35d576e7ee8dadd90e0af1f7bebf12bc2553401f5d | Python | 4,985 | 127 | import argparse
import pandas as pd
import numpy as np
from keras.models import load_model
from sklearn.metrics import confusion_matrix, precision_recall_curve, roc_curve, auc
# Calculate and update the best metrics, fold index and results
def best_fold_metrics(fold_index, auroc, auprc, recall, fold_results):
glo... |
fccc1fe9c251b1e826464400fbd1fdf7185b61a7f19b5f9189bfdd118503b273 | Python | 4,986 | 150 | import pytest
import numpy as np
import torch
from nequip.data import AtomicDataDict, compute_neighborlist_, from_ase
from nequip.nn.embedding import NodeTypeEmbed
from nequip.nn import SequentialGraphNetwork, SaveForOutput, AtomwiseLinear, GraphModel
from nequip.nn.utils import with_edge_vectors_
from nequip.utils i... |
2ba72f7b25fdd6d8a566a76406d7d9ce499f35c07d1f2e3221205fe686a2ac9a | Python | 4,987 | 207 |
import numpy as np
from matplotlib.axes import Axes
from matplotlib.ticker import FuncFormatter
import time
import pdb
class Event:
def __init__(self, dataSource, applicationSettings):
self.dataSource = dataSource
dataSource.addEvent(self)
self.applicationSettings = applic... |
2ff546522fae868d07d18c8efc145c682147cc0ae06fe0648fcf48cffd608173 | Python | 4,990 | 109 | import torch
from torch import Tensor
import torch.nn as nn
from torch_geometric.utils.loop import add_remaining_self_loops
from ..models.utils import subgraph
from ..models.ext.deeplift.layer_deep_lift import DeepLift
from .base_explainer import WalkBase
EPS = 1e-15
class DeepLIFT(WalkBase):
r"""
... |
dd9b1acaedac406ca0118f630c25421105342cc84dedfd2c1044a5c5f7e0ebb0 | Python | 4,990 | 176 | import gc
import struct
from pathlib import Path
import click
import nibabel as nib
import numpy as np
from tqdm import tqdm
def _convert_bin(path: Path, reference: Path) -> nib.Nifti1Image:
ref = nib.load(reference)
axcodes = nib.aff2axcodes(ref.affine)
# The original .bin files are stored in LPS order... |
aba59845c51f684bccb05493e8c59bf9324fa8502528d6af0bdd7d7122c216bb | Python | 4,998 | 114 | # 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... |
7728f812ee5d1a362e1d151fae6a1be5b4d2f5c31662e8017fa1b0ed95dfd1a3 | Python | 4,999 | 207 |
import numpy as np
from matplotlib.axes import Axes
from matplotlib.ticker import FuncFormatter
import time
import pdb
class Event:
def __init__(self, dataSource, applicationSettings):
self.dataSource = dataSource
dataSource.addEvent(self)
self.applicationSettings = applic... |
198b3947d89599d62ca4cfacfff2577b6e2cac6b77dc8562046c6f65a6f164d5 | Python | 5,002 | 140 | # Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from typing import Iterator, Tuple
from openfl.federated ... |
e7630acd8d230d3ed45200ff2562aa18a4fd4f58dbf839cbcc3c2f3d8f85b73b | Python | 5,002 | 137 | """Tests for reinvent/utils/config_parse.py pure-function utilities."""
import pytest
import tempfile
import json
from reinvent.utils.config_parse import (
has_multiple_attachment_points_to_same_atom,
find_invalid_tokens,
validate_tokens,
read_smiles_csv_file,
)
# ── has_multiple_attachment_points_to... |
925e0722dbf6798927ed9065ccd707e54c9af3171a4cd4f33c4aa615b9894ccb | Python | 5,003 | 157 | import flammkuchen as fl
import numpy as np
from joblib import Parallel, delayed
from split_dataset import Blocks, EmptySplitDataset
from fimpy.alignment.volume import (
align_block_shift,
find_shifts_sobel,
shift_stack,
sobel_stack,
)
def _get_shifts(dataset, tstart, tend, fft_ref, prefilter_sigma):... |
43e5f5e13a39daa8acb4f0ffed0449d458054d9b719084dfd4ad2cfa05ab1ae0 | Python | 5,006 | 115 | import tensorflow as tf
from common.models.conv_blocks import ResBlock, ConvBlock
from common.models.local_pooling import AttMaxPool2D
class ResNet28():
def __init__(self,
spectrogram_length,
spectrogram_width,
config_dict,
use_se,
... |
aa87090b426773c543c2ec5e1c32d2a7990a527e7590830d2cd5df6b70d37c59 | Python | 5,007 | 109 | 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... |
f6b9d141fabfc89113c6ad201e5a4307df72b6f7d7e2895fac5b4bca4b56132b | Python | 5,007 | 140 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from typing import Iterator, Tuple
from openfl.feder... |
7c7453236e4b449b1b311f05b8d21d25a4c05ff7ddeac55b72eddb61fe097bd6 | Python | 5,014 | 158 | """
Various utility functions for dealing with bounding box data, including
conversion between various bbox representations, finding centroids, and
calculating "intersection over union" (IoU) of two bounding boxes.
Author: Tal Eisenberg, 2021
"""
import numpy as np
def xywh_to_centroid(xywh):
"""
:param xywh... |
9bc331e005c199e853a38f0939d33b8438d2877d1dfebff3c7f3df93db125d88 | Python | 5,018 | 242 | from abc import abstractmethod
from typing import Dict, Optional, Type
from overrides import overrides, EnforceOverrides
class ChromaError(Exception, EnforceOverrides):
trace_id: Optional[str] = None
def code(self) -> int:
"""Return an appropriate HTTP response code for this error"""
return 4... |
f45108132fa36ee7933e70d668322fa845667d804db07983b84ace4d48c79268 | Python | 5,022 | 190 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""
Evaluate a trained pytorch-lightning model on a given dataset.
"""
from train import (
evaluate_graph_classification,
get_datasets,
evaluate_graph_regression,
MODEL_CONSTRUCTORS,
)
import pytorch_l... |
c9811019bee4d823fd0aac904b7301cc2cdffbe13f5ad1662697b8917dfc9d6f | Python | 5,024 | 135 | """
splitSpeciesReads.py
Designed to separate reads from the two species in hybrid data.
Adapted from GetGeneASEbyReads.py by Peter Combs.
NOTE: Input bam files MUST be sorted by mate-pair.
NOTE: Human is always the reference file regardless of which SNP file is used.
Last edit: 07.27.2016
"""
from __future__ imp... |
17d5b8d7a4735610db83ee15799ca2bb4406dc92ece0fdbfec715e9fda5582db | Python | 5,025 | 145 | import torch
import time
import numpy as np
import torchfields
from metroem import helpers
from metroem.loss import unsupervised_loss
def combine_pre_post(res, post):
result = post.from_pixels()(res.from_pixels()).pixels()
return result
def optimize_pre_post_ups(src, tgt, initial_res, sm, lr, num_iter,
... |
d385195f56648c2b6a912ade79d086347be269f291ff43e73f8971c2dc62678f | Python | 5,025 | 164 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
# @Auther: AcDrogen
# @Email: Nothing
# @File: baseFunc.py
# @Time: 14:12
# @Version: V1.0
"""
# -----------------------
import os
import sys
import numpy as np
import pickle as pkl
# par_dir = os.path.dirname(os.path.abspath(__file__))
# os.chdir(par_dir)
sys.path.append... |
54ba81d5e0cc2096afe220306163f202303da32e1df7a28adc60c049d5fe1db2 | Python | 5,026 | 129 | import numpy as np
def solve(matr, rhs, args, status=None, linsolver="direct"):
import scipy.sparse
import scipy.sparse.linalg
if args.linsolver_maxiter is None:
if args.linsolver == "lsqr":
args.linsolver_maxiter = 1000
else:
args.linsolver_maxiter = 50
def g... |
6216a37c7fd549d4d475da69a098f9809cd4982db534a15543e97da3a0070650 | Python | 5,029 | 163 | from .connection import (
ConnectionCmpWithPointTransformTestData,
ConnectionCmpWithTransformTestData,
ConnectionComparisonTestData,
ConnectionTestData,
)
from .mixins import DistMixinsTestData
class RiemannianMetricTestData(DistMixinsTestData, ConnectionTestData):
def metric_matrix_vec_test_data(... |
2af1fb69dfbab188eb6b8484ca81732688321301ace742a2b46cc19079e716dc | Python | 5,032 | 153 | """ Minor modification to allow glob_wildcards() to have multiple occurence of
same wildcard """
import collections
import os
import re
from itertools import chain
def regex(filepattern):
"""Build Snakebids regex based on the given file pattern."""
regex_list = []
last = 0
wildcards = set()
for m... |
2f6f56cc9cd7477f1c74b34580dfa87023791421cd2063086e2e4814cbd3b1ee | Python | 5,032 | 114 | import numpy as np
import tensorflow as tf
# based on tfa.image.distort_image_ops
def adjust_hsv_in_yiq(input: tf.Tensor) -> tf.Tensor:
image, delta_hue, scale_saturation, scale_value = input
delta_hue = tf.squeeze(delta_hue)
scale_saturation = tf.squeeze(scale_saturation)
scale_value = tf.sq... |
a442cb675e4d583d84c44357bfdce7f83b4d45dea6c0fdee8dbe876fe48f63c1 | Python | 5,032 | 114 | """
MIT License
Copyright (c) 2017 Sadeep Jayasumana , Miguel Monteiro, Walter de Back
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights... |
ac1f44e6cf1d96d527410fe6fd17279b4ce39e0d0527fc75bc43e38385ccd61f | Python | 5,033 | 154 | import numpy as np
import torch
import matplotlib.pyplot as plt
from skimage.transform import resize
from skimage.io import imsave, imshow_collection, imshow
from skimage.draw import line, rectangle, rectangle_perimeter
def np_to_torch(img_np):
'''
np torch
--- ---
512 x 5... |
7284613b713dc408570a05127468c3c9d7067c2c71611e21ddbd5ffe11cb7069 | Python | 5,035 | 122 |
# The following functions are exempt from the above copyright notice licence
# They are made availbale under the following licence of the scipy cookbook:
# Copyright (c) 2001, 2002 Enthought, Inc.
# All rights reserved.
#
# Copyright (c) 2003-2017 SciPy Developers.
# All rights reserved.
#
# Redistribution and use in... |
622e693492d23940d315e05ef90b889660176736d7d50c2b700a30e008b59ca9 | Python | 5,038 | 158 | import sys
import matplotlib as mpl
mpl.use("Agg")
import matplotlib.pyplot as plt
import dadi
import numpy
import scipy
import pyOpt
import dadiFunctions
def readLFromFSFile(fsFileName):
with open(fsFileName) as fsFile:
lines = []
for line in fsFile:
if not line.strip().startswith("#")... |
23762555cc80f1a53faf0a8608bf0ece13eda114f882aca2f7d2cae1ad9de02a | Python | 5,041 | 110 | """Small independent probability checks for fresh network fitting."""
import json
import pytest
pytest.importorskip('pgmpy')
import numpy as np
import pandas as pd
from processing.record_score_learning import fit_network, learn_structure
from vdjdb.score.learning import predict_network
def test_supervised_counts_a... |
0262dcfd222e8cd5b01a03ee66420ae7fe42a8c36e20dd439e75e229a081bbaa | Python | 5,042 | 146 | import numpy as np
import numba
from numba import jit, prange, f4, c8, u1
import math
@jit("void(f4[:,:])",nopython=True,parallel=True,cache=True,fastmath=True)
def fastlog_2(f):
'''Step 1 of FFT-based spatial filtering: computing the log of the input video.
Inputs:
f(numpy.ndarray of float32, shape... |
7c4444b33a088e768a7bf05c6b7409ae2c1141a52f7d6aa471c201ddf8ce0fec | Python | 5,042 | 137 | from warnings import warn
from functools import partial
from tqdm import tqdm
import torch
import numpy as np
from torch.optim import Adam
from torch.nn import MSELoss
from odl.contrib.torch import OperatorModule
from odl.tomo import fbp_op
from dival.reconstructors import IterativeReconstructor
from dival.util.torc... |
0e442a04080cced630f90ac63904123f72d6ae99b66d5f688222d9bc43ebfc87 | Python | 5,045 | 144 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""
Data statistics and metrics managers work with BaseModifier, its subclasses (and perhaps classes that mimic their behavior) under the hood.
The action of a modifier:
- `AtomicDataDict` -> `torch.Te... |
5475f35dc64b69a6db1ee3055fde46e87fcd98f3a7d2718f23359accd5ef4495 | Python | 5,045 | 148 | import random
import pytest
from geomstats.geometry.lower_triangular_matrices import StrictlyLowerTriangularMatrices
from geomstats.geometry.positive_lower_triangular_matrices import (
CholeskyMetric,
InvariantPositiveLowerTriangularMatricesMetric,
LowerMatrixLog,
PLTUnitDiagMatrices,
PositiveLowe... |
f742392a82e1e46d3eb6617340d493a251e454885034c694edebcce431bb5e75 | Python | 5,045 | 125 | from typing import Tuple, Dict
import haiku as hk
from jax import numpy as jnp
from deeperwin.configuration import OrbitalsConfig, MLPConfig
from deeperwin.model import WavefunctionDefinition, DiffAndDistances, Embeddings
from deeperwin.model.orbitals.baseline_orbitals import BaselineOrbitals, _determine_baseline_out... |
7aa08854e36ce3108cfcaf83a3de3f111e6241989afe29c7d8291e49b7d7d872 | Python | 5,046 | 132 | """Extract a complete acquisition snapshot through verified PyABF APIs."""
from __future__ import annotations
from pathlib import Path
import numpy as np
import pandas as pd
import pyabf
from .models import EPOCH_COLUMNS, AcquisitionSnapshot
def snapshot_abf(path: str | Path) -> AcquisitionSnapshot:
"""Read e... |
1263f18e3f5774e9f063a89c0d58811e7b405cf34e06c5d27be99b8a059bf229 | Python | 5,047 | 174 | import glob
import torch
import sys
import os
import json
import argparse
from PIL import Image
from cvnets import get_model
from options.opts import get_training_arguments
from torchvision import transforms as T
def create_image_classes_dict(data_path):
assert os.path.exists(data_path), "dataset... |
6a1e6f1e2c9e4d0d4d572e3e5e76001525f88b4e34254e5177e2992216812f56 | Python | 5,049 | 157 | import multiprocessing
import multiprocessing.context
import sys
import time
from multiprocessing.synchronize import Event
import chromadb
from chromadb.api.client import Client
from chromadb.api.models.Collection import Collection
from chromadb.cli import cli
from chromadb.cli.cli import build_cli_args
from chromadb.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.