sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
91604ee4c85dd6cf213fbde5e6b7c86809bec264186576eecb5934757040988d
Python
4,014
134
from __future__ import division, print_function import numpy as np from numpy import inf, ndarray import pandas as pd import torch import torch.nn as nn from torch.functional import F import os import random import sklearn from sklearn.model_selection import KFold, StratifiedKFold from sklearn import metrics import re ...
56ff48b89d643bede7c1c9113177c7068b3e0ac7bd249c194c2165e5d9c64155
Python
4,015
145
from abc import ABC, abstractmethod from dataclasses import KW_ONLY from typing import Callable, Optional, Union import equinox as eqx import jax import jax.numpy as jnp import jax.scipy.special as jsp class CardiacDriverBase(ABC, eqx.Module): _: KW_ONLY dynamic: bool = False class FixedCardiacDriver(Cardi...
7ebc7563c21385bc5634df3c55e6233ffd5475f0573132c6de289f4d360dface
Python
4,015
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 = "scatterternary.marker"...
814d819fcad59a5446318d4bba7404e6d4bf7a04d016f63876110d6b46077025
Python
4,015
115
# SOURCE: vendored from HazeDT/WaveletKernelNet @ cd6091bf543bb03b65fb989f9dc28aeb3d4be3de # https://github.com/HazeDT/WaveletKernelNet/blob/master/models/Morlet_LeNet.py # The `Morlet_fast` (learnable-Morlet-wavelet CWConv layer, replaces the first conv # layer with a bank of trainable-scale/translation wavelet filter...
c5ea9a4ca0cfd1c7ad63f5f2c42c0e0dc7d5a159916ef6ff78218dfe92887cc1
Python
4,015
112
# Copyright (c) 2024 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 app...
6b017aa34adb1922cfc271a580095589072f949e3cba6174d694f8fc6adcb46b
Python
4,016
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, ...
b8fd3a023b44f1ea41c1753cc3b7162533e6845ede003b85af1cf3f3764b5150
Python
4,016
92
import glob import argparse import json import os import tqdm import numpy as np import pandas as pd from mp_dip.utils.db_atoms_utils import read_db_atoms from mp_dip.utils.utils import read_raw, preanalyse_raw, get_rms_percentile, filter_selected_atoms, \ svarog_tags_writer, get_mp_to_raw_channel_map, get_mp_bo...
3ded4f34faafcdfca48a7e0989b5d9fdbcd6485bca0817ac84b7fe920dc5585a
Python
4,017
89
import sys import json from collections import defaultdict import numpy as np import matplotlib matplotlib.use("Agg") from matplotlib import patheffects import matplotlib.pyplot as plt import aquarel theme = ( aquarel.load_theme("arctic_light") .set_grid(draw=True, width=0.5) .set_font(family="sans-serif"...
4d40266650d2b658ec34e29389d5c0010caf2a9bcc395916885ad1b53a0d940d
Python
4,019
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 = "scatter3d.line.colorbar" ...
59d04dda8b7fcedcecb86457307fd4bc2c9d49da52506afc48e679cf24204d63
Python
4,019
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 = "treemap.marker.colorbar" ...
8550f25783cb32763edcb2ae4d51b34dc7c4e2a60f03f1a2e3e312139c306c47
Python
4,019
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 = "scatter.marker.colorbar" ...
8e01dae88a9f5a4b4b582b1400e2be02ec4991a61b68f6073fe95c75a8a3f568
Python
4,019
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 = "parcoords.line.colorbar" ...
f12c5ef5031035f651414014cc693f3dea9e05e947368bf71bda2f49f01c474c
Python
4,019
106
"""Harvestability spike (row 0.9): count taught paths + claim strings NOW. The taught-path and prose-claim universes stay OPEN until their parsers exist; this spike proves the harvest is feasible and pins TODAY's counts so the sweeps written against them at wave A start from a measured baseline, never a guess. Fallbac...
2a30cd68bb0ce171eee7dcc01be21faf33613a92b3d14beba691db7d2c7ce246
Python
4,020
114
""" Figure about FSM 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 reload #r...
91759f37cf5e7a51dbd855236ebb7946c6b741089703e8b69816965a5521076b
Python
4,021
134
from __future__ import division, print_function import numpy as np from numpy import inf, ndarray import pandas as pd import torch import torch.nn as nn from torch.functional import F import os import random import sklearn from sklearn.model_selection import KFold, StratifiedKFold from sklearn import metrics import re ...
a3e9f5da828a90a21034797a027444d46957272b9c31ff735e2a1e8e9b610604
Python
4,021
135
import numpy as np import tensorflow as tf import random as python_random import os import tensorflow_datasets as tfds from tensorflow.keras.models import load_model from gradient_accumulator import GradientAccumulateOptimizer def normalize_img(image, label): """Normalizes images: `uint8` -> `float32`.""" ret...
2265f622c41d802098906a0947dd822f4d2b024b54e88de9d18f82f28d92d3ab
Python
4,022
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "box.selected" _path_...
15f8550a477d4f09d96b6f309774381b410493ac5550f924483497645dcfd0f8
Python
4,024
84
import glob import os import SimpleITK as sitk import cv2 import numpy as np from natsort import natsorted def subsample_segmentation(in_data, dim_size=None): """Takes an input image (no color channel) and resamples it to a desired size. It can be expanded to work with any number of dimensions. """ dims ...
aa822dc224cfaf91820d2b9f8faab26e1400cbbbdc3689b8001d032b5a98c9b3
Python
4,024
100
"""Lane A08 row gate: the harvested genuine-release corpus still round-trips. The persistence-honesty fixes (WT1 A-IV items 17-22 + W3) must not change how LAWFUL existing artifacts load: every in-window genuine artifact (writers v2.31.0 through unreleased main) loads, and the below-floor v2.16.0 ModelLog bundle keeps...
1c7b9b34c46f6de6f1422b959af6c46d6f32756c0ea51ddff99af2b52297353d
Python
4,026
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 = "sunburst.marker.colorbar"...
624f4c053f6cc68e70431f33d9ab5e4e7a5c4c5ed9cb7c10e8968173bc435e37
Python
4,026
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 = "barpolar.marker.colorbar"...
3e0b365db79bcb9533951977fbfa02f38d1389e4d5e132a8dcf364ab662044f4
Python
4,028
120
import os import argparse import json import gzip from rdkit import Chem class ModificationConstants: DNA_SMILES_BACKBONE = "O=P(O)(O)OCC1OC*CC1(O)" DNA_NAME_MAPPING = { 0: "OP1", 1: "P", 2: "OP2", 3: "OP3", 4: "O5'", 5: "C5'", 6: "C4'", 7: "O4'", 8: "C1'", -1: "O3'", -2: "C3'", -3: "C2'", }...
c3b95bd5a19c02c2ed16aa809c40a65bd20c0110fde26ad8bf85ee1afaa4ab71
Python
4,028
124
from __future__ import annotations import pytest from pybind11_tests import custom_type_casters as m def test_noconvert_args(msg): a = m.ArgInspector() assert ( msg(a.f("hi")) == """ loading ArgInspector1 argument WITH conversion allowed. Argument value = hi """ ) assert...
aac0daf18e050bd0ff819a5acf3208a9c7bd4818aff1fdc70521d9092b4c0ca5
Python
4,029
114
"""A06 capture-options truth: the ``module_filter`` third save gate is DISCLOSED. WALKTHROUGH list-A row 10 (second clause): ``module_filter`` was a doc-invisible third save gate whose argument is an op-record namespace, so the natural nn.Module-shaped filter (``lambda m: isinstance(m, nn.Linear)``) silently saved ZER...
da0d7873e1937a6a2e2b811f650315defff399cab0c26bb971c7ff0f7b9574a1
Python
4,029
109
""" Predict tool usage to weigh the predicted tools """ import os import numpy as np import warnings import csv import collections from sklearn.svm import SVR from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from scripts import utils warnings.filterwarnings("ignore") main_path...
285c72a31f1f69ffd46db489305b9f7c03f64290f1edb6d1421c23f7b1deddf5
Python
4,032
122
""" OIDC-specific utility functions for token handling and verification. This module contains helper functions that are specific to OpenID Connect (OIDC) authentication. These should not be used with non-OIDC backends like OAuth2. """ import logging from typing import TYPE_CHECKING import jwt from social_core.backen...
c6bc5c032909e0a0dd4043333e03f34e1747dea3c7602c24133229cb071fc1b2
Python
4,032
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "splom.selected" _pat...
01bd07fbefacd2d63b28333a076607fae1cd073ec26af0b2a97cb20d795c1f4d
Python
4,033
121
# --- 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 Z(_BaseTraceHierarchyType): _parent_path_str = "volume.caps" _path_str = ...
2cfd65571560c6884abcd37a56906bf3d64d84ecf7dcb6ac4e65dfb88b792cec
Python
4,033
121
# --- 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 X(_BaseTraceHierarchyType): _parent_path_str = "volume.caps" _path_str = ...
70cfaccb17ace97f7fbf683803c63ab7da0085fc376259015e6cc4368605b0a1
Python
4,033
121
# --- 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 Y(_BaseTraceHierarchyType): _parent_path_str = "volume.caps" _path_str = ...
ae2a5cc8839eaa56550178ba3020fc41463d06e585cd7a367a4d4d1239e78860
Python
4,033
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 = "scattergl.marker.colorbar...
cd602e93cd3614144ba8ba78940822eff0df76eeea22cff0eb4a5de6fdcb50a4
Python
4,033
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 = "histogram.marker.colorbar...
e5139df38e797455c6d38a0caa1910fa298f2a69b5a3d24395f6f3d7817c9b43
Python
4,033
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 = "scatter3d.marker.colorbar...
23e97d2f5bc7371c61f375bab891140ddfb16db0340254876d00571c925a092f
Python
4,034
134
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "funnelarea" _path_st...
f99def2323b8264a81322a4ab0fbe1ce6c658ed05d221242b25fccfbf112a81a
Python
4,034
162
# Adapted from https://github.com/facebookresearch/xformers/blob/main/xformers/triton/k_activations.py # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import math from e...
2b744a4e7dc8e0d6c7d61d914216f9cf4aad691bcc6eab180233423c7b366288
Python
4,035
107
# load environment gnnEnv2 from moviepy.editor import * import pickle import numpy as np from pathlib import Path import pandas as pd arg = sys.argv[1] if arg == "genset": out_path = './genset_media_trimmed' #videos trimmed to motion stop in_path = './original_dataset_files/test' #original v...
5ed871761708e54fb38b670be081c207d692b717b825e746651b06fd9d5a2e24
Python
4,035
89
# 结论:当模型进行ensemble的时候性能会明显提升。 import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch from random import choice from sklearn.metrics import cohen_kappa_score from statsm...
886001d8e21d06b81b36302b8d30af148205baeff6a3d8836c5a1e1c970cd4e4
Python
4,036
136
# --- 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 Title(_BaseLayoutHierarchyType): _parent_path_str = "layout.coloraxis.color...
a4d427d5d33a4b8950bb3ff6680e1f8ac0e60327bc561a4995b3877820b76287
Python
4,036
120
from argparse import ArgumentParser import torch from pytorch_lightning import LightningModule, Trainer, seed_everything from torch.nn import functional as F from pl_bolts.models.vision.unet import UNet class SemSegment(LightningModule): def __init__( self, lr: float = 0.01, num_classes:...
b15231100ee032a67c9f86555943e304fb4d74c67f1744d0eb321869015fb04d
Python
4,036
112
import copy from typing import List, Tuple import torch from pytorch_lightning import LightningModule from torch import Tensor from torch.nn import Identity from torchvision.models import resnet50 from lightly.loss import BarlowTwinsLoss from lightly.models.modules import BarlowTwinsProjectionHead from lightly.models...
042ea20273c39d558e59bab743716800831dc86376516ae977095ed9026841dc
Python
4,037
142
# -*- coding: utf-8 -*- """ Created on Mon Oct 12 11:38:07 2020 @author: KEPetousakis """ from numpy import exp as exp import numpy as np from matplotlib import pyplot as plt from random import randint import matplotlib as mpl import warnings import logging logging.getLogger('matplotlib.font_manager...
19f7525f65058bec89ff555d37c41c5de392d448e6354d8a0bba1a5d46f429e4
Python
4,037
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "violin.selected" _pa...
9ce56b71890494b7844916895013a5d73ecce62ef19e68648a4c6b5b63ccdb49
Python
4,037
133
import math from typing import List, Sequence, Tuple, Union import numpy as np import torch from torch import Tensor from pl_bolts.utils import _SKLEARN_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _SKLEARN_AVAILABLE: from sklearn.utils import shuffle as sk_shuffle else: # pragma: no cover ...
1d62089a3012825b9d6bf04aca786fc24d1fe267bc4564592509bb984a9896fd
Python
4,038
137
""" This module includes auxiliary support methods and data structures. """ from collections import namedtuple import numpy as np from numba import njit from numpy import array as array_t # Add documentation to the NamedTuple. __pdoc__ = {} # Module level declaration. MetalAtom = namedtuple("MetalAtom", ...
afeb8246212773fb299271104aed114778cc54691cef815ff48b6b404dd72dd6
Python
4,038
105
import torch import torch.nn as nn from collections import OrderedDict from torchinfo import summary import numpy as np def Conv2D( in_channels: int, out_channels: int, kernel_size: int, stride: int, padding: int, is_seperable: bool = False, has_relu: bool = False, has_sigmo...
24c19cd07014a72f0d33e30a1bc072f934d10a0f1bede95c0e4b8b28a12a842b
Python
4,040
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 = "scattermap.marker.colorba...
6c08c9384e399d5729e5a67bfed8a89aba70942797563d47992e1e67dc8c5c85
Python
4,040
92
import torch import numpy as np from sklearn.model_selection import train_test_split from scDGD.classes import scDataset def prepate_data(adata, label_column, train_fraction=0.8, include_test=True, scaling_type='max', batch_size=256, num_w=0): ''' Prepares the pytorch data sets and loaders for training and tes...
886b80b9f54a56e66e51452cbef80903d122a85a8d3fb98608920c9042773b29
Python
4,040
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 = "scattergeo.marker.colorba...
fe354cdfca0a97cf6d15b9934a0de84c4e791660973d15f5ad4a3be720c14d7d
Python
4,040
143
"""Tests for the specparam.models.time, including the time model object and it's methods. NOTES ----- The tests here are not strong tests for accuracy. They serve rather as 'smoke tests', for if anything fails completely. """ import numpy as np from specparam.sim import sim_spectrogram from specparam.models.utils im...
879be9d4eba7e49d6df67b6f7ebf4522abe083c69b345bebb73f6a1ea553b70d
Python
4,041
103
import numpy as np import pytest from conftest import basis_raw, dataset_config_factory, mock_database from coeffnet.predata.matrices import TaskdocsToData def test_TaskdocToData_minimal_basis_input( mock_database, dataset_config_factory, basis_raw ): """Test the input of the TaskdocToData class.""" db =...
71c08ca07d22868e47113e29cef09cf083b95e603b449eb522a0bb17aeb73466
Python
4,042
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "scatter.selected" _p...
b92b89f67d92de5618193f11e41202c3cd1d4dd0b2f5720f30a23bf1c55b5e0b
Python
4,042
120
from keras.src.api_export import keras_export from keras.src.layers.preprocessing.image_preprocessing.base_image_preprocessing_layer import ( # noqa: E501 BaseImagePreprocessingLayer, ) @keras_export("keras.layers.MaxNumBoundingBoxes") class MaxNumBoundingBoxes(BaseImagePreprocessingLayer): """Ensure the max...
ec10ada7e64e08b4da19067e894153230caf8b4202fe5f7d0102b756e1620d26
Python
4,042
125
from typing import List, Any from pathlib import Path import os import argparse import numpy as np from ase import build as ase_build from ase import io as ase_io from pymatgen.core.structure import Molecule from pymatgen.io.ase import AseAtomsAdaptor from pymatgen.core.operations import SymmOp from minimal_basi...
55b88dd169d9e9e903db007b4b207330e6f150fa111df250774d5436129a6aac
Python
4,043
103
"""Registry of most widely used datasets""" import os import shutil import tarfile import zipfile from ...data import VOCDetection, COCODetection from ...utils import download as _download, makedirs __all__ = ['get_dataset', 'list_dataset'] _DATASETS = {} def list_dataset(): """List available dataset registered...
57cf6b5445e3b2466df35c79c26a70b4da6af9da855f38243ec5c64adfd1f4a1
Python
4,043
119
import gzip import os from helixfold.data import mmcif_parsing from helixfold.data import parsers from helixfold.common.protein import PDB_CHAIN_IDS def traverse_until_valid_res(info, res_index) -> int: # NOTE: id of `info` starts from 0, while res_index # starts from 1. while res_index - 1 < len(info) a...
5dc84e90d280c040658f28db857189ccbb9ee4b60018100e711201f706e14e2b
Python
4,044
161
"""Credit-required lint (workstream D01 gate). The acknowledgments page (docs/acknowledgments.md) is the assembled credit roster from every design memo's CREDIT section. The convert-memo maintenance rule: any change landing a borrowed idea adds or extends a row on that page in the same change. This lint is the mechani...
85fdfbb384e13c688d74afdeadbbf8a7bb7bd994e1cafb6e7290214db01f602b
Python
4,045
107
"""grind-r3 T-CACHES: RF schema-operand-slot cache bounds and fail-closed lookup. Round-2 F39-4a: the unbounded-negative-entry leak was fixed by NOT caching ``None``, which converted every unrecognized func name (loaded traces, custom ops, non-aten labels) into an unbounded RE-computation -- torch does not memoize a f...
af9b4e72ffd4917e56a51f48bbeae9be40e7809ed9588646b0e435b95b043081
Python
4,045
136
import numpy as np import pytest import gym from gym import spaces from gym.envs.registration import EnvSpec from tests.envs.utils import all_testing_initialised_envs, mujoco_testing_env_specs @pytest.mark.parametrize( "env_spec", mujoco_testing_env_specs, ids=[env_spec.id for env_spec in mujoco_testing_...
ba5b6ad22c505dee6b5e3c6190e9a3d82b3085b0833c293f07b7a87b2bb8c6d8
Python
4,046
95
# SOURCE: vendored from PufferAI/PufferLib @ 4.0 (tests/test_nmmo3_encoder.py) # # `NMMO3EncoderRef` is the real PyTorch reference observation encoder for PufferLib's # Neural MMO 3 baseline (`ocean/nmmo3`), used in `tests/test_nmmo3_encoder.py` as the # ground-truth numerical reference that PufferLib's fused CUDA `oce...
6eded46b7325bcb428264f522c7c622796aa86b26b4c3b1f720d702811c8da08
Python
4,047
75
"""General-purpose test script for image-to-image translation. Once you have trained your model with train.py, you can use this script to test the model. It will load a saved model from --checkpoints_dir and save the results to --results_dir. It first creates model and dataset given the option. It will hard-code some...
8ca3e80d0ca83a88e4d30c378615f65e91e60001a9460126f85f6dfcb9bb1586
Python
4,047
142
import os import sys from pathlib import Path import logging import numpy as np import tracemalloc import argparse import snapatac2 as sa2 import pyprojroot code_root_dir = str(pyprojroot.here()) pack_dir = f"{code_root_dir}/package/python" sys.path.insert(0, pack_dir) import utils # type: ignore # noqa: E402 parser...
d7995221c88cdd855d100a1288ce659f7f027e6e523ffeee332e165f07b8b2b3
Python
4,047
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 = "histogram2dcontour.colorb...
fa4a71083d97d3c9b02b782c7cbe3288eb1f4a278288b1c7987d46481580242a
Python
4,047
126
from abc import ABC, abstractmethod import os import attr from matplotlib import pyplot as plt import numpy as np class SLPD(ABC): """ Splicing length pattern distribution. Represents the distribution of splicing length patterns (i.e. the lengths of the exons and introns in a splicing pattern...
4142d86746092754bce339ee343ede990e77965c9470af2197105b98c49bf17d
Python
4,048
87
import torch from torch import nn from torch import Tensor from collections import OrderedDict import numpy as np class GetDensity(torch.nn.Module): def __init__(self,rs,inta,cutoff,nipsin,norbit,ocmod_list): super(GetDensity,self).__init__() ''' rs: tensor[ntype,nwave] float inta:...
d419ad153cbd0f34c0cdb98557223a3d2dbb965818d274c32e3017fdc02a6040
Python
4,048
121
from __future__ import print_function, division, absolute_import import torch import torch.nn as nn from torch.autograd import Variable #from torch.legacy import nn as nnl import torch.utils.model_zoo as model_zoo __all__ = ['vggm'] pretrained_settings = { 'vggm': { 'imagenet': { 'url': 'http:...
d8026e3c8fc31cce53f480e0713c1fd04f2cbb21c01677ec7aca20af4001ed14
Python
4,048
110
"""Nicer log formatting with colours. Code copied from Tornado, Apache licensed. """ # Copyright 2012 Facebook # # 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/licen...
9a468494dc34dbe79b5aefd381f183785f547bcd4e3b3794cb12f3ecbdbddfe6
Python
4,049
75
# !/usr/bin/env python ## created by Yun Hao @MooreLab 2021 ## This script learns and evaluates DTox model ## Module import sys import torch import numpy as np import pandas as pd sys.path.insert(0, 'code/') import dtox_data import dtox_learning ## This function implements DTox model training def dtox(dtox_combin...
42861fa47abf7375d8f7c088b45bf66be04b3616350fe02dd44dd312dcf046a2
Python
4,050
136
"""Adaptive input representations for neural language modeling. Paper: "Adaptive Input Representations for Neural Language Modeling", Baevski and Auli, ICLR 2019. The architecture factorizes token input embeddings by frequency bucket: frequent words receive full-width embeddings, while progressively rarer buckets use...
465d947d9e86bbb60a8743d04d8d167d42d2c08df1bbc53796e6d4537d04b24d
Python
4,051
84
import os, argparse import pandas as pd import subprocess import pickle # Module rnaprot/rplib.py from rnaprot.rplib import bed_overlap_with_genomic_features, gtf_extract_transcript_bed, gtf_get_transcript_ids, bed_get_transcript_annotations_from_gtf, bed_get_exon_intron_annotations_from_gtf, gtf_extract_most_prominen...
83fcaa38d97145cb36c381039389846e64053011f0bf01ee3b4d0135ece7cc54
Python
4,051
103
import unittest from command_utils import load_arguments import os import bleualign import io from bleualign.align import Aligner from test.utils import Utils class TestByEvalFilter(unittest.TestCase, Utils): def setUp(self): pass def test_originalFileName(self): self.main_test('fileNameOptions') def test_fil...
dc3146e2934f2d6d5acdbdda5f298cc5037dc293f8c2b4649d1bebe1fff4f02f
Python
4,051
104
"""hd256 forward + backward on SM100/SM110 against FP64 eager, dense and varlen. Shapes sit on the 128-row tile edges (127/128/129), a partial last tile (1000), a long sequence (4096) and Q/K length mismatches in both directions, for MHA and 24/4 GQA, causal and non-causal. The features the hd256 backward does not sup...
70e05d7468fcebca52a94abcb5bec85efd6258ed3a40a05eaf93db75108babf6
Python
4,052
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "scattergl.selected" ...
b065c5de953db059fd91d925792b87feaa8e5b4c508b4197883b065c00e60893
Python
4,052
133
"""interactive plotting from https://stackoverflow.com/a/31417070/5407682""" import colorsys import math from typing import List import numpy import numpy as np from matplotlib import pyplot as plt, colors as mc def make_interactive_legend(ax=None): if ax is None: ax = plt.gca() if ax.legend_ is None...
bf43400f0a648fb7ff23e631134bfdde8a666e489183714360e916574682e58f
Python
4,053
102
""" ====================================================================== Classification accuracy vs class distinctiveness vs class separability ====================================================================== Generate several datasets containing data points from two-classes. Each class is generated with a Riem...
c6286711e514c3851333508c4541156862efefd10bd4975291e5d7f8c6a96d95
Python
4,054
109
""" Manages active plugins. Load and access plugins. 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 under the terms of the GNU General Public License as p...
d3e79345b8263d35d7ed35870d720f72a3c337b2bf53311d22c9ce6064a02361
Python
4,054
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 = "scatterpolar.marker.color...
e6a1cc934ad36067bc28df51d8fd1ebccf914887e8804feebc8c3e143e7b6cfd
Python
4,054
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 = "scattersmith.marker.color...
451396310a26d2471d951dd7f5299e23064e89034b4e6b7e260518015794285f
Python
4,055
105
""" #-------------------- Created on 2021.11.05 Version 1.0 __author__ = 'Xx' #-------------------- """ ''' Description: Routine for determining the level of confidence of a particular clear sky test. Input two threshold values ('midpt') with associated confidence limits ('locut', 'hicut') whic...
a945f7731a3e26173592d894bcacbd80f6f80c710eba43c9506737fb6ed90692
Python
4,055
123
""" RSA statistics. """ import os import mne import numpy as np from mne import spatial_src_adjacency from mne.stats import (spatio_temporal_cluster_1samp_test) import scipy.io import argparse import sys from config import fname from pathlib import Path # Be verbose mne.set_log_level('INFO') # Handle command line a...
cdf836be034661504a2435078815cee9c5731de72e3d642eafb36c05d33d0372
Python
4,055
159
# --- 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 Pad(_BaseLayoutHierarchyType): _parent_path_str = "layout.slider" _path...
77cd2b93334376ddaa5cbe58d1f85d91cebc3b3cd8d77c61ff11677df14ce1e8
Python
4,056
104
#!/usr/bin/env python3 from htmd.ui import Molecule from moleculekit.tools.atomtyper import prepareProteinForAtomtyping from moleculekit.tools.voxeldescriptors import getVoxelDescriptors, getCenters from argparse import ArgumentParser def parse_cmd(): """Parse command-line arguments. Returns ------- ...
af434fb7a6e3a73320cda876f398aa75cd825723743ae6d4f38502b42011e231
Python
4,056
128
import os import re from matplotlib import pyplot as plt import numpy as np from permacache import permacache from modular_splicing.models_for_testing.load_model_for_testing import step_for_density from modular_splicing.utils.io import load_model, model_steps from modular_splicing.motif_perturbations.summarize_effe...
25c522f70c3233036844f63f8a112fbc8d6fd0be3e0bd5a2fd77bdb3db9f908c
Python
4,057
118
""" =============================================================================== Robust covariance estimation =============================================================================== Comparison of robustness of different covariance estimators on a corrupted low-dimensional dataset. See also [1]_. """ # Autho...
676bf48dcb11a6e0003e606067174bd4ace292225f300b6f977be942dde8859f
Python
4,057
119
""" Module responsible for data augmentation constants and configuration. """ import torch as ch from torchvision import transforms from .audio_functions import audio_transforms # lighting transform # https://git.io/fhBOc IMAGENET_PCA = { 'eigval':ch.Tensor([0.2175, 0.0188, 0.0045]), 'eigvec':ch.Tensor([ ...
a51b1c24aff1d05444a3a22afefed83dce0cc830aa6b2429a1255fc69ff29c3e
Python
4,057
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "scattermap.selected" ...
d92ab717c7b07873b4b98c3593abbd19bdd9b5693ecbff27841b76db554bc17c
Python
4,057
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 Marker(_BaseTraceHierarchyType): _parent_path_str = "scattergeo.selected" ...
2f1365449c9578ebbb013df386b19914618cbd2a7f6720151c8ba439e69c680d
Python
4,058
110
"""Accuracy metric for heatmap prediction.""" # pylint: disable=assignment-from-no-return import numpy as np try: from mxnet.metric import EvalMetric, check_label_shapes except ImportError: from mxnet.gluon.metric import EvalMetric, check_label_shapes class HeatmapAccuracy(EvalMetric): """Computes heatmap...
037ab96f0d74a0075f2213f95330660403aca0dbfd61d3b090f37a4870c2222c
Python
4,059
125
"""Visualize image.""" import numpy as np try: import mxnet as mx except ImportError: mx = None def plot_image(img, ax=None, reverse_rgb=False): """Visualize image. Parameters ---------- img : numpy.ndarray or mxnet.nd.NDArray Image with shape `H, W, 3`. ax : matplotlib axes, optio...
0c8b2d3c718cc1750d0868de2614675b895dd642bfb58d592a68e4469916aa6b
Python
4,059
127
"""Plenoxels radiance-field renderer in torch tensor form. Fridovich-Keil et al. (CVPR 2022), "Plenoxels: Radiance Fields without Neural Networks." Plenoxels represent a scene as an explicit sparse voxel grid of density and spherical-harmonic color coefficients, then render rays by trilinear interpolation and differe...
c56fc59b02cab26cbc365245ec5dd4d7362a498606e8d329da2c62ad53bf8386
Python
4,059
197
#!/usr/bin/env python # -*- coding: utf-8 -*- import os # disable tensorflow warnings os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf # constant values from .constants import CRLF from .constants import IMG_SIZE from .constants import RESET_COLOR_CODE from .constants import GREEN_COLOR_CODE __autho...
e7cdc0d2332d2abc973e68b4c8df4d38d559d739a59a35d119a3023c58266d5e
Python
4,059
101
# SOURCE: vendored from bigict/ProDESIGN-LE @ f9a9ba1 (main) # File: pe/model/modules.py # ProDESIGN-LE: local-environment-aware transformer for protein sequence design. # `design.py` (repo root) constructs the real trainable network as # `modules.Transformer(46, num_class, 256, nhead=16, nlayer=3, device=...)` -- a pl...
6ed7c9e20ba89fe9e3fc8e8e17d81d013cf4b6e2982a7ffc11f66cc41560f01d
Python
4,060
128
from pathlib import Path import pandas as pd from anndata import AnnData from pandas import DataFrame def row_annotations( adata: AnnData, annotations: pd.DataFrame | str | Path, join_column: str | None = None, columns: list[str] | None = None, copy: bool = False, ) -> AnnData | None: """\ ...
4b5f7356e3e386b10af367fe78f2164281810327093046dfdde87f0dd68f1941
Python
4,061
105
from typing import Optional import numpy as np from brian2 import Quantity, meter def generate_circle_locations(n, radius, rng): if isinstance(radius, Quantity): radius /= meter loc = np.zeros((n, 2)) mask = np.ones(n, bool) while mask.sum() > 0: loc[mask] = rng.uniform(-radius, radius...
914fdd2e3fba220e2fb3212aaefd312b304edf3029ccde17089a8fc6aadec108
Python
4,061
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 = "scattercarpet.marker.colo...
cc6b07819e50dff725701acb5acf49a8141922b537bf88df2c57a00fb64195b5
Python
4,061
186
#!/usr/bin/env python # coding: utf-8 # # General setup # In[7]: import os, sys, subprocess import time from glob import glob import itertools from functools import partial import copy import gc import importlib sys.path.insert(1, os.path.realpath('lib')) if "utils" not in sys.modules: import utils else: importlib...
0b04809fdeb9072d4649dff306a2cdf16a0963ad214951f294a0338584569c85
Python
4,062
151
import logomaker import pandas as pd import numpy as np from tqdm.auto import tqdm def plot_logo( df, threshold, ax, color_map={"A": "#00dc33", "C": "#1c1cd5", "G": "#f2a93c", "U": "#ff1525"}, nts=["A", "C", "G", "U"], ): current_df = df.query(f"activation > {threshold}") if len(current_d...
32d9ccee301fbd1072c7d57f5aeaff03e6377043b7e18cf83be569f1aaca7a3f
Python
4,062
111
"""Test cases for lane.py.""" import os import unittest import numpy as np from scalabel.common.typing import NDArrayF64, NDArrayU8 from bdd100k.common.utils import list_files from bdd100k.eval.lane import ( eval_lane_per_threshold, evaluate_lane_marking, get_foreground, get_lane_class, sub_task_f...
bc178742c219099cdd62ca120d71d6dc099b722648dfbb57c3de3059e2358496
Python
4,062
122
"""Functions to analyze and investigate model fit results, in terms of model fit error.""" import numpy as np from specparam.sim.gen import gen_model from specparam.plts.error import plot_spectral_error from specparam.modutils.errors import NoModelError, NoDataError ##################################################...
0eb101bc65afdc38148f0c8ebab7aa54048b5c5350c01d92918bf148d25906d4
Python
4,064
130
""" Functions written by other researchers. """ import numpy as np import mne from scipy.linalg import eig def _get_global_reject_epochs(raw, decim): """ Author: Denis Engemann <denis.engemann@gmail.com> Computes the threshold for global rejection of epochs based on the amplitude Parameters _____...
2dc9d78d51b8317b1fc5fe743abc7e8065b73caae495187cd0a4f51162bbf7b4
Python
4,065
122
# --- 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 Y(_BaseTraceHierarchyType): _parent_path_str = "isosurface.caps" _path_st...