sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bd11269a7b8bec46fa243de34c56264a008d1451e0a73aaf7def5322e93eb7da
Python
10,214
268
import torch import torch.nn as nn import torch.nn.functional as F import pickle import random import numpy as np from tqdm import tqdm from torch import Tensor from torch.utils.data import DataLoader from utils import * torch.set_default_tensor_type('torch.cuda.FloatTensor') class AutoEncoder(nn.Module)...
b30635e9479022acfbcdb81d4d883113928a4fc99c0f234583f7addf10b3367b
Python
10,215
298
""" © Copyright 2022, Torchaudio Contributors. Built with Sphinx using a theme provided by Read the Docs. """ from typing import Optional, Tuple import torch __all__ = ["Conformer"] def _lengths_to_padding_mask(lengths: torch.Tensor) -> torch.Tensor: batch_size = lengths.shape[0] max_length = int(torch.m...
0d0f2bb554dc66212f7efdec3988751faca63cecd0c926351efe73c709cf8a76
Python
10,219
237
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: emma With more than one bias subgroup in each disease class, stratification is more complicated because we need to ensure that *each* bias subgroup has the same distribution of disease and subject effects (otherwise, there are distribution shift-related bias...
fa858badfdec2ccf697fe6900bb23d26ea7f3025b21e688bb142f6a0bd73e8cf
Python
10,220
338
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
c29aa499e9d1464f8fb0839f96de859ba0f9f80dadb81d7e90e5807380a37f7c
Python
10,221
263
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
29c5de60158f067582d23731f2f71836c09835aa6b0ad6a8f5d865ccfa17b4fd
Python
10,223
303
import pytest import torch from elasticai.creator.arithmetic.fxp_converter import ( FxpParams, ) @pytest.mark.parametrize( "total_bits, frac_bits, signed, expected", [ (2, 1, True, -2), (2, 1, False, 0), (3, 1, True, -4), (3, 1, False, 0), (5, 1, True, -16), ...
f6ebb37ff21639bf170177e461cd0fbfda2d7b538f7fbae78d0918223721ea0f
Python
10,226
233
from pathlib import Path from typing import Any, Callable, Dict, Tuple, Union import mne import numpy as np from .base_dataset import BaseDataset from ...utils import get_random_dir_path def default_read_fn(file_path, **kwargs): # Load EEG file raw = mne.io.read_raw(file_path) # Convert raw to epochs ...
33e4da217a24d0d2e54127c2a596f512c364268b8ffaa32d1f39b98e79a19532
Python
10,227
255
""" Read / Write files modules """ # Copyright (C) 2021 Blue Brain Project, EPFL # # 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, either version 3 of the License, or # (at your option) any la...
61d4b9f46d2f2a69d5d0fa003ef8f40c2752dfd7a4b1defba7eed9244e354cfb
Python
10,227
246
from __future__ import print_function import argparse import cProfile import pstats import random import numpy as np from examples.drake.generators import Pose, Conf, get_grasp_gen_fn, get_ik_gen_fn, \ get_motion_fn, get_pull_fn, get_collision_test, get_reachable_pose_gen_fn, get_open_trajectory, Trajectory from...
69d0e521edeb077eaf419060758e983cb73a1a69cc8b99c3e26bf1b04aa27101
Python
10,228
299
#!/usr/bin/env python # -*- coding: utf-8 -*- from cellsim16popsParams_modified_spontan import multicompartment_params import analysis_params import plotting_helpers as phlp import h5py import os from matplotlib import gridspec from matplotlib.colors import LogNorm import matplotlib.pyplot as plt import numpy as np imp...
b3ffc0b03f9f3a08cb14cbce5eac40465e542741a3a1d46bf74491fa9c0ebdeb
Python
10,228
333
"""Class for defining 3D atom environments. Author: Seth Axen E-mail: seth.axen@gmail.com """ from __future__ import division, print_function from functools import reduce import numpy as np import rdkit.Chem import smart_open from e3fp.fingerprint import array_ops PDB_LINE = ( "HETATM{atom_id:>5d} {name:<4s} L...
004558d2aa27cb210c82fe03a3674836baea500c149365d84aa1cceb9d2ecde9
Python
10,230
330
""" pygments.util ~~~~~~~~~~~~~ Utility functions. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from io import TextIOWrapper split_path_re = re.compile(r'[/\\ ]') doctype_lookup_re = re.compile(r''' <!DOCTYPE\s+( ...
c1fd29332353051bd36eaad55ac16f33343c7bdeb97625e1a1599a458e99bbb1
Python
10,232
286
import os import gzip import numba import numpy as np import pandas as pd from numba import njit, prange from .smooth import _load_smoothed_chrom from .utils import _check_data_dir, _iter_bed, _load_chrom_mat, _parse_cell_names, echo @njit(parallel=True) def _calc_mean_mfracs( data_chrom, indices_chrom, ...
484f0c5719f9cfecd62f44c551c126cc906932d65179f9f6404f1dd214799603
Python
10,234
233
import pandas as pd import numpy as np import mdtraj as md import itertools import os import MDAnalysis from MDAnalysis import transformations def initProteins(): proteins = pd.DataFrame(columns=['pH','ionic','fasta']) fasta_CPEB4 = """MGDYGFGVLVQSNTGNKSAFPVRFHPHLQPPHHHQNATPSPAAFINNNTAANGSSAGSAWLFP APATHNIQDEI...
954ce1b1847086fdfd335e393a547c19dde508c47c39986ae22fda5300b23d59
Python
10,234
263
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
316b25d311b91404f6313b793bda89650b08190ce885590cb35bfaffacdf694d
Python
10,236
475
#!/usr/bin/python # -*- coding:utf-8 -*- # -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*- # GAMMA_MIN = 0.1 GAMMA_MAX = 10.0 CONTRAST_MIN = -50 CONTRAST_MAX = 100 UNSIGNED_INT_MAX = 0xFFFFFFFF UNSIGNED_LONG_LONG_MAX = 0xFFFFFFFFFFFFFFFF # frame state code class GxFrameSta...
da95c9f138621fc49bde9b0d19f9a437b2a8b2ad9664f9ba83c49e779524df20
Python
10,237
298
from __future__ import print_function import cProfile import math import os import pstats from collections import namedtuple from pddlstream.algorithms.focused import solve_focused from pddlstream.language.function import FunctionInfo from pddlstream.language.generator import from_fn, from_test from examples.discret...
ec7f2469f81428db278ffa9f2d54e34f22c31a3ed1b7fac3f8720e5b8369eddf
Python
10,242
193
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 11:18:19 2021 This script compute the value, trial by trial, of the priors and the posteriors. These variables can be computed with generative or inferred priors, with optimal or fitted parameter The script also computes derivative from these vari...
d444a9ab0d22ba94bf2bba6164ae73b21544e42cf2f41b462c55385ba127bdaf
Python
10,243
311
"""Build Environment used for isolation during sdist building """ import logging import os import pathlib import site import sys import textwrap from collections import OrderedDict from types import TracebackType from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union from pip._vendor.cert...
92c1ab28d152e936156db40b1e1b4e1e779067d4ea9834000f8610fa46751500
Python
10,244
295
""" Calibration slopes for right- and interval-censored survival predictions. Author: Weijie Sun """ from __future__ import annotations from collections.abc import Callable, Sequence import numpy as np from scipy.optimize import brentq from SurvivalEVAL.evaluations.util import interpolated_curve def _invert_from...
9895f5efdf2d8d98b3f6fcbf7c8bd7be83289c2317b2aa3cc118b94ceae44638
Python
10,245
311
#!/usr/bin/env python # coding: utf-8 ### This scripts was used for calculating the accuracy of each integration methods in predicting genes. ### Detail usages can be found in PredictGenes.ipynb import pandas as pd import numpy as np from scipy import stats import scipy.stats as st import seaborn as sns import matplo...
0fde126ca92d226f4512ae35a10380baecab50f8219e16bf64c75b00838aec58
Python
10,247
295
import unittest import numpy as np import numba from neurolib.control.optimal_control.oc import ( solve_adjoint, compute_gradient, update_control_with_limit, convert_interval, limit_control_to_interval, ) from neurolib.control.optimal_control.oc_wc import OcWc from neurolib.models.wc import WCModel ...
ca91cf0fdae6da52b582eff59cb0f220f94241a1b64a9e3bb644af322a660f2a
Python
10,247
182
import torch from torch import nn from torchdrug import core, data from torchdrug.layers import functional from torchdrug.core import Registry as R # from torchdrug.data import CG22_PackedProtein from cg_maml_steps.cg_protein import CG22_PackedProtein # ** should be registered in torchdrug.layers.geometr...
0b89f8a1f50aae0ac90660fa9f9ad5aa8799ad14393dfa854489f21d1887dde4
Python
10,249
262
""" Test for reading Gaussian files, determining bond orders and GAFF atom types. The test reads a correct SDF file with charges and bond orders specifies, and then compares the molecular structure to what is generated based on the Gaussian output. If the script is run with an addition (random) flag, more verbose o...
68a3203f380895b6d09dde8287e0d5e7dfc49b1f40019f577920bbefcafd47ce
Python
10,249
264
# Copyright (c) 2019 Mwiza Kunda # Copyright (C) 2017 Sarah Parisot <s.parisot@imperial.ac.uk>, Sofia Ira Ktena <ira.ktena@imperial.ac.uk> # # 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, eithe...
bd23914f4d7be760e982693eba07b635e7ab3d54e767f7ab39016d0a580d7195
Python
10,250
270
from dreamcoder.dreamcoder import ecIterator from dreamcoder.domains.text.makeTextTasks import makeTasks, loadPBETasks from dreamcoder.domains.text.textPrimitives import primitives from dreamcoder.domains.list.listPrimitives import bootstrapTarget from dreamcoder.enumeration import * import os import datetime import r...
f91d1d059eeff8c3bf7272fec293d56d051da2d7f1487ccc79e6867e3a9bff72
Python
10,251
234
"""Region-operations mixin for the CCF boundary editor. Carries region-level commands invoked from the region list/tree context menus and toolbar: zoom-to-region, delete/restore a label across the whole volume, per-region colour overrides (prompt / set / reset / refresh), drop-unused-labels, and reset-region (thi...
2277330c97f7413378cc6d831c2708f83218872d4b0a057b873fd09deb46e6f1
Python
10,252
297
import re import inspect import warnings import functools from decorator import decorator import torch from torch import nn from torchdrug import data def copy_args(obj, args=None, ignore=None): """ Copy argument documentation from another function to fill the document of \*\*kwargs in this function. ...
27b13e7c731d05fb500c2326a7a4884b5b210472a1fe288092311e9e29596c6a
Python
10,255
259
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 22 20:52:47 2021 Notes: - ``mne coreg`` to create -trans.fif file - ``mne watershed_bem``to compute the requried inner_skull.surf etc. (4 min) - ``mne make_scalp_surfaces`` also generates one of the surface file but not all (1 min) ...
a633a88361e139f879cd0d8af5dfd6d62f99d5a2620db29c6c2e022843ef4865
Python
10,260
253
import platform import serial import serial.tools.list_ports import time import numpy as np import threading from control._def import * from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * # temporary class Microcontroller2(): def __init__(self): self.serial = None self...
2c80ab41d4d351687cba20be101d4a111ea8cd092df689195e75d898be6257f5
Python
10,261
297
import numpy as np from scipy.stats import gamma, norm, multivariate_normal from scipy.stats import beta as beta_rv import sys sys.path.append("../../lib_c/") from smc2 import smc_c import matplotlib.pyplot as plt import time from numpy.random import multivariate_normal as multi_norm from scipy.misc import logsumexp sy...
aa0aac91707d8d0f5689a18722fe723b50e19cf591f23778e657d0bc3c5eee9d
Python
10,261
241
#!/usr/bin/env python from __future__ import print_function import argparse import cProfile import os import pstats import sys sys.path.append(os.environ['PDDLSTREAM_PATH']) from examples.pybullet.utils.pybullet_tools.pr2_primitives import Conf, control_commands, Attach, Detach from examples.pybullet.utils.pybullet...
93ac827532f89a6da9669c9f0be697e9a69cf122642a32166a569df0fa7c765f
Python
10,262
203
""" MAIN ALGORITHM OF ANDEPED This file contains the initialization and operation of the AnDePeD algorithm and its improvements. """ import numpy as np import AnDePeD.ReRe.status_bar as bar def initialize_rere(self): self.values = self.data['value'].to_numpy() # the first B-1 indices won't be used for pred...
ddcb9c81b33570460e52270504cf683f3c9108e4f6ba98e700a6137a2b5eec42
Python
10,265
271
r"""Test PubChem JSON format using the OpenBabel Python bindings On Windows or Linux, you can run these tests at the commandline in the build folder with: "C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake -R pybindtest -VV You could also "chdir" into build/te...
13bee6af80e36032bbbdf29d1b9547acbb3ac69fbd6f2957ed600cb79da82fbf
Python
10,267
172
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
1744c1363624326b5efd88356e12951d748d59634510f203520c21b87764a31f
Python
10,270
248
"""distutils.extension Provides the Extension class, used to describe C/C++ extension modules in setup scripts.""" import os import warnings # This class is really only used by the "build_ext" command, so it might # make sense to put it in distutils.command.build_ext. However, that # module is already big enough, a...
041916544fea9b2dbe39c23d939a93a272adb29f83829a30ca5c1dc755007279
Python
10,274
234
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import torch import torch.nn as nn import torch.autograd as autograd import torch.nn.functional as F import torch.utils import torch.utils.checkpoint from .utils.constants_torch import use_cuda # inner module ====...
e5bf684ee0a6b922cb9425082c7a3c225b52647d88662cafa6dde1dc79f1bef4
Python
10,275
256
#!/usr/bin/env python3 """ Refresh the JSON fixtures in test/fixtures/ from the live Wikidata/Wikimedia Commons APIs. The fixtures are deliberately *pruned* copies of real entities: only the languages, claims and sitelinks actually used by the test suite are kept, so the files stay small, readable and stable. Volatile...
69421c405d42d8c692bda805e51fa199401f8ccb079ed22c3a97d1b06a544de3
Python
10,276
255
from __future__ import annotations import re from typing import Any from wikibaseintegrator.entities.baseentity import BaseEntity from wikibaseintegrator.models.forms import Form, Forms from wikibaseintegrator.models.lemmas import Lemmas from wikibaseintegrator.models.senses import Sense, Senses from wikibas...
6c5465c4cb98806ac880d8de03603d6baa371d047b125a7443ee619c15950b01
Python
10,276
318
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
b7f729a89001dff0a7f8de71dd964e9a6914489b018a535546aca46477948398
Python
10,278
158
from enum import Enum import numpy import json import re class ComputationBackendType(str, Enum): """ Type of computational backend to use for the lagrangian. """ TENSORFLOW = 'tf' PYTORCH = 'torch' class IntegrationMethod(str, Enum): """ Type of method to get the voltage gradients. ...
104c873ace1e21f714f265bc1a8ab01f5952738a2133df827765b1f299366c9a
Python
10,279
239
from __future__ import print_function from copy import deepcopy from time import time from pddlstream.algorithms.downward import run_search, TEMP_DIR, write_pddl from pddlstream.algorithms.instantiate_task import write_sas_task, translate_and_write_pddl from pddlstream.utils import INF, Verbose, safe_rm_dir # TODO:...
e89c9be57be4b93bb872944b068d5a6ac777e7354088d4d969d4a3c247d41c00
Python
10,280
269
# -*- coding: utf-8 -*- """(Keras) Layers for building Behler-Parrinello symmetry functions This module implements the base layers `*_SF`, which computes the symmetry functions. The layers handelling the computation of atom-centered fingerprints and the caching of Jacobian are implemented in `networks.bpnn.BPFingerpr...
f3957fcd0c93149f5f2fa280722821fcab51e2b928a2604cf83b320195e1faac
Python
10,281
304
import numpy as onp from autograd.extend import JVPNode, def_linear, defjvp, defjvp_argnum, register_notrace, vspace from ..util import func from . import numpy_wrapper as anp from .numpy_boxes import ArrayBox from .numpy_vjps import ( balanced_eq, dot_adjoint_0, dot_adjoint_1, match_complex, nogr...
45a9ea0dfc675f800e7684886cdc1756f81fe869315849783b9629175cd0866d
Python
10,285
297
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.dreamcoder import * from dreamcoder.grammar import * from dreamcoder.program import * import numpy as np from dreamcoder.type import * tobject =...
d287f8ad644daafd9075d1d288a9074bc3304d2405760bf17d573ca433004097
Python
10,286
280
""" code adapted from: https://raw.githubusercontent.com/facebookresearch/FixRes/main/imnet_extract/Res.py """ import torch from torch import Tensor import torch.nn as nn from typing import Type, Any, Callable, Union, List, Optional __all__ = ['ResNetV2', 'resnet18V2'] def conv3x3(in_planes: int, out_planes: int,...
f3b5e5ae415b3ea86c11c53a9999d57a6448c7c6535f961b299667852da4187f
Python
10,287
175
"""NEVER.py 2026-10-09. Pre-registration: 04-NOTES/PREREG-2026-10-09b-NEVER.md Flies that never existed. From the antennal-lobe cut-out of Shiu et al.'s v783 file (3,431 neurons, both lobes) I keep the parts list (every neuron's type and side) and the rules (for each ordered pair of types and same/different side: the...
12012048828c125be9b4ef7cfdbb7bfe7c87fc6eb171633c2b7e83bdda672d90
Python
10,288
263
""" Generates Surface objects from and input STAR file or tomogram Input: - Either a STAR file of particles and the particle average or a segmented tomogram Output: - An output STAR file with the set of Surface objects generated which are stored in disk """ ################# Package import import os ...
4d509434fca338c68e6bbe22abf9f40967f452f4f91a22003028f8e8b6a456d7
Python
10,288
195
import pandas as pd import numpy as np import warnings warnings.filterwarnings(action='ignore') import matplotlib.pyplot as plt import json from sklearn.decomposition import PCA from sklearn.pipeline import Pipeline from xgboost import XGBClassifier from sklearn.linear_model import Lasso from sklearn.metrics import cl...
e188be639f360e1636680240893c21f00783033fbaa4e1b809a5f276c2bd1bcd
Python
10,288
272
from argparse import ArgumentParser import functools from pathlib import Path import sys import subprocess from typing import List, Optional import numpy as np from scipy.stats import pearsonr, spearmanr from multiprocessing import Pool import pandas as pd from tqdm import tqdm _encoding = sys.getdefaultencoding() in...
5fe9d6784151b324d06b65f81fe6df76880431e7518fec2ce691459ea848c193
Python
10,289
291
""" Created on 02/06/2020 Modified on 16/06/2020 :author: Mahyar Osanlouy, Gonzalo D. Maso Talou, Chinchien Lin :summary: """ import os import SimpleITK as SITK from src.utils import sitk_utils as sutils from src.registration.registration_parameters import RegistrationParameters __image_type__ = SITK....
8aab9570c0b98a956f113551137775ac6800798c6fe08d9a36154394c8924533
Python
10,289
275
# __main__.py import sys import importlib from fba import __version__ from fba.parsers import parse_args from fba.utils import open_by_suffix, get_logger def main(): args = parse_args() logger = get_logger(logger_name=__name__) banner = """ █████▒▄▄▄▄ ▄▄▄ ▓██ ▒▓█████▄ ▒████▄ ▒████ ░▒█...
8e7e87ad34f0039f6819706c31eb33d7b95aefccd55a2051c7169d46c43d9702
Python
10,292
236
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # # 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://ww...
97c7d18220ce08f218977cb7bbaa61febaf60bc96ddaf342aadf2449fef5876b
Python
10,292
249
""" Convolutional autoencoder """ from operator import index import keras import numpy as np import pandas as pd import time_series_tools as ts_tools class ConvolutionalAutoencoder(): """ """ def __init__( self, window_steps, model_to_load=None, encoder_model_to_load=None, decoder_model_to_load=...
f1f63c49e1ad88a4c2953ed7c205cb13f098cdbd9d67cb52fc156adf9014e035
Python
10,294
290
# external modules from matplotlib.backends.backend_pdf import PdfPages import matplotlib.pyplot as plt import os import numpy as np from matplotlib import cm import pandas as pd from scipy.signal import find_peaks, peak_widths import seaborn as sns import scipy.stats as stats def format_global(value): if (value...
19b5b09e3cba6f13711285c713279de275f6a46aba5cfa15776fb6a790217cfa
Python
10,299
215
import warnings from typing import Optional import numpy as np import torch import torch.nn from . import ArrayOrTensor, OptionalArrayOrTensor from .base import BaseModel class RP(BaseModel): def __init__(self, n: int, nprojections: Optional[int] = None, indegree: int = 5, threshold: float = 0.1, ...
1e8d61d8d08228f743cd2d3a9e881a46e16cf64458e615b60d851e0fbdc0be76
Python
10,300
282
import pylink from EyeLinkCoreGraphicsPsychoPy import EyeLinkCoreGraphicsPsychoPy from string import ascii_letters, digits import numpy as np from psychopy import core import sys import platform import time import rtPupil_config from PsychoPyFunctions import instructions_screens, terminate_task def validate_edf_fname...
87634da95fc8ec898c43ade5a0d651796130a3cbf99450b22825fb144f4936fe
Python
10,303
261
import os import subprocess import warnings from datetime import datetime import signal from contextlib import contextmanager import numpy as np from numpy import dot, transpose, sqrt from numpy.linalg import svd, det import torch import yaml from rdkit import Chem from rdkit.Chem import RemoveHs, MolToPDBFile from tor...
a055885a433951c47a9dfb29fb5cc784ab38430fef08f81ad5277eb8936beb3b
Python
10,306
245
import torch import numpy as np from tqdm import tqdm, trange import tifffile import os from core.load import load_data from core.models.Model import create_model from core.utils.misc import * from core.utils.Coord import Coord from glbSettings import * torch.backends.cuda.matmul.allow_tf32=True torch.backen...
a073a945d8902d5d50b6920a8e09522394c79b75dd1124c705ea07b7b7d4a8ca
Python
10,306
349
import random import torch import numpy as np from scipy.special import softmax import analysis_utils as au import fit_data as fd no_food_water = 0 food_water = 1 more_food_water = 4 # probability of transfering from s1 to p1, p2, p3 s1_food = 0.8 s1_water = 0.15 s1_more_food = 0.05 # probability of transfering fro...
3b1043be82fb0eac82ca21bbad21882ba96d77a07290d54d1cd152c21fcb2b7b
Python
10,307
299
""" Script for computing statistics about the profile (along different penetration values) clouds of points extracted from a network of filaments attached to a membrane VERY IMPORTANT: all cloud of points will be compressed to a 2D Euclidean space Input: - Path to a membrane attached filament network...
119e7ee2cb1d93c46f426f2dc7f75e062ccb6f1d3fc6fc6bd50aac9c986c962a
Python
10,308
266
#!/usr/bin/env python import time import pybullet as p import copy from perception_tools.perception import Perception from perception_tools.common import NAME_TEMPLATE, get_body_urdf from plan_tools.common import get_color from pybullet_tools.utils import create_box, ClientSaver, set_point, wait_for_user, pairwise_co...
4f3777c4466306b098dab97e05f0423ce8759d1bacee2616257a20c76c5d61d3
Python
10,309
305
import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import MaxNLocator import sklearn.metrics as sk_metrics import scipy.stats import pandas as pd import matplotlib.dates as mdates from mpl_toolkits.axes_grid1.inset_locator import inset_axes def p...
2119bf86330dde093ecc5c84280e82aee30029ddc00698b30f8da0c74d78c6cb
Python
10,318
210
import numpy as np def FullfillData(m_AbsPSD, v_SessionTimes, d_stepSize): """ Fill missing data in the PSD matrix by extending the available data based on session times. Parameters: - m_AbsPSD (array-like): Matrix containing the power spectral density (PSD) data. - v_SessionTimes (array-l...
96ba0f29e4d19438de6c9f69ae09c21b825920c407dc0399e07ac00075022e76
Python
10,320
303
''' Script that runs the DNN on PLEC data ''' import argparse import math import os from collections import defaultdict from statistics import mean import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from datasets import CustomDatasetDB,...
df5b4c211bd4afc6e0269e29d7d1f09c935514ab6ed48506a0503d86edf2f549
Python
10,322
281
""" Calculations that write attributes on a ``Molecule`` A calculation is a function that takes the ``Universe`` and returns one value per atom, stored as an attribute under the calculation's name, or one that writes a data object itself and returns None, such as hydrogen bonds. An updating calculation runs on every f...
6a935acbc3c8e1435fee2bd32b7f1692f096878ff2dd8ec30092bb2cfe5e0f6f
Python
10,323
263
# -*- coding: utf-8 -*- # @title Generate parameters related to synapses # @file Synapses.py # @author Romain Beaubois # @copyright # SPDX-FileCopyrightText: © 2022 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief Generate parameters related to synaps...
e7da65315ed5e9c1e04090f7a595e8a95ef207021471424dee507fef4104ec00
Python
10,326
234
# -*- coding: utf-8 -*- import torch import torch.nn as nn from supar.config import Config from supar.model import Model from supar.models.dep.biaffine.transform import CoNLL from supar.modules import MLP, Biaffine from supar.structs import DependencyCRF, MatrixTree from supar.utils.common import MIN class BiaffineD...
d22ae6ddf6852de0585d3939d3f6d35ae7615aa6e9da3c299fda4a1bb827d502
Python
10,329
286
"""Slide-level training with ordmet script. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import yaml import logging from functools import partial from typing import Dict, Any, List import torch import pytorch_lightning as pl...
40a62bd9fe865e1f56b9659fda969b02d1c6c2fa9daa593992af25cd8e9fd85f
Python
10,330
284
# ---------------------------------------------------------------------- # Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/...
4b92defb56ac9b45a8227da031c41411a295bd5b13c73c2559d36aa3b4e40dff
Python
10,330
218
''' Description: Visualization. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import numpy as np import tabulate import pandas as pd from sklearn.neighbors import NearestNeighbors from plotting.__init__ import * from plotting import _removeAllBorders, _removeTopRightBorders # ==============================...
5f4c7b548997acebbff78e5336e50183db0d6c023638146c866fdc751dffc263
Python
10,331
203
#!/usr/bin/env python import warnings from typing import Tuple, Optional import torch from torch import Tensor from torch.nn.modules.linear import Linear from torch.nn.init import xavier_uniform_ from torch.nn.init import constant_ from torch.nn.init import xavier_normal_ from torch.nn.parameter import Par...
66024b352b90d79a47a82801904960fc924200fc5c1aad8e9c7700d47e1d6e8e
Python
10,332
161
"""LIU_WILSON.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02e-LIU-WILSON.md Two known answers from Liu & Wilson (2013, PNAS 110:10294): (A) do the connectome's synapse counts predict the six connection rates of their paired recordings between GABAergic local neurons, glutamatergic local neurons and PNs (Fi...
d7aef2c83c73e0b1b73d3c270cc65c57314e264f29ad049ee6bbb2018966bd86
Python
10,332
344
"""Utility functions for file and path handling.""" from __future__ import annotations import contextlib import os import socket from copy import deepcopy from datetime import UTC, datetime from logging import getLogger from pathlib import Path from random import randint from shutil import copy, copytree, ignore_patt...
d5e49010802265e13d8327e3a4e0b8c5d4c24b630629333a726342605981af97
Python
10,335
280
""" Script for doing univariate point spatial analysis on stacks of actin filaments Input: - Path to the input tomogram with filament cross-correlation map Output: - StackPlotUni object pickled - Figures with the analysis """ __author__ = 'Antonio Martinez-Sanchez' #######################...
78bd5a82205b79f2c29136caddb805799c8ad4432ae066b9e33342b9bce11bb0
Python
10,336
212
import os import sys import time import json import random import shutil import scipy.io import numpy as np from os.path import exists import matplotlib.pyplot as plt import protocol_file as protocols_many unique_ID = sys.argv[1] params_file = 'params' + unique_ID + '.param' params_v = np.genfromtxt(para...
fd83e248f64ac55629b57d1b863b81552bfca31b65040bc46f77143574672928
Python
10,336
290
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
8c4b404ccafa37aed70137a4972d388338fe19c44b324de54f1c42de189d08aa
Python
10,338
260
#!/usr/bin/env python3 import os import sys import argparse import functools import subprocess import re import shutil import datetime import math import collections import threading import flex_ddg_db3 use_multiprocessing = False if use_multiprocessing: import multiprocessing # The Reporter class is useful for...
5bccfee3b9121be9e9349e2325475553d44bee246ad0abafad55bda88c5baba6
Python
10,340
255
import torch from torch import nn, optim from torch.nn import functional as F from scipy import optimize from scipy.optimize import minimize import numpy as np from torch.nn.parameter import Parameter from sklearn import linear_model # from TransCal import cal_acc_error def get_weight(source_train_feature, target_fe...
82e321e059850626a6a9a400e0fc380733e5a6e86115da6949a70265917bb6de
Python
10,340
228
""" Utility functions that serve for creating the final tables and visualizations of the data @author: trianaa1 """ import numpy as np import pandas as pd import netplotbrain as npb from matplotlib.colors import LinearSegmentedColormap def lags_to_table(data, real_corr_values, variables, network_mapping, alpha, thr...
f989941df21ea2705d17b166404508ae00db70f14ebf3a19aa24b295260cc968
Python
10,341
245
import os import bct import numpy as np from scipy.stats import spearmanr from utils import pickle_load, make_dir, phi_stats, \ med_avg_weight, med_euc_dist, \ mannwhitneyu_print, save_plot from rich_feeder_peripheral import rich_feeder_peripheral import seaborn as sns import mat...
6f6495964781acd0a0ec26c3a668de5498aa6c10754dd19354f3052a97a314d0
Python
10,342
297
# -*- coding: utf-8 -*- """ Created on Tue Sep 24 11:40:41 2019 @author: Laure Spieser and Boris Burle Laboratoire de Neurosciences Cognitives UMR 7291, CNRS, Aix-Marseille Université 3, Place Victor Hugo 13331 Marseille cedex 3 This file is part of Myonset. Myonset is free software: you can redistribute it and/or m...
e91a711e6ae54fe0cf1b15210310e4972fcda54e87251396779a08af359f1d4e
Python
10,344
296
from rdkit import Chem import numpy as np from rdkit.Chem import Draw # patts = [ # '[c][N]([C])[C]', #dimethylamino diethylamino # '[c][N]([c])[C]', #DPA # '[c][N]([c])[c]', #TPA # '[c][O][C]', #methoxy # '[c][O][c]', #DPO # '[c][S][c][c][N][c]', #phenothiazine # '[s]', #thiophene # '[...
ee6935053e44a2dc448c44a49a23a2a496adce19c569b6c65c4b22fe672a515a
Python
10,346
248
import io import json import os import tempfile import unittest from unittest.mock import patch from hed.scripts.hed_extract_bids_sidecar import main class TestExtractBidsSidecar(unittest.TestCase): @classmethod def setUpClass(cls): cls.data_root = os.path.realpath( os.path.join(os.path.d...
32c3f583e55d04adff3ef15a2b1d5775ae315e94eea3be3d15fbce61c2acb751
Python
10,359
328
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
844e710e48f76734deca09b7728567b2b46ca66b2995464bf5635a723f195839
Python
10,359
292
#!/usr/bin/env python3 # coding: utf-8 """ Copyright (c) 2023-2023 Blue Brain Project/EPFL 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 requir...
cc700be2744b1e365fa02547a45765602fa5a419b1be79d15999bba6e5ae7df2
Python
10,360
230
#!/usr/bin/env python # -*- coding: utf-8 -*- import warnings import numpy as np from nxsdk.net.process.basicspikegen import BasicSpikeGen from loihi_tools.compartment_tools import create_distributed_group_over_cores, create_compartment_prototype from loihi_tools.spikegenerators import create_spikegen from loihi_tool...
fcf65ddb57e77f647b5ae1dc9d660d316380125505ab5db26a2bdf89c7f30982
Python
10,361
309
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
8dbe678557adc5df78e2112fb68419e9b89a2fefe829e392a7f786854be18136
Python
10,367
239
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
262f98a247e48677deff1326af82128d9074ed3257820042398a186be1c302bf
Python
10,368
311
import sys from itertools import chain from typing import TYPE_CHECKING, Iterable, Optional if sys.version_info >= (3, 8): from typing import Literal else: from pip._vendor.typing_extensions import Literal # pragma: no cover from .constrain import Constrain from .jupyter import JupyterMixin from .measure imp...
98e426ae44a6afebbc834092aeda2a469399975bd17a3a2d76a369a0d4088321
Python
10,369
255
""" Functions to convert a VOX_coords_mother.txt file into a voxel_coordinates.json file. Adds grid_group and grid_loc fields. Run: python vox_mother_converter.py <subject> <out_file> to create a voxel_coordinates.json file """ import re import pandas as pd import os from collections import defaultdict from .conf...
84a42ee284c01c723283fa7f2e6cd6093171b18d1d9df82741177bfcb3109b58
Python
10,370
254
import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader, TensorDataset from .scoring import regression_scores, binary_classification_scores def arch(input_dim = 200, output_dim = 1, hidden_width = 300, hidden_depth = 10): """ Returns a tuple of integers specifying the ar...
984f2979f16d339bcb49f03449721c6dfcaf0c01fea4b1ac09a28495c73d642a
Python
10,371
261
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
0e5d607fb106d17866a638ff2b8c942862d559ca4342d9662bc5edd5674a4883
Python
10,375
353
"""This module contains sampler class which generates a sequence of nodes from a network using a random walk. All samplers should be the subclass of NodeSampler class. """ from abc import ABCMeta, abstractmethod from numba import njit import numpy as np class NodeSampler(metaclass=ABCMeta): """Super class for nod...
c7097618cac9838a627742ba32a839c74449a8c6e6b36a24d9c9e8b94d5b7a18
Python
10,378
272
import os import re import sys import zipfile import configparser # NSD pycortex database (Google Drive) PYCORTEX_DB_GDRIVE_URL = ( "https://drive.google.com/file/d/1oMoOGjlrOpkphKPCC4XqUPaT0nu59kPC/view?usp=drive_link" ) PYCORTEX_DB_ZIP_NAME = "pycortex_db_NSD.zip" _GDRIVE_FILE_ID = re.compile(r"/file/d/([a-zA-...
c45761332699bf41a45b18b1def3f09f71d98fb5e3bab1fdfd1669264090a894
Python
10,379
302
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
da7634f8c0eeb5f7590653065abb2d90a768b3a5bceae3e79a0d38a26f5b5362
Python
10,382
224
#!/usr/bin/env python """ toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Fr...
a48a9849aa5e0c401a688dd38a585a79be32dacb7b7103ba172deafedf0bf4fa
Python
10,387
234
""""Define the dataclass and processing of receiver data.""" from dataclasses import asdict, dataclass, field from multiprocessing.shared_memory import SharedMemory import numpy as np from scipy import signal from console.interfaces.acquisition_parameter import DDCMethod from console.utilities import ddc @dataclass...
ce34c6eb71d06fc7da724ee9307f1adddaaaa3d115fe19c59d214b345c1c9e74
Python
10,387
237
import sklearn.preprocessing from sklearn.metrics import roc_auc_score,roc_curve,auc import matplotlib.pyplot as plt from torch import nn, softmax from sklearn.metrics import roc_auc_score,roc_curve from models import MAMFGCN import torch.nn.functional as F from PAE import PAE from opt import * from utils.metrics impor...
9184f3acefe51ab67bfe7ad7ee0434ff078d57532a3219f5e37453798e9d9f63
Python
10,391
234
from typing import Dict, Tuple, Union from scipy.interpolate import griddata import numpy as np from ..base_transform import EEGTransform class To2d(EEGTransform): r''' Taking the electrode index as the row index and the temporal index as the column index, a two-dimensional EEG signal representation with t...