sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
72f05b411a51050b653746445cf01574d356d56b248518967dbcc7ef5de25cee | Python | 1,107 | 36 | from numpy import iinfo, isnan
from pytest import raises
from wonambi import Dataset
from .paths import micromed_file
def test_micromed_header():
d = Dataset(micromed_file)
assert d.header['chan_name'][-1] == 'EMG'
assert d.header['chan_name'][:5] == ['FP1', 'FP2', 'AF7', 'AF3', 'AFz']
assert d.head... |
d27184f9b3bca08fec6b6852c85c590e29b77392893d27e458b73fa64595c1a1 | Python | 1,107 | 44 | #!/bin/env python3
'''
Plot particles
'''
import matplotlib.pyplot as plt
import numpy as np
import pdlfeynman as fy
import yaml
import sys
from matplotlib.patches import Circle
from itertools import chain
assert len(sys.argv) == 4
particles = yaml.safe_load(open(sys.argv[1]))
data = particles[fy.particle.Particle.par... |
fc22a5165bca88f7c689803a9fcf0d8b029d8131b3c2f0d21eadd8a0a26cd2d1 | Python | 1,107 | 48 | import os
from . import *
def preprocess_data(args):
print('preprocess')
gtf = read_gtf(args.gtf)
seqs = read_seq(args.fasta)
if args.mode == 'mature':
sdf = get_mature_splice(gtf, seqs, grp=['id', 'trans']) # TODO id/gene
ndf = get_mature_cds(gtf, sdf, grp=['id', 'trans'])
... |
5ed5ad9768ebbe26d5ac17ef01a59aaa8f4b0664b103a82d77446d25ed8680c4 | Python | 1,108 | 38 | from __future__ import annotations
from pathlib import Path
from quacc import flow, job
from quacc.utils.files import copy_decompress_files
def test_copy_files(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
@job
def create_file(name: str, copy: list[dict] | None = None):
output_dir = tmp_p... |
3b271be923d656c7d9f01d78eaf79830420680e2abce90cdb9ddcbf1e2868ceb | Python | 1,109 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
3f9c4da8fb3a3accc56ca8c7292691efae2a9d89b58bd8cbd18c551c37413552 | Python | 1,109 | 28 | from torch.utils.data import Dataset,DataLoader
import os
import numpy as np
class google_dataset(Dataset):
def __init__(self, data_dir="./audio"):
self.data_dir=data_dir
self.data_list=os.listdir(data_dir)
def __len__(self):
return len(self.data_list)
def __getite... |
49e1c5b58e6ae4bfcd531bf5d6a01a870d589ebbd186441a2e374655640c6487 | Python | 1,109 | 14 | """posthoc_sff_left_wrong_2026-09-29.py (POST HOC, descriptive). Are the types still wrong at the end of the continued pair
search the ones Test 1 found NOT function-determined (invisible to a recording one at a time)?"""
import re, pandas as pd
R = 'D:/eucys'
txt = open(f'{R}/06-OUTPUT/posthoc_sff_pairs_continue.txt',... |
89802c152a84171e46589f30cd6ba8e66bf61198f71564a5d427985cf64ec323 | Python | 1,109 | 23 | #
# 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,... |
9ce0d39ee697084ef247194079535f6eee942b62bade514ce3bf0469ac26b160 | Python | 1,109 | 23 | #
# MIT License
#
# Copyright (c) 2024 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,... |
726c0e35fbc731ee4807876878a4fb2d9468efe8f3b59ae01003f69844ede249 | Python | 1,110 | 40 | import torch
from torch import nn
import segmentation_models_pytorch as smp
class SMPUNET(nn.Module):
"""
PyTorch implementation of a U-Net model using the ResNet50 backbone from
segmentation_models_pytorch for denoising tasks.
"""
def __init__(
self,
args,
in_chans: int = ... |
953b1596502476c146344b54d3b6082fa03bdedbbe345d774f1f753c4f0a33f7 | Python | 1,110 | 40 | from typing import Protocol
import torch
from torch import Tensor, nn
from elasticai.creator.base_modules.math_operations import (
ParamExponent,
Quantize,
TwosScale,
)
class MathOperations(Quantize, TwosScale, ParamExponent, Protocol): ...
class PReLU2(torch.nn.PReLU):
def __init__(
self,... |
c520257eb2dbb17c9ef793b34265a37ab3461dfb167b9f642ef95dbdf86888ad | Python | 1,110 | 39 | import serial
import serial.tools.list_ports
arduino_ports = [
p.device
for p in serial.tools.list_ports.comports()
if 'Arduino' in p.description]
if not arduino_ports:
raise IOError("No Arduino found")
if len(arduino_ports) > 1:
warnings.warn('Multiple Arduinos found - using ... |
0c27271ab39a1616f7867ab1592c095a710c126b7be49938ade57c64096abbfb | Python | 1,111 | 39 | from collections.abc import Mapping, Sequence
from torch import nn
class Task(nn.Module):
_option_members = set()
def _standarize_option(self, x, name):
if x is None:
x = {}
elif isinstance(x, str):
x = {x: 1}
elif isinstance(x, Sequence):
x = dic... |
a1c76863842de4176706475300688c7c42de254273b181d19afed203eda56d65 | Python | 1,111 | 28 | """Tests for cli.py's CLI-replay string, threaded into metadata["cli"] so the
report's "Reproduce this run" section can render a Command block.
Headless: only the pure ``_cli_replay_string`` helper is exercised. No
registration runs.
"""
from regtools.registration.cli import _cli_replay_string
def test_ex... |
b86475a252233fe377a00bf5f2325988e15c0ac3a39b29e25e66dcb9b0f76c0d | Python | 1,111 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.BACE")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class BACE(data.MoleculeDataset):
r"""
Binary binding results for a set of inhibitors of human :math:`\be... |
ecf1067770fdf3d5fd74e7e84d233260f9040c9444eb85709a172325e1051893 | Python | 1,111 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
ee80c56943d77c798d836a981aafd53fa3a0adaa532655ef7b1ae65ac431d29c | Python | 1,111 | 32 | from pylearn2.utils import serial
import sys
_, model_path = sys.argv
model = serial.load(model_path)
from pylearn2.gui.patch_viewer import make_viewer
space = model.generator.get_output_space()
from pylearn2.config import yaml_parse
import numpy as np
dataset = yaml_parse.load(model.dataset_yaml_src)
dataset = datase... |
fb3a87c392ff1827356b835e11896b72682ca016439be5c4437a5159cdb9e74e | Python | 1,111 | 39 | # 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... |
837009a0470b6bbd4634288ff2cae4c8f77b71139c7d35a0367fbbe48a01b184 | Python | 1,112 | 52 | from contextlib import contextmanager
from time import time
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
@contextmanager
def tictoc(text=""):
print("--- Start clock ---")
t1 = time()
yield
dt = time() - t1
print(f"--- Stop clock {text}: {dt} seconds el... |
03c3159337ff8efe8db0e6ab57cf3d4d1bd651051d3065539e7319abd5784b26 | Python | 1,113 | 42 | import sys
from pybioshell.core.data.io import Pdb
from pybioshell.core.calc.structural import evaluate_phi, evaluate_psi
if len(sys.argv) < 2 :
print("""
Calculates Phi, Psi dihedral angles of a given input PDB structure.
USAGE:
python3 phi_psi.py input.pdb
EXAMPLE:
python3 phi_psi.py 2gb1.pdb
CATEG... |
1735a496292cb25ab119a1a6ecf31950e7eb0c189cc2bfce94177fe871afe672 | Python | 1,113 | 41 | """
set of utility functions
@author: trianaa1
"""
import os, glob
import pandas as pd
import numpy as np
from scipy.io import loadmat
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as md
import matplotlib.transforms as mtransforms
import matplotlib
def find_missing... |
47c961711d0db54793e3324d8cfa433bad07cb4c6afd1bea5bb4996cbb7818e1 | Python | 1,113 | 37 | #!/usr/bin/python
# sbm version 1.1, release date 30/05/2012
# Copyright 2012 Aurelien Decelle, Florent Krzakala, Lenka Zdeborova and Pan Zhang
# sbm 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 vers... |
5a7a63675ab3757bfca288a9b9560d3664ce602840825a4581fa6fbe51c91929 | Python | 1,113 | 36 | from median.median import Median
nm7 = Median(L=7, dtype=int, initB=[5, 7, 8, 8, 9, 10, 11])
def update_desc(buffer: Median, value: float | int):
print(f"Insert: {value:>3}")
print(f"Before: | {' | '.join([f'{i:>2}' for i in buffer.getBuffer()])} |")
buffer.update(value)
print(f"After : | {' | '.join... |
94bbdbd6e5a8bdc4c91b8a3c42983e0d65c6c1705c36ad1fd64117765a690d20 | Python | 1,113 | 32 | # Takes .json file from XGBoost model and generates a bar graph of feature weight.
import xgboost as xgb
import matplotlib.pyplot as plt
import seaborn as sns
# Load XGBoost model
bst = xgb.Booster()
bst.load_model("xgboost.otherhalf.hifi.100rds.json")
# Get feature score and pull out weight values
feature_scores = ... |
def1206af4b089580809b40e04acc23a057b755935e1ac24d82c8a584e15c42d | Python | 1,113 | 32 | from sitetack.app.enums import PtmKind, OrganismKind, LabelKind, kind_to_dict
class TestEnums:
def test_kind_to_dict_labels_has_correct_element(self):
d = kind_to_dict(LabelKind)
assert d["NO_LABELS"] == {
"name": "No Labels",
"filename_query": "no_labels",
"... |
525a7b0cf58c813691e94b80ddaf9c1bc7a4a131c5b3b86d4d1f712a009b67b4 | Python | 1,115 | 39 | from . import loadDefaultParams as dp
from . import timeIntegration as ti
from ..model import Model
class FHNModel(Model):
"""
Fitz-Hugh Nagumo oscillator.
"""
name = "fhn"
description = "Fitz-Hugh Nagumo oscillator"
init_vars = ["xs_init", "ys_init", "x_ou", "y_ou"]
state_vars = ["x", "... |
5be95cc78f1ab87583b6ad7e5ce39959ce838f191f31bc643741924eacb49d63 | Python | 1,115 | 28 | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
24ed161d6774258196bb31745f5411b57f0223cabb3f9f8678e82bf507916991 | Python | 1,116 | 42 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import torch
from torch.utils.data import Dataset
import os
from PIL import Image
from torchvision import transforms
import numpy as np
from datasets.sequence_aug import *
class dataset(Dataset):
def __init__(self, list_data, test=False, transform=None):
... |
494781f1de97ffcb9d9761ca5ac1d92618a40d7f24c444bd191946191493d345 | Python | 1,116 | 49 | from __future__ import annotations
from quacc.utils.lists import merge_list_params
def test_merge_lists():
a = ["a", "b", "c"]
b = ["b", "c", "d"]
c = ["c", "d", "e"]
assert merge_list_params(a, b, c) == ["a", "b", "c", "d", "e"]
a = ["a", "b", "c"]
b = ["b", "c", "d"]
c = ["C", "d", "e"... |
ac3fb17235c1952118f83271508350e50dda1b6fa9774fd66daa2b7e186ed84e | Python | 1,116 | 52 | from pytest import raises
from wonambi import Dataset
from wonambi.attr.chan import create_sphere_around_elec
from wonambi.attr import Freesurfer, Surf
from wonambi.source import Morph
from wonambi.utils import create_data
from .paths import (fs_path,
surf_path,
eeglab_hdf5_1_f... |
2a33d638a7387d3bf305dc67d77bd2e4d22bd493d4e971c96a92c9f465b35033 | Python | 1,117 | 40 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import common_setup
from common_setup import IssueConfig, IssueExperiment
import suites
heuristics = [
"{}(cache_estimates=false)".format(h) for h in (
"pdb", "cpdbs", "diverse_potentials", "all_states_potential",
"initial_state_potential", "sample_b... |
8b7b3f0d3303b6f92754e5a82e6ee08d311c54cbe990415f79d15077cd3bc97b | Python | 1,117 | 36 | import cv2
class MyVideoCapture:
def __init__(self, video_source=0):
# Open the video source
self.cap = cv2.VideoCapture(video_source)
print(f'video capture {video_source} {self.cap.isOpened()}')
if not self.cap.isOpened():
raise ValueError("Unable to open video source"... |
8bfa5bd4cdf67b9c89cb08104ee73dc3f2d47cc43b674429b5820d9b4a28e826 | Python | 1,117 | 40 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import common_setup
from common_setup import IssueConfig, IssueExperiment
import suites
heuristics = [
"{}(cache_estimates=false)".format(h) for h in (
"pdb", "cpdbs", "diverse_potentials", "all_states_potential",
"initial_state_potential", "sample_b... |
14ce3f1f1d7a84af065b83fa4ca1adc9b9fe11bbaa2b3eb49345b6530c191288 | Python | 1,118 | 42 | import pandas as pd
import numpy as np
from steps.methods.metric_factory import external_factory
class Tester:
'''
A class to test the alignment of a given hypothesis (i.e. a discrete annotation)
with a given cluster assignment
'''
def __init__(self,
hypothesis: str,
... |
517cf08dab5c65b85156558bbdeba74bb4f8470249248134363d727b53ea2bd6 | Python | 1,119 | 48 | import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.test_util import check_grads
npr.seed(1)
def test_real_type():
fun = lambda x: np.sum(np.real(x))
df = grad(fun)
assert np.isrealobj(df(2.0))
assert np.iscomplexobj(df(1.0j))
def test_real_if_clo... |
aaed39104510f793d65617f1c4ff2f9914f9593c280ed72d4df744ac8085cdfa | Python | 1,119 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.Delaney")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class Delaney(data.MoleculeDataset):
"""
Log-scale water solubility of molecules.
Statistics:
... |
ab7367be26421c8333b86d78f31b67aeadfc7c991002013045ea858935d38b4d | Python | 1,119 | 67 | # Settings for cell types, model types, and cell numbers
params = {}
# Cell types to include
params["cell_types"] = [
"L23",
"L5",
"L6",
"I23",
"I5",
"I6",
"L23input",
"L5input",
"L6input",
"I23input",
"I5input",
"I6input",
]
# Model type of cells
params["model_types"]... |
e55cc412add4f552e67c537fa3c7c7aab188545062969b7963d5386cccee558f | Python | 1,119 | 43 | import io
import os
import re
from setuptools import setup, find_packages
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
return fp.read()
def find_version(*file_paths):
version_fi... |
f3c918df51494afa6f3a1aba96e86dfcfafe97585ba4a8066bcf591070048079 | Python | 1,119 | 37 | import mne
import logging
__version__ = '1.1.3'
def set_log_level(level: str = "INFO", third_party: str = "CRITICAL"):
"""
Set log level for torcheeg.
Args:
level (str): Log level. Choose one of ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"].
third_party (str): Log level for third par... |
377e9b16c0a72c6de308fde334a3980bff0a7f863a870c5e521c839e5088b5c8 | Python | 1,120 | 40 | import os
import random
import shutil
import unittest
import numpy as np
from torcheeg import transforms
from torcheeg.datasets import TSUBenckmarkDataset
def mean_reduce(eeg_list):
return np.array(eeg_list).mean(axis=0)
class TestSSVEPDataset(unittest.TestCase):
def setUp(self):
if os.path.exist... |
aeefd22a777fa92c3dff5dc1be324251cd388ec213962915cf24cbbf3c53f235 | Python | 1,120 | 41 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 26 13:01:34 2020
@author: david
"""
# Corregistration of MEG sensors and subject MRI (includes a manual step)
import mne
import os
import os.path as op
from stormdb.access import Query
from sys import argv
# set a few environmental variables to ma... |
d0dafff54233fa05b02abaf47b3931fa1ea78c654fa7479f3a326ae5d9309360 | Python | 1,120 | 30 | from IlluminaBeadArrayFiles import GenotypeCalls, BeadPoolManifest, code2genotype
import sys
import os
import glob
import argparse
parser = argparse.ArgumentParser("Generate a Callrate report from a directory of GTC files")
parser.add_argument("manifest", help="BPM manifest file")
parser.add_argument("gtc_director... |
f62c333fc08e0418161e38ccb9246e8ed45c7b11c68714923980961d3d36aab9 | Python | 1,120 | 42 | import torch
import torch.nn as nn
from model import const
class GCN(nn.Module):
"""Some Information about GCN"""
def __init__(self, in_feat, out_feat, order, As, operation='...cn, nm -> ...cm'):
super(GCN, self).__init__()
self.order = order
self.conv_operation = operation
s... |
5e6c0ae35b22e92b611f571e9b9b89a58eb35c61ff94253ffbe0bb4ec84b3df1 | Python | 1,121 | 37 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
8880d8a170b829c9c871ad80d948e1a4030143e2daad895035eda53a66d546f3 | Python | 1,121 | 39 | from pylearn2.utils import serial
import sys
_, model_path = sys.argv
model = serial.load(model_path)
from pylearn2.gui.patch_viewer import make_viewer
space = model.generator.get_output_space()
from pylearn2.config import yaml_parse
from pylearn2.gui.patch_viewer import PatchViewer
import numpy as np
dataset = yaml_p... |
9319aca60f42c2866f4b920cdbbc520c53a5a9ae4d7b9d91f8271ff3eb1f6469 | Python | 1,121 | 39 | from pylearn2.utils import serial
import sys
_, model_path = sys.argv
model = serial.load(model_path)
from pylearn2.gui.patch_viewer import make_viewer
space = model.generator.get_output_space()
from pylearn2.config import yaml_parse
from pylearn2.gui.patch_viewer import PatchViewer
import numpy as np
dataset = yaml_p... |
a5b4defe80be2f56a48ff6eb51df399ee5e335761086bc9bf8ba1e5e9569022b | Python | 1,121 | 34 | """
Created on Sun Dec 26 19:38:25 2021
@author: Haotian Teng
"""
import os
import sys
import argparse
from xron_model import MM_CONFIG
def main(args):
base_config = MM_CONFIG()
grid_key = [base_config.CNN['Layers'][0]['out_channels'],
base_config.CNN['Layers'][1]['out_channels'],
... |
00ad0c12fc8c5b43811bc8d3cef10989d11869838011fb4bcf2ca3bc15ca52f3 | Python | 1,122 | 49 | import time
import meep as mp
from meep import mpb
# Compute band structure for a square lattice of dielectric rods
# in air.
# Define various parameters with define_param so that they are
# settable from the command_line (with mpb <param>=<value>):
r = 0.2 # radius of the rods
eps = 11.56 # dielectric constant
k_... |
1a06599eb4353960d45016298a93fd3533af4753e25ca6603735804056e8f8e3 | Python | 1,122 | 38 | """
Bonito Aligner
"""
from threading import Thread
from functools import partial
from mappy import Aligner, ThreadBuffer
from bonito.multiprocessing import ThreadMap
def align_map(aligner, sequences, n_thread=4):
"""
Align `sequences` with minimap using `n_thread` threads.
"""
return ThreadMap(part... |
46fb8bdcda96ffbcb8113cb7f58ebb2581342bd981551cd8eb74d3bc37a6099a | Python | 1,122 | 39 | import bisect
import numpy as np
class CombinedScheduler:
def __init__(self, schedulers=None):
self.schedulers = []
if schedulers is not None:
for scheduler in schedulers:
if scheduler is None:
continue
elif hasattr(scheduler, 'sched... |
75efdea60ea19d5cc6fbc1a481c0854f7ca217083f2b07913bd9ee33a2e06d6d | Python | 1,122 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.CEP")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class CEP(data.MoleculeDataset):
"""
Photovoltaic efficiency estimated by Havard clean energy project.
... |
e140ff0829f0db8f4812c189fc229b0320356220a642bfbb662fba3a1a0badde | Python | 1,122 | 39 | from pylsl import StreamInlet, resolve_stream
import numpy as np
import asyncio
from ._messages import SampleMessage
from ._rate import Rate
import labgraph as lg
class LSLPollerConfig(lg.Config):
type: str = 'EEG'
sfreq: float = 500.
downsample: int = 1
class LSLPollerNode(lg.Node):
OUTPUT = lg.To... |
37cf3ac1733a5c3cc04e408ed6321e0567f945aa3eec386c1035398bb98a08ce | Python | 1,123 | 39 | import pandas as pd
from cuppa.components.prob_combiner import ProbCombiner
class TestProbCombiner:
def test_can_multiply_probs_without_zeroes(self):
probs = pd.DataFrame(
[[0.9, 0.8, 0.1, 0.2]],
columns=[
"dna_combined__Breast",
"rna_combined__Bre... |
a13b2992ae5d86aaed66f03bf7a27705a133efcffacc8c0026baaa5bf12c9769 | Python | 1,123 | 33 | from Artificial_Data_Generation.Patient import PatientDataBase
# mods: gaussian, rectangle, noise, noise_gauss
mods = 'rectangle'
DATA_PATH_IN = "../../data/input_data"
DATA_PATH_OUT = "../../data/output_data/" + mods
ct_data_out = "../../data/output_data/png_org"
if __name__ == '__main__':
print('start initiali... |
c6f616e2ff17b184386628a4c8e2573c6ee087dcc98dd706501935e04ef95f2d | Python | 1,123 | 34 | from typing import Any, Callable
from elasticai.creator.ir2vhdl import Instance, LogicVectorSignal
from elasticai.creator.ir2vhdl import Node as VhdlNode
from .node_factory import (
InstanceFactoryForCombinatorial,
)
@InstanceFactoryForCombinatorial.register("output")
@InstanceFactoryForCombinatorial.register("... |
a302b76d2968f98788371b5aa7cd6fb7a45840d613807687f4bc83ceb2566650 | Python | 1,124 | 31 | import torch
def scaling_M(
M: torch.FloatTensor,
error_threshold: float = None,
m_q_shift_threshold: int = None,
):
assert torch.all(M > 0), "M should be positive"
M = torch.round(M * 10**5) / 10**5
m_q_shift = torch.tensor(1, dtype=torch.int32)
m_q = torch.tensor(
0, dtype=torch.... |
fee1e71a1d6fc7ac2996d79b062e74788a014379d7b50b9d3a80b571c3ed29a7 | Python | 1,124 | 43 | # coding: utf-8
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import time
class Timer(object):
"""A simple tim... |
5e54aee32d19f78bebaaceb514517f48b2080a1cd7e0396ef3a5d4f7536d287e | Python | 1,125 | 37 | import unittest
from torcheeg.datasets import (BCICIV2aDataset, StrokePatientsMIDataset,
StrokePatientsMIProcessedDataset)
class TestMotorImagery(unittest.TestCase):
def test_bciciv_2a_dataset(self):
kwargs = {
'record': 'fake_record',
}
kwargs.... |
70976f87cec87d9a29fe583b2b9bc96b13398752696453911ed0e5e1a72dc1de | Python | 1,125 | 34 | #! /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... |
76d0a292f92184b585bcd3be5d4d71164552b88c170b24d4c12a9c9d74661d3e | Python | 1,125 | 43 | # pylint: disable=too-many-function-args, invalid-name, unused-argument
""" FBIRN ROI dataset loading script"""
import numpy as np
import pandas as pd
from omegaconf import DictConfig
from src.settings import DATA_ROOT
def load_data(
cfg: DictConfig,
dataset_path: str = DATA_ROOT.joinpath(
"fbirn_ro... |
a1df38ff870831a68192f6041c7405c47dd5b5af889a66a9074598abcb342a63 | Python | 1,125 | 38 | """
Handy functions for flattening nested containers containing numpy
arrays. The main purpose is to make examples and optimizers simpler.
"""
import autograd.numpy as np
from autograd import make_vjp
from autograd.builtins import type
def flatten(value):
"""Flattens any nesting of tuples, lists, or dicts, with ... |
63cb04269890832599765aab37b945f6408330b2f268d1efcc69e660c48f28c9 | Python | 1,126 | 46 | """Test interfaces."""
from copy import deepcopy
import numpy as np
from console.interfaces.dimensions import Dimensions
generator = np.random.default_rng()
def test_dimensions_from_dict():
"""Test creations of dimensions object from dictionary."""
x, y, z = generator.random(3)
dim_dict = {"x": x, "y":... |
7efa8ec5f5085777db1d8de63c3d7ed806741b53d2846d598f919d111cf43b78 | Python | 1,126 | 24 | #
# 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,... |
9480a21ee5d597744e60e0d6b41a603522a3554ad57c540591b4fff9aff171ea | Python | 1,126 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.ChEMBLFiltered")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class ChEMBLFiltered(data.MoleculeDataset):
"""
Statistics:
- #Molecule: 430,710
... |
c93a4ab8a54b1da487c2a41e0195e3d42f7ecbfb481c5ad5d41df859f710b54a | Python | 1,126 | 37 | """PyNEST Mesocircuit: Run Live Paper Simulation
------------------------------------------------
Mesocircuit with evoked activity for live paper.
This script needs to be executed before `live_paper_plotting.ipnb`.
"""
from mesocircuit import mesocircuit_framework as mesoframe
import parametersets
#################... |
9e6c88c76b961b82f75b8a761c1212077d4ccb7281462b4963e3da7eed925ab3 | Python | 1,127 | 46 | # Configuration file for the Sphinx documentation builder.
# -- Project information
project = "disperseNN2"
copyright = "2023, The disperseNN2 authors"
release = "0.1"
version = "2.0.0"
# -- General configuration
extensions = [
"sphinx.ext.duration",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sph... |
b73f10d14fad86cc2db800ac2e5e1a04a8b2a7094a11a64a7e1c1685a7696027 | Python | 1,127 | 30 | def cartesian_product(sequences):
# TODO: Rename this. It's not good that we have two functions
# called "product" and "cartesian_product", of which "product"
# computes cartesian products, while "cartesian_product" does not.
# This isn't actually a proper cartesian product because we
# concatenate... |
333e7a30357c5bd1556afac56af1bad826b0c00527700f6e9dfac37f2f3b2208 | Python | 1,128 | 38 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"]
REVISIONS = ["issue714... |
d11754fbf613c222bd7d74946c74c764d276a87037c0d215a612c8720b97656b | Python | 1,128 | 45 | from PIL import Image
import numpy as np
import h5py
import os
import sys
import cv2
# Maybe consider implemeting more involved auto-balancing
# http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button
def apply_clahe_to_H5(fn, clahe):
f = h5py.File(fn, "r+")
img... |
129213e7ed902de5e04acb42fb33245450a52f6853951dae806ee82b6e147611 | Python | 1,129 | 26 | """
Find which probability threshold for spike detection has the best results
"""
from src.model import ModelSpikeSorter
from src.data import RecordingCrossVal
model = ModelSpikeSorter.load(r"/data/MEAprojects/DLSpikeSorter/models/v0_4/2954").to("cuda")
recording_cross_val = RecordingCrossVal(sample_size=model.sample... |
15571089b4bb537c2defc436c9718e96af52d398dbd1d54e9ed89b1ccf2632f9 | Python | 1,129 | 24 | # Dictionary with RepeatMasker files urls for each genome assembly, along with
# the number of lines taken by the header.
__genomes__ = {
# human
'GRCh38': ('https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.out.gz', 3),
'hg38': ('https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.... |
2d04475efe9d10fb2bdf5c99da6716f88d882b69893d6e06717773a51abef121 | Python | 1,129 | 24 | #
# 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,... |
5100d299a68e48fee1120077387f2dd8e8ec2ebd5142fa791401ae0bf7bc21e9 | Python | 1,129 | 46 | # Get ERPs from cleaned epochs
from base.files_in_out import GetFiles, filter_list
import evoked.evoked_constants as cs
import base.base_constants as b_cs
from evoked.evoked_MNE_helper import EpochGroup
import gc
import mne
# In[Get list of epochs]
import os
import platform
platform.system()
# define starting da... |
8d833874560d15720af1bfbaf06db6e4032562aec6e3385545953c894f01594c | Python | 1,129 | 34 | """Flash residual pixel artifact correction."""
import numpy as np
from . import lib
def quickCamcor(imstack: np.ndarray, camparams: np.ndarray) -> np.ndarray:
"""Correct Flash residual pixel artifact on GPU."""
if not imstack.ndim == 3:
raise ValueError("imstack must be 3D")
camcor_init(imstack... |
09b03c1ef092b1f29debf4d90d12be2c06e4eef2ab9d359c863fcca8b17bcdfc | Python | 1,130 | 32 | import math
import matplotlib.pyplot as plt
from scipy.stats import vonmises
input_data_file = "test_inputs/THR_chi1.dat" # The same input file as was used to run ap_chi1_rotamers_estimation
n1, mu1, kappa1 = 16156, -1.04831, 75.4575
n2, mu2, kappa2 = 18211, 1.07518, 50.7715
n3, mu3, kappa3 = 2953, -3.02569, 19.5993
... |
151f8199dc7fdc8339f478d671b58e9c0d546316efcbe6919daf4249ebc18ad7 | Python | 1,130 | 39 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = ... |
5640e0fe1d9b4ca114216bb5dd3102e8bc2cf5a2da7b743e12c781221188d456 | Python | 1,130 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.Lipophilicity")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class Lipophilicity(data.MoleculeDataset):
"""
Experimental results of octanol/water distributio... |
df758f36bba66d4683619ed9fb584d70cf0a4c5f627a18e282967780b5e378fb | Python | 1,130 | 29 | import os
import pandas as pd
import numpy as np
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
BASE_PATH = os.path.join(os.environ['WORKSPACE'], 'results/')
DATASETS = {
'w3c-bins1': BASE_PATH + 'w3c/analysis/mappers_w3c_bins1.json/',
'w3c-bins2': BASE_PATH + 'w3c/analy... |
ee31277741dc11d8653e6c495ccdea2fa77a7f9206a04abb8bc794d9c02f34c5 | Python | 1,130 | 27 | __all__ = [
'__version__', '__doc__',
'io', 'mouse', 'get_expression_data', 'get_samples_in_mask',
'get_interpolated_map',
'keep_stable_genes', 'normalize_expression', 'remove_distance',
'fetch_desikan_killiany', 'fetch_gene_group', 'fetch_microarray',
'fetch_raw_mri', 'fetch_rnaseq', 'fetch_fre... |
e193f2209530cd8e9f8ef780137449a75cad2c99e8ec1c70d5b14f5c8ab4966f | Python | 1,131 | 38 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = ... |
81c73a40391c80730eb809f9531699c004adb1106b9c64a7ff2c634b9ec92283 | Python | 1,132 | 41 | from optparse import Values
from typing import List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.exceptions import CommandError
class HelpCommand(Command):
"""Show help for commands"""
usage = """
%prog <command>"""
ignore... |
8721a196799c264c6bc8904a0b75f9167129877ef9910a0bfe61bc2d952e5e06 | Python | 1,132 | 57 | # coding: utf-8
from .exceptions import *
from .ext import ExtType, Timestamp
import os
import sys
version = (1, 0, 5)
__version__ = "1.0.5"
if os.environ.get("MSGPACK_PUREPYTHON") or sys.version_info[0] == 2:
from .fallback import Packer, unpackb, Unpacker
else:
try:
from ._cmsgpack import Packer,... |
1d5d1f17ff309ceb09747c96e98ac0ef5a9475b96cc0c1f4405c6f8e1c34a240 | Python | 1,133 | 31 | import bpy
def check_online_access_for_ui(layout: bpy.types.UILayout) -> bpy.types.UILayout:
"""
Disable UI without Online Access
Checks for the online access permissions, and adds a warning and disables following
UI elements if it fails the check. Returns the UILayout that will have .enabled flag
... |
87af64c146cde47dc6b97ecfd77b82586b1b91bc2775191889ee680f55e866bf | Python | 1,133 | 41 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' Compute Boundary Element Model for inverse solution '''
"""
Created on Thu Nov 18 14:08:04 2021
@author: david
"""
import os
import os.path as op
from stormdb.process import Freesurfer
from stormdb.access import Query
from sys import argv
proj_name = 'MINDLAB2020_ME... |
1a746427f60f9b5983d292f72291692b7a2d88ebf93afe933bc55d495ea95b44 | Python | 1,134 | 41 | from __future__ import annotations
from importlib.util import find_spec
from pathlib import Path
from shutil import rmtree
TEST_RESULTS_DIR = Path(__file__).parent / "_test_results"
TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch"
has_ray = bool(find_spec("ray"))
if has_ray:
def pytest_sessionstart()... |
0802b0ecb521c9857e776527640052c68d9ce3163881d5fb6feeb23803f45ed7 | Python | 1,135 | 34 | import argparse
from dataset import TCGA_Project_Dataset
import dataset as module_dataset
import datasets_manager as module_datasets_manager
from parse_config import ConfigParser
from utils import set_random_seed
SEED = 1126
set_random_seed(SEED)
def main(config):
Datasets = {project_id: config.init_obj(
... |
2bdb7f8c9bcf452843f5d27561310f6c5ccfef0ea26be5a0ead7a58a0973bade | Python | 1,135 | 39 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = ... |
afc7663ca76489993c014a6438760e28fed6596787b6fa3924fc64c85b3c95bc | Python | 1,135 | 24 | #
# 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,... |
9c43c73168c52077abad5150a7aeca387133035d6b4ced3838f49f3fdbc06af5 | Python | 1,136 | 42 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
a47f4a3e9984df9d62af23e8be9c7a131cc7d2167082dae3f528ee711d5352ff | Python | 1,136 | 49 | import numpy as np
def get_virtual_lidar_to_vehicle_transform():
# This is a fake lidar coordinate
T = np.eye(4)
T[0, 3] = 1.3
T[1, 3] = 0.0
T[2, 3] = 2.5
return T
def get_vehicle_to_virtual_lidar_transform():
return np.linalg.inv(get_virtual_lidar_to_vehicle_transform())
def get_... |
c7980dc95946d193b290845f0953a7f11d619d13d2ba9c254940557d88d2016b | Python | 1,136 | 42 | from __future__ import annotations
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from ts-workflow examples.examples.sample import add, divide, make_array
def test_add():
"""
Test that the addition function works.
"""
assert add(1, 2) == 3
def test_d... |
52e17ed604f1a04a91094245d0a4fb093eec794fef34bdaa0032ad18836d5733 | Python | 1,137 | 52 | from .data import (
cache_graph,
cache_mol,
MoleculeDatapoint,
MoleculeDataset,
MoleculeDataLoader,
MoleculeSampler,
set_cache_graph,
set_cache_mol
)
from .scaffold import generate_scaffold, log_scaffold_stats, scaffold_split, scaffold_to_smiles
from .scaler import StandardScaler
from .u... |
597599d70d0e2a272d6ab60bbe43c22576af7f4adc787c635fafd1cdbf36a738 | Python | 1,137 | 29 | """Guard the opt-in --deterministic env pinning in scripts/run_tests.py.
The point of _apply_determinism is that ITK reads its thread count once at import,
so the env must be pinned in the CHILD process's environment before the test
interpreter starts. This test just locks the exact keys/values it sets."""
impo... |
6876de62a7ed33cb725fcc272e302c1805dce0db690575740272c14802027420 | Python | 1,137 | 49 | from numpy import isnan
from wonambi import Dataset
from wonambi.ioeeg import write_edf
from wonambi.ioeeg.edf import remove_datetime
from wonambi.utils import create_data
from .paths import (psg_file,
generated_file,
EXPORTED_PATH,
)
psg = Dataset(psg_fil... |
9bd17a73387cea58dc080ada349ffc21dbc8c7494ac2ff48048a5637676a3ce3 | Python | 1,137 | 28 |
import sys
import json
from pathlib import Path
import pandas as pd
import os
from itertools import combinations
import random
def main():
pombe_biogrid_file = "/home/grads/tasnina/Projects/ICON/datasets/pombe/networks/all_networks.txt"
nets_df = pd.read_csv(pombe_biogrid_file, sep='\t')[['System... |
547ba5519e1414b14b7aa47a0a4860333bbbb16a03858afdaba66e8cea2b1c77 | Python | 1,138 | 42 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment, RelativeScatterPlotReport
DIR = os.path.dirname... |
de4e70a53046bf43839d6cc6f89ed829196a02ea681cf42cf683580888146a1b | Python | 1,138 | 45 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from common_setup import IssueConfig, IssueExperiment, is_test_run
BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"]
REVISIONS = ["issue698-base", "issue698-v1"]
CONFIGS = [
IssueConfig... |
143068a1f744a1e9f67cbfa4dbcd937b3d19fdce0175fdd7552db92a1b46fae8 | Python | 1,139 | 39 | from __future__ import annotations
import contextlib
from importlib.util import find_spec
from pathlib import Path
from shutil import rmtree
TEST_RESULTS_DIR = Path(__file__).parent / "_test_results"
TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch"
has_distributed = bool(find_spec("dask.distributed"))
if ... |
15a9565b90347de8d60c43af8cb9ca4d43e69f38efef1a956cedb9337cda25f1 | Python | 1,139 | 40 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
from pathlib import Path
from quacc import flow, job
from quacc.utils.files import copy_decompress_files
def test_copy_files(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
@job
def create_file(name: str, copy: ... |
6e8f9d14593a62aa99a6578468c703149477a0a93be6a9ec7712b89726f4b7fe | Python | 1,139 | 39 | from . import loadDefaultParams as dp
from . import timeIntegration as ti
from ..model import Model
class WCModel(Model):
"""
The two-population Wilson-Cowan model
"""
name = "wc"
description = "Wilson-Cowan model"
init_vars = ["exc_init", "inh_init", "exc_ou", "inh_ou"]
state_vars = ["e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.