sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b260eb4e736c9a94ba3d742f25a210e374435be496fbed3ab546aebceea23a25
Python
2,975
89
""" quick and dirty derivative threshold detection for APs """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import pyabf import glob import nump...
1a520943ac66728e6355ac9473ed3e0719bd1a036638412d6a041ed0fcbb636a
Python
2,977
94
def standardize_tuple(value, n, name, allow_zero=False): """Transforms non-negative/positive integer/integers into an integer tuple. Args: value: int or iterable of ints. The value to validate and convert. n: int. The size of the tuple to be returned. name: string. The name of the argum...
2d1ba8e0c31d27bd8a8d3edec856262a7af4b6a8a87c5c29093909e3e70f1367
Python
2,977
61
from sklearn.metrics import confusion_matrix import numpy as np import tensorflow as tf import os, argparse import cv2 from data import process_image_file #Combine the COVID and non-COVID pneumonia cases mapping = {'normal': 0, 'pneumonia': 1, 'COVID-19': 1} def eval(sess, graph, testfile, testfolder, input_tensor, ...
5d9ab821aed93ff2d6a53f4e7ec96d51faaf01745f76681edc62f7467ddc72a7
Python
2,977
104
"""Comprehensive dry-run visualization tests for fastlog.""" from __future__ import annotations from pathlib import Path import torch from torch import nn import torchlens as tl from torchlens.fastlog import RecordContext def _mlp() -> nn.Module: """Return a small static MLP.""" return nn.Sequential(nn.L...
056b6667e28d34649debe33fcc279899f80300ae66a34ce2fdfcdbfd8daa1d9b
Python
2,978
104
# --- 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 Legendgrouptitle(_BaseLayoutHierarchyType): _parent_path_str = "layout.shap...
b3282ea5e74460dd22e601bc76df8339cecbe260678863eeba61932b4ca25123
Python
2,979
99
"""Metrics like Dice and ROC AUC""" import numpy as np from scipy.stats import ttest_ind from sklearn.metrics import roc_auc_score from sklearn.metrics import auc from sklearn.metrics import precision_recall_curve def dice(pred, true, k=1): """Computes Dice score. Args: pred (ndarray): prediction ...
ef8bf32ed5e5b4db7ce657097d12853559cc3a7cc264cfe3891bc54cfc894a0e
Python
2,980
83
"""Tests for specparam.metrics.metrics""" from pytest import raises from specparam.metrics.metric import Metric from specparam.metrics.error import compute_mean_abs_error from specparam.metrics.gof import compute_r_squared, compute_adj_r_squared from specparam.metrics.metrics import * ##############################...
9503069ba3ab464c017c52774b9321c8c6467bebb6f3f384dde5392e0bf01ec7
Python
2,982
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "contourcarpet"...
9606077a88718d033e2e54c79abaa2b2d4b0c534c968282859b298bbac448dbe
Python
2,982
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "choroplethmap"...
ecaac36b77a3b96cf44e0d50047dca36d5b2419f06f3b0ece79b9dd55ab51ddd
Python
2,982
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "scattercarpet"...
debb82905a314d260d8edbb4b250f1dd91dbf5800ee0eb3a221f8b4d1f91c747
Python
2,983
76
"""Detection dataset from RecordIO files.""" from __future__ import absolute_import from __future__ import division import numpy as np from mxnet import gluon def _transform_label(label, height=None, width=None): label = np.array(label).ravel() header_len = int(label[0]) # label header label_width = int(l...
31e68639e941fc80c798b3d357b0449eb9a6660e49fb42e951d3e5eb9bc298fa
Python
2,984
85
import pickle as pkl import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.cm as cm from collections import Counter from scipy import stats fichier = open("data/residues_of_interest/dico_res_correctness.pkl", "rb") dico_score_correctness = pkl.load(fichier) nb_methods = len(dico...
1678f718825d2104b90b4daad89d750aa167049345fa75adef7a4a313a819500
Python
2,985
72
# Given a locus file and 1000 genomes location, generates MsCAVIAR format # locus file and LD matrix import argparse, glob, os, subprocess __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + '/' def gen_ld_parseargs(): # handle user arguments parser = argparse.ArgumentParser...
3472e07d7d9ab95684dd9e212006f874fa3f5b1e5efc0b5912bce4b47d346b72
Python
2,985
170
# pyrefly: ignore-errors # Unmaintained experimental module, not part of the public package surface. # helper def _find_distance(seq1, seq2) -> int: edits = 0 for i in range(len(seq1)): if seq1[i] != seq2[i]: edits += 1 return edits # analyzers? def edit_distance(seq1: str, seq2: str, ...
03637c1f1788bdea4fc6a217ae7ed73ae8c874423aa452445b928a386204bc9f
Python
2,986
97
import gzip import pickle import random import warnings import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.preprocessing import MinMaxScaler import os import keras import tensorflow as tf from keras.models import Model from keras.callbacks import EarlyStopping, Mod...
3716baaba1e617601d9d0d003b5b7904baff117f828520630ded8176b7fa36c6
Python
2,986
75
from __future__ import annotations from collections import defaultdict from minknow_api.data_service import GetReadStatisticsResponse from typing_extensions import TypeAlias from bream4.device_interfaces.devices.base_device import BaseDeviceInterface # (channel, well) -> ( (classification) -> PerClassificationData ...
c34fbdaa55ae2312badd86ac149e5554b4f090ecc2820559a984f88f80ddde27
Python
2,986
84
""" Tests to make sure the example datasets load """ import os import numpy as np import pandas as pd import eugene as eu from pathlib import Path HERE = Path(__file__).parent eu.settings.dataset_dir = f"{HERE}/_data/datasets" def test_get_dataset_info(): dataset_info = eu.datasets.get_dataset_info() assert...
3402e2f119c1afa3376df7c82e59d0f20c301a9cf27b6fdaec19b7cc76e05413
Python
2,987
95
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy import torch imp...
345c8e366ccad00543959335a06e0ad27557ac4f23d735f72c098cae4b2a941b
Python
2,989
70
#!/usr/bin/env python '''Return aggregated statistics for database''' import sys, re, MySQLdb, argparse, os, json, subprocess import pandas as pd import makemodel import numpy as np from MySQLdb.cursors import DictCursor def getcursor(host,passwd,db): '''create a connection and return a cursor; doing this gu...
526d1ce6b7f4178112e08ad1bc11ee44fe2d3a2afd06512f339e0982c22a9fe0
Python
2,989
111
from pyrosm.config.default_tags import ( basic_info_tags, highway_columns, building_columns, amenity_columns, shop_columns, craft_columns, leisure_columns, tourism_columns, historic_columns, emergency_columns, office_columns, landuse_columns, natural_columns, wate...
adf2ccf14578e3a95ee4dc24327710ff6e218fc6c40ad3a4d34173d78f7e153b
Python
2,989
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "scatterternary...
c6540286c14c628d87cf38bf328a6c16de538bf0ad02725d2e3592a9d2a2315b
Python
2,989
84
import sys from tqdm import tqdm import mxnet as mx import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.data import mscoco from gluoncv.data.transforms.pose import (flip_heatmap, heatmap_to_coord_alpha_pose) from gluoncv.data.transforms.presets.alpha_pose impo...
f514366795c8a591405c136c95f8d97bfbffc38b996efae74a3f6cb23ad62442
Python
2,989
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl...
c9c045a6170e4821370271426374142e9f13fe014ac49fef6e363aa3b6bf6d5b
Python
2,990
40
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
46c4764a4479f15fc2794483be433860d07039ee200aeceb7eb37fab05d7a9bb
Python
2,991
96
from ._RL_agent import * from numba import njit @njit def mb_session_value(choices, second_steps, outcomes, n_trials, transition_type, params): # Unpack parameters. alpha, weight_mb = params[:2] if transition_type == 1: trans_prob = [0.8, 0.2] else: trans_prob = [0.2, 0.8] # Variables. V_s = np....
5d39846cc62890aea415420c872c84ddf5214c0f0d21d87c494b432379430641
Python
2,991
110
import sys import argparse import logging import time import vcf def call_gt(tag): if sum(tag) == 2: return '1/1' else: if tag[0] == 1: return '1/0' if tag[1] == 1: return '0/1' return './.' def main_ctrl(args): fileout = open(args.outvcf, 'w') header = open(args.invcf, 'r') ...
862068ba480706bd3b35a984c211fff9855bfa4e9db178b53f01aef3ff89db14
Python
2,991
79
from gettext import npgettext import torch from tqdm import tqdm from .pmi_tfidf_classifier import get_doc_tfidf import numpy as np device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') def get_pmi_vectors(words_pmis, word2text_count, word2id, tokenized_text, N, lpw, nl): vectors = torch.zeros(le...
a13250b13a14eea5de08f42ba70d0c33ff1a6226a2a5b942fd9e6cfb0f4d57c5
Python
2,993
57
import os import re import numpy as np import matplotlib.pyplot as plt import sys sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells') from analysis import utils_linclab_plot utils_linclab_plot.linclab_plt_defaults(font="Arial", fontdir="analysis/fonts") from analysis.utils_int_discrim import plot_performance ...
a9f1b7798e0b353383044ce9e1c7ed878e5d19a79108e8daaa753f9ceee4e351
Python
2,993
108
from __future__ import absolute_import, division, print_function from io import TextIOBase import sys import threading if sys.version_info[0] < 3: from Queue import Queue else: from queue import Queue def start_thread(runnable): threading.Thread(target=lambda: runnable.run()).start() class ConsoleInpu...
956827de12ee49dc76bf99e4af997c95e68564cd1b4627a2652baa71baf4f20e
Python
2,994
74
"""Regression tests for r18i2 options residue (finding L2). L2 (de-bloat): ``torchlens.options._merge_grouped_options`` carried a keyword-only ``fields`` parameter that was documented but never read in the function body. Every one of its five call sites threaded a ``_*_FIELDS`` constant into it that the merge never co...
030ec1d6669aed8deddbcf95cb18b616fce5c3b39eef1f7821b1ed65b77dd8ca
Python
2,995
89
import unittest from numpy import exp, log, mean, array, abs from spitfire import GeneralAdaptiveERK, odesolve class ExponentialDecayProblem(object): def __init__(self): self.decay_constant = -1. self.lhs_inverse = None def rhs(self, t, state): return self.decay_constant * state def...
2532979a1d692976f9fadfbb0b04503bb2f7e1eeae8fbde065408843de9fe032
Python
2,996
99
"""Utility functions""" # pylint: disable=missing-docstring, arguments-differ, method-hidden import json import pickle import pathlib import numpy as np class ComplexEncoder(json.JSONEncoder): def default(self, obj): if hasattr(obj, 'to_dict'): return obj.to_dict() elif isinstance(obj,...
753f82064713b639c8682454d385f509e81cfd11abe1a6b2d900395400632241
Python
2,997
86
"""``EpisodeSpec.step_input_from`` (W051-EPISODE out-of-fence item 3). The options owner gains the declared carried-input argument selector. The consumer (``resolve_episode_declaration`` -> ``EpisodeJoinSession``, the ``entry_basis`` envelope slot) ships with lane W051-EPISODE and reads the field via ``getattr(spec, "...
d54e1c3953ded31a9813afe4f405d8175d2abd48cb8dd82321acdd635ecb0c95
Python
2,997
82
import wandb import matplotlib.pyplot as plt import numpy as np user_project_name = 'omarcos/deepopt/' artifact_name_dpf = 'run-3fv8g9iw-table_dpf:v0' artifact_name_part = 'run-3fv8g9iw-table_part:v0' acceleration_factor = 22 testing_name_group = 'x{}_test2'.format(acceleration_factor) run = wandb.init(project = 'dee...
dfe8e3ac2c45d94db667c90654f81084e21e9320d8ad8f5f224a1e0d368f5d25
Python
2,998
103
""" Plotting of continuous features stored in adata.obs. """ from matplotlib import pyplot as plt from PIL import Image import pandas as pd import matplotlib import numpy as np from typing import Optional, Union, Mapping # Special from typing import Sequence, Iterable # ABCs from typing import Tuple # Classes fro...
6830a7c41bd2ee35e0dd0befb1ed9b1a1fc0e84115de966872aa07696bb5fcbb
Python
2,999
104
# --- 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 Legendgrouptitle(_BaseLayoutHierarchyType): _parent_path_str = "layout.news...
718425ed1e069d000f54acf9101ee6dfedd8a315ffae0147d711f6b26efb8c02
Python
2,999
65
import torch import torch.nn as nn from torch_geometric.nn import GCNConv, GATConv, SAGEConv, global_max_pool as gmp, global_mean_pool as gep class CPI_classification(torch.nn.Module): def __init__(self, device, emb_size = 768,max_length=1500,n_output=2, hidden_size=128, num_features_mol=78,dropout=None): ...
817b8e1e66c44aed222c41c80c8cb0d4533eec19a58275b0c72523083109dbf3
Python
2,999
90
# 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...
0f0d498bcc5f68cc0eac01204b4830661283c14ff20c02c6bc88bfe464e00eed
Python
3,000
91
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, ...
5225a4c3fefb52d8b2402092abc1811c198a655f22d8af4ffe1cbb29b8c7e0ae
Python
3,001
99
import django # Django settings for celery_http_gateway project. DEBUG = True TEMPLATE_DEBUG = DEBUG CELERY_RESULT_BACKEND = 'database' BROKER_URL = 'amqp://guest:guest@localhost:5672//' ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': ...
6a9762da38d76dae13a87ea48dabc1b4a8a4a7c94d3bc9f7fece83e91f6214cc
Python
3,001
86
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Estimators for tfep that are compatible with the bootstrap analysis. """ # ===================================...
764fbe12258c656ae370b19d1bb591ac169209b9968e392b44ca39a806447dc0
Python
3,001
95
"""Phase 5(d): user-attached pre/post hook ordering relative to wrap-forward push.""" from __future__ import annotations from typing import Any import torch import torchlens as tl from torchlens import _state class HookChild(torch.nn.Module): """Child module containing a nested linear module.""" def __in...
b1dda94fa0306d65537c8f9030a99d0351b782986867fdba2a5b2d718ec16981
Python
3,002
106
"""Load and validate the vsearch completion spec. Provides a small typed model on top of spec/vsearch.yaml that the per-shell generators consume. """ from __future__ import annotations from dataclasses import dataclass, field from pathlib import Path from typing import Optional import yaml SPEC_PATH = Path(__file...
2090caa23858712c637ff556f8194eed095d7263304805d9af509ecc00e68108
Python
3,003
104
import unittest import pickle import numpy as np from bdpy.evals.metrics import profile_correlation, pattern_correlation, pairwise_identification class TestMetrics(unittest.TestCase): def test_profile_correlation(self): # 2-d array n = 30 x = np.random.rand(10, n) y = np.random....
b97d2e803d5475a06c3c45dc0ad02ee4deadb0f00f01c1f5a5043ede99fd01b6
Python
3,003
106
import functools import hashlib import pathlib import warnings import numpy as np def hashfile(fname, blocksize=65536, count=0, constructor=hashlib.md5, hasher_class=None): """Compute md5 hex-hash of a file Parameters ---------- fname: str or pathlib.Path path to the file bl...
bdc53fc561cc9acccfacd909dbb760a87ccc6f7cca512c3cd95db6240fca71a9
Python
3,003
79
""" This module allow you to test ensembling model """ import torch import os import logging from analysis.training_analyser import TrainingAnalyser from utils.utils import ( calc_metric_and_loss_on_data, ) from models_architectures.ensembling_model import EnsemblingModel class TestEnsemblingModel: """ Th...
34a63c8c6ce4130b2d3be4a877726d7947ed28a4ecc55dc019db38bb97317f0b
Python
3,004
63
import unittest from Metrics.src.CEST import mtr_asym from Metrics.src.utils import mtr_asym_curve import numpy as np from test_support_function.src.CEST import generate_Z_3D class TestMtrAsym(unittest.TestCase): def test_mtr_asym_curve(self): # Test MTR asymmetry curve with a Lorentzian curve centered at...
a6b3abb018e68240c4fa16383e5d76d321793089649261ab14bb3c5df2324fec
Python
3,004
84
from __future__ import absolute_import import ctypes import re import warnings def glibc_version_string(): "Returns glibc version string, or None if not using glibc." # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen # manpage says, "If filename is NULL, then the returned handle is fo...
c48c1bc87b4650a0f55755d512566c898187a8b9c29fbb81dd8ebd2c9e7108a9
Python
3,004
104
"""Extraction v2 runtime (lane F18; extract memo items 4-19). The private implementation package behind :mod:`torchlens.dataset_extraction`: the typed batch envelope + collate door (:mod:`envelope`), the batch context with row and key validation (:mod:`context`), mask-aware pool presets (:mod:`pool`), save-dtype routi...
f0770d63c3effd43fe9cb790e69ed2006cbee16398043c7da2430e78b39839c5
Python
3,004
87
import glob import torch import pytorch_lightning as pl from utils.data_manager import DataManager from utils.data_loader import LIDataLoader from utils.result_logger import save_test_log from model.define_model import load_pretrained_encoder from model.model_interface import ModelInterface, define_callback class Mo...
2a58d1fde663071452a3aee2efc42d0cc89ae0320d152308bc48b9ea088796b4
Python
3,006
90
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 28 17:13:33 2023 @author: fcheng """ import pandas as pd import seaborn as sns import os from plot.makeDataFrame4plot import makeDataFrame_color_weight from plot.barplot import barplot_dotline from plot.stats import compare_two_weight_samples s...
c44abe134fd890f9a589c6bd6c281e635bbd81cefb2e07925b9641b906cdf654
Python
3,006
71
import unittest from scipy.stats import norm, multivariate_normal from numpy import linspace, mgrid, unique from numpy.random import seed from .context import densratio class BasicTestSuite(unittest.TestCase): """Basic test cases.""" def test_alphadensratio_1d_1(self): x = norm.rvs(size=200, loc=0, ...
f533db45fba55886990ceaec4056b9ab26cb67dc6d8c0329a2596d14aaad42b8
Python
3,006
107
import pytest import sys import textwrap import rpy2.robjects as robjects import rpy2.robjects.methods as methods rinterface = robjects.rinterface def test_set_accessors(): robjects.r['setClass']("A", robjects.r('list(foo="numeric")')) robjects.r['setMethod']("length", signature="A", ...
e579410d0d0af2c1800576a564a6e8424a55129c5c4bfdab27804046a5ea5693
Python
3,007
66
import tensorflow as tf from tensorflow.keras import backend from tensorflow.keras.layers import UpSampling2D from typing import Optional, Union, Tuple from cvnn.layers.core import ComplexLayer from cvnn.layers.core import DEFAULT_COMPLEX_TYPE class ComplexUpSampling2D(UpSampling2D, ComplexLayer): def __init__(s...
ec5591bbc6ea1a21d9e2a23306ca02dd6be7fcbb67aba99adfed7281b04b1763
Python
3,007
78
from ovseg.model.SegmentationModel import SegmentationModel from ovseg.model.SegmentationEnsemble import SegmentationEnsemble from ovseg.model.model_parameters_segmentation import get_model_params_3d_res_encoder_U_Net import argparse import numpy as np parser = argparse.ArgumentParser() # vf should be 5,6,7. VF stands...
c8c37b1cefd9e0d8532ee6bf45d8572f6babf02fba5d960288e7cbdf29678987
Python
3,008
80
"""Hand-pinned independent facts for the godobject-oracle golden suite. b9-opus R75-2: the godobject goldens are regenerated THROUGH torchlens, so they detect CHANGE, not correctness. These pins assert facts about the committed golden FILES that are derived from first principles — the corpus model's own source (``test...
057e6f702876e47b177e6dcf6d8b30aa0f216507390ec7b3fa3ddac5f1790c68
Python
3,009
118
# This is my main script import sys, os, pathlib sys.path.insert(0,pathlib.Path(__file__).parent) import pathlib import pandas as pd from base.parallel_predictions import mbs_search from base import configs from base.utils import load_classifier, get_MBS_V2 import argparse """ df = pd.read_csv("base/training_set_F0...
153ce389615f0d58541c28d951079139a72e49c3d73cfcf5d96d33d034aef2a6
Python
3,009
92
# -*- coding: utf-8 -*- """ Created on Mon Feb 6 21:01:02 2023 @author: Caterina Brighi """ #%% Import functions import matplotlib.pyplot as plt import matplotlib as mpl import SimpleITK as sitk import numpy as np import pandas as pd import datetime import os import glob import gzip import shutil...
a8ca27d335807ca033ae7b2d54c320ec4e4ba0c57b3cf9a6a21694a13a4266a8
Python
3,009
98
"""Tests for BackwardPass backward call-site metadata.""" from __future__ import annotations import inspect from pathlib import Path import torch from torch import nn import torchlens as tl from torchlens.data_classes.func_call_location import FuncCallLocation class _ContextModel(nn.Module): """Small model fo...
2008bd364ecaef243ad9c6ac291bd2ca4304d6f9fcfaba1c4582b69d515791a4
Python
3,010
97
# AUTOGENERATED by config_manage.py build_config_types — do not edit manually. # Run `make config-rebuild` to regenerate from the config schema. from typing import Any class ToolShedAppConfigurationAttributes: """Type annotations for schema-defined "tool_shed" config attributes.""" log_level: str databas...
765b5123625c7064fb293f8ee37c5cf46c9b64a905529c041f226f0ea89e2cac
Python
3,010
90
""" The offline larva, simulated without the physics engine. Integrates the locomotor output directly into a pose, bypassing the segmented body simulation. Used for fast behavioural runs where only the trajectory matters. """ from __future__ import annotations from typing import Any import numpy as np from ... impo...
af90a2bfa1f07c0dbf486ffeefdeb20f0087ac190a8988db45e9360948114094
Python
3,011
83
import torch from torch_geometric.nn import radius_graph from torch_geometric.nn.models import SchNet from torch_scatter import scatter from .atomistic_nn import AtomisticNN class AtomicSchNet(AtomisticNN, SchNet) : """ Modification of the PyG SchNet implementation to recover the atomic contributions to t...
70ca1e2c12551d4a595a7f44d0f500aed8a5ce1875d9691ac861d661d6e15791
Python
3,012
88
import sqlite3 from sqlite3 import Connection import pandas as pd import os from bioconfpred.params import (CHEMBL_TARGZ_FILEPATH, CHEMBL_URL, CHEMBL_SQLITE_PATH, CHEMBL_DIRPATH) class ChEMBL(): """ Used to query the ChEMBL SQLite file :param...
c030539fc1d208eedca6897c1efb3819b26fecca8f7c4a93b51c01e74a70948b
Python
3,012
95
"""Prepare the ImageNet dataset ============================ The `ImageNet <http://www.image-net.org/>`_ project contains millions of images and thousands of objects for image classification. It is widely used in the research community for benchmarking state-of-the-art models. .. image:: ../../_static/imagenet_banner...
10ec2dc02599349423ffe6c776b67cbd80ded0658936fd7d3a766f475e2b7448
Python
3,013
89
"""Unit tests for ScreenTextFont's line wrapping and spacing.""" from __future__ import annotations import pytest @pytest.fixture def pygame_ready(): import pygame pygame.init() yield pygame.quit() @pytest.mark.fast class TestScreenTextFontWrapping: def test_no_wrapping_when_max_text_width_un...
4d4ad13b4271a7fd5d3124dd01745a4048b48b4eb06d751fea5878bd72abb314
Python
3,013
70
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Wii preprocessing.""" from __future__ import print_function, division from ..signal import read_data_source from ..tags import smart_tag_definition from .. import smart_tags_manager import ...
7ad8482a5fe798a53e2a5a2614d9f183c910fd247fad3721a4a0c6d1c8039364
Python
3,014
90
from __future__ import annotations from dataclasses import dataclass, field from typing import Dict, Iterator, Mapping, Optional, Sequence import numpy as np import torch @dataclass class DomainTensorData: x: torch.Tensor labels: Mapping[str, torch.Tensor] = field(default_factory=dict) mask: Optional[to...
e5b4992c16a855f885996862c7c12fc376d44990c79fa2ff9537ca954df8b677
Python
3,014
77
"""Subprocess entry point for isolated surface-oracle snapshot generation. The surface goldens freeze CONSTRUCTION-TIME behavior too: a model built after torch has been wrapped can bake live wrappers into its state (the SF-53 class — ctor-read ``F.<op>`` defaults, string-activation resolution), which forks the snapsho...
1c986f58a0e9715fa801989e03f2547e82cb1820d880f2947d0e1c2be23d653d
Python
3,015
77
# 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...
65bf4e0ec1efcde018cb8586639efb5cef88520da9e948804ee3d9cabdd421c1
Python
3,015
100
import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces # TODO: Task need to be revisited class ReachingDelayResponse(TrialEnv): """Reaching task with a delay period. A reaching direction is presented by the stimulus during the stimulus period. Followed by a delay period,...
7bbcdc863c92eb36bd266836f81032a228634ad9e728095ceb5320b4ab918d08
Python
3,015
108
import gc import weakref from contextlib import contextmanager from unittest.mock import MagicMock, Mock import pytest from celery.utils.objects import Bunch, FallbackContext class test_Bunch: def test(self): x = Bunch(foo='foo', bar=2) assert x.foo == 'foo' assert x.bar == 2 class te...
97eee6ab676bade4e22ec3b644f21f9f532aca7932dc9cafc99d0d9d117478dc
Python
3,016
102
"""CMAC cerebellar controller, 1975, James S. Albus. Paper: "A New Approach to Manipulator Control: The Cerebellar Model Articulation Controller." CMAC tile-codes continuous inputs into overlapping associative memory addresses whose table entries are summed for control output. """ from __future__ import annotations ...
b4230c694250f8f7c3cb424ad6621c33f013bfb3387b90607ae9f4a071814dbb
Python
3,017
90
"""The SDPA facet-reconstruction gate must refuse corrupted reconstructions. ``_allclose_sdpa`` decides whether a reconstructed facet is served as real or refused as ``MissingFacet``. Its former hand-picked absolute floors (atol 2e-2 fp16/bf16, 1e-5 fp32) blessed ALL-ZERO and SIGN-FLIPPED reconstructions of any payloa...
ca3bc687975249e2cfe2a9e69fe1c7339cc4bee7960276d36670720d2055b7b8
Python
3,017
91
"""grind-p3 T5.7: fastlog directory bundles get the core writer's 0600/0700 tightening. The core bundle writer tightens saved bundle directories to ``0o700`` and metadata sidecars to ``0o600`` because ``mkdir``/``open`` honor the ambient umask (a common umask 022 leaves everything world-readable). The fastlog director...
f01494d8417add4708261bbb65b14f840edd9ccfd6d845f129b852de5913463d
Python
3,017
104
# --- 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 Legendgrouptitle(_BaseTraceHierarchyType): _parent_path_str = "histogram2dcon...
35e672ac1261e5291258ec5db838e58f45cbd328e17b9cf051b6715d12e25149
Python
3,018
94
from __future__ import annotations from typing import TYPE_CHECKING from functools import partial from itertools import chain if TYPE_CHECKING: from typing import Dict, Any, Tuple, Union, Iterable, Callable from typing_extensions import TypeAlias from torch import Tensor import torch.optim as optim ...
79d4b019a78254089e327924bd73453db5af89c33fb1312f31961ff1a3046d51
Python
3,019
130
import os data_dir = os.path.realpath(os.path.join("..", "..", "data")) mass_shift_annotation_url = ( "https://docs.google.com/spreadsheets/d/" "1-xh2XpSqdsa4yU-ATpDRxmpZEH6ht982jCCATFOpkyM/" "export?format=csv&gid=566878567" ) # Living data analysis performed on 2020-11-18. living_data_dir = os.path.joi...
96c69d26117c7168710e086055568a1557518ad463eb6c65c718cb18e564d420
Python
3,019
90
# --- 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 Textfont(_BaseTraceHierarchyType): _parent_path_str = "quiver.selected" _...
9a27f1e1ffb7864847dc25c2d7e6626a7b64d88f2a4f14c259032ae3962c762f
Python
3,019
108
import pathlib import shutil import tempfile import h5py import numpy as np import pytest from impose import data data_path = pathlib.Path(__file__).parent / "data" def test_ds_bad_path(): path = data_path / "does-not-exist.h5" with pytest.raises(FileNotFoundError): data.DataSource(path) def tes...
4699600049a3000daf801e69c1636314efd941615009af382d04cdf93efa1a43
Python
3,020
94
"""Pointer Sentinel-LSTM mixture model. Paper: "Pointer Sentinel Mixture Models", Merity et al., ICLR 2017. Pointer Sentinel-LSTM augments a recurrent language model with a pointer cache over recent hidden states and a sentinel that lets the pointer component choose between copying from history and using the normal v...
817ab7fd5bcfa7d34fa7ecb33a08b74c8029d572043a83309e96a489d57fc769
Python
3,020
90
# --- 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 Textfont(_BaseTraceHierarchyType): _parent_path_str = "bar.unselected" _p...
de977e444dd08758be707ec9248bc2b533e1d2aa3f0b35443371b85085a42ebf
Python
3,020
120
#!/usr/bin/python import argparse import logging import subprocess import sys def stop_err(logger, msg): logger.critical(msg) sys.exit() def log_subprocess_output(logger, pipe): for line in iter(pipe.readline, b""): logger.debug(line.decode().rstrip()) def get_arg(): parser = argparse.Arg...
e66fad45363779a3712c58892bac16933fd1c71d376e0279978fdd7bcdd5b34d
Python
3,020
110
""" NGS indexes """ import logging import os from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) from galaxy.util import UNKNOWN from .metadata import MetadataElement from .text import Html log = logging.getLogger(__name__) class BowtieIndex(Html): """ base class f...
7fa35a8cc0d3dcb08fea788286870c62fc85512be4e44f871adb865e6ad5adc7
Python
3,021
92
"""Shared fixtures for the F34 leverage-dividend suites (no tests here). The toy nets reproduce the leverage panel's measured identity scenarios in miniature: a reused-module cohort (one ``nn.ReLU`` instance called at several sites), a VALUE-PRESERVING same-cohort insertion (the extra ``relu`` call on an already-recti...
9799a3747cfff956eb45731b456b2f8182501fbdaad8433b51a5fdb646b00b2a
Python
3,021
74
from __future__ import annotations from typing_extensions import Literal from pathlib import Path import pooch import tarfile # This is a global variable used to store all datasets. It is initialized only once # when the data is requested. _datasets = None def datasets(): global _datasets if _datasets is No...
c5a13a3be8721f0e43995646e17a7d2e7ad384c67cece85f7bf7eafa208cd52f
Python
3,021
87
""" Colormap collection - the purpose of this script is to create demo graphs of common ABF plots using all available colormaps. Colormaps with extremely light traces are skipped. Graphics are saved and an HTML page is made to view them, which can be easily converted to PDF. """ import os import sys sys.path.append("....
c904dee9dc969417f1481acebff31d45717544f2c447f1163a9fa96b6ccba197
Python
3,021
89
""" A module that implements tooling to enable easy warnings about deprecations. """ from __future__ import absolute_import import logging import warnings from pip._vendor.packaging.version import parse from pip import __version__ as current_version from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_...
3ddf5cf10186c7905b0cefea3129b12f2abd89387e42129baf285a596ed44bfe
Python
3,023
72
from typing import ( TYPE_CHECKING, Union, ) from galaxy.exceptions import ( error_codes, MessageException, RequestParameterInvalidException, RequestParameterMissingException, ) from galaxy.util.json import safe_dumps if TYPE_CHECKING: from fastapi.exceptions import RequestValidationError ...
812331484b2de5e11623659ea25c63467f10c04914efc3c185c8ba02cc6fc103
Python
3,023
73
"""Module for vector environments.""" from typing import Iterable, List, Optional, Union import gym from gym.vector.async_vector_env import AsyncVectorEnv from gym.vector.sync_vector_env import SyncVectorEnv from gym.vector.vector_env import VectorEnv, VectorEnvWrapper __all__ = ["AsyncVectorEnv", "SyncVectorEnv", "V...
0b0bf2915f2de2376371ce97bf8ef421dfee619f57fd62b54b9dfbf7d3fe5d55
Python
3,024
94
#!/usr/bin/env python """ This script fetches sequence from an indexed FASTA for genes specified in the provided BED file. """ # 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, '../')) sys.path.append(os....
44a49106385d0023000e51311c6155cd0c931fae796d57a8c49f1cbca745080d
Python
3,024
73
""" AvgPool2d w/ Same Padding Hacked together by Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F from typing import List, Tuple, Optional from .helpers import tup_pair from .padding import pad_same, get_padding_value, pad_same1d def avg_pool1d_same(x, kernel_size: List[int], stri...
9c2dfab0c4568d1165001cad5fcef254db1fd157641f3ba6bc6685a0a45214a8
Python
3,025
102
#!/usr/bin/env python #========================================================================= # # 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://...
20977ac3afb360f6337c6da7e6e9c5f898aa318aadb0ec65d7f169157203ecd1
Python
3,026
83
# %% import pandas as pd import matplotlib.pyplot as plt from globals import path, sessions, subjects, folder_spots_noboth, colours_types import os # %% # Load density data file_path_name = ( f"{path}/forearm_area.csv" ) if os.path.isfile(file_path_name): # open csv with headers in rows forearm_area = pd.r...
45eaa2efa5d2156c797c24d0817780a535945f2c205e9fba552529eed28a15ce
Python
3,026
68
# Mossy layer at 45, 90, 135 degrees from os.path import join import numpy as np import os import pandas as pd from library.comput_utils import cal_hd_np from library.params import ParamsHolder from library.shared_vars import sim_results_dir from library.utils import save_pickle from library.simulation import simulate...
f5f51b2c324b7093dff4db03aa18fad2577c3c7b0a2adf6114abb12d34521ff8
Python
3,026
75
#!/usr/bin/env python3 """Fail loudly if the CI image's deps are below the flash_attn/cute/pyproject.toml floors. Runs inside the SIF before tests. The FA4 install in run_fa4_ci.py uses --no-deps (to keep the SIF's torch/cudnn), so pyproject floors are not enforced at install time. A SIF baked before a floor bump ther...
20ac657acdba17a1cedd2d9c09c01f1fec173ec964e8928add583b8bd6ab0958
Python
3,027
101
import cv2 import numpy as np from random import randint import random from PIL import Image height = 32 width = height size = 6 pos_all = [ (5, 5 ), (5, 15), (5, 25), (15, 5 ), (15, 15), (15, 25), (25, 5 ), (25, 15), (25, 25), ] def is_hit(ver1, ver2, fig_type): if fig_type ...
2649e36a0162e100c682280eca18e7ba91e999f4b620562ca9ed262fa3ba9f22
Python
3,028
89
# 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...
c984d8bb95f127cd55b2a029c9dcb125ead138dcfde09d8599fe43b600f71352
Python
3,028
99
"""Formatting information about envs and wrappers.""" import gymnasium as gym from neurogym.core import METADATA_DEF_KEYS, env_string from neurogym.envs.registration import ALL_ENVS, all_envs, all_tags, make from neurogym.utils.logging import logger from neurogym.wrappers import ALL_WRAPPERS, all_wrappers def show_...
6fef10480d6a96daf7f18691431f49aed0414daf4b2ff7cb8e0b1a8852cd8fe1
Python
3,029
74
""" Squeeze-and-Excitation Channel Attention An SE implementation originally based on PyTorch SE-Net impl. Has since evolved with additional functionality / configuration. Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507 Also included is Effective Squeeze-Excitation (ESE). Paper: `CenterMa...
07f7a7a875ae4ef52d1f81ea858f1248d5c8629f241aff4ab5fc15c8c6e57b17
Python
3,030
78
import sys # setting path sys.path.append('../TM2_segmentation') import os import numpy as np import nibabel as nib import itk import pandas as pd import tarfile from scripts.preprocess_utils import find_file_in_path # load metadata file input_annotation_file = 'data/csv_files/cbtn-all-LGG-BRAF.csv' df = pd.re...