sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
befe53fac4834842be65a6b71577a52352f82d9e63b83cb2a13f9d96700b7eb4 | Python | 1,728 | 69 | import sys
from pybioshell.core.data.io import read_fasta_file, Pdb
if len(sys.argv) < 3 :
print("""
Reads a FASTA file with two aligned sequences: a query and a template, and a template structure.
Prints a partial thread of the template, i.e. the fragment of a template structure that is
aligned with a query
US... |
e66b54811bd5491306dc71695c9bed9ca7f7dc06d6adb0afb60efd02b7439ed3 | Python | 1,728 | 41 | import json
import time
from pathlib import Path
import numpy as np
from pyproteonet.data import Dataset
from pyproteonet.imputation import impute_molecule
from gnn_imputation import impute_gnn
COMPETITOR_IMPUTATION_METHODS = ['median']#['mindet', 'minprob', 'median', 'knn', 'missforest', 'bpca', 'isvd', 'vae', 'dae... |
a39733920b3639f1393235a9e0baaffd05439b4cfc66a884575a8ab03a998e7e | Python | 1,730 | 58 | import time
from urllib.error import URLError
import anndata
import numpy as np
import pandas as pd
import pytest
from anndata import AnnData
from pubchempy import PubChemHTTPError
from scipy import sparse
import pertpy as pt
NUM_CELLS = 100
NUM_GENES = 100
NUM_CELLS_PER_ID = NUM_CELLS // 4
pt_compound = pt.md.Com... |
51d19b0a16a5a754faba88e01ad286891d07143f6ce776a6cf233e09e561becb | Python | 1,731 | 47 | import flax
from netket import jax as nkjax
from tre_tvmc.driver.utils import safe_log
def make_logpsi_U_afun(logpsi_fun, U, variables):
"""Wraps an apply_fun into another one that multiplies it by an
Unitary transformation U.
This wrapper is made such that the Unitary is passed as the model_state
o... |
22792f6de708ed019eb1632efec9636e169055668483684badd2bca2baefb4c2 | Python | 1,733 | 48 | import numpy as np
from merlin.analysis import testtask
from merlin.plots import testplots
from merlin import plots
def test_metadata(simple_merfish_data):
randomTask = testtask.RandomNumberParallelAnalysisTask(simple_merfish_data)
randomMetadata = testplots.TestPlotMetadata(randomTask,
... |
e44c2c14902e4e4e1efa32f0e711c6e42fa4158007da3500fc60bc372d42d8a4 | Python | 1,733 | 56 | #!/usr/bin/env python
import itertools
import os
import sys
from glob import glob
import click
import numpy as np
import tifffile as tiff
from rich import print, traceback
@click.command()
@click.option("-i", "--imgs", required=True, type=str, help="Path to image files")
@click.option("-u", "--uncert", required=Tru... |
f247f0b6a0528d3e8afd60f6c56a02da9ccd7f08ddaa6584e4d0334393d7c1cc | Python | 1,733 | 49 | from assemblyfire import Assembly, AssemblyGroup, ConsensusAssembly
import numpy
all_gids = list(range(500))
rnd_gids_a = [numpy.unique(numpy.random.randint(0, 500, 75)) for _ in range(3)]
rnd_gids_b = [numpy.unique(numpy.random.randint(0, 500, 75)) for _ in range(5)]
assemblies_a = [Assembly(gids, index=(0, i)) for ... |
60041fe86242880e69ac45674765b55615527664f0164fd73834178ae871a49f | Python | 1,734 | 54 | """
This script generates the surrogate data for H5, H6, and H7. It already organizes
the data in lags.
author: @trianaa1
"""
import sys
import numpy as np
import pandas as pd
import pickle
from scipy.stats import zscore
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/... |
6f46b66299106b48c137a3f5dd519c131f533ce5ed5678db4e5afe49d287a3d8 | Python | 1,734 | 40 | """Offline recording validation and thread-safe telemetry software tests."""
import json
from concurrent.futures import ThreadPoolExecutor
import pytest
from liquidaion_fly.recording import OfflineReplay, SessionRecording, load_recording
from liquidaion_fly.telemetry import Telemetry
def test_recording_roundtrip_sn... |
9bace4f33bafd29983de7afa23abaa5f0bbf100ad83b612b237c4672af4078b8 | Python | 1,734 | 75 | """Math utils functions."""
import torch
import numpy as np
def identity(x):
return x
def cosh(x, clamp=15):
return x.clamp(-clamp, clamp).cosh()
def sinh(x, clamp=15):
return x.clamp(-clamp, clamp).sinh()
def tanh(x, clamp=15):
return x.clamp(-clamp, clamp).tanh()
def arcosh(x):
return Arco... |
fd02c0b5c05a50137336b7051ebf6e68c0db5bb339e3b909cff22a09834f9371 | Python | 1,734 | 46 | #
# 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,... |
26f13d39447f99965eb896a6560747e4939e8d9ebb9497a48f94aff1ec111599 | Python | 1,735 | 61 | import pytest
from regtools.registration.cli import build_parser, _build_affine_overrides
def test_affine_method_default():
args = build_parser().parse_args(["--fixed_image", "f.nii.gz", "--moving_image", "m.nii.gz"])
assert args.affine_method == "default"
assert _build_affine_overrides(args) == ... |
ebbf01af8204487340e088a02e2b3d8890da126a92a684cf8269df6e79726f37 | Python | 1,735 | 62 | #!/usr/bin/python3
import sys
import argparse
import os
import subprocess
def clump_snps(results,
outfile,
bfile,
p1 = None,
r2 = None,
snp_field = None,
p_field = None):
cmd = ["plink", "--clump", results, "--out", ... |
1b254a7916ace01e62e683587a684e894e1b0670c3a11b7f7eab7772f1679437 | Python | 1,736 | 55 | #! /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_D... |
42499b22c0a86a6f035e23ccf9315f01bee89e7eff0bcdac8b9c3ee1774894fe | Python | 1,736 | 72 | 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... |
674736a6ea25b1eda82702b21a950fc6701e7cc79efe9372e89ab2c65c2301b7 | Python | 1,736 | 51 | import os
import requests
from tqdm import tqdm
# Function to download the file with a progress bar
def download_file(url, dest_folder, filename):
if not os.path.exists(dest_folder):
os.makedirs(dest_folder)
file_path = os.path.join(dest_folder, filename)
# Check if the file already ex... |
a8d77cd3c126e45d03474d3f91f36212d1dbb34dd30f8c83f0dd0a296b7855e2 | Python | 1,736 | 80 | from __future__ import annotations
import pytest
ray = pytest.importorskip("ray")
from ase.build import bulk, molecule
from quacc.recipes.emt.core import relax_job, static_job # skipcq: PYL-C0412
from quacc.recipes.emt.slabs import bulk_to_slabs_flow # skipcq: PYL-C0412
def test_tutorial1a(tmp_path, monkeypatch... |
5049832bb9246e62ff761e3b82eb9da13405d33bb30d9946df13ba7d14671b39 | Python | 1,737 | 57 | from pathlib import Path
from typing import Any
import elasticai.creator.ir2verilog as ir
from elasticai.creator.file_generation import find_project_root as get_path_to_build
from elasticai.creator.ir import Registry, attribute
from elasticai.creator.ir2verilog import Ir2Verilog, factory
def translate_path_to_int(pa... |
bf99a2d9be208be26f5640aaa97b7655cd11871bbd754faaf814c6a85f2bb7a3 | Python | 1,737 | 54 | import numpy as np
from PIL import Image
from torch.utils.data import Dataset
def make_dataset(image_list, labels):
if labels:
len_ = len(image_list)
images = [(image_list[i].strip(), labels[i, :]) for i in range(len_)]
else:
if len(image_list[0].split()) > 2:
images = [(val.split()[0... |
c4cd9383e77ffbf2fb65f0940f60606b29e087cd67bc0e5e8a91a8e4a6daf6a7 | Python | 1,738 | 46 | class ActivationsAndGradients:
""" Class for extracting activations and
registering gradients from targetted intermediate layers """
def __init__(self, model, target_layers, reshape_transform):
self.model = model
self.gradients = []
self.activations = []
self.reshape_transfo... |
f1a5527a2500fb1650ecfed2d6701559306429dd84f44bbe004ae3af7c5cb50b | Python | 1,738 | 56 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 21 15:40:00 2021
@author: CY
"""
import torch
import torch.nn.functional as F
import numpy as np
def per_class_iu(hist: np.ndarray) -> np.array:
"""
:param hist: bin count matrix of size CxC where C is the number of output classes.
:return: list ... |
921d83b3c64ed25528da12c7701b0751665d2e75f578f30bc60737ee1d472b82 | Python | 1,739 | 73 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os.path import abspath, dirname
from datetime import datetime
now = datetime.now()
# make sure that we're in the source directory
# so that it's consistent between read the docs and local
cur_dir = abspath(dirname(__file__))
import wonambi
# -- General configurati... |
ce2680c8f52800010ecc6b5a2d75066a02cf7bdb766521315689d0d97d29fb06 | Python | 1,739 | 43 | from collections import defaultdict
from pddlstream.utils import INF
from pddlstream.language.constants import is_parameter, Head
from pddlstream.language.conversion import obj_from_pddl
def extract_function_result(results_from_head, action, pddl_args):
import pddl
if action.cost is None:
return None... |
4c1b6d1cdf3188d5bb550723987a8de52023fbaf015b5c9c197d79955d5fb7e9 | Python | 1,740 | 67 | """Processes ECoG and LFP data to generate Granger causality values."""
import os
import sys
from pathlib import Path
cd_path = Path(__file__).absolute().parent.parent
sys.path.append(os.path.join(cd_path, "coherence"))
from coh_connectivity_processing import granger_processing
from coh_loading import load_preproces... |
5b3b7665e9078e08ad62c86e592d1cce856df21e4dfebca807a79f3169b905f2 | Python | 1,740 | 45 | """
"Test" is a loose term...
This outputs the grids and strips as they are interpreted from VOX_coords mother.
Meant to be used to visualize which bipolar pairs will be made.
Run with:
python test_vox_mother_converter <subject>
"""
from voxcoords_to_fs import *
def show_subgrids(lead):
"""
Shows all of t... |
755be86694d83a00126b938ecd8df7f894d38abef94a0cb67a4036c42a2e2503 | Python | 1,740 | 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... |
86221b5ce6cc371010142ecf81d5ebc290c5fda4f8e65dc49b6bafb2cfef270c | Python | 1,740 | 62 | #!/usr/bin/env python
from __future__ import print_function
import os
from pddlstream.algorithms.search import solve_from_pddl
from pddlstream.algorithms.focused import solve_focused
from pddlstream.algorithms.incremental import solve_incremental
from pddlstream.utils import read
from pddlstream.language.constants i... |
8fa6a9bbd8c47bd1503faf48efdcc1bd5d957c63ffe37fa28272a647dadd9358 | Python | 1,740 | 48 | import numpy as np
from scipy import ndimage
def gaussian_filter_3d(inp, sigmas, size, mode):
sigma = sigmas / size
return ndimage.gaussian_filter(inp, sigma, mode=mode)
def __triangle_filter_1d(inp, width, spacing, axis, mode):
x_lim = np.ceil(width / spacing) * spacing
x = np.arange(-x_lim, x_lim ... |
beec459723941f643cdbccb45931f7c2ee06b8c6ee496e123e23c8fb15e4d511 | Python | 1,740 | 59 | #!/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 = 4 # model 4
arg... |
33634eaccf9feeb778b3db80ab914e8a79350cc0285eaa6c79d2a3d1291c1f12 | Python | 1,741 | 60 | """
Base Buffer class
"""
import numpy as np
class Buffer:
"Buffer"
def __init__(self, L: int = 62, dtype: type = float, initB=None):
if isinstance(initB, type(None)):
self._buffer = np.zeros(L).astype(dtype)
self._L = L
self._dtype = dtype
else:
... |
3ad2a2ee90432020b0546f42ddf5a88334a049f25954ef539b142f9cefad33cb | Python | 1,741 | 65 | import math
import meep as mp
from meep import mpb
# Dielectric spheres in a diamond (fcc) lattice. This file is used in
# the "Data Analysis Tutorial" section of the MPB manual.
sqrt_half = math.sqrt(0.5)
geometry_lattice = mp.Lattice(
basis_size=mp.Vector3(sqrt_half, sqrt_half, sqrt_half),
basis1=mp.Vecto... |
073d04a06c7bdaddbfb52c92e86085ad2031f17e1a681d4bc595cbbe625f5e2c | Python | 1,742 | 55 | #! /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_D... |
5a9e02306a5021ef80316357af7a74a7193f3ae2f140894d3611e05f397e0e04 | Python | 1,742 | 65 | ##
# \file show_slice_coverage.py
# \brief Script to show slice coverage available over reconstruction
# space.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Feb 2019
#
import os
import SimpleITK as sitk
import pysitk.python_helper as ph
import niftymic.base.data_reader as... |
3994f7908ffc216eb4f9f989a9214d2a508574b123eb4dffddacad7060a9e663 | Python | 1,743 | 53 | import os
import csv
from tqdm import tqdm
import shutil
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.ZINC2m")
@utils.copy_args(data.MoleculeDataset.load_smiles, ignore=("smiles_field", "target_fields"))
class ZINC2m(data.MoleculeDataset):
"""
ZINC compound... |
62569047d1361153e689339217f35b735a79ef25279b8bd1b565d4d9a4f2410f | Python | 1,743 | 41 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import model.RNN.model as rnn
class LowResNet(nn.Module):
"""Some Information about LowResNet"""
def __init__(self, in_feat, hid_feat, num_RU, I, out_feat=1, dropout=0.0, **kwargs):
super(LowResNet, self).... |
8620188f1f24e334dc51197aa0b098168e811c30f68a7b4d3bfba97102ad869a | Python | 1,743 | 52 | import logging
import sys
from typing import Optional
logging.addLevelName(logging.CRITICAL, "[CRIT ]")
logging.addLevelName(logging.ERROR, "[ERROR]")
logging.addLevelName(logging.WARNING, "[WARN ]")
logging.addLevelName(logging.INFO, "[INFO ]")
logging.addLevelName(logging.DEBUG, "[DEBUG]")
logging.ad... |
8a29eeed73348626683a0c8542dd10048d421c88068bf1fa606d27408e7ff171 | Python | 1,743 | 63 | from zipfile import error
from control.toupcam import HRESULTException
def signed_to_unsigned(n, num_bits):
"""
Helper function to do 2s complement conversion on returned error codes.
Returns function as a string representation in hexadecimal form.
"""
return hex(n & ((1 << num_bits) - 1))
hres... |
9ef88eee00582d44e3ec97cd002fd297e6830ae89b378520c009fecd24dec4c5 | Python | 1,743 | 56 | import random
import unittest
import torch.nn as nn
import torch
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import GlowTrainer, CGlowTrainer
from torcheeg.models import BGlow, BCGlow
class DummyDataset(Dataset):
def __init__(self, length: int = 1... |
39030b30d25f24fa2370367205718b909b2559a12b4ebfcd3c45c37c6876255d | Python | 1,744 | 51 | """Self-contained HTML registration report (package).
Splits the former single ``report.py`` into focused modules:
``assets`` (embedding + CSS), ``figures`` (galleries + result GIFs),
``metrics`` (metric tables, headline, diagnostics, hemisphere), and
``render`` (document assembly + public builders).
Public AP... |
b66cd8b7763281fdb0ecb8830957cee25c46e179906404e0f5fa9c930f965300 | Python | 1,744 | 43 | import unittest
from hed import load_schema_version
from hed.models import DefinitionDict
from hed.validator.util import placeholder_tag
class TestPlaceholderTag(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.schema = load_schema_version("8.4.0")
cls.definitions = DefinitionDict(
... |
bd0ac7811f59f566a12a11d37b95fccd1a8c89cd7d5f70518628c9fd8c66036e | Python | 1,744 | 61 | # built-in
from math import isclose
# external
import hypothesis
import pytest
# project
import textdistance
ALG = textdistance.sqrt_ncd
@pytest.mark.parametrize('left, right, expected', [
('test', 'test', 0.41421356237309503),
('test', 'nani', 1),
])
def test_similarity(left, right, expected):
actual... |
4d6554d1b40cc4860d3a89b1a8ce77b6ce79a5160c7f63e6e37922fb2d685e4d | Python | 1,746 | 56 | from __future__ import annotations
from typing import Any
from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_enums import WikibaseSnakType
class String(BaseDataType):
"""
Implements the Wikibase data type 'string'
"""
DTYPE = 'string'
PTYP... |
8f75f79c30e9cf92553566ffe28833ab88db4a3ba44c48da6107804715f76d44 | Python | 1,748 | 65 | # Node group "CA Value Vector" (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 regenera... |
a3d7edc3cce63c783dcabd5ec543aab18f2fddba21c5b502ad386e2b46860d93 | Python | 1,748 | 56 | """OME-Zarr format converter module.
Public API:
- Conversion functions (no GUI/Qt dependency): ``write_ome_zarr``,
``convert_channels``, ``convert_tiff_dir``, ``convert_tiff_selection``,
``convert_nii``, ``convert_auto``, ``split_into_channels``,
``get_spacing_from_nii``; and for points: ``convert_point... |
01c42f9b18cfac78723644620ee6bc42fd3e73934904ef2a9d33e017272b0839 | Python | 1,749 | 41 | """The hed-tests test schemas, loaded from the vendored folder without the cache or the network.
hed-tests (the ``spec_tests/hed-tests`` submodule) ships load-ready XML for its test-only libraries
(testaux, testclash, testconflict, testminimal) and their standard partners under
``json_test_data/test_schemas/hedxml/``.... |
faba45b32a2fcb5da1d277d87d9778d9ffb698fcf005bb38e3d874b834dc215d | Python | 1,749 | 58 | #!/bin/env python
"""
OXASL - Quantification module
Fits a kinetic model to differenced ASL data
Copyright (c) 2008 University of Nottingham
"""
from oxasl import basil
try:
import oxasl_multite
except ImportError:
oxasl_multite = None
try:
import oxasl_ve
except ImportError:
oxasl_ve = None
def r... |
90b566b87ee58a96a5074c25af80ea791ca0f48838708db68a1b189cefb6ff1a | Python | 1,750 | 52 | import os
from torch.utils import data as torch_data
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.BinaryLocalization")
@utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",))
class BinaryLocalization(data.ProteinDataset):
"""
Simpler ve... |
e4242f8893a026de347bead4f78c9c873dfdade679a843ff3fb49087c9e1e099 | Python | 1,750 | 55 | extensions = dict(
extra_params=[('verbose', 'FALSE')],
skip_default_set_params_for=['training_frame', 'ignored_columns', 'response_column', 'max_confusion_matrix_size',
'distribution', 'offset_column'],
set_params="""
if (!missing(distribution)) {
warning("Argument distri... |
6028a0a86506d3645bf3f09e45c525504ddfc3b4f271bcfe15bcc7c6bf649cf0 | Python | 1,751 | 65 | ##
# \file binary_mask_from_mask_srr_estimator.py
# \brief Class to estimate binary mask from mask SRR stack
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date January 2019
#
import os
import re
import numpy as np
import SimpleITK as sitk
import pysitk.simple_itk_helper as sitkh
import ni... |
97c783f34acb0dec7369aa570c39b7159ad780a09dfff7abe0c237e989b9f3e0 | Python | 1,751 | 55 | # MEGIT utility and helper functions
import sys
import os
"""Function list:
mk_outdir(out_dir, err_msg='Invalid output directory!'): Create an output directory for data.
prog_print(iteration, total, prefix=str(), suffix=str()): Create a terminal progress bar for a loop.
"""
def mk_outdir(out_dir,... |
b756ff8dc139f1fcd7ab3bd6ffe7846f6d486f426ea2c12ce095551c425eb3f5 | Python | 1,751 | 45 | """
"Test" is a loose term...
This outputs the grids and strips as they are interpreted from VOX_coords mother.
Meant to be used to visualize which bipolar pairs will be made.
Run with:
python test_vox_mother_converter <subject>
"""
from vox_mother_converter import *
def show_subgrids(lead):
"""
Shows all... |
3b5430f67573467ba7eef669e1464cef0bc94aff56f78d66114f6e0cc9d8dc35 | Python | 1,752 | 47 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
7cc49f911912eb27cd7b62189f20e214e37787f9813e9033234729b1aa862f45 | Python | 1,752 | 44 | """
Created on Mon Mar 28 23:54:38 2022
@author: Haotian Teng
"""
import h5py
import numpy as np
from matplotlib import pyplot as plt
strides = 11
root = h5py.File("/home/heavens/Documents/UCSC_Run1_20180129_IVT_RNA_201.fast5",'r')
for read_id in root:
if read_id == "read_40634cc4-ff9c-41f3-bd2c-901cb23c0179":
... |
0d29666ff92164232015e53a461218e9ad469e924ba096eee20f5808d379013b | Python | 1,753 | 58 | import pandas as pd
import numpy as np
import pickle
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import torch
import scipy.io
from torch.utils.data import TensorDataset, DataLoader
from torch import Tensor
from torcheval.metrics import R2Score
from sklearn.metrics import r... |
1ab784f29dbe233d5a0c4996f972567703ffdb76ae886e2fed9bb35c3b979d2c | Python | 1,753 | 51 | """Cross-validation against pymovements' Engbert-Kliegl implementation.
These tests are skipped if pymovements is not installed (it's a test-time
dependency only). They feed identical pre-computed velocities into both
detectors and confirm the events match sample-for-sample on synthetic
microsaccades.
"""
from __futu... |
3716e935d06d5345452346ca7c67c39293fb4b6ffcffa1653bcedd547d28830b | Python | 1,753 | 47 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
862153eb0335ef8188c11bea0ec21cb8e73e743b2adae3ca30a6f257cfb55e77 | Python | 1,753 | 47 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
a50a02152aef05ed71c7831af7de9986558d2d79ec5de0046438edd5fb263fa0 | Python | 1,753 | 39 | import torch
import torch.nn as nn
from GlobalModel import MSTSDNModel
import utils
class Trainer:
def __init__(self, device: str, lr_rate: float, weight_decay: float, nodes: int,
seq: int, dim_k: int, heads: int, window_size: list,
mlp_ratio: float, adj_dim: int, r_mlp_... |
d01141a09ba10723d743f1494f2c11e01eb05ca604153aabef66a5e6d03e84db | Python | 1,753 | 75 | """
.. _cam_param_example:
Estimate camera parameters
==========================
This examples shows how to estimate the intrinsic parameters of a connected
Pupil Core world camera.
.. note::
This example requires the dependencies for
:ref:`streaming<streaming_dependencies>`.
"""
import sys
import logging
... |
120bde03ee6ce3a00f261f8eca09b0f65d5773cd9899e72e4a1ccfa7fa29a93b | Python | 1,754 | 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... |
d56b27fba8c1295d5b7bfb9b6fa1c516ec18529a9f34ab04e4505c1e3dff9e6d | Python | 1,754 | 40 | """
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 Found... |
0c20723fb49e75349e14ec5fc44a1bd54c018a76cc67b00f6398b7149cbae4e8 | Python | 1,755 | 67 | # 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... |
1e5aa1824aeac3c1109c8816d26bb95ff1bc60671555accadea4fd7df3ee39da | Python | 1,755 | 47 | from matplotlib import pyplot as plt
import rsatoolbox
import seaborn as sns
from typing import Callable, List
# local imports
from .helpers import Table
def plot_column_wise(table: Table, plotfun, fig_params={}, plot_params={}):
cols, _ = table.get_size()
fig, ax = plt.subplots(cols, 1, **fig_params)
for ... |
a69720673f76bb9d75f35dcfe6498e8205f0c6aeb2b05234c2ec935ae4b80be9 | Python | 1,755 | 75 | import torch
from torch import Tensor
class Round(torch.autograd.Function):
"""
Round deterministically to nearest neighbour with STE.
"""
@staticmethod
def forward(ctx, x, *args, **kwargs):
return torch.round(x)
@staticmethod
def backward(ctx, *grad_output):
return grad_... |
33d3664abedc054cfa588c768ba79f24011d483cc4eaa476fc349042e6fcf9c2 | Python | 1,756 | 57 | #!/usr/bin/python
# -*- coding:utf-8 -*-
from torch import nn
import warnings
# ----------------------------inputsize >=28-------------------------------------------------------------------------
class CNN(nn.Module):
def __init__(self, pretrained=False, in_channel=1, out_channel=10):
super(CNN, self).__in... |
6833b8a1afacab8f0733ec6d04e702470411de58b34ac248e49461b7dc2ac089 | Python | 1,757 | 60 | """"""
import abc
from pupil_recording_interface.base import BaseConfigurable
from pupil_recording_interface.decorators import device
class BaseDevice(BaseConfigurable):
""" Base class for all devices. """
def __init__(self, device_uid):
""" Constructor. """
self.device_uid = device_uid
... |
77c25e11d7730d57b9940bee60ed9da8ddf70b71060a8f2b9ce70066a4f2ba2f | Python | 1,757 | 59 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: A.Akdogan
"""
import os
import albumentations as album
def get_final_path(sub_count, join_list):
path = os.path.dirname(os.path.realpath(__file__))
for i in range(sub_count):
path = os.path.dirname(os.path.normpath(path))
for i in ran... |
e4d5209a513386987881ba450583e59a42249e3827eb3d9f026b0d8e2b8e987a | Python | 1,757 | 54 | # 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... |
302558784e200cf1f9dd3f0502b8b4374dcd0198c27c66d13c92a3ade44556ea | Python | 1,758 | 53 | # 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... |
90da6ca47d69894163fbbf42362660d4a08c008130edc0875c22da6d924c59a6 | Python | 1,758 | 39 | import tensorflow as tf
import os
#from tf_explain.callbacks.grad_cam import GradCAMCallback
class CallBacks:
def __init__(self, learning_rate=0.01, log_dir=None, optimizer=None, validation_data=None):
self.log_dir = log_dir
self.learning_rate = learning_rate
self.optimizer = optimizer
... |
02169eb141a5fbd8adeaebc6e9fb053ceafdca716919a4cc938b795d35fb67f4 | Python | 1,759 | 62 | import os
import string
import urllib.parse
import urllib.request
from typing import Optional
from .compat import WINDOWS
def get_url_scheme(url: str) -> Optional[str]:
if ":" not in url:
return None
return url.split(":", 1)[0].lower()
def path_to_url(path: str) -> str:
"""
Convert a path t... |
0745fb9065d8069623604fcfbf65d66e74f3874a4e6177b8fdcbc31b63d41393 | Python | 1,759 | 53 | import pandas as pd
import json
import os
import unittest
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.model import extract_mean_and_sigma
import hornet.model as hm
class TestExtractMeanAndSigma(unittest.TestCase):
def setUp(self):
self.path = ".data_t... |
28f101b9e6922d2bc1a4578834cbb40fa4e01dc47dd1ee4f6906b089fcc5e28d | Python | 1,759 | 47 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
1e7399e3f28588c8512f0d4e7848662b6c4c92daca8263c4ef8f840d36bf5b06 | Python | 1,760 | 67 | import atexit
import os
import shutil
import ssl
import sys
import tempfile
import urllib
from functools import partial
from typing import Optional
def get_temp_dir_path():
temp_dir_path = tempfile.mkdtemp()
atexit.register(partial(shutil.rmtree, temp_dir_path, ignore_errors=True))
return temp_dir_path
... |
90ebf35cc613b49603706ff3b3a88d1e45917c91e35b178688ed2c42a63e8611 | Python | 1,760 | 42 | """
PyntBCI
=======
Python Noise-Tagging Brain-Computer interface (PyntBCI) is a Python library for the noise-tagging brain-computer
interface (BCI) project developed at the Donders Institute for Brain, Cognition and Behaviour, Radboud University,
Nijmegen, the Netherlands. PyntBCI contains various signal processing s... |
aacf1272431f534bcd998578567c4a9c66069d5ac74808caacf70fd3382cf806 | Python | 1,760 | 58 | # pylint: disable=too-many-function-args, invalid-name
""" ABIDE ICA (869 subjects) 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(
"abide869/A... |
c48edba0188e12a8287455a31111810f08569e3265176af0f4690341d7bd241f | Python | 1,760 | 53 | # 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... |
14acabeed9498dbfcc3ba73151d66484c07f2d2cc2240ad63f2bafa6facc9224 | Python | 1,761 | 53 | # 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... |
2ba3d8590fbede6522b10e5543fcd851953489f8e0227be0c0beb82681a388f0 | Python | 1,762 | 59 | import os
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
from data.constants import RADIOMICS_UID
from data.utils import loadRadiomicsData
from data.ClinicalDatasets import PreopSurvivalDataset, PreopClassificationDataset
class RadiomicsDataset(Dataset):
def __... |
4a113a6fa2d9799f2d1574fccb3b8f442ad5f3b04f3b1a57bc2e41cc4728488f | Python | 1,762 | 79 | import os
import torch
class BestMeter(object):
"""Computes and stores the best value"""
def __init__(self, best_type):
self.best_type = best_type
self.count = 0
self.reset()
def reset(self):
if self.best_type == 'min':
self.best = float('inf')
... |
b3cf3ed2803b9199821ac83fcb4a1156d876541bafb8aab73f056fd1e8f4e8d1 | Python | 1,762 | 58 | import unittest
import torch
from torcheeg.models import BCEncoder, BCDecoder, BEncoder, BDecoder
class TestVAE(unittest.TestCase):
def test_bvae(self):
encoder = BEncoder(in_channels=4)
decoder = BDecoder(in_channels=64, out_channels=4)
mock_eeg = torch.randn(1, 4, 9, 9)
mu, logv... |
d2bd0ee02855ff4e29eb8f59839512b82b95150a32e57f5ba23fecf743bc31dd | Python | 1,762 | 49 | """Cheap, non-fatal environment/atlas readiness check for the hub header."""
import os
from regtools import get_project_root
def _venv_present():
return os.path.isdir(os.path.join(get_project_root(), "bin", ".venv"))
def _atlas_installed():
"""True if the default Allen CCF 25um atlas is installe... |
f29558012386961969c8797e88a7907d9929ba54bb7b299ca3040aab4941dee1 | Python | 1,762 | 60 | #! /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... |
375e583020772038212093a90f1e6b84fb4532ecc9a724264eb0f33fe172ecc6 | Python | 1,763 | 65 | """ Module for a language """
import pandas as pd
INPUT_LANGUAGES_PATH = "data/input_languages.csv"
INPUT_LANGUAGES = None
def load_input_languages(path) -> pd.DataFrame:
languages = pd.read_csv(path, sep=",", index_col=["InputCondition", "Item.ID"])
return languages
def load_input_language(input_condition... |
94f31fc025fabf601a3e0bc587f7125997202c36d68850872d9fe9f5143dbb11 | Python | 1,763 | 47 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... |
3a5e97a6ab5967877227492c5ee6423c361bdd6de80f32d9731fe7a8f9bdbc30 | Python | 1,764 | 57 | '''
Modified by Mayank Kabra
Adapted from deeplabcut (deeplabcut.org)
Adapted from DeeperCut by Eldar Insafutdinov
https://github.com/eldar/pose-tensorflow
'''
from enum import Enum
import numpy as np
class Batch(Enum):
inputs = 0
part_score_targets = 1
part_score_weights = 2
locref_targets = 3
... |
52e6fe5e9745d0e0781862db91dcdd0a37d45a704d535bc6258382b86010682e | Python | 1,764 | 52 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites, configs
from downward.reports.compare import CompareConfigsReport
import common_setup
REVISIONS = ["issue425-base", "issue425-v1"]
CONFIGS = configs.default_configs_optimal()
# remove config that is disabled in this branch
del CONFIGS['asta... |
8f404c03b5cd049879d94ec40dba980ff3c99a5b7d26034c622ad813e79c77b6 | Python | 1,764 | 67 | from __future__ import annotations
import os
from pathlib import Path
from unittest import mock
import pytest
FILE_DIR = Path(__file__).parent
GULP_DIR = Path(FILE_DIR, "gulp_run")
@pytest.fixture(autouse=True)
def mock_settings_env_vars():
with mock.patch.dict(os.environ, {"GULP_LIB": "."}):
yield
d... |
b4af2bc52fd604149712d212c5f77fc2dc4cec8c662e8e002c4293e9b6431c45 | Python | 1,764 | 51 | """ Estimation variables: This class contains the estimation variables """
import numpy as np
class EeEstVars:
# This class defines the instance variables unique to each instance
def __init__(self):
# This function determines the default estimation variables
# Parameter names for data frame... |
c279c023c8fa0061a3ef123665e2c1d8413f0a29054da39f2f25731ac1299dd8 | Python | 1,764 | 52 | import sys
import json
import pandas as pd
from functools import reduce
def filter_identifiers(data, output_file, taxa_filter):
"""Filter identifiers based on taxa and save to a text file.
Args:
data (str): Path to the input data file (BlobTools table).
output_file (str): Path to the output te... |
3d64ff4ed7d4bb4d56da76435d02560ca9ec5b4027c6ad6ccfc43c050f89aece | Python | 1,765 | 69 | ### configs for next hyperparam trial
import optuna
from datetime import datetime
import numpy as np
def train_fn(trial):
# t=trial.suggest_uniform("t", .5,3
# t = trial.suggest_int("t",1, 8,step=1)
# r=trial.suggest_uniform("r", 0, 10)
# r=t*2
# t = trial.suggest_uniform("t", 1.0, 4.0),
# rt... |
c3ac8917c2396efcd08bac6f90461dfe7f2e954796516b6c4761cbb15155d672 | Python | 1,765 | 64 | import argparse
from pathlib import Path
def add_run_dendritic_spine_arguments(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--mesh-file",
type=Path,
default=Path.cwd() / "spine_mesh" / "spine_mesh.h5"
)
parser.add_argument(
"-o",
"--outdir",
... |
13ccabca6457918b75e0f14b42c392527c6ec22765b32af656040b5a28414a92 | Python | 1,766 | 54 | """Quality Control and stability verification unit tests."""
import json
from pathlib import Path
import pandas as pd
from colabmda.openmm.modular.qc import analyze_logs, parse_em_log
def test_parse_em_log(tmp_path: Path):
# Missing em.chk
assert parse_em_log(str(tmp_path)) == "Failed"
# Present em.ch... |
49541054ce5d5e63c04d3f07645c835a9448dc09259e94ed65e94c42e43d7c26 | Python | 1,766 | 45 | from fxpmath import Fxp
class SFI_ENC:
WIDTH = 0
DEC = 0
def __init__(self, width, dec) -> None:
self.WIDTH = width
self.DEC = dec
class SFI:
G = SFI_ENC(width = 27, dec = 23)
V = SFI_ENC(width = 32, dec = 23)
E = SFI_ENC(w... |
0bfb3286a69c124d50718848f4c55883da626ee6ae04600345484aca4fa179b9 | Python | 1,769 | 44 | # Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020)
#GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes.
#Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and... |
1062d3e2687b30175a72d22353d792a85f9ddc0f723d14508b47bf0b2a8f58a7 | Python | 1,769 | 59 | import numpy as np
from ase.build import molecule
from ase.calculators.lj import LennardJones
from ase.calculators.singlepoint import SinglePointCalculator
from sella.internal import Internals
from sella.peswrapper import InternalPES
def _water_internals(atoms):
internals = Internals(atoms)
internals.find_a... |
bc81f88dfd98f44125235bde651cca7bf54813359153e916905434c6a34caf40 | Python | 1,769 | 55 | #!/usr/bin/env python3.6
import sys
from os.path import expanduser
sys.path.append(expanduser("~")+'/src.git/visualife/src')
from core.SvgViewport import SvgViewport
from core.Plot import Plot
from core.styles import ColorRGB, color_by_name
BOX_SIZE = 10 # size of every square used to represent a hydrogen bond on a ... |
3d1b1d2d10df4db99b26896eba4c44703c0aec58506809d8e81502176eadfbef | Python | 1,770 | 51 | import logging
from cirrocumulus.anndata_util import (
ADATA_MODULE_UNS_KEY,
get_pegasus_marker_keys,
get_scanpy_marker_keys,
)
from cirrocumulus.util import dumps
logger = logging.getLogger("cirro")
def save_datasets_h5ad(datasets, schema, output_directory, filesystem, whitelist):
adata = None
... |
1f295a4887efc71a8303658b8629605484dc4c8ff9b8b6e16537ccaf675c0fd4 | Python | 1,771 | 54 | # 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... |
969aa303dc72cb1d641ec2e8eb51f08006228169af84e3d4621b81353919e5fa | Python | 1,771 | 54 | from matplotlib import pyplot as plt
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.Draw.MolDrawing import MolDrawing, DrawingOptions
from rdkit.Chem.Draw import mplCanvas
class Canvas(mplCanvas.Canvas):
def __init__(self, ax, name="", imageType="png"):
self._name = name
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.