sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
aee68f7e593a84a4233986f452917f78ffebdfbc35ae39e79a4c0093395bb688 | Python | 4,615 | 126 | # Copyright 2020 The HuggingFace Team. 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 applicabl... |
8695f9fb6051d63cd10b81bbf3beaca16c928c454fae75509d4619c9167a6069 | Python | 4,616 | 133 | """
Create file to generate intra and inter correlations
For SC and FC metrics.
SC and FC with the same preprocessing as in the extracted values.
"""
import numpy as np
import os
import click
import subprocess
import numpy as np
import datetime
import pandas as pd
import matplotlib.pyplot as plt
from joblib import Pa... |
e0cd72c9abbe7afc4f7b8c923a73f2c4f46d3b2ce7e99cbc35e1a57b2f8040db | Python | 4,617 | 107 | import argparse
import random
import sys
import numpy as np
import os
import pandas as pd
import json
import torch
from constants import *
from old_code.dataloaders.dataloader_item_classification import get_item_classification_dataloader
from src.training.train_utils import directory_setup, Logger, train_val_split
fr... |
a490f02114a3c9c6acc44de041fa9aa2cb3bd2e43f0e6f6b5bbc8926a7327c44 | Python | 4,618 | 134 | import numpy as np
import matplotlib.pyplot as plt
from soundsig.plots import multi_plot
"""
Implementation of S. Zayd Enam's STRF modeling stuff:
S. Zayd Enam, Michael R. DeWeese, "Spectro-Temporal Models of Inferior Colliculus Neuron Receptive Fields"
http://users.soe.ucsc.edu/~afletcher/hdnips2013/papers/strfmode... |
4c0a634f5594a40bfb2f71398e80757b8d707fd476fb676ec0d7e17eb88867b2 | Python | 4,619 | 112 | import os
from models import define_discriminator
from models import define_generator
from models import define_gan
from models import train
from utils import load_dataset
from utils import summarise_performance
from utils import get_res_and_size
from tensorflow.keras.utils import plot_model
import json
def main(t... |
2a2f43ab3bef2b48035fb06f045380b5186c9a2b3b05c1846cc028a03ff3b022 | Python | 4,621 | 165 | import torch.nn as nn
import torch
def get_embedding_masks(embedding_len, history_len) -> torch.Tensor:
masks = []
j_max = 0
i_max = 1
while j_max < history_len:
mask = torch.zeros(size=(embedding_len, history_len))
j = j_max
i = 0
while j>=0 and i < embedding_le... |
41058bde9b37b520ae32388c469c957dd6da1a064336c9e9a6142aa42899a604 | Python | 4,621 | 121 | ''' Script for supplemental ROI analyses '''
proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition'
wdir = '/projects/' + proj_name + '/scratch/working_memory/'
scripts_dir = '/projects/' + proj_name + '/scripts/working_memory/'
import sys
sys.path.append(scripts_dir)
import mne
import numpy as np
from stormdb.acces... |
fe1b1b7bb4ca5ec80522698c6637a0fcad1eda61e35f097e43a98e43f5fcd4e7 | Python | 4,621 | 75 | """CONVENTIONS.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30f-CONVENTIONS.md
Which excitatory signs of the antennal-lobe local neurons push Shiu et al.'s published file over the line? Three sign rules,
each predicted from the excitatory share alone before simulating (line 0.365; tipping point 41.8% [37.7,... |
76b19f4c8474e8a89508f1d61deb4a66b47597bc07112f56869bbc5afcbb4d04 | Python | 4,622 | 121 | # 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... |
dba2bd9703e2cdbd68d32a9308cee9b39a1a62fde25865f6f995d594fbf06865 | Python | 4,622 | 124 | #!/usr/bin/env python3
"""
Modified by Mayank Kabra
Original by DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.... |
06164b22e0ce4d507cab9feb3e1c694e73e3856af4fd9c67ed4ad3b40f5f7f1b | Python | 4,623 | 115 | """Implementation of CLI find command."""
import numpy as np
from treem.morph import Morph
from treem.io import SWC
from treem.utils.geom import fibonacci_sphere
from treem.utils.geom import rotation_matrix
from treem.utils.geom import rotation
def find(args):
"""Locates single nodes in morphology reconstructio... |
4ff8d317b2810b468396b6628004667b099c7422a7dc78fe66061fcbfab95021 | Python | 4,623 | 109 | import argparse
import copy
import os
import shutil
import os
import sys
fpx = ""
args = argparse.Namespace(
inputlen = 2114,
outputlen = 1000,
ibam="chrombpnet_tutorial/data/downloads/merged.bam",
data_type="ATAC",
genome="chrombpnet_tutorial/data/downloads/hg38.fa",
peaks = "chrombpnet_tutori... |
bf2e7e5fe4cb27b452a08aef83aff02015f2b3b7c32c07a9a184dc61157b23ab | Python | 4,623 | 139 | from memory_profiler import memory_usage
# size = 50000
size = 3000
def test_simple():
import numpy as np
def func():
a = np.random.random((size, size))
return a
rss = memory_usage(proc=func, max_usage=True, backend="psutil")
uss = memory_usage(proc=func, max_usage=True, backend="p... |
b5a0128aae55652e9445f1dcc5240a06972d2a6c2d6fdaf083732b266a8a0ac9 | Python | 4,625 | 113 | #!/usr/bin/env python
from __future__ import print_function
import time
import numpy as np
import pybullet as p
from examples.test_franka import test_retraction
from pybullet_tools.ikfast.ikfast import get_ik_joints, check_ik_solver
from pybullet_tools.movo_constants import get_closed_positions, get_open_positions, ... |
fd9a0d95f91d290bf04a75d2e07541d076129f8a37d1bfdf720f6a9633ded138 | Python | 4,626 | 116 | import os
import numpy as np
import torch
from scipy.spatial.transform import Rotation
file_path = os.path.realpath(__file__)
script_folder = os.path.dirname(file_path)
package_folder_path = os.path.dirname(script_folder)
MIN_EPS, MAX_EPS, N_EPS = 0.01, 2, 1000
X_N = 2000
"""
Preprocessing for the SO(3) sampling... |
32211c36b9d5ee466fd0bc551ab3d142b96955b8e1086a89ffa5d186a8b14f5f | Python | 4,627 | 113 | #!/usr/bin/env python
from __future__ import print_function
import time
import numpy as np
import pybullet as p
from examples.test_franka import test_retraction
from pybullet_tools.ikfast.ikfast import get_ik_joints, print_ik_warning
from pybullet_tools.movo_constants import get_closed_positions, get_open_positions,... |
12fc8c6da8c08ac18fe56d73f45c153a6d9717f9d17ae6ccd55443277f5c25a8 | Python | 4,628 | 113 | """Run a blocking callable off the Qt main thread.
``AsyncTask`` wraps any zero-arg callable and emits ``finished(result)`` or
``failed(message)`` so GUI code never blocks the event loop on git/disk I/O.
``run_async`` is the convenience wiring: it moves a task onto a fresh QThread,
keeps Python references alive o... |
6e7a5e86678cd37043821e83b9177255a9172655391cacaa296d453b9b26146b | Python | 4,628 | 113 | import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.tree import DecisionTreeRegressor
from scipy.signal import butter, lfilter
import scipy.stats
import os
import functions_mea_prediction as func
directory = '/Volumes/Elements/spring20... |
1611fee3794bc9e7c818b421a4ede40558df9d728a3ca6d4a41b75e701d5fb03 | Python | 4,629 | 128 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
import numpy as np
from setting import *
# Arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-n", "--name", type=str, help="dataset name")
argParser.add_argume... |
2ca8b2a1fdb01cf15a480c3c8918c36b8dd816d1198663ac5e640226f08c2582 | Python | 4,629 | 108 | """Calibration of the average predicted survival curve against Kaplan-Meier."""
from __future__ import annotations
import numpy as np
from matplotlib import pyplot as plt
from scipy.integrate import trapezoid
from SurvivalEVAL.evaluations.util import interpolated_curve
from SurvivalEVAL.nonparametric_estimator.singl... |
eeebbe10a5f341c41903165664d3275540bd95d9234bcf549f95807a93d4e50b | Python | 4,629 | 146 | import torch
import torch.nn as nn
import dgl.function as fn
import torch.nn.functional as F
class DotDecoder(nn.Module):
def __init__(self):
super().__init__()
"""Dotproduct decoder for link prediction
predict link existence (not edge type)
"""
self.act = nn.... |
0b57e0480ce3c500cc42c32486edaa37ae8193d13826eaef184b332163d0c9ce | Python | 4,631 | 68 | """LAW_PATCH.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02q-LAW-PATCH.md
Can the inequality design the smallest patch for the published model? The 122 patch neurons ordered by how much each
correction alone lowers s (local-neuron synapses onto uPNs weighted by laboratory-prior baseline rates); k_law = the... |
152030f1fa27f2b9dc3f8d3264a734b330a0a8682a10a9916a9e798957fa719a | Python | 4,631 | 180 | import cmath
import math
import numpy as np
import meep as mp
resolution = 50 # pixels/μm
dpml = 1.0 # PML thickness
dsub = 3.0 # substrate thickness
dpad = 3.0 # length of padding between grating and PML
gp = 10.0 # grating period
gh = 0.5 # grating height
gdc = 0.5 # grating duty cycle
sx = dpml + dsub + ... |
b25f2002cf6e04cf4166707e560b54cf03f3fd909904b117eb1806a456b2e07f | Python | 4,631 | 127 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.hardsigmoid.design import (
HardSigmoid as HardSigmoidDesign,
)
from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations
from elastic... |
cadf019207400e506fbc6a7af5c2efdbbf3e17f7456478fef501eacad3efbd20 | Python | 4,631 | 151 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 10:51:35 2018
@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... |
1d38b37bd6790a21f4e078f84af3c0f67a137d0732526ca136437832e348e444 | Python | 4,632 | 147 | # -*- coding: utf-8 -*-
#
# Spectral estimation with (multi-)tapered FFT
#
# Builtin/3rd party package imports
import numpy as np
from scipy import signal
import logging
import platform
# local imports
from ._norm_spec import _norm_spec, _norm_taper
def mtmfft(
data_arr,
samplerate,
nSamples=None,
t... |
58c1f33be14673792a0229936fce3e4a76c1708470ff43ebba79cf4ce6453a6b | Python | 4,632 | 134 | # 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 required by applicable law or agreed ... |
1bd3c81bf0e9583525bce04eb04f6fb86b59b1c7b7082c79b77efe8fa3b3a9a5 | Python | 4,633 | 160 | # 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... |
60a3bea1f66796e5b1c711ae0611fcccf269c2c20aef9954522e7d1f03e9c4ea | Python | 4,633 | 118 | """Tests for the Cellpose model-training launcher (offscreen Qt + pure builder)."""
import os
import sys
import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from PySide6.QtWidgets import QApplication
except Exception as exc: # pragma: no cover
pytest.skip(f"PySide6 ... |
77c43b60d437d300d15777bc6c66ac36484ee05254c8a7a7b392a505e3500d03 | Python | 4,633 | 176 | import argparse
import ast
from maldi_nn.models import MaldiTransformer
from maldi_nn.utils.data import SpeciesClfDataModule
from lightning.pytorch.callbacks import ModelCheckpoint
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch import Trainer
from maldi_nn.spectrum import PeakFilter
de... |
cdadc0a50813751616589423a2f03f988136d7f6f6eb5bae474d0b0c5478a6fb | Python | 4,633 | 139 | # Node-group asset "Dihedral Nucleic Angle" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE... |
58912de8b32c2181fc69223d14351850cdb7c255aadeb0521283c980aa24a989 | Python | 4,634 | 124 | """
Molecular Dynamics recipes for EMT.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.calculators.emt import EMT
from ase.md.npt import NPT
from ase.units import bar, fs
from quacc import Remove, job
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from... |
a3f99a8f85b573c02cb3c60ba20d14d439409887ffe5228f72ad168980f56939 | Python | 4,634 | 121 | '''
Created by Yi Jie (Josh) Tseng on 9/28/2023
The purpose of this code is to graph scatter plot and the slop of selected region. This script will take a user input file and
plot all date into a scatter plot using a column named "Elapsed" as the X-axis and the sample cell counts as the Y-axis. After
checking t... |
b668fe8288f3fff4f5f22a93fd77eb014cc737d68d11d23e8bf616566936fb31 | Python | 4,635 | 137 | """Headless OME-Zarr conversion CLI with colored output.
Invoked in a terminal by the GUI as
``python -u -m regtools.ome_zarr_converter.cli --job-spec <job.json>``.
The job JSON is produced by the GUI (see the converter design spec).
"""
import argparse
import json
import os
import sys
import traceback
... |
da115fd4b75ab990392509575713c1be3a7e1e158835ad8ba6e32c48cd3a899e | Python | 4,636 | 143 | import numpy as np
import pytest
from SurvivalEVAL.evaluations.discrimination import (
auc,
concordance,
concordance_time_dependent,
)
def _evaluate(metric, **changes):
kwargs = {"event_times": [1, 2, 3], "event_indicators": [1, 0, 1]}
if metric == "auc":
kwargs.update(predict_probs=[0.1,... |
80e92ba31f6e9c851d954e2b90ec128285fc10f82d9f6557224800517a572e36 | Python | 4,637 | 122 |
# set parameters related to converting gene names
def set_gene_conversion_parameters(config):
for ref in config['references'].keys():
try:
config["references"][ref]['convert_ref_mm_to_hg']
except:
config["references"][ref]['convert_ref_mm_to_hg'] = False
# set parameters related to batch
def s... |
77be5e51c8bfd5aa3b136e9b6694cf3b4a8a0fd8031c7de44395a03f20fcbfce | Python | 4,638 | 136 | """
Lagged coherence of time domain signals.
Author: James Bonaiuto <james.bonaiuto@isc.cnrs.fr>
Adaptation: Sotirios Papadopoulos <sotirios.papadopoulos@univ-lyon1.fr>
"""
import numpy as np
from scipy.signal import hilbert
from joblib import Parallel, delayed
def phase_shuffle(epochs, n_shuffles=100):
... |
6b35d4fca4caa26ab8b4b4090d110f44b1f61789149a78c9c6c1e06f6841085e | Python | 4,640 | 152 | """Plot earliest prediction timepoints."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
from matplotlib import pyplot as plt
import motor_intention.plotting_settings
import motor_intention.proj... |
72f2d987d9b999cbdb59678b214ea13e991ca0d78f02f2683cd717a93b1c2cd7 | Python | 4,640 | 117 | from .tiled_volume import TiledVolume
from pathlib import Path
from .config import *
class Interface:
loaded = {}
@staticmethod
def instance(path):
"""
now it only supports TiledVolume (Tiled Tiff/V3DRaw 3D)
:param path: teraconverted brain / resolution
:return: an instanc... |
43037322370ef9f69def72ae36b1272a60e9efe19055bbe5f0bf1605558956f2 | Python | 4,641 | 131 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
import tensorflow as tf
from edward.inferences.variational_inference import VariationalInference
from edward.models import RandomVariable, PointMass
from edward.util import copy
class MAP(Variatio... |
6485a2a1643528b0c29223b7228abce41127e4e49dd4cc118f7007c0a52298f4 | Python | 4,642 | 95 | import os
from typing import Tuple, Union
import numpy as np
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
from ..utils import get_random_dir_path
from .utils import create_subset, ensure_cache, read_indices, write_indices
def train_test_split(
dataset: Ba... |
7152726a0c0148c0860276ba2c68467c1e5fef67887fc6849514c5499cb57a7b | Python | 4,642 | 147 | # 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... |
012572c99c622482f0edb4c8555a49c7c276f773371e4e45df78a51a7d1ef347 | Python | 4,643 | 132 | import itertools
import logging
import os
import posixpath
import urllib.parse
from typing import List
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.models.index import PyPI
from pip._internal.utils.compat import has_tls
from pip._internal.utils.misc import normalize_path, redact_auth_f... |
07011169079ddd148dcd1df737030d5e8b9949d52e9455e7d66387a371b9b204 | Python | 4,643 | 156 | ''' Modified by Mayank Kabra
From LEAP https://github.com/talmo/leap by Talmo Pereira
'''
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
def show_pred(net, X, Y, joint_idx=0, alpha_pred=0.7, save_path=None, show_figure=False):
"""
Shows a prediction from the model.
net: n... |
f2b24a9e3a8fb28606e9a2a64ad30709dfcd0e37bb1b4f5473a19ced51d84c55 | Python | 4,643 | 134 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
234fe77b3f383eeddf841411bb914a04b5f31b263bfddd5e5c45b7d514a91213 | Python | 4,644 | 94 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
2362b671c38fa97c24c449d0e47955d66de18203a5f6447f74d55e9b49612142 | Python | 4,644 | 129 | # Node-group asset "Centre on Selection" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CH... |
63d7c7a3c2622e637614584959531a55fe03f04e25ee14ea6a4cf82a17b135b0 | Python | 4,644 | 96 | """Lesion-level detection of fine-tuned vs scratch-trained models, with a
patient-level bootstrap.
Lesions follow the dissertation protocol: the reference and predicted masks of
a region (TC = labels 1 and 3, WT = labels 1-3) are split into 26-connected
components and components smaller than 20 mm^3 are discarded. A r... |
8c413f4ccc1b10fb60e6d1055f62b253b9893b774c21230038f8708102adcc6e | Python | 4,644 | 136 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.fusedffn.design import FFN as FFNDesign
from elasticai.creator.nn.integer.fusedffn.fc1relu import LinearReLU
from elasticai.creator.nn.integer.fusedffn.fc2 import Linea... |
d8c1d93a79861a20f626c0bf55b301d8c2675afa1a45392b405c0beb4a2b7160 | Python | 4,644 | 90 | import subprocess
import argparse
from convert_to_iso import convert_file
def call_fsl(cmd, pipe):
proc = subprocess.Popen(cmd.split(), stdout=pipe, stderr=pipe, shell=False)
return proc.communicate()
def process(ct_file, mri_file):
output_folder = '/seeg_vol/SEEG_Viewer/Outputs/'
SEEG_CT = ct_file
... |
ddb4c857e476947a591a783e9d87e939855c4558b589a35aa11a4a1a6e051724 | Python | 4,644 | 144 | import torch
import torch.nn as nn
import math
DEFAULT_W0 = 30.
########################
# Initialization methods
########################
def _no_grad_trunc_normal_(tensor, mean, std, a, b):
# For PINNet, Raissi et al. 2019
# Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.... |
524d2f022a5f78493743a7397396b8013318b156c0b15b6996b71c2407b9733e | Python | 4,648 | 115 | from typing import Tuple, List, Union
from skimage import io
import SimpleITK as sitk
import numpy as np
import tifffile
def convert_2d_image_to_nifti(input_filename: str, output_filename_truncated: str, spacing=(999, 1, 1),
transform=None, is_seg: bool = False) -> None:
"""... |
d8e43e45c30875f3a6e3b0551dfe4322dd90b01d577d0c4ecfe25c033673d30c | Python | 4,649 | 132 | # MIT License
# Copyright (c) 2023 Qiyun Wu
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... |
1b4f1aa0baeb53b23d520f115dd050bf9ebac21ed09dfb57d8c4bbadbd9a5bdc | Python | 4,650 | 117 | """
====================================================
Hyperparameter Optimization Benchmark with OpenML
====================================================
In this tutorial, we walk through how to conduct hyperparameter optimization experiments using
OpenML and OptunaHub.
"""
#####################################... |
44e5fd51dd2807a7e1dc9e8d015526e0e312250920f3c8d234071713a29e8d3d | Python | 4,650 | 129 | """
Description:
Computing auxiliary data (VAE latent variables at each timepoint and the corresponding UMAP visualization) for perturbation analysis.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
"""
import torch
import numpy as np
import pandas as pd
from benchmark.BenchmarkUtils import loadSCData, ... |
733112d0f4d7f0a19554613a2977b8db44f6f05990e03240acefcf753dae4e60 | Python | 4,650 | 131 | # 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... |
ff07214da66bb32fea91e4103d20ece798b15e7040f8001165a9006bcbb2dadd | Python | 4,650 | 150 | from dataclasses import dataclass
from typing import Protocol, Self, TypeVar, overload, runtime_checkable
@runtime_checkable
class ConvertableToFixedPointValues[T: ConvertableToFixedPointValues](Protocol):
def round(self) -> Self: ...
@overload
def clamp(self, min: Self, max: Self) -> Self: ...
@ove... |
91038e5ea60d3cd8f59c108ee70d4a1ff2996300540ec385d2258595245c887b | Python | 4,652 | 124 | import argparse
import json
import os
from openmm import XmlSerializer, unit
from openmm.app import PDBFile, StateDataReporter
from colabmda.openmm.modular.utils import (
add_solute_heavy_atom_restraints,
fresh_seed,
load_stage_state,
make_sim,
offset_seed,
save_stage_artifacts,
save_stage... |
c473fc472c2d42171d2a54ca39a3605570921f73f81bc860c30516cc7e7d2657 | Python | 4,652 | 118 | import numpy as np
import pandas as pd
from pathlib import Path
import brian2 as b2
import brian2hears as b2h
import mne
from tracking_utils import (
load_config,
extract_envelope,
extract_envelope_phase,
extract_eeg_phase,
reorder_eeg_data
)
mne.set_log_level('WARNING')
if __name__ == '__main__... |
caeb9af0a5fda84e3ddea74d914479f7d2c42e8f136a8e39401a8b7b0c93b8b0 | Python | 4,653 | 158 | """
Contains class Distance for the calculation of distances between given segments.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from builtins import object
__version__ = "$Revision$"
from copy import copy, deepcopy
import warnings
import numpy
... |
d7eb997fcf93ffaccfd8655862c078bde755991a4017bd9849e053f9b7a3ebac | Python | 4,654 | 154 | """
oxasl.gui.run_box.py
Component of the OXASL GUI which runs the OXASL pipeline
Copyright (c) 2008 University of Nottingham
"""
import sys
import traceback
from threading import Thread
import nibabel as nib
import wx
from wx.lib.pubsub import pub
from oxasl import Workspace
from oxasl.pipeline import oxasl
from ... |
ec617d70b7613f8aee040b7540d20be987bf9d4249d3bf6f6d6302d6d68969e5 | Python | 4,654 | 99 | import torch
from torch import nn
from typing import List, Dict, Optional
from ..utils import _scatter_add, find_distances, add_scaling
class AtomicModule(nn.Module):
def forward(self,
batch_data : Dict[str, torch.Tensor],
properties : Optional[List[str]]=None,
... |
3d500b323a047e268b9422b26c66e71680bacdc91a7f2f9220151d1174bcc0f2 | Python | 4,655 | 140 | # 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... |
66985f63df774ac435d08d489aa10b540d15ab238967c189cf0fba5064c2ab34 | Python | 4,655 | 135 | """Core recipes for universal machine-learned interatomic potentials."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.atoms.core import get_final_atoms_from_dynamics
from quacc.recipes.mlip._base import pick_calculator
from quacc.runners.ase import Runner
from ... |
9876890224cebbbd3d6d0738c75a3310c55c7828b934c0be2b5353046c984f04 | Python | 4,655 | 133 | """
Optuna example that optimizes convolutional neural networks using PyTorch Ignite.
In this example, we optimize the validation accuracy of fashion product recognition using
PyTorch Ignite and FashionMNIST. We optimize the neural network architecture as well as the
regularization. As it is too time consuming to use ... |
818189b303fd55b11493db6e2c62ed59af3adf4c8c5bb303a56c2a90d2951883 | Python | 4,656 | 153 | # Node group "XPBD Solve Points" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regene... |
3a0164670858616397cc3306b32d851c83440acbaf5e0fc920b626e9c3ebcd46 | Python | 4,657 | 123 | # 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... |
9347fe523ca3508bff8bffb361dea4723f39127d3510e376a47a779cbf883904 | Python | 4,657 | 119 | import torch
import random
import numpy as np
import pandas as pd
import torchvision.transforms as transforms
from scipy.spatial import distance
from scipy.spatial.distance import cosine
from sklearn.neighbors import NearestNeighbors
from sklearn.metrics import mean_squared_error
from torch.utils.data import T... |
c3298aaa157cfdb863aaa4e09bb26b27cc8faa40303d355c1a451252e23d95bb | Python | 4,657 | 112 | import unittest
import hed.schema.schema_validation.validation_util as util
from hed import load_schema_version
from hed.errors import ErrorHandler, SchemaWarnings
from hed.schema.hed_schema_entry import HedSchemaEntry, HedTagEntry
from tests.schema.util_test_schemas import load_test_schema
class Test(unittest.TestC... |
61b585f00b8ee0027ad1a407133bc6f8bb7951dcb24edc273c14175029cc6404 | Python | 4,658 | 122 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 20 10:28:54 2021
@author: ftead
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from numpy import trapz
import seaborn as sns
#%%
#testing fofr calculation of a single nucleus
df1 = pd.read_excel('ko_cells.xls', 'KO 21')
#n... |
83b1ae07b996c6b85c24c61162427fdaf6c8d9de1823afa847b52f51cbf39229 | Python | 4,659 | 129 | import torch
import torchvision.transforms as transforms
import numpy as np
import cv2
from utils.ddfa import ToTensor, Normalize
from model_building import SynergyNet
from utils.inference import crop_img, predict_sparseVert, draw_landmarks, predict_denseVert, predict_pose, draw_axis
import argparse
import torch.backen... |
51d6f9aa8db8491a65c7d3efa527e758e9ab37efea635cb483b76b4b80a011b8 | Python | 4,660 | 154 | """Unit tests for the ANTs effort presets + resolve_ants_kwargs merge logic.
Pure logic only -- no QApplication, no real ANTs registration run.
"""
import logging
import pytest
from regtools.registration.core.registration.presets import (
ANTS_EFFORT_PRESETS,
resolve_ants_kwargs,
)
@pytest.... |
67772ed17997c400b0be57dc552780fb15ae0b1e67d3c25ae8b6b71f9ac5ec0d | Python | 4,660 | 120 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
6cb5e92f7038693218e4961ff5ed22ae4b71b4aef8ccd35421dfa1dbf8477d2e | Python | 4,660 | 127 | import unittest
import torch
from torcheeg.models import (ArjunViT, ATCNet, Conformer, SimpleViT, TCNet,
VanillaTransformer, ViT, LaBraM, DARNet, MHANet)
class TestTransformer(unittest.TestCase):
def test_labram(self):
eeg = torch.randn(2, 6, 8, 200)
model = LaBraM.b... |
78e94e0419f6f963d628ee45cc832f924e02ad451abcc61c2f5796e11d5f183d | Python | 4,660 | 127 | # 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... |
3228d6574d2cb587d2fea8ea0a80a063ed3c694015d0492dbc8db1fbd3db2664 | Python | 4,661 | 229 | import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.test_util import check_grads
npr.seed(1)
def test_abs():
fun = lambda x: 3.0 * np.abs(x)
check_grads(fun)(1.1)
check_grads(fun)(-1.1)
check_grads(fun, order=1)(0.0)
def test_absolute():
fun =... |
951533694b73511de7e49231dc9d90f20cd492ba0c8c4e97d115e57c5ad33a93 | Python | 4,661 | 152 | """Vision transformer model.
Copyright (c) Meta Platforms, Inc. and affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
--------------------------------------------------------
References:
timm: https://github.com/rwightm... |
98d8fd6125f4f403118fda1150ce96f093808855c1bca752c86866e31bf0143b | Python | 4,661 | 127 | # 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... |
31af6c49ed000aec93e9202b9549e233066afb6a68a8967245d42cf32291236a | Python | 4,662 | 143 | # -*- coding: utf-8 -*-
"""
Created on 15 October 2023
@author: divyoj
"""
## importing libraries:
import numpy as np
import matplotlib.pyplot as plt
import os
from numba import njit
import time as process_time
import plotting
from scipy.integrate import solve_ivp
import seaborn as sns
from tqdm import tqdm
sns.set_t... |
3881f6b7fe2f07fda74c66d3e93cf4d9310996d812a30b29869a5fefd79c3bea | Python | 4,663 | 156 | # Node-group asset "Density Style Surface" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_... |
399db66d9595f6628d9993525533a3b0664ca31a018c107b8c20155b8632d930 | Python | 4,663 | 132 | import os
from typing import List, Optional
import hydra
from hydra._internal.utils import _locate
from omegaconf import DictConfig
from pytorch_lightning import (
Callback,
LightningDataModule,
LightningModule,
Trainer,
seed_everything,
)
from pytorch_lightning.loggers.logger import Logger
from c... |
4586dc5b0e16aaa5cf6b7aee58540df5e970143ef1aa004c8c0d0ef84c5c3710 | Python | 4,663 | 101 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute the logistic weights of priors and sensory likelihood at each trial around the change points.
This script gather, for each subject, trials with the same distance to a change point
and compute for each distance, a logistic regression of the sensory likelihood... |
654732c68713b2d1275a6fae5b19989022098246d291ff6d84047ae4b5b25756 | Python | 4,664 | 117 | # 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... |
16fbcd831fc1ef2a637fbaccc4534d04eb2e17f0e3fce57c2f87669142e140a3 | Python | 4,665 | 143 | """distutils.command.bdist_dumb
Implements the Distutils 'bdist_dumb' command (create a "dumb" built
distribution -- i.e., just an archive to be unpacked under $prefix or
$exec_prefix)."""
import os
from ..core import Command
from ..util import get_platform
from ..dir_util import remove_tree, ensure_relative
from ..e... |
2cca42faf3b5958dd274e63d6636f4c0a74c84d34360407009a9ef196f91789e | Python | 4,666 | 126 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
da4639cf7665891ddd6c6bf0176d2cbe66387b561bae6cb4490f0cc84af39d9d | Python | 4,666 | 110 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import torch
from mne.viz import circular_layout
from mne_connectivity.viz import plot_connectivity_circle
from .utils import _plot_to_image
def plot_adj_connectivity(adj: torch.Tensor,
channel_list: list = None,
... |
27769fb65ac43d688361e0ec5585c2662915fe066d9e21b3ba4187724124318e | Python | 4,668 | 126 | import os
from tqdm import tqdm
import numpy as np
import pandas as pd
from random import sample, randint
import torch
import torch.nn as nn
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, Dataset
import _init_paths
from mylib.voxel_transform import rotation
def square(d):
... |
28a1cbda7f33ab0d1591d36232e6cc36ee441550e8118afe1a84202d0e9ee064 | Python | 4,668 | 122 | """
Introduction to the transforms Module
=====================================
Welcome to the guide on TorchEEG's ``transforms`` Module! This module provides you with toolset designed for the transformation and preprocessing of EEG signals and related metadata.
EEG transforms concentrate on EEG preprocessing, featur... |
46cc4ada299e5e9e956dd5005eb5025d25771d568fc81807888c53ab196b0faa | Python | 4,668 | 140 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
from . import returncodes
from . import util
import math
try:
import resource
except ImportError:
resource = None
import sys
"""
Notes on limits: On Windows, the resource module does not exist and hence we
cannot enforce any limits the... |
56a01625417be49e457f3c8e075d0c4358a66d7de13d127efe9df7450d81fccf | Python | 4,669 | 142 |
import os
import time
import logging
import argparse
import yaml
import jinja2
from jinja2 import meta
import easydict
import torch
from torch.utils import data as torch_data
from torch import distributed as dist
from torchdrug import core, utils
from torchdrug.utils import comm
from . import model
logger = lo... |
cc698dbbea3d52db35d736e61152c677c1597d36c56a8b88621548bfff6525fd | Python | 4,670 | 111 | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import logging
import os
import sys
import io
import tensorflow as tf
import matplotlib.pylab as plt
from tensorflow.keras import layers
from tensorflow.keras import models
import numpy as np
from PIL import Image
import ... |
d7f08b451571062bb6268780911aa905b628a0e7541eab6e145ab9f5e364d20e | Python | 4,670 | 131 | import numpy as np
import rdkit
import rdkit.Chem as Chem
import networkx as nx
from build_vocab import WordVocab
import pandas as pd
import os
import torch.nn as nn
from utils import *
from torch_geometric.loader import DataLoader
from torch_geometric.data import Batch
from torch.nn.parameter import Parameter
impor... |
d0fb90310468eb0002ee375b576b54292896b7b1eb389f6b8ae63f076439e02f | Python | 4,671 | 143 | #!/usr/bin/env python
# Written by Minh Nguyen and CBIG under MIT license:
# https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
import argparse
import os.path as path
import numpy as np
import pandas as pd
import cbig.Nguyen2020.misc as misc
def split_by_median_date(data, subjects):
"""
Split timepo... |
73b96bf7a50a4b59e35b066d45ea8b8a055c4cc4cc4a68c6ada753aa6a37e41b | Python | 4,673 | 132 | # Plot probability of contributing to a corticospinal wave for S1 Appendix Fig H
from os.path import join
from get_paths import *
import pickle
import matplotlib.pyplot as plt
import numpy as np
from colors_paultol import colors
save_flag = 0
## Load data
# Load simulation results
fname_data = "data_u... |
146faba6346916636988607837322e72fc6aeac4085c1dc7393a3699e4cab6b5 | Python | 4,674 | 127 | """
pygments.formatters.terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pip._vendor.pygments.formatter import Formatter
from pip._vendor.pyg... |
53da8402c38b95f180b4e77b07a92307563757fb47afa582062a715f66a71bc9 | Python | 4,674 | 149 | import os
import argparse
import pathlib
from source.dataset_collection import DeepVIDv2Dataset
from source.network_collection import DeepVIDv2
from source.worker_collection import DeepVIDv2Worker
from source.utils import JsonLoader, JsonSaver
def get_parser(parent=None):
if parent is None:
parser = arg... |
a20903f039ca1bfc22d937cfbf0e5d7e00ab5f0065bf3d951fdf668cfe93eeda | Python | 4,675 | 134 | # 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... |
a3d2ca3886330ad3da989785a0220e924dcd13e6d5e59afdf836e0d8d8808092 | Python | 4,675 | 135 | # 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... |
2f27ce2df3ad0c23517b87fe96afa1a8a664ef9f737d19687dbf21bbc496201f | Python | 4,676 | 77 | """AMOUNT_OFFICIAL.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30e-AMOUNT-OFFICIAL.md
The 56 random type-level sign sets of TIPPING_POINT (10-70% excitatory share, 8 per target), re-run on Shiu et al.'s own
v783 file (whole brain, DL5 + DA1, 150 Hz, 5 trials). Does the same set get the same verdict on both... |
ac84ddb27956c937ac3c0edc8eb7257c1c092c070b96fac0f63b6bdb3220349a | Python | 4,677 | 123 | from ngclearn import resolver, Component, Compartment
from ngclearn.components.jaxComponent import JaxComponent
from jax import numpy as jnp, jit, nn
from jax import grad, value_and_grad #, jacfwd
from functools import partial
from ngclearn.utils import tensorstats
@partial(jit, static_argnums=[2])
def calc_go... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.