sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e068e22aed05593ce552b2f0001b838d4959ea5430553ef60119fc81cc59d9f6
Python
7,487
218
""" Manager and Serializers for Visualizations. Visualizations are saved configurations/variables used to reproduce a specific view in a Galaxy visualization. """ import logging from typing import ( TYPE_CHECKING, ) from sqlalchemy import ( false, func, or_, select, true, ) from sqlalchemy.or...
45d41a24bf210972ca7aca00a30d15c6089734869f02025b8423832889a7e1df
Python
7,488
215
""" experiment launcher using tmux panes """ import os import math import GPUtil import re available_gpu_devices = None class Options(): def __init__(self, *args, **kwargs): self.args = [] self.kvs = {"gpu_ids": "0"} self.set(*args, **kwargs) def set(self, *args, **kwargs): f...
4baeefcd9ccaf0af5eb7ca133f0e524576dd91feaf15295f46215664edb7929f
Python
7,488
171
''' @saulzhang The implementation code of dataset loader class in the the paper "Predicting Future Frames using Retrospective Cycle GAN" with Pytorch data: Nov,17,2019 ''' import glob import random import os import torchvision.transforms as transforms import torch import random import pickle from torch.utils.data im...
f3cbbd5d115d86cd577e23238c545bcfe3f8edec6f1731e2672bb66f779b1de5
Python
7,488
332
#!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 import numpy as np import mahotas as mh __author__ = ['Nico Curti'] __email__ = ['nico.curti2@unibo.it'] __all__ = [ 'evaluate_features' ] def get_haralick (masked : np.ndarray) -> np.ndarray : ''' Extract the Haralick features from the masked image ...
358c028834362f3f9c2d213af4e14581fc38351d2599a8c4e2079cd0a92be0cd
Python
7,489
180
import os import torch import pandas as pd import scanpy as sc import numpy as np from sklearn import metrics import multiprocessing as mp from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import ( v_measure_score, homogeneity_score, completeness_score) import glob2 import matplot...
ab1486e6500fdc59d20df7ecb6da2e8b9b87980d8e1987e87ee9ab6ef9390eb3
Python
7,489
138
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tracking_controller/tracker_control_ui.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_TrackerControl(object): def setupUi(sel...
febd01c396faf765b8fce27644ed5cdd2ff3e705800f066e3d2051c9cb841a7a
Python
7,489
174
import logging import os from os.path import dirname from galaxy.queue_worker import job_rule_modules from galaxy.structured_app import StructuredApp from galaxy.tool_util.toolbox.watcher import ( get_tool_conf_watcher, get_tool_watcher, ) from galaxy.util.watcher import get_watcher log = logging.getLogger(__...
e3ffec68ca2f4685655edcfe8f0bd12dff1f9fc3f4f5bcbff6b61028a887f4dd
Python
7,490
156
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
54510b76c1508ba74a5c8b679b654ec463e69cf50ea6c0ab591160b10e2ce3f9
Python
7,492
212
# Copyright 2022 Deepfold 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 law or agreed to i...
c0beb72258193a7d41f0fe14b2e33d9b0dda9f697bbc9b2f84ffa5fd8a3cce87
Python
7,493
202
#!/usr/bin/env python """ download_db.py Helper script to download databases for the knead_data.py pipeline Requires an internet connection and Python v2.7+. """ import sys # Try to load argparse to check for python v2.7+ try: import argparse except ImportError: sys.exit("Please upgrade to Python versio...
fc31062426ea602e61bd42369ba6f8f66851aa9bb8a0d7a511046b97f9bef354
Python
7,493
217
import pickle import numpy as np from numpy.testing import assert_array_equal import pytest from conftest import get_distances, get_means, get_metrics from pyriemann.regression import (SVR, KNearestNeighborRegressor) from pyriemann.utils.kernel import kernel from pyriemann.utils.mean import mean_covariance regs = [S...
2217595d16856a5c72857dc283f9eec2fb3bbc5c68edd59ce6f6d08ac4a358ff
Python
7,496
177
from . import InvertibleModule import warnings from copy import deepcopy from typing import Sequence, Union import torch class Split(InvertibleModule): """Invertible split operation. Splits the incoming tensor along the given dimension, and returns a list of separate output tensors. The inverse is the ...
5222d8d6ce8eaaf572c82afb78194307e017bb582e7420fcff0f0d550b66627f
Python
7,498
211
"""Regression tests: selective save/grad selectors under orphan-removed ops. Postprocess removes internally-sourced dead branches (orphans) from the raw capture, which renumbers final layer ordinals, type indexes, and labels relative to capture-time raw indexes. Integer ``layers_to_save`` ordinals, exact final labels ...
d2c7657e6081ad1cdf3a7b4f4451bd6cae9a3c4329831d21a90806dd1a532a16
Python
7,499
188
"""Deep chains (compo memo stratum 3; F36 waves A-D). One invariant at every hop: honesty and provenance facts SURVIVE the chain. Each chain crosses at least three product transitions, and every cross-member/ragged read is exercised AFTER a save/load round trip (foldB D18 law 2). Toy models by design -- the chain topo...
49bdd465e66a12fb536ac08dd0cfc827e1b413549d712cf34ea846d11a349d5f
Python
7,500
184
import numpy as np import pathlib import sys import shutil import tempfile import unittest from asmc.asmc import * data_dir = pathlib.Path(__file__).resolve().parent.parent / 'ASMC_data' if not data_dir.exists(): print(f'ERROR. {data_dir} does not exist. Did you clone ASMC recursively with submodules?') sys....
5cda411c354d1d088e50b6bad9cd3bd9e99052d16dfd4e0417038a35b35dc64e
Python
7,500
297
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. ''' Modified based on Ref: https://github.com/erikwijmans/Pointnet2_PyTorch ''' import torch import torch.nn as nn from typing import List, T...
ff05ea873a3f5f9c8a302c98e34ebbb60cefefc2c9e7c9e30dcaf1ffda971716
Python
7,500
218
import sys import glob import pickle import powerlaw from itertools import groupby from scipy.optimize import curve_fit from brian2 import second, np, ms def process_data(times, nidx, M, bin_size): si_time = sim_time/ms # ms but unitless bins = np.arange(0, si_time, bin_size) valids = np.zeros_like(bins...
60555f3022836a3d7fc1d076af70e7d2fa8dd38ba9d8c00981bd5c58b0aae9f7
Python
7,502
237
import warnings from typing import Optional import numpy as np import torch def cosine_schedule( step: int, max_steps: int, start_value: float, end_value: float, period: Optional[int] = None, ) -> float: """Use cosine decay to gradually modify start_value to reach target end_value. Args:...
08e8dcb5ea9a599c8e34352321ac9de2765906f24bcdb2911e789670a7622c9c
Python
7,503
258
# This file was automatically generated by SWIG (https://www.swig.org). # Version 4.2.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Import the low-level C/C++ module if __package__ or "."...
1b01dca983709747faca1b689e1d17a4dadedb3405ed0d3ad57338e98ccc16f1
Python
7,504
187
from __future__ import absolute_import, division, print_function import os import sys import tensorflow.compat.v1 as tfv1 from attrdict import AttrDict from xdg import BaseDirectory as xdg from ds_ctcdecoder import Alphabet, UTF8Alphabet from .flags import FLAGS from .gpu import get_available_gpus from .logging impo...
17a25b9a383e38e727e950e4ea082c8a38ab4fcc9b636a42de389a52011c9c0c
Python
7,506
185
#!/usr/bin/env python """BaseShadowHandEnv Environment Wrappers.""" import abc from typing import Optional import gymnasium as gym import numpy as np from gymnasium import spaces from angorapy.common.const import N_SUBSTEPS from angorapy.tasks.core import AnthropomorphicEnv from angorapy.tasks.envs.dexterity.consts i...
def13bbed3485adf8d59327b487fd66ac34cfcca866fff93e6182f3e2e7297e7
Python
7,506
156
import numpy as np import os.path from data.base_dataset import BaseDataset, get_transform from data.image_folder import make_dataset from PIL import Image import random import util.util as util class SingleImageDataset(BaseDataset): """ This dataset class can load unaligned/unpaired datasets. It require...
335633fc1d3514514d6892d3ffa910ce701c93c10ec671a1b30c3181b319a4b3
Python
7,507
210
import argparse import copy import json import pandas as pd import numpy as np import sys from pathlib import Path from survival_plus_x.models.cox_lightning import compute_cindex, compute_stratification_logrank_pvalue def main(args): # configure the reduction function of the ensemble assert args.ensemble_r...
52d89a57e46fe7bed1b34e67d8e56e4a29511f9664449706e1ef0c75134bc943
Python
7,508
167
import sys import os sys.path.append("../src") from tensorflow import keras import modeling import data_prep import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import spearmanr, pearsonr import pandas as pd from functools import reduce from matplotlib import rcParams rcParams['fi...
1388c2930bacb1f4747243337d226730354c6c156c58db4e7a432bdb2811323f
Python
7,509
226
import numpy as np from keras.src import backend from keras.src.api_export import keras_export from keras.src.utils import tf_utils @keras_export("keras.utils.normalize") def normalize(x, axis=-1, order=2): """Normalizes an array. If the input is a NumPy array, a NumPy array will be returned. If it's a ...
c0a7bd37dfd342053e3ca366dbc28ddef55f13e98d16c87ea4e8bbea9f4a89ec
Python
7,510
185
#!/usr/bin/env python3 """ File: export_fim_to_excel.py Created: 2022/06/23 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this source tree. ""...
49507daf99137a90878d8685dd39ee4f9ccac5f1b047d8de895ffbc428c431ae
Python
7,511
144
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.homology as homology import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rnn import...
799d5bcc30f15c9a7d5ef524b094bf74c7ce3f827db779db897a007699d1f0d9
Python
7,511
187
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class YBins(_BaseTraceHierarchyType): _parent_path_str = "histogram2dcontour" _...
79ac8b1f1c0ebd14db2534cd7d8d4fc62f6af1ca62d16cbf9e6c8c1f0d924cdd
Python
7,511
187
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class XBins(_BaseTraceHierarchyType): _parent_path_str = "histogram2dcontour" _...
6e870e29c1f6d56852a9ff222045fb63c9e0f49770ced7577f198fd77eb86d40
Python
7,512
222
import unittest from unittest.mock import MagicMock, patch from codecarbon.output_methods.emissions_data import EmissionsData from codecarbon.output_methods.http import CodeCarbonAPIOutput, HTTPOutput class TestHTTPOutput(unittest.TestCase): def setUp(self): self.emissions_data = EmissionsData( ...
381eeab98e26cf03f92880a9a6ec78e4441b811d6c51f1af5e35f394ccb22638
Python
7,513
203
"""M4 equivalent-lane parity (compo memo stratum 1; F36 wave A). The same semantic request down different lanes (string label, Selection, predicate, accessor) must accept/refuse IDENTICALLY -- the memo's founding counterexamples were zero-match asymmetries (a selector lane refuses typed while the plan lane silently wa...
e22fcde664c4e849ae26556a72cf77e890fdaf82031b1b239ce4571b4bace39f
Python
7,513
144
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path import numpy as np import torch from ultralytics.utils import LOGGER, NUM_THREADS from ultralytics.utils.checks import check_requirements from .base import BaseBackend class LiteRTBacke...
c3e3cd763a39cb56ef37100cfbed7f2d95cf6a2786af359e7bad644a0bf7c4f2
Python
7,514
185
#!/usr/bin/env python3 import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import glob, re, sklearn, collections, argparse, sys, os import sklearn.metrics import scipy import caffe from caffe.proto.caffe_pb2 import NetParameter import google.protobuf.text_format as prototxt from ...
f4be3e6caf6f7f62d02c22aede767798a5a176f77d1b2f90df45439354e7df49
Python
7,517
141
import torch from .base_model import BaseModel from . import networks import itertools from data import aux_dataset class Pix2PixAttnModel(BaseModel): """ This class implements the pix2pix model, for learning a mapping from input images to output images given paired data. The model training requires '--datas...
3fdfa5367bc0cf32cb0e2021eb0d6dd7690e6108a2a7610fe0812e494c706226
Python
7,518
231
""" Braitenberg-style robot agents. Implements the classic sensor-to-motor crossed and uncrossed wirings, used as a minimal reference controller for the 2D robot simulation. """ from __future__ import annotations from typing import Any import random import numpy as np from ... import util from ...model.modules impo...
4cf9f4fddeff18324814db338757a0490ca9dfdf02c8ac35bdecd77f22c93dae
Python
7,518
259
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections import datetime import time logging.basicConfig(stream=sys.stderr, level=logging.INFO) logger = logg...
5a91481bda22ad953ccf8de863253caa1c7b973d9a22ed0e72dcb23363d4ebc1
Python
7,518
198
import math from typing import List, Tuple import torch from pytorch_lightning import LightningModule from torch import Tensor from torch.nn import Identity, ModuleList from torch.nn import functional as F from torchvision.models import resnet50 from lightly.loss.swav_loss import SwaVLoss from lightly.models.modules ...
d7b8ed4672c97488069554ea00cc3a7bddd7cbebd8734d267ab5ae553f46f1c9
Python
7,518
267
import copy import gc import pytest import rpy2.rinterface as rinterface rinterface.initr() def test_invalid_init(): with pytest.raises(ValueError): rinterface.Sexp('a') def test_init_from_existing(): sexp = rinterface.baseenv.find('letters') sexp_new = rinterface.Sexp(sexp) assert sexp_new...
beeda41ffb5cb4d85c8fcec6710dff951f43421811ee5ec25ba08222355c1c31
Python
7,519
175
"""Implementation of a space that represents the cartesian product of `Discrete` spaces.""" from typing import Iterable, List, Optional, Sequence, Tuple, Union import numpy as np from gym import logger from gym.spaces.discrete import Discrete from gym.spaces.space import Space class MultiDiscrete(Space[np.ndarray])...
e3834d6be645f6d829586071de9c26decb058249ae7e00ed2c5d2a8604cbcd73
Python
7,521
167
""" Diffusion utils. """ import paddle from helixfold.model import all_atom from helixfold.model import r3 from helixfold.data.data_utils import generate_backbone_affine, generate_torsion_angles from helixfold.model import quat_affine, all_atom from helixfold.relax.amber_minimize import make_atom14_positions import gzi...
b7bee65760e32d9f00c0cb2ecc1eb55b72301f6744183be4872c03f54fd0f544
Python
7,526
191
import argparse import logging import time import warnings import sys import contextlib import os import utils import numpy as np from pqdm.processes import pqdm import pmsurv_exponential import pmsurv_weibull import deepsurv import pmsurv_common #TODO: https://docs.pymc.io/en/v3/pymc-examples/examples/pymc3_howto/up...
6449f3e105884aa7d9aac4ae3ae0b0782e1c4f6ff3eccbae6bc1397eab7f69ca
Python
7,527
194
"""Save out reports from model objects.""" from specparam.io.utils import create_file_path from specparam.modutils.dependencies import safe_import, check_dependency from specparam.plts.templates import plot_text from specparam.plts.group import (plot_group_aperiodic, plot_group_metrics, ...
7d77a6bdbcafe43fb7f50f51c67d8afe6a1e30628ac83dc6b77fe3611372b3a0
Python
7,527
205
import time from pathlib import Path from h5py import File import torch from tqdm import tqdm from torch.utils.data import Dataset, DataLoader from itertools import cycle from rbm.potts.functions import init_chains, init_parameters from rbm.potts.pcd import fit_batch from rbm.potts.functions import init_chains, init_p...
27b35218edbd61bd310266544c28c0ac8135ac19bf67d4c43f1672a8e826d765
Python
7,531
199
"""Declared episode derivation on a REAL model (lane F40b; foldA s6 F40). The realism arms the D8 rebuild must flip from refused to supported, on the R0 roster's REAL distilgpt2 class (vendored config, zero network): a root returning what real ``generate()`` returns (prompt+completion); the KV-cache last-token feed (t...
8ca510646d350f29d3ee8d25cd525c3b8c07db41daddaaf058dd2ce7bd05686f
Python
7,531
225
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
3e282b2b96e45b2d60b6126bcc8fb1d9944e84a7c0a1c5372fd71389d7aa428f
Python
7,534
241
"""Caper's HPC Wrapper based on job engine's CLI (shell command). e.g. sbatch, squeue, qsub, qstat """ import logging import os import subprocess from abc import ABC, abstractmethod from pathlib import Path from tempfile import NamedTemporaryFile logger = logging.getLogger(__name__) CAPER_LEADER_JOB_NAME_PREFIX = 'CA...
6dfaeb9e97a2be08b2cb3ac01e1a8a7b8e18000ba9adbdb5b73bd51696f219a0
Python
7,534
168
from __future__ import annotations import logging import os import pprint from typing import Optional import grpc import minknow_api.statistics_pb2 as mk_stats import pandas as pd from bream4.device_interfaces.devices.base_device import BaseDeviceInterface from bream4.toolkit.procedure_components.grpc_streamer impor...
e8e1163796b16c037979dc53bdd34ef649eebe321ba9afcf425e72c962ff90ca
Python
7,534
231
import logging import os import platform import re import sys import traceback import uuid import sentry_sdk from qtpy import QT_VERSION, QtCore from sentry_sdk.integrations.logging import ignore_logger import llspy from llspy import schema from llspy.cudabinwrapper import CUDAbinException, gpulist logger = logging....
4f08c95e481a6578a34a6b1e62d0a540b553be8f78683011e162521895c48aa3
Python
7,535
194
import numpy as np from keras.src import initializers from keras.src import layers from keras.src import ops from keras.src import regularizers from keras.src import testing from keras.src.backend.common import AutocastScope class LayerNormalizationTest(testing.TestCase): def test_ln_basics(self): self.r...
61b50829adeff40871bd43cf322493b15ab2777a2503eedae20f228c882ea3b1
Python
7,535
198
import copy import cv2 import numpy as np import torch from skimage import measure from utils.lung_cropping_model.deeplab import DeepLab def refine_lung_region(imgsSegResult): imgs = np.where(imgsSegResult > 0.5, 1, 0) region = measure.label(imgs) props = measure.regionprops(region) nu...
945095641c407a6373e852a3301af89fb3e3b4252c691a575979ffea678267fe
Python
7,536
203
""" ==================================================================== Offline SSVEP-based BCI Multiclass Prediction ==================================================================== Building extended covariance matrices for SSVEP-based BCI. The obtained matrices are shown. A Minimum Distance to Mean classifier i...
fa03af382f9b267153d13d92c8a20346f5bd69590c2031e667d8f5bdb2118544
Python
7,536
192
import argparse import csv import pandas as pd import numpy as np def compute_indel_length(fs_df): fs_df['indel len'] = 0 fs_df['indel len'][fs_df['Reference_Allele']=='-'] = fs_df['Tumor_Allele'][fs_df['Reference_Allele']=='-'].str.len() fs_df['indel len'][fs_df['Tumor_Allele']=='-'] = fs_df['Reference_A...
7b123b2bb0b159be1a81bdeadfa1afa360dbc44d44cad7c35434d6c006b94f9d
Python
7,537
255
from anndata import AnnData from typing import Optional, Union import numpy as np import pandas as pd import networkx as nx from scipy.spatial.distance import cdist import scanpy def pseudotime( adata: AnnData, use_label: str = None, eps: float = 20, n_neighbors: int = 25, use_rep: str = "X_pca", ...
7d196832742861dcbcf8f1792276d403acf30322da698f639b0f2b2d00bf8fa7
Python
7,539
193
import lifelines import scipy.stats as st import numpy as np import pandas as pd import pymc as pm from pmsurv.exc import PyMCModelsError from pmsurv.models.base import BayesianModel import pmsurv.utils class GaussianProcessModel(BayesianModel): def __init__(self): super(GaussianProcessModel, self).__init...
bc6bfad440d81797b6edc33d728cec205587cdb8efe854f4a600a10e52767cdc
Python
7,539
234
""" =============================================================================== Metric comparison =============================================================================== A comparison of the usual metrics used to process SPD matrices, computed mainly for 2x2 matrices to display intuitive visualizations. """...
3b8f9623731e0016f659f5c43767aa0da9630ee819459a98338a25e5446a3d8d
Python
7,541
180
""" Test objects and function in the package ``tfep.app``. """ # ============================================================================= # GLOBAL IMPORTS # ============================================================================= from collections.abc import Sequence from typing import List, Optional, Type,...
95f8956a4a5ec7eda9dd2d914251aab1fa07722cdfd0eaec842f170e75678094
Python
7,543
217
from pydantic import TypeAdapter from galaxy.datatypes._schema import ( DatatypeConverterList, DatatypeDetails, DatatypesCombinedMap, DatatypesEDAMDetailsDict, DatatypesMap, DatatypeVisualizationMapping, DatatypeVisualizationMappingsList, ) from galaxy.datatypes.data import Data from galaxy...
cb10bb82d0c8a0e7173a7c020443e0ebbd65a39fcc23fd18bf6e29504387eb4f
Python
7,544
241
import os import sys import traceback from typing import Dict, Tuple from pathlib import Path import pickle import shutil import numpy as np import pandas as pd from numba.core.errors import NumbaDeprecationWarning from numba.core.errors import NumbaPendingDeprecationWarning import warnings warnings.simplefilter('ig...
f11a491d7a0493e347f76f0d45f018bd7a5f721fa4e729e578f01c2b9817fa14
Python
7,546
234
import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F def get_inplanes(): return [64, 128, 256, 512] def conv3x3x3(in_planes, out_planes, stride=1): return nn.Conv3d(in_planes, out_planes, kernel_size=3, ...
c535a828fc55dd62be6746b80c6427d14f90a5f94a638112ec073c9f7ffc6ace
Python
7,549
241
""" Triple format classes """ import logging import re from galaxy.datatypes import ( binary, data, text, xml, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix...
3d1d4f9444315f1acb1fa5454aede880eab3e2849cacddbc221b6a29d1227401
Python
7,552
214
"""``tl.validate`` hands the live model back without writing into its tensors. Regression pin: every validate scope used to restore the model's state by ``load_state_dict`` even when the validation runs had not changed it. That copies the snapshot into each parameter and buffer in place, so every ``_version`` counter ...
3f00560d8324487b683bdfb06e5b10d573284d12c42351f4ee0df519fb53bf56
Python
7,552
199
''' this project were based the pytorch, pytorch lightning and pytorch video library, for rapid development. ''' # %% import os from pytorch_lightning import Trainer, seed_everything from pytorch_lightning import loggers as pl_loggers # callbacks from pytorch_lightning.callbacks import TQDMProgressBar, RichModelSumma...
e27f8bc7d61d62330c498d100d4a5c77754553f12833a74be8546a69653c5c4f
Python
7,552
184
"""W051-AGENT: closure handoff on multi-pass traces (AUD-CODE 3.11d), per-row reduction status (3.11f), JSON-safe logged values (2.6), and the 4.8 boundary refusals, plus realistic-fixture paging (4.9).""" from __future__ import annotations import json from pathlib import Path import pytest import torch from torch i...
f54e3ee707459ff4003e8280554a6a8ec7bc7340c00a35a7a534d9c07851b5ae
Python
7,553
198
"""Tests for bdpy.recon.torch.modules.generator.""" import unittest import copy import torch import torch.nn as nn import torch.optim as optim from torchvision.models import get_model from bdpy.recon.torch.modules import generator as generator_module class LinearGenerator(generator_module.NNModuleGenerator): ...
19faf76fd93c6b7b26474c4bf46f7f06f618e95c0937ffb5199773c846a79834
Python
7,554
242
import pickle import numpy as np from numpy.testing import assert_array_equal import pytest from sklearn.model_selection import cross_val_score, KFold from sklearn.pipeline import make_pipeline from pyriemann.estimation import Covariances from pyriemann.geometry.kernel import kernel from pyriemann.geometry.mean impor...
5a8bba9a6f38015b3216d4f187657ceb54b4d9c610fa856d4f28858b5d284587
Python
7,554
198
#Autor: Carlos Alberto Hernández Nava #ASVspoof2017 Spectrogram extractor an convert to csv import sys, csv, os, time, shutil, cv2 import pydub import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.signal as signal import soundfile as sf from PIL import Image from pydub import AudioSegmen...
e86c02fc1592f37d7ba0c59f8d5bd32d6d5fc93ca92a3819b0a5366d5d7e96fa
Python
7,555
177
import io import os, sys, glob import shutil import zipfile import requests import src.EP_Generator_utils as EP_Generator_utils from eppy.modeleditor import IDF from src.Signal_Generator import generate_signal_for_EP from src.OB_GEN.OB_Generator import ob_gen def download_epw_create_directory(epw_url, configs): e...
972e73df1353b3367f4159c1b2f4540a3dcd8112e2489ea09854b42994309ba0
Python
7,556
215
from operator import concat from typing_extensions import Self import torch import torch.nn as nn import torch.nn.functional as F import dgl import dgl.function as fn from dgl.utils import expand_as_pair from graphmae.utils import create_activation class GCN(nn.Module): def __init__(self, in_di...
edf3cc84eb22bdd90b0e658b254aff0df274b24c96175ed77a71af7a810774c7
Python
7,556
204
"""Replay engine: buffer-state threading and in-place ownership. Regression net for the 2026-08-19 buffer-replay finding: the replay engine executed in-place funcs on tensors it did not own (captured record outs and committed overlay tensors, resolved BY IDENTITY), and buffer version records were excluded from overlay...
7b316183d82b79ac50084c759ed828ba3e0823674b11b303e0d1a660ad6d7774
Python
7,557
221
""" Base class for making forms in the system UI. Use with plugin_controller for automated plugin-controls SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is free software: you can redistribute it and/or modify it ...
f9cf252932c23cfda1497f91fe2e55603a019952ad84554ae232681ad1a17212
Python
7,557
182
import contextlib import os import random import numpy as np from sklearn.model_selection import KFold, StratifiedKFold import torch from torch.utils.data.dataloader import DataLoader # from torchsummary import summary from hn_cnn.cnn import MODELS from hn_cnn.constants import * from hn_cnn.data_augmentation import ...
b50e2f78d727d4d35964e7a12243aeaec25e82d108b2ea7b7d617d2a432014ce
Python
7,567
195
""" Larva-shaped agents for the 2D robot simulation. Adapts the robot control loop to the larva body model, so that sensor-driven Braitenberg behaviour can be simulated with the same body as the larva agents. """ from __future__ import annotations from typing import Any from ... import util from ...model.modules imp...
2a37abecf9ba4f6f94437036a67134f05149496ed5b10ea8bb73c72214240337
Python
7,568
150
from skmob import TrajDataFrame from skmob.measures import collective from skmob.utils import constants import numpy as np import pandas as pd import math class TestCollectiveMetrics: def setup_method(self): latitude = constants.LATITUDE longitude = constants.LONGITUDE date_time = constant...
57e83827f993b8f6ad5634bbaeb2ee0e2bfe761f4da10f6ca3119ac1a32a80bc
Python
7,568
205
import os import h5py import numpy as np import pandas as pd from modiscolite.io import save_hdf5 from modiscolite.tfmodisco import TFMoDISco from .._utils import _make_dirs, _path_to_image_html from modiscolite.report import run_tomtom, create_modisco_logos, report_motifs def _trim_cwm( cwm, trim_threshold=0....
8d841edd8dbf24fd63f8d1be0b53db0f3768b479403c6795ab719bc8e0307638
Python
7,568
245
"""Define object to manage algorithm implementations.""" import numpy as np from specparam.data.data import DATA_FORMATS from specparam.utils.checks import check_input_options from specparam.algorithms.settings import SettingsDefinition, SettingsValues from specparam.modutils.docs import docs_get_section, replace_doc...
e21f64d632a7f6658cf9a780ede24271a53f3b4d3be5cb453c7ad5a69ee155ad
Python
7,571
204
import torch import torch.nn as nn import torch.nn.functional as F from ..base import _layers as layers from ..base import _regularizers as regularizers from ..base import _blocks as blocks from ..base import _towers as towers class DeepMEL(nn.Module): """DeepMEL model implementation from Minnoye et al 2020 in Py...
efcdc34a470f65e12a4f1372256f14c9083f33459a1223fa0de6b8e42a7aba79
Python
7,571
197
"""Eelbrain GUIs""" def run(block=False): """Hand over command to the GUI (quit the GUI to return to the terminal) Parameters ---------- block : bool Block the Terminal even if the GUI is capable of being run in parallel. Control returns to the Terminal when the user quits the GUI app...
f7fa9efc66ea777a44f68c2dc0fdd012205a7eb913bf511623957530cca512bf
Python
7,571
218
from unittest import mock from uuid import UUID import pytest from carbonserver.api.infra.repositories.repository_emissions import ( SqlAlchemyRepository as EmissionRepository, ) from carbonserver.api.infra.repositories.repository_experiments import ( SqlAlchemyRepository as ExperimentRepository, ) from carbo...
8a33ef029b0de2369c7d6e8df85417b193189ac338fc91bc5648e1c605913935
Python
7,575
198
import time ## Panel classes class BasePanel(object): """Returns a panel instance. This class should be subclassed to define a local panel configuration. To build a panel, do the following in the __init__() method of your local subclass: 1. add instances of the necessary interfaces to the ...
45def4c5282078c57b43827d7ea884e2dd160132cf2d8d75dae57a20a296c132
Python
7,576
246
### Prototype of Growing neural gas import numpy as np import random as pyrnd from pylab import * from .metrics import euclidean, cityblock, pearson, spearman, xcorrdist class Edge: def __init__(self, node1, node2): self.nodes = (node1,node2) self.age = 0 def length(self, distfn=euclidean): ...
b356764b4c5a04180e5d856f68b5b92e433461dec22f17f0a8c7362096905331
Python
7,577
216
"""Brain-Score ``ActivationsExtractorHelper`` adapter tests (bridge P11). The ``get_activations`` contract is exercised offline (no Brain-Score install needed); the extractor wiring is verified against a stub mirroring the real ``ActivationsExtractorHelper`` constructor read from the brainscore-vision 2.3.22 wheel, pl...
21e3cad7d7f74b07b5829842232fa3221c2020b8a161dc431f48292c48071a94
Python
7,578
220
#!/usr/bin/python3 #-*-coding:utf-8-*- # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not us...
44c527b8af0f6247baad2de65973fbaf33659c7aa0dfb2d581cc24b944f88b41
Python
7,579
206
""" Code here relates to the from-scratch creation of data which simulates electrical recordings of neurons. Creating data from scratch is useful because (1) you can generate your own ABFs to analyze without requiring access to real recordings and, (2) generating data with known events allows you to test your event de...
4966b295bb342979c8337aa0213668c892d2960ee3fd4c539c203e7cdee48ff0
Python
7,579
259
# This file was automatically generated by SWIG (https://www.swig.org). # Version 4.2.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Import the low-level C/C++ module if __package__ or "."...
732a492ae616fe07490d7831f86b1af08da3771a4ce1a6793ccef768c3e480b1
Python
7,580
190
import os import pandas as pd import numpy as np import sys sys.path.insert(0, "/home/abraun/pymeg") import pymeg from pymeg.contrast_tfr import Cache, compute_contrast, augment_data from pymeg import contrast_tfr from pymeg import parallel from joblib import Memory import logging import glob import pdb from optparse ...
e9e43d24626e75f2398657d788118f944fb47a85b3e583506de5d39dd509887c
Python
7,582
257
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from typing import List from warnings import catch_warnings, filterwarnings import numpy as np from scipy.linalg import norm from scipy.stats import spearmanr, SpearmanRConstantInputWarning from ._boosting_opt import l1, l2 from .shared import DeconvolutionData...
8df990c645cce9a02180e12e88c2cd404ff37781a15e79a87b3fb0a2c8f94b81
Python
7,583
223
"""Evidence envelope + all-channels disclosure sweep (memo sec 5 / item 14). ONE immutable envelope, computed once at settlement, consumed by every surface; the banner ladder is HYPOTHESIS -> CORROBORATED -> REFUTED and no channel may launder it. The parametrized all-channels test enumerates every banner-bearing surfa...
01c152ac5bc98fc49080531d66da8fd8db4e6111503def5f47c636b57402ae8d
Python
7,586
209
from __future__ import annotations from typing import ( Annotated, Literal, ) from urllib.parse import quote from pydantic import ( AliasChoices, Field, ) from galaxy.exceptions import ( AuthenticationRequired, MessageException, RequestParameterInvalidException, ) from galaxy.files.models...
37beebc5b253a608e73a64ea6699809ea2cb6c9187e37722cd2b08b373c39ca5
Python
7,590
203
import argparse import os import numpy as np import torch import pytorch_lightning as pl from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping from pytorch_lightning.loggers import WandbLogger from torch_geometric.loader import DataLoader as GeometricDataLoader from pathlib import Path # Imports from ...
3cfa7712575fafd3dcf894275b5b81a51c2a889c292a1a982f7cafdc254d3b51
Python
7,591
225
from unittest import mock import pytest from api.mocks import FakeAuthContext, FakeUserWithAuthDependency from dependency_injector import providers from fastapi import FastAPI, status from fastapi.testclient import TestClient from carbonserver.api.infra.repositories.repository_organizations import ( SqlAlchemyRep...
4b1b613064fad8589407e1eddcad0b198b7bc0adb974642a0b8223403d13ff9d
Python
7,591
232
""" plot_from_dicts_tool.py This script contains functions to plot from dictionaries. Authors: Colleen Gillon Date: October, 2019 Note: this code uses python 3.7. """ import argparse import glob import inspect from pathlib import Path # try to set cache/config as early as possible (for clusters) from util import...
c6bd34bc8d22b4c46eafd6922ed65abcc453528989dc3e9a59e151ae2079d56e
Python
7,591
174
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Written by Yuichiro Yada #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ################################################ # A code for Fig. 3. This code uses an output .pkl file from "prediction_realdata.py". ################################################ import...
317c95fcae4bd662d4e9a4d57aea87ba39c147cd64f048cd500f0f1bceab8851
Python
7,592
216
import os import sys import time import heapq import semver import random from multiprocessing import Pool from collections import namedtuple KILO = 1024 KILOBYTE = 1 * KILO MEGABYTE = KILO * KILOBYTE GIGABYTE = KILO * MEGABYTE TERABYTE = KILO * GIGABYTE SIZE_PREFIX_LOOKUP = {'k': KILOBYTE, 'm': MEGABYTE, 'g': GIGABY...
c38a36643695ad847f45bf112ef682e9de7d558bb40f2a59d7227e2407e05981
Python
7,592
215
from typing import Optional import numpy as np import pytest import gym from gym.envs.box2d import BipedalWalker from gym.envs.box2d.lunar_lander import demo_heuristic_lander from gym.envs.toy_text import TaxiEnv from gym.envs.toy_text.frozen_lake import generate_random_map def test_lunar_lander_heuristics(): "...
51a2312e73b0f6d6cd560afcf17a1835bb26591f31504165618cebecdcf9d01b
Python
7,593
205
import os import json import random import torch import numpy as np from collections import defaultdict from src.utils.util import device from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt class WiCReader(object): ''' WiCReaer reads WiC dataset ''' def __init__(self, config, tokeni...
71afe82da8b72fb5eb6336ba0330959ac2a1a098934be2d6c275a7529db0232a
Python
7,594
163
""" Created on 13/07/2015 Author Peter van Heusden (pvh@sanbi.ac.za) """ import logging import shlex from galaxy.util import ( commands, string_as_bool, ) from . import AuthProvider log = logging.getLogger(__name__) """ This module provides an AuthProvider for PAM (pluggable authentication module) authenti...
eee255c6e56393b925ee0d4f44036b1650a84f30661d60a13e61eabfa7801763
Python
7,594
173
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved # # 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 applic...
c0451e202b4b3996e97e876423e1cdd4864cbc71f6853594601fef75e211803f
Python
7,595
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 9 17:53:00 2022 @author: fcheng """ import os import numpy as np import matplotlib.pyplot as plt import seaborn as sns def change_width(ax, new_value) : """ Change bar width """ for patch in ax.patches : current_width = pa...
ce0611752a941b2bd3051b06e220e7bc6e062e58824fd4bb9335edc5d516dedf
Python
7,595
171
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import math #import copy import numpy as np # ROS libraries import rospy # ROS messages from std_msgs.msg import String from geometry_msgs.msg import Twist #from nav_msgs.msg import Odometry class MoveRobot(object): def __init__(self, hz = 10.0): ...
7cc64c33347344faf8f0e183adfdaafb515936110750cd94299e17f9d3d91745
Python
7,596
241
from pyoperant import hwio, components, panels, utils from pyoperant.interfaces import comedi_, pyaudio_ from pyoperant import InterfaceError import socket import time _ZOG_MAP = { 1: ('/dev/comedi0', 2, 0, 2, 8), # box_id:(subdevice,in_dev,in_chan,out_dev,out_chan) 2: ('/dev/comedi0', 2, 4, 2, 16), 3: ('/...