sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8337b4ccd13afd052254ab53d0214255ffa70454a93f030b1cb9fa0478bbc467 | Python | 1,894 | 47 | #! /usr/bin/env python
import numpy as np
import trimesh
import argparse
import pyshot
import os
import matplotlib.pyplot as plt
"""
A simple CLI to show how to extract SHOT descriptors in python
"""
if __name__ == "__main__":
parser = argparse.ArgumentParser("example_pyshot", description=__doc__)
parser.add_... |
c2c8701ebda214ebbd6a7dda7772eb296489eb64b03e18b08d40d9b97117ce72 | Python | 1,894 | 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... |
e06ab5570934b678ac182cd99a88164a847c86760b2810ae001f0498acc058f2 | Python | 1,894 | 55 | # 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... |
f6bcafca604a7543909f97eccaaffbe05a839c0b5944e1518b64a5866ae9002b | Python | 1,894 | 55 | import torch
from torch import nn
import numpy as np
from .base import CutoffLayer
__all__ = ["CosineCutoff",
"SmoothCosineCutoff",
"PolynomialCutoff",
]
class CosineCutoff(CutoffLayer):
def forward(self,
distances : torch.Tensor,
) -> torch.Tensor... |
72b12a2349f95e9396c1e36cfc7ed3a86a73ab78460906724ee4d1ce3db44fb4 | Python | 1,897 | 53 | import platform
import numpy as np
import pytest
import molecularnodes as mn
from .utils import NumpySnapshotExtension
@pytest.mark.skipif(
platform.system() != "Darwin" or platform.machine() != "arm64",
reason="Test only runs on macOS ARM",
)
def test_random_rgb(snapshot_custom):
n = 100
colors = np.... |
aa743342e587b476dc420354f94ca3090a865c81e0496c6e0cc546338b07490d | Python | 1,897 | 65 | from typing import Callable, List
from ..base_transform import BaseTransform
class Compose(BaseTransform):
r'''
Compose several transforms together. Consistent with :obj:`torchvision.transforms.Compose`'s behavior.
.. code-block:: python
transform = Compose([
ToTensor(),
... |
d77f3076d8a0ef3d62e60670bbe13fead6dd33b51b2642da2085283658cc38a2 | Python | 1,897 | 23 | """validate_realpn_alsubnet_2026-09-29.py (methods check before PREREG-2026-09-29d). Does the antennal-lobe cut-out
(AL_SUBNET, 3,431 neurons) reproduce the whole-brain REAL_PN correlations (S 0.282, F4 0.697)? Same input (Seki receptor
responses, 1,000 ms, 5 trials, seed 50 + odour index)."""
import sys, time; sys.pat... |
bb725dbe184d8508b7048b33ce3b6067a71e91ee5595852016e6aef8f8615a4b | Python | 1,898 | 56 | import numpy as np
import torch
from Util.SimpleViTModel import Model
from Util.Utils import transform_data_embed
import pandas as pd
from torch.utils.data import Dataset, DataLoader
torch.backends.cudnn.deterministic = True
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
class Da... |
f2882c991af454be6b7e998e4ac43471a99b7ce137ec6d152b4b98d1b5c4b578 | Python | 1,898 | 77 | # Node-group asset "Backbone O" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING, L... |
3175d0aace7947ad7ddbb2d809e5401a797ead983f6f1387475f2f731a07d77f | Python | 1,900 | 57 | from unittest import TestCase
from elasticai.creator_plugins.grouped_filter.src.iterator_utils import batched
from elasticai.creator_plugins.grouped_filter.src.tensor import (
reshape_flat_CxN_groupwise,
structure_flat_CxN,
)
class ReshapeCxNTest(TestCase):
def test_interpret_flat_vector_as_2x6(self):
... |
3e3a0377beca5909b7da689fa785a8f558295fc4f4b274f1c0d8fb1cc625c0c0 | Python | 1,900 | 64 | from __future__ import print_function, division
import torch
import topaz
from topaz.model.features.basic import BasicConv
from topaz.model.features.resnet import ResNet16, ResNet8, ResNet6
from topaz.model.classifier import LinearClassifier
from topaz.model.utils import load_state_dict_from_pkg
resnet16 = ResNet16
... |
56e1dd80ec0b53f42e31a472396e54df4ed0016094e66c3ce4c5b19da39a2e90 | Python | 1,900 | 57 | # 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... |
d9e2073f3dbf2328c8f199c1b39dd0388ef40bd493240e13b53464b59c088ec8 | Python | 1,900 | 80 | from ..model import Model
from . import loadDefaultParams as dp
from . import timeIntegration as ti
class ThalamicMassModel(Model):
"""
Two population thalamic model
Reference:
Costa, M. S., Weigenand, A., Ngo, H. V. V., Marshall, L., Born, J.,
Martinetz, T., & Claussen, J. C. (2016). A thalamoco... |
e62ef490a077dfe59c71e16dfc08fa55b26eaa68ee8f949f2de954faf54edfaa | Python | 1,900 | 77 | # Node-group asset "Backbone C" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING, L... |
7e3eb8b8c064fb1f3fcfd39e07779323fcb2a743fe334fcee467946662002815 | Python | 1,902 | 42 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
REVS = ["issue392-v2"]
LIMITS = {"search_time": 300}
CONFIGS = {}
for randomize in ["false", "true"]:
for pref_first in ["false", "true"]:
CONFIGS["lama-nonunit-randomize-%(randomize)s-pref_first-%(pref_first... |
18279eaab988bd7062cebcbad3665ec82618e15b554e7bb75b582a639682d35b | Python | 1,903 | 40 | """Locate the placeholder tag of a value column template."""
from __future__ import annotations
from hed.models.hed_string import HedString
from hed.models.model_constants import DefTagNames
def placeholder_tag(template, hed_schema, def_dict=None):
"""Return the tag of a value column template whose value portio... |
db0c52fa2d5aa7b5706353c5d43b980066dff60fb5a174d9da5b8c07a4975b4e | Python | 1,903 | 72 | import numpy as np
def add_death(mat, eps=1e-15):
"""
Given an "illigal" non-stay action, there is eps chance to die
In the paper this is referred to as a dummy state.
"""
for action in range(mat.shape[-1]):
zer = np.where(mat[..., action].sum(axis=0) == 0)[0]
mat[-1, zer, action] ... |
0f27ffb75007360c0dacdc6ce98a7160be99d9736fdf2fda81324fda6d0c4045 | Python | 1,904 | 64 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : simple_plot.py
# Author : Yufeng Liu
# Date : 2021-04-08
# Description :
#
#===================... |
3288be89350e391a3178c6d01fe19f3ba4a98e4379c1482ba239f769f0358565 | Python | 1,904 | 70 | # Node group ".Profile Type Picker" (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 reg... |
4a5195e8d426a9da03e6ef52cec261c0de9832a1e2bf39d39d1ee846e4343d00 | Python | 1,904 | 76 | import json
from typing import Any
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pathlib import Path
from ..prixfixe.predictor import Predictor
from .utils import n2id, revcomp
from scipy import stats
import pandas as pd
'''
230407 BHIPredictor added
- flatten (optiona... |
63184eee16b1045910e1fde81ea331ae979fcb4f577f1d521c4d6532ff67ea62 | Python | 1,904 | 55 | from dolfin import *
import numpy as np
import matplotlib.pyplot as plt
import os
from IPython import embed
from analyse_data import read_data
#os.system("dijitso clean")
patient = "C25"
resolutions = [8,16,32,64, 96]
surf_area = np.zeros(len(resolutions))
first_run = True
for i,res in enumerate(resolutions):
... |
950ba14e914274e222335562e5734e01e0fb3c5a19edbd46949888cea0510c12 | Python | 1,904 | 37 | """OFFICIAL.py 2026-09-30. Shiu et al.'s own v783 model file (Connectivity_783.parquet, philshiu/Drosophila_brain_model,
sha256 efeb23fb...0347), as counts and signs for SHIU783_SIM. Same neuron order as Completeness_783.csv (checked).
Until 30 Sept my analyses used a rebuild (Pospisil edge list + FlyWire nt_type); thi... |
b414edd4af69ea6d2c254387f2c3bbdf1254be989d21e5e9df67c078468161a0 | Python | 1,904 | 64 | #! /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... |
d27da43136157c5c1a1b1d58f580cd5282247a3bb4e6d797f6f183ab84b4f277 | Python | 1,904 | 66 | import sys
import importlib.util
import os
import pytest
_SCRIPT = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"scripts",
"batch_2d_registration.py",
)
def _load_script_module():
spec = importlib.util.spec_from_file_location("_batch2d_scr... |
033866cbd0fc327f84484374c772e9f8f673ed05be71954b9e954d1e4fa415ca | Python | 1,905 | 66 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
039ef6abc8ca5f77640f1ba01313d8e76e064fdaf6dc31b5fda7a285894563a2 | Python | 1,905 | 64 | # 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... |
2591258d6daab8400833140a788b6066d2fa5138531a9bd7c7256883553bb1f2 | Python | 1,905 | 65 | import numpy as np
def adjustArrayShape(original, target):
"""
Tiles and then cuts an array (or list or float) such that
it has the same shape as target at the end.
This is used to make sure that any input parameter like external current has
the same shape as the rate array.
"""
# make an... |
9f6d13307773fdc310be895ade17d12ceb052f4d640346e2595f60d8f54470ed | Python | 1,905 | 47 | import scanpy as sc
import pandas as pd
def feature_selection():
# Read the gene expression data and metadata
sc_adata = sc.read_h5ad(sc_h5_data_path)
sc_adata_meta = pd.read_csv(sc_csv_meta_path, index_col=0)
sc_adata_meta_ = sc_adata_meta.loc[sc_adata.obs.index,]
sc_adata.obs = sc_adata_meta_
... |
eac1a26eed5f36c374e59a136c880a7e43aff3ce7060f5cdb6856f76df39f4c6 | Python | 1,905 | 49 | # 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... |
ece93ca15a4862e0267a2584fbb554d05a420ff0fa1c819a6f4719b8083e452f | Python | 1,905 | 66 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
06322ba065efccacb606980d1a28c551ee33a967a067a334717ceca57f689c71 | Python | 1,906 | 66 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
25c8fbacdc19e5cf2af191986605d3b53767e9aa0ba56ecff8d96fbbf4c71797 | Python | 1,906 | 66 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
7dd49bdc6480bdf44752ad9468d07ee2162d29bc0c9221a3bb4e2667fae465b2 | Python | 1,906 | 45 | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
def guassian_kernel(source, target, kernel_mul=2.0, kernel_num=5, fix_sigma=None):
n_samples = int(source.size()[0]) + int(target.size()[0])
total = torch.cat([source, target], dim=0)
total0 = total.unsqueeze(0).exp... |
15c6a9ac54f5cb80b13aa8b16beaa847a5b540782841095f2827be42ff909254 | Python | 1,907 | 66 | """MP-ALOE-compatible VASP recipes."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.calculators.vasp.params import MPtoASEConverter
from quacc.recipes.vasp._base import run_and_summarize
if TYPE_CHECKING:
from typing import Any
from ase.atoms import A... |
299762eba82c47efd151752bf6e7a3b2c937ae64c7ad054959e340dac57e5526 | Python | 1,907 | 51 | from typing import Optional
from pip._internal.models.format_control import FormatControl
class SelectionPreferences:
"""
Encapsulates the candidate selection preferences for downloading
and installing files.
"""
__slots__ = [
"allow_yanked",
"allow_all_prereleases",
"for... |
d8c77500675e7eea94c0b866ffc2b940f47106b8cdf2ece1c65de021d4c3e722 | Python | 1,907 | 69 | """Preparing the Cam-CAN MEG Data
[STEP 4] Apply dipole sign flipping on the source space data
"""
# Install dependencies
import os
import glob
from sys import argv
from osl import source_recon, utils
from dask.distributed import Client
# Set hyperparameters
if len(argv) != 2:
print("Need to pass one argument: us... |
50ec255cf6eb7fa34ee47e952304a7cd452173805b077e4c7c0618cdc7d84224 | Python | 1,908 | 56 | from tqdm import tqdm
class Engine(object):
def __init__(self):
hook_names = ['on_start', 'on_start_epoch', 'on_sample', 'on_forward',
'on_backward', 'on_end_epoch', 'on_update', 'on_end']
self.hooks = { }
for hook_name in hook_names:
self.hooks[hook_name]... |
6bbb490972f0ed23523afc725a2289feac971ca0f122c04c9a12aa2472b49710 | Python | 1,908 | 75 | import numpy as np
from volume import *
def to_octree( volume ):
queue = [volume]
octree = []
while len(queue):
octree += _to_octree( queue.pop(0) , queue )
return octree
def _to_octree( volume, queue ):
if volume.shape == (2,2,2):
return []
octree = []
for sub_idx in range(8):
sub_sli... |
cc10f1eee12a2a8db3af6d6e52f3ed2f2403b08b9fd5ff6862360ca2ea56d43c | Python | 1,908 | 56 | ###go through fastq file to pull barcodes
import pandas as pd
import os
import sys
import re
import time
import pathlib
import gzip
argv = sys.argv
#from Bio.Alphabet import IUPAC
from Bio.Seq import Seq
from Bio import SeqIO
fastqfile = argv[1]
#dictfile = argv[2]
out_id = argv[2]
read_number = int(argv[3])
bc_len ... |
ad8a2ce573a6bd621a6069c23d87b84af19dedd334d68bf118c726d9bb4350d3 | Python | 1,909 | 68 | import numpy as np
from typing import List
def bit_list_to_int(bitList: List[bool]) -> int:
"""Converts a binary list to an integer
Args:
bitList: the binary list to convert
Returns:
The integer corresponding to the input bit list
"""
out = 0
for b in reversed(bitList):
... |
dd4362eac710f6a9b61b1722e495a560b7249111a3b11f4a493ebab8f17c4b4a | Python | 1,909 | 52 | # 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... |
5e2aa91d4ce604fc33f766cc2c733c4610bda5b096be0e53bfa1f6b6a64c4f75 | Python | 1,910 | 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_DI... |
97a7b8136881f321f131031e236a647e4de31ef36a1ff2401fae4d295588d2a3 | Python | 1,910 | 73 | """
Functions related to attribute get/set python built-ins.
# Author: Vladan Lucic, Max Planck Institute for Biochemistry
# $Id$
"""
from __future__ import unicode_literals
from past.builtins import basestring
__version__ = "$Revision$"
def getattr_deep(object, name):
"""
Like built-in getattr, but name ... |
bedb4c865aa421443761ae7d98d0f90a7894a9475a402b1a3654461fa5cc80d4 | Python | 1,910 | 51 | from NAB.nab.detectors.base import AnomalyDetector
from NAB.nab.detectors.skyline.algorithms import (median_absolute_deviation,
first_hour_average,
stddev_from_average,
stddev_from_... |
e6cef5d9d7d68ccc346619f981787568ee61dbcce2754a1109f8783dcee25568 | Python | 1,910 | 55 | from typing import Any
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
from elasticai.creator.base_modules.prelu2 import PReLU2 as PReLU2Base
from elasticai.creator.nn.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.fixed_point.math_operations import MathOperations
from .d... |
27c98c81117d7cd57c56ef18aba960251d976c83a0ee0e065835c1fea295a8ac | Python | 1,912 | 62 | #!/usr/bin/env python
import sys
import click
import numpy as np
import pandas as pd
import tifffile as tiff
from rich import print, traceback
@click.command()
@click.option("-m", "--meta", required=True, type=str, help="Path to metadata file")
@click.option("-r", "--ratios", required=True, type=str, help="Path to... |
2f58f7628bb692fcdf113e8d0ae8b69db2879b139cd8cd1975838b540e6d63f4 | Python | 1,912 | 77 | # Node-group asset "Backbone CA" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING, ... |
2f700a1dffaaa16a8adfefec8a00fdb99ebcbb089d49232cd489644f77bc02c9 | Python | 1,912 | 57 | # 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... |
35af60b9e27c54b8593eb81896e6e8f4e71c021a801fa3c99368c2b93951befe | Python | 1,912 | 50 | import os
import glob
import pandas as pd
import argparse
def combine_csv_files(directory, output_file="combined_volumes.csv"):
try:
# Recursively find all CSV files in the directory
csv_files = sorted(glob.glob(os.path.join(directory, "**", "*.csv"), recursive=True))
if not csv_fi... |
b8e315efec0afff16bed498226b9fa91929f310f915a34c518f121063799f988 | Python | 1,912 | 56 | # 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... |
cdd036a1ec4138ed01ff6cb66ba3bda314901e8a724a773ca2be06c1f5db2e9e | Python | 1,912 | 56 | """Unit tests for the inverse-consistency-error statistics.
ICE checks that the forward and inverse transforms are mutual inverses: a point
round-tripped through fwd then inv should return to its origin. The pure stats
function summarizes the residual displacements; the ANTs round-trip itself is
done in the pipel... |
1d1bc0ff532dfbb38708d003c918ffd1fd7ba625ae6e3b789a56750a728a50de | Python | 1,913 | 33 | import tkinter as tk
import numpy as np
import os
class SettingsWindow(tk.Toplevel):
def __init__(self,settings):
super().__init__()
self.resizable(width=False,height=False)
self.geometry("270x320")
self.title("Settings")
settings_names = [' delete\nthreshold',' drop\n... |
56075779d0b088a320bee902f439bde90493d261fa7807ced72cfb5b6e7e9c0d | Python | 1,913 | 75 | # Node-group asset "World to Angstrom" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHEC... |
d56c158de8292087abc1312f4b3bc5532b3864265348c87c22b0b51d17c9b518 | Python | 1,913 | 71 | # -*- coding: utf-8 -*-
#
# Syncopy plotting setup
#
from syncopy import __plt__
from packaging.version import parse
foreground = "#2E3440" # nord0
background = "#fcfcfc" # hint of gray
# dark mode
# foreground = "#D8DEE9" # nord4
# background = "#2E3440" # nord0
if __plt__:
import matplotlib as mpl
# ... |
de93f1cdc819ab71f3b3e67040d037847a221c958de80eff74097c63a44f2ac6 | Python | 1,914 | 48 | import numpy as np
import xarray as xr
import hmp
from hmp import simulations
from hmp.models import CumulativeMethod, EventModel
from hmp.patterns import HalfSine
from hmp.patterndata import PatternData
from test_io import init_data, init_data_large
def test_cumulative_simple():
""" test a simple fit_transform ... |
f25fe29b745989a9af9e87bd39a7b910534b5ca4b4428e5592f43c7df861a276 | Python | 1,914 | 80 | # -*- coding: utf-8 -*-
from __future__ import annotations
import functools
import os
import re
from typing import Any, Iterable
import torch
import torch.distributed as dist
import torch.nn as nn
class DistributedDataParallel(nn.parallel.DistributedDataParallel):
def __init__(self, module, **kwargs):
... |
341e025c0538dab102746a8a73ffe0ba6c1f75358353f89c271fb5cdaa455e7b | Python | 1,915 | 74 | """Demonstration of launching a planewave source at oblique incidence.
tutorial reference:
https://meep.readthedocs.io/en/latest/Python_Tutorials/Eigenmode_Source/#planewaves-in-homogeneous-media
"""
import matplotlib.pyplot as plt
import meep as mp
import numpy as np
mp.verbosity(2)
resolution_um = 50
pml_um = 2.... |
5ca95082e9f07167d454c25cc7d210cd81442c8ee6c2d7ea554f2d666fbb5445 | Python | 1,915 | 63 | """Bounding-box alignment - port of bb_alignment.m."""
from __future__ import annotations
from pathlib import Path
from typing import Optional, Tuple
import numpy as np
from scipy import ndimage as ndi
from skimage import filters
from .correspondence import bounding_box_point_correspondence
from .edges ... |
6989ac110943d13d4174313f060a8b563926b7ad8c1c8f2b2ef0cc8678df786c | Python | 1,915 | 61 | """Plot timelocked features."""
from __future__ import annotations
from pathlib import Path
from typing import Annotated
import matplotlib.pyplot as plt
import mne
import mne_bids
import pte
from pytask import Product
import motor_intention.plotting_settings
import motor_intention.project_constants as constants
PLO... |
8ec5476b3a418582d6967d5695e35af0fc40d07d929e68484cc012ba1794dbd6 | Python | 1,915 | 56 | import numpy as np
class ImageNormalizer255To1(object):
def __call__(self, patch):
if patch.dtype!=np.uint8:
raise ValueError('expects np.uint8, not', patch.dtype)
return (patch / 255.0).astype(np.float32)
def reverse(self, patch):
patch = np.clip(patch* 255 + 0.5, 0, 255).... |
0d20e743d1e1a1ff6c17f4219360badbfcf3d7a7acce7fa44f8281d193ea018c | Python | 1,916 | 55 | from typing import cast
import torch
from elasticai.creator.arithmetic import FxpArithmetic
from elasticai.creator.base_modules.conv1d import MathOperations as Conv1dOps
from elasticai.creator.base_modules.linear import MathOperations as LinearOps
from elasticai.creator.base_modules.lstm_cell import MathOperations as... |
be033d7eda6e6728656cf2b10b8410ad6851da477cf482523b9d02e370f32e2e | Python | 1,916 | 48 | import numpy as np
import networkx as nx
def simulate_networks(n_nets=1000, n_nodes=68, p_in=.25, p_out=.01, seed=None,
n_noisy_nets=100, noise_level=.5, noise_sd=.01):
'''
simulate noise-free and noise-affected random community networks.
----
inputs:
n_nets: total number... |
4feac856dd3b3a4a852c0eb72694de27ce2f417892902af5be6872e61c9051f2 | Python | 1,917 | 43 | import os
import unittest
from hed.schema import HedSchemaGroup, load_schema
class TestHedSchema(unittest.TestCase):
@classmethod
def setUpClass(cls):
schema_file = "../data/validator_tests/HED8.0.0_added_tests.mediawiki"
hed_wiki = os.path.join(os.path.dirname(os.path.realpath(__file__)), sc... |
5b08f06c97dd0b0ff0e5dcfede9f9028d9ef6d9b8ac2b9430526e9e948012468 | Python | 1,917 | 57 | import torch
import torch.nn.functional as F
from torch import nn
class _EncoderBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False):
super(_EncoderBlock, self).__init__()
layers = [
nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1),
n... |
5ec85a816a2678479211024c96de4418f8131792f56e2ea1949909cc6aaf66df | Python | 1,919 | 72 | # Diana Giraldo
# Class to get image slices from MRI nifti file
import numpy as np
import torch
from torch.utils.data import Dataset
import nibabel as nib
import cv2
from ..utils.mrislicing import get_slice
class ImageSlices(Dataset):
#Constructor
def __init__(
self,
in_nib_object,
... |
5e52939a06d2eff93cb82aa3d869e4bd4c0af7e8038f28258a75101371cccc61 | Python | 1,920 | 59 | from nilearn import datasets
import ABIDEParser as Reader
import os
import shutil
from dataloader import dataloader
# Selected pipeline
pipeline = 'cpac'
dl = dataloader()
# raw_features, y, nonimg = dl.load_data()
# Input data variables
num_subjects = 532
# num_subjects = raw_features.shape[0] # Number of subjects... |
404d8d364e4f4bac114d9c3bafb239e7238bbaf93031b5d111de5e3043ced57f | Python | 1,922 | 48 |
from cobolt.utils import SingleData, MultiomicDataset
from cobolt.model import Cobolt
import os
dat_dir = "../../example_data"
snare_mrna = SingleData.from_file(path=os.path.join(dat_dir, "snare"),
dataset_name="SNARE-seq",
feature_name="GeneExpr",
... |
d7579bbca507c2c3a09f31a18e613f4ae46dce17a5a9b9433ff959277d808a95 | Python | 1,922 | 62 | import numpy as np
import pickle as pkl
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib as mpl
import os
from matplotlib import rc
#rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino... |
540ff8a3cb58464486023d1f10c59047bea7cdc6d7ef049dcd7a55076c997f91 | Python | 1,923 | 53 | import os
import shutil
import torch
import tempfile
def process_and_save_params(source_folder, output_folder, restore_folder):
index = 0
target_folder = tempfile.mkdtemp()
os.makedirs(output_folder, exist_ok=True)
for root, dirs, files in os.walk(source_folder):
for name in fil... |
89f269530ae7f3120c9945e42cf26cf7b5c1e9f613d14f3738d306ba19e18180 | Python | 1,923 | 70 | import click
import h5py
import numpy as np
import os
##########
# inputs #
##########
"""
This script combines the ISM scores from multiple splits into one file. It averages the obverlap of scors between splits.
"""
@click.command()
@click.option('--input',
'input_file',
required=True,... |
083ea8cd402b7cab7a5154049c28e7f96599e29f6735c37851218f365fec11ef | Python | 1,924 | 61 | import numpy as np
import torch
from torch.autograd import Variable
class Namespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def min_max_standardize(x):
return (x - x.min()) / (x.max() - x.min())
def to_var(x, requires_grad=False, volatile=False):
"""
varialbe type that aut... |
93806e9b43cc2a804c9dac787e8515e73e5b7bc68d98de4d57e1ca8b4ac94fd8 | Python | 1,924 | 48 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn.functional as F
def flow_warp(x,
flow,
interpolation='bilinear',
padding_mode='zeros',
align_corners=True):
"""Warp an image or a feature map with optical flow.
Args:
x... |
a0df93142128d71842d4896a2d7526e31153498b86f6490120da01e2fd53fe37 | Python | 1,924 | 40 | from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
def create_rf_model(ml_settings, task_type):
if task_type == "regression":
rf_model = RandomForestRegressor(n_estimators = ml_settings["n_estimators"],
criterion = ml_settings... |
22963d39842ec603124eae409bc6efb3d96edabbd91c2447977aeb304fc89ac3 | Python | 1,925 | 26 | """HASH_INPUTS.py — sha256 and size of every raw input the scripts read, so anyone can check they start from
the same bytes. Output: 04-NOTES/INPUT_HASHES.txt"""
import hashlib, os, glob
R = 'D:/eucys'
files = ['neurons.csv.gz', 'classification.csv.gz', 'synister_fw_mat571_t11_synapses.feather',
'fafb_v783_pri... |
7c103bd4155a0c4aab02659fc419ba6d349d9fdd75f6ce281d064ccbff2fafdd | Python | 1,925 | 77 | """
.. _stream_recording_example:
Stream from a recording
=======================
This example shows a dummy streaming setup that uses the recording included
in the package.
"""
import sys
import logging
import pupil_recording_interface as pri
# %%
# Set recording folder
# --------------------
folder = pri.get_tes... |
76f365f5399f3f3355c622a4e560c58a112b679efdea0d940bdf8a186c9f5e69 | Python | 1,926 | 72 | import sys
from dataclasses import dataclass
@dataclass
class WindowsConsoleFeatures:
"""Windows features available."""
vt: bool = False
"""The console supports VT codes."""
truecolor: bool = False
"""The console supports truecolor."""
try:
import ctypes
from ctypes import LibraryLoader... |
f7417899cd46ee83cf09a24bf7fbf494c6bb3b29b9699bc18d2cf6485576c800 | Python | 1,927 | 66 | #!/bin/env python3
'''
Draw Feynman diagrams for the quasi-particles in the 2D patterns of cardiac
arrhythmia
'''
import matplotlib.pyplot as plt
import sys
import networkx
import yaml
from pdlfeynman.particle import PARTICLES
from pdlfeynman.history import ReactionHistory
from pdlfeynman.diagram import *
from pdlfeynm... |
80fff4273788c79849f6a00a687f106620ce085a4ba0f6839b5f2ba75cbaa1a7 | Python | 1,928 | 45 | """
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... |
deb179890ccdbea31711f2057930053eea4bb37f226d7f512bc69aabef9049de | Python | 1,928 | 57 | # 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... |
f5f2bb3b26ddeaf4084280b82e5f04a20325a0a33bbc8482d3f878b286285141 | Python | 1,929 | 66 | # This script runs the pipeline on single tomograms
from pathlib import Path
import os
import cProfile
import pstats
# Set environment variables
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import cryovesnet
dataset_directory = Path("/media/amin/mtwo/84")
# dataset_directory ... |
db66ba973a27b9efbd28183c61c74b9b90bc92a76e47a887b542593b9aa37a7a | Python | 1,930 | 47 | # Builtins
import datetime
from setuptools import setup
from setuptools.config.setupcfg import read_configuration
import toml
# External packages
import yaml
# Manually set release version
releaseVersion = "2026.6.2"
# Read dependencies from setup.cfg + pyproject.toml and create conda environment file
envFile = "acm... |
e166494c927a1590f2d6a2b765151a7e0daf10158e6baac5bbd0bafac01a14e2 | Python | 1,930 | 85 | import matplotlib.pyplot as plt
import numpy as np
import meep as mp
from meep import mpb
resolution = 128 # pixels/μm
Si = mp.Medium(index=3.45)
syz = 10
geometry_lattice = mp.Lattice(size=mp.Vector3(0, syz, syz))
k_points = [mp.Vector3(0.5)]
a = 1.0 # waveguide width
def parallel_waveguide(s, yodd):
geo... |
6172a6e5b01d359bad16aeaa929d73a1d49ebb7d6522457f60581580b3246c40 | Python | 1,931 | 75 | import pprint
from itertools import islice, chain
separator = ">" * 30
line = "-" * 30
class Ellipsis(object):
def __repr__(self):
return "..."
ellipsis = Ellipsis()
class PrettyPrinter(pprint.PrettyPrinter):
truncation = 10
display = 3
def _format_items(self, items, stream, indent, a... |
371397b67cdd35d7ea46e3cae8db04c8311f4753a7b982831df2bc4e3011bf07 | Python | 1,932 | 59 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
Adapted from DeeperCut by Eldar Insafutdinov
https://githu... |
5d8d67eba8ad7ab097cabc4627cf6ed5565a363992637b53950084b325358f8a | Python | 1,932 | 58 | from random import randint
import cocotb
import pytest
from cocotb.triggers import Timer
from elasticai.creator.arithmetic import int_arithmetic
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.mac import load_and_plugin
@cocotb.test()
@eai_testbench
async def in... |
634ebdd402d762f8ebb26b38c5225820d8dbdc17a5a08de823a2b1b7964b889c | Python | 1,932 | 55 | import os
import unittest
from hed.errors import get_printable_issue_string
from hed.tools import BidsDataset
class MyTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.base_dir = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "hed-examples/dat... |
a226180fa2214f1f45e0240c7f3e4b41e193d72e6166b9ddc5b281612bf34daf | Python | 1,932 | 60 | """distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
import os
from ..core import Command
from distutils._log import log
from stat import ST_MODE
class install_scripts(Command):
description = "install scri... |
1ffb2f8a3c077f7d91862a9e5763877aaba3ddabe3db69ea8fe9c1a5293a688f | Python | 1,933 | 55 | #! /usr/bin/python
import argparse
import os
def convert_dp_rmet_file2bedmethyl(args):
freqinfo = dict()
with open(args.freqfile, "r") as rf:
for line in rf:
words = line.strip().split("\t")
chrom = words[0]
pos = int(words[1])
strand = words... |
49fa5fe41f3ce96e6e38e82c7655e9b67a3ce2bcfec2cfbc0df9c4d9c25be6b8 | Python | 1,933 | 57 | import numpy as np
from scipy.ndimage import gaussian_filter
# Fourier Burst Accumulation
# See https://github.com/remicongee/Fourier-Burst-Accumulation
# https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7120097&tag=1
def fba_2d_onechannel(img_list, p = 11, sigma = 5):
F_img = [np.fft.rfft2(img) for img i... |
f7a3d64285a9023dcd4f3047f384c11d3f669f7db998f3b8d66b7fa6ee14c508 | Python | 1,933 | 47 | CIRRO_TEST = "CIRRO_TEST" # whether running using pytest
# authentication/authorization
CIRRO_AUTH_CLIENT_ID = "CIRRO_AUTH_CLIENT_ID"
CIRRO_AUTH_ISSUER = "CIRRO_AUTH_ISSUER"
CIRRO_AUTH = "CIRRO_AUTH" # python class to validate tokens (created based on CIRRO_AUTH_PROVIDER)
CIRRO_AUTH_PROVIDER = "CIRRO_AUTH_PROVIDER" ... |
6b173e95124edacf5d793fc01c17eb2bf67a826371f8341083e699abf9e40780 | Python | 1,934 | 74 | from .basic_euclidean import eucl_dist
from .basic_spherical import great_circle_distance
######################
# Euclidean Geometry #
######################
def e_edr(t0, t1, eps):
"""
Usage
-----
The Edit Distance on Real sequence between trajectory t0 and t1.
Parameters
----------
pa... |
7666400f8fcb22d720f5fec21433a73623fd1aad2c829f29b27275d8aae63f98 | Python | 1,934 | 62 | import numpy as np
from neurolib.utils.collections import dotdict
def loadDefaultParams(Cmat=None, Dmat=None, seed=None):
"""Load default parameters for the Kuramoto Model model
:param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not given, then ... |
8fdc57df9bd36019b7b474793e2483631ba5bd485fa7383ce7c304e537cf60f8 | Python | 1,934 | 63 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
datasets = ["fbirn", "hcp"]
models = ["mlp", "bolT"]
data = []
for dataset in datasets:
for model in models:
path = f"/data/users2/ppopov1/mlp-project/assets/logs/A_A_A_SwiFT-exp-{model}_defHP-{dataset}/runs.csv"
df = pd.rea... |
a3d7893ee713584a9afa3f32a6c0b0dd1dde6f872d02bfe080de388186b53010 | Python | 1,934 | 52 | # coding=utf-8
# Copyright 2020 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
#
# Unless required by applicable... |
3666cd199f83911d0589d1d61dc347aefc22eba5c517beb3c13e99f8435ba740 | Python | 1,935 | 69 | #!/usr/bin/env python3
import os
import matplotlib.pyplot as plt
from nilearn.image import load_img, resample_to_img
from nilearn import plotting as nplot
# ------------------------------------------------------------------
# paths
# ------------------------------------------------------------------
projpath = "/proje... |
617a7b458958e968b783db78f1529217389673672cfd41f30d9609a379db6cc9 | Python | 1,935 | 46 |
import os
import time
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from NET_module.data_preprocessing.preprocessor import Preprocessor
from NET_module.utils.utils import get_task_code
# inspired by the NVIDIA nnU-Net GitHub repository available at:
# https://github.com/NVIDIA/DeepLearningExampl... |
daef3a6fd3969a9cea0adec958d9d048f98be52521dad73cc8b9453254d9749a | Python | 1,935 | 47 | from ruamel.yaml import YAML
import pandas as pd
from parser_dicts_variables import dict_manifest_to_version
def check_outdated_notebooks():
# Read the information from the manifest
with open('manifest.bioimage.io.yaml', 'r', encoding='utf8') as f:
yaml = YAML()
yaml.preserve_quotes = True
... |
5b12dcce2d49de15625df769c18c8aa4f57484374726053bb4da9fe1f2404213 | Python | 1,936 | 48 | from monai.losses import TverskyLoss
from nnunetv2.training.loss.deep_supervision import DeepSupervisionWrapper
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
import numpy as np
import torch
class CombinedTverskyBCELoss(torch.nn.Module):
def __init__(self, alpha, beta, pos_w):
sup... |
b45795edf0171bcca13224274af9dfdfc5918f95972d30b613e927a1ddb81b03 | Python | 1,936 | 75 | # Node-group asset "B Factor" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
from... |
d434b4ff04c677ab4c1339c43feb7a8961aeeaee475f49bf13bb80737bf3eb23 | Python | 1,936 | 66 | from typing import Dict, List, Union
from ..base_transform import LabelTransform
class Mapping(LabelTransform):
r'''
Mapping the label according to a certain dictionary.
.. code-block:: python
from torcheeg import transforms
t = Mapping({
'left_hand': 0,
'ri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.