sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4f90d8da954baae28f5e5ff6bdc06f4995939107cae22d7e4759e96bc85adb8a | 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 X(_BaseTraceHierarchyType):
_parent_path_str = "isosurface.caps"
_path_st... |
5d6f3eb22d1c49128c0d3fad1077ca28ae693228bcba4aa4da39568e006c7344 | 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 Z(_BaseTraceHierarchyType):
_parent_path_str = "isosurface.caps"
_path_st... |
82a22f29a5cc17bc77eee0f2088742bf5b02b1c2081767aab0d699e9e445c937 | Python | 4,066 | 129 | """
Classes to apply compression to the output of the cochleagram function.
Include modifications of the gradients to improve stability for back
propagation.
"""
import torch as ch
class CompressionFunction(ch.nn.Module):
"""
Base class for all compression functions. Forward pass must take in
a ch tensor ... |
a3aa6d9fbae6909400c5409fe7319af34b2ed016de5d8970f61eae8e84511444 | Python | 4,066 | 108 | """Pascal VOC Semantic Segmentation Dataset."""
import os
import numpy as np
from PIL import Image
from mxnet import cpu
import mxnet.ndarray as F
from ..segbase import SegmentationDataset
class VOCSegmentation(SegmentationDataset):
"""Pascal VOC Semantic Segmentation Dataset.
Parameters
----------
ro... |
048f433af4b916182e884829ede14cad54c0b2c3ac932ec2f79782eb3a6311aa | Python | 4,067 | 120 | """Tests for the filter observation wrapper."""
from typing import Optional
import numpy as np
import pytest
import gym
from gym.spaces import Box, Dict, Tuple
from gym.wrappers import FilterObservation, FlattenObservation
class FakeEnvironment(gym.Env):
def __init__(self, observation_space, render_mode=None):
... |
5fbd68b0a3f601bdf128440141333cfb3c85b2472568cc97d19c524cfe257118 | Python | 4,067 | 84 | import numpy as np
import tensorflow as tf
import os, argparse
from data import process_image_file
from collections import defaultdict
def score_prediction(softmax, step_size):
vals = np.arange(3) * step_size + (step_size / 2.)
vals = np.expand_dims(vals, axis=0)
return np.sum(softmax * vals, axis=-1)
cl... |
d4943ecea866b5653f03610a0b51cb3436f94d8794ed2d93162ab0da397ebb12 | Python | 4,067 | 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 = "scattersmith.selected"
... |
dca5ee8b77194da03a32ff9f1d038af4e4a12b7d2e4d3e26b33fc5ef38221662 | Python | 4,067 | 143 | import os
import h5py
import numpy as np
import tqdm.auto as tqdm
from .chunk_iteration_order import dataset_indices_generator
from .reprocess_data import create_datapoints
from modular_splicing.utils.genome_statistics import gene_at_richness
def create_dataset(
*,
datafile_path,
dataset_path,
SL,
... |
ef9e809967368e7eb135eb2e9eebb3bf334d1a3464c92eb9577b17e3b1df7409 | Python | 4,067 | 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 = "scatterpolar.selected"
... |
477e4bb89419132651f9eea794d036fe62eb914dc5156ff174199616fd778125 | Python | 4,068 | 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 = "scatterpolargl.marker.col... |
7d85d15f3ac08b103d896e750b8127998553e331585918517228965a853b76cb | Python | 4,068 | 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 = "scatterternary.marker.col... |
703f54137157a4f46547d8ef973f820eb78fe7ac45f1957be8a6d522d7de5977 | Python | 4,070 | 139 | import copy
import pytest
import numpy as np
from mirp import extract_images
@pytest.mark.ci
def test_mask_processing():
# Default settings.
image = np.ones(shape=(3, 10, 10), dtype=float)
mask_1a = np.zeros(shape=(3, 10, 10), dtype=bool)
mask_1b = np.zeros(shape=(3, 10, 10), dtype=bool)
mask_2a... |
b3d952f36ee7793074593a14ea6c5b432be063ea4e49f89485f20eee668ea614 | Python | 4,070 | 130 | import torch
from tqdm import tqdm
import numpy as np
from interpretability.utils import (
set_hook_to_get_repr_all_layers,
load_sequences,
load_model_and_vocab,
)
import pickle as pkl
from sklearn.decomposition import NMF
import inspect
def get_all_tokens_repr(activation, nb_layer):
all_cls_tokens = ... |
f36dbd28f52a8b47efc02dd94505ba48763118c9d9d401baecadba5bcaa7c661 | Python | 4,070 | 113 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
fb969406b394d52cfa8ff5dba9660cb156a20414cc8ef6c353c35044d61ffe9e | Python | 4,071 | 118 | import torch
import torch.nn as nn
from modular_splicing.utils.construct import construct
from modular_splicing.models.modules.residual_unit_stack import ResidualStack
from modular_splicing.models.local_splicepoint_model_residual_propagator import (
lsmrp_types,
)
from .bottleneck import bottleneck_types
from .ls... |
0fda69134dd6498384530e95b56f30bb83a46d03d6e337ffd29a35e84dfc1467 | Python | 4,072 | 105 | import numpy as np
from mirp._features.histogram import HistogramDerivedFeature
from mirp.settings.feature_parameters import FeatureExtractionSettingsClass
from typing import Generator
def get_feature_pooling_parameters(
settings: FeatureExtractionSettingsClass,
spatial_method: str
) -> Generator[str... |
1f33c10216c61b8a66d766aa364d0d484af2444388b73002a680c81d345a2832 | Python | 4,072 | 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.updatemenu"
_... |
2b54fbf97496f7a4f43ae307350e65291ec4bbda91d7765d7159fc3f0f563083 | Python | 4,072 | 130 | # coding=utf-8
# Copyright 2023 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... |
791bd8d9958616577d8e06ee2eafa7acbc00e4cccb851cf6a9bf3666e1a5850d | Python | 4,072 | 121 | #!/usr/bin/env python3
import argparse
import numpy as np
import sygma
from rdkit import Chem
from rdkit.Chem.rdmolfiles import SDMolSupplier
def mol_supplier(filename, ext):
"""
Based on the file extension, use the appropriate RDKit function to
load a chemical data file (SMILES or SDF) containing multi... |
fece5a95075613f5e868850c821bcf05e9cb80d42bc1f508c477ed4188be495d | Python | 4,072 | 118 | #%%
import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualBlock1D(nn.Module):
def __init__(self, planes, downsample=True):
super(ResidualBlock1D, self).__init__()
self.c1 = nn.Conv1d(planes, planes, kernel_size=1, stride=1, bias=False)
self.b1 = nn.BatchNorm1d... |
c8b31ebaf75caef7d0b60cb693f6c5020416bf51a770f16e2e86d6a44b37c3da | Python | 4,073 | 97 | import matplotlib
import numpy as np
from munkres import Munkres
from sklearn import metrics
from sklearn.manifold import TSNE
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# Tmp
# Ref: https://github.com/MysteryVaibhav/RWR-GAE
class clustering_metrics:
def __init__(self, true_label, predict_label):
... |
dc4a7547ddf6667000b55b92d23f7d1b5d894bb8655bd164447f8e16961675ad | Python | 4,073 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
f18b5628b1e31b74f19b652ba689fc0dbaaa605315f59c41d975ae7c52d87523 | Python | 4,073 | 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 = "scattercarpet.selected"
... |
0bdea3ce7cabf14f92baf064526a7a5921b5b0c61ac371f2904d3220a08fac3e | Python | 4,074 | 101 | import sys
import argparse
def read_set(read_fn):
f = open(read_fn,'r')
causal_set = set()
for line in f:
line = line.strip()
causal_set.add(line)
return causal_set
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='This program takes in the output set of MCav... |
63878bc300b7b43f50268af3472ca3669530a35c9e177e471a4b5c2811f04243 | Python | 4,077 | 117 | from sklearn.metrics import mean_absolute_error
from numpy import random
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import plot_tree
from sklearn.ensemble import RandomForestClassifier
from sklearn.inspection import plot_partial_dependenc... |
631a241fcf8f3af99babe0011d3774fe31aeb9f811b0e9a0350c7e3c77a73a4f | Python | 4,078 | 140 | """Pins for the saved-for-backward draw annotation (opt-in, DOCUMENTED-UNSTABLE).
The row makes autograd's retained-tensor memory visible per node from the
capture-time ``num_autograd_tensors`` / ``autograd_memory`` measurements.
HONESTY CONTRACT: the row appears ONLY where retention was measured positive;
an absent r... |
939d88850dca1dd6856097aa233abb7ac5888d9d0921b2062ce6baf9000afa85 | Python | 4,078 | 110 | #!/usr/bin/env python
# fix problems with pythons terrible import system
import sys
import os
file_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(file_dir, '../'))
import prob2020.python.utils as utils
import prob2020.python.indel as indel
import pandas as pd
import argparse
def count... |
c6a7c76b8f571984dbc59e1d28965436ff73859e32d970280b66bcdca550b4c3 | Python | 4,078 | 121 | """Base VAE class definition
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.utils import get_mean, kl_divergence
from src.vis import embed_umap, tensors_to_df
class VAE(nn.Module):
def __init__(self, prior_dist, likelihood_dist, post_dist, enc, dec, params):
super(VAE, s... |
e7acdaa48f2f537a136a136468063655dd8d54e89b0a0f275a7ee0ac1b0de0ab | Python | 4,078 | 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 = "scatterpolargl.selected"... |
fb2e4a1ca5a222f2a8c8d978545e90d0a72ea81ea930370de5012037f02ff09f | Python | 4,078 | 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 = "scatterternary.selected"... |
29c025e624aac4e0e4093dfc44a49f31366332078597e8e44e83aadd1d1f63a1 | Python | 4,079 | 111 | import logging
from galaxy import exceptions
from galaxy.files.models import FilesSourceRuntimeContext
from galaxy.files.sources._fsspec import (
CacheOptionsDictType,
FsspecBaseFileSourceConfiguration,
FsspecBaseFileSourceTemplateConfiguration,
FsspecFilesSource,
)
from galaxy.files.templates.models i... |
90d89d55c0692011addeaa64c660116c6f9e48c1aa4f819e6dd0d23e0beb8d10 | Python | 4,080 | 69 | """2. Fine-tuning SOTA video models on your own dataset
=======================================================
Fine-tuning is an important way to obtain good video models on your own data when you don't have large annotated dataset or don't have the
computing resources to train a model from scratch for your use case.... |
de5fcb8d0434117dc79711acc57a14c4c700177d47190cb4663b819657e0a92a | Python | 4,081 | 110 | import argparse
import os
from tqdm import tqdm
import pandas as pd
import numpy as np
import arviz as az
EXCLUDES = ['lambda_det', 'k_det']
def overlap_index(trace1, trace2):
cmin = np.min([trace1, trace2]) - 0.1
cmax = np.max([trace1, trace2]) + 0.1
grid1, pdf1 = az.kde(trace1, custom_lims=(cmin, cmax))... |
ee203d5675cd3af59c31f0d20a68409b5ed197066f1cdad65ff8dfabd1ac47b9 | Python | 4,082 | 129 | '''Caffe module.'''
import os
import PIL
import numpy as np
from bdpy.dataform import save_array
from tqdm import tqdm
def extract_image_features(image_file, net, layers=[], crop_center=False, image_preproc=[], save_dir=None, verbose=False, progbar=False, return_features=True):
'''
Extract DNN features of ... |
231da6430870e45b68d88e47e1dca26c6f265880cd83768d4d96333b85edc7d2 | Python | 4,083 | 81 | 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')
colors = [sns.color_palette('Set1')[0], sns.color_palette('Set1')[1], sns.color_palette('Set1')[2], sns.c... |
98b5297c1f0a64b81e4c2767cfbb5fe39f670918a71fc1a0ca8841def8da1186 | Python | 4,084 | 112 | """Behavioral tests for layer 3 of the never-ship-a-major defense.
``scripts/no_major_parser.py`` is the ONLY major-bump layer that sees a
squash-merge title/body composed in the GitHub UI (layers 1/2 are local
hooks), and until grind r5 it had ZERO tests anywhere (b10 R86-2): it
depends on three PSR-9.x private-ish A... |
df10c6e2c742fbf796dd92a6b7750ed9e4bde50fb73b69cbdd202446cac6e210 | Python | 4,084 | 149 | ###############################################################################
"""This parser takes as input the text files canonical_dataset.txt and
canonical_sequence.txt, and produces a .h5 file datafile_{}_{}.h5,
which will be later processed to create dataset_{}_{}.h5. The file
dataset_{}_{}.h5 will have datapoin... |
24185a2204422bcc619a498eae238999abe0a8112e7af466ece8c8ef0a3b7033 | Python | 4,086 | 121 | import unittest
import numpy as np
import deepchem
from deepchem.data import NumpyDataset
from deepchem.models import GraphConvTensorGraph
from deepchem.models import TensorGraph
from deepchem.molnet.load_function.delaney_datasets import load_delaney
from deepchem.models.tensorgraph.layers import ReduceSum, L2Loss
fr... |
30490632724a7354dc8a917fd392e3cb783c6173c77275cc5e8ab6ecbf3b7333 | Python | 4,086 | 119 | import nfp
import numpy as np
import pytest
from nfp.frameworks import tf
from numpy.testing import assert_allclose
layers = tf.keras.layers
# def test_slice():
# connectivity = layers.Input(shape=[None, 2], dtype=tf.int64, name='connectivity')
#
# out0 = nfp.Slice(np.s_[:, :, 0])(connectivity)
# out1 = n... |
8c86583cff1ff275f93cdf7c8d821e080788b9317564cc7f6dcd48a0d0e431cb | Python | 4,086 | 96 | from ovseg.model.SegmentationModelV2 import SegmentationModelV2
from ovseg.model.SegmentationEnsembleV2 import SegmentationEnsembleV2
from ovseg.model.model_parameters_segmentation import get_model_params_3d_UNet
# name of your raw dataset
data_name = 'MY_DATASET_NAME'
# same name as in the preprocessing script
prepro... |
9606babcdb9c30dacb9c72e7a37451c1568d49741102326dd332b64ac7d00eaf | Python | 4,086 | 126 | import tensorflow as tf
import numpy as np
from layers.__init__ import Convolutional
from pdb import set_trace
import sys
from scipy import signal
from scipy import linalg
COMPARE_TF_AND_NP = False
TWO_DIM_TEST = True
ONE_DIM_TEST = False
STACKOVERFLOW_EXAMPLE = False
if COMPARE_TF_AND_NP:
# Results are not exac... |
3a5e4253b83b18d680fb4545fa3b377a95f88ad25bdff8c699015d62a888ce88 | Python | 4,087 | 97 | from tensorflow.python.keras.layers.core import Dropout
from .metrics import load_metrics
from focal_loss import BinaryFocalLoss
from tensorflow.keras.layers import Conv3D, MaxPooling3D, UpSampling3D, Activation, BatchNormalization, concatenate
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import M... |
3db2b0fa70d50d153f7e3ca54739e7b773c4c5fc877986a9e08432c033b9dabb | Python | 4,087 | 113 | #!/usr/bin/env python3
import sys, os
import msprime
import pyslim
import tskit
import numpy as np
helpMsg = '''
usage: $./swp_blnk_init.py <`n` or `s`> <sc_min> <sc_max> <Ne_bottleneck> <out_pref>
'''
scale = 1
sim_len = 1e5 # can be shortened for surveys
rho = 1e-7
Ne = 10000
def log_log_lin(sc_vec, k, b)... |
45d240f561e5be9d168282bfd69f1c40499e4bb32d5de8d8684cfa78f422a105 | Python | 4,087 | 133 | import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torch.autograd import Variable
from torch.nn import Linear, ReLU, CrossEntropyLoss, Sequential, Conv... |
cd01d0529f39424f69c5f2320aea039802ef6b31ebd3ed32b96fc3a59ee0b886 | Python | 4,087 | 143 | """Progressive Neural Network with lateral transfer columns.
Rusu et al. (2016), "Progressive Neural Networks." Progressive nets add a new
task-specific column for each task while freezing earlier columns and feeding
their hidden activations through learned lateral connections into the new
column. This compact recon... |
7ee4aac4ad92037f52664e31e7d2be16d6f89eefe4140afd527a4ff0e2860341 | Python | 4,088 | 108 | from unittest.mock import Mock, patch
import pytest
# this import adds a @shared_task, which uses connect_on_app_finalize
# to install the celery.ping task that the test lib uses
import celery.contrib.testing.tasks # noqa
from celery import Celery
from celery.contrib.testing.app import TestApp, setup_default_app
fro... |
871de7184414ffa034b35ef368aa136f859cb483c3adfeb27b77b3f36abc2cfc | Python | 4,088 | 115 | #!/usr/bin/env python
import argparse
import json
from cp_common_functions import (get_json_value,
get_pipeline_lines,
get_total_number_of_modules,
INDENTATION, update_module_count,
... |
fc2a0f7b99dd9947eafdad4678841297b8a133e49653a60ee2555cae1b8e4be0 | Python | 4,088 | 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... |
377d44367d1bff8e9d98bf42f03b7d5dac50dfee0a0ee4ec586e67e34b371554 | Python | 4,089 | 116 | import numpy as np
from tqdm.auto import tqdm
from seqexplainer import attribute
from .._settings import settings
from seqdata import get_torch_dataloader
import xarray as xr
import torch.nn as nn
from typing import Union, Optional, List, Dict, Any, Literal
def attribute_sdata(
model: nn.Module,
sdata: xr.Dat... |
f066dd578d0f2b0d9ae5674812641f36d084538f0e78811920c7b1e40ea048bb | Python | 4,089 | 110 | """Checks kit item 9: range/liveness over the PUBLIC phase seam (memo D14).
The in-tree range check is implemented 100% over the public
``capture.hooks`` seam, and this file IS the seam's CI conformance test:
the probes add ZERO ops to a trace (BatchNorm model included -- the
seam-pollution tripwire), collect honest f... |
1f1b5b023298dffaac3407e88da77dc94bb821ccf6dc935c90b40e21dd44415a | Python | 4,090 | 106 | # SOURCE: vendored from kexinhuang12345/DeepPurpose @ master
# (DeepPurpose/encoders.py, class CNN)
#
# DeepPurpose CNN drug/protein encoder: a stack of 1D convolutions over a one-hot
# SMILES/amino-acid encoding, followed by adaptive max-pool and a linear projection to a
# fixed-size embedding (the DeepDTA-style encod... |
b24d5a7a5f3d1516ee655c47ecbb462f43d458b01f78568d36924756dff4c90e | Python | 4,090 | 132 | """Database models used by the SQLAlchemy result store backend."""
from datetime import datetime, timezone
import sqlalchemy as sa
from celery import states
from .session import ResultModelBase
__all__ = ('Task', 'TaskExtended', 'TaskSet')
DialectSpecificInteger = sa.Integer().with_variant(sa.BigInteger, 'mssql')... |
14b46587e1eb90aefea012fabaf7f07005a2ba7ee9ee1d57cd5b43ab4dbe8d5a | Python | 4,092 | 117 | import math
import sys
import time
import torch
import torchvision.models.detection.mask_rcnn
from modelTraining.utils import *
from modelTraining.coco_eval import *
from modelTraining.coco_utils import *
def train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq, scaler=None):
model.train()
... |
726ad6b2a2703639d94870da47bc8d0d43e3ef4a1dd7b177f22ea9459fb6e044 | Python | 4,092 | 74 | import sys
sys.path.append('./utils')
sys.path.append('./graphs')
sys.path.append('./dataset')
import pandas as pd
import argparse
# import featurizer
import build_dataset
import graphalgos
import splitters
import runtrain
import torch
import optimizer
from torch.utils.data import DataLoader
device = torch.device('cuda... |
4660bafb439f3369834a2f3274ce48a8815fa57c06ed7cf46b925cf9fd2a0684 | Python | 4,093 | 126 | # This example requires the following dependencies to be installed:
# pip install lightly[timm]
import copy
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
from tqdm import tqdm
from lightly.data import IJEPAMaskCollator
from lightly.models import utils
from lightly.models.m... |
8d893e5d6a7929e4c273df436d42dfb4b30f87459b81fc2f461a08abf398a58b | Python | 4,093 | 135 | __author__ = "quentin"
from collections import deque
from ethoscope.core.variables import IsInferredVariable
from ethoscope.utils.description import DescribedObject
class NoPositionError(Exception):
"""
Used to abort tracking. When it is raised within the ``_find_position`` method, data is inferred from pre... |
6cb134c342d468c6816bc6d2abf1f08cd786f4b0d5a620f6929ece9dec047deb | Python | 4,094 | 124 | import numpy as np
from PIL import Image
import torch
from .utils import images as imageutils
class ClipToTensor(object):
"""Convert a list of m (H x W x C) numpy.ndarrays in the range [0, 255]
to a torch.FloatTensor of shape (C x m x H x W) in the range [0, 1.0]
"""
def __init__(self, channel_nb=3... |
918dd4803bb38a52e32a0f0ed395395846f84bd788e32dfd940515e4fff69d47 | Python | 4,095 | 127 | from __future__ import annotations
import argparse
from .count import generate_bootstrap_count_curves
from .count import generate_count_curve
from .froc import generate_bootstrap_froc_curves
from .froc import generate_froc_curve
from .utils import bounds
from .utils import test_point
def run():
parser = argpars... |
7fc47a2ebe04ee264df599e63df5da07f3a611c644668c5b8e9ea31091ee29a2 | Python | 4,096 | 134 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from sqlalchemy.orm import scoped_session
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Serializer,
)
log = logging.getLogger(__name__)
# needed to extract this for use in manage... |
fd836e45b6ae5fd7e0d797c5ec80922b8fafa01fcf7363bbe990aadc7d57681a | Python | 4,097 | 106 | """R35: device/layout-aware host transport replaces detach().cpu().contiguous().
Converged disputed-r2 acceptance battery (b5 #2): (a) an already-contiguous CPU
tensor still no-ops (zero-copy alias of the same storage), (b) sol's CPU
strided-view counterexample still yields a CONTIGUOUS result — the naive
``.to("cpu",... |
3fb35c03f3e4f3bd9e486fe4457068106f0132cc559696876388a27d5a29508d | Python | 4,100 | 120 | import dataclasses
import importlib.util
from pathlib import Path
import pytest
from carbonserver.api import schemas as server_schemas
def load_client_schemas():
repo_root = Path(__file__).resolve().parents[3]
client_schema_path = repo_root / "codecarbon" / "core" / "schemas.py"
spec = importlib.util.sp... |
011eca1956ba592319e75d75b7164ed4c5115b563541d20f0070bcfd2cf989c4 | Python | 4,101 | 96 | import inspect
import sys
import typing
import pytest
from pydantic import BaseModel
from celery.utils.annotations import annotation_issubclass, get_optional_arg, is_none_type
@pytest.mark.parametrize(
'value,expected',
((3, False), ('x', False), (int, False), (type(None), True)),
)
def test_is_none_type(va... |
39b738e91cb039d734077e51b34ece47009f6a733e15eb7066cab3e4ca59a1d2 | Python | 4,101 | 78 | import os
import dicom2nifti
# unzip first
import tarfile
# importing the zipfile module
from zipfile import ZipFile
# open file
input_path = "/mnt/kannlab_rfa/Anna/PING/Package_1207895/image03/t1/"
extracted_path ='/mnt/kannlab_rfa/Anna/PING/Package_1207895/image03/extracted_t1/'
path_to_save_nii = '/mnt/kannlab_rf... |
a7ec7565c3316f2486aed610deca7e5bf9c9ac92b36b2e65980744be11c07fdf | Python | 4,102 | 126 | import numpy as np
import pytest
from gym.spaces import Box, Discrete
from gym.wrappers import AtariPreprocessing, StepAPICompatibility
from tests.testing_env import GenericTestEnv, old_step_fn
class AleTesting:
"""A testing implementation for the ALE object in atari games."""
grayscale_obs_space = Box(low=... |
8b330f21365dfee39956c6863c11375700fac8a1ce33d06d63a02df54692f56d | Python | 4,103 | 115 | """Reusable, Panel-free functions for looking up and loading/saving
`LarvaworldParam` configurations: the registry lookup used throughout the
Parameter Database UI, and the file/bytes/workspace round-trip built on
`LarvaworldParam.to_config()`/`from_config()`/`save_config()`.
"""
from __future__ import annotations
im... |
c86b4bacc5830235262dbe259595ae9dabbf3b0af1617052298cb310252eae7f | Python | 4,103 | 99 | # 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... |
ff3d16035717062d20cda3fd19fc9a16b25031788fdf1d1a3fe230d3e0e0f2f9 | Python | 4,103 | 106 | # requires: mayavi
# dataset: mne_sample
'''
Example performes a permutation cluster test on source space data and creates
an HTML file describing he output.
'''
import eelbrain as e
# settings
n_samples = 1000
# create an HTML report in which to document results
report = e.Report("MNE Sample Dataset", author="Prof... |
522606faceab21915193da13ad955f622b5b42a7882959212c41fdd210f19494 | Python | 4,104 | 99 | """A.1 (часть 2): сколько решений на агента нужно для устойчивой оценки MI.
Записываем упорядоченные по времени решения (дециль энергии; действие) для
долгоживущих агентов и считаем внутриагентную MI по ПЕРВЫМ N решениям при
N = 100, 200, 400, 800. Ищем минимальное N, при котором оценка перестаёт
зависеть от N — это в... |
2e697ae45cad17cc3f299255fb4155b9e6938df591751d3b448c6ce6729612c4 | Python | 4,105 | 114 | """Test cases for mot.py."""
import os
import unittest
import numpy as np
from scalabel.common.typing import NDArrayI32, NDArrayU8
from bdd100k.common.utils import list_files
from bdd100k.eval.seg import evaluate_segmentation, fast_hist, per_image_hist
class TestFastHist(unittest.TestCase):
"""Test cases for th... |
31474017fa72dd0b3f08c042fc5ed9f4dc87c90d554ac397cf148e87e8430070 | Python | 4,105 | 120 | import sys
sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils')
import re
import pysam
import argparse as ap
import pandas as pd
import numpy as np
from utils import *
#import multiprocessing as mp
#from functools import partial
def main(args):
argp = ap.ArgumentParser(descriptio... |
785dc2cc346e9d12675bdc2144e93aea78e1780fc11fdaf259eab866f7a856fb | Python | 4,105 | 111 | """
===============================================
Comparison of embeddings of covariance matrices
===============================================
Comparison of several embeddings of a set of ERP covariance matrices extracted
on MEG data: SE, LLE and t-SNE
Spectral Embedding (SE) is based on computing the low-dimens... |
3b029c77a1bd0cf91b46efafbc86a1ec5f94421996713a05c3c993f8ea4c693e | Python | 4,106 | 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 Line(_BaseTraceHierarchyType):
_parent_path_str = "parcoords.unselected"
... |
53b2d4abbd890f0c5afeb5bdfd8f919ec87074d5132510eaeefe09b9e2dfa57f | Python | 4,106 | 113 | #!/usr/bin/python
import sys
import timeit
import re
import pandas as pd
import numpy as np
import json
import tabix
##### Return index of a1 which exists in a2 #####
def ArrayIn(a1, a2):
# results = [i for i, x in enumerate(a1) if x in a2]
results = np.where(np.in1d(a1, a2))[0]
return results
def ArrayNotIn(a1, a... |
62e5fb187380826844d0b95aca3102bb6888294f6bced1be743d4c5bba1070ca | Python | 4,106 | 127 | from __future__ import annotations
import argparse
from coco_froc_analysis.count import generate_bootstrap_count_curves
from coco_froc_analysis.count import generate_count_curve
from coco_froc_analysis.froc import generate_bootstrap_froc_curves
from coco_froc_analysis.froc import generate_froc_curve
from coco_froc_an... |
d45a309e9d74f568a841c330765f5f8adecbab14b72670f07b6c287e769714ec | Python | 4,106 | 116 | import numpy as np
from neurogym.core import TrialEnv
from neurogym.utils import spaces
from neurogym.utils.logging import logger
# TODO: Need better description
class DawTwoStep(TrialEnv):
"""Daw Two-step task.
On each trial, an initial choice between two options lead
to either of two, second-stage sta... |
ef898b4d5273aaef46f39460f527373c6f0eadd301860becdf58ff712f34d42d | Python | 4,106 | 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 Spaceframe(_BaseTraceHierarchyType):
_parent_path_str = "isosurface"
_pat... |
6b3e88ae59f817c037ceb3ae635f9757b072a5dab0c121d71c973e0c00c1beb8 | Python | 4,108 | 135 | #!/usr/bin/env python
"""
Input: File with a single molecule or SMILES string
Output: Similar molecules.
"""
import argparse
import sys
import cheminfolib
import psycopg2.extras
import pybel
cheminfolib.pybel_stop_logging()
def parse_command_line(argv):
parser = argparse.ArgumentParser()
parser.add_argumen... |
9bc028962ea2edc51a45059fda2ece48b615638a74920c7648aab523d9550a53 | Python | 4,108 | 124 | import torch
import unittest
from typing import Iterator
import torch.nn as nn
from functools import partial
from bdpy.recon.torch.modules import latent as latent_module
class DummyLatent(latent_module.BaseLatent):
def __init__(self):
self.latent = nn.Parameter(torch.tensor([0.0, 1.0, 2.0]))
def rese... |
c8c3308d7ac0c460ad2563f08d7a26a83917f55c74c74309e97be502946aca44 | Python | 4,109 | 130 | import numpy as np
import matplotlib.pyplot as plt
from modular_splicing.eclip.trained_on_eclip.train import models_trained_on_eclip
from modular_splicing.fit_rbns.load_rbns_neural import load_rbns_models_for_evaluation
from modular_splicing.mrs.analysis import paper_figure_analysis
from modular_splicing.utils.plots.p... |
2135c7e71d1dbeda88dc2d2eee46a297027f22ca6501fed3c9fbda4b92f54a4d | Python | 4,110 | 126 | import numpy as np
from mirp._image_processing.utilities import standard_image_process_checks
from mirp._images.generic_image import GenericImage
from mirp._images.mask_image import MaskImage
from mirp._masks.base_mask import BaseMask
def crop(
image: GenericImage,
masks: BaseMask | MaskImage | list[... |
2dd5d93eb4ed31e6150816bf096f537cfd972c0af3136bbf2feae08e13d8fff0 | Python | 4,110 | 187 | # Generated by scripts/markdown_directives_doc.py from
# client/src/components/Markdown/directives.yml. Do not edit by hand.
# Regenerate with `make client-gen-markdown-directives`.
class DynamicArguments:
pass
DYNAMIC_ARGUMENTS = DynamicArguments()
SHARED_ARGUMENTS: list[str] = [
"collapse",
]
CELL_TYPES: ... |
9ab39976ca393709bdb4729ab94d9f9e693f201a28b92f604efa15110e7b9466 | Python | 4,111 | 137 | import re
import numpy as np
import pytest
from gym.spaces import Discrete, Graph, GraphInstance
def test_node_space_sample():
space = Graph(node_space=Discrete(3), edge_space=None)
space.seed(0)
sample = space.sample(
mask=(tuple(np.array([0, 1, 0], dtype=np.int8) for _ in range(5)), None),
... |
488a24e49b0b94c2312f7d947d1a540be73e04e129054ab43b81977d779f0b51 | Python | 4,112 | 120 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import d... |
e483fc722fb3e6c32eb69549dc792cb6210b4bd6ff7a0e195419a262017fb1d5 | Python | 4,112 | 103 | #!/usr/bin/env python3
'''
This script exists to generate the unique ligand sdf files in a given pocket, by grabbing all of the existing docked poses
and then calculating which of them are less than a certain RMSD threshold between one another.
Assumptions:
i) The crystal ligand files are named <PDBid>_<ligand name><... |
87db38375602e108da40aad6aa33bf89794b0c772b38802220e1e8905d9f0e75 | Python | 4,113 | 143 | """
====================================================================
One-way Manova
====================================================================
One-way Manova to compare Left vs Right.
"""
from time import time
from matplotlib import pyplot as plt
from mne import Epochs, pick_types, events_from_annotati... |
9028d9e36020d3ce92f3c89abc6bacceecff3dedc573ae5845502ad66ec2dccb | Python | 4,113 | 130 | """Rolled/unrolled collapsed-box honesty for surfaced exit ops (V4/V5).
A collapsed module box must never count a layer that is ALSO drawn as a
separate visible node beside it, and a rolled multi-call box must disclose
when its call sites output different shapes instead of asserting the first
call's shape for all of t... |
96803b7ca43f472ebb455ded65529fd1c9969c36cfd2bd32810d84e22cff4e9e | Python | 4,113 | 121 | """Microbenchmarks for ``seqpro.tokenize`` (pytest-codspeed).
Collected by the normal test suite (runs each body once, ~free) and timed under
``pytest --codspeed`` (see the ``bench`` pixi task / bench.yaml CI workflow).
"""
from __future__ import annotations
import numpy as np
import pytest
import seqpro as sp
from ... |
3589685e64a5cbac38886341c0b36b93bb506cb47332ca0cce58635b353a5467 | Python | 4,114 | 123 | """mx.compile / traced-transform honesty for the technical-preview MLX backend.
A compiled callable replays a traced graph, so wrapped eager functions never
fire inside it: before detection existed a compiled entry silently
under-captured. The entry now refuses typed, and a compiled attribute on the
model ceilings the... |
4911a810db3ac3ea3906b0f14e0a5753de13551fa4b4b82cb8fca8156c9f826a | Python | 4,114 | 93 | """tlspec v9 cross-version compatibility proofs (C07 coordinated schema write).
Barrier-S gate rows: the schema field-name diff between the v8 and v9
contracts of record is pinned EXACTLY (reviewable KEEP-policy diff, zero
removals), the harvested v8 golden still loads at its recorded schema under
the v9 runtime, and ... |
8841519446e2e4ecdb71628140589c4fe35f4d8045094b2802194d39370129e6 | Python | 4,114 | 99 | import torch
import numpy as np
import os
from inference.density import *
from src.MODEL import *
class PES(torch.nn.Module):
def __init__(self,nlinked=1):
super(PES, self).__init__()
#========================set the global variable for using the exec=================
global nblock, nl, dro... |
9211c2f8510b5791a7d5a91886693eff4d8942472f396a9929abf30d294ba9d0 | Python | 4,114 | 128 | import random
from ..utils.data import read_batch, rewrite_batch
from .datasets import ImageDataset
def run_cutmix_on_tensors(t1, t2, edge: str = None, amount: float = None, clone: bool = True):
"""
Performs CutMix augmentation with given two tensors. Idea from www.doi.org/10.1109/ICCV.2019.00612
:param... |
455d359925c5e58bec4c59aab134a648de399a7a11b2abcc7fb61980dd3a12bf | Python | 4,117 | 127 | """
Accessible models can be read and copied but not modified or deleted.
Owned models can be modified and deleted.
"""
import abc
from typing import (
Any,
Generic,
TypeVar,
)
from galaxy import (
exceptions,
model,
)
U = TypeVar("U", bound=model._HasTable)
class AccessibleManagerMixin(Generi... |
b29d02bfd64aaa389195259e9bd52938f63a445a933b090a66a1d43a93940437 | Python | 4,117 | 100 | """Regression test for the R0_TRANSFORMERS_RUNTIME collection gate.
L8 floor fix: ``tests/real_model/r0/conftest.py``'s ``pytest_collection_modifyitems``
originally matched items only by PATH (``str(item.path).startswith(this_dir)``), so a
sibling file elsewhere in ``tests/`` that imports ``tests.real_model.r0.familie... |
e1ac59e66ce5d74d0b0f0139bd212180f33f1bfa2eb82321765fb742eb428c96 | Python | 4,117 | 132 | import json
import numpy as np
import torch
import os
from modular_splicing.dataset.generic_dataset import dataset_types
from modular_splicing.models.entire_model.entire_model_types import entire_model_types
from .arguments import get_args
from modular_splicing.train.standard_train import train_model
from shelved.si... |
3e85e164cad586854d3ce3d149da9ffd01f3e17082643dedbbe9d5fb64c82735 | Python | 4,119 | 136 | """
Plot distribution of coherences for up (top row) and down choices (bottom row)
averaged across the low and high single-trial bias bins before (left column)
and after subsampling (right column) to yield an equal number of up and down
choices within each single-trial bias bin
"""
import matplotlib.pyplot as plt
impor... |
5093cd5346daa9dc200fb018a9947c5612567b1b7095b27e90785d09e521cafb | Python | 4,120 | 135 | doc_spatial_base_plot = """\
adata
Annotated data matrix.
title
Title name of the figure.
figsize
Figure size with the format (width,height).
cmap
Color map to use for continous variables or discretes variables (e.g. viridis, Set1,...).
use_label
Key for the label use in `adata.obs` (e.g. `leiden`, ... |
3a54369e92ddebe87ef7cbde07304da2f9e18ad3e228f28a0a7c71648ea03608 | Python | 4,121 | 119 | # --- 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 Increasing(_BaseTraceHierarchyType):
_parent_path_str = "candlestick"
_pa... |
74c8f3feb2a6dfb6d19dd5c5f8ed12948a74784f976f5c76ee084aff3a811c2f | Python | 4,121 | 119 | # --- 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 Decreasing(_BaseTraceHierarchyType):
_parent_path_str = "candlestick"
_pa... |
2a975d9e9aba5037e9c01a89dd6c3095ae2d234b4fbb0b0e48ffcfc7a4b3d27a | Python | 4,123 | 119 | #### --- jPCA ------------------------------
#### See Churchland, Cunningham, Kaufman, Foster, Nuyujukian, Ryu, Shenoy.
#### Neural population dynamics during reaching Nature. 2012 Jul 5;487(7405):51-6.
#### doi: 10.1038/nature11129
import numpy as np
from numpy import array, zeros, ndim
from numpy.linalg import ei... |
4230e8fbdb106c88e18961cb9551f525eb6418d0cf7757ce0d7b8ebafd0f92bd | Python | 4,123 | 94 | import pandas as pd
import numpy as np
from skmob import TrajDataFrame
from skmob.utils import constants
from skmob.preprocessing import detection
class TestDetection:
def setup_method(self):
latitude = constants.LATITUDE
longitude = constants.LONGITUDE
date_time = constants.DATETIME
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.