sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c55f17e3ff80ad90ec10528845d4324f372ca57532f2418bc731d1a30514385
Python
4,903
132
#Autor: Carlos Alberto Hernández Nava #ASVspoof2017 spectrograms MFCC 2D import cv2, sys, os, gc import librosa import numpy as np import pandas as pd import seaborn as sns import openpyxl as pxl import tensorflow as tf from tensorflow import keras import IPython.display as ipd from numpy.random import randn from pand...
a8b898e135840f7924c5523b6b83249662a5d8fe7be18d56349944c1e7d966a4
Python
4,903
178
from abc import ABC, abstractproperty from torch import nn import torch from torch.nn import functional as F from modular_splicing.utils.construct import construct class GenericLinearSRMP(nn.Module, ABC): """ Short range motif reprocessor that uses a linear function to compute the influence of each motif...
1bbd127119d3097dbe3025e3322492d29f453fd76c70b0c376121dfd8a20e588
Python
4,904
102
#!/usr/bin/env python3 """ File: create_PICALO_jobs.py Created: 2021/11/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. """...
a9b0290bc235a2ccea363de2f248806be0a460d8c4949210762198741cda3fc2
Python
4,904
173
""" Widget for editing an environment's thermal landscape. """ from __future__ import annotations from typing import Any, Callable import panel as pn import param from .widget_base import classattr_section, parameterized_editor, widget_block __all__ = ["build_thermoscape_widget"] _DEFAULT_THERMO_SOURCES = { ...
74c22467c0b5d006000dd0aefc1bd70e30f2efac944b1256c86f7bb1589a9fd7
Python
4,905
177
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from math import floor import numpy as np from numpy import newaxis FULL_SLICE = slice(None) FULL_AXIS_SLICE = (FULL_SLICE,) INT_TYPES = (int, np.integer) def digitize_index(index: float, values: np.ndarray, tol: float=None): """Locate a scalar ``index``...
d24c6f0ca02329278a98b876c8d1e1546ff83283e3b95d0593f408cbd0bae7a6
Python
4,908
129
''' This module is used to process the data to make it the standardized csv file, ready for loading into the GNN module. Specifically, this module makes the txt files for the Glasgow Subgraph Solver (GSS). Commands for running the GSS along with the sed commands to clean up the GSS output are included in the comments ...
1d2fdaea7852d2d36238126e52476467e77b057d553fbf7e22b13114746f7f51
Python
4,909
148
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Line(_BaseLayoutHierarchyType): _parent_path_str = "layout.newshape" _p...
2955b9d180be5fa174c50f4089a11f491c72561cbc225ace25e35f64d7368a61
Python
4,909
138
"""DDP unwrap smoke tests for fastlog.""" from __future__ import annotations from collections.abc import Iterator from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens.distributed import has_vetted_snapshot class DdpModel(nn.Module): """Simple model for...
7cea0d2d793af3d627d7a951fc6d0080783cac1dfa52eb23d2817c08627137aa
Python
4,909
137
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
25a95714c1c39c03da3f2fbe789f3184d44d8f41e454a5e305d261ea6a0e61dd
Python
4,911
118
import collections.abc as container_abcs import re from queue import Queue from threading import Thread from typing import Any, Optional, Union import torch from torch import Tensor from torch._six import string_classes from torch.utils.data import DataLoader, Dataset class AsynchronousLoader: """Class for async...
9e1874949cbc4432758c927d3801a174395416c0c15ee25fe922789189ebf823
Python
4,911
171
import os import cv2 import matplotlib import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay matplotlib.use("QtAgg") import numpy as np from skimage import io from skimage.transform import resize from sklearn.model_selection import KFold from model import...
e3454b77cb744557ce337469b08f5765526c314134fc0b166c6b1ddb8366c35d
Python
4,911
141
from biss.backend import BissClassifier, save_prediction, get_volume_share from glob import glob from os import path import threading import time from IPython.display import clear_output from IPython.display import display #from google.colab import files from zipfile import ZipFile as zip from ipywidgets import Layout,...
a7c104f4e496f445039254b6060ddc3a4b7a316ca225019ad0e0964707e701d1
Python
4,912
162
#! /usr/bin/env python import fnmatch import os import re import warnings import numpy as np import tifffile as tf from scipy.ndimage.filters import gaussian_filter def main(infile, nx, nz, sig=1, pad=12): try: with warnings.catch_warnings(): warnings.simplefilter("ignore") indat...
e12c4b67ffe996193e823ea0fab211405bf5640de67a367a600cad23ae5627be
Python
4,912
131
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in November 2019 @author: Nathan de Lara <nathan.delara@polytechnique.org> @author: Thomas Bonald <tbonald@enst.fr> """ from typing import Optional, Union import numpy as np from scipy import sparse from sknetwork.classification.base import BaseClassifier fro...
ffcf51592d86c7a64c14b874e475fd6d313111d0d29954fae0b9070b7a685d1c
Python
4,912
136
""" Plot impact of single-trial history bias as well as of signed stimulus strength on amplitude and slope of M1 beta lateralization """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats from mne.stats import permutation_cluster_1samp_test import seaborn as sns from mpl_axes...
668721f7e13d36fa55439dce605de8ce641b87a6fdcc1da4973217c5616680ae
Python
4,913
146
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import csv import re import math from collection...
38f3ac6ceb22febe8cea0b670aaacc1e6cf2ed1118504433fe3bf3ea142cf234
Python
4,914
151
# %% ''' Code to take individual subject parameter estimates from SPM in regions of interest. We use the mean within rois / spheres. Also an 'eroded' version where ROI size has been controlled for ''' import sys import nibabel as nib import numpy as np import pandas as pd from nilearn.masking import apply_mask from ...
33ac1dc066862a9d7b930eb0a9e9fb42b69b00a5a094150b1ce1ff27d49e121a
Python
4,915
155
from unittest import mock import pytest from api.mocks import FakeAuthContext from carbonserver.api.errors import UserException from carbonserver.api.infra.repositories.repository_emissions import ( SqlAlchemyRepository, ) from carbonserver.api.schemas import Emission, EmissionCreate from carbonserver.api.service...
4335f8c640ab87f6adf78adac9e1b58195f9c7725575e9e00ea9b3de99ddd485
Python
4,916
141
import numpy as np from scipy import interpolate from mitochondria import Mito, to_dpsi from utils import Recorder def get_steady_state(): try: kk = np.load('./steady_state.npz') baselines = kk['baselines'] all_nads = kk['nad_ss'] all_atps = kk['atp_ss'] all_psis = kk['psi...
85cc4961bf7b85212059585773c3bc36504abf70d7b93980cf8872bb2b693f06
Python
4,916
161
import json import os import warnings import SimpleITK as itk import torch import torchio as tio itk.ProcessObject.SetGlobalWarningDisplay(False) warnings.filterwarnings('ignore') def set_transform(size, depth, resample, mode): preprocess = tio.Compose([ tio.ToCanonical(), tio.Resample(resample)...
c34b4742332594d8f8a3c2d0e4d086bd929005738787b973d34f23d2d443d864
Python
4,916
170
__author__ = 'quentin' from git import Repo from git import GitCommandError import logging import traceback import os class DeviceUpdater(object): def __init__(self, git_working_dir): self._git_working_dir = git_working_dir self._working_repo = Repo(git_working_dir) self._origin = self....
72e9f15b27f54809d4ebff577d80c533b2de570ae25e9458374de7333e522c09
Python
4,918
114
import torch from pytorch_lightning import Trainer from torch import nn from torch.utils.data import DataLoader from torchvision.datasets import FakeData from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T from lightly.utils.benchmarking import FinetuneClassifier, LinearClassifier ...
fd20bcf18fc87408d4296b571f98fecbb8b3952bb1220bd8bff4faf98dea840a
Python
4,920
121
""" This module define MetricAccuracy """ import logging from metrics.generic_metric import GenericMetric import numpy as np import pickle as pkl import torch class MetricFMax(GenericMetric): """ This class define the accuracy metric """ def __init__(self, data_for_metric): self.number_of_thr...
1a437b614d7de8f9f580cf955e800c43161a1f535bf0f21f1f0679c1a459f1d0
Python
4,921
161
import json import pytest from database import CategoryModel category1_id = 0 category2_id = 0 category3_id = 0 class TestCategory: @classmethod def setup_class(cls): CategoryModel.objects.delete() @pytest.mark.run(before='test_post_categories') def test_get_empty(self, client): re...
effc092d7c0119706afa68277766a310fe2a1141334c74d6737ba5eaa558a69d
Python
4,921
168
# --- 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 Domain(_BaseTraceHierarchyType): _parent_path_str = "pie" _path_str = "pi...
aa13bec452b0dbd4d853b248266778de96a5b989e045925c05246c6528c5d961
Python
4,922
147
from __future__ import annotations import pytest import torch import torchvision from lightly.models import utils from lightly.utils import dependency if dependency.torchvision_vit_available(): from torchvision.models.vision_transformer import VisionTransformer from lightly.models.modules import MAEBackbone...
da707aeaeb26cd8ce78b453c761909c43f98f671a99d45d3068fef7085a090ce
Python
4,923
142
# ---------------------------------------------------------------------------- # Copyright (c) 2015, The Deblur Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # --------------------------------------------------...
2ae11c9ee297aa826a8cb04a0963083517286f5a77e9951afc3c26e0eeb1411e
Python
4,924
131
#!/usr/bin/env python # -*- encoding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function import io import os from pathlib import Path from setuptools import find_packages from setuptools import setup from Cython.Build import cythonize def read(*names, **kwargs): with io.open( ...
5ca4c320fc34cc08c800b3bc446312b9acc8944e0ad5ef4e6625a3e5ae792c68
Python
4,927
134
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
9efd762d2f3523cc103f651addb15648d0ec448a05abe4eab7c7eec32448f676
Python
4,927
131
""" Attention Pool 2D Implementations of 2D spatial feature pooling using multi-head attention instead of average pool. Based on idea in CLIP by OpenAI, licensed Apache 2.0 https://github.com/openai/CLIP/blob/3b473b0e682c091a9e53623eebc1ca1657385717/clip/model.py Hacked together by / Copyright 2021 Ross Wightman """...
0c74a0f3fe5fa889f64bcdbec4ed2bd65cba7948b62fcc318eb58a7ba641af26
Python
4,928
155
import warnings import json import random from .base import Renderer from ..exporter import Exporter class VegaRenderer(Renderer): def open_figure(self, fig, props): self.props = props self.figwidth = int(props["figwidth"] * props["dpi"]) self.figheight = int(props["figheight"] * props["dp...
7e36d0cd393d5ae316c15f6d7f69e8d8dbd903d8ca313fbff007f5ca97782032
Python
4,929
148
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Line(_BaseLayoutHierarchyType): _parent_path_str = "layout.newselection" ...
ddb824627674b896f9d5b953828e7e6b110e46d185337e2b5ae272cf2f44de62
Python
4,929
150
import numpy as np import Code_General_utility_spikes_pickling as util from copy import deepcopy as dcp import matplotlib.pyplot as plt import Code_General_Nassi_functions as nf __RES_DPI = 48 _CND = 600 _THRESHOLD = -20 _DISP = 0 _N_NEURONS = 10 _N_RUNS = 10 _N_STIMULI = 18 _T_STIM = 2 # s _T_STIM_PRESENT = 500 # m...
c3e88b63fc794772097ea4327eea764deea515f686a0fb8c47df594ea7b0e3e7
Python
4,931
135
# SOURCE: vendored from # https://github.com/dspanah/Sensor-Based-Human-Activity-Recognition-DeepConvLSTM-Pytorch # @ master (notebooks/1.0-dsp-DeepConvLSTM.ipynb, cell defining `HARModel`) # # DeepConvLSTM (Ordonez & Roggen 2016, Sensors 16(1):115) for wearable-sensor # human activity recognition: four stacked 1D-conv...
e0aa2e44bd3c6254a1b0c9bb161fdd30ff0fef28ae255dffe2a193bb8b62cece
Python
4,931
109
'''Tests for bdpy.bdata.metadata.''' import unittest import numpy as np from numpy.testing import assert_array_equal from bdpy.bdata import metadata class TestMetadata(unittest.TestCase): '''Tests for bdpy.bdata.metadata.''' def __init__(self, *args, **kwargs): super(TestMetadata, self).__init__(...
04f95788c2e68e5fa59d5c687d02103939cb9c3117f58ebe0192d33b122133c3
Python
4,933
139
#!/usr/bin/env python import argparse def main(args): if args.header: h1 = True h2 = True else: h1 = False h2 = False cache = list() out = open(args.outfile, "w+") write_buffer = list() def _readline(header=False): with open(args.f2) as handle2: ...
566cfae3e538cf8bd80ce6ccf6ee630a4bb7ee5f8c8cd0722dfe9db3bc2e190e
Python
4,933
142
# This example requires the following dependencies to be installed: # pip install "lightly[timm]" # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import torch import to...
89812f49ecd8af26865773d5def1d99e6fb93045c6401b829c2a4faec077deee
Python
4,933
152
import numpy as np import scipy import scipy.spatial import string import os,re import random import util to1letter = { "ALA":'A', "ARG":'R', "ASN":'N', "ASP":'D', "CYS":'C', "GLN":'Q', "GLU":'E', "GLY":'G', "HIS":'H', "ILE":'I', "LEU":'L', "LYS":'K', "MET":'M', "PHE":'F', "PRO":'P', "SER":'S', "THR":...
fe41b6e75e2e6e18b841dea6b5f3de92b1acd4eeb73d1bd3027a016a0fefa3ad
Python
4,933
151
import numpy as np import scipy import scipy.spatial import string import os,re import random import util to1letter = { "ALA":'A', "ARG":'R', "ASN":'N', "ASP":'D', "CYS":'C', "GLN":'Q', "GLU":'E', "GLY":'G', "HIS":'H', "ILE":'I', "LEU":'L', "LYS":'K', "MET":'M', "PHE":'F', "PRO":'P', "SER":'S', "THR":'...
457c02fdc8b66b0e2bbea7918d3e5cef4f77452abdfb4cd878516c79411d942e
Python
4,934
141
"""Functionality used by multiple algorithms""" # from collections import namedtuple import numpy as np from tns.morphmath import bifurcation as _bif bif_methods = {'bio_oriented': _bif.bio_oriented, 'symmetric': _bif.symmetric, 'directional': _bif.directional, 'random': ...
71a14581ee2bee92ad046134defb2f201af78fddaa65287943578b15e94f5ab6
Python
4,934
128
import sys sys.path.extend(["src"]) from src.predict import evaluate_model import matplotlib.pyplot as plt import utils import numpy as np from prodict import Prodict import matplotlib.lines as mlines def plot_select_cases(cfg: Prodict) -> None: """Generates patient-level plots comparing TDNODE-generated predic...
8426f4660922626ff109c98676b65e06e87765fa6af67c620f8a3cb5eb9b1cec
Python
4,934
115
import cv2 from PyQt5 import QtCore from score_behavior.score_analyzer import FrameAnalyzer from score_behavior.global_defs import DeviceState import logging from .dialog_controller import TrialDialogController logger = logging.getLogger(__name__) # noinspection PyAttributeOutsideInit class ObjectSpaceFrameAnalyzer...
3bfcdae3d83aa1f5ff58283de32650294146c77b62ca479983ddefe704842937
Python
4,936
112
from typing import Tuple, Iterable, List import torch.nn as nn from torch import Tensor class InvertibleModule(nn.Module): """ Base class for all invertible modules in FrEIA. Given ``module``, an instance of some InvertibleModule. This ``module`` shall be invertible in its input dimensions, so t...
63e2dfeaf90672519b7988f17611760a41870e42b30a2d4d904673be853b2e20
Python
4,937
124
import argschema import marshmallow import platform from typing import Union from pathlib import Path, PureWindowsPath from nway.onprem_utils import query_utils from nway.schemas import (CellROISchema, OnPremExperimentSchema, ExperimentContainerSchema, OnPremGenerated...
6a170e839a7af27368c3aff0cb9a6b6182b4299ab6da59b40ac267f00c833022
Python
4,937
148
"""Validation of dependencies of packages """ from collections import namedtuple from pip._vendor.packaging.utils import canonicalize_name from pip._internal.operations.prepare import make_abstract_dist from pip._internal.utils.misc import get_installed_distributions from pip._internal.utils.typing import MYPY_CHECK...
740b7e24e1960ed2e09ee262b0351fd5af2350ed1f2edaf088ab9761860c7f3a
Python
4,938
112
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import d...
94de260fcc500dd3393922b4cf7ba8201d72d83a754ba062813aac91edbdf3c5
Python
4,938
110
from datetime import datetime import warnings import sklearn import experiments.config as config from datasets import load_from_disk import auggam.linear import auggam.data import pandas as pd from copy import deepcopy from collections import defaultdict from sklearn.model_selection import StratifiedKFold from sklearn....
089237dfdd9fc7baa7690fd05a0d688d7a9b0b7a4d81984e3a2c4d3aeb7b15ae
Python
4,942
116
# General imports import os import sys import torch import numpy as np import pandas as pd import seaborn as sns import xarray as xr import matplotlib.pyplot as plt import pytorch_lightning from tqdm.auto import tqdm # EUGENe imports and settings import eugene as eu from eugene import settings settings.dataset_dir = "...
1a56e092a9077eac994cff200461f3b9f566a257e17f689d747a20dbcb25fa8c
Python
4,942
141
import numpy as np from scipy import interpolate from mitochondria import Mito, to_dpsi from utils import Recorder def get_steady_state(): try: kk = np.load('./steady_state/steady_state.npz') baselines = kk['baselines'] all_nads = kk['nad_ss'] all_atps = kk['atp_ss'] all_p...
3c1b908aeb02de250a2698dba940be31625bfea055bde996ee55a650ff9d8dc4
Python
4,942
144
""" classifier_eegnet_05.py — EEGNet (PyTorch), per-group models Same evaluation logic as the Random Forest module: folds are split by subject via GroupKFold, so no subject appears in both train and test. """ import os from typing import Dict, Tuple import numpy as np from sklearn.model_selection import GroupKFold f...
40935c75d61e227922cad8359b4c12980ef50f3195ee56dcd8c229b5253b84ac
Python
4,942
167
import numpy as np from gym import utils from gym.envs.mujoco import MuJocoPyEnv from gym.spaces import Box DEFAULT_CAMERA_CONFIG = { "trackbodyid": 2, "distance": 4.0, "lookat": np.array((0.0, 0.0, 1.15)), "elevation": -20.0, } class Walker2dEnv(MuJocoPyEnv, utils.EzPickle): metadata = { ...
7581d48ee5e9c880e258f8786c2122c9b206c8180d13f19b5979ecff4542abd4
Python
4,942
117
################################################### ### This code simulates vesicle motility and ### ### presynapse capture during axonal motion. ### ### ### ### This is the first phase of the simulation ### ### This code generates a collection of single ### ##...
a8dd95de1912f3abea2fa64768bdc13c1c4bb9fb875611a6a516d9ea0b493b71
Python
4,942
120
"""Utils for auto Mask-RCNN estimator""" # pylint: disable=consider-using-enumerate import os import logging import mxnet as mx from mxnet import gluon from .... import data as gdata from ....data import batchify from ....data.sampler import SplitSortedBucketSampler from ....utils.metrics.coco_instance import COCOIns...
4ad31e14573fd93c24aa210050977b637b0b3ee9279b23870bd4df305aa0d710
Python
4,943
105
import sys # setting path sys.path.append('../TM2_segmentation') import os import numpy as np import nibabel as nib import itk import pandas as pd import tarfile from scripts.preprocess_utils import find_file_in_path, register_to_template split = "HEALTHY" # select the split to perform registration on # this is cr...
160f01da7b373bcd85389fb61fd3b46878c3e35d85f140d7b8d32e75252d79f8
Python
4,944
106
import sys # setting path sys.path.append('../TM2_segmentation') import os import numpy as np import nibabel as nib import itk import pandas as pd import tarfile from scripts.preprocess_utils import find_file_in_path, register_to_template split = "HEALTHY" # select the split to perform registration on # this is c...
ae9d32c02d6c8df9881e5a508ac168567c160939234ccf5db42cfdf817cf3e97
Python
4,944
131
"""F03 ledger memo items 5b + 5c. 5b: the edited-rerun divergence-detector composition row ("after 5b: no warning, divergence_count == 0"). The panel's 3.4 defect (TorchLens's own edit tripping the detector on resnet18, measured at f74e4a9e) does NOT reproduce on the F03 base tip — a 4-cell mode x helper matrix on tor...
de8e536636c85cdf7ce3adcdecebd4a10f3df89c06f1c8e2484829e57e9d2fdf
Python
4,945
123
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.collections as mc import matplotlib.colors as mpcolors from mpl_toolkits.axes_grid1 import make_axes_locatable from tqdm.auto import tqdm from . import xpu, stats, cluster from .xpu import cupy_wrapper, iscupy, to_numpy, usin...
78d40e92dc937972417326a77781fd8507e766a1ea44c9543bf12c74e380ebb2
Python
4,947
129
"""grind-p3 T11: validation/backward.py input/output walkers are guarded. ``_clone_inputs_with_grad`` and ``_sum_tensors`` were unguarded recursion with no memo: a legal deep nest or a self-referential container died in a raw ``RecursionError`` from library internals, and a DAG-shaped tree that reuses one sub-containe...
4203cb1e89b521dfc3128d5033d1ded19c0779e07afb785715aae46ce0c9e52d
Python
4,948
144
# SOURCE: vendored from RLAgent/gated-path-planning-networks @ master # https://github.com/RLAgent/gated-path-planning-networks # Files: models/GPPN.py (Planner), no changes to the architecture; only the # `args` object (originally an `argparse.Namespace` built by # `utils/experiment.py:parse_args`) was replaced with a...
bf701d1217aac26ea71cd8bf086b0eef698f27a9c691396709f14ed427b1b1c7
Python
4,948
141
"""grind-p3 T11: GradFnCall equality, hashing, and ordinal_index safety/cost. The dataclass-generated ``__eq__`` compared raw field tuples, so two like-labeled calls carrying saved multi-element gradient tensors raised an untyped elementwise torch ``RuntimeError`` -- which also detonated inside ``ordinal_index``'s ``l...
e3004c48cdfe818e827f89d774d7849d0e416dc0d437db9764d27fce6f7f01f0
Python
4,948
78
"""General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., bicycle_gan, pix2pix, test) and different datasets (with option '--dataset_mode': e.g., aligned, single). You need to specify the dataset ('--dataroot'), experiment name ('--name'), and ...
2d850dfbc948c0c93e21d4ff0d691c6180e55b3cf430779459fb719187ae7add
Python
4,950
135
import os import numpy as np from astropy.io.fits.util import path_like from mne.utils import _ensure_int, logger import os.path as op _multi = { 'str': (str,), # 'numeric': (np.floating, float, int_like), 'path-like': path_like, # 'int-like': (int_like,), # 'callable': (_Callable(),), } def read...
eb620b1e09f2cba874f84dddf9a924ad574b3ef2c33d1d2a751fc1e92b4d3610
Python
4,950
143
"""A/B overhead measurement for ``tl.record`` on real vision models. Methodology follows the promoted P2 A/B harness (``tests/test_perf_capture_ab.py``): torch intra-op threads pinned to 1, median-of-N wall clock with one warmup call, load context recorded. This script extends the small-capture rows (tiny CNN/MLP) wit...
a0be84a6826586898fd8d4bd89f375803b640d3fc689c6d1776c6101bcab5c5a
Python
4,951
149
from typing import Callable, List, Tuple import imodelsx import numpy as np from spacy.lang.en import English from os.path import dirname, join import os.path import pickle as pkl import inspect def explain_ngrams( text_str_list: List[str], mod: Callable[[List[str]], np.ndarray[float]], ngrams: int = 3, ...
78daed971365b7272f2aef20b5df2aeec7ef7fb04a94a13d59580be105acf7ef
Python
4,953
131
import torch from torch import nn from torch.nn import functional as F class _NonLocalBlockND(nn.Module): def __init__(self, in_channels, inter_channels=None, dimension=3, sub_sample=True, bn_layer=True): super(_NonLocalBlockND, self).__init__() assert dimension in [1, 2, 3] self.dimensi...
04263b0112fe766fd67a8bf889303a7d1656e4e1ceec5a7ee786b6d8a03645e1
Python
4,954
175
from __future__ import annotations import dataclasses import enum from typing import Final import numpy as np import numpy.typing as npt from PySide6.QtCore import Qt from .._shape import Shape from .._shape import nearest_edge_index from .._shape import nearest_rotation_point_index from .._shape import nearest_vert...
7b23d9e8365b0948e62f7df951314fe3aa8c2521a2f67d2e97499e5308f00bb0
Python
4,954
122
import pandas as pd import re,sys import os import biotite.sequence.io.fasta as fasta from utils import parse_config,setup_fonts import seaborn as sns import matplotlib.pyplot as plt def needle_commands_from_blast(blast_file,test_name,train_name,parent): test_fasta = fasta.FastaFile.read(test_name) train_...
c27eb791f49152e11cea7a0f7f61a2de5093edfa565a086fe167ea7cdcc5e79a
Python
4,954
113
import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, pad_sequence class RETAIN(nn.Module): def __init__(self, num_features, dim_emb=128, dropout_emb=0.5, dim_alpha=128, dim_beta=128, dim_num=2, dropout_context=0.5, dim_output=1, num_layers=1...
e06c094f0dab54828768ea8ab250ca8cd89b22e23c14386782fb90dda8b4b0f0
Python
4,954
144
"""Utility functions used to adapt galaxy.util.search to Galaxy model index queries.""" from sqlalchemy import ( and_, func, or_, select, ) from sqlalchemy.orm import ( aliased, InstrumentedAttribute, ) from sqlalchemy.sql.expression import BinaryExpression from galaxy import model from galaxy...
07e7364353a324e315596095c12c15e29790aa041b0abe5621629fa86609c0dd
Python
4,956
158
import torch import torch.nn as nn from modular_splicing.utils.io import load_model LSSI_MODEL_THRESH = -10.0 class BothLSSIModels(nn.Module): """ Represents both an acceptor and a donor model. Core LSSI as used in the main model. Also performs multiple projections, to represent the splicepoint as...
1afafab43d329a0ef9a8aea99185c7d5168d2045a599ccddb0e78f44fe12ee82
Python
4,956
114
import itertools import json import os import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from angorapy.common.const import PATH_TO_EXPERIMENTS, QUALITATIVE_COLOR_PALETTE experiment_ids = [['1674975602294059', '1674975602446141', '1671749718306373'], [...
4f578f7a2ddbdd54aa7c0de17e33900e07aea0f14d22b3103456953fab511368
Python
4,956
120
"""L6 stage-4a exit gate: GREP-VERIFIED independence from the attribution kit. The design memo (sec 2.4, r3 fix for sol MAJOR-5) split stage 4 in two merges precisely so the SHEDDABLE attribution-kit capstone (4b) is demonstrably detachable from the non-shed 4a content: Selection resolution, cross-run patching, and ev...
1fbce1dbc8613a3c13673ddab366aa327867b4c63cb6ad31590a30c20a45f153
Python
4,957
196
from functools import wraps import torchmetrics import torch import numpy as np from .utils.data import transform_to_elementwise_shape, transform_class_predictions # https://torchmetrics.readthedocs.io/en/latest/pages/quickstart.html # https://torchmetrics.readthedocs.io/en/latest/pages/implement.html # Decorator...
3e75420b0acd8919e2cedf275e8b9dd13d937a151d99d3315aaf2aac53498a05
Python
4,957
145
from typing import Any, List, Mapping, Optional, Tuple, Callable import numpy as np from imodelsx.llm import get_llm def summarize_ngrams( llm: Callable[[str], str], ngrams_list: List[str], num_summaries: int = 2, prefix_str="Here is a list of phrases:", suffix_str="What is a common theme among th...
7c6bb278064cffe1c8f770f29f7ae22b6f86e1b816487c0e1d742250c868039a
Python
4,957
139
"""``do(<Op record>, edit)`` / ``do(<Layer record>, edit)`` (AUD-CODE 4.10). A record is the most precise site spelling a user can hold, yet the hook door refused it ("Unsupported site query") and the spec lowering would have dropped an ``Op`` to its BARE ``layer_label`` (the last pass of a multi-pass layer) had it be...
925cc31311c3fe70aca77d26b83dd4dbd59e2d7c4690fea21f0c382a75e83e44
Python
4,957
137
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module defines single :class 'DataReadProxy'. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import os.path import struct import numpy as np from . import signal_cons...
f762bdadc33c6ef6613cc0c2b01e5dd209ba8f0dfb0f2e141fb3a837cbcc2f3d
Python
4,957
143
import pathlib import shutil import tempfile import lmfit import nanite.model from nanite.model import residuals import numpy as np data_dir = here = pathlib.Path(__file__).parent / "data" class MockModelModule: def __init__(self, model_key, **kwargs): super(MockModelModule, self).__init__() # r...
4daac470542672ebea6d1702461421b3c7818772a58e78da18aed251c034d3b2
Python
4,958
161
"""Thin views over the lazy reader (extract D14's views layer). These functions consume ONLY the reader's public protocol — metadata, ``iter_batches``, ``rows`` — and are therefore structurally unable to reach storage internals. They ship in the same release as the reader so the documented access patterns (the SAE/CLT...
9fc97dec6eb7d858a40d62fd5474db9292b0c074d602a7642a6738db13d0c9f2
Python
4,958
143
#!/usr/bin/env python3 -u # -*- coding: utf-8 -*- import os import argparse import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import trim_mean, genextreme, pearsonr, spearmanr from preprocessing import get_zmap_dataset, features_from_df, preprocess, FeatureSelector from inspectio...
e613251f6dea4b5c9fff8d4ac72cc73bc4f0a799cb0d568c6c1d2a31d28e1b69
Python
4,958
128
import sys import numpy as np from ast import literal_eval from collections import defaultdict def score_multiple(gold_list, test_list, value_for_div_by_0=0.0): # accumulate counts for all gold/test files pcounts = np.array([0, 0, 0, 0], dtype=np.int32) rcounts = np.array([0, 0, 0, 0], dtype=np.int32) ...
51b8fcfe0621c6b27db83b9eea8c06e3d68c36e8374cbe78e5c5e5d32a9f3920
Python
4,961
144
import unittest from unittest import mock import pytest import responses from codecarbon.external.geography import CloudMetadata, GeoMetadata from tests.testdata import ( CLOUD_METADATA_AWS, CLOUD_METADATA_AZURE, CLOUD_METADATA_GCP, CLOUD_METADATA_GCP_EMPTY, GEO_METADATA_CANADA, GEO_METADATA_U...
6fc4f16d63e8a9b3be9b4ad93c78edf2233e05230ab30178758b2b11cc61c1c1
Python
4,961
93
#!/usr/bin/env python # Created on: Dec 6, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" __description__ = """ Intended to be run from main directory (not plotsForPaper). Specify list of plots (eps files) to copy here. Give a tuple of src and dest filename if you need to rename fiels. The idea i...
9e2d477dad9a3cf4ea84af6301470f0b126fdbf5e5543a4746f4086c42123009
Python
4,961
96
import matplotlib import matplotlib.pylab as plt from matplotlib.ticker import AutoMinorLocator import seaborn as sns import glob import pandas as pd import os sns.set(style='ticks', context='talk', palette='Set1') fig1, axes1 = plt.subplots(4, 3, figsize=(12, 15), num='RMSD') fig2, axes2 = plt.subplots(4, 3, figsize=...
6d01437784253da0288c592e12f2afa0321adbb7fb43b80b24a9a821492b7f0d
Python
4,963
152
#!/usr/bin/env python """ Test runner for notification system tests. Demonstrates the comprehensive test coverage for the enhanced notification system. """ import os import subprocess import sys from pathlib import Path def run_tests(): """Run all notification system tests.""" # Change to the node director...
a7851a6da73848d9b86149fec1ced2f50a3fe7109e197fda28ce2f17fe0b5df8
Python
4,963
184
from typing import Optional, Union from anndata import AnnData import matplotlib.pyplot as plt from matplotlib import cm import matplotlib as mpl import numpy as np import stlearn.plotting.utils as utils def deconvolution_plot( adata: AnnData, library_id: str = None, use_label: str = "louvain", cluste...
2189d63617b35b4554544e639998ed125158695f84448d9aa6c07507fc3a15eb
Python
4,965
124
'''Test tns.generate.section code''' import json import os import numpy as np from nose.tools import assert_dict_equal from numpy.testing import assert_array_almost_equal, assert_equal from tns.generate.algorithms.common import TMDStop from tns.morphmath import sample from tns.generate.algorithms.tmdgrower import (TM...
30e4fae7db3a01945f4d546f6af75cd55daff7f60c59dd06006eb2990b860df6
Python
4,965
107
"""Data parallel task for Mask R-CNN Model.""" import mxnet as mx from mxnet import autograd from gluoncv.utils.parallel import Parallelizable class ForwardBackwardTask(Parallelizable): """ Mask R-CNN training task that can be scheduled concurrently using Parallel. Parameters ---------- net : gluon....
481f1091af106861cc01184b72b4e804610a87154a75c3f57596e414fbd61d60
Python
4,965
178
import matplotlib as mpl import matplotlib.colors as mcolors import matplotlib.pyplot as plt import numpy as np from anndata import AnnData def deconvolution_plot( adata: AnnData, library_id: str | None = None, use_label: str = "leiden", cluster: int | str | None = None, celltype: str | None = Non...
07be4036fb19880277357fb3a9978351506784921dafd10d5466887a8343d1f9
Python
4,966
106
from mirp._data_import.generic_file import MaskFile from mirp.data_import.import_image import _import_image from mirp._data_import.utilities import supported_mask_modalities, supported_file_types, flatten_list def import_mask( mask, sample_name: None | str | list[str] = None, mask_name: None |...
3afc25fb54264ec7fe2d214a4cd23db55fa778a0e7dad571a2d353ee8cf5788e
Python
4,966
114
# Given sumstats file, generate a file that can be used by subsequent scripts to # generate MsCAVIAR input files. import argparse, math, sys def parseargs(): # handle user arguments parser = argparse.ArgumentParser(description="Given sumstats file, generate" + " a formatted file used by subsequent scripts to...
2ea08863f880ed19b97d28b555f1ad425794201ed532286e32e98dd54e1f90f5
Python
4,967
169
# --- 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 Domain(_BaseTraceHierarchyType): _parent_path_str = "table" _path_str = "...
631ba0e6c4383a813c3c9f9680e6feb1447cacfc94f971dc466292c5a9ca6a59
Python
4,967
164
'''Figure module This file is a part of BdPy. Functions --------- makefigure Create a figure box_off Remove upper and right axes draw_footnote Draw footnote on a figure ''' __all__ = [ 'box_off', 'draw_footnote', 'make_violinplots', 'makefigure', ] import matplotlib.pyplot as plt impor...
d279208f42914069320e32be8c36caf3e4a049e888916b0a979a442b2b8a575a
Python
4,969
158
import torch import torch.nn.functional as F import numpy as np MAX_DIM = 1024 def cosine_pull_loss(a, b, labels=None): a = F.normalize(a, dim=-1) b = F.normalize(b, dim=-1) if labels is None: loss = - (a * b).sum(-1).mean() else: loss = 0 cossim_a = - torch.einsum('ij,kj->ik...
0ef81b8706c89b0ffcd78bea4bd9d987f682ad19cbb9eba18132a0017f5bf226
Python
4,970
137
# Copyright 2017 The TensorFlow 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 applica...
efc92fcd73f61bf2fc39985f75532a8ad7c0a57ea433e3ac893ade186dafd557
Python
4,970
95
import matplotlib import matplotlib.pylab as plt from matplotlib.ticker import AutoMinorLocator import seaborn as sns import glob import pandas as pd import os sns.set(style='ticks', context='talk', palette='Set1') fig1, axes1 = plt.subplots(4, 3, figsize=(12, 15), num='RMSD') fig2, axes2 = plt.subplots(4, 3, figsize=...
0c4a62e131a393ac330698e1b195a2ad9d999bc5aba86e5b3944a189e18a4d41
Python
4,971
117
#!/usr/bin/env python # -*- coding: utf-8 -*- """ cohort_counts.py — 五个队列的样本/受试者计数:**从产物推导,不手抄** ------------------------------------------------------------------ 为什么需要:Table 1 的每一行、Figure 1 的抬头、以及摘要里的 「1,991 samples from 769 subjects」此前都是**手抄**的。手抄的后果已经发生: · 受试者总数写成 **769**,而产物给出 20 + 383 + 40 + 229 + 96 = **768...
4637080f8036df99dc58ae7b80a59e0dd6914e10624aa35562209329682597e1
Python
4,972
259
#!/usr/bin/env python '''Generate models for affinity predictions''' # [SGD|Adam] * [regular|rankloss|ranklosswneg] [xaviar|radial] [0.01|0.001] modelstart = '''layer { name: "data" type: "MolGridData" top: "data" top: "label" top: "affinity" include { phase: TEST } molgrid_data_param { sourc...
861c8bc7008d339d38d6c77ea4eef15800ef02d735de49c060a9e610f9178fc8
Python
4,973
153
import dataclasses import importlib import os import unittest from unittest.mock import patch from codecarbon.output_methods.emissions_data import EmissionsData from codecarbon.output_methods.metrics import prometheus EMISSIONS_DATA = EmissionsData( timestamp="2021-01-01T00:00:00", project_name="test_project"...
9012cce8e593120be69067487e26d3baac142b16ef9525dc68766776c97ac68e
Python
4,973
166
#!/usr/bin/env python # # stringdb documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
18f65e904313218c16e478a323c157a9fd48fdfe83cd345728c3c76fee0b9408
Python
4,974
113
""" Author: Derek van Tilborg -- TU/e -- 23-05-2022 Message Passing Neural Network for molecular property prediction using continuous kernel-based convolution (edge-conditioned convolution) [1] and global graph pooling using a graph multiset transformer [2] instead of the Set2Set method used in [1]. I added dropout to...