sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b75bde2eb22441f704f21f20310570a030b7fc22dcda01c889bd2d55dbf27588 | Python | 3,970 | 113 | import cutlass
import cutlass.cute as cute
from cutlass import Int32
from cutlass.cutlass_dsl import T, dsl_user_op
from cutlass._mlir.dialects import llvm
@dsl_user_op
def ld_acquire(lock_ptr: cute.Pointer, *, loc=None, ip=None) -> cutlass.Int32:
lock_ptr_i64 = lock_ptr.toint(loc=loc, ip=ip).ir_value()
state... |
d883f3ca5ccdad5b85fc7b89a8ddc4b7289852e0a3a627b48e0bc1d74e244800 | Python | 3,970 | 82 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
ec00ed493300471ec4144f18a7ab4b3da2749b4a32e32ced8f8df345d3c658df | Python | 3,970 | 132 | """
Widgets for editing a simulation's timing and runtime options.
"""
from __future__ import annotations
import panel as pn
import param
from .widget_base import collapsible_family_box, family_box, param_controls
__all__ = ["build_sim_ops_widget", "build_inspector_timing_widget"]
_TIMING_FIELDS = ("duration", "Ns... |
f086e885227f099de98e46d802e1aae345bd4d3b0d4dfa95ae023574d9920db8 | Python | 3,970 | 112 | from keras.src.api_export import keras_export
from keras.src.backend.common import is_int_dtype
from keras.src.layers.preprocessing.image_preprocessing.base_image_preprocessing_layer import ( # noqa: E501
BaseImagePreprocessingLayer,
)
from keras.src.ops.core import _saturate_cast
@keras_export("keras.layers.Aut... |
4124fb1fb47b367a690406b9a8e830038a7cd31edc3d6baa544b6d097cae7201 | Python | 3,971 | 128 | import io
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from scanpy.plotting import palettes
from stlearn.pl import palettes_st
def get_img_from_fig(fig, dpi=180):
buf = io.BytesIO()
from io import BytesIO
fig.savefig(
buf, format="png", dpi=dpi, bbo... |
62fba96eeaf993f7f18d3f9831981830d33594530b51b9df48b2373abacebcf1 | Python | 3,971 | 125 | from math import sqrt
from model import common
import torch
from torch import nn
import torch.nn.functional as F
def make_model(args, parent=False):
return DFSRCNN(args)
class DFSRCNN(nn.Module):
"""
Args:
upscale_factor (int): Image magnification factor.
"""
# def __init__(self, upscale... |
7f7a6d6f4d6e9cc5f0346957a278f34ac895ae2e718825ac4f705b9213bd023d | Python | 3,971 | 105 | import numpy as np
import torch
from seqexplainer.preprocess._preprocess import ohe_seqs
from seqexplainer._utils import _model_to_device
from tqdm.auto import tqdm
def deepstarr_motif_distance_cooperativity_gia(
model,
b_seqs,
A_seqs,
B_seqs,
AB_seqs,
motif_b_distances,
batch_size=128,
... |
bf4264cd3ac7744f61a68b5d2e7519f944fd4e885e6bdb87e6396af55ad66886 | Python | 3,971 | 102 | """
VOneNet code based on `https://github.com/dicarlolab/vonenet`
Only the model backbones included in Feather et al. 2022 are included.
"""
import torch
import torch.nn as nn
import os
from .vonenet import VOneNet
from torch.nn import Module
class Wrapper(Module):
def __init__(self, model):
super(Wra... |
e86020bd76beddbb930aa05aa977eaad06c14b5d1ccccad0b9397cda76aacd23 | Python | 3,971 | 119 | import os
from mirp._images.mr_image import MRImage
from mirp._masks.base_mask import BaseMask
from mirp.extract_features_and_images import extract_features_and_images
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
def test_basic_mr_t1_feature_extraction():
data = extract_features_and_images(
... |
52831a54775a8260a75b21bddbe0c229e1919eb07c6f919ba7cb73b6732222ea | Python | 3,973 | 133 | # --- 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 Contour(_BaseTraceHierarchyType):
_parent_path_str = "mesh3d"
_path_str =... |
53c9a631964ba739824807fbaf4b5400deb47afd20cac549a249437af921ff93 | Python | 3,973 | 133 | # --- 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 Contour(_BaseTraceHierarchyType):
_parent_path_str = "volume"
_path_str =... |
cecbb556bc1944134661f05c1c501e11cc4c0f546dcdad2ba987152ca28b8f3c | Python | 3,973 | 134 | from inspect import getsource
import logging
from typing import List, Dict
import warnings
import numpy as np
import pandas as pd
def printfn(fn) -> None:
"""print fn source code"""
content = getsource(fn)
print(content)
def concat_allen_name(allen_l2):
"""allen_l2 is usually a pandas Series.
"""
... |
0b156862e5c84ffd65160856fddb908668dce2fd1b3ceb39df8d4854f1d5a8cb | Python | 3,974 | 136 | import numpy as np
import scipy.signal as scs
from scipy.ndimage import convolve1d
from . import utils
def norm_gauss_window(bin_length, std):
"""
Gaussian window with its mass normalized to 1
Parameters
----------
bin_length : float
binning length of the array we want to smooth in ms
... |
b7b2d2df0a8c810b6617069d13e33bc0b1b27f4f8ba1c49e7c5c548995147c31 | Python | 3,974 | 152 | import argparse
import uuid
from datetime import datetime
__input_folder__ = "input"
def get_basis_set_name(basis_set):
"""Sanitize basis set name for use in file paths."""
basis_set_name = basis_set.replace("*", "star")
basis_set_name = basis_set_name.replace("+", "plus")
basis_set_name = basis_set_... |
b43d2e0690fb0ca7a9c69281d218aac708e61c930dbd0c6a7df06a72783006d6 | Python | 3,975 | 107 | # -*- coding: utf-8 -*-
"""
clean the data preprocessed from frmriprep
By M.-Y. Wang 23-Nov-2022
"""
import os
from nilearn import image as nimg
from nilearn import plotting as nplot
import matplotlib.pyplot as plt
import numpy as np
import nibabel as nib
import bids
import pandas as pd
fmriprep_dir ='/Users/wang/D... |
37fc6491ae1c89d17e5a8e10bbf1fb70e1d179f8ce4a7486fbcb4eaf9d6f627f | Python | 3,976 | 123 | """
This file holds many variables that are used throughout MoleculeACE
Author: Derek van Tilborg -- TU/e -- March 2022
"""
import datetime
import os
from enum import Enum
from pathlib import Path
def get_project_root() -> Path:
return Path(__file__).parent.parent.parent
###
# Benchmark parameters
###
RANDO... |
09998c3b6a88508cee2c2839a7b79435699bec60640b463516509af93e0619bb | Python | 3,977 | 130 | # This example requires the following dependencies to be installed:
# pip install lightly
# 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 copy
import torch
impo... |
8cfa8b981b3105aab6ef8cedab8247a4706f72ef89df428401923fd5f6b886cd | Python | 3,978 | 129 | """Phase 1 capture-unification regression tests."""
from __future__ import annotations
import example_models
import pytest
import torch
import torch.nn as nn
import torchlens as tl
from torchlens.options import CaptureOptions
from torchlens.validation import validate_forward_pass
class SmallCNN(nn.Module):
"""... |
39b84e2b47ab861554c2aae6d85eb5be8c7108ac8d876b0234d2a82e0149b5e2 | Python | 3,979 | 118 | # --- 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 Gradient(_BaseTraceHierarchyType):
_parent_path_str = "scatter.marker"
_p... |
87b49133092ec671047e501b40f1ae497b9875fb6f3051235acb1a57af99460f | Python | 3,979 | 82 | import numpy as np
def topHatFilter(blueMovie,uvMovie,mask,topHat=300):
# Mask (spatial), resize, and rotate
# mask = np.array(Image.open('mask.tif').resize(downsampledSize, Image.BILINEAR).rotate(rotationAngle,Image.NEAREST,True))
rotatedSize3D = blueMovie.shape
# Reshape
blueMovie = blueMovi... |
a965041ecb485ffa43b1b4aa03ff19152935d57bbc0adfd77ccfc40d9d8a4f05 | Python | 3,979 | 124 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
12d22a41ea1946ed87cb40c0ba2fe564fea28c08074e542365df2ddbe799e26f | Python | 3,981 | 100 | from ._RL_agent import *
from numba import njit
@njit
def mf_forget_diffa_session_value(choices, second_steps, outcomes, n_trials, transition_type, params):
# Unpack parameters.
alpha_pos, alpha_neg, weight_mf, lbd, forget = params[:5]
# Variables.
Q_c = np.zeros((n_trials, 2)) # Value of the choice.
V_s =... |
19207f9874f4db851d1a087eb5c0a4a3ea85a2ebd13e6cabb03de6081e0a287d | Python | 3,981 | 120 | from io import StringIO
from typing import (
TYPE_CHECKING,
)
try:
from fsspec.implementations.sftp import SFTPFileSystem
from paramiko.ecdsakey import ECDSAKey
from paramiko.ed25519key import Ed25519Key
from paramiko.rsakey import RSAKey
except ImportError:
SFTPFileSystem = None
if TYPE_CH... |
8966801c5a9aa051dcdefbcf6f307f83b012602adf236ee33ec9364cdd5c8f25 | Python | 3,982 | 178 | """
Tests to make sure basic model functionality works
"""
import os
import torch
import pytest
import numpy as np
import pandas as pd
from pathlib import Path
import eugene as eu
SEQ_LEN = 100
OUT_DIMS = 2
MODEL = "hybrid"
STRAND = "ss"
TASK = "regression"
LOSS_FXN = "mse"
CNN_KWARGS = dict(channels=[4, 16, 32], co... |
e9524be0fb7876be9d016595006a2270d7e57ca32aee03d243295b3961aed2b3 | Python | 3,982 | 138 | import itertools
from slurmpy import Slurm
# slurm params
partition = 'jsteinhardt' # yugroup, jsteinhardt
num_gpus = 1
s = Slurm("embed_dset", {"partition": partition, "time": "4-0", "gres": f"gpu:{num_gpus}"})
##########################################
# main setting finetuned archs
###########################... |
edacad8f6a60e95891110231a5f6387652a7ab0504d3fddc5edd7b5f2316874e | Python | 3,982 | 98 | import pandas as pd
import numpy as np
def drop_duplicate_entries(tmp):
"""Drop cases where mutation and ddG/dTm value is the same, but other info is different"""
arr = np.empty(tmp.shape[0], dtype=object)
# get unique entries by ddG/dTm value and other key info
for n, i in enumerate(tmp.index):
... |
2a8f4150b793a0a9cb135781f81b9b1e336bd7d4ab6c8ceae2719075c81af302 | Python | 3,983 | 89 | """
evaluation on pdbbind coreset.
"""
import argparse
import os
import numpy as np
import torch
from tqdm import tqdm
import multiprocessing as mp
from src.utils.docking_inference_utils import read_ligands, docking
from src.utils.docking_utils import extract_carsidock_pocket
from src.utils.utils import get_... |
321aaf46bfbc40404b9100063a3ba78068363022df67e7af361cd1170852229c | Python | 3,983 | 106 | from imodelsx import AugGAMClassifier
import numpy as np
import fire
from auggam import data
from os.path import join, dirname, abspath
import imodelsx
import joblib
import os
from nltk.tokenize import word_tokenize
path_to_repo = dirname(dirname(abspath(__file__)))
def run_dataset(
checkpoint="hkunlp/instructor-... |
5a3bf939a17e4aeb6bc87f9eb34b3da4c62ef34a2979573d6e4af24445ac2f61 | Python | 3,983 | 110 | """
Figure about two-layer models.
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import figutils
from PyPDF2 import PdfReader, PdfWriter, Transformation
# If you change figutils often, and want changes reloaded, uncomment lines below:
#from importlib import rel... |
e6fe9f33b76c273528c3d159d7c611a814c5c0fd41b3f147e30a6d087e9b54cd | Python | 3,984 | 90 | from typing import Any
from dataclasses import dataclass
from mirp.settings.utilities import setting_def
import numpy as np
@dataclass
class ResegmentationSettingsClass:
"""
Parameters related to mask resegmentation. Resegmentation is used to remove parts of the mask that correspond to
undesired intensit... |
f9007aa2640104c9a20a89695d270579fe2781a1d4a898c6e8c639011d520287 | Python | 3,984 | 113 | # coding=utf-8
# Copyright 2022 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... |
43c9d9761945ab762719e12c51b043cab93e75560a058abb3faf2c1eb97e8c28 | Python | 3,985 | 109 | """Tests for TorchLens draw behavior in non-interactive shells."""
from __future__ import annotations
from pathlib import Path
import pytest
def test_view_rendered_file_skips_open_in_headless_context(
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
tmp_path: Path,
) -> None:
""... |
9aa75eb43e86bc95f6b6481bbde20a9aac8664e65566f2736c93aa7e91caf0aa | Python | 3,985 | 145 | """
Tests to make sure the in silioc interpretation methods work
"""
import pytest
import numpy as np
import eugene as eu
from pathlib import Path
from eugene.interpret._filters import (
_get_first_conv_layer,
_get_activations_from_layer,
_get_filter_activators,
_get_pfms,
)
HERE = Path(__file__).pare... |
af20dc8cd21099053183f60ea879d13934c64914a8f79ab6e2dbf09fd4210194 | Python | 3,985 | 109 | import numpy as np
from src.modeling import detect_synaptic_contacts
import os
def test_detect_synaptic_contacts_fake():
print("Testing with fake point clouds (two layers)...")
# Axon points of source neuron
axonal_points = np.array([
[10, 10, 10], # Area 1
[50, 50, 50], # Area 2
])
... |
9b3ad28dc3ca1fc4aef0941e693ae405acbf7f11b9986be30485be949661f54a | Python | 3,986 | 108 | import torch
import torch.nn as nn
class SceneClassificationModel(nn.Module):
def __init__(self, parameters):
'''Initializes the model
Args:
parameters (dict): The model parameters
'''
super(SceneClassificationModel, self).__init__()
self.num_recurrent = parame... |
af49cb39383ea365a2a76b5278748218ead2328f8c487d1f2306a0440bff4544 | Python | 3,987 | 126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import io
import os
import tempfile
import unittest
from contextlib import redirect_stdout
from common import find_target_items, reverse_items, sort_items
class CommonScriptTest(unittest.TestCase):
def run_file_op(self, func, input_text, *, input_bytes=None):
... |
5c49e285c8f46b8692cf82cee799b988a1959f81ca4de28df132321e3b838312 | Python | 3,988 | 174 | # Copyright (c) 2022, Tri Dao.
# Adapted from https://github.com/NVIDIA/apex/blob/master/apex/contrib/layer_norm/layer_norm.py
import torch
from torch.nn import init
from flash_attn.ops.layer_norm import (
DropoutAddLayerNormFn,
DropoutAddLayerNormParallelResidualFn,
DropoutAddLayerNormSubsetFn,
)
def r... |
1b810dc1b3c64a5236071dfb77bb4e66818b44905bebaba0d9385c23af938fae | Python | 3,989 | 167 | """
Optimization helpers and stochastic bout-duration generators.
Provides a Nelder-Mead wrapper, the DEB beta function, and two generative models
of behavioural bout durations (critical-branching and exponential).
"""
from __future__ import annotations
import math
from typing import Any, Callable
import numpy as n... |
be427a618e1ee903ba4591adddb2df98ff230b01dbeb9764159d4f93ea54da3e | Python | 3,989 | 115 | import numpy as np
import torch
from gpu_sel import *
from calculate import *
from write_format import *
import re
# unit
length_a_au=1/5.29177208590000E-01
Di_de_au=0.393430307
energy_ev_au=1.0/2.72113838565563E+01
Di_de_ev= 0.20819434
Ef_au_ev=51.4221
#convertor
factor_energy=energy_ev_au
factor_dipole=Di_de_au/Di_de... |
13ec2ec362a5638b36fe2a2270abcd43e2e9ed95b3c640676fbcbf53349cd192 | Python | 3,990 | 127 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Base transformer classes for autoregressive flows.
"""
# =====================================================... |
2d285881c5a3906a2bfd3113b900ca3fd8c6b35c503034babad4b89fcdbeb8cb | Python | 3,990 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "bar.marker.colorbar"
... |
9d8f405d745cd721c5f0d9cbb65eb8e83d684df97ce4c19dab8e76e08351ef45 | Python | 3,990 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "densitymap.colorbar"
... |
9e99fee9d6f5d821b2d005b1ba65ad835d2af665bc200a83a75220d74169cc33 | Python | 3,990 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "isosurface.colorbar"
... |
ac7d9300201e404bf47e043075d243634ba53e35f0df10fb54ab53c5a5b59c00 | Python | 3,990 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "streamtube.colorbar"
... |
b102d1172808c1b175822ac777aa9bc1be5982fca06e1abb707a43b047ad7f9e | Python | 3,990 | 92 | import os
import argparse
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.optim
from tensorboardX import SummaryWriter
from gluoncv.torch.model_zoo import get_model
from gluoncv.torch.data import build_dataloader
from gluoncv.torch.utils.model_utils import deploy_model, load_model, sa... |
bee49bec568547ea85732958202155664559516a3e5a767fc6431dc8f6747644 | Python | 3,990 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "choropleth.colorbar"
... |
15718946ef08ec07cba6fc09c2bf9d28934e22c9e1a995eeb19a99ebd05af700 | Python | 3,991 | 139 | """
The notebook launcher app.
Opens a Jupyter notebook against a chosen dataset or model, so that an
analysis can continue outside the portal.
"""
from __future__ import annotations
import json
from html import escape
import panel as pn
from larvaworld.portal.notebook_workspace import launch_notebook_for_item
d... |
1e9a02d55a8e5225691e60cae89a8f110fe18d1b7020eec5cc016f98e74e950e | Python | 3,991 | 134 | # Copyright (c) ByteDance, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import os
import sys
from tap import Tap
import dist
class Args(Tap):
# environment
exp_name: str ... |
091895962f9b5822f1020fa1ad9fd11bf010ca7ce832b285d5c50769ed899879 | Python | 3,993 | 133 | # --- 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 Contour(_BaseTraceHierarchyType):
_parent_path_str = "isosurface"
_path_s... |
2f77c63a5180d1dfc15224330f980f411761b8bf5992ec4b2ddaf96357675056 | Python | 3,994 | 118 | # --- 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 Gradient(_BaseTraceHierarchyType):
_parent_path_str = "scattergeo.marker"
... |
eb51e5f4475edfe922900a993d476607f866c0b36ccf5bd9d2946f959578d002 | Python | 3,995 | 133 | import numpy as np
from skimage.transform import resize
def transform_spatial(coordinates, original, resized):
# obs transform
x = coordinates[:, 0]
y = coordinates[:, 1]
x1p = x / original[1]
y1p = y / original[0]
x1 = x1p * resized[1]
y1 = y1p * resized[0]
return np.vstack([x1, y1])... |
26dfdbbb866ed28aa1c6d9c0678fc8eca89cfa9937ddb6afea417fa355115d73 | Python | 3,997 | 110 | from typing import Dict, List, Optional, Tuple, Union
from lightly.transforms.multi_view_transform import MultiViewTransform
from lightly.transforms.simsiam_transform import SimSiamViewTransform
from lightly.transforms.utils import IMAGENET_NORMALIZE
class FastSiamTransform(MultiViewTransform):
"""Implements the... |
4530bd6ed63799b84eb73d000a3f07464c5ecabe44fa4a494d00546ef9f0e30b | Python | 3,997 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "histogram2d.colorbar"
... |
60dbbce9c28a3560738f514a5781a4f63f031aa9c4e973ae0149653e16a43eda | Python | 3,997 | 114 | """IO functions for seqFISH-PLUS technology.
"""
import numpy as np
import pandas as pd
from anndata import AnnData
from scipy.sparse import csr_matrix
from ..configuration import SKM
from ..logging import logger_manager as lm
def read_seqfish_meta_as_dataframe(
path: str, fov_offset: pd.DataFrame = None, accumu... |
9edbb0f874340d5716c026673315586d52825fe1d43dbe1bdb578ddde06e7207 | Python | 3,997 | 126 | import numpy as np
from neurogym.core import TrialEnv
from neurogym.utils import spaces
class DelayComparison(TrialEnv):
"""Delayed comparison.
The agent needs to compare the magnitude of two stimuli are separated by a
delay period. The agent reports its decision of the stronger stimulus
during the ... |
13ad4fbd2d96ae66fdfb34fe78073ff3fc48dc2fbcf70265a4bf122fe9a54268 | Python | 3,998 | 141 | import posixpath
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.download import path_to_url
from pip._internal.utils.misc import splitext
from pip._internal.utils.models import KeyBasedCompareMixin
from pip._internal.wheel import wheel_ext
class Link(KeyBasedCompareMixin... |
3758828872c051c8a40fb482592a3188ebf7ee71c29f14ea6452c75d397e703e | Python | 3,998 | 92 | # pylint: disable= arguments-differ,missing-docstring
"""Basic neural network layers."""
__all__ = ['GroupNorm']
import numpy as np
from mxnet.gluon.block import HybridBlock
from mxnet import autograd
class GroupNorm(HybridBlock):
"""GroupNorm normalization layer (Wu and He, 2014).
Parameters
----------
... |
5b4a2bf77410e00c0590065bc1516839ea8aac1f6d7a8621fb1e56d1f1e3b07a | Python | 3,998 | 132 | __author__ = 'quentin'
from collections import deque
from ethoscope.utils.description import DescribedObject
from ethoscope.core.variables import *
class NoPositionError(Exception):
"""
Used to abort tracking. When it is raised within the ``_find_position`` method, data is inferred from previous position.
... |
3fa3977bf4c50d463bf21949b1d65af1b67cb19799a50155878c541cf29c5e61 | Python | 3,999 | 118 | from __future__ import annotations
import builtins
import pytest
import env
from pybind11_tests import ConstructorStats
from pybind11_tests import modules as m
from pybind11_tests.modules import subsubmodule as ms
def test_nested_modules():
import pybind11_tests
assert pybind11_tests.__name__ == "pybind11... |
3fd53cb44ccd45c600d1ce0a9de573d979612e8bf8f4c6fe1eb7e2b59e84ef35 | Python | 3,999 | 135 | """
This module the language modeling dataset
"""
import logging
import torch
import numpy as np
from datasets_pre_processing.generic_dataset import GenericDataset
class LanguageModelingDataset(GenericDataset):
"""
class that define language modeling dataset
"""
def __init__(
self,
da... |
7312a12385097977b13e056639213cdf17f4669354e97c1bc9ba2e5bc7b04f63 | Python | 4,000 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
9d6fc15faa4af56e8a6cbda8565ce78a5a7e7253e27f2f9b9849765585a696af | Python | 4,000 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
c627079971f00164cf753c69bbac4eaea4c0f68927294d736de5ce87feaf8bb5 | Python | 4,000 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
fd34ccf17ba734c3526798fee8504b78b3301b334c1f8280e8e8aa8fd181cc51 | Python | 4,000 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
3934df305e8401aedfecee79781b68e65adab66a44d65e5fc23a05885b923637 | Python | 4,001 | 115 | import pandas as pd
import sys,re
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from Bio import motifs
def find_motif_locations(fimo_output,by='start',stat='count'):
plt.figure(figsize=(20,20))
# ingest stored data
df_val = pd.read_csv('../Fa/test.csv',sep="\t")
df_val = df... |
62d6fb13dd30ffc6561329c2d8f1e59e2d535e4107a82dbf6c172b7f9aef31d7 | Python | 4,001 | 93 | from __future__ import annotations
import logging
import os
from typing import Callable, Optional, Union
from grpc import RpcError
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.feature_manager import ChannelNotifierState
class ChannelDisable(o... |
c9e2762126b86158ae69dad38ee4b86dd0a951e196c1b4da65b20d9e72e8ecd6 | Python | 4,001 | 123 | import torch
import torch.nn as nn
from tlib import tutils
from ..utils.model import get_model_summary, TrainEvalStateChanger
class Module(nn.Module, tutils.classes.StateAndArgsSaver):
"""
Has some additions compared to nn.Module. Can be used equally like a nn.Module:
class Model(torch.Module):
... |
a2f508dd098c1e487d3b4f0aa1e108261af6eff428304c5eef934bcd5291a224 | Python | 4,002 | 122 | import socket
import sys
import socket
import threading
import SocketServer
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def __init__(self, callback, infoclient, *args, **keys):
self.callback = callback
self.infoclient = infoclient
SocketServer.BaseRequestH... |
885be2454590efe4d5b32efe4fd48193461559bf6353c02647765d48fa0df579 | Python | 4,003 | 122 | # --- 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 Domain(_BaseLayoutHierarchyType):
_parent_path_str = "layout.grid"
_pat... |
a1c5ef6188337303bc1b9beeebb345c0c003340a95f78eb230b9656d3a1658d5 | Python | 4,003 | 75 | from tqdm import tqdm
from psam_model import load_model, evaluate_model, MotifModel, MotifModelDataset
from constants import get_args
from load_psam_motif import read_motifs
from map_protein_name import get_map_protein
from utils import write_permute_res
def main(bs, protein, data_dir, motifs, map_index, threshold_l... |
26c64fb4567498e554b474b4e1140d781c7743f531a900178ff375055ea0677e | Python | 4,004 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "parcats.line.colorbar"
... |
326c39f821e6636a2eb3384f1dcf60050510ec405e8cbf574e00f1359ab30456 | Python | 4,004 | 127 | import numpy as np
from numpy.random import default_rng
import pathlib
from mpi4py import MPI
from causal_optoconnectics.tools import conditional_probability, joint_probability, roll_pad
from causal_optoconnectics.generator import (
construct_connectivity_filters,
construct_connectivity_matrix,
simulate,
... |
3b2516cec09ed2dbd8dcc16657be95287e48a66f8bd4bec9d3a946c0e1231bf1 | Python | 4,004 | 118 | # --- 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 Gradient(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolar.marker"
... |
5d55572dc599c5367e9beac792023a6b33a41235e2eda71f5e736c5242f88cb4 | Python | 4,004 | 118 | # --- 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 Gradient(_BaseTraceHierarchyType):
_parent_path_str = "scattersmith.marker"
... |
d046cc4fddc6e54ca9ba0217bf78bd307329fb205784be50591de141b9ccf731 | Python | 4,004 | 138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in November 2019
@author: Nathan de Lara <nathan.delara@polytechnique.org>
"""
from abc import ABC
import numpy as np
from scipy import sparse
from sknetwork.base import Algorithm
class BaseClassifier(Algorithm, ABC):
r"""Base class for classifiers.
... |
ed9733b153cd41c3b50536073c1369656a5a93087e8d9ab3898d54643e698d37 | Python | 4,004 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "splom.marker.colorbar"
... |
89c66c30241b20c3aa9a52dc6ad38af93e743143908c8a561660dfb7521c63f7 | Python | 4,006 | 139 | import torch
import os
import math
from torch.utils import data
from src.data.Dataset import Dataset
from src.data.DatasetReader import DatasetReader
from src.utils.util import set_seeds
class Batcher(object):
'''
Batcher is responsible for returning batches of data
'''
def __init__(self, config, toke... |
1a204fd30c336e9fe70672a6fc15ca94220f458d829e9dc65da25791d5eef33f | Python | 4,007 | 109 | """W1-AC null-autocast shim rows (memo 8.1 item 11 / D18 / defect L8).
Under structure-only meta admission ONLY, exactly the call (meta device AND
``enabled=False``) maps to ``nullcontext`` — semantically null: disabled
autocast performs no dtype coercion and no numerics exist on meta, yet torch
validates the device s... |
57600e7b6eeba147ecb39994a6bac1f9f6d18c3129d1e930d5e77dd8725708c3 | Python | 4,007 | 122 | import glob
import pandas as pd
from collections import Counter
from sklearn.model_selection import train_test_split
class DataManager:
def __init__(
self,
hard_path="./data/hard_labeled_dataset/*.png",
aug_path=None,
valid_ratio=0.2,
test_ratio=0.2,
is_sampling=Fa... |
e352197ac01392f73ae832fa47531727de374b4b7abfb2642dbd875bcce2b925 | Python | 4,007 | 98 | import pandas as pd
import argparse
from utils import side_no_sca_change,valid_smiles
import statistics
def get_metrics(sample_score, ref_score, mol_one, sca_one):
metrics = {}
active = 0
sucess = 0
valid = 0
hop = 0
#将sample_score中的GraphDTA列进行从高到低排序 并取前10%的的列1
sample_score = sample_score.... |
fd9778036d65ae9fb4528c66a14945d9ebebffd32db4689eb8d157750ad440b1 | Python | 4,007 | 1 | import numpy as np
import pandas as pd
import time
import random
# [1] data load #
df1 = pd.read_csv('./data/GSE72056_melanoma_single_cell_revised_v2_gene_filtering_ben3388mal1257_deg.csv', index_col=0) # dimension = (genes x cells)
df2 = pd.read_csv('./data/GSE72056_melanoma_single_cell_revised_v2_gene_filtering_mal1... |
1c456888f4207bb1840d0e45940e7721e70323620d65fb81ea50a336ae6455bb | Python | 4,008 | 83 | from typing import Union
import tensorflow as tf
from angorapy.agent.ppo import loss
from angorapy.common.senses import Sensation
@tf.function
def learn_on_batch(batch,
joint: tf.keras.Model,
distribution,
continuous_control: bool,
clip_val... |
6db38d364381eb9a676b333d32b421722c565125f7a0479dbdd3a70556ebfc91 | Python | 4,008 | 109 | #!/usr/bin/env python3
"""This script is almost an original file "example_4_b.py" created by Roman Martin."""
from GNNSubNet import GNNSubNet as gnn
import ensemble_gnn as egnn
import copy
import random
import time
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import accuracy_score
from s... |
da11b0914fead97a9b516a22fc90acf178349f21105b0727f8d6ae0975a65fed | Python | 4,008 | 145 | import pytest
from pyrosm import get_data
@pytest.fixture
def test_pbf():
pbf_path = get_data("test_pbf")
return pbf_path
@pytest.fixture
def helsinki_pbf():
pbf_path = get_data("helsinki_pbf")
return pbf_path
@pytest.fixture
def default_filter():
return {"amenity": True,
"craft": ... |
4ace8b1cd37a752c15b7cf48d5c3be629194adf4986fa16e1fa837373bd3b681 | Python | 4,010 | 118 | # --- 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 Gradient(_BaseTraceHierarchyType):
_parent_path_str = "scattercarpet.marker"
... |
fcbc6f2e53020ad91117deda47274288d76908935e326be1ae7fb9681721ca49 | Python | 4,010 | 145 | # __init__.py
# Copyright (C) 2013 Bastian Venthur
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program i... |
8b454d10474c58f2e2e4676a7e15bc963f959df16fde47147e0975d4c568f877 | Python | 4,011 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "choroplethmap.colorbar"
... |
a6774e9994364fac0eb3a84a3098785ad8c1ba979fe1bffb5417c1f842aca695 | Python | 4,011 | 119 | """Held pristine torch functions behave exactly like direct calls under capture.
Capture preparation rebinds a module-held pristine torch function to its
wrapper, so a held ``F.relu`` (the default activation
``nn.TransformerEncoderLayer`` binds at torch import) gets the same outer
``F.relu`` / inner ``torch.relu`` cal... |
a998b389c3738f90d77744131ae13f6aa5718331990e474fadaa2f08c8478e19 | Python | 4,011 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "funnel.marker.colorbar"
... |
d17e4321adfdf9817406c944e70aff0b816cc9ab1e8b1d5184c17cde82ccaaf9 | Python | 4,011 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "quiver.marker.colorbar"
... |
d25c3f5b3d8986549c290c97fb8e3b5411ef1137db88505b71a4c81b2a397d6f | Python | 4,011 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "icicle.marker.colorbar"
... |
fd985588b931e5e9a832aed842f363b06947f4abbc6aa9847a4572c91a17fb9a | Python | 4,011 | 136 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "contourcarpet.colorbar"
... |
29ebb01f1bf54db9b0af45ef4d3d090368b201755a4f4a9f638baf031141f1b8 | Python | 4,012 | 98 | import numpy as np
import scipy
import sparse
def add_age_gender(feature_matrix, nonTemporalData, feature_names, age_normalized=True,
age_squared=True, age_sqrt=True):
"""Adds age and gender to 2d feature matrix n_patients x n_features
Parameters
----------
feature_matrix : ... |
a3a73b83990b08713cfdfea8adcd8db310ace35463c3190cca4cf1043e2918c8 | Python | 4,012 | 94 | """FIXME: hypersphere is perhaps bad naming as I am not sure it is the essence;
alignment-and-uniformity loss perhaps? Does not sound as nice.
"""
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn import Module
class HypersphereLoss(Module):
"""Implementation of the loss describ... |
c0b51e3b2d160e0d8c9eee6f9eca231f2b7d03954b07ebf36a819f34b1ab56a1 | Python | 4,012 | 101 | """SSD default config"""
# pylint: disable=unused-variable,missing-function-docstring,bad-whitespace,missing-class-docstring
from typing import Union, Tuple
from autocfg import dataclass, field
@dataclass
class SSD:
# Base network name which serves as feature extraction base.
base_network : str = 'vgg16_atrou... |
fa42c3b7fa8ae9f7904563ba193ac37befeb1a479caaacee12f54cce234e2c69 | Python | 4,012 | 121 | # This example requires the following dependencies to be installed:
# pip install lightly
# 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 copy
import pytorch_li... |
5910cd7df3a7692dfc525eaec09fd520ccd0c1bf4388400d52b17fafb76f342a | Python | 4,013 | 159 | from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from score_behavior.cv_video_widget import CVVideoWidget
class CVVideoWidgetPlugin(QPyDesignerCustomWidgetPlugin):
# Initialise the instance.
def __init__(self, parent=None):
super(CVVideoWidgetPlugin, s... |
66d620c77ba7f4c379cfe60faad5a6d94c8a69bc2f2eafd9fc7ff5f02a6c8478 | Python | 4,013 | 96 | import numpy as np
from brian2.only import *
import deepdish as dd
from digest import get_voltages
from readout import load_results
out_fname = 'contrib_TA.h5'
def get_contributions(cfg, isi, templ):
'''
Calculate the contribution of TA to greater activity in dev than msc, as a fraction of total contributio... |
66e47b352c16501a7d0fbf5ab9e266ad761bad6f883a0960ccac401558d1faab | Python | 4,013 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
f00cf0682d3dd8990b790c2f1d35abd6823e4b07fc8d17aeed6cf23aedf5165e | Python | 4,013 | 91 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
for anc in rang... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.