sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
be8a5fbce140df6152589debc0153904250dab4d40511bc466f8599269091e5a
Python
12,189
308
"""A synthetic Haxby-like dataset, built the way `Simulator` builds data. Despite living beside the fetchers in `nltools.datasets`, `load_haxby_example` downloads no data: it injects condition-specific signal into a few spheres of the package's 3 mm MNI brain mask (or, on request, into a tiny synthetic volume). That m...
8e5e307f49143efa7f4669486cbdc9188f3016c4e3f7ceafe26c6ca55e337bf6
Python
12,192
349
r"""The manifold of Positive Semi Definite matrices of rank k PSD(n,k). Lead author: Anna Calissano. """ import geomstats.backend as gs from geomstats.geometry.fiber_bundle import FiberBundle from geomstats.geometry.full_rank_matrices import FullRankMatrices from geomstats.geometry.general_linear import GeneralLinear...
bb0b948f4381a64c882cca82c5d7038ca8be7b18ca9bb36574af90f12d86718f
Python
12,204
347
# -*- coding: utf-8 -*- """ Created on Thu Jun 8 15:45:24 2023 @author: Em """ from torch import (#where, zeros_like, tensor, exp, ones, zeros, is_tensor, #stack, ...
3c99f90614a49962642ef81981b06595de925f3f2f12ce33bcb9e74d272db5d6
Python
12,215
254
import numpy as np import scipy import pandas as pd import itertools import os from sklearn.preprocessing import minmax_scale from sklearn.linear_model import LinearRegression from sklearn.cluster import KMeans from sklearn import metrics from .data_loading import PTIterator, CNIterator, Paired_data_iterator, val_PT_co...
92f23cf2c5ba17975c0b25592ccd13329e9a7a6933c31bbee48af423485c708e
Python
12,220
241
# 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 ...
5692998db334c0f2dda7aee3cae3c364482ac33819c2b9ea23280d15491b9fb4
Python
12,222
344
# 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 ._workflow_utils import set_workflow_state from ._compile_utils import COMPILE_TARGET_DICT from nequip.model.utils import _EAGER_MODEL_KEY from nequip.model.saved_models.load_utils im...
d5c35af9ac630f877b7d5b01442bb700eb44305e7fffb888def3066216e5455a
Python
12,223
384
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== """Unit tests fo...
0c8f6ddf06275d3739223498e102282fc57c56e87bfbd54b17a89ef102d710dc
Python
12,228
348
"""Represent stimulus epochs for one recording sweep.""" from __future__ import annotations from collections.abc import Mapping, Sequence from typing import Any, Literal, Optional from pprint import pprint import pandas as pd import pyabf from pydantic import BaseModel, ConfigDict, field_validator from sanpy.sanpy...
834c69e1c57523decb296fa58d8e90e9943e27b1735c01e48771387e9eb3fcbf
Python
12,233
290
"""The published MACE-MDP model reproduces its committed reference. ``mace_mdp`` loads an ``AtomicDielectricMACE``, which is the **only** class in the tree that emits a ``polarizability`` (``mace/modules/models.py:1190``), so this is the one place that quantity is pinned at all. FM-2 converts this checkpoint; the numb...
f68c687bc33fd67a9cbb6217fce9a8e94e7f5075e1c50193b1a6ebfd6a5e3671
Python
12,238
373
from __future__ import annotations import platform import re import subprocess as sp import sys import tempfile from pathlib import Path from typing import Any, Final, Literal, TypedDict import copier import more_itertools as itx import pathvalidate import pytest import requests_mock from hypothesis import HealthChec...
e41b82b1f678237ca27785b6519f7620382f080ec331ff82ea52a5e12886e300
Python
12,239
348
from time import time import numpy as np from PymoNNto.NetworkCore.Base_Attachable_Modules import * from PymoNNto.NetworkCore.Synapse_Group import * from PymoNNto.Exploration.Evolution.Interface_Functions import * import copy import time import sys float32 = np.float32 float64 = np.float64 SxD = 0 DxS = 1 class Netw...
fa2a801315e4b968de961db3227a367cdad83f2cf687016d6c725eeb43ca0c72
Python
12,247
337
"""Functions to train and evaluate the classifier""" import gc import os import time import numpy as np import pandas as pd import torch from matplotlib import pylab as plt from .ConvNet import compute_device, accuracy torch.cuda.empty_cache() gc.collect() def find_lr_bounds(model, train_loader, opt_func, save,...
06dc0679263dbff1e74c460b1446b914f9f5cd845f7cfdbecfbbda1d143a7c80
Python
12,274
343
import os import random import time from pathlib import Path import numpy as np import torch import torch.distributed as dist import torch.multiprocessing as mp import webdataset as wds import yaml from torch import optim from torch.distributed.algorithms.join import Join from torch.nn.parallel import DistributedDataP...
1cf366690a77c56e2c68f54489e6b90ae2799aa1503c302a5b8bae30a5a1c327
Python
12,284
287
"""Tests for Adjacency modeling: bootstrap, regression, SRM, cluster summary, permutation generation.""" import numpy as np import pandas as pd import pytest from scipy.linalg import block_diag from nltools.data import Adjacency, DesignMatrix # Only `bootstrap` emits these two quality advisories, and the bootstrap t...
b26e8bb1e2e25e36224b74d300237677b25c0bbfd8adc98b2b0d2742abf68df9
Python
12,290
320
import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf from statsmodels.tools.sm_exceptions import PerfectSeparationError import scipy.stats as stats from co...
7ab3c444ec06211b0e535b70aba3d25b3b2f461b2e50d6bac7dcb1b28bdd1e37
Python
12,296
347
"""Determine sample sizes by interpolating run simulation outcomes.""" import numpy as np import xarray as xr from scipy.stats import linregress from scipy.interpolate import InterpolatedUnivariateSpline from ..metrics import mk_betweenAssocRelError, mk_weightError, \ mk_scoreError, mk_loadingError, mk_betweenCor...
4542289785ebe10d65e2f24811047f8ad0744ac0c1ee9b9d6191b77f8472cea4
Python
12,308
323
from torch import (tensor, is_tensor, cat, zeros, arange, exp, rand, randperm, manual_seed, bool as tbool, eye, ...
8fec2bb4aa57bbba5e60f1b8420f16783843a7cb7662ba5cd1dfde1853e28888
Python
12,319
349
""" mesh_parser.py parse mesh data from constant/polymesh """ from __future__ import print_function import numpy as np import os import re import struct from collections import namedtuple from .field_parser import parse_internal_field, is_binary_format Boundary = namedtuple('Boundary', 'type, num, start,...
f5a346b1c023fbba3cedc7498567a8c29ff91a8f3e61b6ef42a435a2d997d2e5
Python
12,326
346
import numpy as np from typing import List, Optional, Dict, Union import hashlib import pathlib import pandas as pd import ase from deeperwin.run_tools.geometry_utils import BOHR_IN_ANGSTROM import json ROUND_R_DECIMALS = 5 def dump_to_json(data, fname): def default_encoder(o): if hasattr(o, "to_json"): ...
176a6fc7d3467a431d048357aba71d9e2fe539e9e7ed356931b3c55cfdb192d7
Python
12,331
329
import pytest import geomstats.backend as gs from geomstats.geometry.diffeo import AutodiffDiffeo from geomstats.test.random import RandomDataGenerator from geomstats.test.test_case import TestCase from geomstats.test.vectorization import generate_vectorization_data class CircleSO2Diffeo(AutodiffDiffeo): """Diff...
bcd8e09e11894888cbfdcbaf38f147c95e94ed249ab5e206114019c4cbac00f2
Python
12,339
338
import uuid from random import randint from typing import cast, List, Any, Dict, Tuple import hypothesis import pytest import hypothesis.strategies as st from hypothesis import given, settings import chromadb from chromadb.api import ClientAPI from chromadb.api.types import Embeddings, Metadatas from chromadb.test.conf...
10da171b85691535bd021dda160b79d6db3c0e19a841c10a5d6bb10b98fadc82
Python
12,356
297
''' Description: Author: voicebeer Date: 2020-12-10 08:47:27 LastEditTime: 2021-02-27 03:08:48 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard i...
a44f3f3de00f6394c348cd02cf222ed92fe5ffd02db437cd938c9482ccd8955c
Python
12,358
350
from __future__ import annotations from typing import Any, Dict import numpy as np import pytest import torch from ase import Atoms from e3nn import o3 from mace import data, modules, tools from mace.calculators.foundations_models import mace_polar from mace.cli.convert_cueq_e3nn import run as run_cueq_to_e3nn from ...
8251a3881d8f669c4497ef7c2ffb3c0549091a9e35b9fed1c2ae00bf41bb69fc
Python
12,359
260
"""Optional pgmpy contract, run in the pinned confidence environment.""" import json import pytest pytest.importorskip('pgmpy') from vdjdb.score.bayes import fit, predict, predict_marginals def test_exact_missing_inference_roundtrip_and_deterministic_tree(): rows = [{'a_studies': '2' if i % 2 else '0', 'b_tcrne...
5271589869d29408e5d8e34faddeb264c60da8902791d77207bbc88a3d4a7268
Python
12,371
384
""" NeuroLearn Utilities ==================== handy utilities. """ __all__ = [ "get_resource_path", "get_anatomical", "set_algorithm", "attempt_to_import", "all_same", "concatenate", "_bootstrap_apply_func", "set_decomposition_algorithm", ] __author__ = ["Luke Chang"] __license__ = "MI...
1010afc83d832e128604ad9290316c43d98af8622e5dff1972bd1e266da50152
Python
12,389
336
#!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import method.io as io import method.nn as nn import numpy as np import pandas as pd import argparse from sklearn.preprocessing import StandardScaler from imblearn.over_sampling import SMOTE """ Treat this as a multi-label classification problem...
2f85cd826dd1fcf9677f8cbf12d00f411a95b1627cd207be028bc78e9d9f7848
Python
12,391
323
import os, argparse, subprocess, shlex, io, time, glob, pickle, pprint import sys import os import numpy as np import pandas as pd # import matplotlib.pyplot as plt # import tqdm, fire from PIL import Image Image.warnings.simplefilter('ignore') import torch import torch.utils.model_zoo from torch.utils.data import D...
1353f43fc22b9d65d985b6cb1787096cf47f4c994d8237807ad64258df03be34
Python
12,393
349
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import random import argparse from utils import logger from typing import Optional from common import DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT from . import register_sampler, BaseSamplerDP, BaseSamplerDDP from .ut...
2edca220b18feec2bb8ab67cec9dfc60f58b4bf802b942acd67b864afc340f0a
Python
12,397
344
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.16.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # `REINVENT 4.4`: Reinforcement Learning with DockSt...
71d6b5d2b32b69fc72d08cb3f19235d645ed4abff76448f86f916fe49382f9e8
Python
12,399
340
import pytest import logging import hypothesis.strategies as st from chromadb.test.property.invariants import check_metadata import chromadb.test.property.strategies as strategies from chromadb.api import ClientAPI import chromadb.api.types as types from hypothesis.stateful import ( Bundle, RuleBasedStateMachin...
6694ae0b273a5ad95bca1b63fccb5d0c533120669a13cb462a228f8cb05b3348
Python
12,409
344
import numpy as np from math import * #ms_per_step=2 #def step_ms(x): # return x*ms_per_step def SpikeTrain_ISI(x): result = [] last = -1 for i, x in enumerate(x): if x > 0: if last!=-1: result.append(i-last) last=i return result def get_bins(numbe...
832e14cc654c19e2ce3a1e512f48f468ba0db5973bda122d6fc3b13e446d5d4d
Python
12,410
284
"""How the magnetic anchor is driven, on each of the three surfaces. Shared by ``regenerate.py`` and by the two magnetic golden test modules, and that sharing is the point: a reference and the test that checks it have to drive the model the same way, and the only reliable way to guarantee that is for there to be one d...
8e9d4ff7459b03723fcab7099575838f7d4860bd5e0983ed82825ad18c668004
Python
12,414
513
import matplotlib import matplotlib.patches import matplotlib.pyplot as plt import numpy as np def plot_1d( domain, u_ref, u_state, path=None, title=None, umin=None, umax=None, slice_lim=0.1, transpose=False, invertx=False, nslices=6, dpi=300, transparent=True, ...
46a197f7c4071211699a656140ea233e7c4d646a1460db15ed079ca610aa57c9
Python
12,418
217
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
e7ad4cf4e834f1807bcfdcd54d29d449b3d5569574077722b0295494e7a2f8cd
Python
12,420
349
# model2b_experiment2.py - A simulation and model fit of Model 2b and Experiment 2 # # Copyright (C) 2023 Michael D. Nunez, <m.d.nunez@uva.nl> # # This program 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, e...
d16062a158487d6356a736a1c6b2bfddb8e76d950c505316d8cad4bf4c6cca09
Python
12,428
224
"""Structural audit of the cropped Stereo-seq fixture (called from the test script).""" import os import h5py import numpy as np BORDER_PAD = 32767 def audit(out_dir, source_dir, sn, x0, y0, size): res = [] def ck(name, cond, detail=""): res.append({"name": name, "pass": bool(cond), "detail": str(det...
42a1f41a221602297d1f13e7fa8bf90175ef858bf797706568fbe1a7030ed351
Python
12,433
334
########################################################################################### # This code is adapted from the Atom3d paper and the GVP paper # ATOM3D: # https://arxiv.org/pdf/2012.04035.pdf # https://github.com/drorlab/atom3d # # GVP: # https://arxiv.org/abs/2106.03843, https://ope...
574fbcede8b8c4511acaaa9319eac8186af0aa69331de4f79c0c88829e0d1edf
Python
12,438
359
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import mmap from pathlib import Path import io from typing import BinaryIO, List, Optional, Tuple, Union import numpy as np import torch imp...
ca3a2f061b470600dc49bcb55b2c50a72fa6e387794950b6be9acc5b24d6f1fd
Python
12,442
324
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Dict, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import utils fr...
910e5e42f6a340c6b23e0a516d6778c831640b2b5c7acda181ad5db28eaac279
Python
12,446
355
# nolapse_test_pystan.py - Testing fits of HDDM models without lapse process in Stan using pystan in Python 3 # # Copyright (C) 2021 Michael D. Nunez, <m.d.nunez@uva.nl> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
e1e0875c704f5addf90817f44343ac361fe02934c9bf28c86ddd652be9e238af
Python
12,446
414
## In this script we use to train both the permutation # equivariant network and the data augmentation during # training import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data import itertools # number of available gpu ngpu = 1 batch_size =...
5fcb93bb5b54623c3d18e6bbeb30320039cb46496fd96eaf7186a8ac4a662d61
Python
12,451
355
"""plotting_help.py Useful functions for matplolib plots """ import numpy as np from matplotlib.collections import LineCollection from matplotlib.colors import to_rgba import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt from matplotlib.offsetbox import AnchoredOffsetbox redorange = (.96, .59, .2)...
2b295f8454b0a12f7ca7163d92a434b0e5e6c151c28ce7516136afe7b64af885
Python
12,452
364
""" Code for sampling from diffusion models """ import json import os import multiprocessing as mp from pathlib import Path import tempfile import logging from typing import * from tqdm.auto import tqdm import numpy as np import pandas as pd import torch from torch import nn from torch.utils.data import default_coll...
aa1b8276225e9ed49ed44506f9d16cf98b5bc70f5ff17b1214d8a15378d9eced
Python
12,459
317
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Experimental Director module.""" import asyncio import logging import time from collections import defaultdict from pathlib import Path from typing import Any, AsyncGenerator, Dict, Iterable, Optional, Tuple, Union import dill from op...
abd0863bd3291e39eb65d4fadb75f276616ef4f647b41164f284df54b0bafc94
Python
12,467
341
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models 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 Cognitive...
e30069326e76779cf25720b960789a4b90dc968acac8122f48e35eb8e78c5088
Python
12,467
334
import pytest from unittest.mock import patch from chromadb import CloudClient from chromadb.errors import ChromaAuthError, NotFoundError from chromadb.auth import UserIdentity from chromadb.types import Tenant, Database from uuid import uuid4 def test_valid_key() -> None: with patch( "chromadb.api.fastap...
7810446986d03540e0b4677de9f8eea13b697977b91b76aa8f1c4a1340305d03
Python
12,477
334
# -*- coding: utf-8 -*- import numpy as np import functions.time_functions as tf from scipy import stats from sklearn.svm import SVC from sklearn import metrics from sklearn.linear_model import LogisticRegression from sklearn.model_selection import KFold from sklearn.model_selection import cross_val_predict from rando...
175efb8d8547ac09829267273a18611760d5eba087295e3b6e491230a40d5548
Python
12,480
294
import copy import torch import numpy as np from scipy.special import comb from itertools import combinations import torch.nn.functional as F from torch_geometric.utils import to_networkx from torch_geometric.data import Data, Batch, Dataset from torch_geometric.loader import DataLoader def GnnNetsGC2valueFunc(gnnNet...
2a9958bc6a089ddc1f2cb21ec7cf87766fb66066f2f366806b2d0604c5199202
Python
12,488
364
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib from argparse import Namespace from dataclasses import dataclass, field from typing import Any import torch import torch.nn...
20251f38a00b05a51aeca887ab1a1a2ca3b81da5c379144e279eec63732d735c
Python
12,498
291
''' Description: Author: voicebeer Date: 2020-09-14 01:01:51 LastEditTime: 2021-03-11 00:27:11 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard i...
af005c99dfe310c42e738cb47cfaf967c57d9e1d045d6a2032ffcb85abb37172
Python
12,500
299
import tensorflow as tf class WideResNet(): def __init__(self, spectrogram_length, spectrogram_width, outputs_list): self.spectrogram_length = spectrogram_length self.spectrogram_width = spectrogram_width self.outputs_list = outputs_list ...
163462af25e5de0d0ce30c430b549122187475c9d63406a1ec819ee5ca90155a
Python
12,501
319
import argparse from contextlib import nullcontext import numpy as np from scipy.spatial import cKDTree from model_angelo.utils.affine_utils import ( get_affine_translation, get_affine_rot, get_affine, init_random_affine_from_translation, ) from model_angelo.utils.fasta_utils import fasta_to_unified_s...
6d73e3f44a30740eab118d6027ced124046dfaf17d292a877b9666a590d83597
Python
12,501
246
import numpy as np import pandas as pd import seaborn as sns from multiprocessing import Pool from orientation_reconstruction_utilities import * from random_orientation_utilities import * import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits import mplot3d from mpl_toolkits.mplot3d import Axes3D fr...
f7e88cf562dcc81523d2e5176fceccfd51d4f1a8d84765510b9593f9d72e63a9
Python
12,501
428
import torch import torch.nn as nn import numpy as np import pysurvival.utils.optimization as opt # --------------------------- Activation Functions --------------------------- # class Swish(nn.Module): def forward(self, x): return x * torch.sigmoid(x) class Gaussian(nn.Module): def forward(self, x)...
fe740b6425c0a4036614e8748ea3cde7565f38d685d8b8b19bcfbc987963eb30
Python
12,507
357
from __future__ import annotations import abc import functools as ft import re from typing import TYPE_CHECKING, Any, Final, Iterable, Mapping, Sequence, cast import attrs import more_itertools as itx from bids.layout import BIDSLayout, Query from bids.layout.models import BIDSFile from typing_extensions import Self,...
ae4f2d05497bea7a17a35bf32ce2abf182ea4e0b8767ce5c6f48bab974848b04
Python
12,512
386
# Stack class # Stack of sections # defined by: # 3d bounding box # cv # section is a stack with thickness == 1 import copy import os import math import six from corgie import exceptions, helpers from corgie.layers import str_to_layer_type from corgie.log import logger as corgie_logger class StackBase: def __in...
361d529a4e211085eed058e17a5ba3c6dde2320686570ec0a666d01feb70207e
Python
12,525
353
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # TODO : add a colorbar in the top-right of the PRC instead of a legend # 1. https://stackoverflow.com/questions/32462881/add-colorbar-to-existing-axis # 2. https://stackoverflow.com/questions/43805821/matplotlib-add-colorbar-to-non-mappable-object import o...
447b52f18ecd17d589e7b8da93b6a9f529cad8be32d7430745c1abdbb595d1e4
Python
12,527
291
''' Description: Author: voicebeer Date: 2020-09-14 01:01:51 LastEditTime: 2021-03-11 00:27:52 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard i...
540d7e588fbe855504b8f9fc01fca4bc4035ec4f4f2238d18fad7ea9ff7f83ba
Python
12,529
291
''' Description: Author: voicebeer Date: 2020-09-14 01:01:51 LastEditTime: 2021-03-11 00:27:35 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard i...
a9c5e20f613e87e8d72e93cd34fb2a47a4d36746e8a35f48f3ecb07741e92a74
Python
12,533
301
import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from collections import OrderedDict from torch.hub import load_state_dict_from_url from torch import Tensor from torch.jit.annotations import List __all__ = ['DenseNet', 'densenet121', 'densenet169', 'dens...
3243cb55fa8d8bae45ff856c92ee936bf0973774a28af38e999ed0ef8f5694b9
Python
12,536
371
import logging import os from collections.abc import Callable, Iterator, Sequence from functools import partial from itertools import count from pathlib import Path from typing import Literal, Protocol import numpy as np import torch from rich.console import Console from torch.nn import CrossEntropyLoss from torch.opt...
fd873e673caf48648ccc86848e68a87c8283ababb660567fa35da92e7d8aa11f
Python
12,537
357
import os import random import time from pathlib import Path import numpy as np import torch import torch.distributed as dist import torch.multiprocessing as mp import webdataset as wds import yaml from torch import optim from torch.distributed.algorithms.join import Join from torch.nn.parallel import DistributedDataP...
f9e05f0d433280576296393524d7c6bda7daf9fecf392bde45264e7316019b65
Python
12,538
226
"""The retired build's two master-table checks, replayed over the whole corpus and accounted for. `tests/unit/test_legacy_qc_parity.py` proves the two builds agree on one constructed record per failure mode. This proves it on all 192,793 records, which is the half a fixture cannot do: a mode nobody thought to construc...
2924c617de0d8995cb4612c57f2b4c8913946c8cdeaffd9736a8ab4c9c1447f5
Python
12,543
363
# 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 # # Un...
8775192afae56651d3316b6b01d18c5d975da2681702975d4c821e83edc12531
Python
12,559
384
########################################################################################### # Radial basis and cutoff # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ########################################################################################### import...
a1a4f06c2906d7fc56a5e9d2a3e9306e478e7213777f34094edcc4bbb4fcd108
Python
12,564
312
import copy import torch import numpy as np import torch.nn as nn from torch_geometric.loader import DataLoader from sklearn import preprocessing class LogReg(nn.Module): def __init__(self, ft_in, nb_classes): super(LogReg, self).__init__() self.fc = nn.Linear(ft_in, nb_classes) self.sigm ...
07e11b0e35f7408f9d987a787f7609d5939bb1b01ffcb17dbbb572ec37bc412d
Python
12,574
352
""" Implementation of dFC methods. Created on Jun 29 2023 @author: Mohammad Torabi """ import time import numpy as np from joblib import Parallel, delayed from scipy.special import softmax from sklearn.cluster import KMeans from sklearn.preprocessing import StandardScaler from ..dfc import DFC from ..dfc_utils impo...
a9a529484792201bef0b0db0b607366a2d907f39c3e945147e647de28e1cbfeb
Python
12,586
302
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import os import shutil import socket import torch import lightning from lightning.pytorch.callbacks import Callback from nequip.train import NequIPLightningModule from nequip.utils import RankedLogge...
05d604a0063fdbb85fa23e2df3bfc88758370a4924664885ca544f24ef6beb08
Python
12,595
362
import jax.numpy as jnp import numpy as np import jax from functools import partial import sklearn.metrics from statistics import mean import logging import plasticity.data_loader as data_loader import plasticity.utils as utils import plasticity.synapse as synapse def initialize_params(key, cfg, scale=0.01, last_laye...
0a6fe990e253cae419cdb2aec198596d8af0fed33e5a3f4f0eb0429d0b7a0810
Python
12,604
333
from __future__ import annotations import itertools as it import os from pathlib import Path from typing import Iterable import more_itertools as itx import pytest from hypothesis import assume, example, given from hypothesis import strategies as st from pathvalidate import Platform, is_valid_filename, is_valid_filep...
7dbf2a637fb6bd3643487e8f024fcf01ec01f84e1a23a587d51cd89de611c55d
Python
12,614
335
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import pickle import numpy as np import pandas as pd from sleeprnn.common import constants from sleeprnn.data import utils from sleeprnn.data import stamp_correction from sleeprnn.data.d...
e354964e0d77a7d39466835ee664442b19db791b3493ccc82c2dce89cec2c13d
Python
12,614
288
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " import numpy as np import time from threading import Lock, BoundedSemaphore from nest_el...
903a5c55adee6346c1e8ec095b82a5a4caf3a08467ced077157562ba24effba0
Python
12,616
302
#Based on https://pytorch.org/vision/0.8/_modules/torchvision/models/densenet.html import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from collections import OrderedDict from torch.hub import load_state_dict_from_url from torch import Tensor from torch.jit.a...
f09137623b45e555c1fc62ca5a8aa3949260b3a41b58ac1d080808c0a7f92f9d
Python
12,635
342
import torch import sympy as sym import numpy as np from scipy.optimize import brentq from scipy import special as sp def Jn(r, n): """ numerical spherical bessel functions of order n """ return sp.spherical_jn(n, r) def Jn_zeros(n, k): """ Compute the first k zeros of the spherical bessel fu...
a147594e3ea70bef0a4e7f3a3d0d8034b3800c945d92bea9a1c66b6841e0c4b4
Python
12,640
349
# Based on the code from: https://github.com/TUM-DAML/gemnet_pytorch # https://github.com/TUM-DAML/gemnet_pytorch/blob/master/gemnet/model/layers/basis_utils.py # https://github.com/TUM-DAML/gemnet_pytorch/blob/master/gemnet/model/layers/basis_layers.py import math import torch import sympy as sym import numpy as np f...
9bcb295e4fd3883526eab984bb194bf7f5059d20ea4840fdce2857f8dc8dbd44
Python
12,658
458
"""Automatic differentiation in PyTorch.""" import functools import torch as _torch from torch.autograd.functional import hessian as _torch_hessian from torch.autograd.functional import jacobian as _torch_jacobian def _get_max_ndim_point(*points): """Identify point with higher dimension. Same as `geomstats...
747835fb7e0f74f4ece535aeec4dd87ae75104f2c47f39b7a6ffd9106bae8fce
Python
12,663
334
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """DirectorClient module.""" import logging from pathlib import Path from typing import Any, Dict, Iterator, Optional, Tuple, Union # type: ignore import grpc from grpc._channel import _MultiThreadedRendezvous as DataStream from openfl.e...
4612c14933c4419d6065d3be2b267ad765b27939c476c74253f63931fbf2f03d
Python
12,664
320
# 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...
6c24e9b480eee74b1801432d3810678e34e492360518380ded3db132923838e8
Python
12,665
422
import os import time import hdf5storage import numpy as np import scipy.io as sio from functions.dFC_funcs import * os.environ["MKL_NUM_THREADS"] = "64" os.environ["NUMEXPR_NUM_THREADS"] = "64" os.environ["OMP_NUM_THREADS"] = "64" ################################# Parameters ################################# #####...
f74dd4724a3488ef8da211f9e5c76c4c6aa43e49d638a2b445023f5668ed1980
Python
12,668
410
"""Utility functions used throughout the rest of the package.""" import warnings import numpy as np import pandas as pd import xarray as xr from scipy.spatial.distance import cdist from scipy.stats import norm from sklearn.linear_model import LinearRegression try: import holoviews as hv except ModuleNotFoundError...
0b6e297040c820ea5de7aff689209b6754d0fb99a1b01d26a622466f94d89173
Python
12,676
254
"""The curation skills, checked against the build they instruct a curator to drive. A skill is an instruction document an agent loads and follows. Nothing executes it, so nothing fails when it goes stale, and these six went stale in a way that mattered: they were written against ``py_src/``, which phase 4 deleted, and...
47196ca9dddb6f5b870c8984adb55a109e5bfc49183c7928eb72301a96e2fb6c
Python
12,677
320
"""mass_kc.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 import pyedflib from sleeprnn.common import constants from sleeprnn.data import utils fro...
6e04a46ea2c63ec4be257e298010207ece86497dca5b3ecc3d2be72e657c9002
Python
12,689
388
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """ DGL implementation of GVP and GVP-GNN (without the autoregressive functionality) modified from source: https://github.com/drorlab/gvp-pytorch/blob/main/gvp/__init__.py """ import functools import torch from torch i...
a3837e57199cb65791433926e1b18437481b5053bd4a3a0911c30af715013414
Python
12,696
449
import time import multiprocessing as mp import pylsl import numpy as np from .. import logger from ..triggers import TriggerDef from ..utils.io import read_raw_fif from ..utils.preprocess.events import find_event_channel class StreamPlayer: """ Class for playing a recorded file on LSL network in another pr...
172bb6d39f2d7995e63dfa31009c038dc8e9c230f770473b29c6c97ef9848b12
Python
12,698
199
"""Cluster metrics, vendored from TCREMP with exactly one deliberate divergence. ⚠ **The one divergence is the tie-break in :func:`binominal_test`, and it is a correctness fix.** Upstream assigns each cluster its majority label by sorting on ``fraction_matched`` alone and keeping the first row, so a cluster split even...
aca5c702d46a6a4b96f243a0acff1ed86e9bc7d3342c188e1e15bd5aef99223b
Python
12,704
375
"""Implementation of sub-Riemannian geometry. Lead author: Morten Pedersen. """ import geomstats.backend as gs class SubRiemannianMetric: """Class for Sub-Riemannian metrics. This implementation assumes a bracket-generating distribution of constant dimension. Only one of the arguments 'cometric_matrix...
bdf76e7450bfa8b7212a7a5064ee8f37dec500631d292a4403168cfe3f778b78
Python
12,710
300
""" ICC analyses First, threshold the entire matrix at 95th percentile. So now we have 4 matrices: the original ones, and the thresholded ones. Results to compute: - Overlap between windows (ICC or Jaccard Coefficient) at a whole brain level - Proportion of edges by network + test within window of proportion First...
df28a891c4830bf98cd5fa746e342b2a67fe48c4da092f862d2a3c95d5dafba5
Python
12,712
354
# simpleCPP_test.py - Testing JAGS fits of a non-hierarchical Neural-DDM model # in JAGS using pyjags in Python 3, # assumes CPP slopes are generated from drift rates # # Copyright (C) 2022 Michael D. Nunez, <m.d.nunez@uva.nl> # # This program is free software: you can redistribute it and/or modify # it under the terms...
b0e767d11490154e14fa73d22dd747e4a15e6054e8d2b7c5811553b6a3030e36
Python
12,718
391
from collections import namedtuple from random import shuffle import numpy as np import torch import tqdm from Bio.SVDSuperimposer import SVDSuperimposer from scipy.spatial import cKDTree from model_angelo.utils.misc_utils import setup_logger def get_fit_report(input_cas, target_cas, max_dist=5, verbose=False, two_...
adc7d0d5a2bd0f08b61e62c29c95bcf09bfa219de4d727a9ab6517863178ed39
Python
12,727
364
import os import matplotlib.pyplot as plt import numpy as np import random import shutil from skimage import io import math from PIL import Image,ImageDraw import cv2 def data_split(source_path:str, dest_path:str , train_ratio=0.8, test_ratio=0.1, val_ratio=0.1, shuffle=True): ''' This function s...
70c1426ef95296a85be59bfd6fae48675cc763dbe2e710364ec56a8f9a1661d7
Python
12,729
390
import torch import time import torch.nn as nn from torch.nn.parameter import Parameter import os import pathlib import copy from scipy import ndimage import numpy as np import artificery import torchfields from metroem.finetuner import optimize_pre_post_ups from metroem import helpers, masks def finetune_field( ...
8472114826627c0fc7e50ec86fa9864f80f580ead20cae55bf70397b992713b2
Python
12,730
376
# 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...
7cf271213c29300eeebbdd00c5939f3bd589b9f5c49cf5d78e1529ae1bd1e502
Python
12,735
340
## __doc__=""" ## this sctrip is using for Shape-Map which seem no difference between ## SC or BULK ## ## the update of version 1.5 ## cutadapt twice to remove the internal adapter which ligated which reverse transcript ## ## the change in version 2.5: ## 1) change to zy made reference ## 2) bowtie...
fe23c4c70d925b2a3e95cf173744eb4b1f14253aed063ec93cefd0bfaf0dd8e3
Python
12,735
336
""" You are standing in an open field west of a glass building, with a sliding electric front door. There is a small mailbox here. > Open mailbox. There is a letter. > Read letter. ------------------------------------------------------------------------- Welcome to ModelAngelo! Have a look around... This is the build c...
8b1429849db83c0a027538ee8fc223e6e9a719b6b590261e37e3fbf63dbadae9
Python
12,740
351
# recovery_test.py - Testing JAGS fits of HDDM models in JAGS using pyjags in Python 3, # This hierarchical model is usuaully appropriate for trials with intermixed experimental conditions # # Copyright (C) 2020 Michael D. Nunez, <m.d.nunez@uva.nl> # # This program is free software: you can redistri...
d829d889dcd75ac1b06b67659eab09088aa16de390e720d88a1e1ec0923ad06a
Python
12,740
297
''' Description: Author: voicebeer Date: 2020-09-14 01:01:51 LastEditTime: 2021-03-16 06:00:49 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard i...
6b797113544f49c660a2d08abdea3f53db4ceddd7661ce8470943e25d88f05d3
Python
12,749
393
from tests.helpers import REPO_ROOT import os import subprocess import sys from pathlib import Path import numpy as np from ase import Atoms from ase.build import molecule from mace.calculators import MACECalculator def test_run_train_with_elec_temp(tmp_path): """Test run_train.py with electronic temperature em...
7d15871104e9d29d6fe8538e8974af5704ded6d8aef622fa6b35ea05ffddf8f0
Python
12,761
242
import os import torch import hydra from omegaconf import OmegaConf from torch_geometric.utils import add_remaining_self_loops from sklearn.metrics import accuracy_score, roc_auc_score from benchmarks.xgraph.utils import check_dir, fix_random_seed, Recorder from benchmarks.xgraph.gnnNets import get_gnnNets from benchma...
21ad898f889b61a219947cc904ea0f949c0808d6167fe019c32372d6fe0d6d36
Python
12,768
421
"""Run the default preprocessing pipeline on soarrKULee.""" import argparse import datetime import gzip import json import logging import os from typing import Any, Dict, Sequence import librosa import numpy as np import math import scipy.signal.windows from brain_pipe.dataloaders.path import GlobLoader from brain_pip...
9767a30539d2c82f96cfc63aa6e6550f9cf051481ab58d19e7c06f03775bfc24
Python
12,769
306
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import warnings from pathlib import Path from tqdm import tqdm import json # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpecFromSubplotSpec # TensorPAC from t...