sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e7879df068bb1f1eae32ce88dc319faf3f958881e4d4aaa0390c2786d2a14acf | Python | 7,458 | 158 | import os
import tempfile
import unittest
import numpy as np
import pandas as pd
from torcheeg import model_selection
from .test_utils import _make_dataset
class TestBaseModelSelection(unittest.TestCase):
_parameters = {
'train_subjects': [0, 1, 2],
'val_subjects': [3],
'test_subjects':... |
f1b562fefc3b08fc2b53813814da81aefc941e7be341d74c031dd2ec0f8f9f14 | Python | 7,459 | 275 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
1fc038bc41fa50aeba8b2ce75602f4c6705772206dc7377cf004d872f5a22c3f | Python | 7,460 | 161 | from __future__ import annotations
import os
from pathlib import Path
import pytest
from ase.build import bulk, molecule
from ase.calculators.gulp import GULP
from quacc import change_settings
from quacc.recipes.gulp._base import run_and_summarize
from quacc.recipes.gulp.core import relax_job, static_job
def test_... |
be5c83cdbfcfbd9f47ed1f5b6d3aff08c467bde5b90dce7a782edec9dfc67e80 | Python | 7,460 | 288 | import os
import subprocess
import contextlib
import functools
import tempfile
import shutil
import operator
import warnings
@contextlib.contextmanager
def pushd(dir):
"""
>>> tmp_path = getfixture('tmp_path')
>>> with pushd(tmp_path):
... assert os.getcwd() == os.fspath(tmp_path)
>>> assert o... |
9143052acd3296b1d01f740097db13ace31a32cdaf846adb080281927e03a41c | Python | 7,461 | 173 | # Mancy Chen 25/04/2023
# MRIQC
import pandas as pd
import os
import matplotlib.pyplot as plt
list_of_input = ['001', '003', '004', '006', '007', '008', '010', '011', '017', '018', '020',
'021', '022', '024', '027', '029', '030', '032', '033', '034', '035', '036',
'037', '038', '039', ... |
82683f67f0d85c856d12a91cccb5f0ad01b21dae8377204339611e2c0d7544b2 | Python | 7,462 | 150 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""export_sign_tables.py —— 为对照实验(probe_controls.mjs)导出"按递质拆分"的中间表。
背景:v5.1 的符号干预翻转的是整条递质规则。要回答"起作用的是谷氨酸身份,还是任何
同等规模、同等位置的符号改变",需要能按神经元、按递质任意组合地重新赋号。本脚本
把两份数据导出为可在 Node 里快速重新赋号的中间表(产物已 .gitignore,随时可重建)。
输出(game/data/derived/):
1. flywire-pair-nt.bin.gz —— FlyWire 源表 c... |
181a901aa0ef9cdd7c2345f4a7ebf092f93b268b5f01a364a2dfc4efe76c5432 | Python | 7,466 | 238 | from __future__ import annotations
import os
from importlib import util
from pathlib import Path
import pytest
from ase.build import molecule
from quacc.recipes.orca.core import (
ase_quasi_irc_job,
ase_relax_job,
freq_job,
relax_job,
static_job,
)
has_fairchem = util.find_spec("fairchem") is no... |
968aed5142982f1a8f84fb041ef02f8fa8519b1804046177d30750e2dee9cd00 | Python | 7,466 | 193 | """Named registration-parameter presets (Qt-free storage layer).
The Parameters tab has many knobs users re-enter every run for a given
species/modality. A *preset* is just a named copy of that parameter dict. This
module is the storage layer only - pure CRUD over a JSON file, no GUI (the
gather-from-widgets / ap... |
fbff00e174218b3c5750fc98b6d6f5eebb7f688df1de37e7984fa389937ad4a2 | Python | 7,466 | 172 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 18 2018
@author: carlos atico ariza
"""
import os
import pickle
import re
from features_to_DF import gen_bn_features
import sys
import gc
#Test data for building pipeline
#d = {'URL' : ['https://nutcasehelmets.com/collections/adult/products/technic... |
414ba7c182dff08c8e83239cc177c5e5f0773683fe2317dd5db4ef5c76a68ca9 | Python | 7,469 | 202 | import numpy as np
import pickle as pkl
import torch
import networkx as nx
import scipy.sparse as sp
import sys
exc_path = sys.path[0]
def parse_index_file(filename):
"""Parse index file."""
index = []
for line in open(filename):
index.append(int(line.strip()))
return index
... |
5a1df5ea9fda79933ed840063f1fd89eb676121605e9a0391d75a092aeb6cbaf | Python | 7,470 | 198 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.fusedffn.fc2.design import Linear as LinearDesign
from elasticai.creator.nn.integer.math_operations import MathOperations
from elas... |
85aad95bb1e3f5db14725ad19b7dccfbe8333dc0616fc10316183e615b647d84 | Python | 7,470 | 208 | import torch
from torch import nn
from torch.hub import load_state_dict_from_url
__all__ = ['MobileNetV2', 'mobilenet_v2']
model_urls = {
'mobilenet_v2': 'https://download.pytorch.org/models/mobilenet_v2-b0353104.pth',
}
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from t... |
ced22c380da53eb539656b1da62db2dbdfba7649a998f247d45d41e5fde886b6 | Python | 7,471 | 130 | import argparse
import schnetpack as spk
import torch
from torch.utils.data.sampler import RandomSampler
from torch.optim import Adam
import os
import numpy as np
import shutil
from schnarc.schnarc import get_energy, get_gradient, get_dipoles, get_nacs, get_schnarc, get_socs, get_diab,get_nacs_deltaH, get_nacs_deltaH2,... |
fe1b80c1a22172a69de9a7a531dbb9302f80a7f18086256330cc640d9fc168e9 | Python | 7,471 | 213 | # 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... |
0cbc8bb551aada6c86cfdb3a865223703869c63e72954dcc5140a761d004dea3 | Python | 7,472 | 183 | import numpy as np
from scipy import signal
def f_RMSFilter(v_signal, d_windSize):
"""
Applies a Root Mean Square (RMS) filter to the signal.
Args:
signal (numpy.ndarray): The input signal.
window_size (int): The size of the sliding window for RMS calculation.
Returns:
numpy.... |
295c05901769a42b8adc3879f8a7c80c629242623f96c8025981bf32b7192113 | Python | 7,472 | 224 | #
# 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,... |
5f938bf9cdb142e02021198e26c40cb2bb64d77f1fdde97153c83a1722b9ad91 | Python | 7,472 | 262 | from typing import cast
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from median.distributions import AbsNormal, Beta, LogNormal, Normal, Uniform
from median.utils.utils import getBinsX
def test_Uniform():
L = 40
a = 20
b = 120
dist = Uniform()
x = np... |
40521e52249c2b6ff3015de7c20a69122ceeb550a2085202eacea004a18c2f84 | Python | 7,473 | 205 | # -*- coding: utf-8 -*-
'''
Created on Tue Feb 16 13:15:38 2016
@author: kousik
'''
''' Visual inspection of ICA solution and interactive manual rejection '''
import os
from os.path import join
#import matplotlib
#matplotlib.use('Qt4Agg')
# matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from sys import argv
... |
f7c1acab0d96fdc7256240f787d0d18b71fbd8bd337a5ae2993515de15632655 | Python | 7,474 | 204 | # ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: APT
# language: python
# name: python3
#... |
a92db61433584c4f10e498c8d83150597e1193b188644a55ec09992bd975ac65 | Python | 7,475 | 167 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
def get_neuron_conn_indices_by_type(connected_pairs, connection_types,
layer_map_pre, layer_map_post,
num_neurons_pre, num_neurons_post):
connect... |
a54ceafacfec4033335cb63bf2797705e92e593676b486f5b69cdf5471c53d74 | Python | 7,476 | 124 | import os
import torch
import argparse
class options():
def init(self):
self.opt = self.get_opt()
self.make_dic()
self.check_device()
self.check_data()
return self.opt
def check_data(self):
opt = self.opt
if self.opt.data == 'pbmc':
... |
d5b2d7411186bb46d7be4459797a634a9cf18e51844a5348c3061661426fa467 | Python | 7,476 | 183 | """
Set of tests for Hopf normal form model.
"""
import unittest
import pytest
import numpy as np
import xarray as xr
from jitcdde import jitcdde_input
from neurolib.models.hopf import HopfModel
from neurolib.models.multimodel.builder.hopf import HOPF_DEFAULT_PARAMS, HopfMass, HopfNetwork, HopfNode
from neurolib.utils... |
20c7294d8dc5b7ff71d3dec11b1cee9741c5ac2ee29bdf6d1a8e7f4068070a2f | Python | 7,477 | 204 | import json
import os
import random
import shutil
from openmm import CustomExternalForce, LangevinMiddleIntegrator, Platform, XmlSerializer, unit
from openmm.app import Simulation
def pick_platform():
requested = os.environ.get("COLABMDA_PLATFORM", "auto").strip().upper()
names = [requested] if requested != ... |
e3e26a30396e1706c086fe78982df96e8a89c6ff7bb07883ea11502fa599fa64 | Python | 7,478 | 218 | from __future__ import division, print_function
import glob
import json
import os
import sys
from locale import strcoll
from typing import List
import numpy as np
import pandas as pd
import topaz.utils.star as star
from topaz.utils.data.loader import load_image
def mirror_y_axis(coords, n):
coords = coords.clon... |
4db680b249d42efa935625909e21fb56aa3e72b0ca4ad686815ae3a1bad9ede9 | Python | 7,479 | 202 | from pathlib import Path
import torch
import pandas as pd
import numpy as np
from typing import Tuple
class Dataset_Fredmd(torch.utils.data.Dataset):
"""
Creates a PyTorch suitable data set for FRED-MD. The data is transformed to
log-differences and rolling origins are created. Afterwards each rolling ori... |
1f302ab3356a8ffd085f5eb547af4be4dca0a1ec72b405696c36c7d0f41b96ce | Python | 7,480 | 199 | from itertools import cycle
import torch
import torch.nn as nn
from tqdm import tqdm
import torch.multiprocessing
from tqdm import tqdm
torch.multiprocessing.set_sharing_strategy('file_system')
def train(dataloader, model, optimizers, device, custom_loss_function, loss_param, main_task, version):
sum_of_loss = ... |
3439a300036d878ca62fbc55f98ea6121d3f140789f6adb2e2d6e00f0aa25768 | Python | 7,482 | 213 | """
Script for computing local topology properties from a GraphMCF
Input: - File with a GraphMCF (.pkl)
Output: - GraphMCF with the new properties overwritten
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
from pyseg.globals import... |
3db2b6528b18641dff30c679e5487be186bb485d56f592bae4cb299e49be31b3 | Python | 7,482 | 176 | from typing import Dict, Union
import io
import pywt
import numpy as np
import matplotlib.pyplot as plt
from ..base_transform import EEGTransform
class CWTSpectrum(EEGTransform):
r'''
A transform method to convert EEG signals of each channel into spectrograms using wavelet transform.
.. code-bl... |
a179ba22a7a46dfe2e635fcb630db0560ff9e76286a14ff4382fc594c73c6830 | Python | 7,482 | 151 | #!/usr/bin/env python
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Other Leading Vehicle scenario:
The scenario realizes a common driving behavior, in which the
user-controlled ego vehicle follows a leading car driving down
a given road. A... |
abfa5fa9f46cdffd6abe3de0f7fa2cfea22e1bea310485ef6651088bd7e8e7b2 | Python | 7,484 | 183 | import numpy as np
import tqdm
import copy
import numba
from skimage.segmentation import watershed
from skimage.filters import gaussian
def get_bbox(mask, pixel_toll=0):
max_shape = mask.shape
coords = np.nonzero(mask)
z_min, z_max = max(coords[0].min() - pixel_toll, 0), min(coords[0].max() + pixel_toll, ... |
efa1a089b58e79bee696545d9c9b0881c983a446448fc9a2a54018df7076eafd | Python | 7,484 | 143 | """
CONJECTURE_TESTS.py written 2026-09-07
TWO CONJECTURES, AND THE PREDICTIONS ARE WRITTEN BEFORE THE RUN.
--- C1. THE GAIN CONJECTURE -------------------------------------------------------
Across four published sign conventions rho(W) spans 0.8% while rho(W_EE) spans 62%.
CONJECTURE: a connectome determines... |
2a60fb29305a581c5fd0f9b0d6596339c0aecd16457c3d57bba01190c3c8b00e | Python | 7,485 | 188 | """
Tile-mosaic assembly engine.
This is a faithful port of the original
``UCI-ALLEN-BrainRepositoryCodeGUI/stitcher.py`` implementation
provided by the Allen Institute. Storage dtypes match the reference
exactly:
* ``slice_image`` is held as ``uint16`` - the same dtype the TIFFs are
written as. Per-tile... |
652b4ee6cf589577135c43053b0198120eaaaee49a1cf00fec42f982085d0b40 | Python | 7,487 | 225 | """Point-correspondence routines.
Ports of:
utils/BoundingBox_PointCorrespondence.m
utils/find_PointCorrespondence.m
utils/Final_PointCorrespondence.m
utils/damage_correspondences.m
utils/outlierRemoval.m
"""
from __future__ import annotations
from typing import Tuple
import numpy ... |
6ce87bcf144696c26af563a8e4ce7e29607d68f94c565ebcd4c31db5ba1a877d | Python | 7,488 | 222 | """
Script for getting a core graph from a scalar filed and grow and extended one from the core
Input: - Original tomogram (density map)
- Scalar field
Output: - vtkPolyData with the core and extended graph
- Segmentation of graphs
"""
__author__ = 'Antonio Martinez-Sanchez'
... |
f702ab7e31bf02b919b4e16f67baed4f4d65c22253f47f2845cb208c0caaa479 | Python | 7,490 | 227 | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
7277afc4d175418fbdc833c44ef0c99bc2f77c055e8f6464a641b86fa872b470 | Python | 7,491 | 197 | from parse import args
import os
import pandas as pd
import numpy as np
import math
import pickle
from pyfaidx import Fasta
import tensorflow as tf
from DeepCRISPR.deepcrispr import DCModelOfftar
from CFD.otscore import calcCfdScore
from MIT.otscore import calcMitScore
from CROPIT.otscore import calcCropitScore
from CC... |
8ec6f72a3dd742d36ac30bed735594b7f264f0011721e863117223ddd227bfa3 | Python | 7,491 | 206 | """
distutils.command.upload
Implements the Distutils 'upload' subcommand (upload package to a package
index).
"""
import os
import io
import hashlib
import logging
from base64 import standard_b64encode
from urllib.request import urlopen, Request, HTTPError
from urllib.parse import urlparse
from ..errors import Distu... |
d989cf82866b5df372d5899a77f815c7fe715bdb6dddf36236bd4798e58fbef5 | Python | 7,491 | 170 | from collections import defaultdict
import logging
from random import Random
from typing import Dict, List, Set, Tuple, Union
import warnings
from rdkit import Chem
from rdkit.Chem.Scaffolds import MurckoScaffold
from tqdm import tqdm
import numpy as np
from .data import MoleculeDataset
def generate_scaffold(mol: U... |
7de2f2826ec452430f5fb4abf7607e900b9e80433f435da667a9344259501b86 | Python | 7,492 | 218 | import torch
import torch.nn as nn
from utils.complex_utils import complex_utils as Z
from utils.loss_utils import choose_loss
from utils.optics_utils import super_gaussian, gaussian
from utils.layer_utils import layer_sel
from utils.dataset_utils import get_input_mask
from network.config_params import update_la... |
e9545123a4db86ff1e53c8c762a8d92e0b218b6320e629883136a4bafbecd0eb | Python | 7,492 | 206 | #!/bin/env python
# Written by Greg Ver Steeg
# See readme.pdf for documentation
# Or go to http://www.isi.edu/~gregv/npeet.html
from __future__ import division, print_function
import scipy.spatial as ss
from scipy.special import digamma
from math import log
import numpy.random as nr
import numpy as np
import random
... |
a3f97cdf5467a06995c9ac03be91de274e7cb6fe22d61e5dad3ac28f72986ef1 | Python | 7,495 | 186 | """
Set of tests for FitzHugh-Nagumo model.
"""
import unittest
import numpy as np
import xarray as xr
from jitcdde import jitcdde_input
from neurolib.models.fhn import FHNModel
from neurolib.models.multimodel.builder.fitzhugh_nagumo import (
FHN_DEFAULT_PARAMS,
FitzHughNagumoMass,
FitzHughNagumoNetwork,
... |
e88fc54407b0ff2b4fdd7f8fecaa7b5966215ea68fda2b8d8b83107fda611b3f | Python | 7,496 | 285 | import numpy as np
from pathlib import Path
from tifffile import imwrite, imread, TiffFile
from scipy.io import loadmat
import json
def fname(old_file, new_ending, old_root="", new_root=""):
"""Helper function to generate path for output files
This will strip the suffix from `old_file` and attach a new
... |
355d18e786c88f25537920816e937335c801a6e3d8536da1e6d0a7f19548b992 | Python | 7,497 | 150 | import numpy as np
from scipy.signal import savgol_filter
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
import plot # pupillometry code
class Updater:
# add means, measures, derivatives and signal range to data
# computes measures and plot everything
def __init__(self,dat... |
8cb74e74ef6f847b5c72cbfd1e1227880f8bb72f583dda282c489739b445e490 | Python | 7,500 | 177 | import argparse
import pathlib
from pathlib import Path
import json
import os
from collections import OrderedDict
import shutil
import sys
import nibabel as nib
import numpy as np
import re
from tqdm import tqdm
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via input() and return their answer... |
fb1dcc047e529cff4e8672f973992c417155c0792778f877376230b2343e5d8a | Python | 7,500 | 106 | """MALE_CNS.py 2026-10-05. Pre-registered: 04-NOTES/PREREG-2026-10-05c-MALE-CNS.md (sha in .sha256 next to it).
A fourth adult fly (Janelia male CNS v1.0, neuPrint): M1 v2LN30 onto uPNs per side; M2 FlyWire dominant pairs replicated;
M3 brain-wide dominant inputs signed by this fly's own classifier; M4 v2LN30 / v2LN36 ... |
fa666ec5bbfc60cc691af3a799611cb2e4eca9ecbc57782f7fb738e238d89cf8 | Python | 7,505 | 197 | import os
import threading
import traceback
import time
import numpy as np
from PyQt5.QtWidgets import QWidget, QFileDialog
from PyQt5.uic import loadUi
import crossbar_panel
import apps
# import globals.global_func as gf
FILE_PATH, FILE_FULL_NAME = os.path.split(os.path.realpath(__file__))
FILE_NAME, ... |
a150dbfa96e4c314414955379a87eda7041bae5825b626b3337010d526b3d3af | Python | 7,507 | 208 | # 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... |
c7d283939dc70aa6b7bba678ae4979ef5838ce847b8ae22a666d9dfd1e6c5659 | Python | 7,507 | 230 | from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
from soundsig.incrowd import ConvolutionalInCrowdModel, InCrowd, fast_conv
def test2():
#construct sample input matrix
num_channels = 60
num_timepoints = 10000
stim = np.random.randn(num_channels, num_... |
325c71bbb2bda0b1acb1ee8e888db82d3c8afec3973eaf1e80d9e3afb23d013b | Python | 7,512 | 214 | import neuprint as neu
import numpy as np
import pandas as pd
from pathlib import Path
from .core import DataSet
from .ds_utils import _add_types, _is_int
from abc import ABC, abstractproperty
class JaneliaDataSet(DataSet, ABC):
"""Base class for Janelia datasets which use the neuprint/clio API."""
_roi_c... |
e895ca9d00b57ffca70a34b126bf71b3f06e6e6023537de3c61b05ed2fc2babd | Python | 7,512 | 153 | import torch
import torch.nn as nn
class TSCeption(nn.Module):
r'''
TSCeption. For more details, please refer to the following information.
- Paper: Ding Y, Robinson N, Zhang S, et al. Tsception: Capturing temporal dynamics and spatial asymmetry from EEG for emotion recognition[J]. arXiv preprint arXiv:2... |
a7bf62463cddef0e41cb566eaf8e8cbcddd020121b4cff9cea44b04560d4783d | Python | 7,513 | 198 | #!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import stat
import argparse
import subprocess
import datetime
import re
import glob
import csv
import warnings
import time
import numpy as np
from threading import Timer
#from APTCluster import makecmd
DEFAULTAPTDIR = os.path.dirname(o... |
771fbbfdacf07607ed713b2e79049eba64d5697c28b98170db3b1b13b64f1487 | Python | 7,515 | 198 | """
Convert QuPath Detections and annotation to pandas dataframe
"""
# Copyright (C) 2021 Blue Brain Project, EPFL
#
# 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 Lic... |
823e07f14b6eb51da46135ded7b56b84c5c91257a0af3bde8ea56f22650a5d71 | Python | 7,516 | 235 | # 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... |
ab66976da95191c437a8fac0c8111909ae45551292a0c2ccb2cbe3e9498ab85d | Python | 7,516 | 225 | """Perform and save time frequency analysis of given files."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Annotated, Literal
import mne
import mne_bids
import numpy as np
import pandas as pd
import pte
from matplotlib import figure
from matplotlib import pyplot as plt
f... |
a80742269453c432e4e87e746ea5a2d5459a93b5bfe8fa6885abfb337672e39a | Python | 7,518 | 170 | from dreamcoder.domains.arc.arcPrimitives import *
from dreamcoder.domains.arc.makeTasks import get_arc_task
import dreamcoder.domains.arc.arcPrimitives as p
def check_solves(task, program):
for i, ex in enumerate(task.examples):
inp, out = ex[0][0], ex[1]
predicted = program(inp)
if predi... |
23b2513ca900148508276f739e86bfcd9dd207d75795aa946c1869eb609364b8 | Python | 7,519 | 187 | # This script makes runtime measurements of the program for different model parameters
import subprocess
import re
import csv
import math
import os
import io
import itertools
# Prints the results to the given csv.
def print_csv(pathname, array):
with open(pathname, "w+", newline='') as csvfile:
... |
9b9f68164b4456a7d4c14f12c3547523927a164420df4830490311a7ecd1ce73 | Python | 7,519 | 238 | import os
import subprocess
import sys
from pathlib import Path
def _run_script(script: str) -> subprocess.CompletedProcess[str]:
env = os.environ.copy()
for name in list(env):
if name.startswith(("COG_OBSERVABILITY_", "COG_TRACE_", "OTEL_")):
del env[name]
return subprocess.run(
... |
5687cf1b07b67625e0c2cc5d04c12176f3f62b7622964b82f3450ef5af24f622 | Python | 7,520 | 218 | import pytest
import torch
import torch.nn.functional as F
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 imp... |
25b17df63f42c889002d42a24b041cc82bc9eac7bb2b26e72328a603bd4a1e0e | Python | 7,522 | 212 | # Copyright 2019 Murdoch Children's Research Institute,
# Melbourne, Australia
#
# 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 req... |
785708c2801aa04fd83abb7bb29e2853cb8c9a013890a1fb6f407f0796f827dd | Python | 7,527 | 232 | # 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... |
61b3a501d5df53cda5dc477459e7693557231751441a82f7548f0dafe11c61be | Python | 7,528 | 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... |
3c5ebce0c182549beeec99610b62b4f5232d0a47711283c5bfea17cb46af64de | Python | 7,529 | 199 | ###############################################################################
# This code generates the Supplementary Figure 4 of the paper "Longitudinal #
# single-subject neuroimaging study reveals effects of daily environmental, #
# physiological and lifestyle factors on functional brain connectivity" #
... |
36d9d6c1198ca0b1fd04fc7808faea3d15767361c41c08681fedb2d95bfc64ed | Python | 7,532 | 211 | from functools import partial, reduce
from inspect import signature
from itertools import chain
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.autowiring ... |
65a1b37b0413f68aef81944b23c8ebf29c86e3bd4ec7eefebfb4fbfdad1be31a | Python | 7,532 | 169 | #################################################################################################
# Generate plots of comp after CCA - time and spatial
# Also make GA of same
#################################################################################################
import os
import mne
import numpy as np
import... |
02a7aee3c6c289bae418484b1c93ecae3480a82b986c7414583322f58d7c5ef4 | Python | 7,534 | 284 | """
Module for generating movies from 2p images
(c) 2015 C. Schmidt-Hieber
GPLv3
"""
import os
import sys
if sys.version_info.major < 3:
try:
import subprocess32 as sp
except ImportError:
sys.stdout.write("Couldn't find subprocess32; using subprocess instead\n")
import subprocess as sp... |
2d8edf1bf78c0c28533fafb811307a0a5d19080d367d839a5f5bf89337bf538a | Python | 7,534 | 132 | # 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... |
c93a6f8f53f4af12138d6c6e254ad7df416a39be5319ad8e033b3e80fb1088fe | Python | 7,534 | 182 | """Undo / redo stack for the CCF boundary editor.
Extracted from the viewer so the stack-management invariants can be
unit-tested without spinning up a ``QApplication``. The viewer instantiates
one ``UndoHistory`` and delegates push/pop to it; restoration of the
snapshots themselves still lives on the viewer beca... |
159091275e4ba22ca4427546c9ae3c65a43bf195ec12e423a91ff4fd12a271e8 | Python | 7,535 | 203 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from typing import Any, Dict, Optional
from models.model import Model
from models.kan_layers import KAN
class ParallelConvBlock(nn.Module):
def __init__(self,
inp,
out):
super().__init__()... |
b6a119c29ceb25e185020452389ad2161b04bbe10e17e17d7e4036a5c7a6858e | Python | 7,536 | 182 | from dreamcoder.program import *
def graphPrimitives(result, prefix, view=False):
try:
from graphviz import Digraph
except:
eprint("You are missing the graphviz library - cannot graph primitives!")
return
primitives = { p
for g in result.grammars
... |
101ec2456c014e0c3c1beb76dc32fef33e507be48a23cb08422d38cbe3794af3 | Python | 7,541 | 209 | """PyTorch embedding datasets designed to work with OpenSRH.
Copyright (c) 2024 University of Michigan. All rights reserved.
Licensed under the MIT License. See LICENSE for license information.
"""
import os
import json
import logging
from collections import Counter
from typing import Optional, List, Union, TypedDict... |
fa901b836a6db09812cc0e247e39afbdad29190f80885430c71cba1ebf9b818b | Python | 7,544 | 212 | #!/bin/env python3
"""
Find and analyse the trajectories of PDLs
"""
import csv
import ithildin as ith
import numpy as np
import matplotlib.pyplot as plt
import sys
from matplotlib import cm
sd = ith.SimData.from_stem("results/pdl-detection/optical_20200204114234")
# sd = ith.SimData.from_stem("results/pdl-detection/p... |
9afae32e1055cea1e183fb186378e0247e92d06426d6a01134eca8e711ac8731 | Python | 7,546 | 238 | # 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... |
a7b00729ae07c143ed1513acc35f2e5ca14eb381240cdd40d675b4262a5ae43a | Python | 7,548 | 182 | import importlib
import networkx
from merlin.core import analysistask
from merlin.core import dataset
class SnakemakeRule(object):
def __init__(self, analysisTask: analysistask.AnalysisTask,
pythonPath=None):
self._analysisTask = analysisTask
self._pythonPath = pythonPath
@s... |
8ba369e1b959aa805fef96b7b26896af06d4986a986427ea4521a4079e250633 | Python | 7,549 | 202 | import scanpy as sc
import numpy as np
from sklearn import metrics
from scipy.optimize import linear_sum_assignment
import torch
from torch import nn
import pandas as pd
def silhouette(adata, group_key, embed, metric='euclidean', scale=True):
"""
wrapper for sklearn silhouette function values range... |
cdfd58536c7a303d0fb1348ae213e68f34f14758a1169b5210dfb573d2dc4a0d | Python | 7,549 | 173 | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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
#
# ... |
8a6d104ecc123ec914d95490ed8ac61abb7f5e3556f039b3384a4c36a1221fca | Python | 7,551 | 176 | #!/usr/bin/env python3
# Python standard libraries
import os, sys, filecmp, difflib, time, traceback, subprocess
# os.system('head -n 26 test_results.html> test_results.html.tmp && mv test_results.html.tmp test_results.html')
w="""
<html>
<head>
<title>Example tests results table</title>
<style>
th {
color: whit... |
c614084e44145642212c2d5b891733de864b7da45e1088f51f619f7c2047cb67 | Python | 7,551 | 209 | import os
import time
import logging
import argparse
import yaml
import jinja2
from jinja2 import meta
import easydict
import torch
from torch import distributed as dist
from torch.optim import lr_scheduler
from torchdrug import core, utils, datasets, models, tasks
from torchdrug.utils import comm
logger = logging... |
ae4b1a0cabe025f449655dce7e31b513ac07c933f91257c657e8b7293b739881 | Python | 7,552 | 230 | #!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Allows controlling a vehicle with a keyboard. For a simpler and more
# docu... |
de7fa29f371b96b57a0c098018b48b130bcd4de30cf4ccdfbe466ecd47677058 | Python | 7,553 | 286 | import numpy as np
import pandas as pd
from scipy.ndimage import uniform_filter1d
import matplotlib.pyplot as plt
from matplotlib import colors
from scipy.io import loadmat
import h5py
from skvideo.io import vread, vwrite
from PIL import ImageDraw, Image
def load_track(matlab_file):
"""Load fly tracker data fr... |
2c86ca1055d4988b84c7183f512fc042b5403dd8a622bdf3d63f13ed9fd551ce | Python | 7,554 | 251 | # 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... |
7de8146aaf035168ff3f657efcb756331e7b1fe7a467d8ff65d0c74cca40fe95 | Python | 7,554 | 272 | import numpy as np
from pathlib import Path
# plotting
import matplotlib.pylab as plt
from matplotlib.colors import CenteredNorm
import seaborn as sns
# video/image handling
from skvideo.io import vwrite
from PIL import Image
# local code
from src.processing import calculate_pearson, calculate_ccf, resample
#######... |
c3497ac0ce0fe598250d1e39396e2d80e3bb92f1bf611869f0d83cdaee288d68 | Python | 7,554 | 277 | # 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... |
187b4ec8fb96c3a57614901a0dcb0359702626da9df6992b741c34f2d9ff9a41 | Python | 7,555 | 109 | """LARVA_LAW.py 2026-10-03. Pre-registration: 04-NOTES/PREREG-2026-10-03d-LARVA-LAW.md
The inequality in a third brain: the first-instar larval antennal lobe (Winding, Pedigo et al. 2023, data S1-S2), with
Shiu et al.'s constants. V0 validity, L1 a line from 20 random orders, L2 single signs, L3 who, L4 spikes.
usage: ... |
4f95f618d51ced269bb8cfd7b2f9bf0186d46b25b2d79e7c8154389e5689def7 | Python | 7,555 | 165 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from tabulate import tabulate
from tqdm import tqdm
from src.inference.model_initialization import get_classifiers_checkpoints, init_regressor, init_classifier
from src.inference.predict import do_score_image
from constant... |
830193a079a135bc0352aaa4f5c125b89cba82396b4970f2988663f4bde24202 | Python | 7,557 | 224 | import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from dreamcoder.task import Task
from typing import List
class MikelArcNet(nn.Module):
special = "ARC" # needed if we ever try bias optimal learning
def __init__(self, tasks: List[Task], testingTasks=[], cud... |
b9547409d873ac3b1fb8c1adb57c71af3fad5ec58123cec6899090d024841f14 | Python | 7,557 | 236 | from matplotlib.axes import Axes
from matplotlib.patches import Circle, Ellipse, Polygon
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import numpy as np
from numpy.typing import NDArray
def eventplot(
S: NDArray,
E: NDArray,
fs: int,
ax: Axes = None,
upsample: int = 20,
... |
17e516cb6734f1dab33855a9e0da84e9f984c7bfb7cf1df6d060969e2660ba40 | Python | 7,558 | 255 | """
Extract SC values
Update this script as new values are extracted. The markers extracted are:
- Weighted clustering coefficient
- Average connectivity
- Global efficiency (SC lengths)
- global centrality
- MSP
- MST
This script follow similar structure to the one on creating MR values, from MSclerosis-TVB
"""
im... |
563bcbcd55ee11e70dae8887269e32fc33b575719c7abf603894b44ad304dc70 | Python | 7,558 | 237 | from pathlib import Path
from typing import Self
from elasticai.creator import ir
from elasticai.creator.ir2vhdl import (
Ir2Vhdl,
Node,
PluginLoader,
Registry,
Shape,
factory,
)
from elasticai.creator_plugins.skeleton.hw_function_id import HwFunctionIdUpdater
class CNNBuilder:
def __init... |
a6e3c3e0337bf761020b02a197e55a8bf4706bdb917f22e257fa1bfb50dcd8fa | Python | 7,558 | 167 | # MIT License
#
# Copyright (c) 2024 Yu Bao, Harbin Institute of Technology
#
# 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
# ... |
61114f122f2003e85e12d472ca805c398326141b44a9d0b2284c8bf8c458ba79 | Python | 7,560 | 226 | # Copyright (c) 2020, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
c7579ed6b77ccbd8dc949ae3b2ad554e567ab2e9caf597a8ac3dfbd5905d01be | Python | 7,560 | 222 | from __future__ import annotations
from functools import cached_property
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from numpy._typing import NDArray
from cuppa.constants import PAN_CANCER_CLASS_NAME
from cuppa.logger import LoggerMixin
from cuppa.misc.utils import check_required_columns... |
d8a66527fc916557d01c47575cb31861340c767af0e5743318a2f5e38d6756a1 | Python | 7,562 | 218 | # 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... |
f6e98437828bba1ad1995074fdcbadbfe650f5cccb59a7554c8b2cc2221940cd | Python | 7,563 | 193 | ### Modules
# basic
import os, h5py, pysam, glob
import numpy as np, pandas as pd
from Bio import SeqIO
from ont_fast5_api.fast5_interface import get_fast5_file
from sklearn import preprocessing
from collections import OrderedDict
# dask
import dask
import dask.bag as db
from dask.distributed import Client, LocalClust... |
d5d0108f3255b8ce5aeaf8b4ee3cc4076603cbc4ef2aa5a0578dfd8fde017112 | Python | 7,564 | 244 | """Convenient module to convert data based on simple mathematical operations.
"""
from inspect import signature
from logging import getLogger
# for Math
from numpy import (absolute,
angle,
amax,
amin,
asarray,
concatenate,
... |
89ae26445d8855c8543a50e8b377f0f3d913f2f151848a8217b29831bc6fd851 | Python | 7,568 | 271 | #!/usr/bin/env python3
"""
m6a_supervised_cnn.py
Author: Anupama Jha <anupamaj@uw.edu>
This module predicts whether an
adenine is methylated or not. The
model is trained with Fiber-seq
HiFi read sequence, inter-pulse
distance and pulse width signal
from pacbio. The model is a
convolution neural network.
"""
import tor... |
908f2d9e8f9d16f575861690b794bea92887dfe6519765d4fa9e916fecaf5ece | Python | 7,568 | 197 | import uuid
from collections.abc import Callable, Iterable
from os import environ
from os.path import exists
from pathlib import Path
from typing import Any
from cocotb_tools.runner import get_runner
from elasticai.creator.file_generation import find_project_root
def run_cocotb_sim_for_src_dir(
src_files: Itera... |
ea7466edd4cc8642610f67b86fc1640263084572d070bead4bf7e2057ac84d1f | Python | 7,572 | 165 | import numpy as np
import os
import pandas as pd
from tqdm import tqdm
import torch
import torchvision
from constants import *
from src.dataloaders.rocf_dataloader import get_dataloader
from src.utils import class_to_score
class MultilabelEvaluator:
def __init__(self, model, image_size, results_dir, data_dir, ba... |
97e2bf153a7926609b8544cbbca1e9c1fd278e31a5a854ca5467ef0d0f87e4b3 | Python | 7,575 | 203 | #!/usr/bin/env python
import json
import numpy as np
import tensorflow as tf
from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input
#from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import logging
import os
import sys
import io
import tensorflow a... |
683477a4a4515fd747a1b4361f32abc9fd368e03999c67277c4997ff6f3c55c8 | Python | 7,581 | 222 | import os
import textwrap
from optparse import Values
from typing import Any, List
import pip._internal.utils.filesystem as filesystem
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
from pip._inter... |
7b5fec9ccf16bcd6915f08b03ffa22be4293ecc537331ef2d048751cb3160572 | Python | 7,581 | 186 | """
Interaction tests for ItemEntity against the simulated Wikibase instance:
retrieval, error handling and, most importantly, the exact payloads sent to
the wbeditentity API endpoint when writing.
"""
import json
import pytest
from wikibaseintegrator import WikibaseIntegrator
from wikibaseintegrator.dataty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.