sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
457d4979184e4f2b52b19c545ee32be6fc1b63b017f7c4b355e225c54cbb670c | Python | 4,094 | 133 | # 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... |
d0738c9c33a8550671252675afed0f2c2d7a65e9741497b74ba70801b4183c01 | Python | 4,094 | 131 | import hypothesis.strategies as st
import pytest
import torch
from hypothesis import settings as hypothesis_settings
from hypothesis.stateful import (
RuleBasedStateMachine,
initialize,
invariant,
precondition,
rule,
)
from torch.nn import Conv1d, Flatten, Linear, ReLU, Sequential, Sigmoid
from ela... |
04cd862bad6449d67be1b5eebdb292160dd853429a9e93c2c9b52afd9c1a840a | Python | 4,095 | 127 | import os
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn.modules.loss
def format_metrics(metrics, split):
"""Format metric in metric dict for logging."""
return " ".join(
["{}_{}: {:.4f}".format(split, metric_name, metric_val) for metric_name, metric_val in metric... |
0fb8c1ce296d8a42644efaf5ceae5a9a1190b849e0bdd4c2ddaa54b46bc86f3c | Python | 4,096 | 127 | import os
import sys
_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if _ROOT not in sys.path:
sys.path.insert(0, _ROOT)
from installer import platform_win as win
def test_parse_longpaths_value():
enabled = " LongPathsEnabled REG_DWORD 0x1"
disab... |
a4fecdbde1b7e06ce80d45c323b2bcd7fb073b12e958b44989023043f6555e94 | Python | 4,096 | 115 | import matplotlib
import numpy as np
import seaborn as sns
matplotlib.use('TkAgg') # Set the backend for matplotlib
import matplotlib.pyplot as plt
import os
import scipy.io
import pandas as pd
from Functions.f_AnalysisGraphs import *
from Functions.f_AnalysisFunctions import *
from Functions.f_AnalysisSta... |
ff4703b1660f5d8b30d7a30fce7106d46acca4d44c7de4cac3db05db54dd2680 | Python | 4,096 | 98 | from __future__ import print_function
# NOTE(caelan): must come before other imports
import sys
sys.path.extend([
'pddlstream',
'ss-pybullet',
#'pddlstream/examples',
#'pddlstream/examples/pybullet/utils',
])
import argparse
import numpy as np
import datetime
import os
np.set_printoptions(precision=3... |
476264e3ce480fd511600f7c399730b76438357427d9178ee5f30023001ec552 | Python | 4,098 | 120 | import sys
import logging
import pupil_recording_interface as pri
# Generation of your pupil device (1, 2 or 3)
pupil_gen = 2
# folder for saving calibration
folder = "~/pupil_capture_settings"
if __name__ == "__main__":
# stream configurations
configs = [
pri.VideoStream.Config(
devic... |
bade2150a9b1da6c314b7fbc0c6542ef0c5532a837207de73c1413da2c93a8d9 | Python | 4,099 | 97 | import os
import tempfile
import unittest
from torcheeg.model_selection import TrainValTestSplitCrossSubject
from .test_utils import _make_dataset
class TestTrainValTestSplitCrossSubject(unittest.TestCase):
_splitter_class = TrainValTestSplitCrossSubject
_parameters = {
'train_subjects': [0, 1, 2],
... |
39ce0fd394acbb969df6f07e46abdbc4882c1fe79e3e53ba59687358d9045f89 | Python | 4,102 | 122 | from typing import Literal
from .LTPlusDataset import LTDataModule
from .rectangledataset import RectangleDataModule
from .squaredataset import SquaresDataModule
# Standard parameterizations of datasets used in experiments
from ..colors import RedXORBlue, NotRedXORBlue, RandomGrey, Grey, RandomChoiceColor
from ..text... |
3e703a848766de8a49a4af618aadc56fa16522ff857978ada23017bc86f0bbda | Python | 4,102 | 107 | '''
Description:
Run scNODE on extrapolating multiple timepoints.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import torch
import numpy as np
from model_validation.extrapolation.utils import loadSCData, tunedOurPars
from benchmark.BenchmarkUtils import splitBySpec
from optim.running import constructscNOD... |
1497c00c806a46cb4f39ff64445d519caaea88584cd1250a40a5b1eef8ab7c9e | Python | 4,103 | 98 | """Screenshot the continuous-generation window during a real run (offscreen VTK EGL rendering).
QT_QPA_PLATFORM=offscreen PYTHONPATH=src python scripts/capture_continuous_ui.py \
--output publication/continuous/ui --tokens 1000 --strength 0.70 --feedback 0.45
"""
from __future__ import annotations
import argp... |
a64a3995e2793424294f1439baefc0bfd292eebb2c42d9ba01c814d18f9e5d3c | Python | 4,104 | 102 | # --------------------------------------------------------
# DaSiamRPN
# Licensed under The MIT License
# Written by Qiang Wang (wangqiang2015 at ia.ac.cn)
# --------------------------------------------------------
#!/usr/bin/python
import argparse, cv2, torch, json
import numpy as np
from os import makedirs
from os.p... |
269457aa21055862efe575cd5fb88f79b4d11580deb9e9b1e5ee2b130efc234a | Python | 4,106 | 107 | import csv
import os
import pickle
from typing import List
import numpy as np
import pandas as pd
from rdkit.Chem import PandasTools
def save_features(path: str, features: List[np.ndarray]) -> None:
"""
Saves features to a compressed :code:`.npz` file with array name "features".
:param path: Path to a :... |
4794c1d6241cd0446e9e8e8018a58c9de1c2199846b5cf2913cdc2f1f049237c | Python | 4,106 | 107 | #! /usr/bin/env python
from __future__ import print_function
from collections import defaultdict
import build_model
import pddl_to_prolog
import pddl
import timers
def get_fluent_facts(task, model):
fluent_predicates = set()
for action in task.actions:
for effect in action.effects:
fluen... |
acae3d58a28c580dca2d9d66042a9a7f61e7d845f3a2218d8660276d9112bd7d | Python | 4,107 | 159 | from __future__ import print_function, division
import torch
from torch.autograd import Variable
from PIL import Image
import torch.utils.data as data
import numpy as np
import os
import sys
try:
import cPickle as pickle
except:
import pickle
def load_object(filename):
with open(filename, 'rb') as input:
... |
b70b406b58c1425ba4deda1a9648aa6e45c83da14bc90f317b041ef7186e72f9 | Python | 4,108 | 95 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
from examples.pybullet.utils.pybullet_tools.pr2_problems import create_floor, create_table
from examples.pybullet.utils.pybullet_tools.pr2_utils import get_top_grasps
from examples.pybullet.utils.pybullet_tools.utils import connect... |
370b7fd405232954fd509d7ce4941b4198b1849a963b3e879f8735243673dd18 | Python | 4,109 | 112 | # 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... |
5e836c61b5717441df5103e5daca5a1fce79f04d39109e21998a4abc80c46679 | Python | 4,109 | 102 | # AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"ode_solve": "00_ode.ipynb",
"ODEF": "00_ode.ipynb",
"ODEAdjoint": "00_ode.ipynb",
"NeuralODE": "00_ode.ipynb",
"MMD_loss": "01_losses.ipynb",
"OT_loss": "01_losse... |
62b6363337528c1b68818198702e5cdcb0312e7f86e5d6fe0c401f9398813fec | Python | 4,110 | 116 | #!/usr/bin/env python
# Copyright (c) 2018-2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module contains the result gatherer and write for CARLA scenarios.
It shall be used from the ScenarioManager only.
"""
from... |
84415c0a9602d0006fe86fd346e3d5eca792eb26fbc0254b5949e7e5da7be1a4 | Python | 4,110 | 80 | from pddlstream.algorithms.downward import fd_from_fact, fact_from_fd
from pddlstream.algorithms.scheduling.negative import get_negative_result
from pddlstream.algorithms.scheduling.recover_streams import extract_stream_plan
from pddlstream.algorithms.scheduling.utils import get_instance_facts
from pddlstream.language.... |
381c6d8b3ae87c9fd9048ce77b27ee5182469c49c982b948e2444d63ec150fb3 | Python | 4,111 | 107 | import numpy as np;
import pandas as pd
from sklearn import preprocessing, metrics
import scipy
"""
evaluation.py provides evaluation functions that takes in predictions and output gene-wise correlation, peak-wise AUROC and AUPRnorm, as well as FCT (FOSCTTM) score
"""
def compute_pairwise_distances(x, y):
... |
8c8b20ea3d5d702576508fe118abb04fbcbf0bcbbeea0731fe7143ea7eef155a | Python | 4,111 | 100 | import random
from itertools import product
from plan_tools.common import COLLISION_BUFFER
from pybullet_tools.pr2_utils import get_arm_joints
from pybullet_tools.utils import set_pose, pairwise_collision, get_moving_links, set_joint_positions, \
pairwise_link_collision, get_all_links, any_link_pair_collision
def... |
1fa2b0c2a2684031c90899b14d0b6742051e2379284a602c8325d0459bb4f476 | Python | 4,113 | 115 | # 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.
#
# Sample sequences based on a given structure (multinomial sampling, no beam search).
#
# usage: sample_sequences.py [-h] [--chain CHAIN] [--... |
2ef60ab665d2f4942cae55cd22c3578543c927bac4cb1e8633e9cecc2c0a5137 | Python | 4,113 | 91 | from typing import Optional, Union
from segmentation_models_pytorch.base import (
SegmentationHead,
SegmentationModel,
ClassificationHead,
)
from segmentation_models_pytorch.encoders import get_encoder
from .decoder import LinknetDecoder
class Linknet(SegmentationModel):
"""Linknet_ is a fully convol... |
3278005358092bda731b2287eba96b2a5f3b378b8d99dfc1f3656d9515b78804 | Python | 4,113 | 119 | import numpy as np
from scipy import ndimage
from skimage import measure, morphology
def find_edges(mask, level=0.5):
edges = measure.find_contours(mask, level)[0]
print(type(edges))
ys = edges[:, 0]
xs = edges[:, 1]
return xs, ys
def plot_contours(arr, aux=None, level=0.5, ax=None, **kwargs):
... |
4510a15ee30684a3861ef9c21fe2d011d1be77efab4daca1eff891096771b378 | Python | 4,113 | 123 | # 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... |
638b3380727fc2adc7ac88e3f0e1ab91972bfb0c8650af93a218f67297e3b828 | Python | 4,113 | 124 | """The CCF boundary editor's 3D load can run off the GUI thread.
load() decompresses multi-hundred-MB NIfTIs; on the interactive atlas-picker path
that froze the editor. load_async() moves the decompress to a worker and applies
the result on the GUI thread, leaving the event loop responsive. This pins:
* the di... |
d3e17971c0b2b1a1737f31a3444115dc3470b568c208a3c14583561226f651b1 | Python | 4,113 | 118 | """Constructor for spin-echo spectrum sequence with projection gradient."""
# %%
from math import pi
import pypulseq as pp
from console.utilities.sequences.system_settings import raster
from console.utilities.sequences.system_settings import system as default_system
def constructor(
fov: float = 0.24,
read... |
a0846ea3a7c6b5bf7e2e463011525d304518d1a969d9073dcfdf68abc6e20d03 | Python | 4,114 | 112 | import torch
import torch.nn.functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.relu.design import ReLU as ReLUDesign
from elasticai.creator.nn.integer.quant_uti... |
b1621a37817d0af2ab7671e5292ceed941719984860b671aa6078c145b1f0854 | Python | 4,114 | 99 | from __future__ import print_function
# NOTE(caelan): must come before other imports
import sys
sys.path.extend([
'pddlstream',
'ss-pybullet',
'plan_tools',
#'pddlstream/examples',
#'pddlstream/examples/pybullet/utils',
])
import argparse
import numpy as np
import datetime
import os
np.set_printo... |
2cb71e4df1d9ffc0b55bea9355c8fc83c2e548f873aecb075d891d2da1941270 | Python | 4,115 | 156 | # 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... |
5c7102becf152a493ca9ad0286bc252ea3ec3bab3e26be1a8b1bdf7149de79de | Python | 4,117 | 120 | import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import globals.global_font as gFont
import globals.global_style as gs
class Cell(QtWidgets.QWidget):
def __init__(self, r, c, colorbarRuler):
super(Cell, self).__init__()
self.r = r
self.c = c
self.__colorValue = ... |
7c295818a32757ab82cc5eddbea5c0f296a334a0535cc7cc841b515452b008c8 | Python | 4,118 | 131 | """Core recipes for GULP."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.recipes.gulp._base import run_and_summarize
if TYPE_CHECKING:
from typing import Any
from ase.atoms import Atoms
from quacc.types import CopyFiles, RunSchema
@job
def sta... |
ec03cce1900c792fe096e11270f061554369171cb981e02bbd823ab2e289989c | Python | 4,118 | 123 | """"""
"""
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 softw... |
5f81ef2818e57f31707ed4015f9e8a40299e7fae47a0062f7c87df45d64b1cea | Python | 4,119 | 107 | import matplotlib
matplotlib.use('Agg')
import sys
import Core
import xml.etree.ElementTree as ET
matplotlib.interactive(False)
from pylab import *
ioff()
def main(fname, param=None):
"""
The main function of the command line version.
Reads the content of the .xml file into the option object,
and cr... |
766323d18843c5de407d9a54cc26ef73dfc5ea842bad205e15fa509de68cdaa9 | Python | 4,119 | 127 | """
Optuna multi-objective optimization example that optimizes multi-layer perceptrons using PyTorch.
In this example, we optimize the neural network architecture as well as the optimizer configuration
by considering the validation accuracy of fashion product recognition (FashionMNIST dataset) and
the FLOPS of the PyT... |
8ba8cbcb5ce069e56984773b7cf6d4371922612ff5ca009250a9158215ad900a | Python | 4,119 | 133 | import torch
import lightning.pytorch as pl
import numpy as np
from trainer import LitModel, TrainingConfig
from torch.utils.data import DataLoader, Dataset
class TrainSeqDatasetProb(Dataset):
"""np.array dataset"""
def __init__(self,
ds: np.ndarray,
reverse: bool,
... |
8901fb5844865ee2593bfcc33cdec485593ab077b927849b2e739c3789506b82 | Python | 4,120 | 105 | import os, numpy as np
import pandas as pd
from PIL import Image
from .download import *
# Benchmark Classes ------------------------------------------------------
class NeuralDataset:
def view_sample_stimulus(self, image_index = None):
if image_index is None:
image_index = np.random.ran... |
dcdd3ce8346e751e4da3f89dfd3b39d00f0325cee8263870c6950757f0a1fa8c | Python | 4,121 | 110 | import pandas as pd
from lifelines import KaplanMeierFitter, NelsonAalenFitter
from lifelines.statistics import multivariate_logrank_test
def get_data_ready_for_km(dfs_dict, args):
kmdf = None
for df_key in dfs_dict:
if df_key == 'clinical':
kmdf = dfs_dict[df_key]
else:
... |
4f55d377241b673a917c112d02201d938bd1348e5a688d377a3737550f814d9e | Python | 4,123 | 155 | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_backends
class AlbertTokenizer:
def __init__(self, *args, **kwargs):
requires_backends(self, ["sentencepiece"])
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_b... |
b878945c2e93983d3be7778459754492ae69dc89ae13f97bcd5c42636558e16a | Python | 4,123 | 135 | import cocotb as ctb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
from cocotb.types import LogicArray, Range
from elasticai.creator.file_generation.resource_utils import get_file_from_package
from elasticai.creator.testing import eai_testbench
pytest_plugins = "elasticai.creator... |
c24d650ab41c40969cd5584f1ff1808dd2cd7a4038f69541a012fab0b80a7e00 | Python | 4,123 | 113 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import numpy as np
import random
import torch
from collections import OrderedDict
from joblib import load
import argparse
from setting import *
from utils import *
from loader import *
from evaluate ... |
ca38870364c46e9f9a952b98ba44e910c896d7f7afde221a4c1c6c294d8f81c9 | Python | 4,124 | 118 | 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... |
f01ec438b4ed47233875c91c0ea109ab00300ae7d68276f0cf34b790fb0fab2a | Python | 4,125 | 98 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File to preprocess input images into training dataset and generate a CNN model trained on images defined in the study.
Input:
1. Dataset/data/: Folder consisting of input RGB BP meter images
2. Dataset/labels.csv: File storing LCD numerical and quality ... |
5cc6215291a6c89db6121006409a28a99a52e3b4906b45a37dccbfcd03799dc7 | Python | 4,126 | 130 | """
Bonito Download
"""
import os
import re
from shutil import rmtree
from zipfile import ZipFile
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from bonito.util import __data__, __models__
from bonito.cli.convert import main as convert
from bonito.cli.convert import argparser as cargparser
impor... |
9089fc4949b46b0db9a4ad7d13811181e790f1836a09cd34007324395a1c4d23 | Python | 4,126 | 136 | # 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... |
ad0030d1e84ae3f61ab88f3c4ac2f4c9b8fbf76ee4a1d43c3dfe71bb958ef019 | Python | 4,126 | 143 | # -*- coding: utf-8 -*-
# @Author: Sadamori Kojaku
# @Date: 2023-06-08 16:38:19
# @Last Modified by: Sadamori Kojaku
# @Last Modified time: 2023-06-15 11:56:36
import networkx as nx
import numpy as np
from scipy import sparse
def to_trans_mat(mat):
"""
Computes the transition matrix of a given Markov chai... |
9a003e8bfe12272fa1cd591232152e19635a86123d3bb7bdf08b55ab6f1be0eb | Python | 4,127 | 123 | # -*- coding: utf-8 -*-
from typing import Iterable, Union
import torch
from supar.config import Config
from supar.models.dep.biaffine.parser import BiaffineDependencyParser
from supar.models.dep.vi.model import VIDependencyModel
from supar.utils.fn import ispunct
from supar.utils.logging import get_logger
from supar... |
666623c27c1944eead605564ff7b29f5535664a211ce147cca33e678492b795d | Python | 4,128 | 119 | #! /usr/bin/env python
import gc
import argparse
import numpy as np
def str2bool(v):
# susendberg's function
return v.lower() in ("yes", "true", "t", "1")
def count_line_num(sl_filepath, fheader=True):
count = 0
with open(sl_filepath, 'r') as rf:
if fheader:
next(rf)
for ... |
3f53ad9cbe19122081b0693355bc331f85e68f7186829963b8d769e033e248f8 | Python | 4,129 | 103 | """
Data preprocessing for Shomerosh/Clara mobile platform.
Loads raw data (Clients, Games, Medical sheets), filters test accounts and
invalid ages (< 18 or > 100), pivots medical questionnaire responses,
computes BMI, and produces a merged per-user dataset (merged_data.pkl).
"""
import pandas as pd
import numpy as n... |
9ba12af55ad0f88f44e8868c2517bae6ec078725ed99da30564e41a2036ddddf | Python | 4,129 | 60 | """LATERAL_STRENGTH.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29f-LATERAL-STRENGTH.md
Seki real receptor input -> AL cut-out with the laboratory prior, excitatory-LN output scaled by s -> fit to the real PNs.
usage: python LATERAL_STRENGTH.py [run|analyse] (workers: LS_WORKERS, default 4)"""
import ... |
5fc8bda152ecb3284342240fec49759ad520fcac08e215f03538aed337665381 | Python | 4,130 | 134 | import pytest
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
@pytest.mark.parametrize("total_bits, frac_bits", [(2, 2), (4, 3), (8, 4)])
def test_cut_float_to_integer_signed(total_bits: int, frac_bits: int) -> None:
config = FxpArithmetic(
FxpParams(total_bits=total_bits, frac_bits=fra... |
ea190e1fb50e53f62a26cbe1849ed1f2d0eff360fd7f8651641b735d201deb97 | Python | 4,130 | 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... |
17d06e6d0befea746d90073360dabcc67ffcb89c3d3ce3940e015881f9b5ae34 | Python | 4,131 | 108 | r"""Test OpenBabel executables from Python
Note: Python bindings not used
On Windows or Linux, you can run these tests at the commandline
in the build folder with:
"C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake
-R pytest -VV
You could also "chdir" into bu... |
bd2a01e2140707c0853376f718971f1b3428aa4453801699c86ed11e2f1b6a4b | Python | 4,131 | 62 | #python
import numpy as np
from nilearn.datasets import fetch_atlas_schaefer_2018
dataset = fetch_atlas_schaefer_2018(n_rois=400)
atlas_filename = dataset.maps
labels = dataset.labels
from nilearn.input_data import NiftiLabelsMasker
masker = NiftiLabelsMasker(labels_img=atlas_filename, standardize=True)
sub=['sub... |
3e6bb11dd4ae3be2278c42503b2a43345abde3e261b255da91a172d57fbb3fac | Python | 4,132 | 116 | import bct
import numpy as np
from utils import stats, cpl_func, make_dir, pickle_dump
from joblib import Parallel, delayed
from joblib.externals.loky import set_loky_pickler
set_loky_pickler('pickle')
import os
os.environ['OPENBLAS_NUM_THREADS'] = "1"
os.environ['MKL_NUM_THREADS'] = "1"
direc = os.path.abspath('..... |
a215635696bc5d9e1aee0e130a1699549295db2e4793f9ad31ec391cc59cfc5e | Python | 4,133 | 117 | # Node-group asset "Centroid" (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_CHECKING
from... |
bdff35130a26377c5ef46f2a449103d151aa362926450450a286cdb318b95ebb | Python | 4,133 | 124 | import contextlib
import hashlib
import logging
import os
from types import TracebackType
from typing import Dict, Generator, Optional, Set, Type, Union
from pip._internal.models.link import Link
from pip._internal.req.req_install import InstallRequirement
from pip._internal.utils.temp_dir import TempDirectory
logger... |
7fc34626b34b5103b279953a183e031e316b1487bf204b229ef7cd26dc64e915 | Python | 4,134 | 59 | """POSPISIL_PN_READOUT.py 2026-09-24. Pre-registration: 04-NOTES/PREREG-2026-09-24e-POSPISIL-PN-READOUT.md"""
import numpy as np, pandas as pd, scipy.sparse as sp
from scipy.sparse.linalg import eigs
R = 'D:/eucys'; L = []
def p(m=''): L.append(str(m)); print(m, flush=True)
E = pd.read_parquet(f'{R}/tmp/eff_edges.parqu... |
19f8bd17ae9d612641dd0ab72a0141db0c6e1f2378a8a97fb2a0853b346cbaf2 | Python | 4,135 | 129 | #!usr/bin/env python
"""Tune and evaluate TGAN models."""
import json
import os
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from tensorpack.utils import logger
from tgan.model import TUNABLE_VARIABLES, TGANModel
from tgan.research.evaluation imp... |
88cbb49b9c47e550eb77118589dec08ac5c45ac2a7b175f5b8556f92201b5922 | Python | 4,135 | 98 | import os
import cv2
import json
from tqdm import tqdm
from sklearn.model_selection import train_test_split
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--root_dir', default='coco128',type=str, help="root path of images and labels, include images and labels and classes.txt")
parser.add_argum... |
268c790d17215a3136aadf125140e276fb73a6a654ae00b060b0e859e4578016 | Python | 4,137 | 103 | import numpy as np
import nxsdk.api.n2a as nx
def create_compartment_prototype(compartmentVoltageTimeConstant, compartmentCurrentTimeConstant, vTh,
refractoryDelay=None, verbose=True,
**CompartmentPrototype_kwargs):
"""
Wrapper for nx.Compartme... |
81c808d1f39f830ff76130a5a5badafcc371c321322777945eb6a82c761be7d1 | Python | 4,137 | 88 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
90b76e25a0742e467e01d456a5fe31e7d57164096e74796b5b1289bc5e7ab296 | Python | 4,137 | 62 | import argparse
from m6atm.preprocess.m6atm import *
from m6atm.train.predict import *
from m6atm.train.run_model import *
__version__ = '1.0.0'
def main():
### main parser
parser = argparse.ArgumentParser(prog = 'm6atm', description = 'm6ATM v%s'%(__version__))
subparsers = parser.add_subparsers(hel... |
9d211a472caf60018000d2150701d5d03488b0eef10539cd451eb57ea5183189 | Python | 4,137 | 107 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-02-02
# Description :
#
#======================... |
90010fccf157d8aa032a39093f59db7f22331f81d56d00bc08436f6a14003947 | Python | 4,138 | 130 | # Parameters for evolution
from numpy import array, zeros, ones, cumsum
from copy import deepcopy
params = {}
# Number of subjects
params["num_subjects"] = 1
# Does or does not have D-wave (0-no, 1-yes)
params["D+"] = [1]
# Total number of waves (D-wave + I-waves)
params["measured_waves"] = 4
# Extra I-waves for fu... |
b4f981da180fc26663a63e4ecfe5772c704b095a3e63e890ff83aa274a5aa291 | Python | 4,138 | 132 | # Node group "Animate Collection Pick" (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 ... |
c00236ab3d6a5f2140d7c41f6d98e44348cec5b101ea3482d9c5e437ebadab75 | Python | 4,138 | 106 | #!/usr/bin/env python
# mypy: ignore-errors
import os
from datetime import datetime
from importlib.metadata import metadata
from scverse_doc.registry import intersphinx
info = metadata("pertpy")
project = info["Name"]
author = info["Author"]
copyright = f"{datetime.now():%Y}, {author}"
version = info["Version"]
urls... |
8b9648c1130ffd7310a4792068ec7bc18183214b8bc033abce7240b6bc838533 | Python | 4,139 | 98 | #!/usr/bin/env python
# Copyright (c) 2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Wrapper for autonomous agents required for tracking and checking of used sensors
"""
from __future__ import print_function
import ca... |
ab08e31e830c8e92e9771bffcde59d982a95797360fa6df039ce3de8430bc8ad | Python | 4,140 | 139 | """"""
import logging
import cv2
from pupil_recording_interface.decorators import process
from pupil_recording_interface.process import BaseProcess
from pupil_recording_interface.externals.methods import normalize
from pupil_recording_interface.externals.file_methods import PLData_Writer
logger = logging.getLogger(_... |
59973fc76a8481e0ec4812c019f03b34088d725813554a697ae06e238efce14b | Python | 4,141 | 103 | import data.ABIDEParser2 as Reader
import numpy as np
import torch
from utils.gcn_utils import preprocess_features
from sklearn.model_selection import StratifiedKFold
class dataloader():
def __init__(self):
self.pd_dict = {}
self.node_ftr_dim = 2000
self.num_classes = 2
def load_dat... |
d76ea5a32426a41f98797d97b580bf4e7e1c64ebd199bc0ac38e32bf69eb28b8 | Python | 4,141 | 130 | import os
import torch
import shutil
import numpy as np
from PIL import Image
from tqdm import tqdm
from urllib.request import urlretrieve
class OxfordPetDataset(torch.utils.data.Dataset):
def __init__(self, root, mode="train", transform=None):
assert mode in {"train", "valid", "test"}
self.roo... |
3395983c8a775c571a632985f3be3001d32b032183bd0b8dcc7c10a65c43115b | Python | 4,142 | 123 | from collections import defaultdict
from functools import lru_cache
from codex.utils.formatting import percentage, display
from codex import logger
# computes the set of nodes reachable in 1 hop from given sources
def neighbors(sources, neighbor_sets):
res = set()
for s in sources:
oset = neighbor_s... |
dfd72705155bfdd904cef7cb675b73a5f44545998bfa6ba06be0e20bb5278dd4 | Python | 4,142 | 136 | """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... |
ea19233c661f990ca3f63657673020dd837d37fdc0a8c7859c7729ae69756b6b | Python | 4,142 | 136 | import torch
class complex_utils(object):
@staticmethod
def isComplex(input):
return input.dtype == torch.complex64
# return input.size(-1) == 2
@staticmethod
def isReal(input):
return input.dtype == torch.float32
# return input.size(-1) != 2
@staticme... |
f904f6ad3dfb3c1ba1b4dcb570dba33867f5c48d0b95afcd31c348317bd6a293 | Python | 4,142 | 155 | # Node group "Constraint Distance" (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 rege... |
fe8f12d97e445cd9aeed4970c5e0fa8b6545388b3c96095fda4b61fee317dcdc | Python | 4,143 | 160 | # Node-group asset "Set Chi 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_CHECKING... |
7a1598acf3d9bc776fbdeeb8a0959596f03380feb4cecd03a85dd1afc281f1bb | Python | 4,144 | 124 | """
Regenerate `tests/data/1brs_AD_apbs.dx.gz`: the APBS electrostatic potential of one
barnase-barstar pair from PDB 1BRS (barnase chain A, barstar chain D).
APBS=/path/to/apbs uv run docs/dev/apbs_1brs.py [--dime 65 65 65] [--out FILE]
Steps: download 1BRS from RCSB, keep the protein atoms of chains A and D (ch... |
f856e72f4cc3ff8a10ad20fd4ce50df33542cf3ac535ffa56d4d3d7d43c58bc1 | Python | 4,144 | 149 | import sys
from nose.tools import *
from pyccg import chart
from pyccg import lexicon as lex
from pyccg import logic as log
from pyccg.model import Model
from pyccg.word_learner import *
def _make_mock_learner(**kwargs):
## Specify ontology.
types = log.TypeSystem(["object", "location", "boolean", "action"])
... |
14c97f617550dda4fa2a09128356a5bbac4d7b46b03c1127e697ea2290b38db5 | Python | 4,145 | 113 | # -*- coding: utf-8 -*-
"""
Created on May 4 2023
@author: Jonas A. Thiele
"""
### Plot relevant links (edges) identified via stepwise LRP during model training in main sample
import numpy as np
import pandas as pd
import scipy.io as spio
import matplotlib.pyplot as plt
from matplotlib import colors
... |
b530ed71ee02c159c08f0e9436fd8124538019c88fd0fd6225bf00288e847e8f | Python | 4,145 | 130 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 9 15:20:41 2021
@author: Engi
"""
from autoreject import AutoReject
import mne
import evoked.evoked_constants as ev_cs
import numpy as np
import base.files_in_out as in_out
import feather
class AutoHelp():
def __init__(self,files):
self.files=... |
3315eeaffec4753736ba3acda4a2bf2bfb36373db967e98b70a9391484cee4ef | Python | 4,146 | 137 | import re
from collections.abc import Callable
from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.vhdl.shared_designs.rom.design import Rom
def extract_rom_values(text: str | list[str]) -> tuple[str, ...]:
if not i... |
7600d6d8d0b9cd7918252c1f8094c5f1773fd585256381d571ba7ba116fa1ce7 | Python | 4,146 | 136 | import os
import fsspec
import numpy as np
import pandas as pd
import pytest
import scipy.sparse
from cirrocumulus.parquet_dataset import ParquetDataset
from cirrocumulus.prepare_data import PrepareData
from cirrocumulus.zarr_dataset import ZarrDataset
def read_and_diff(
ds_reader, path, test_data, measures, di... |
de2cc0ed7aded5bfa5c395e76543c069f5e144dcb6a86031b2777daa637e2f00 | Python | 4,146 | 149 | # -*- coding: utf-8 -*-
"""Numerical tests for virials and energy conservation of potentials"""
import tempfile
import pytest
import numpy as np
import tensorflow as tf
from pinn.io import sparse_batch
from shutil import rmtree
import yaml
from pinn.io import load_qm7b
from pinn.models import pol_models
import pinn
imp... |
18ffdc2e2378e4d314feff482e07eb4850a080c8ef4cc60f09d0ebc73d7133fa | Python | 4,148 | 98 | """ANTs registration "effort" presets and the merge/validation helper.
This module owns the coarse effort knob (fast / default / thorough) and the
precedence logic that combines a named preset with the user's explicit advanced
overrides into a kwargs dict for ants.registration().
Grounding (antspyx 0.6.3 per-tr... |
93226211ab523cbeda42e5bb953d71077394bb1fdb979aae0d970b38d34eb83e | Python | 4,148 | 97 | import argparse
import numpy as np
import torch
import random
from real_utils import *
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, default=0.001,
help='Initial learning rate.')
parser.add_argument('--weight_decay', type=float, default=1e-5,
help='W... |
c2698bc0afdb480d4579dd874dee3a361691dfe18028e4c8fb7c190e5ec58b91 | Python | 4,149 | 64 |
from datetime import datetime
import pandas as pd
import os
import glob
sample = snakemake.wildcards.sample
folder = snakemake.wildcards.folder
date = datetime.now().date()
genes_file = snakemake.input.genes_list
genes_file_name = genes_file.split('/')[-1][:-4]
sys.stdout = open(snakemake.log.log, 'w')
... |
e46e627c475f3aaca3d1ca494d6d9b4d71215922ba61b1499facb19438d1f3bd | Python | 4,150 | 124 | """Tests for regtools.cellpose_sam.measurements (pure, no cellpose/Qt)."""
import numpy as np
import pandas as pd
import pytest
import tifffile
from regtools.cellpose_sam.measurements import resolve_pixel_size_um, add_physical_units, compute_summary
def test_cli_value_wins_and_reports_user_source():
... |
1541d7764b229dd6b8726d6baf9458160a4db0b107c1eb057ccc1e9d1efb2a5e | Python | 4,151 | 80 | import os
from copy import copy
from typing import Union
import numpy as np
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
def train_test_split(dataset: BaseDataset,
test_size: float = 0.2,
shuffle: bool ... |
82fa02593ff06e02bc437dca964da4c86866a4e9d6e3ddfcd189f834288a0e6c | Python | 4,151 | 81 | import numpy as np
import matplotlib.pyplot as plt
import tqdm
import glob
import scipy.io as sio
import h5py
import networkx as nx
from itertools import combinations
from scipy.stats import pearsonr,zscore
import copy
from scipy.io import loadmat
if __name__ == "__main__":
orientation='RL'
path_HCP_data='/h... |
728391135ceddfa9f16e13edcb087374443ed7baee5640d55c0b86e85199487e | Python | 4,152 | 117 | # Node-group asset "Sample Mixed Rotation" (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_... |
f24032b992d20b2108810afabdb5307e1a6a83da30b3898cd0857a0d66b37af2 | Python | 4,154 | 139 | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import calendar
import time
from email.utils import formatdate, parsedate, parsedate_tz
from datetime import datetime, timedelta
TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
def expire_after(delta, date=None):
date = date or datetime... |
a3a41c62de7c2d00521fa267b2a0f362345dadad1444a56b3126a2f492f51ff3 | Python | 4,155 | 83 | # example usage:
# python cross_val_experiment.py --experiment-dir-parent=/home/jupyter/behavior_benchmarks_experiments --experiment-name=harnet_turtles --dataset-dir=/home/jupyter/behavior_data_local/jeantet_turtles/ --model=harnet --resume
import os
import yaml
import numpy as np
import argparse
from plumbum import ... |
936814e863ea228f9d6930e2dd5bc0b93e7796e23953135289e7aa3dcf4f4c59 | Python | 4,156 | 122 | from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.identity.layer import BufferedIdentity
from elasticai.creator.nn.sequential.layer import Sequential
class TestSequential:
def test_empty_sequential_passes_throu... |
a50b752d5082f3ff5eeef2f65648453e55e0cf450f9e716fae8b8e3cba967dab | Python | 4,156 | 123 | import re
from collections.abc import Iterable, Iterator, Mapping
from dataclasses import dataclass
from itertools import repeat
from string import Template as StringTemplate
from typing import Protocol, cast
from .resource_utils import read_text
def module_to_package(module: str) -> str:
return ".".join(module.... |
72fb89b79f7680dec6e5cf564801da544fac7c07e83bc8251a2f699e23b39a54 | Python | 4,159 | 118 | import subprocess
from .config import paths
import logging
import os.path as osp
import os
import nibabel.freesurfer as nbfs
import scipy.ndimage as scimage
from skimage import measure
import numpy as np
log = logging.getLogger('submission')
def mri_fill(pial_file,filled_file):
subprocess.call([osp.join(paths.fr... |
45360aeb7990c010ae3b28e8e674f964a2055582452b737201e68ad62fd8815c | Python | 4,160 | 122 | import sys
import os
# Get the current script directory
current_script_directory = os.path.dirname(os.path.realpath(__file__))
# Get the root directory of your repository
root_directory = os.path.abspath(os.path.join(current_script_directory, os.pardir, os.pardir))
# Add the root directory to sys.path
sys.path.appen... |
c3842dc647ac6ae3057d29bca52b463642aac288bb26da93dd507e5c10d0be49 | Python | 4,160 | 114 | # 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... |
ca5fa1ca3dc8c70ee4aedc86385d3d02e829be1c5f98862e6223bf760ec25e56 | Python | 4,160 | 106 | """Fine-angle rotation in the counting path.
The cellpose orientation now supports arbitrary angles (not just 90° steps) via
the shared rotate_image, so the counting frame can match a registration angle
like 267°. These tests cover the detector's load_image and the dialog wiring.
"""
import os
import sys
i... |
d71cf78735026fe254a94cb12a67097ce06be0d17240a7ad52fb92236784e4f0 | Python | 4,160 | 108 | from BehavPLS_opt import BehavPLS
# from plot import *
from compute_opt import *
from configparser import ConfigParser
from argparse import ArgumentParser
import numpy as np
import pickle
import typer
from scipy.io import loadmat
import random
app = typer.Typer()
import yaml
@app.command()
def set_default_paramete... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.