sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9f773732b19d7ca08de9e00d02f839a27b4893e91b93d0711c5837b405e83057 | Python | 3,474 | 105 | #==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... |
94fef7b694e0fb2c2a6e68fd8901931059e5ede2a6b8c9fc22b940895671087b | Python | 3,475 | 93 | from typing import Tuple
import torch
import torch.fft
from torch import Tensor
class GaussianMixtureMask:
"""Applies a Gaussian Mixture Mask in the Fourier domain to an image.
The mask is created using random Gaussian kernels, which are applied in
the frequency domain.
Attributes:
num_gaus... |
85c3afd729a312d5fa5d77056db51088ee971353dcbce31b066d57c15afd3524 | Python | 3,476 | 78 | #!/usr/bin/env python
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
4a19577d9adccfba21cf9ee1577febb7d0ff7c1c5649237d22f51eb95f11fd71 | Python | 3,477 | 97 | """Shared helpers for the Model Explorer contract harness tests (F15).
Runs the pinned real ``dist/worker.js`` graph processor under Node and
returns its per-graph stats. The worker is the panel's stand-in for the
browser: three of the four data-loss bugs the design round found are
invisible to a dataclass parse and v... |
65693aa1c5ae102ef99aaa5630016c2082618acdc4244a03d34d3d74ff35656c | Python | 3,477 | 108 | import torch.utils.data as data
from PIL import Image
import os
import os.path
def has_file_allowed_extension(filename, extensions):
"""Checks if a file is an allowed extension.
Args:
filename (string): path to a file
Returns:
bool: True if the filename ends with a known image extensio... |
ee165c5f01042c5ff99d274651e0fc5fc085ca37e7fd0027ae5a5ffd57ed1335 | Python | 3,479 | 110 | # --- 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 = "histogram.selected"
... |
fbf9992dc735d378e12f0f70478af6998a9c217eea90e1d5e49586313933419a | Python | 3,479 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "cone"
_path_s... |
32fabef723731e5c339583a6f8ecf286bd0625c899d47af8bc2a847fb2e820fe | Python | 3,480 | 82 | import torch
from functools import partial
from src.audio import create_transform
from torch.utils.data import DataLoader
def create_dataset(name, path, batch_size, audio_max_frames,
train_split, dev_split, test_split=None):
''' Interface for creating dataset '''
# Import dataset & collect... |
81f06d74d837beaee0581fd058f4ec8bd91252b17b1194edfc869c841fe17c76 | Python | 3,480 | 106 | import numbers
import importlib.resources
from afmformats import meta
from nanite import model
import numpy as np
from PyQt6 import uic, QtWidgets
from .. import units
class TabInfo(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super(TabInfo, self).__init__(*args, **kwargs)
ref = impo... |
9654f80dbde9c1e89602675797f525998a1b2971137d4d71c6cd234f4daf3d94 | Python | 3,481 | 104 | import pandas as pd
import numpy as np
import scipy
from pylab import *
import os
import pysam
from collections import Counter, OrderedDict
from itertools import izip, imap
import scipy.stats
import gzip
import json
import seaborn as sb
import sys
import operator
fsize=14
exon_tagged_file=sys.argv[1]
gene_tagged_file... |
09c6fd3bf7eb52105e735e33aedaf7ce40acfa6afe2f1d3b24d34e5c7e9b01bf | Python | 3,482 | 128 | # --- 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 = "scatter3d.projection"
_pa... |
165c5e38f32a9908f2b8e247f6ddb8e755da5504f614fee0d0394c0065704ec3 | Python | 3,482 | 87 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
5e0a8373ed36d2e07980ca59d276656d02d3a4517b5d68ac27463b6692530226 | Python | 3,482 | 77 | import torch
import numpy as np
class Trainer():
def __init__(self, args, optimizer, lr_scheduler, loss_fn, evaluator, result_tracker, summary_writer, device, model_name, label_mean=None, label_std=None, ddp=False, local_rank=0):
self.args = args
self.model_name = model_name
self.optimizer =... |
7c92bcce49748d65eb2004ddd91c083284203d15ebcfb2bdd554d48b618944c7 | Python | 3,482 | 86 | from typing import Optional, Union, Iterable, Dict
import numpy as np
from anndata import AnnData
from scipy.sparse import issparse
from sklearn.utils import sparsefuncs
from stlearn._compat import Literal
import scanpy
def normalize_total(
adata: AnnData,
target_sum: Optional[float] = None,
exclude_high... |
9352594f474bd84dfb0214a4796c88f247bf4f36eaaa3c35fb074ad6255187e7 | Python | 3,482 | 128 | # --- 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 = "scatter3d.projection"
_pa... |
9a061a7e9c82dc3c8b3c9b1bf8cd7c4f22c7bd3d386449daecb1902f7857a5ff | Python | 3,482 | 128 | # --- 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 = "scatter3d.projection"
_pa... |
a9403a71ff718d22e54121726dcae50901696018af1313a9e847b2a8289b7259 | Python | 3,482 | 129 | """Tests for specparam.data.data."""
from specparam.data import SpectrumMetaData, ModelChecks
from specparam.tests.tutils import plot_test
from specparam.data.data import *
###################################################################################################
###########################################... |
d6839b57498b678a0182440768ee87216fcd6f9804e2d39129c710cb947c6433 | Python | 3,483 | 102 | # 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_l... |
04b95052c24eeeb480241a37e11295ad19621d978eaba59c09781e2042a95d9b | Python | 3,485 | 102 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
from . import general as utils
from . import BaseFunctions
class PseudoLoader(object):
def __init__(self, data, setup_config):
self.registrations = BaseFunctions.Data(data, None)
self.mice ... |
312fbef12c126da720a2bdd80f379457f168893c8039ce106d4f9a9a54cb0e61 | Python | 3,485 | 63 | import glob
import os
import sys
import argparse
import numpy as np
import pandas
from mp_dip.utils.cortical_distance import calculate_cortical_distance
from mp_dip.utils.utils import get_mp_book_paths
def main():
# np.set_printoptions(precision=3)
np.set_printoptions(suppress=True)
np.set_printoptions(... |
6cf763a9293444d1c29c2b54df68e0d03290f0aadafb7f553ac60397e682acc8 | Python | 3,485 | 129 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 29 10:25:54 2018
@author: nfcontrol
"""
# import statements - all of these are packages within the rt environment
import time
from random import random as rand
import sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
im... |
7313233c29c496272b88c54e016a785d73cfbf1e2422c1cd6ff8bf166318a212 | Python | 3,486 | 110 | import os
import numpy as np
import nibabel as nib
from scipy.io import loadmat
from os.path import join as pjoin
from magicbox.io.io import CiftiReader, save2cifti
from cxy_visual_dev.lib.predefine import mmp_map_file,\
cole_label2name, cole_net_assignment_file
proj_dir = '/nfs/s2/userhome/chenxiayu/workingdir/st... |
83065bb79bce287bfabd966b421979f46ebf2e4faf73f502802024f6db81553d | Python | 3,487 | 119 | import numpy as np
from scipy.stats import norm
from scipy.stats import beta
from matplotlib import mlab
# d-prime
def dprime(confusion_matrix):
"""
Function takes in a 2x2 confusion matrix and returns the d-prime value for the predictions.
d' = z(hit rate)-z(false alarm rate)
http://en.wikipedia.org... |
6d1804214b2fafb4b17cde78f588bbab7aa22931b919c2be3b33631f34dda167 | Python | 3,488 | 103 | from more_itertools import chunked
from permacache import permacache, stable_hash
import numpy as np
from modular_splicing.legacy.hash_model import hash_model
from modular_splicing.utils.run_batched import run_batched
from modular_splicing.utils.sequence_utils import all_seqs
def function_on_changed_sequence(
x,... |
a2531857785d9ddf82ed2ad2a85f0e66be8fa22e4018dd69b0216db8542caa56 | Python | 3,488 | 112 | """Preview and dry-run RecordContext fidelity tests."""
from __future__ import annotations
from dataclasses import asdict
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.fastlog import RecordContext, RecordContextFieldError
from torchlens.visualization.fastlog_preview import _b... |
61ce39954ff63f3e619c7fdfe35efc336bfd53bd5aff73e4137a30c34e206ff2 | Python | 3,489 | 95 | import logging
import numpy as np
import scipy.stats as st
import lifelines
import pandas as pd
import pymc as pm
from pmsurv.models.base import BayesianModel
import pmsurv
import pmsurv.utils
from pmsurv.exc import PyMCModelsError
class WeibullModelBase(BayesianModel):
def __init__(self):
super(WeibullM... |
642a8fd348d7d13e448fb1ac68cb30f1eab3380ccd3327361d7c70c838d471a7 | Python | 3,489 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "volume"
_path... |
74bd227b6d1970d0aadf79ffdad46374bcb08f01b82d1213cf464e52e9aac5f8 | Python | 3,489 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "mesh3d"
_path... |
a2ec27cd33a790e8798e328b621f0048eac7e09323489f2efdd228153c3cdebb | Python | 3,489 | 88 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
e6fa3c79d78141aeeca26ddeddfbf736bb30dcdfe8a7f5a49cfbd6c805f01be9 | Python | 3,489 | 114 | import torch
from torch import nn
from einops import rearrange
from SRDTrans.SpatioTemporalTrans.TemporalTrans import TemporalTransLayer, LearnedPositionalEncoding
from SRDTrans.SpatioTemporalTrans.SpatioiTrans import SpatioTransLayer
class TemporalTransformer(nn.Module):
def __init__(
self,
... |
fdec8b050a95488442d2a6633f6e672f65fed1ad2d99c9d51bea5ac71c8831a0 | Python | 3,489 | 132 | # --- 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 Starts(_BaseTraceHierarchyType):
_parent_path_str = "streamtube"
_path_st... |
82737927b695e04eaa49bf157fc96d24f08339066c1721dafebe7f2090621ceb | Python | 3,490 | 102 | """This module describes the abstract interface for :class:`InstrumentPlugin`.
These are responsible for collecting and formatting a coherent set of metrics.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Any,
Protocol,
)
from .. import formatting
from ..safety i... |
dec769127e8894b4a887972a8fc507a0c2a1ee5ba2cba60f8db6460fc432c490 | Python | 3,490 | 106 | """Regression tests for public ``trace(halt=...)`` partial captures."""
from __future__ import annotations
import torch
from torch import nn
import torchlens as tl
from torchlens.fastlog import RecordContext
from torchlens.options import CaptureOptions
class _ThreeStageModel(nn.Module):
"""Tiny model with an o... |
013f09f5f09a22996ada3cc67363d3981f8d10b578e34deb70628e67fb691680 | Python | 3,491 | 124 | model = dict(
type='SimCLR',
backbone=dict(
type='ResNet',
depth=50,
in_channels=3,
out_indices=[4],
norm_cfg=dict(type='SyncBN'),
zero_init_residual=True,
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type=... |
203e160a4d451a79ff6c46041b592306f1cc9e4a3ab767099558667e97561567 | Python | 3,491 | 107 | import torch
from torch.utils.data import DataLoader
from modular_splicing.dataset.for_model import reformat_argument_for_model
def run_model_on_single_batch(*, m, xy, evaluation_criterion, model_kwargs={}):
"""
Run a model on a single batch.
m: The model to run.
xy: The batch to run the model on, s... |
fe3254679da85a4cf1d340af8c267c9b1e6672ed1cbad8751135f283efa75d77 | Python | 3,491 | 87 | # noinspection PyProtectedMember
from torch.optim.lr_scheduler import _LRScheduler, MultiStepLR, CosineAnnealingLR
# noinspection PyAttributeOutsideInit
class GradualWarmupScheduler(_LRScheduler):
""" Gradually warm-up(increasing) learning rate in optimizer.
Proposed in 'Accurate, Large Minibatch SGD: Train... |
166be2f9278eb700f8360b438ed8295d8c13552f735c85448c972e1acd910de7 | Python | 3,492 | 110 | import re
def get_map_protein():
protein_psam_name_dict = {}
protein_rbns_name_dict = {}
with open('intermediate_data/protein_psam_name.txt', 'r') as f:
# f.readline()
idx = 0
for line in f:
psam_name = re.split(',|\n', line)[:-1][0]
# print(psam_name)
... |
1cf277feae6e2e9b1399a193d5622ad6e03fb3344ead948a003306de1a904ab1 | Python | 3,492 | 100 | """One-call NaN forensics door (torchnative 6.5 / W3.1).
The pitch is STRUCTURAL: the default capture names the ORIGIN op with
module address and file:line at zero added cost -- detect_anomaly reports
where a NaN surfaced in backward, and the report defers to it BY NAME
inside its own output for the cases this door do... |
5f4ee6d558e56175d08ac56dc5281e36297840d23faa48bd6da58ee2494fb081 | Python | 3,492 | 87 | from collections.abc import Iterable
import numpy as np
from brian2 import second, Quantity
from util import ensure_unit
def get_clean_tbounds(tstart, tstop, interval):
tstart = 0 if tstart is None else tstart
tstop = interval if tstop is None else tstop
tstart = ensure_unit(tstart, second)
tstop = en... |
907009dda65c48761d125dc499f46848128a829d9a31b5922d588e20cf8f4d4c | Python | 3,492 | 93 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 23 17:57:47 2022
@author: psicobiologia
"""
import pickle
import scipy.io
import numpy as np
from sklearn.decomposition import PCA
from sklearn.model_selection import GridSearchCV, cross_val_predict, cross_validate, StratifiedKFold
from sklearn.pip... |
ce03d3aae8856e28fe089e38d90a5cebafc5775d3181e9ade50e0bf007cf46a0 | Python | 3,492 | 96 | """
The utility function for model construction.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/nn_utils.py
"""
import torch
from torch import nn as nn
def param_count(model: nn.Module) -> int:
"""
Determines number of trainable parameters.
:param model: An n... |
c87bf7e63d4f3e09177107e7d119529f653996fc8a603eecc8f7390b0c35d991 | Python | 3,493 | 93 | """Test 3D U-Net"""
import sys
import shutil
from os.path import join as opj
import os
import yaml
from scripts.utils.constants import WORKING_DIR, MRI_CYST_SEG_FILES_3DUNET, MRI_ORG_SEG_FILES_3DUNET # noqa
os.chdir(WORKING_DIR)
def create_conf_files_test(kind, create_yml=False):
"""Create 3D U-Net config file... |
aed186615b9fdc13443dbc0d919b21687ce00d4c46f087b9fec3cafbe2663856 | Python | 3,494 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "surface"
_pat... |
8d0b7db68a9c12818d0f568103dfd3b906cbe9230a0e9dbe1f32fad81d0ff5b4 | Python | 3,496 | 103 | import datetime
from typing import TYPE_CHECKING, List
import numpy as np
import requests
from carbontracker import exceptions
from carbontracker.emissions.intensity.fetcher import IntensityFetch, IntensityFetcher
if TYPE_CHECKING:
from carbontracker.loggerutil import Logger
CURRENT_DATASET = "CO2emis"
PROGNOSI... |
2996bee7cac19418f18b4cf1eddcf63ee18fb0e470f2aaa3f7573340a8b54214 | Python | 3,497 | 99 | # --------------------------------------------------------
# Modified from https://github.com/pengzhiliang/MAE-pytorch
# --------------------------------------------------------'
import argparse
import datetime
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from PIL import Image
import cv2
from... |
7323b48b0252f9898db4c3df8b3b33e9ba029249663f2e8d04c5eaa180893bc4 | Python | 3,497 | 110 | # --- 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 = "candlestick.increasing"
... |
7d95099d99fdd870c08df22d5bc266da46eac65be82892b93f503b45df88c037 | Python | 3,497 | 110 | # --- 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 = "candlestick.decreasing"
... |
c250beb0bc89948b3b321f21d800319f59fe1536bed975c22fb7b61cc40b36ea | Python | 3,498 | 106 | # Copyright 2022 Mayo Clinic. 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 applicable law or ... |
0178153040b8e21bef31e6c4fa58b046f677e2643e154228af95b9d9499aadc5 | Python | 3,499 | 81 |
from collections import OrderedDict
from torch import nn
from .modules import VOneBlock, SequentialWithAllOutput, BottleneckVOne
from .back_ends import AlexNetBackEnd
from .params import generate_gabor_param
import numpy as np
def VOneNet(sf_corr=0.75, sf_max=6, sf_min=0, rand_param=False, gabor_seed=0,
... |
e47a633b4331c57132c393ca04d8ec11304f77eb5ed85e773d9c69dfede98250 | Python | 3,500 | 75 | import tensorflow.compat.v1 as tf
import scipy.sparse as sp
import numpy as np
from .model import GATE
from tqdm import tqdm
class STAGATE():
def __init__(self, hidden_dims, alpha, n_epochs=500, lr=0.0001,
gradient_clipping=5, nonlinear=True, weight_decay=0.0001,
verbose=True, ... |
29336015b6f0a6b5b0904100d2f35db1fb64013c0bd2aa556a0156bea4ac0a3a | Python | 3,501 | 110 | from unittest import mock
from uuid import UUID
from api.mocks import DUMMY_USER, FakeAuthContext
from carbonserver.api.infra.repositories.repository_experiments import (
SqlAlchemyRepository,
)
from carbonserver.api.schemas import Experiment, ExperimentCreate
from carbonserver.api.services.experiments_service im... |
8dd8978ace32d7adb6817387e4c10e19737d8273ff7ebebb8f2974325a4ec6ad | Python | 3,501 | 103 | # coding=utf-8
# Copyright 2026 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... |
c38b1aad7bf604413a69914fb058b159e00676889f9994fbfb4d7e9c91b1e0f2 | Python | 3,501 | 109 | """Noisy DQN."""
import argparse
from typing import Tuple
import numpy as np
from pytorch_lightning import Trainer
from torch import Tensor
from pl_bolts.datamodules.experience_source import Experience
from pl_bolts.models.rl.common.networks import NoisyCNN
from pl_bolts.models.rl.dqn_model import DQN
class NoisyDQ... |
8cda2a58104508785add34406712286a5115a1fd012039ae34a3e33a11773bdf | Python | 3,502 | 111 | # --- 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 = "indicator.delta"
... |
d77a006029a2468680af76fae2bd5e0b868dd3460eb01129cc954d5313b9d2b8 | Python | 3,502 | 111 | # --- 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 = "indicator.delta"
... |
2fbdcdfb2036b51453adb3a5b788349f09c52d72304f16980860ed11daa43285 | Python | 3,503 | 108 | from typing import Sequence
from dm_control import mjcf
from mujoco_utils import mjcf_utils
from angorapy.tasks.world_building.entities import Robot
from angorapy.tasks.envs.dexterity.mujoco_model import consts
HAND_POSITION = (0., 0., 0.)
HAND_QUATERNION = (1, -1, 1, -1)
class ShadowHand(Robot):
"""A ShadowHa... |
b492a5827c1016322e1ea20a3cbc27775eaddff1bed4a48d25dedb3f1fd6b0d7 | Python | 3,504 | 97 | """Test functions for specparam.utils.spectral."""
import numpy as np
from specparam.sim import sim_power_spectrum, sim_group_power_spectra
from specparam.utils.spectral import *
###################################################################################################
#####################################... |
852bf4e1a3e87e46f873dc3ecef579cfd7c7b7d7a0972642875dfb64d827e744 | Python | 3,505 | 110 | # --- 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 = "waterfall.increasing.marke... |
fb68b74e934aeb83463c9072f74ce831b2fb21a56e8b4d191e77e95ee3f302d4 | Python | 3,505 | 110 | # --- 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 = "waterfall.decreasing.marke... |
41a8063a2fe2c2fe07fafa22f9aa0ef91c91da02e4f2796a28109e8bb683077f | Python | 3,506 | 73 | import os, argparse
import subprocess
import pickle
import pandas as pd
from rnaprot.rplib import bed_get_exon_intron_annotations_from_gtf, extract_exon_intron_labels, gtf_get_transcript_ids, gtf_extract_most_prominent_transcripts
# Transcript IDs dictionary
# Test tr_ids_dic = {'tr1': 1, 'tr2': 1} - has to be trans... |
745cdab80d1fc42aff67d9e43ca04699539cff1bf0e3b7142996d3ec5e78e1f4 | Python | 3,506 | 95 | import qt
import ctk
class AxisControl(qt.QWidget):
def __init__(self, parent=None):
super(AxisControl, self).__init__(parent)
self.min_distance: int = 63 #resulting in 64 layers
# Create controls
self.minSpinBox = qt.QSpinBox()
self.minSpinBox.setRange(0, 4096)
se... |
ada626f02699e4a9da315627eba89499cb7d7f6228f445b8ed2a086ac9bf365c | Python | 3,506 | 96 | import numpy as np
import time
from PCAfold import preprocess
from tensorflow.keras import layers, initializers
from keras import Model, Input
from tensorflow.keras.callbacks import EarlyStopping
random_seed = 100
angle_list = [i for i in range(0,180)]
n_points = 2000
random_seed = 100
np.random.seed(seed=10)
mean =... |
38fe3384ec0b97101dfea5ba31446e1b033f93012d4b7734433400047fc749aa | Python | 3,508 | 108 | import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from pyriemann.utils.base import logm
from pyriemann.utils.kernel import (
kernel,
kernel_euclid,
kernel_logeuclid,
kernel_riemann
)
from pyriemann.utils.mean import mean_covariance
from pyriemann.u... |
8292817455447c19ad749224f2f8996cf296796c8926eb2364eb6836bf25ef25 | Python | 3,508 | 84 | """Minimal reproducer: cp.async.bulk.tensor.1d (descriptor TMA) passes racecheck.
Same pipeline as racecheck_repro_1d_bulk.py but uses make_tiled_tma_atom to
create a TMA descriptor, which generates cp.async.bulk.tensor.1d PTX.
python AI/racecheck_repro_1d_tensor.py # correctness
... |
30fb55751e39e49c83e428aad58408a70154af2e2002353460400bad9b763fc4 | Python | 3,509 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "streamtube"
_... |
469ec1d8f692daa70281937e78d1f9fd11d51c7cbdb62b678bfc69eec19339aa | Python | 3,509 | 100 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import print_function
import glob, os, gc, sys
import os.path
import csv
import numpy as np
np.random.seed(1337) # for reproducibility
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
from IPython.display import display... |
9af02557fe0d9465d020a17743d7a950e3a6f8ec8e3cab11b73c7762ced3c15d | Python | 3,509 | 95 | from typing import Optional, Tuple
import torch
from pytorch_lightning import Callback, LightningModule, Trainer
from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
import torchvision
else: # pragma: no cover
warn_missing_pkg("tor... |
a983a7e4baec208ccc211613571a045d5b8cdbdd8a5b3fdae9082185644273a5 | Python | 3,509 | 125 | """Reusable timing/duration panel widget for portal apps.
Displays and controls: duration, steps, timestep, framerate (derived).
Reduces duplication across Module Inspector, Model Inspector, and simulation apps.
"""
from __future__ import annotations
import panel as pn
import param
__all__ = ["build_timing_widget"]... |
b931de3fb9b42b9fadb9deac0a097491a6bb8c027c9c403351c5bf140d856cc7 | Python | 3,509 | 119 | import pytest
from pyrosm import get_data
@pytest.fixture
def helsinki_pbf():
pbf_path = get_data("helsinki_pbf")
return pbf_path
@pytest.fixture
def helsinki_region_pbf():
pbf_path = get_data("helsinki_region_pbf")
return pbf_path
def test_reading_boundaries_with_defaults(helsinki_pbf):
from ... |
ef95aeecc06d461d50dbd9a10c66220f5b71fe36bdefde7de8a0ac9b0d512434 | Python | 3,509 | 129 | # --- 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 Lightposition(_BaseTraceHierarchyType):
_parent_path_str = "isosurface"
_... |
1a16783466d5574abdde6ac4e75f2bea4586f2efad287374425983f96a352556 | Python | 3,510 | 145 | import os
import sys
import pickle
from neuron import h, gui
import numpy as np
def reference_filename(mech_name):
return f"diffuse-{mech_name}.pkl"
def save_state(mech_name, t, X):
with open(reference_filename(mech_name), "wb") as f:
pickle.dump((t, X), f)
def load_state(mech_name):
filenam... |
f48de09f34bf4894030211bdaad1e49331e088b846d16a5cc7425fc058ebab7a | Python | 3,511 | 91 | import sys
from ij import IJ, ImagePlus
from ij.plugin.filter import Analyzer, MaximumFinder
from ij.process import ImageProcessor
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input_file = sys.argv[-9]
scale_when_converting = sys.argv[-8] == "yes"
weighted_rgb_convers... |
2fce1733a8bdd8dc8e8f61079e3682c4a3376ddf059b4e558f4b77452f0b6a81 | Python | 3,512 | 73 | import tensorflow as tf
import transformer_network
import utils
from tensorflow.keras.layers import (Dense, Dropout, GlobalAveragePooling1D,
Input)
from tensorflow.keras.models import Model
def create_model(vocab_size, config):
embed_dim = config["embedding_dim"]
ff_dim = ... |
8fd52292de3c851d52a638c7fd4ef40dada5fafe07fd0c6a0848f300682ca69a | Python | 3,512 | 104 | """grind-r5 P7 / R16: escape disclosure survives persistence; FakeTensor ordering.
A capture TorchLens itself refused to bless (``capture_verified=False`` with a
reason) used to save and load as a capture with NO claim -- ``False -> None``,
reason gone -- so an artifact with a provably missing op was
byte-indistinguis... |
d3532d8df6e545fe4df87da3252b83aa7b3af250795e0dfbed55fe11747bd76a | Python | 3,512 | 77 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
daaea396f2502777298e789bbc76737615acc16b4b9ec5636792ce4c68174484 | Python | 3,512 | 106 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import division
import sys
import glob, os, gc
import uuid
import os.path
import csv
import numpy as np
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
import shutil
import re
import pickle
from boto3.session import Sess... |
e888f34ced922a69b8cfc432838b877f20fd207f1db035376ea1ec14b88a97e5 | Python | 3,512 | 114 | from pathlib import Path
from typing import Sequence
from dm_control import mjcf
from angorapy.tasks.world_building.entities import External
class Block(External):
def __init__(self,
position: Sequence[float] = (.0, .0, .0),
rotation: Sequence[float] = (.0, .0, .0, .0)):
... |
2652198a990b37d1be43726f7d686735dd4211c3bd4521c93f1420e7927858d5 | Python | 3,513 | 92 | # flake8: noqa
import numpy as np
from keras.src import backend
from keras.src import ops
from keras.src import testing
from keras.src.optimizers.adagrad import Adagrad
class AdagradTest(testing.TestCase):
def test_config(self):
optimizer = Adagrad(
learning_rate=0.5,
initial_ac... |
5646dade0a06ef4406839cd6eb8c95c947e736207d39809edccac219883a5fc4 | Python | 3,513 | 145 | """Utility functions to select from and/or organize data objects."""
import numpy as np
###################################################################################################
###################################################################################################
def groupby(vec, num):
""... |
7033f2d19c75e52c876c76b921536caa3f6d85c239f7e0c532a1a0aeb11753ec | Python | 3,514 | 103 | # FAITHFUL REIMPLEMENTATION from arXiv:1812.10044 (no public code) -- A/B codex
"""Trainable Projected Gradient detector for overloaded MIMO."""
from __future__ import annotations
import torch
from torch import nn
from torch.nn import functional as F
class TPGDetector(nn.Module):
"""Unrolled TPG detector with t... |
af78c6b81e405287f738ad9113816b1c3d0f4c8eef3b9431f420f44aab3b3705 | Python | 3,514 | 101 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
f49ce120d3f8731478b30821e21d3582862f98cdd37d6e0e07a372aa3ce50823 | Python | 3,515 | 106 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from .. import plot
from .._data_obj import Dataset
from .._stats.testnd import _MergedTemporalClusterDist, NDTest
from .._text import ms
from ..fmtxt import Section
def time_results(
res: NDTest,
ds: Dataset,
colors: dict,
title... |
856222df79c938bb71f34a13b3debc35ffd46383d1150777b34091fe741b81eb | Python | 3,516 | 92 | # 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... |
bfa7b2b213e1d2bee47437ad272bba4428c9eafca8a57974f8e1f11bd9f83d70 | Python | 3,516 | 107 | import glob
import random
import os
import torchvision.transforms as transforms
import torch
import random
import pickle
from torch.utils.data import Dataset
from PIL import Image
def video_load(video_path,nt=5):
video_info = []
video_folder = os.listdir(video_path)
cnt=0
for video_name in video_folde... |
562e018e2dec523a495d81401f0d9354ee34b46f896ea1cc3a1c9e7e0ab09751 | Python | 3,517 | 101 | """
This module start slurm job on the cluster
"""
import os
import json
import argparse
import logging
def transfer_data(direction, which_cluster, folder):
if which_cluster == "genouest":
cluster_path = params["genouest_path_to_tfpc"]
elif which_cluster == "igrida":
cluster_path = params["igr... |
b7133a76a107c2330cc4f480404aa6c41b698dc27a70b5194696432d9aa412c1 | Python | 3,518 | 102 | """Plan-check verb (weightsfree memo D14 / face 4 / composition rows).
Audit-only, forever separate from the runnable gate: pass, shape mismatch,
selector typo, value-callable refusal, and REFUTED-source refusal — plus the
never-arms pin.
"""
from __future__ import annotations
import pytest
import torch
from torch i... |
ae6edee4e12505f5a9e669b95f86dcefdba72136dc5536cd54c1d8911410de5c | Python | 3,519 | 110 | # --- 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 Activeshape(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_pat... |
e894e879d01e9134489e605edde3b8f6935e8f418e79619094da5542ab608a05 | Python | 3,519 | 113 | import cv2
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import albumentations as A
from albumentations.pytorch.transforms import ToTensorV2
class PatchDataset(Dataset):
def __init__(self, df, transform):
self.df = df
self.transform = tra... |
0cc69a9aaabdb627b80b5011ad2c0c20f3dd1b82737a9ce69f0ffbcb01f26b99 | Python | 3,520 | 90 | __author__ = 'cenwan'
import numpy as np
import math
import glob
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import matthews_corrcoef, make_scorer, roc_auc_score
GOTerm="GO0034613"
MCCValue=make_scorer(matthews_corrcoef)
#-----Loading testing data-----
with open... |
4043d9f3e318522aadaae0f0f265c7298c680e86df384a1ca71ea354632df5c3 | Python | 3,520 | 100 | #!/usr/bin/env python3
# coding: utf-8
"""
Created on May, 2020
@author: Thomas Bonald <tbonald@enst.fr>
"""
from typing import Union
import numpy as np
from scipy import sparse
from sknetwork.classification.propagation import Propagation
from sknetwork.clustering.base import BaseClustering
from sknetwork.utils.forma... |
f23e9fd5a0aa0bc865fb3c107465a080bbfabb9c69a00561b3bd2d164c12e256 | Python | 3,522 | 92 | '''
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... |
53dc06454ccafee5f9ef7cdadca8642ed405ac8b1d4773e6f696ae399a7ff80f | Python | 3,523 | 88 | """R1 venue gate + session-scoped real-checkpoint fixtures (memo A1/A2).
VENUE CONTRACT (memo 4.3): R1 tests run ONLY behind a green preflight
(``scripts/preflight_fetch_artifacts.py``) under the offline env it prints.
IN VENUE (offline env set) nothing here can skip -- a missing artifact fails
loudly at load. OUT of ... |
cf41ebfc0ca971d92b4d1387c1182b973574529be4e83d6b8e50458a002cc9cd | Python | 3,523 | 138 | #!/usr/bin/python
import numpy as np
import pylab as pl
import struct
def spike_counts(spikes, size=None):
'''
Compute spike count for each neuron
'''
if size is None:
nspikes = np.zeros(1)
else:
nspikes = np.zeros(size)
for spike in spikes:
t,i = spike
if i>=l... |
7a855ad4980f5cd3fe1ed6bcd9abf51a27cf9b2ca1e351b942abbfe7674af26c | Python | 3,525 | 107 | #!/usr/bin/env python
"""
Input: Molecular pattern of molecule.
Output: Multiple substructurally related molecules file.
"""
import argparse
import sys
import cheminfolib
import psycopg2.extras
import pybel
cheminfolib.pybel_stop_logging()
def parse_command_line(argv):
parser = argparse.ArgumentParser(... |
8a62fdbb8219cd287cce7d8d16b617a98fa98ce6cec2c54cb53fca02a198f6d6 | Python | 3,525 | 118 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Module to compute posturographic measures.
(most after Prieto T., "Measures of Postural Steadiness:
Differences Between Healthy Young and Elderly Adults", IEEE Transactions of biomedical e... |
b3ad783a3e59783191a633ef62d7caedec0c4b9e1540643fece99af4a7949882 | Python | 3,525 | 119 | # collect all patches, patches = entire frame here
# pass through vgg19 to get features
import numpy as np
from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.keras.applications.vgg19 import preprocess_input
from tensorflow.keras.preprocessing.image import smart_resize
from tensorflow.keras.models imp... |
e28f24615d9858342a5bdefb549330d34a6f44c1adc27712db1074d57ecdbe94 | Python | 3,526 | 123 | import torch
import moinn.utils.batch_tensor_operations as bo
import math
from schnetpack.train.metrics import Metric
def clustering_loss_fn(args):
def loss(batch, result, epoch):
# define tradeoff warmup parameters
cut_warmup, entropy_warmup = args.tradeoff_warmup_epochs
cut_warmup -= 70... |
2b98d3270285f4344146b222069e11522da93d840219674fffdd893347f538e7 | Python | 3,527 | 96 | """
.. _exa-mtrf:
EEG speech envelope TRF
=======================
Analyze continuous speech data from the mTRF dataset [1]_: use the
boosting algorithm for estimating temporal response functions (TRFs) to the
acoustic envelope.
"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
# sphinx_gallery_thumbnail_nu... |
648c0e86353c8bbde54916b7cb1bca7fab0a7d8dfb3277c38b62323ec1ef8dec | Python | 3,527 | 123 | import array
import pytest
import rpy2.rinterface_lib.callbacks
import rpy2.rinterface_lib.embedded
import rpy2.rlike.container as rlc
from rpy2 import robjects
from rpy2.rinterface.tests import utils
def _just_pass(s):
pass
@pytest.fixture(scope='module')
def silent_console_print():
with utils.obj_in_modul... |
582c27a7664a8abd08cce24b75b69e4ad3ca899cf0cafd315a3938fa95801052 | Python | 3,528 | 90 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.