sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1246044abca0bac2aa966f8c327fdc13f4b711c995e10018cb123e7252f2659c | Python | 2,059 | 69 | import torch
import torch.nn as nn
import gc
class MetaModel(nn.Module):
"""
Class to differentiate meta-models from simple-models.
"""
def __init__(self):
super().__init__()
class SimpleModel(nn.Module):
"""
Class to differentiate meta-models from simple-models.
"""
def __ini... |
5fdeeaad5189000fa685ac3b51c0176745a0da32247442e9db75c42edbebcc71 | Python | 2,059 | 62 | # -*- coding: utf-8 -*-
import numpy as np
class Population:
"""A Population is a measure over the cells at given timepoint.
Parameters
----------
time : int or float
The time at which the cells where measured.
p : 1-D array-like
Measure over the cells at the given timepoint.
... |
16f98cfccd58c15c0bce1df42a27c284f84bbbd2308e33cc522e458e53b6f964 | Python | 2,060 | 61 | """Plotting for manuscript figures
----------------------------------
This script needs to be executed after `ms_figures_simulations.py`.
"""
import os
from mesocircuit import mesocircuit_framework as mesoframe
from mesocircuit.plotting import ms_figures as figures
##################################################... |
983b04335b4eef7d1fb0614f8cf88d3ea74df50bc840a080def347cb491fcc3d | Python | 2,060 | 49 | from learn_tools.collect_simulation import start_task
import argparse
import os
from pybullet_tools.utils import read_pickle
from pddlstream.utils import get_python_version
from learn_tools.retired.run_sample import evaluate_samples, sample_task_with_seed
from learn_tools.learnable_skill import load_data
from learn_to... |
b2cd6dab0040ab950d83b50dd6d65eb8cfb0378119fad8543e1ab69051a64708 | Python | 2,060 | 60 | # coding=utf-8
# Copyright 2018 The Microsoft Research Asia LayoutLM Team 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
#
# Unles... |
f2ee1736fe2c211aa753a33cb39d8a55ecf15dd4970330aa8655024462be08ff | Python | 2,060 | 63 | import torch
from gem_cnn.nn.gem_res_net_block import GemResNetBlock
import torch.nn as nn
from torch.nn import Sequential
import torch.nn.functional as F
class GEMCNN(torch.nn.Module):
def __init__(self, nverts, nlayers, channels=16, convs=3, n_rings=2, max_order=2, len_features=32):
"""
GEM-CNN N... |
f347be0ba2cee01c43c72b505f6c18e0c2623dd0ebe155be14ca3077a55fa429 | Python | 2,060 | 71 | # encoding: utf8
from __future__ import unicode_literals
from __future__ import print_function
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs':[np.get_include()]}, inplace=True)
import GaussianProcess
import matplotlib.pyplot as plt
class GPMD:
def __init__(self, dim):
... |
16f2c3e2577c6d8e15e38d2bbd13a80548367e8c52380e4afda2baef3c952eee | Python | 2,061 | 74 | import unittest
import numpy as np
import neurolib.utils.functions as func
from neurolib.models.aln import ALNModel
from neurolib.utils.loadData import Dataset
class TestFunctions(unittest.TestCase):
"""
Test functions in neurolib/utils/functions.py
"""
@classmethod
def setUpClass(cls):
... |
cc96067d1855f3185ca5435a87b3901eaf03eedb6614bd36652e9b6cfad23794 | Python | 2,061 | 45 | # 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... |
d0199f3094b5ea055dec35a4441a6ffb2b2ff0c808d9255ff6b2c65f051ad372 | Python | 2,061 | 72 | # 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... |
45056599f7d01855944deeb462bce5d28bfd04c34e5fad8eb06d6766700be876 | Python | 2,062 | 76 | # Node-group asset "Secondary Structure" (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... |
c39a190615dbc0f7b8e4c1499fa810b72c32e17b76a25841d6e4b3bc2029881c | Python | 2,062 | 61 | #!/usr/bin/env python
# Purpose: Find avg. DVARS value for each session and for each participant overall.
#
# Input: Single-column txt file DVARS for each bold image. These were generated using the CBIG2016 preproc pipeline.
# Output: Avg. DVARS value for each participant's session an deach participant overall.
#
# Wr... |
82f2aaaaea59fe0da3aadcef1201726538b3f438b17b3ea9614cdbe6d5e5cb7a | Python | 2,063 | 61 | #!/usr/bin/env python
# Purpose: Find avg. DVARS value for each session and for each participant overall.
#
# Input: Single-column txt file DVARS for each bold image. These were generated using the CBIG2016 preproc pipeline.
# Output: Avg. DVARS value for each participant's session an deach participant overall.
#
# Wr... |
b14fc971ef018f48027614e72198534654f048270f8c5f3af1c9a9f1500b6434 | Python | 2,063 | 50 | import os
import shutil
from tqdm import tqdm
def move_files_with_substring(source_folder, target_folder, substring):
"""
Move files from source_folder to target_folder that contain the substring in their filenames.
Args:
- source_folder (str): The path to the source directory.
- target_folder... |
ea9276ce087cc9405abce33c09b85ed36e864c9859144b648e640640f3e1018a | Python | 2,063 | 59 | """
Optuna example that optimizes a classifier configuration for cancer dataset using LightGBM.
In this example, we optimize the validation accuracy of cancer detection using LightGBM.
We optimize both the choice of booster model and their hyperparameters.
"""
import numpy as np
import optuna
import lightgbm as lgb... |
61b5a6781f29f3cdab6f5931a50f51ff85a291e5632b0d66a49f65559e1325df | Python | 2,064 | 58 | # 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... |
c6c6b2eac8b0ec85abc0de1dd7a745760e4b3db04036c4937b3fa00dd2065af7 | Python | 2,064 | 27 | """POST HOC (not pre-registered), 30 Sept 2026: why does right-side sugar reach il3LN6 and left-side sugar not?
Direct and two-step synapse counts from left and right LB3 onto the left il3LN6 and onto the other antennal-lobe local
neurons (Shiu et al.'s file). output: 06-OUTPUT/posthoc_door_anatomy.txt"""
import sys,... |
1f43c2b087c27176ade363699b3588becf3b5e3bace31585ad048938edbcb958 | Python | 2,065 | 87 | import sys, re
from optparse import OptionParser
import time
import os
import getopt
import numpy as np
from scipy import stats
data = []
def save_data(filename, column1):
with open(filename, 'w') as f:
for a in column1:
for b in a:
f.write(str(b)+ "\t" )
f.write("\n" )
... |
41705ce7a691b6c44e5bd6a96a51eae5ea8bd84da87b653a4073b5652879ca39 | Python | 2,065 | 61 | #!/usr/bin/env python
# Purpose: Find avg. DVARS value for each session and for each participant overall.
#
# Input: Single-column txt file DVARS for each bold image. These were generated using the CBIG2016 preproc pipeline.
# Output: Avg. DVARS value for each participant's session an deach participant overall.
#
# Wr... |
5c69ee11e2d9ce638c5592bd24d4612dcb4309377211703088e00132ae41427b | Python | 2,065 | 73 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at you... |
f22600666c526753c77a9cd82037996d4c1d4b0625dd424f8fd7cea417aae19e | Python | 2,065 | 65 | # 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... |
8d71d500f1b2f2e75a60a6f95b158f47df07bf5c02bae11faf96e169942f9eff | Python | 2,066 | 57 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design, Port
from elast... |
a6149e867943f429a552fe9b88d9e93128b9ef935d9353a35b9af1aa5df74184 | Python | 2,066 | 93 | import torch
import torch.nn as nn
from modeling import TiedLinear, TiedEmbedding
def test_TiedLinear_type():
f = nn.Linear(20,10)
g = TiedLinear(f)
assert isinstance(f, nn.Linear)
assert isinstance(g, nn.Linear)
def test_TiedLinear_shapes():
orig = nn.Linear(20,10)
tied = TiedLinear(orig)
... |
ce90c30a6389b297e411e91438def053400114d5bed2e5d4669ce91d16147622 | Python | 2,066 | 57 | from distutils import log, dir_util
import os
from setuptools import Command
from setuptools import namespaces
from setuptools.archive_util import unpack_archive
from .._path import ensure_directory
class install_egg_info(namespaces.Installer, Command):
"""Install an .egg-info directory for the package"""
d... |
00757b17036a93b8cb4c77fc475bca08852124ce520fb825f28e47472875f2c1 | Python | 2,067 | 46 | from rdkit import Chem
from Bio.PDB import PDBParser, MMCIFParser
import numpy as np
from scipy.spatial.distance import cdist
# based on TCS score in AlphaFill.
def compute_clash_score(dis, base_vdw_dis, neighbor_mask=None, clash_thr=4):
mask = dis < clash_thr
if neighbor_mask is not None:
mask = mask &... |
a00f5431096c0227a24ae63789e6377e2b91b714963324532bee45fba29a7994 | Python | 2,067 | 72 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotRepor... |
72faffdaff0145bc5c225e71e6575fa9d1e3848f188bcb3cca4e741bf9e6ea34 | Python | 2,068 | 73 | from itertools import filterfalse
def unique_everseen(iterable, key=None):
"List unique elements, preserving order. Remember all elements ever seen."
# unique_everseen('AAAABBBCCDAABBB') --> A B C D
# unique_everseen('ABBCcAD', str.lower) --> A B C D
seen = set()
seen_add = seen.add
if key is ... |
b7fe51d3c53a9a292d2731df38b34ac8bc80ff4e23be391280971c2078963669 | Python | 2,068 | 46 | """
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.0
"""
import wx
from deeplabcut.gui.welcome import Welcome
... |
d385d1da1e0541b1b3ce2e8986e650b123d3257f417ed9b7cf17f24a34753208 | Python | 2,068 | 53 | import argparse
import glob
import os
from plantsegtools.utils.edit import crop_image
from plantsegtools.utils.io import smart_load, create_h5, create_tiff
def parse():
parser = argparse.ArgumentParser()
parser.add_argument("--path", type=str, required=True, help='path to segmentation file')
parser.add_a... |
07a8e6cb29fbd976dc9ba1c75c20ab61a35c4eabde083e2b3088386a56e8201e | Python | 2,069 | 54 | #!/bin/env python3
'''
Define a Feynman diagram
'''
import pdlfeynman as fy
import yaml
diagram = fy.diagram.Diagram()
x = 1
n00 = fy.diagram.Node.Reaction(time=x, reaction=fy.particle.growth.pair_production)
diagram.add_node(n00, x=x, y=0)
x += 1
n10 = fy.diagram.Node.Reaction(time=x, reaction=fy.reaction.growth_de... |
87a934e17054d50d15d3d74f68dc55805c4228a7e98dd94d2042ef2b2c8228ac | Python | 2,069 | 51 | #!/usr/bin/env python
import os
import pandas as pd
## location of main project directory on HPC
proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie/'
## location of R output files to visualize
r_path = os.path.join(proj_path, 'Scripts', 'MovVar_CommsBio_Revision01', 'control_ISRSA','r_output_movie_random')
##... |
bd0ae64589374e21547fbe6be7bdfc5d4ce139f0626ad475f397ab6255837f83 | Python | 2,069 | 58 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
f0b50584c32a6adb7d2ef03867dffc493f913f14d8b473fc1f65184a39ae8deb | Python | 2,069 | 44 | """
FEATHER_PASS_B.py - second pass. Extracts the synapse coordinates + argmax label
for a selected set of presynaptic segments, for the N-4 spatial test.
Selection: DIRTY (modal agreement <0.70) and CLEAN (>0.90) segments, n in [150,4000].
Output: 06-OUTPUT/pass_b_selected_synapses.parquet
"""
import pyarrow as pa, py... |
9f960fe9b77cda11739dd8ad7e448a57ed17a2655e12ec329437956ae0d6e317 | Python | 2,070 | 59 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design, Port
class Ha... |
2403d9f0130fa96495817c5678fb8fd19d242bfb14b4e7fbc12c0ab398c1195c | Python | 2,072 | 75 | """"""
import logging
from concurrent.futures import Future
from pupil_recording_interface.process import BaseProcess
logger = logging.getLogger(__name__)
class Pipeline:
""" Pipeline for different processing steps. """
def __init__(self, steps, context=None):
""" Constructor.
Parameters
... |
761bfac2a04bc22d31a38ed045983315649f15151e3009a144da4101a8d93ece | Python | 2,072 | 69 | import os, h5py, cv2
import numpy as np
train_path = './cell-dataset/train/'
test_path = './cell-dataset/test/'
train_type_list = os.listdir(train_path)
train_type_list.sort()
test_type_list = os.listdir(test_path)
test_type_list.sort()
print(train_type_list)
# shape =
train_data = []
test_data = []
for train_typ... |
76b02c5c90c05197ed19d12cc507389d8eee743cc9828cf895bd5200b4b2108c | Python | 2,072 | 77 | import tvm
from tvm import relay
from tvm.contrib import graph_executor
from tvm.contrib.download import download_testdata
import numpy as np
import torch
import os
from utils import *
# prepare a pretrained model.
VGG16 = torch.load("/mnt/e/godev/inftychain/rolluppy/VGG16_Cifar10.pth")
print(VGG16)
print(VGG16.feat... |
83e551807ea9644f655866e7009e3c91d7ef5fbed0c04cb9dbbb99d90011c37b | Python | 2,072 | 58 | from requests import exceptions
import argparse
import requests
import cv2
import os
ap = argparse.ArgumentParser()
ap.add_argument("-q", "--query", required=True,
help="search query to search Bing Image API for")
ap.add_argument("-o", "--output", required=True,
help="path to output directory of images")
args = vars(... |
a60396be4ce946d67d8ff5c478b0fa5225b1b40ad811a2de1d306406c814110b | Python | 2,072 | 59 | """Grouped metadata cards for the registration report. Stdlib only; never raises."""
from regtools.registration.report.assets import _esc
from regtools.registration.report.metrics import _metadata_rows
# group title -> key/prefix matchers (first match wins; order defines display order)
_METADATA_GROUPS = (
... |
aa5da7c217cb9a52f5859db09471322d6704f31e890e9ea3599686c9ebb1d202 | Python | 2,072 | 77 | """Core recipes for Psi4."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import job
from quacc.recipes.psi4._base import run_and_summarize
has_psi4 = bool(find_spec("psi4"))
if TYPE_CHECKING:
from ase.atoms ... |
51060e379e5f075777c0901a7442ddb0d4813ea4d6788c2b167bf74f4c3e4b0e | Python | 2,073 | 65 | # -*- coding: utf-8 -*-
from __future__ import print_function
"""Make subprocess calls with time and memory limits."""
from . import limits
from . import util
import logging
import subprocess
import sys
def print_call_settings(nick, cmd, stdin, time_limit, memory_limit):
if stdin is not None:
stdin = ... |
741ed737c48a7b42f0155084887cf86b49788f98598414aa971cddc62ab1324c | Python | 2,073 | 74 | # Node group ".Check End Face Corner" (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 r... |
149a056fb5ffc8c4994e4988622c511c31d78aa1ffb235e9986147e9193edefb | Python | 2,074 | 84 | # Node-group asset "Is Even" (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 ... |
47b30e3d6e7fb962311c4454620ff19ab18beb2b454c33cf6eb56fc5e95eca7f | Python | 2,074 | 78 | # -*- coding: utf-8 -*-
from pinn.io.base import list_loader
def _ase_spec(atoms):
"""Guess dataset format from an ASE atoms"""
ds_spec = {
'elems': {'dtype': 'int32', 'shape': [None]},
'coord': {'dtype': 'float', 'shape': [None, 3]}}
if atoms.pbc.any():
ds_spec['cell'] = {'dtyp... |
6f7873b262c1e122d0e25ba0785ecd3c0e0329f2902f5e866945f9737819d02d | Python | 2,074 | 78 | # Node-group asset "Mass" (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 bpy... |
72ae7e4e44e370dd28b8fea0865375a8a76495dc7596e13405e7e21a9b32a59a | Python | 2,074 | 73 | #!/usr/bin/env python3.9
# train an AI model, track runtime for epochs and save the best models (loss/accuracy)
from ownutil import ParseArgs, PrepareData
# read command line arguments (data set, epoch number, train/validation size)
args = ParseArgs()
#model specific wired setup
args.modelnum = 3 # model 3
arg... |
bfd118705015d9f29d3d520bb112a043aac993e5d641d4b43c70716f5e06e4d0 | Python | 2,074 | 58 | """Run parameter space
---------------------
This example script shows how to iterate over parameter ranges and generate
comparison plots.
"""
###############################################################################
# Import parameters, the Python module used here to define parameter ranges.
from mesocircuit ... |
f61f1d7a10c1988d46be2061b355d31bd4d93d7ead0d1fb7f93c567f5eda2114 | Python | 2,074 | 65 | """Computes and saves adjacency/distance/coulomb matrices for a dataset."""
import time
from tap import Tap
from chemprop.atomic_matrices import mol2matrix
from chemprop.features import save_features
from chemprop.data import get_smiles
from chemprop.utils import makedirs
class Args(Tap):
data_path: str # Path... |
fc6f915d673f657532325be6171bbbeeaf73f387e6086d84e8816a3f63833ad5 | Python | 2,074 | 23 | """posthoc_crash_spiking_2026-10-01.py (POST HOC except part 1, which PREREG-2026-10-01f planned but CRASH_TEST.py did not run)
1. T3: spiking check at the true k* of the median fresh order (N00, k* = 34 = median).
2. BANC (post hoc): spiking for the 5 size-matched control candidates of CRASH_BANC K3, which only had th... |
155e0033cc9fbe663f906e61c8cb641193ea8df112558efb0431dad37cefd7a2 | Python | 2,075 | 51 | # 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... |
275ebd5a22cabe0fe595f2b4f127b36870b87aeeece7262836816903ee2ff0a0 | Python | 2,075 | 55 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMAR... |
573f00cd7260d5821213741d5834c6b0b80f9abf6198f7e2e4c89c5b512c470b | Python | 2,075 | 45 | import os
import sys
import time
datadir = sys.argv[1] # should point to the directory where the fast5 & reds dir exist
model_name = 'uncalled'
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
filtered_bonito_script_path = "../targetcall/run_bonito_params.py "
# ... |
67184b25de304e3101db7dea677953867d8b5d6d923333c5432562aea5a824cf | Python | 2,075 | 42 | """EXPERIMENTAL example: steering gated by how active the reservoir is.
centered = original readout/decoder output, mean removed (inherited)
gate = tanh(gate_gain * RMS(reservoir state)) in [0, 1)
delta = strength * gate * RMS(h) * centered / max(RMS(centered), floor)
Copy this file, r... |
4b35eaaed92c987021f184bf4a23783a48e55745955d2d356051df68284f5fd2 | Python | 2,076 | 77 | import os
import pandas as pd
from calvados.cfg import Config, Job, Components
import subprocess
import numpy as np
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--name',nargs='?',required=True,type=str)
args = parser.parse_args()
cwd = os.getcwd()
sysname = f'{args.name:s}'
# se... |
a87fe5ba6f290938a55f01b2fd888b516796ab0882153f89df2c32bec3c5b31a | Python | 2,077 | 68 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DI... |
07eb6bb84d61d746d8c60c5f63137c1b32e07fb2289e75cb642866074232ebe8 | Python | 2,078 | 76 | import math
import numpy as np; #import tensorflow as tf
import matplotlib.pyplot as plt
from tqdm import tqdm
import sys
import seaborn as sns
import pandas as pd
import torch
from scipy.io import loadmat
import pickle
def normalise(data, axis):
"""normalise data by the axes"""
minimum= data.min(axis=axis, k... |
dcd04097d36b1f8e30bec360b848fa50e15019ba953228bc91af3c785bba16d8 | Python | 2,078 | 85 | """
.. _streaming_example:
Stream from connected devices
=============================
This example shows how to stream video data from a connected Pupil Core
headset.
.. note::
This example requires the dependencies for
:ref:`streaming<streaming_dependencies>`.
"""
import sys
import logging
import pupil_... |
e9a592275781a5b3e594d5831b69c6211b15e8c25a27b74dcb7c027efb438479 | Python | 2,078 | 61 | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import logging
import os
import sys
import tensorflow as tf
import matplotlib.pylab as plt
from tensorflow.keras import layers
from tensorflow.keras import models
import numpy as np
import PIL.Image as Image
import glob
... |
7460c57573d9b0d5c379f58c4c3041e80c3a1cab6ae3f7f7d717660a6538ecd5 | Python | 2,079 | 69 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import configs, suites
from downward.reports.scatter import ScatterPlotReport
# Cactus plots are experimental in lab, and require some changes to
# classes in lab, so we cannot add them es external files here.
try:
from downward.reports.cactus import Cac... |
c9e2b3553aa7401c5c674ce96f0e161315867e063d84b7f5004339ab2a01b26d | Python | 2,079 | 80 | import numpy as np
import pandas as pd
from rdkit import Chem
import itertools
import networkx as nx
from . import mol_tree as mt
# Obtaining the list of vocabulary for a data set
def Vocabulary(data):
cset=set()
for m in data:
mol=mt.MolTree(m)
for c in mol.nodes:
cset.add(c.smi... |
d681c361dae0a665aea9d4fcfd9c4d986316922ad3764cca9f7d6c69c78e1104 | Python | 2,079 | 70 | #!/usr/bin/env python3
# A script that plots Chi-1 vs CHi2 scatterplot
from sys import argv, stderr
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcl
from matplotlib.patches import Ellipse
COLUMN_RES = 0 # Residue number
COLUMN_CHN = 2 # Chain id
COLUMN_PHI = 3 ... |
0a0a70d6d3eaa64a64f062aab0c44af58abd0d48e5893fd36611ffb2448ed1e1 | Python | 2,080 | 73 | # version:1.0.1905.9051
import gxipy as gx
from PIL import Image
def main():
# print the demo information
print("")
print("-------------------------------------------------------------")
print("Sample to show how to acquire mono image continuously and show acquired image.")
print("------... |
223ef9c33b86f8407b063c1ecd2dcf203c59394f2d4d0b9392333824bbf26ddf | Python | 2,080 | 61 | # 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... |
33463cca1b26660681db78f2e6eadcc161622a98cc0e89c7a85f9846db96049b | Python | 2,080 | 67 | """Testing CLI command measure."""
import subprocess
import os
def test_measure():
"""Tests for morphometric mesurements."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'measure', 'pass_simple_branch.swc'],
stdout=subprocess.PIPE,
... |
da3b3602c49f19630ea1f4995bd88decb4b3b0570c7e7b976a05e1e5148a5765 | Python | 2,080 | 54 | import pytest
import torch
from elasticai.creator.nn.integer.quant_utils.calculate_quant_params import (
calculate_asymmetric_quant_params,
)
from elasticai.creator.nn.integer.quant_utils.Observers import GlobalMinMaxObserver
from elasticai.creator.nn.integer.quant_utils.QParams import AsymmetricSignedQParams
from... |
eeb651415cd4d8df0d52600bd341980710d1f00833c5dcfcca58c60cd06d6310 | Python | 2,080 | 60 | # 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... |
75c47c762ee7a4940061379f8329b6ce892d4dd3fe4d9198770126353821d2da | Python | 2,082 | 52 | # Copyright (c) 2021, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
012c05030277b87d76053d7ca72117a0b7193904c48137e6ac35b55694bd217d | Python | 2,083 | 81 | from itertools import starmap
import pytest
from elasticai.creator_plugins.lutron_filter import (
binarize_activations as replace_prelu_with_binarize,
)
from elasticai.creator.ir import attribute
from elasticai.creator.ir.datagraph import Node
from elasticai.creator.ir.datagraph_impl import DefaultIrFactory as Ir... |
192b56acaf440d900e06db32410ea75044e6aaf521de55de2db1cb7ab9e0afe9 | Python | 2,083 | 63 | """
this script allows you to run multiple experiments sequentially
it reads all *.yaml files from the directory config/ and trains the model with each
it ignores config_example.yaml
the run name of the individual runs will be the concatenation of the
runname specified as command line argument and the name of the confi... |
f91da2a5478c88c9c39ca453c11675dc21249d9e3615d5adc03a45a62c7524c7 | Python | 2,083 | 65 | #!/bin/usr/python3
# Use example: python run_transforms_on_masks.py output_highresnet_train1 output_highresnet_train1_transformed
## Import libraries
import os
import shutil
import tempfile
from glob import glob
import argparse
import numpy as np
import pandas as pd
import torch
import torchio as tio
from monai.dat... |
f3e69bdf0c110626a9c834d64689518ac645d8b059948c4a55b20a756f7794f1 | Python | 2,085 | 87 | from dreamcoder.program import *
from dreamcoder.domains.text.makeTextTasks import delimiters
def _isUpper(x): return x.isupper()
def _increment(x): return x + 1
def _decrement(x): return x - 1
def _lower(x): return x.lower()
def _upper(x): return x.upper()
def _capitalize(x): return x.capitalize()
def _app... |
81a0bafb84ccb6758f4d99efc02380e39b5c9d97975e23da08991f6783d7eacd | Python | 2,086 | 74 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from HDPGPHSMM_segmentaion import GPSegmentation
import time
import matplotlib.pyplot as plt
import os
import glob
def learn( savedir, dim, gamma, eta, initial_class, avelen, maxlen, minlen, skiplen ):
gpsegm = GP... |
91a2d203101a1be5f5a1a26286daf7b4bcc82c1a80c2f3b0919076463c2334c4 | Python | 2,086 | 53 | from Util.SimpleViTModel import Model
from torch import optim
from torch.utils.data import DataLoader
import scipy.stats
from Util.Utils import *
from Util.sam import SAM
torch.backends.cudnn.deterministic = True
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
if __name__ == '__mai... |
a3f114bfe214303bca770ca5ebe101c4051c62108578392bc2871d255af2a1f4 | Python | 2,086 | 67 | import unittest
import torch
from torch_geometric.data import Batch, Data
from torcheeg.datasets.constants import DEAP_GENERAL_REGION_LIST
from torcheeg.models import DGCNN, LGGNet, GIN, RGNN
class TestGNN(unittest.TestCase):
def test_dgcnn(self):
eeg = torch.randn(1, 62, 200)
model = DGCNN(in_... |
2a6c8f697abda2981a7a21c762ca0c9c07e76fca35875199dc2c9a87659a7118 | Python | 2,087 | 62 | # 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... |
8a5c5fc76d6dc97bf35dea85f0010bc31b4f49ce8ce8a45a66348ef617c0214a | Python | 2,087 | 80 | #!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides a simple watchdog timer to detect timeouts
It is for example used in the ScenarioManager
"""
from __future__ impo... |
56b0bae431292016b99c04f9786310c0d051b4b6aba86eabcbc9c9c55276c501 | Python | 2,088 | 66 | # 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... |
87eebc3200bd2981522c6cea95e5a9e1f56a2297057b3ff6bdc2c548274f2a37 | Python | 2,088 | 67 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, arithmetic_mean, geometric_mean
import common_setup
from common_setup import IssueConfig, IssueExperiment
from rel... |
2c12d5b7a727b7d7029ec4479597f9e2d5170d303eed3b9a01c1d178f39fb183 | Python | 2,089 | 62 | """
Optuna example that optimizes a classifier configuration for cancer dataset using
Catboost.
In this example, we optimize the validation accuracy of cancer detection using
Catboost. We optimize both the choice of booster model and their hyperparameters.
"""
import numpy as np
import optuna
import catboost as cb
... |
6df129ecde01f897b94f57f026953f0ee35d66096fbcc3d38f104cc82b2998f3 | Python | 2,090 | 59 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/DryBean_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float(config... |
a11b90cec3566bf6555340cf34d73edea144cb315a5da0dc6add5d3e8b1667f4 | Python | 2,091 | 72 | from time import perf_counter
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.nn.functional import pad as torch_pad
import torch_tensorrt
from scipy.signal import find_peaks
from src.model import ModelSpikeSorter
from src import utils
# test = torch.rand((1020, 120), dtype=torch.float16, dev... |
2dde3ee950c1a58f18a4c5dec51c77e670a6bf486bf83794326ce9880ec64ee8 | Python | 2,093 | 80 | import jax.numpy as jnp
from hippo import get_store_path, get_data_path
from hippo import save_config
from hippo import load_config, get_recents_path
from hippo.data import load_data
from pathlib import Path
import pickle
import logging
from hippo.models.hmm import HMM
logger = logging.getLogger(__name__)
def pri... |
a6580e841ec79ca756344bd6eee203962fa9412cb6a987bafa7869563895230e | Python | 2,093 | 79 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 20 13:55:27 2025
@author: juanpablomayaarteaga
"""
from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import numpy as np
BBox = Tuple[int, int, i... |
b56ae3d53745dff1df77ae5895e351135564bda5114f3effe2f6249c4bdd4830 | Python | 2,093 | 57 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design, Port
from elast... |
2d4d4563d717f1b67462e967ebda5f466c819013f776194b9b2505e66f743480 | Python | 2,094 | 66 | import os
import toml
import logging
import jobflow as jf
from ase.io import read
from quacc import get_settings
from quacc.recipes.newtonnet.ts import ts_job, irc_job, geodesic_job
# Load configuration from TOML file
config = toml.load('inputs_using_newtonnet.toml')
# Constants from TOML file
REACTANT_XYZ_FILE = con... |
39fffe5f604393ab7d4e395dc1569b111b92d809c9752f0b9d7473f6d4622065 | Python | 2,095 | 70 | # 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... |
56cd0ddcf29a6a015865ae0485dca7d5e1e5aed457c9d94531cc2ee3ab60c157 | Python | 2,095 | 47 | import datasets
import lightning.pytorch as pl
from hicdiffusion_model import HiCDiffusion
from classification_model import ClassificationModel
from lightning.pytorch.callbacks import ModelSummary
import os
import shutil
from lightning.pytorch.loggers import WandbLogger
import time
import argparse
def main(val_chr, te... |
e0aadc2a62be1c4a87bfbed27f21eba256cb86479d8ef071db4a5e9fba005578 | Python | 2,095 | 64 | import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import unittest
import pyntbci
FS = 120
N_TRIALS = 11
N_SAMPLES = 7
N_CLASSES = 5
X = np.random.rand(N_TRIALS, N_CLASSES, N_SAMPLES)
y = np.random.permutation(np.tile(np.arange(N_CLASSES), int(np.ceil(N_TRIALS / N_CLASSES)))[:N_... |
84984e8cecb5ca588775713a33385d05a372c59801c18ca0a6d8a51a1fb2fd9f | Python | 2,096 | 63 | from typing import Any
import torch
import torch.nn.functional as F
from torch import nn, Generator
from ..prixfixe import FinalLayersBlock
from .utils import initialize_weights
class AutosomeFinalLayersBlock(FinalLayersBlock):
def __init__(
self,
in_channels: int,
seqsize: int # for comp... |
a3d1ee1f33504e614a8e1fee01c2e7ad66f8af7f67d28762a5f69a8785d8c639 | Python | 2,096 | 59 | # 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... |
dc31f4b13551e3a9432d0a6bf02ed5dc3b1daccc25f12ba29d03be54e3bb1d03 | Python | 2,096 | 98 | import numpy as np
import pandas as pd
import h5py
import os
import matplotlib.pyplot as plt
with open('train_sequences.txt') as handle:
raw_data = pd.read_csv(handle, sep='\n', header=None).to_numpy()
length = []
seqs = []
labels = []
for i in range(len(raw_data)):
seq, label = raw_data[i][0].spli... |
934aa9621d4ebdccc3d02b39aad325581f655ba6ca83dd976eb5465e01cc2738 | Python | 2,097 | 68 | ##
# \file joint_image_mask_builder.py
# \brief Build common mask from multiple, individual ones
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date November 2017
#
import SimpleITK as sitk
import numpy as np
import pysitk.simple_itk_helper as sitkh
import niftymic.base.stack as st
class J... |
db3ffafaae269673fc28ae04e48eb5c2c1428c19c8024f11849c552d70d81878 | Python | 2,097 | 62 | from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import os
import shutil
from setuptools import Command
class rotate(Command):
"""Delete older distributions"""
description = "delete older distributions, keeping N newest files"
user_optio... |
02c9d9591163741c1179e98cbbe5b85eeba2fae714fb99eb181a71477cd6cc98 | Python | 2,098 | 69 | #!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides an example longitudinal control for vehicles
"""
import math
import carla
from srunner.scenariomanager.actorco... |
f650e87931973452539a7a26b63d0e2927b9957f5775e9fdc6eedfe2e81ac111 | Python | 2,098 | 77 | import dataclasses
from abc import abstractmethod
from typing import Any, Iterator, Protocol
class Definable(Protocol):
@property
@abstractmethod
def name(self) -> str: ...
@abstractmethod
def define(self) -> Iterator[str]: ...
class Node(Protocol):
implementation: str
name: str
typ... |
034f8fbd355996ee6684df65bc19bf40c13e8f2f17b9b05a6f0e730e1ac02074 | Python | 2,100 | 64 | import unittest
import torch
from torcheeg.models import SimpleViT, ArjunViT, VanillaTransformer, ViT
class TestTransformer(unittest.TestCase):
def test_simple_vit(self):
eeg = torch.randn(1, 128, 9, 9)
model = SimpleViT(chunk_size=128, t_patch_size=32, s_patch_size=(3, 3), num_classes=2)
... |
ab1815de72a75d0bb585f6e7455b303d8cbe030220d57d0b482e3b70ae6cf239 | Python | 2,100 | 76 | CONSOLE_HTML_FORMAT = """\
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<style>
{stylesheet}
body {{
color: {foreground};
background-color: {background};
}}
</style>
</head>
<html>
<body>
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code>{code}</code></pre>
</body>
</... |
0428e535e70248d3cbb47924df8fc84c78171f2c72b55e01f9c86bafc0108662 | Python | 2,101 | 52 | import h5py
import os
import glob
import argparse
import numpy as np
# from plantsegtools.utils.io import rename_h5_key
from plantsegtools.utils import H5_FORMATS
def parse():
parser = argparse.ArgumentParser()
# Required
parser.add_argument("--path", type=str, required=True, help='path to h5 file or'
... |
7b1cbf332a6c2077796e45391b8d091a47f831e87b251c5b0d7bbd431f9c6b10 | Python | 2,101 | 72 | import argparse
def add_subparser_args(subparsers: argparse) -> argparse:
'''Add tool-specific arguments.
Args:
subparsers: Parser object before addition of arguments specific to
`denoise`.
Returns:
parser: Parser object with additional parameters.
'''
subparser = subp... |
aaa108c3a0b3dfc47d6356d77989229292ecd68c523a3d94a0bffb72089ca583 | Python | 2,101 | 79 | import os
import pickle
import numpy as np
import nibabel as nib
from decord import VideoReader
from decord import cpu
from decord.bridge import set_bridge
# Some funtions taken from Algonauts2021 starter notebook:
# https://github.com/Neural-Dynamics-of-Visual-Cognition-FUB/Algonauts2021_devkit
import h5py
def sav... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.