sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
665e4ee1b697f6b57b617b8d25af6b8d29c2f2e8b9e4bdaa78b58b63358075cb
Python
13,639
327
############################################################################### # Does feature extraction by spherical projection texture # Does a user-settable projection along rays from the centroid in gauss-legendre quadrature # Mapping the data to a 1/2D spherical surface # This is decomposed into a spherical harmo...
495d2f1b6841bfd6efc850bcd1257311e506f4526ebe561bf5ed8acfc67f1e8b
Python
13,645
345
""" Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free software: yo...
0c23c35cdf9e3114a0ebb98afd94821714ce875871e0ba283ee0a7a2aa410783
Python
13,647
340
# This file contains helper functions for DEAP # including additional mutation, crossover and selection operators. import random import copy import numpy as np # def indivAsDict_adapt(individual, ParametersInterval, paramInterval): # """ # Convert an individual to a dictionary # """ # return Paramete...
8f1e667cd4ad4edf0cda2723299bf8069825ddd257b44afc36c85b82c0980b0b
Python
13,651
287
"""Hemisphere geometry: crop bounds, side masks, per-point assignment. ``crop_bounds`` is deliberately a PURE function of ``(shape, plane, mode)``. The half-brain crop is applied to the template AND the annotation, and mirrored again downstream to keep warped output aligned; deriving the bound from the data (say,...
7abb364dee1e7c85864ed9d7c6afee73b4ed171e5ffbf3f71ded0284c948282f
Python
13,654
358
import matplotlib.pyplot as plt import numpy as np import scipy import sys import neurolib.utils.functions as func def plot_outputs(model, ds=None, activity_xlim=None, bold_transient=10000, spectrum_windowsize=1, plot_fcd=None): # check if BOLD signal is long enough for FCD FCD_THRESHOLD = 60 # seconds ...
7d127a2e620471e18c66fbf50c720503d6adf925a9fc1960e6513103bce64cef
Python
13,655
370
from dolfin import * import numpy as np import matplotlib.pyplot as plt import sys import time import os #os.system("dijitso clean") # Leser kommmandolinjeargumenter start = time.time() T = 2800 dt = 20 patient = sys.argv[1] res = int(sys.argv[2]) order = int(sys.argv[3]) Q_in = float(sys.argv[4]) parameters["kr...
4ecd318d6f664ae74b76505ea6bf9ef01e9e53fa28fbba5931fb7ec9520e4245
Python
13,660
320
from __future__ import print_function from dvn.utils import get_itk_array,write_itk_imageArray import numpy as np from dvn import FCN, VNET, UNET from dvn import Network as NET from dvn import losses as ls import argparse import os import keras as K # Defined global variables here ................................. BLO...
2b0a0a698c3af742ec82f2d7c35e468b7e495234213b353b938b74c4bc0e1d96
Python
13,663
266
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later """ Functions that load classification accuracies from the PCA and TriDy classification methods and formats them for plotting authors:Daniela Egas Santander, Jānis Lazovskis Last update: 02.2024 """ import numpy as...
b5c9d96c3e2710f6fe8666a7f585adc35d62169c33d983514eba623071ff9cfc
Python
13,666
450
import numpy as np import matplotlib.pyplot as ppl from scipy.signal import windows from syncopy.specest import mtmfft from syncopy.specest import mtmconvol from syncopy.specest import superlet, wavelet from syncopy.specest import wavelets as spywave def gen_testdata(freqs=[20, 40, 60], cycles=11, fs=1000, eps=0): ...
10f0c0eb2f418cbd7eecf72fa7c2939edb696f5635c0f905600aff8b101c062d
Python
13,668
295
from typing import Callable, Dict, List, Union import numpy as np import torch from scipy.signal import hilbert from ..base_transform import EEGTransform from ...utils import LazyLoader pyg = LazyLoader( 'torch_geometric', install_hint='See https://pytorch-geometric.readthedocs.io/en/latest/notes/installa...
72b3ae188962d7abc1fc6b3ed145e03da66c5e498f175bbe8610d1032ef2dc0d
Python
13,670
378
import os import sys import torch from torch import autograd from torchdrug import utils module = sys.modules[__name__] path = os.path.join(os.path.dirname(__file__), "extension") spmm = utils.load_extension("spmm", [os.path.join(path, "spmm.cpp"), os.path.join(path, "rspmm.cpp"), ...
354d9b977a79744e4e0271f6b7d5f3ddeb7f57e6e799008c0d2307a6c289912d
Python
13,673
425
# 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...
5cfa5ac4c90042817eae1a4b802af16f2c9433b68fdf55ec6fc46c76ade2cb1c
Python
13,684
379
# 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...
d936de86afeab3b450250116a81cb48f1f323db7c99305e509c6a4f5f04d7db9
Python
13,684
350
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
a074244ced0958fff7183863422f122eef737c7ed40685c4dd1592308c72d6f0
Python
13,685
647
"""Workflow decorators.""" from __future__ import annotations from functools import partial, wraps from typing import Any, Callable from quacc.settings import change_settings_wrap Job = Callable[..., Any] Flow = Callable[..., Any] Subflow = Callable[..., Any] def job(_func: Callable[..., Any] | None = None, **kwa...
a9edb45e31effe5c1601b547f86e144323c98b572bf695e14f303a0978ee2875
Python
13,685
405
from dreamcoder.type import * from dreamcoder.program import * from dreamcoder.frontier import * from collections import Counter class MatchFailure(Exception): pass class Matcher(object): def __init__(self, context): self.context = context self.variableBindings = {} @staticmethod d...
0cf4ac9476aeedb32db09ba67d54a628dd18c6710428b8d73928ee16ff9a5108
Python
13,688
385
# 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...
82abb93ddc3bc4af6e99d0d293d52d86691ee77c91a6b5b88c575c806ac7ca38
Python
13,690
355
#!/usr/bin/python # Gogulan Karunanithy, UCL, 2023 import tensorflow as tf import time import os, copy from tensorflow import keras import tensorflow.keras.backend as K import numpy as np import matplotlib.pyplot as plt from tensorflow.keras.mixed_precision import experimental as mixed_precision polic...
07588de713ea18ac91269f29218c6ad9b50c4c795a285803c6c712e1b356863f
Python
13,691
282
# Copyright (c) MONAI Consortium # 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 agreed to in writing, so...
d052d054843de8870129fa2516cda584b012ba0080213b79c0a4cbfc5fb39044
Python
13,693
358
# 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...
13a4bb2840a3b510e41368c3e525f6da35deca3eec20b3aa6978c56f5ff6c135
Python
13,694
460
import numpy as np import torch from skimage import io from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures from torch.utils.data import Dataset from torchvision.transforms import GaussianBlur import source.network_collection as nc class BaseDataset(Dataset): def...
7c34bfe7c48143461b9c4a852d56300dd8ffcca4d3e9b09733596bca39fe2182
Python
13,695
304
from __future__ import print_function import os from collections import namedtuple, defaultdict, deque, Counter from time import time from pddlstream.algorithms.downward import get_literals, get_precondition, get_fluents, get_function_assignments, \ TRANSLATE_OUTPUT, parse_sequential_domain, parse_problem, task_f...
88bfc0ceb398826c290af65ff5dbd51a342e0c01d9ad18f0ccc300c33b4490e7
Python
13,696
354
import os import napari import numpy as np from skimage.measure import label from skimage.segmentation import find_boundaries, watershed from skimage.filters import gaussian from plantsegtools.utils import create_h5, smart_load, load_h5, H5_FORMATS, relabel_segmentation from plantsegtools.postprocess.seg_nuclei_consis...
df71325afea7a7eff4c46e781dcf0d6e9708a60e91f8d61fdf0033930c6af10e
Python
13,696
325
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Module used to parse all the route and scenario configuration parameters. """ import json import math import xml.etree.ElementTree as ET import carla from agents.navigation....
3772c214b7b288b026325f06f5c67cbc3b862ea6b36d0d21af8642720db8b0f5
Python
13,697
361
from tensorflow.python.keras import backend from tensorflow.python.keras.applications import imagenet_utils from tensorflow.python.keras.engine import training from tensorflow.python.keras.layers import VersionAwareLayers, GlobalMaxPooling1D, MaxPooling1D from tensorflow.python.keras.layers import Input, Conv1D, Ba...
d41c89f3913dc04e208b8fcab581b22260fd2447cd0a36fad5462bf4a4c8ef3d
Python
13,700
205
from pathlib import Path import random import numpy as np import pandas as pd from pyproteonet.io import load_maxquant, read_multiple_mapped_dataframes, read_mapped_dataframe from pyproteonet.processing import logarithmize from pyproteonet.normalization import normalize_sum def load_breast_cancer_dataset(path: Path =...
c28bbd6de0218ce39e28c64216cd716084048a93d7e9d6ac71ce51149dd42273
Python
13,703
445
import argparse import cv2 import time import numpy as np import threading from control.dcam import Dcam, Dcamapi from control.dcamapi4 import * from control._def import * def get_sn_by_model(model_name): try: _, count = Dcamapi.init() except TypeError: print('Cannot init Hamamatsu Camera.') ...
0c5d6488eeafafa162cb22fa67b08c48d1f3cecb868833bd2ee8ff6ce5c6937e
Python
13,706
412
# 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...
22a32c209c65d22c5f52dda7e5920981cdf03c3e09659534beaafd22623d024c
Python
13,706
306
# -*- coding: utf-8 -*- """ Created on Thu Oct 28 21:00:17 2021 @author: CY """ import torch import torch.nn as nn import torch.nn.functional as F from torch.distributed import get_world_size import numpy as np class BaseModel(nn.Module): """ Base model with: a encoder """ def ...
cd6224ca5778b4560a1c1acc3f19219d379ec9169adb157c8b16e2bb5fd246e6
Python
13,707
462
from datetime import datetime from logging import getLogger from os import SEEK_CUR from pathlib import Path from struct import unpack from xml.etree.ElementTree import parse from numpy import (append, asarray, cumsum, diff, empty, nan, sum, where, ndarray, unique) from .utils import DEFAULT_DATETI...
e54de642001e6a0b3fc8787f422c0a589f35211913b2b6154aef9dc5a9dd5817
Python
13,708
380
import functools import pandas as pd import numpy as np from tqdm.auto import trange from ..datasets.core import DataSet from ..datasets.ds_utils import _add_types from ..utils import printv from ..mappers import GraphMapper, BaseMapper, extract_mappings __all__ = ["GroundTruthModel"] """ TODOs: Refactor this mo...
3c6078bde8488291a554ced3928cf67c5c74ec439ba60f6a43effb0103b287b6
Python
13,710
98
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMAR...
9970af5c8a8471067cac4e8fc48a63a6d545f769067241939a98b7cc3f260db0
Python
13,710
310
# 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...
49985bbe331f763ab1262d12ee8fbd9dc3f035c251418f189f8aeb611cb56463
Python
13,715
458
from itertools import chain import pytest from hypothesis import given, settings, strategies from elasticai.creator.arithmetic.fxp_converter import FxpConverter, FxpParams @pytest.mark.parametrize( "total_bits, frac_bits, signed, number, check", list( chain( [ (total, fra...
ace2893c1bee2d28c495f62e3b08eef7903347712fe65bc9a0226f23f5ef67d8
Python
13,715
371
"""distutils.filelist Provides the FileList class, used for poking about the filesystem and building lists of files. """ import os import re import fnmatch import functools from .util import convert_path from .errors import DistutilsTemplateError, DistutilsInternalError from ._log import log class FileList: ""...
4071d3d6f750f7c1c149bfe5d9e9508ec32e1c035f937a854fc4e13845dadb3d
Python
13,716
329
""" Script for extracting the graphs for analyzing quantitatively a synapse (or any other junction between two membranes) Input: - Density map tomogram - Segmentation tomogram of the synapse Output: - A graph """ __author__ = 'Antonio Martinez-Sanchez' # ################ Package impor...
8c7aa4bc8d98dc3cc1763a631ba6af50fedfe00fb5db8676ae5c7ee52516386c
Python
13,717
275
import os from typing import Callable, Dict, Tuple, Union import numpy as np from scipy.io import loadmat from ....utils import get_random_dir_path from ..base_dataset import BaseDataset class KULProcessedDataset(BaseDataset): r''' This dataset contains EEG recordings from 16 subjects listening to one of tw...
058fd67aac22cd2fb4a0c144aea95eed7bcf0fb2f161b569cc0747852c8f2fa8
Python
13,718
390
## # \file residual_evaluator.py # \brief Class to evaluate computed residuals between a # simulated/projected and original/acquired slices of stacks # # Should help to assess the registration accuracy. # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date January 2018 # # Import lib...
81b28487577b0879c8e031b55e1896c6f422a16c8049aa7d7f4633528181ea21
Python
13,721
365
# 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...
77a6ec09194b0a67c47380f8fd6eee9c472fd9933bc3923093fc2ba75f8a3d92
Python
13,735
357
from PIL import Image from scipy.ndimage import zoom from wsilearn.wsi.wsd_image import ImageReader from wsilearn.utils.asap_links import make_asap_link from wsilearn.utils.cool_utils import * from wsilearn.utils.io_utils import move_file, copy_from_to def px_to_um2(px, spacing): return px*(spacing**2) def write...
548fef3ee1151551292bad22dcf4b742ccd9428e3b14a81900891236f458474b
Python
13,739
330
#! /usr/bin/python # -*- coding: utf-8 -*- import json import os import time import tensorflow as tf from tensorflow.python.training import session_run_hook __all__ = ['TaskSpecDef', 'TaskSpec', 'DistributedSession', 'StopAtTimeHook', 'LoadCheckpoint'] class TaskSpecDef(object): """Specification for a distribu...
378ff459ebf3083aba1943ca91159da447cb8355185a1a9d3e9a0b734e7278f2
Python
13,741
400
# data generator code for training disperseNN2 import sys import numpy as np import tensorflow as tf import msprime import tskit import warnings from attrs import define from disperseNN2.read_input import parse_provenance import gc @define class DataGenerator(tf.keras.utils.Sequence): "Generates data for Keras" ...
93009ab142d79da382953e618d2f22abcb3f97a20b37766871df4aefe93794e9
Python
13,741
277
#!/usr/bin/env python """ Helper module to load whisker and neuropixels data, based on info about condition, cortex depth, CNO time drop, animal ID. """ # Ensure /data_analysis is in path import os import sys if not ('data_analysis' in os.getcwd()): sys.path.append(os.path.join(os.getcwd(), 'data_analysis')) # Im...
54f1e2a7f20cb33b0933e182388d7f85657ead4bf2cb2c5948fb16b0383224c1
Python
13,743
499
from sklearn.cluster import KMeans, AgglomerativeClustering, estimate_bandwidth, MeanShift, OPTICS, SpectralClustering from sklearn.mixture import GaussianMixture import logging import matplotlib.pyplot as plt import pandas as pd from .metric_factory import internal_factory from .graph import CKNNGraph log = logging....
cfb7650ec645c132c5885ce7a14104fd4f2465aad635fde709c1c719c39ce1cc
Python
13,751
323
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module import pregex as pre from dreamcoder.utilities import * from dreamcoder.domains.regex.groundtruthRegexes import * from dreamcoder.program import Abstraction, Appli...
4fbab75f9f1aac11cdab5d253f598601ce39263ce5ab0169ecdbde6c09872e90
Python
13,752
458
from __future__ import print_function,division import sys import torch import torch.nn as nn import torch.nn.functional as F class ResidMultiScaleBlock(nn.Module): def __init__(self, nin, ng, nout, scales=[1,2,4], pooling='max', padding=False): super(ResidMultiScaleBlock, self).__init__() self....
e4226e4f616497012ffcdf197ce6adece5e248178eb46a377509b51028809529
Python
13,756
342
import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo from collections import OrderedDict model_urls = { 'densenet121': 'https://download.pytorch.org/models/densenet121-a639ec97.pth', 'densenet169': 'https://download.pytorch.org/models/densenet1...
6a3babbd2700376e3f248968e44dc4edff23d40080e5b9a9e792e2183d7a21d6
Python
13,760
311
# -*- coding: utf-8 -*- """Script for removig double picked partiles in STAR file.""" import os import math import logging import time import csv import itertools import operator import copy as cp import scipy as sp import numpy as np from datetime import timedelta # import pyseg as ps from pyorg import sub, disper...
7a860d88756322b6fe1a4a2463baf1be05b1cc865985e9177bc853da0d2a2934
Python
13,763
336
#!/usr/bin/env python3 ## Importing libraries import tqdm import sys import numpy as np from itertools import combinations from scipy.io import loadmat,savemat import glob import pickle as pk import os import h5py import pickle as pkl def upper_tri_masking(A): '''Extract the upper triangular values of a matr...
fc72cc8c1835bd3c5b3e879097ce6cc400cab01861839b0c2a36a5a4eb2ed1d3
Python
13,769
375
from __future__ import annotations from functools import cached_property from typing import Collection, Iterable, Optional import numpy as np import pandas as pd from sklearn.base import BaseEstimator from numpy.typing import NDArray from cuppa.constants import DEFAULT_KEYWORDS_MALE_CLASSES, DEFAULT_KEYWORDS_FEMALE_CL...
63dc16904046c1f2172e54e2e67e06ca2125c8b0be4062a7a6e610e857d5fe5a
Python
13,770
119
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from downward.reports.absolute import AbsoluteReport from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BE...
c3b51ef7cb3ded026e8d97ad5233bbb3490dd230eceb7c656b44177ac6d9cc9d
Python
13,770
119
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from downward.reports.absolute import AbsoluteReport from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BE...
52d5102c21f46fa27e246d7990c3349bd77f0d6219d40f741c5c4233d973e5d2
Python
13,772
427
#!/home/dingml/anaconda3/envs/expressBert/bin/python3 import argparse import shutil from argparse import Namespace from collections import OrderedDict import time import os import torch import torch.nn as nn import sys import gzip import numpy as np import logging import warnings from io import TextIOWrapper from typi...
27a7713e30b79161e4dd7faa7b84fca0f0973fabf0661f793dfd6ae07df164e4
Python
13,775
347
import math from typing import Callable, Dict, List, Set, Tuple import numpy as np from rdkit import Chem from chemprop.args import InterpretArgs from chemprop.data import get_data_from_smiles, get_header, get_smiles, MoleculeDataLoader, MoleculeDataset from chemprop.train import predict from chemprop.utils import lo...
832e7c802384c90d4a1ce7776ecf82edf9a1a510b887faa9011c66b569e9845c
Python
13,777
431
# 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...
3cc0a0698ae134140faba05cac80a084d73fc49f346a5629f7941f65e2e10c06
Python
13,781
331
""" Unsupervised and deterministic classification test for PCA-KMEANS algorithm Input: - The STAR file with the particles to classify - Ground truth mask - Classification parameters Output: - A set of STAR files with the new classes - 2D rotational averaged around mem...
edb45e6f6d5ae85d450ba983906ee60458be8e4af5193b37ef6a66fc35638cb7
Python
13,781
395
import numpy as np from skimage.transform import resize from skimage import filters # import pandas as pd # from math import floor # # import decimal # from skimage.morphology import erosion # from scipy.ndimage.filters import minimum_filter # from skimage.exposure import adjust_gamma # from sklearn.preprocessing im...
3df1cd5b4f9701a7a8c389b1244f59bc1495051a84b5349a458f4cf6e3630efd
Python
13,782
350
import os import os.path as op import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.svm import SVC from sklearn.decomposition import PCA from params import SUBJECTS as subjects from params import PLOT_DIR as plot_dir from params import BIDS_ROOT as root from utils...
9e700a3df5e0915327c08a95bf06bbf0f56938ce86866f34844a742e979b3259
Python
13,782
343
""" Image I/O utilities and axis alignment for the registration module. Metric functions have moved to :mod:`metrics` - they are re-exported here for backward compatibility. """ import gc import numpy as np import scipy from scipy.ndimage import affine_transform # Re-export all metrics so existing ``from...
b81cfd41c9dc771745596d948e0052cb150057f3e44b991915e43f331c7245ad
Python
13,785
411
from __future__ import annotations import os import sys from pathlib import Path from types import ModuleType, SimpleNamespace from typing import TYPE_CHECKING import pytest from ase.atoms import Atoms from ase.build import bulk torch = pytest.importorskip("torch") ts = pytest.importorskip("torch_sim") mace = pytest...
f154065f7803c68720705b912cefb44abcb9f5341f68f0a0a1c9c2a99a306044
Python
13,787
418
""" ============== MVPA functions ============== Utility functions for estimation and statistical analysis of MVPA parameters. Authors: Functions retrieved and adapted from https://github.com/heikele/GAT_n4-p6, also see: Heikel, E., Sassenhagen, J., & Fiebach, C. J. (2018). Time-generalized m...
761ee10b01052d2c8c605c4190d9c5b6bb823c028232ebb4c9cfcacb553aebc7
Python
13,794
232
# ------------------------------------------------------------------------ # # 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 # # Unle...
ae3234aef7d8180896c212bd4e06b0ad0719689eccca1e182f00c74fe14573ad
Python
13,799
338
"""Utilities for assembly and conversion of HED strings to different forms.""" import math import re from collections import defaultdict from functools import partial import pandas as pd from hed.errors.exceptions import HedFileError from hed.models.definition_dict import DefinitionDict from hed.models.hed_string im...
d05c3ee85c2ba96368d1f6cef1415185e29473f57446389b4f18f08ddc9c1754
Python
13,812
273
import numpy as np import ast import pdb # import spiking function from spiking_ulils import label_encoder from spiking_ulils import Conv2d, BatchNorm2d, Relu from spiking_ulils import Flatten from spiking_ulils import Linear import argparse parser = argparse.ArgumentParser() # quantization level parser.add_argument(...
866b470c9b20245091960be0c7ab01a2c06a50c44418fafd88f893fef46b509b
Python
13,820
305
import torch import numpy as np import torch.nn as nn from einops import rearrange class LayerGIN(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim, epsilon=True): super().__init__() if epsilon: self.epsilon = nn.Parameter(torch.Tensor([[0.0]])) else: self.epsilon = ...
c6af7c82c13af8615c51e73d2c4a0edf065fa5db682716b3d6fdebca4dcc83aa
Python
13,821
331
# -*- coding: utf-8 -*- """ Created on Jun 22 2023 @author: Jonas A. Thiele """ ### Apply models build in the HCP sample to ### predict intelligence scores in the replication sample (PIOP1 and PIOP2 combined) ### for models that were trained with different numbers of most relevant links (determined by step...
19e8024a7411246706e40529cbae8d030e5d898c125935c4fc3d2a975ad05127
Python
13,826
324
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Hang Zhang ## Email: zhanghang0704@gmail.com ## Copyright (c) 2020 ## ## LICENSE file in the root directory of this source tree ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ """ResNet variants""" im...
56b617a2b9f9f1b320c71783cb053a7fe14b8dbb7293a3411cc4ba869cced9b6
Python
13,827
119
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from downward.reports.absolute import AbsoluteReport from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BE...
6c9f763d76bcb7aec72221585179f35f4afbacd43923bbcd66eca8eeaae730e1
Python
13,827
280
from __future__ import annotations import warnings from typing import TYPE_CHECKING, Literal import numpy as np import scanpy as sc from fast_array_utils.conv import to_dense from fast_array_utils.stats import mean, mean_var from numba import njit, prange from pandas.errors import PerformanceWarning from scanpy.tools...
850e766766a9dbfef3d1d87a90459f42570c24833dd89e55a8497a69f063b98a
Python
13,831
396
#!/usr/bin/env python3 """ Command-line script for extracting tabular summaries from datasets without BIDS organization. This script processes TSV (tab-separated values) files and generates summary statistics about the columns and their values. Unlike hed_extract_bids_sidecar, this script does not assume BIDS dataset ...
de9738b9147d023495cd05ed1a5b5a3e9986f14ca900df2156866e29bee2662e
Python
13,831
307
import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo import torch.nn.functional as F from resnet_features import resnet18_features, resnet34_features, resnet50_features, resnet101_features, resnet152_features from densenet_features import densenet121_features, densenet161_features, densenet169_...
bf0e465d3d3eb3ccf41446970d82513b833d263f259ce1feec269c6f9569b0f4
Python
13,834
412
""" Pool of useful functions for processing surfaces # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 1.05.17 """ import vtk import math import numpy as np from pyorg import disperse_io __author__ = 'Antonio Martinez-Sanchez' # Iso-surface on an input 3D volume # tomo: input 3D nu...
8bf75e3c92a774f032ee17f8f1297a66e3f2977b453c213aef3d1235ab70bb01
Python
13,839
381
"""Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from """ import configparser import locale import os i...
018bb0bf5eeb42487cca302b87ce5bdb11f0575478f484e97009e547a22623b5
Python
13,850
373
""" Test for the backend integrator. """ import json import os import pickle import unittest from copy import deepcopy from shutil import rmtree import numpy as np import pytest import symengine as se import sympy as sp import xarray as xr from jitcdde import t as time_vector from jitcdde import y as state_vector from...
4c207c888fd52f444b6bc0a924591dd4c85b8365d10ace272443f5db97cf6ddd
Python
13,850
352
import torch import torch.nn as nn from torch.autograd import Variable import time as t import matplotlib.pyplot as plt import sys plt.switch_backend('agg') sys.path.append('/home/jmwang/WorkSpace/GENiPPI/gPPMol/models_3d') import os from torchvision import utils from tensorboard_logger import Logger from tqdm import t...
710b5156e0904abdbbd82a083910689c88de4d6dd9600546790f6eb340b9fec3
Python
13,853
340
# 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...
7ad74fb5ce28cd2d628f2eda1733c93ce16c0f833d4a2edb0c8cb488e212ca46
Python
13,853
450
# 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...
7fcb061b115ad2fc1e146e4ec9e062a665a315d778f44d7ce8c5899ae2ce37e1
Python
13,854
336
#!/usr/bin/env python3 ## Importing libraries import tqdm import sys import numpy as np sys.path.append('/home/andrea/research/') sys.path.append('.') from utils_plotting import * from utils_brain_analysis import * from utils_analyse_HOtimeseries import find_frames_pctl,find_peaks from utils_identifiability import * ...
f66b2c92c9ae00b440dcf35c2bdc28583e8cc5883c618df7ad36d16bc8285b02
Python
13,857
319
import os import json import argparse import math from utils import interpolate_trajectory, gen_skeleton_dict, gen_scenarios DOT_PROD_SLACK = 0.02 PRECISION = 2 DISTANCE = 380 # length in meters NUM_WAYPOINTS_DISTANCE = int(DISTANCE / PRECISION) PRUNE_ROUTES_MIN_LEN = 20 #set this to prune shorter routes MIN_ROUTE_LEN...
a463dc0c2c4ac19e93d8334c6d5aedb8d83afe9d9dcd4c83dce92b620c7be7b2
Python
13,859
346
import torch import torch.nn as nn import math import copy from torch.nn import Linear from .so3 import SO3_Embedding from .radial_function import RadialFunction class SO2_m_Convolution(torch.nn.Module): """ SO(2) Conv: Perform an SO(2) convolution on features corresponding to +- m Args: ...
a094b746e6ec92bc5d1311498ba931684d466e5553ebfdbe8b7a77335d341d2b
Python
13,862
334
from __future__ import print_function import numpy as np from examples.discrete_belief.dist import DDist from examples.pybullet.utils.pybullet_tools.pr2_primitives import Command, Pose, Conf, Trajectory, \ create_trajectory, Attach, Detach, get_target_path, SELF_COLLISIONS from examples.pybullet.utils.pybullet_to...
d60c85a45ae74f665bb99c5cf4461352bc1e64afff4264981abe94bd21af85ba
Python
13,866
343
######################################################################################## # C. Jarne 2024 Analysis Group of D. Vidaurre @cfin # # # # Code performs a Kernel Ridge regression (called KRR...
f710a00bf73fc8b11663024854e5e2c432955b4bd057a1635f3ef51917c41f8d
Python
13,873
281
import os import pandas as pd import torch import numpy as np # Labels def get_possible_classes(database, cancer): possible = {} possible['pancan-pancan'] = ["type",] possible['gdc-BRCA'] = ['pathologic_M', 'pathologic_N', 'pathologic_T', 'tumor_stage.diagnoses', 'age_at_initia...
1575a9a542c576abc0d1839f01e998e785ff5ddc90df7f6b56e03345cc5017af
Python
13,877
384
# -*- coding: utf-8 -*- import operator from typing import Iterable, Tuple, Union import torch from torch.autograd import Function from supar.utils.common import MIN from supar.utils.fn import pad def tarjan(sequence: Iterable[int]) -> Iterable[int]: r""" Tarjan algorithm for finding Strongly Connected Com...
7b38d17a6ace903a4f05e8745de3bf78babc0c99ed3a9a9426a12d26cd7deef3
Python
13,877
335
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 8 10:39:20 2022 This script is used to generate a summary table of m6A sites from tagged SAM file @author: heavens """ import os import re import sys import pysam import argparse import numpy as np import pandas as pd from tqdm import tqdm from iter...
e7f99a455205999961bc7838c82a6e6b5a78a19a1929dd2da46893e9040fb209
Python
13,878
362
""" March 2021 by Oliver Gurney-Champion and Matthew Orton o.j.gurney-champion@amsterdamumc.nl https://www.github.com/ochampion Solves the Extended Tofts model for each voxel and returns model parameters using the computationally efficient AIF as described by Orton et al. 2008 in https://doi.org/10.1088/0031-9155/5...
7a2228cccb8d53e8ca95b3ee0466a05fad70942776015ea15e9b3a970a60d014
Python
13,879
325
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Module used to parse all the route and scenario configuration parameters. """ from collections import OrderedDict import json import math import xml.etree.ElementTree as ET i...
43b6889ac6747c26491f2d061bbf20f87665eb0e32dcb398e7111291911fc745
Python
13,881
361
"""Tests for the self-contained HTML registration report builder. The builder (:mod:`regtools.registration.report`) is pure/stdlib-only and Qt-free, so these tests need no GUI. """ import base64 import os import struct import zlib import pytest from regtools.registration.report import ( build_html...
30fb6688112e8dace94c70ae47fa22e1bc9a19c9f3478ff581013d87388123a8
Python
13,884
402
#!/usr/bin/env python3 """ openmm_proteinwater_colab.py Chunked OpenMM protein-in-water MD with robust resume and Colab-safe I/O. Key improvements vs the original: - Platform fallback: CUDA -> OpenCL -> CPU - Atomic trajectory/log writes: write *.tmp then rename only if chunk finished - Cleans up 0-byte files automat...
e89048b00658de6369cb1cdb37ed56bae44ea865366c947c72c4a6b9e9e62e10
Python
13,885
236
import sys, os, h5py, pickle import pandas as pd from optparse import OptionParser from scipy import stats import tensorflow as tf from tensorflow import keras from keras.optimizers import Adam from keras.models import Model, load_model from keras.layers import * from keras.metrics import * from keras.utils import plot...
5087fe8d759e5f472700cfd80d623f69b23afbcfff78c2f84e00906372bcf547
Python
13,893
317
"""Tests for regtools.ccf_boundary_editor.contour_edit.""" import numpy as np import pytest class TestEditStateDataclasses: def test_component_not_dragged_when_source_equals_current(self): from regtools.ccf_boundary_editor.contour_edit import ContourComponent pts = np.array([[1.0, 2.0]...
694d948b1c71cbf091cae04daeef664f3ec9c871e521969717dc1e9bdf46964f
Python
13,897
248
import pandas as pd import numpy as np from pyfaidx import Fasta import argparse import vcf as pyvcf from pyensembl import Genome import tqdm import os from tasks_annotate_mutations import SpTransformerDriver, annotate_VCF_general, SNPInterval class Annotator(): def __init__(self, limit_protein_coding=False) -> N...
08816c8263b177e25f8ba514e15a59191012a73de8fbc8d8951d57ac3b3efa5e
Python
13,898
328
# -*- coding: utf-8 -*- # ORIGINAL DOCUMENTATION: # TheVirtualBrain-Scientific Package. This package holds all simulators, and # analysers necessary to run brain-simulations. You can use it stand alone or # in conjunction with TheVirtualBrain-Framework Package. See content of the # documentation-folder for more detail...
6a82388514f8a9a6e67a5636277df5e7a5864421f392b45f3da80717500c57d9
Python
13,900
418
# 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 Optional import torch import torch.nn as nn import torch.nn.functional as F from .multihead_attention import ...
d089d6fbc7cd49819ca347f7120bf9c075f0715ab3f6e8c65ad7d7affdc54d7d
Python
13,900
387
import tensorflow as tf # Helper layers # ======================================================================================================== class _TransformerEncoderLayer(tf.keras.layers.Layer): def __init__(self, d_model, nhead, dim_feedforward): super(_TransformerEncoderLayer, self).__init__() ...
27cfe003b14830cc5a85d6b08624edad7d520c1a717c2bb51088ae7b0f11a740
Python
13,909
509
"""Parameter classes for Bayesian optimization.""" from __future__ import annotations import abc from collections.abc import Callable, Sequence from inspect import signature from numbers import Number from typing import TYPE_CHECKING, Any import numpy as np from sklearn.gaussian_process import kernels from bayes_op...
bbd309625e9ec43576b9b0de38d0f25fe3fafc1ae4d2dceaa598aa15d9703931
Python
13,910
280
"""Utilities to support HED validation.""" import warnings from hed.errors.error_reporter import ErrorHandler from hed.errors.error_types import ValidationErrors from hed.validator.util.char_util import UNCLASSED_VALUE_SETS, CharRexValidator from hed.validator.util.character_sets import code_point class UnitValueVa...
291ea937c8e0af3b17427ad2a9c38354cd7304035ffccd660c46845f15d2b872
Python
13,913
278
import BEBE.visualization as visualization import BEBE.evaluation.metrics as metrics import os import numpy as np import pandas as pd import tqdm import yaml import warnings from sklearn.metrics import homogeneity_score def perform_evaluation(y_true, y_pred, metadata, num_clusters, unsupervised, output_fp = None, conf...
977adb946cbede5f4edf24a34b9c7e31fbcb1da5a1ff25fc02801438fc7b88f0
Python
13,915
247
"""Command-line interface to package treem.""" # pylint: disable=too-many-statements import argparse import sys from treem.io import SWC from treem.commands.check import check from treem.commands.view import view from treem.commands.find import find from treem.commands.modify import modify from treem.commands.repai...
54a660286fde1cda263bb1659f05d2edbec9b576ac01bfc12e5780bb3f4f25a7
Python
13,923
292
import site from typing import Callable, List, Dict, Optional, Literal from numpy import squeeze import torch from torch import nn from hotpp.layer.radial import ChebyshevPoly from .base import AtomicModule from ..layer import EmbeddingLayer, RadialLayer, ReadoutLayer from ..layer.equivalent import NonLinearLayer, Gra...