sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
916b1c8055bda429ae69e9b774a1c489c1fa41359979a4a26c81333efa83fb4c | Python | 3,311 | 64 | """
Modified by Mayank Kabra
Original from DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import os
impo... |
859762bcf17cd20c383b0909edee3ae22aa3a350e2d5029ff8ff3a9fb3838deb | Python | 3,312 | 66 | from itertools import cycle
from control_tools.execution import ArmTrajectory, Attach, GripperCommand
from plan_tools.common import Control, Conf
from plan_tools.samplers.generators import solve_inverse_kinematics, plan_waypoint_motion, \
get_pairwise_arm_links, set_gripper_position, Context
from plan_tools.sample... |
87632a2b162a70ba06132bd89c52bf4357ff1eb94e5737892715d09fdb18e0ac | Python | 3,312 | 102 | # Node-group asset "Fallback Rotation" (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... |
b85a9380bff941bea8dfa52a2b59e1d21bd1a323b963edd89e67a80b3ac7dc4d | Python | 3,312 | 83 | """Scaled label volumes must round, and single planes must match the full PIR load.
The bundled Waxholm annotation is uint16 with ``scl_slope=0.00766``: label 4
reads back as 3.9985. Truncating that mislabelled about half the regions, and
loading the whole 1024x512x512 volume to show one 2-D slice cost ~3 GiB.
""... |
ea2ea7515d3da8f56f5bd869fcbe11681c3c879e0d5fd920cdf568822e7ac7b3 | Python | 3,312 | 90 | import torch
from torch import nn
from tqdm import tqdm
from copy import deepcopy
class EarlyStopping:
def __init__(self, patience):
self.patience = patience
self.smallest_val_loss = torch.inf
self.epoch_smallest_val = 0
self.best_model_state = None
def early_stop(self, epoch)... |
af56fbc33593268b800c32e1f99d758918b8890c43d09289d6a1e5ea6398c6c0 | Python | 3,314 | 108 | """
pygments.formatters.bbcode
~~~~~~~~~~~~~~~~~~~~~~~~~~
BBcode formatter.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pip._vendor.pygments.formatter import Formatter
from pip._vendor.pygments.util import get_bool_opt
__al... |
2d47ec1cc491a68628c2dd7ebb194be7a9d56aa5f0becf22fb56cb4709f44e48 | Python | 3,315 | 104 | import numpy as np
from sklearn.model_selection import KFold
from datetime import datetime
import os
# path append stuff because this file is in "wrong" folder to find imports
import sys
sys.path.append('../src')
from model import CNN
from dataloader import DATA
from config_train import DEBUG, RUN_NAME
from helpers i... |
63be2f0f1618774028f9d980ce0183fb3e6d20367a018b18e37703c7cc385e7b | Python | 3,315 | 72 | """Provides ways to use and extend the elasticai.creator plugin system.
The plugin systems evolves around the
* [`PluginLoader`](#elasticai.creator.plugin.PluginLoader) class
* [`PluginSymbol`](#elasticai.creator.plugin.PluginSymbol)protocol
* `meta.toml` files that describe the plugins
For convenience many function... |
cf0c02a4275506e28cf178d2db11319884d7cac6be969803ba48aa3a5b57aa2c | Python | 3,316 | 120 | # -*- coding: utf-8 -*-
import tensorflow as tf
from .. import _logging as logging
from .core import *
__all__ = [
'FlattenLayer',
'ReshapeLayer',
'TransposeLayer',
]
class FlattenLayer(Layer):
"""A layer that reshapes high-dimension input into a vector.
Then we often apply DenseLayer, RNNLaye... |
e60881f3b623f4713cebacbd5512915bff793f81bdf08573a7bc76fe312ed9ea | Python | 3,316 | 86 | """
This script summarizes the significant results for global efficiency and participation
coefficients, organizing them and matching the results with the node coordinates for H5
"""
import os, sys
import pandas as pd
from scipy.io import loadmat
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_... |
eed6b269ed36309c21d3502f2305760d41a27bb257d3241af3cf0084e1d87bc0 | Python | 3,316 | 107 | from pathlib import Path
import numpy as np
import numpy.testing as npt
from astrovascpy.io import load_graph, load_graph_from_bin, load_graph_from_csv, load_graph_from_h5
from astrovascpy.PetscBinaryIO import get_conf
TEST_DIR = Path(__file__).resolve().parent
TEST_DATA_DIR = TEST_DIR / "data"
def test_petsc_inst... |
33acaabe2661304bde2bd0a0930f742a0ac6a84faa136edb10ac4d60755e219c | Python | 3,317 | 105 | import os
import tempfile
import unittest
import numpy as np
import torch
from torcheeg.io import EEGSignalIO
class TestEEGSignalIO(unittest.TestCase):
def setUp(self):
self._directory = tempfile.TemporaryDirectory()
self.addCleanup(self._directory.cleanup)
self._io_path = self._director... |
f6448fdffa5a027fbf20442eb1154deef1cfcc02e8dcbaae5926380afa14dea2 | Python | 3,318 | 80 | """
RERE INITIALIZATION FUNCTIONS
The param_refresh function replaces hyperparameter values with the next set from the file in 'file' mode.
The load function imports the selected dataset.
The initialize_cons function sets parameters to a self-consistent value.
"""
import pandas as pd
# set or update algorithm param... |
f330e2b25999366c14dd57a9f40de4eb9239db79cf234080f0a60ede78c91b6c | Python | 3,319 | 99 | # 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... |
fd1c5e57e525b51d962c32e59a8433488de4d35bd98dd016ae27f6b15a79f138 | Python | 3,319 | 99 | import sys
import scanpy as sc
import anndata
import pandas as pd
import numpy as np
import os
import gc
import csv
import pickle
import cell2location
import matplotlib as mpl
from matplotlib import rcParams
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
sp_data... |
bdbe481480fc6e68af052a8418c6a762c59e311c8983a7bd295d539b7cf120c1 | Python | 3,320 | 86 | """
This script summarizes the significant results for global efficiency and participation
coefficients, organizing them and matching the results with the node coordinates for H6
"""
import os, sys
import pandas as pd
from scipy.io import loadmat
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_... |
4cabb1a6e1d1df4c4f47cb4518f412c65d942c92cdd9a4b0967819738ed063ad | Python | 3,321 | 90 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-01-30
# Description :
#
#======================... |
97e880cda03d6f85aba30e2746d0462513fbfde2ac4c4fea95fa97ecf16f7e0a | Python | 3,322 | 70 | from xlsxwriter import Workbook
import numpy as np
class Excel(): # write and save data in .xlsx
def __init__(self,path,data):
self.workbook = Workbook(path)
self.data = data
(self.n,self.m,self.l) = np.shape(self.data.measures)
self.fonts = []
for col in self.data.color_... |
eca33207b329965c6172a53dcf258a2c54076c6b481e1ba45b423bb2735a8823 | Python | 3,322 | 108 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at you... |
230a2196055d991771d3eb5e009cafe41aa334718965b808672d4479eee8a5af | Python | 3,323 | 109 | import logging
from collections.abc import Callable, Iterable, Iterator
from hashlib import blake2b, file_digest
from pathlib import Path
class HwFunctionIdUpdater:
"""Hash all files in `build_dir` except for `target_file` and uses `replace_id_fn` to write the result to `target_file`.
The id will stay the sa... |
a3f13a0476d6cd7d4d260d31c4e24856cde0d7b2ede32b459aa1439e22b38d62 | Python | 3,323 | 77 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
c8556cc370b2871c9e4e19bc085e78483ade3a636c0ae56a4b95459d45c76cf1 | Python | 3,323 | 106 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides an NPC agent to control the ego vehicle
"""
from __future__ import print_function
import carla
from agents.navigation.basic_agent import BasicAgent
from... |
afa65543f5d808a04d32e507d721663dff6697e334450142961484fd942dfe05 | Python | 3,324 | 115 | """"""
import numpy as np
import pandas as pd
import xarray as xr
from pupil_recording_interface import BaseReader
class MotionReader(BaseReader):
""" Reader for odometry data. """
def __init__(self, folder, stream="odometry", source="recording"):
""" Constructor.
Parameters
-------... |
f0b79366029ad38ca4863947f4896f7ab5fde79a5dfab3d55aec5c447e28ce43 | Python | 3,324 | 96 | # ----------------------------------------------------------------------
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... |
3a04fb57f447d0a5f9d379cd8fef075b53ced33371afea11e9d13583343357fa | Python | 3,325 | 99 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: Renames the files contained in source field of the configuration file,
and also renames the source folder to the destination field.
"""
import os
import sys
from src.commands.abstract_preprocessing_command import AbstractPreprocessingCom... |
68d03512b343e3a4b51411dae75d0dea33274c08de32ae233f9a0c491adf05bd | Python | 3,325 | 110 | """Phonon recipes for EMT."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import flow
from quacc.recipes.common.phonons import phonon_subflow
from quacc.recipes.emt.core import static_job
from quacc.wflow_tools.customizers import customize_jobs
if TYPE_CHECKING:
from collectio... |
cf66a3eaf8354aa72acca2ffd96e6fe44fc734cad3e180e3240d79540b83fc03 | Python | 3,325 | 67 | """
This scripts only
"""
import sys
import numpy as np
import pandas as pd
import seaborn as sns
from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.tsa.stattools import acf
import statsmodels.api as sm
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap, BoundaryNo... |
fa1227cbce82957a37f62c61e624827d421ad9ffe1fdb80a4435bb82ab3e28b5 | Python | 3,325 | 121 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
def _wipe_internal_state_for_tests():
global orig_stdout, orig_stderr
orig_stdout = None
orig_stderr = None
global wrapped_stdout, wrapped_stderr... |
1676b2f9913db5220383a809bd4c86500c381773cd2945344a146b1ba9b046d1 | Python | 3,326 | 76 | ##########################################################################################
# Script to analyze the questionnaires data (Valence, Presence, STAI-T, UPPS)
# - descriptive statistics
# - test if valence and presence is different between mov_cond
# - reformat STAI-T and UPPS data
# - descriptive statistics ... |
1a4d20a3e98d1316765df6c22d7cd9c2b9168e66df7c8f6ca1748632164e1f21 | Python | 3,326 | 86 | ##
# \file setup.py
#
# Instructions:
# 1) Set environment variables with prefix NIFTYMIC_, e.g.
# `export NIFTYMIC_ITK_DIR=path-to-ITK_NIFTYMIC-build`
# to incorporate `-D ITK_DIR=path-to-ITK_NIFTYMIC-build` in `cmake` build.
# 2) `pip install -e .`
# All python packages and command line tools are then installed... |
4bbeda6915af4b119e9b732282d05d47324cd339b128b7cb1aef4fc29e5f99ed | Python | 3,326 | 104 | from __future__ import annotations
from pathlib import Path
import pytest
from ase import Atoms
from quacc import change_settings
from quacc.recipes.mrcc._base import prep_calculator, run_and_summarize
from quacc.recipes.mrcc.core import static_job
FILE_DIR = Path(__file__).parent
def test_static_job(tmp_path):
... |
502e457732323091b860ff604ff08b6dd8a9d3e55ab3df90960ff55a665cdee2 | Python | 3,327 | 105 | # Node-group asset "Is Lipid" (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... |
d865eaac99e6a4167222c3a93e4c3c74ed3986cdf75d0c97ec667beef1cebfe8 | Python | 3,327 | 117 | # 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... |
fc281e63a8dd15d5736d8874ef5e8d086b69cc7997ac56c55a5cb8d68a9a64f1 | Python | 3,327 | 89 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
12b7084f4bf7e11a76467d22d2d4c69cddf86c54d193a7ae62e14bbe9aa13415 | Python | 3,328 | 76 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite=suites.suite_optimal_strips()
suite.extend(suites.suite_... |
fea687a4611cb59403edefae4617c129b9f8ed261a41e5959f779392fd2973da | Python | 3,328 | 116 | """Custodian handlers for QChem."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import QuaccDefault, get_settings
if TYPE_CHECKING:
from pathlib import Path
from quacc.types import DefaultSetting
has_o... |
9dd9384a4425f9d528824b37604a2e1f49ed7ddd63f35346496decc41c8d5f97 | Python | 3,329 | 86 | import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
import numpy as np
import os
import pandas as pd
import seaborn as sns
from src.analyze.utils import init_mpl
from src.utils import map_to_score_grid
from src.preprocessing2.process_ratings import merge_rating_files
from constants import DATA_DIR, SC... |
aee08137b49905b5076b52891cdfe3f07389719c63e565878cb17729e0660fa6 | Python | 3,329 | 112 | """Biophysical and linear photoreceptor models.
Port of BiophysModel.m
"""
import numpy as np
from .coefficients import LinearCoefficients
from .params import PhotoreceptorParams
class BiophysModel:
"""Photoreceptor response model supporting biophysical and linear modes.
Args:
params: Photorecepto... |
45c8bfbdc2550f31e56ada5da3636bc2abd7f9d9addb46a58130ddb5389d2322 | Python | 3,330 | 79 | import numpy as np
import comparison_datasets
from skimage.transform import resize
import torch
import glob, os
from torchmetrics.regression import PearsonCorrCoef
import pandas as pd
from torchmetrics.image.fid import FrechetInceptionDistance
import hicreppy.hicrep as hcr
from scipy import sparse
import hicreppy.utils... |
9f1fa920c58e66d3ea802aacadc328d0d0eb8c0a9e19ef94842c52b3013f17b3 | Python | 3,330 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 16 10:41:42 2022
@author: felipe
"""
import numpy as np
import scipy.io as sio
import sys
import networkx as nx
def connectionMatrix(n_nodes=4,weights_type='equal', mean_weight=1.0,std_weight=1.0,symmetric=True,positive=True):
#weigths: equal... |
d0e3b82cb0d234ccd7716d1226502f4cf425a21deec8dde8b41971d6a744f324 | Python | 3,330 | 113 | #
# 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,... |
a4f338c6e20c57bdc2dfc4fd9c467c0bbc61b2066cebab8895268c63c76a4571 | Python | 3,331 | 80 | # Copyright (c) 2022, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
bb9d30e1d4a39aec5ef1e69503f0e061f43952419a51fc2f33a5bdc2c78a7510 | Python | 3,331 | 111 | #!/usr/bin/env python
# coding: utf-8
# # RAISING implementation
# RAISING is a neural network(NN) framework implemented in a two stage approach, first performing hyperparameter tuning to devise the best NN architecture then training on the data to estimate the feature importance. Here we describe the implementation ... |
9466e83ffc0cd1afb1f3aa9c31c52d0a3797a57ad0b23d803e284a2ab7a2326c | Python | 3,332 | 95 | from string import Template as _pyTemplate
from elasticai.creator.template import (
AnalysingTemplateParameter,
TemplateBuilder,
TemplateParameter,
)
class EntityTemplateParameter(AnalysingTemplateParameter):
"""Find the entity in vhdl code and make its name available as a template paramter.
Ass... |
bde24ee2a4bbbc62afada766be383bcff9bb4985ade296663db9806f2967cf33 | Python | 3,332 | 111 | #
# 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,... |
012915cd202ff2647db581a0e52cd5ef85548068c7e33766890fe42b3c62338a | Python | 3,333 | 105 | # Node-group asset "Is Loop" (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 ... |
20c5af614a089e5cbb0078dbe1a9b0de5a7694291b5d88609b333545c6a9149c | Python | 3,333 | 86 | """End-to-end test for the CCF boundary editor.
Synthetic two-region annotation with a cell placed just inside region 1 near
the shared boundary. Pull the boundary past the cell and confirm the cell is
re-counted into region 2, and that region volumes shift conservatively.
"""
from pathlib import Path
impor... |
ddb4d69426f0308aefbaa206a39a912f664e7ad29f9e8ab2a4d22bcb79d724de | Python | 3,333 | 89 | #!/usr/bin/env python
import os
import sys
com=sys.argv
if '-r' not in com or '-1' not in com or "-2" not in com:
print "USAGE: python TAURUS-MH -r <genome_folder> -1 <G to A converted mate> -2 <C to T converted mate> -Trim1 <Trim off first Xbp of reads> -Trim2 <Trim off last Xbp of reads> -split1 <Use first Xbp of u... |
9090321beb0950f334e948dc41855414fdd31b0f3ce720734327d2a32f506cd1 | Python | 3,334 | 106 | # Node-group asset "Between Float" (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... |
9f36bed7f5ba99bc039e017b7095cab2bd750c006b831113a1d9f26126fd9c50 | Python | 3,334 | 80 | """
INITIALIZATION FUNCTIONS
The param_refresh function replaces hyperparameter values with the next set from the file in 'file' mode.
The load function imports the selected dataset.
The initialize_cons function sets parameters to a self-consistent value.
"""
import pandas as pd
# set or update algorithm parameters... |
d1ddbc9e31fc70fff84d76fa275e6b56a31e579e82ff82d86e64b1fe9194a611 | Python | 3,334 | 91 | #!/usr/bin/env python
# Copyright 2025, Felix Krueger (fkrueger@altoslabs.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... |
d3e7a844d275ff4465c74901e88d02e70e3f2841a128bd733be8d6908aea2684 | Python | 3,334 | 105 | # 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... |
e0028dae653cd73d96235e63749516c0fdb9937dca6300f93fc9b419d6a8d81d | Python | 3,334 | 105 | # Node-group asset "Is Helix" (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... |
2182f1ac0b1c3ef67af3b24875063468cbfd8d330469367aaaa793a96232d9f9 | Python | 3,335 | 89 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 12 16:06:18 2023
@author: felipe
"""
import numpy as np
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import scipy.io as sio
import scipy.si... |
3012f54e5f2f697d45f8dea14dea22c5bddd0474409d1e791215cfe8fbd2a1b1 | Python | 3,335 | 89 | """
init file
"""
import os
version = "1.0"
cwd = os.path.dirname(os.path.abspath(__file__))
cwd = os.path.abspath(os.path.join(cwd, os.pardir))
def set_paths(config_path):
"""
Creates path for CKG if they do not exists
"""
structure_directory = '.'
data_directory_structure = {"data": [
... |
718d69727073a73e3cbcca811f266d578d2179a0fbc02039d175d8af21192eaa | Python | 3,335 | 148 | import pytest
from elasticai.creator.graph import BaseGraph as GraphDelegate
from elasticai.creator.graph import bfs_iter_down, bfs_iter_up, dfs_iter
def test_yield_node_in_case_it_has_no_successors():
g = GraphDelegate.from_dict(
{
"0": [],
}
)
actual = tuple(g.nodes)
ass... |
ff7944781870d0618ba3d7774338a5323315d67908189e3e0e08bdc0f04e0b00 | Python | 3,335 | 96 | import numpy as np
def _orthonormalize(X, Y, eps1, eps2, maxiter):
"""Orthonormalize the columns of X against the orthonormal basis Y."""
nrows, ncols = X.shape
output = np.empty((nrows, ncols), dtype=np.float64)
naccepted = 0
for column in X.T:
vector = column.astype(np.float64, copy=Tru... |
3176159ce6113837e23a404b0e57293e70a46a9db63a4cd62ad8c0d564cf7b2a | Python | 3,336 | 91 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
import numpy as np
#TODO: add the lr scheduler
class Trainner:
def __init__(self, model, optimizer, criterion, device, trainloader, validloader, lr_scheduler=None, epochs=30):
self.model = model
self.optimizer... |
691e13da9a0630cc6a3be13924cd828a0a9fb3bdf9bf45a90d117b8c7257632c | Python | 3,336 | 76 |
# Transform log files into a csv
import os
import argparse
import pandas as pd
# Define inputs
# indir: path of input directory
# modeldir: path of model directory
# output: name of output
parser = argparse.ArgumentParser()
parser.add_argument('-indir', nargs=1, type=str, default='0')
parser.add_argument('-modeldi... |
b6d105c6daf3d28b5ee76f049646716ca9ded7e860e8d932eec60a7487b5180e | Python | 3,337 | 93 | # 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... |
ffd0db43a46d9a4bed994235828d4bf0abb458bb971b9946e88cd022fbf92fe3 | Python | 3,337 | 106 | # Node-group asset "Mask Pixels" (CompositorNodeTree), 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... |
e242b4e1437ac66d26270c8309726ee26049313308d0a2a260cb70bcc4c4dc6a | Python | 3,338 | 90 | from pathlib import Path
import pandas as pd
from pytorch_lightning import LightningDataModule
import torch
from torch.utils.data import DataLoader
class SemData(LightningDataModule):
DATA_FOLDER_ = Path("datos")
def __init__(
self, dataset_name: str, test_pct: float = 0.15, val_pct: float = 0.1, ba... |
07da5aeb19ee8933874970c44bdd22ac9a077f639a1dc3b9b427c303219325a7 | Python | 3,339 | 110 | ##
# \file slice_acquisition.py
# \brief Based on a given volume, this class aims to simulate the slice
# acquisition.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date May 2016
#
# Import libraries
import itk
import SimpleITK as sitk
import numpy as np
import os
import sys
fro... |
d1c3a5b3698879bbb8f79d3dd0b95e0ed89e01931d0fb76cff5a7c6a5924eda7 | Python | 3,339 | 106 | # 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... |
f9d14d2571a497404b6bcc8eb4e9f36573123bc2aabfbb923b6e43d92487ef73 | Python | 3,339 | 92 | import pandas as pd
import numpy as np
import gc
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.spatial import distance_matrix
sns.set_context("talk")
def gen_proximity_model(dev_lim):
print('loading raw data..')
fdir = "data/synapse_coordinates.csv"
# load id as integers and a... |
2e2606249cb2d3ce5b41fd571af646f18220602bffe7a042754cf112751b22e8 | Python | 3,340 | 119 | # pylint: disable=invalid-name, missing-function-docstring
""" MLP model module """
from random import uniform, randint
import torch
from torch import nn
from omegaconf import OmegaConf, DictConfig
def get_model(cfg: DictConfig, model_cfg: DictConfig):
return meanMLP(model_cfg)
def default_HPs(cfg: DictConfig... |
2f35d2b58e502a8f0034954219215ced05f0d0226c118f06f4a105a29019b16b | Python | 3,340 | 59 | def addNetColors_Seaborn(fcMatrix):
""" A function to generate a Seaborn heatmap figure with CAB-NP colors added along axes of FC matrix; python 3
INPUT
fcMatrix: a node x node matrix of FC estimates (in the Glasser parcellation, this would be 360 x 360, and presumably the 'grand mean' across ... |
9908654a8561179567065a30c8e228798eabf6f5d7a8ed4efb5e411735498d4e | Python | 3,340 | 105 | # Node-group asset "Is Sheet" (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... |
3548b758a48d13ef261e9f28d391f87b8ec6c48da2918b9c9f0f8d8bce2a15a8 | Python | 3,341 | 104 | # 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... |
89c059733af6dc80e51b88c1a9aba27de486c96d82a9b998a1fcfb10ecc24fed | Python | 3,341 | 125 | from __future__ import division, unicode_literals, print_function # for compatibility with Python 2 and 3
import matplotlib as mpl
import matplotlib.pyplot as plt
import math
import warnings
warnings.simplefilter("ignore", RuntimeWarning)
# change the following to %matplotlib notebook for interactive plotting
%matplo... |
fb2ecca9faabde59f11fe38df8ba25b249ad16c767becdada05d5703283b3167 | Python | 3,341 | 83 | from unittest import TestCase
from codex.service.search import pagination_data
class TestSearch(TestCase):
def test_pagination_data(self):
self.assertEqual(
([], [1, 2, 3], 20, [10, 20, 50, 100]),
pagination_data(items_list=[1, 2, 3], page_number=1, page_size=20),
)
... |
4208049993765f2c56eea25ecc0c53c9777da73379ae697f596956e03e0106f7 | Python | 3,342 | 103 |
# Adapted from https://github.com/waliens/multitask-dipath, since the original code is not compatible
# with current pytorch version
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
from pathlib import Path
import torch
from abc import abstractmethod
from torch import nn
from torchv... |
7035f1c8388c2966c662a88a51166de60a520fe2d39b14c3003280f3f4469ffe | Python | 3,342 | 66 | import os
import pandas as pd
import numpy as np
import unittest
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.uml import filter_data
class TestFilterData(unittest.TestCase):
def test_filter_data_frame(self):
# Test case 1: df['kapa'] 10 - 40, df['f... |
98737cbfde0d4f5e412f7afb18841e535727a623210dd062dc9a5a2c963b3834 | Python | 3,342 | 108 | import torch
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import MolStandardize
from moleculekit.util import uniformRandomRotation
from moleculekit.smallmol.smallmol import SmallMol
from moleculekit.tools.voxeldescriptors import getVoxelDescriptors, viewVoxelFeatures
import matplo... |
a9188117b1f9af9a934d6531ee2b068690b9818cd377a22b3e7835890de7a11b | Python | 3,342 | 91 | from sitetack.app.model import Model
from sitetack.app.enums import PtmKind, OrganismKind, LabelKind
from sitetack.app.alphabet import Alphabet
from sitetack.app.kmer import Kmer
from sitetack.app.predict import Predict
import tensorflow as tf
from itertools import product
import pytest
class TestModel:
def test_... |
be536bcecb0aa053b500134d4235b0c601f5274ea2d33fa1b9d188039dd4229e | Python | 3,342 | 110 | """Input-output functions
-------------------------
"""
import numpy as np
import scipy.sparse as sp
import os
import h5py
def load_h5_to_sparse_X(X, h5data, sparsetype='csr'):
"""
Loads sparse matrix stored in COOrdinate format in HDF5.
Parameters
----------
X:
Group name for datasets
... |
3aed35f842ed77a6454358b1e9e2d9114033da7da087742b1824c1c2e75663f0 | Python | 3,343 | 109 | #
# 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,... |
a1db1e138973be30470361ddad10d08e6513a0f0a874a328aedc0ce76d7a8aa0 | Python | 3,343 | 101 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
June 2024 by Paulien Voorter
paulien.voorter@gmail.com
https://www.github.com/paulienvoorter
Code is uploaded as part of our paper in MRM: 'Diffusion-derived intravoxel-incoherent motion anisotropy relates to CSF and blood flow'
"""
# this loads all patient data an... |
a453043af23638772309dde89cf1ce2649ef55f6a80643c53acf26cb6f1271e8 | Python | 3,343 | 105 | # Node-group asset "Is Solvent" (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
fr... |
ed5faf04a3db3e9cf6426740890df397dbe5493059f86827312ae7aa62bd65cf | Python | 3,343 | 90 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "7"
import util as tools
import torch
from Dataset.mydataset import Dataset
from BDNN_Model import BBP_Model
from BDNN_Model_Wrapper import BBP_Model_Wrapper
import numpy as np
from Dataset.Environment import Environment
def init_world_model(Exp, file_name):
... |
b6f5e2e9d66c6d09de68d51ec86efc54fa58fa7418e8ac217c1d0b1529ed0da8 | Python | 3,344 | 95 | from plantsegtools.utils.io import load_h5, load_tiff, create_h5
from plantsegtools.utils.edit import crop_image
from skimage.segmentation import find_boundaries
import tifffile
import numpy as np
import csv
import os
import argparse
def parse():
parser = argparse.ArgumentParser()
parser.add_argument("--path"... |
269889fbb6f0a44c7733a02d5718228cab527999e0c2b6f2be06d13092651cac | Python | 3,345 | 100 | # Node-group asset "Unique Chain ID" (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_CHECKI... |
2753adf8767de4acf98cc47f0090037c14a618996c7bd4e7a74ae39e2fc08386 | Python | 3,345 | 118 | import torch
from torch import nn
class scPerb_vae(nn.Module):
def __init__(self, opt):
super().__init__()
self.opt = opt
input_dim = opt.input_dim
hidden_dim = opt.hidden_dim
latent_dim = opt.latent_dim
self.encoder1 = nn.Sequential(
nn.Linear(input_dim,... |
9aea1fe223199557be9cd649fedf9da5e7ddfbb9a60b4f1b08edc8d044718c2c | Python | 3,345 | 99 | # 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... |
6c174080d98236efd5348392e30a64ddfd4394add903f8de883b15ed225d81ee | Python | 3,346 | 103 | from abc import ABC, abstractmethod
from collections.abc import Iterable
from elasticai.creator_plugins.grouped_filter import FilterParameters
from ._ir import (
DataGraph,
NameRegistry,
Node,
NodeConstraint,
Registry,
Rule,
attribute,
build_sequential_ir,
ir_factory,
pattern_r... |
ee10bf2c0cb157add802cf0538244b10f25da9031c0b5794b99528a9ff3329a2 | Python | 3,346 | 83 | from collections import defaultdict
from pddlstream.language.constants import is_parameter
from pddlstream.utils import INF, get_mapping
def compute_order(domain, atoms):
# Most constrained variable/atom to least constrained
# TODO: dynamically select the atom with the fewest options (minimize new additions)... |
ef5a88591bb299da916d17714b5e7c41301937d6f86ba5e1125f06ed20ad4e06 | Python | 3,347 | 72 | import os.path
import re
from collections import defaultdict
from ckg.graphdb_builder import builder_utils
#########################
# IntAct #
#########################
def parser(databases_directory, download=True):
intact_dictionary = defaultdict()
stored = set()
relationships = set()
... |
d4d3d7fb4de31b2b62d23890164f064f1d90a2e8ec8c79448b2ce363d7538ac8 | Python | 3,348 | 93 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import numpy as np
import random
import torch
import argparse
from setting import *
from utils import *
from loader import *
from evaluate import *
from models import *
from XAI_method import *
set_p... |
7d0f143b069e86b6d106d6157a554ff549ba220bd402d9456fef8b8be35cb4ae | Python | 3,349 | 58 | import os
from utils import create_new_folder, download
def get_url(data_path, database='gdc', cancer='pancan'):
"""Several databases are related to TCGA: TCGA Pan-Cancer (pancan), GDC TCGA, legacy TCGA, TCGA TARGET GTEx (TTG). Here are the locations of the different sources. TCGA Pan-Cancer and GDC are directly... |
54b6b4a409400bf90d822f4f990749aee1cfe79b62642927b1155cc508315ad0 | Python | 3,350 | 116 | """Tests for runtime CPU-thread capping (sella._threads).
These verify that the thread controls used to keep co-located Sella processes
from oversubscribing the CPU actually take effect at runtime.
"""
import ctypes
import os
import re
import numpy as np
import pytest
from ase.build import molecule
from ase.calculato... |
caf0c67a54d5ba045ac8f68e17693869bd0acb8777b8e9007ee3908c04a32266 | Python | 3,351 | 109 | """Functions brought over from jaraco.text.
These functions are not supposed to be used within `pip._internal`. These are
helper functions brought over from `jaraco.text` to enable vendoring newer
copies of `pkg_resources` without having to vendor `jaraco.text` and its entire
dependency cone; something that our vendor... |
7d1ba14162feb2e0c50df2426d774f581d4a4dd363b1a04bc3c96ecc760fda42 | Python | 3,352 | 84 | import numpy as np
from ...utils.collections import dotdict
def loadDefaultParams(Cmat=None, Dmat=None, seed=None):
"""Load default parameters for the Wilson-Cowan model
:param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not given, then a single... |
25e127c89d548bd069bf65e63e8e943a36afdc6e8d3a82d417f8f504df676703 | Python | 3,353 | 112 | # Node-group asset "Set Color" (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
fro... |
7bbb507ac0a9a261382ad4f891b5623231a2a552427bbde8c67e688ff1361f0f | Python | 3,353 | 85 | """Validates the onset/offset conditions."""
from hed.errors.error_reporter import ErrorHandler
from hed.errors.error_types import TemporalErrors
from hed.models.model_constants import DefTagNames
from hed.validator.reserved_checker import ReservedChecker
class OnsetValidator:
"""Validates onset/offset pairs."""... |
c10184e24fd7cec48de8444612a2e851c1817f602d61e936b3d5320b14f3d5fb | Python | 3,353 | 77 | """
This script provides an example of how a pre-trained ilastik
PixelClassification project can be used to generate predictions
from within Python, without the need to read/write data from disk.
Once the project is loaded, this script doesn't touch the hard-disk.
"""
from __future__ import print_function
from colle... |
40c2c84b0dceeff38cc8777b16dc6729b77af4ef4b49ccab7b940982b58b696c | Python | 3,354 | 103 | import re
import pytest
from elasticai.creator.vhdl.auto_wire_protocols.autowiring import (
AutoWirer,
AutoWiringProtocolViolation,
DataFlowNode,
)
def _wire(
top: DataFlowNode, graph: tuple[DataFlowNode, ...]
) -> dict[tuple[str, str], tuple[str, str]]:
_autowirer = AutoWirer()
_autowirer.w... |
bbd708b0f23a3c9b30a989dfe70ab64a814e094130e19d17254af68d91ab9eec | Python | 3,354 | 113 | """
Use a saved model to predict a datasets.
This script will also generate a submission file for the challenge.
Model settings are imported from the main train script.
Make sure you import the version of the main script you want to use and
that this script is in the same folder.
usage:
python predict_test.py
"""
... |
50d68e141c3f3ee77dabab1ecd77f5cdd6bc282300c088e0fefa15876e372d68 | Python | 3,356 | 84 | from collections.abc import Sequence
import torch
from torch import nn
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.SchNet")
class SchNet(nn.Module, core.Configurable):
"""
SchNet from `SchNet: A continuous-filter convolutional neural network for modeling q... |
21efa835b4655a445ad13a9cd491636847814929dcebac9f5af98a265234fa7a | Python | 3,361 | 93 | import dotenv
import os
import glob
import json
import importlib
from typing import List
from merlin.core import dataset
envPath = os.path.join(os.path.expanduser('~'), '.merlinenv')
if os.path.exists(envPath):
dotenv.load_dotenv(envPath)
try:
DATA_HOME = os.path.expanduser(os.environ.get('DATA_HOME... |
a3cb3412f74021f62df0c1ec76745bff4666db90ad1a5421eabc6b3435329a75 | Python | 3,361 | 122 | #!/bin/env python3
'''
Define a Feynman diagram
'''
import pdlfeynman as fy
import pdlfeynman.particle as fyp
import pdlfeynman.reaction as fyr
import yaml
def determine_particle(node:fy.diagram.Node, key:str='products') -> fyp.Particle|None:
match node.nodetype:
case fy.diagram.NodeType.PARTICLE:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.