sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e0bb35f599d0caf1e7bdda8c1d808d5e653d9bc9aad102769021402f1e5492b3 | Python | 2,189 | 63 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from django.utils.timezone import now
from cvat.apps.engine.utils import take_by
def create_growth_data_for_existing_users(apps, schema_edit... |
0bdc62f18980260c930d9782c4fa80c6bbbab0f53086c86ad62ec5a52effd90c | Python | 2,190 | 73 | import brainpy as bp
import brainpy.math as bm
import numpy as np
import jax
import seaborn as sns
import matplotlib.pyplot as plt
from cann import CANN1D
import scipy
bm.set_platform('cpu')
cann = CANN1D(tau=3, tau_v=144., num=128, mbar=150.5)
v_ext = cann.a / cann.tau_v * 0.55
dur = 2.5*np.pi / v_ext
dt = bm.get_dt... |
193fc3b78582d29b65062c6a77e74ec382424fc473a7b9de4b513057a053721e | Python | 2,190 | 60 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['others.zip'])
tmp_dir = tempfile.Tempo... |
8930f1e681f2b81d519e87d1fb2c202db02816b250d0ed62a1a38fbc464a27fb | Python | 2,190 | 58 |
"""
Methods to handle finding of plugins, etc
"""
import os
def find_plugins(plugin_paths):
"""
Looks for files named "*_plugin.py" in the directory list "pluginPaths"
"""
plugins = [] # This list will contain the names of plugins found in the pluginPaths directory list
plugin_directories = [] ... |
0a55c3aaf9ee5295eaaff8a23ae179036c643237dfa8e9979629df406908a0c1 | Python | 2,191 | 64 | """Plot statistics about the DrugBank approved molecules."""
from collections import Counter
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from tqdm import trange
from admet_ai.constants import DRUGBANK_ATC_NAME_PREFIX, DRUGBANK_DELIMITER
FIGSIZ... |
4781eccc4ca762d0cb66fce5234507aef333f86c7a7dc918fe54663988813df5 | Python | 2,191 | 79 | #!/usr/bin/env python3
import arbor as A
from arbor import units as U
import numpy as np
from util import plot_spikes, plot_network
from unconnected import unconnected
# global parameters
# cell count
N = 10
# total runtime [ms]
T = 1000
# one interval [ms]
t_interval = 10
# numerical time step [ms]
dt = 0.1
class... |
48f88488ca6d2259961b7c7f53f316ed458493460f32dff72fd5944fcf28e292 | Python | 2,192 | 47 | import json
import pytest
from src.acquisition import download
def test_modified_cached_input_is_rejected_without_network(tmp_path, monkeypatch):
monkeypatch.setattr(download, 'ROOT', tmp_path)
monkeypatch.setattr(download, 'MANIFEST', tmp_path / 'manifest.json')
path = tmp_path / 'data.tsv'
path.writ... |
8c828477f25e9de8b581c9a5469d1779654d1b2d5f9f89ea34c3ebe87e363b18 | Python | 2,192 | 73 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtOpenGL classes an... |
9ce17fedfab2ecae4c46d0a6f7332e3881588471d76f40ad916b031665fd1309 | Python | 2,192 | 69 | import ants
import antspynet
import sys
import os.path
from os import path
import tensorflow as tf
####################
#
# Set-up
#
####################
output_directory = sys.argv[1]
threads = int(sys.argv[2])
t1_files = sys.argv[3:]
tf.keras.backend.clear_session()
config = tf.compat.v1.ConfigProto(intra_op_pa... |
a9efe1dad16dc90c7b75a9e7eec0a8bef14eb72531ea71bbf4fae79176510145 | Python | 2,193 | 60 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from torch_geometric.utils import to_undirected
from ogb.linkproppred import PygLinkPropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(des... |
8768d2a39b3c213ff029dc042b0ca3b41adbb46665e7bedf9ccb68351f8ada50 | Python | 2,194 | 72 | import sys
import numpy as np
import matplotlib.pyplot as plt
def read_transmembrane_potential(input_file, dt, print_rate, period):
data = np.genfromtxt(input_file)
n = len(data)
ms_each_step = dt*print_rate
end_simulation = n / ms_each_step
end_period = period / ms_each_step
timesteps = np.... |
dc08117a5dc1b9c2e86df42ace9abc4e75660012d5ac32f09f1edf75e67006f9 | Python | 2,194 | 49 | import cv2
import PIL.Image
import numpy as np
import tensorflow as tf
from copy import deepcopy
def build_direction(loss, input_place, TI=False):
import scipy.stats as st
kernlen = 15; nsig = 3
x = np.linspace(-nsig, nsig, kernlen)
kern1d = st.norm.pdf(x)
kernel_raw = np.outer(kern1d, kern1d)
... |
42bfca9151f21305d147edc78cc2e4f28cb079b1e2f55bf490ce1828e3750c7a | Python | 2,197 | 79 | # -*- coding: utf-8 -*-
# python standard library inputs
import sys
# external inputs
import numpy as np
from scipy.io import loadmat
def get_onset_vols(cond_input, outlier_input, name_condition, TR, skip_vol):
"""Get onset vols.
This function returns all the volume indices corresponding to an
experim... |
7f33d4ba283eaba3263daca0b703c573c21e32d98e7523707dd455098cd7dee7 | Python | 2,197 | 75 | import numpy as np
class AttributeDict(dict):
def __getattr__(self, attr):
return self[attr]
def __setattr__(self, attr, value):
self[attr] = value
class Recorder_select():
def __init__(self, inst, rec_vars_list):
self.inst = inst
self.rec_vars_list = rec_vars_list
... |
970e1c0fced353fc1534c140a67f7e060b9dcda1b0b739d78f68bc9674da51a5 | Python | 2,197 | 66 | import pytest
import numpy as np
from nems import Model
from nems.layers.stp import ShortTermPlasticity
from nems.visualization.layers import stp_test_input
from nems.tools.debug import compare_layer_eval, generate_random_input
def test_constructor():
with pytest.raises(TypeError):
# No shape
stp... |
afb24e9f0a1109800bd1e42bedd56a6487279084d0891352ac5563bd90f90cae | Python | 2,197 | 96 | """Functions for DSC processing.
Created 15 October 2021
@authors: Laura Bell
@institution: Barrow Neurological Institute
Translated from jupyter notebook DSCpipeline.ipynb by Michael Thrippleton
Functions:
estimate_R2s
estimate_delta_R2s
estimate_delta_R2s_dual_echo
"""
import numpy as np
def estimat... |
32b236a2cddd549f5c199d4f4d55c88316a1e3ea262a543f5c175924cd2697ca | Python | 2,198 | 66 | # -*- coding: utf-8 -*-
#
# test_spikes.py
import unittest
import arbor as A
import numpy as np
from arbor import units as U
from .. import fixtures
from .. import cases
"""
all tests for the simulator wrapper
"""
@cases.skipIfDistributed()
class TestClearSamplers(unittest.TestCase):
# test that all spikes are... |
a4c73917c86fc295558b29e12ad1a8be7147cfd1e3b12e33815a72c3c4f9df24 | Python | 2,199 | 54 | import argparse
import time
from torchvision.models import ResNet50_Weights
from torchvision.models import ResNet152_Weights
from torchvision.models import MobileNet_V2_Weights
from torchvision.models import SqueezeNet1_1_Weights
import torchvision
import torch
import dataset
import train_utils
#from ultralytics import... |
2f57f39bd1b663c548765aa40f061275e304ca29b0ecbeeec1826381d02d9151 | Python | 2,201 | 73 | import os
import shutil
import pytest
from unittest.mock import patch, Mock
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.models.endpoints import PreparedModel
def _prepared():
"""Mock ``load_chat_model_prepared``: return ``(client, PreparedModel)``."""
return (
Mock(),
Prepar... |
659c220b9056919938d87f8769210ef38797f6e763a1ec4ab1ea0809c76a105d | Python | 2,201 | 83 | import brainpy as bp
import brainpy.math as bm
import numpy as np
import matplotlib.pyplot as plt
from cann import CANN1D
#%%
#set default ramndom seed for reproducibility
np.random.seed(0)
#set backend to cpu
bm.set_platform('cpu')
def intrinsic_speed(mbar=0, k=1.0, duration=5000):
np.random.seed(0)
cann = ... |
03537f9d24deaec742f75bee5a5bf56a132fb1a80d7cc168a9b2ff9064c05f6c | Python | 2,202 | 60 | # Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
"""CVAT URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
... |
5501f253413b059f322dc5434ec0316613f10f50ebaacc229cc4ce4f7e51e39a | Python | 2,203 | 68 |
#%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import TwoD_gamma
import brainpy.math as bm
#set default ramndom seed for reproducibility
bm.random.seed(1)
#set backend to cpu
bm.set_platform('cpu')
labelsize = 18
ticksize = 14
center_trace, step, mean_fr, sp... |
f768d924bbbc4f753257c1d931dc3f55da577c5ec909da2abaa2e5794b770635 | Python | 2,203 | 54 | from nipype import IdentityInterface, Function
from nipype.interfaces.fsl import Reorient2Std
from PUMI.engine import NestedWorkflow as Workflow, BidsPipeline
from PUMI.engine import NestedNode as Node
import os
# experiment specific parameters:
ROOT_DIR = os.path.dirname(os.getcwd())
input_dir = os.path.join(ROOT_DI... |
1a33037d235dc28d5f9aecc532050683c54f3b93c3139352ce90b3875ff69913 | Python | 2,205 | 64 | import torch
import numpy as np
from NN_AE_TrainingLoop import AENN_TrainingLoop
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils import get_data
from utils import setup_logger
import logging
"""
In this Toy model, I model IT as CNN features of an encoder trained... |
cde1913498a51339d7d0d71242e25d2b7b6406f25ce3533bbba1023a954c85d5 | Python | 2,205 | 62 | # Copyright (c) 2020, Soohwan Kim. 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 applicable la... |
30fe3db94638298bea07667d5a93267a208eb301bfaae877a9f1b4a602298ebe | Python | 2,206 | 89 | """Calculate static (time-averaged) features from neuroimaging data.
Note, the data in "data/src" isn't provided. You can use the get_data.py
script in the parent directory to download the output of this script.
"""
import os
import numpy as np
import pandas as pd
from glob import glob
from osl_dynamics.data import ... |
a0902179adc48c24e8118bc5088f1bedada1ca557639b2a551a3cef2f6805449 | Python | 2,206 | 62 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
a1982905187facac5f4e791b26c1a36e87ee0ee7b63abc3c71e12570769b9e67 | Python | 2,206 | 70 | import numpy as np
def weighting_residual(params, omega, Zdata=None, model=None):
"""Weight data using a model for the error
Parameters
----------
params: dict
Dictionary with parameters.
Contains the entries for `stdA` and `stdPhi`, which are
the standard deviations of the i... |
b36fdfdd0e005e776d96a6a0a188591ee298d9514e3fe630ce1e70a860f90af6 | Python | 2,206 | 54 | from argclz import AbstractParser, as_argument, argument
from neuralib.plot import plot_figure
from neuralib.util.verbose import publish_annotation
from rscvp.topology.util import RSCObjectiveFOV
from rscvp.util.cli import CommonOptions, SBXOptions, StatisticOptions
from rscvp.util.util_gspread import USAGE_TYPE
from r... |
c2e0046e5243a20c65865ce32affb3676cf4180036edeb0c2cb75e5c988bf13e | Python | 2,206 | 65 | import math
import torch
from utils import loss_and_miner_utils as lmu
from miners.base_miner import BaseTupleMiner
# mining method used in Hard Aware Deeply Cascaded Embeddings
# https://arxiv.org/abs/1611.05720
class HDCMiner(BaseTupleMiner):
def __init__(self, filter_percentage=0.5, **kwargs):
super(... |
3c34928bc7f39fcd8d63ef56cfcf05e79275e24566904985a0617e91f6f7dcbb | Python | 2,207 | 62 | from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from pathlib import Path
import torch
import csv
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description='Random seed set:'... |
ef1158f3a6b805fee69145606adab42705bc02d9a45435f25d715fe2af6aecb8 | Python | 2,207 | 63 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Patrick Lenz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
bf32e1fc9db6cf8b7e5d353421f40bfa47f3fa966aee0a906b3d68bdeac6a720 | Python | 2,208 | 72 | import pandas as pd
import time
import json
import content_feature as cf
import csv
import spacy
nlp = spacy.load('en_core_web_lg')
def get_content_vector(tweets):
links = cf.count_urls(tweets)
mentions = cf.count_mentions(tweets)
content_vector = {
"links_ratio":links[0],
"unique_links_rat... |
4dc1dde9699174ea51a2730d3878a1774244a0d7099b51099710f4aac43f05f5 | Python | 2,209 | 85 | # -*- coding: utf-8 -*-
"""
ParameterTools
Provides simple formatting tools to handle / print parameter dictionaries
organized as key:value pairs.
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
def getParameter(parameter, ke... |
f8a599c84e231e06220fec73c78c5ae3ac25d93723eab2c736ba031bd946cb8d | Python | 2,209 | 69 | import torch.nn as nn
from utils import set_seed
from torch_geometric.nn import (
GATv2Conv,
GraphNorm
)
DEFAULT_SEED = 42
def attentive_weights(m):
set_seed(DEFAULT_SEED)
if isinstance(m, nn.Linear):
nn.init.xavier_uniform_(m.weight.data)
if m.bias is not None:
... |
534a36a2bcf4eb7d1a57f51f0505e6b4255a833c974e24f3de4affc6cdf2836b | Python | 2,210 | 75 | class DummyNode:
"""
A class to represent an ONNX node that is not "accelerateable".
This node is created to preserve the original ONNX model graph structure,
but will be skipped by the underlying engines, treating it as a 0 HW cost node.
"""
def __init__(self, id, preds, node_name="", type=Non... |
b883203cad27e16c55cc571a75427f1c623ec93705d3852cf58d94679c43191f | Python | 2,210 | 59 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_core.supported_data_standards.brainio.s3 import... |
dc35d769903c4b77f38817e336be6bccf42e37193c2e89288052c88b35d0c2a7 | Python | 2,210 | 64 | import collections
import numpy as np
from argclz import AbstractParser
from neuralib.plot import plot_figure
from neuralib.util.deprecation import deprecated_class
from rscvp.visual.main_running import RunningVisualOptions
from rscvp.visual.main_tuning import ApplyVisualActCache
from rscvp.visual.util_cache import V... |
322e54ac59ecdae840e64b8960352f082e2dc64e5e19e1a4444b0157685d6752 | Python | 2,211 | 59 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_core.supported_data_standards.brainio.s3 import... |
39b7aca8492519ba491e4a08738f198beb61828cb87eb2427ea89800a2bb16b7 | Python | 2,211 | 59 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_core.supported_data_standards.brainio.s3 import... |
6186bd736a8ca5b0aa05e6e6ae9b3dd38c7f8a533f7aa610487e69f177f63a09 | Python | 2,211 | 78 | import sys
import time
import getopt
from slice_dataframe import slice_dataframe
from save_miscdf import *
def chopgems(roi_json,prefix,binsize):
create_a_folder(prefix)
sinfo = roi_json
slice_gem = sinfo[0]
sdf = slice_dataframe()
sdf.init_from_file(slice_gem)
for roi in sinfo[1]:
it... |
0e3ac9a479454c0ba66c0e83fa6a9ad2d8fa07a0323a7794f5841010c5532eb8 | Python | 2,212 | 74 | """Testing utilities for coordax."""
from typing import Mapping
import chex
import jax
from neuralgcm.experimental.coordax import core
import numpy as np
def assert_field_properties(
actual: core.Field,
data: np.ndarray | jax.Array | None = None,
dims: tuple[str, ...] | None = None,
shape: tuple[int... |
1142af27ba37a2cb6b1b24fdc21887153d611135a7eb378f9adb7296ca4d46f1 | Python | 2,212 | 93 | import sys
import numpy as np
for rl in open(sys.argv[1],'r'):
ss=rl
helix=["H","G"]
turn=["T"]
_h_res=[]
for i in range(len(ss)-4):
s0=ss[i]
s1=ss[i+1]
s2=ss[i+2]
s3=ss[i+3]
if s0 in helix and s1 in helix and s2 in helix and s3 in helix:
_h_res.append(i+1)
if len(_h_res) != 0:
prin... |
99a0735ee0a99114d947d771d80380ceff516be82a2807e0f1d4c009d268fa57 | Python | 2,212 | 74 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute the mean Fiber Response Function from a set of individually
computed Response Functions.
The FRF files are obtained from scil_frf_ssst, scil_frf_msmt in the
case of multi-shell data or scil_frf_memsmt in the case of multi-encoding
multi-shell data.
"""
impor... |
b15e44f1a322b41f06cf111d419a17774b3a5811dee6ac74cb8cacdc4237c746 | Python | 2,212 | 63 | from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from pathlib import Path
import torch
import csv
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description='Random seed set:'... |
b97bac557fecf8c71409a2193b63cff75bc4247ad828979ed2674c0c5b7c22c3 | Python | 2,212 | 60 | # -*- coding: utf-8 -*-
import logging
import os
from dipy.io.surface import load_surface
from scilpy.io.utils import is_argument_set
vtk_ext = ['.vtk', '.vtp', '.fib', '.ply', '.stl', '.xml', '.obj']
fs_ext = [".gii", ".gii.gz", ".pial", ".nofix", ".orig", ".smoothwm", ".T1"]
def load_surface_with_reference(pars... |
d3ef4333d540d9604e605858d224ec6123e558aa4ae48a154b16c94ed7e3e544 | Python | 2,212 | 65 | """Merge all the Therapeutics Data Commons (TDC) ADMET datasets into multitask datasets for regression and classification."""
from functools import reduce
from pathlib import Path
import pandas as pd
from tqdm import tqdm
from tdc_constants import DATASET_TO_TYPE, ADMET_ALL_SMILES_COLUMN
def merge_tdc_admet_all(da... |
67e2b976c3c5ff70e54222d9c68caa9886d0406f08dfe6d4d90463ac03b72d51 | Python | 2,213 | 71 | from brainvoice.modules.weight_init import apply_weight_init
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class LinearAutoencoder(nn.Module):
def __init__(self, input_dim, latent_space_dim, metric_name='mse', init=None):
self.metric_name = metric_name
... |
dcd045d620d5492824dea24ef9117f40415ad8a20a83b81f3e0a20fca84dfa30 | Python | 2,213 | 58 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
fetch_data(get_testing_files_dict(), keys=['processing.zip'])
tmp_dir = tempfile.TemporaryDirectory()
def test_help_option(script_runner):
ret... |
610cca3c75b83e7732293eb8fc4b659835311271b5616b814eacb90484217726 | Python | 2,214 | 77 | #!/usr/bin/env python
"""
Reads a list of intervals (start, stop) and a maf. Produces a new maf
containing the blocks from the original that overlapped the intervals.
NOTE: See maf_extract_ranges_indexed.py which works better / faster for many
use cases.
NOTE: chromosome/src information in the MAF is ignored b... |
f8101269cc3c975be81ad25a760f1f770e28501e0217384fd2a35fe05219e2a0 | Python | 2,214 | 45 | from tqdm import tqdm
import os
import pandas as pd
import torchaudio
import torch
import numpy as np
import argparse
"""
python src/extract_torchaudio_models_brainvoice.py --model_name=WAV2VEC2_ASR_BASE_960H && \
python src/extract_torchaudio_models_brainvoice.py --model_name=HUBERT_BASE
"""
if __name__ == "__main__... |
4ff74504ea792f827d503c9f2605c572ece762f330331d80b89986c72275f189 | Python | 2,215 | 50 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from unicore.optim.lr_scheduler import UnicoreLRScheduler, register_lr_scheduler
@reg... |
4ba7b90fcd9578ac005c630a21e458a3b4d0275d58ba252e5e41b0988e640689 | Python | 2,216 | 62 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from depth.models.builder import LOSSES
@LOSSES.register_module()
class SigLoss(nn.Module):
"""SigLoss.
We adopt the implementation in `Adabins <https://github.com/shariqfarooq123/AdaBins/blob/main/loss.py>`_.
Args:
... |
ad1ec813872a55b2c56773577811e8d28ca945c57a56668d8abf5b5cbcd88c86 | Python | 2,216 | 83 | import lmfit
import numpy as np
import impedancefitter as ifit
from impedancefitter.time_domain import (
calculate_impedance_spectrum_using_cwt,
calculate_impedance_spectrum_using_fft,
fit_impedance_from_time_domain,
predict_time_domain_signal,
rectangle,
)
fs = 10000 # 10 kHz sampling
dt = 1.0 /... |
49ededeb8ff8c90eca9129052e247024266f4b53e4b1d6ee8948cdf069c21f5a | Python | 2,217 | 58 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
import torch
from .evnet.evnet import EVNet
def get_model(name... |
b25f810a32477d3a5c9a468d99a6174be20eb068d87dec2d478878e96d4211ed | Python | 2,217 | 54 | # SPDX-FileCopyrightText: Copyright © Timo Koch
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Script that maps the vtk simulation data to the MRI image space
"""
from vtk2mri import pyvista_mesh_to_mri
import xml.etree.ElementTree as ET
import multiprocessing as mp
import pyvista as pv
import numpy as np
import sim... |
50b665116c5e77e12ec3ef3d5e31016d34df156945b406bbf00887dd879585d9 | Python | 2,218 | 54 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Activation modules."""
import torch
from torch import nn
class AGLU(nn.Module):
"""Unified activation function module from AGLU.
This class implements a parameterized activation function with learnable parameters lambda and kappa, based ... |
f4fdc6292563a3ae215f20da0e6fb7d0e7f52cb793efc7b7ab419e2943e3fcdf | Python | 2,218 | 51 | #!/usr/bin/env python
import os
import sys
import argparse
import shutil
from datetime import datetime
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from material_identifier import (
load_material_catalog,
detect_dat_format,
read_xrd_pattern,
predict_parameters,
IDENTIFIED_DIR
)
def... |
7a727c0b60034066fe47aa2655ea2e5a3c15a65718dc3e1ec5d1985a64303cb8 | Python | 2,219 | 49 | import pytest
class Test_SampleAnnotation:
@pytest.fixture(scope="class")
def sampleAnnotation(self, dropConfig):
return dropConfig.sampleAnnotation
def test_columns(self, sampleAnnotation):
parsed_cols = set(list(sampleAnnotation.annotationTable))
def_cols = set(sampleAnnotation.... |
e58a3856a6b73ed42586121c6123e791f9cc11cf1756e5598f24711c8b40434a | Python | 2,219 | 82 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 19 11:55:19 2025
@author: jstout
"""
import json
import re
import MEGnet
import os, os.path as op
_megnet_path = MEGnet.__path__[0]
weights_path = op.join(_megnet_path, 'model_v2k3')
model_path = op.join(weights_path, 'model_v2.keras')
config_pat... |
7cb04994699c73cc0af4ee207d98789b5d9a3d47e7ba48c87ee7cbcb99719010 | Python | 2,220 | 72 | #!/usr/bin/env python
"""
Tool for filtering a tabular data file. Fields are separated by tabs, the
header line is denoted by a '#' in the first byte, comments are denoted by
a '#' at the start of any subsequent line.
Expressions can use column names as well as numbers. The -c options allows
cutting, again using fiel... |
09646d1dbeff1adcafe11410f32f062e557eb1574e07816ba8cddd52f938c958 | Python | 2,221 | 60 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_core.supported_data_standards.brainio.s3 import... |
8ab86283d22adedba39571fb36139b0d64892f162c4551b2b253a51740e7ee38 | Python | 2,221 | 74 | from abc import ABC, abstractmethod
from typing import Optional
import pandas as pd
from pyproj import CRS, Transformer
class AbstractAssociator(ABC):
def __init__(self, crs: Optional[CRS] = None, global_crs: Optional[CRS] = None):
if global_crs is None:
self._global_crs = CRS.from_epsg(4326)... |
aecbba9642d0efacd184fcf53ed8469ca3227e7f97cb337213f7dfa513dcbec8 | Python | 2,221 | 67 | #!/usr/bin/env python3
#imports
import argparse
from ase import Atoms
import numpy as np
from ase.visualize import view
from ase.io import read, write
from ase.optimize import *
from ase import units
from KerNNCalculator.KerNNCalculator import *
from ase.md.langevin import Langevin
from ase.io.trajectory import Trajec... |
b35ad463e50f4cdbb527bbe97b0e6d5c8cab2d18aaf56b1629c1a281697dc1da | Python | 2,221 | 58 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
import torch
from .evnet.evnet import EVNet
def get_model(name... |
bb75e5a8d330959eb910e897eb982781b250c986fcca5d4902567d77ffe4f345 | Python | 2,221 | 83 | """Plot group-average power maps and coherence networks for each mode.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of modes and run id, e.g. python 6_plot_networks.py 6 1")
exit()
n_modes = int(argv[1])
run = int(argv[2])
#%% Import packages
print("Importing packages")
import ... |
cca03cebc2c9b330b27b2550c55dd9e6b283293a2973989e588877fb03dd0bfb | Python | 2,221 | 95 | def ATOMIC_NUMBER():
return [
# Alkali Metals
1, 11, 19,
# Alkaline Earth Metals
12, 20,
# Transition Metals
22, 23, 24, 25, 26, 27, 28, 29, 30,
# Metalloids and elements with 3-5 electrons in the valence shell
5, 13, 14, 15, 33,
# No... |
6c1a90fc63ee5191b98f10b26e677875886b32e58e2570cbf07106257775b9e3 | Python | 2,223 | 72 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 14 16:51:39 2023
@author: kundakci_1789
"""
import matplotlib.pyplot as plt
#adjust the plotting rc parameters
def set_rcparams(posterfig=False):
""""
This function sets the rc parameters for plotting.
Parameters
----------
p... |
a1cfb1a1e5c03e79f5e3c23df594d84fd206b59f38bddbcd93783ee02e6780a1 | Python | 2,224 | 70 | import subprocess
import select
import sys
import time
"""
Example commands:
conda activate tf-py38
cd /home/aleksandr/Desktop/WORK/OLINK_suicide_PSY_project/Data_preprocessing_analysis
/home/aleksandr/miniconda3/envs/tf-py38/bin/python Process_testing.py
"""
def stop_process_on_output(command, target_output, int... |
902cb7c768fd2e8fddc7b05c6913f1ab1c99425295eac20e42506503aa4d462a | Python | 2,225 | 78 | # Copyright 2021 AlQuraishi Laboratory
#
# 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 i... |
a9a02e0565ade1e0354065cd14601e18bfb413c4c27d3a0154a0b88fc5aed309 | Python | 2,225 | 66 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Conversion of tensors (the 6 values from the triangular matrix) between various
software standards. We cannot discover the input format type, user must know
how the tensors were created.
"""
import argparse
import logging
import nibabel as nib
import numpy as np
fro... |
bef7c46d84f4e9c47142264fa2378a4780dda0ac2944a86d20eecbe21e7b0d05 | Python | 2,225 | 64 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import json
import os
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_requirements
from .base import BaseBackend
class MN... |
017475b2aaeb5a71cf6de7a1541872eea4b9a94ed33b2f09cf87d66b543bf2bb | Python | 2,227 | 70 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de
#
# This program is ... |
6590825ea8900b8fa6d44c528c36614bf6b5a8f5e71c4c212464e6002c4d9d52 | Python | 2,227 | 92 | import sys
import traceback
from dataclasses import dataclass
from io import StringIO
from typing import Any, Callable, List, Tuple
import pytest
from torch.multiprocessing import Manager, Queue
from typing_extensions import Self
@dataclass
class ProcArgs:
target: Callable
args: Tuple[Any, ...]
class MPCap... |
6cca85166dc44b08acca6295af08656a8e7c008ff59f4fae63f9e98c81c323ae | Python | 2,227 | 63 | #!/usr/bin/env python
"""
These are for testing that HAL modules process messages in
the expected FIFO fashion.
Hazen 03/18
"""
import time
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.hal4000.halLib.halModule as halModule
class TestSimpleSequencing(halModule.HalModule):
"""... |
cd2277b5811436458400e34b7ac8bec3e03bc06482fc903cfc329a3aa476654b | Python | 2,227 | 82 | """
Directive for documenting optional arguments of WaveformModels
"""
from importlib import import_module
from docutils import nodes
from docutils.parsers.rst import Directive
class ArgsDirective(Directive):
"""
Directive for writing out documentation
"""
required_arguments = 2
optional_argume... |
8d9c91b41299498d185ec41294cdcb5f1293bd63a2c73e5e3b148cc307514253 | Python | 2,228 | 65 | # 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, software
# distributed under th... |
bd80367d0720aead2f4ab526b5e19d09bd86d810cd6880e11f423515677dc8b0 | Python | 2,228 | 60 | """Regression tests for JobTracker robustness fixes.
- _save must not crash on non-JSON-serializable task results (persist path).
- register_batch must not block the full globus wait-timeout for plain futures.
"""
import time
from concurrent.futures import Future
from unittest.mock import Mock
from chemgraph.executi... |
c1b4c5d09df5c78e89bf3fc2967b24341eca51e0e7ae21ce1fab93c755142adc | Python | 2,228 | 78 | # -*- coding: utf-8 -*-
import numpy as np
def merge_dict(dict_1, dict_2, no_list=False, recursive=False):
"""
Merge two dictionary (used for tractometry)
Parameters
------
dict_1: dict
dictionary to merge
dict_2: dict
dictionary to merge
no_list: boolean
If False... |
2d088172e74cf521326eb9189cd48ac83f7bf33e087b6a15c65250cfa9b9ce61 | Python | 2,229 | 72 | import numpy as np
import pytest
from pyment.configurations.target_configuration import (
BinaryTargetConfiguration,
CategoricalTargetConfiguration,
RegressionTargetConfiguration,
compile_target_encoder,
)
def test_binary_config_returns_encoder():
config = BinaryTargetConfiguration(name='sex', ki... |
b99838d4b5b23ee42168479078f510d1beade54c1b85a6b9c4d497368f8d7bcf | Python | 2,231 | 64 | import pybedtools
import pandas as pd
import pybedtools
import os
import sys
bin_dir = os.path.dirname(sys.executable)
pybedtools.set_bedtools_path(bin_dir)
import pandas as pd
def make_bedtool_from_final_sites(df):
df_bed_cols = df[['contig', 'position', 'position', 'site_id', 'conversion', 'strand']]
ret... |
efdfda6f7e1b9769845a02e2f8ae0c5d53ead36f02521706a3920c28fa636e14 | Python | 2,231 | 70 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import json
import tempfile
import numpy as np
import nibabel as nib
from scilpy.io.streamlines import save_tractogram
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
tmp_dir = tempfile.TemporaryDirectory()
def init_data():
stre... |
b735a37cd906896d485624e167cabb8488688cfa69fdb079326c50af28cbebdd | Python | 2,232 | 77 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020 Julius Zimmermann,
# julius.zimmermann[AT]un... |
d6baeea283bcac0b798fa45a761cefd4b4ec5d36ed62827973b807d6f01ee50e | Python | 2,232 | 66 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
808ababdef043c7440275bb1bf43e7eb046dd02ba2190c9d96bf4e61c084d8ca | Python | 2,233 | 49 | # script for the first part of figure 1 . Single contrast vs multi in simulations.
import OptimalBattery.simulate as sim
import torch as pt
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import OptimalBattery.plot as plot
from scipy.stats import pearsonr
from OptimalBattery.global_config impo... |
8367e235febdd1431760d714db307c4378b33edafed3c427e46d1b31c94b7b49 | Python | 2,233 | 65 | import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from scipy.stats import levy_stable
import TwoD_fun
import levy
import brainpy.math as bm
#set default ramndom seed for reproducibility
bm.random.seed(1)
#set backend to cpu
bm.set_platform('cpu')
fit_color = ['#009FB9','#F18D00']
legend = ['B... |
cb6919ea57b1dac8d7e14e46dbedb088402cd6bbca4d7f74bfb67fca3644b933 | Python | 2,233 | 69 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 17 14:58:25 2023
@author: gligorov
"""
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
def plot_feature_importance(bst, figsize=(10,5)):
"""
Plots the feature importances of an XGBoost model
"""
plt.figure(figsi... |
fb852cc1e288b4535d9930f198a45f0646ddcaa12baf639ce50f923e229f6bb5 | Python | 2,234 | 67 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to resample a set of streamlines to either a new number of points per
streamline or to a fixed step size. WARNING: data_per_point is not carried.
"""
import argparse
import logging
from dipy.io.streamline import save_tractogram
from scilpy.io.streamlines impo... |
fc53d6ed12d2b470788161e9872d07f851f7b7a25914b2d259dbc049d0e50de7 | Python | 2,235 | 49 | """
Iter-5 record attempt — DINOv2 ViT-g/14 WITH the official ImageNet linear classifier (dinov2_vitg14_lc).
Scale-up of our current #1 (dinov2_vitl14_lc, site overall 0.41). The lead over the ConvNeXts came
ENTIRELY from the neural side (0.36 vs 0.20) — DINOv2's self-supervised representational geometry is
best-in-sw... |
3c731c75434619dfbab18e78b4e068a4e8a4fd12e461f394ca07c57e2ac5239d | Python | 2,236 | 78 | """
Main moderation models for the HBOT-fNIRS cooperation study.
This script estimates whether interpersonal trust moderates the association
between cooperation-related mPFC inter-brain synchrony change and
hyperbaric-oxygen-related cooperation gains.
Expected input:
data/processed_main_analysis_data.csv
Expecte... |
482b5d2186222836e52c7e35922c5955889b08bc0575d055cdbc8629cf6a322f | Python | 2,236 | 67 | #!/usr/bin/env python3
#imports
import argparse
from ase import Atoms
import numpy as np
from ase.visualize import view
from ase.io import read, write
from ase.optimize import *
from ase import units
from KerNNCalculator.KerNNCalculator import *
from ase.md.langevin import Langevin
from ase.io.trajectory import Trajec... |
ec79f44298fde6607b1cbf9c38293ced4d5bd3844471c7c337bf013e9deb216a | Python | 2,236 | 65 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import json
import os
from sam3.agent.agent_core import agent_inference
def run_single_image_inference(
image_path,
text_prompt,
llm_config,
send_generate_request,
call_sam_service,
output_dir="agent_output",
debug=... |
1098acfe7676a013435a633500b8c98f43c99218a137a04fb58ec93aef651204 | Python | 2,237 | 66 | """
Setup script for DHG-LGB package.
"""
from setuptools import setup, find_packages
import os
# Read README for long description
def read_file(filename):
filepath = os.path.join(os.path.dirname(__file__), filename)
if os.path.exists(filepath):
with open(filepath, 'r', encoding='utf-8') as f:
... |
15460cadcfb9b2cd62cc2c4902c3813b50f2d7ed7245342e61748ebd7f40fda5 | Python | 2,238 | 61 | #!/usr/bin/env python3
"""Record an unsigned 64-bit (``ulong``) analog channel and read it back.
Thalamus analog streams can carry 64-bit **unsigned** integers (``ulong_data`` /
``is_ulong_data``) in addition to floating-point and signed-integer samples -- useful
for monotonically increasing counters, hardware timesta... |
fc8763d3f8a264a6899865d813a1575b16aef3bcfff577f447f58ade4f0c52ab | Python | 2,239 | 67 | from __future__ import annotations
from typing import Optional
import cv2
import numpy as np
from brainways.pipeline.brainways_params import TPSTransformParams
from brainways.transforms.base import BrainwaysTransform
from brainways.utils.image import ImageSizeHW
class TPSTransform(BrainwaysTransform):
def __in... |
2f2516d5d44123c1f4bff6d248e0f1391b7f18b7f6b501d095c03c64413e3218 | Python | 2,240 | 69 | import os,csv,re
import pandas as pd
import numpy as np
import statsmodels.api as sm
from scipy import stats
import scanpy as sc
from sklearn.neighbors import NearestNeighbors
from . calculate_adj import *
from . util import *
def Moran_I(genes_exp,x, y, k=5, knn=True):
XYmap=pd.DataFrame({"x": x, "y":y})
if k... |
405d84768440250210ef376f8e48c753ef2f478ebcd3a26b93c103892434aae7 | Python | 2,240 | 65 | #!/usr/bin/env python3
import numpy as np
import nibabel as nib
from skimage.filters import frangi
from scipy.ndimage import binary_dilation
# ==== 输入文件 ====
in_file = "/mnt/f/BIDS/demo_BIDS/derivatives/xfm/sub-AFib0241/ses-baseline/T1w_filterNLM.nii"
synthseg_file = "/mnt/f/BIDS/demo_BIDS/derivatives/anat_seg/sub-AFi... |
8602fa6280768d9149eb210b37bc426880863eb01a9b11e5f8f508512d1b5710 | Python | 2,241 | 83 | import shutil
import numpy as np
import torch
from sklearn import metrics
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
... |
22f60418f6faf8f80ce367e0fcad840bc57469aa1400dd92437d023126dc3cdc | Python | 2,242 | 67 | """PyTorch Dataset for COCO-17 normalized pose clips.
Wraps any source of pose sequences into a clip dataset with optional
motion-aware sampling weights (static clips downweighted to reduce
the "predict same pose" shortcut during Pose-JEPA pretraining).
"""
import numpy as np
import torch
from torch.utils.data import... |
394b7818931aca29420045f25dacd557b59f0466ba23927c24d51b6724231738 | Python | 2,243 | 95 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import os
def filter_param(df, param):
filter_set = {0, 1, 2, 3} - {param}
return df[~df["varied"].isin(filter_set)]
if __name__ == "__main__":
multi_dfs = []
for spatial_genes in [24, 32, 64, 256, 512]:
dfs = [
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.