sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
517d44e8f6182d94147c329f33752daa0d63afebe339454a3adc7d8a637e7605
Python
4,247
126
"""Coverage of the input validators in pyrosm.utils (#272). These assert the error branches (bad argument types / values) that the parsing APIs rely on, so the validators are exercised directly rather than only through the happy path. """ import pytest from shapely.geometry import Polygon, MultiLineString, LineString...
600d22ec66e434b99a8e7d5363cf66dd4baa263be6638c7122630ba18df9612f
Python
4,247
151
import torch.nn as nn import torch class TemporalTransLayer(nn.Module): def __init__( self, dim, depth, heads, mlp_dim, dropout_rate=0.1, attn_dropout_rate=0.1, ): super().__init__() layers = [] # print("trans depth:", depth) ...
015be59fe4df1ad7b3ab78307b3e3ea0bc4a385918286dd3fb89ec5b27a5162f
Python
4,248
145
# coding=utf-8 import os import datasets import requests from promptsource import DEFAULT_PROMPTSOURCE_CACHE_HOME from promptsource.templates import INCLUDED_USERS def removeHyphen(example): example_clean = {} for key in example.keys(): if "-" in key: new_key = key.replace("-", "_") ...
cc7cfcdf6b9fdfedcdbe01c647df53d90ea41f109ec45cb75c214c7343748dc2
Python
4,248
122
""""Functions to compute measures across collections of recorded neurons.""" import numpy as np from spiketools.utils.checks import check_time_bins from spiketools.measures.spikes import compute_spike_presence ################################################################################################### #######...
3ff20a2748bcb4c5ad8013a22cdfebb9f5d0c4542a1c67be8821c4a8932fcd5d
Python
4,249
121
#!/usr/bin/env python ''' Tool for building a combined SDB or CSV sample-set from other sets Use 'python3 data_set_tool.py -h' for help ''' import sys import argparse import progressbar from pathlib import Path from deepspeech_training.util.audio import ( AUDIO_TYPE_PCM, AUDIO_TYPE_OPUS, AUDIO_TYPE_WAV, ...
01bb5a1bee8ac70a9b7623e8fee16f402d3f26eb62f29629b7dc031843898372
Python
4,250
118
"""Move-compat gates for the _io split (C01 item 3) + disposition labels (item 4). The split sends the IO error vocabulary to ``format_errors`` (logical L0) and the format contract to ``format_contract`` (L1) with ``_io/__init__`` a declared re-export facade. Two invariants gate it: - ZERO SPELLING CHANGES: every his...
1f8f64e0ffd6b088dad3ed97428285fb05e3dd915a6188a8f578af41d77254cf
Python
4,250
146
import numpy as np import pandas as pd import io from PIL import Image import matplotlib import matplotlib.pyplot as plt from anndata import AnnData from scanpy.plotting import palettes from stlearn.plotting import palettes_st from typing import Optional, Union, Mapping # Special from typing import Sequence, Iterab...
7ce11c6b06467f8ec6ed6ab50c4278b35778c15b1c62fe158a2286478fa436a4
Python
4,251
130
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy import pytorch_li...
cd6b8a7627d6d7b8490fcecbbd1b58cb39a4a71ab18a07736b98ee57cf938da2
Python
4,252
132
#!/usr/bin/env python3 '''Takes a bunch of types training files. First argument is what index the receptor starts on (ligands are assumed to be right after). Reads in the gninatypes files specified in these types files and writes out two monolithic receptor and ligand cache files in version 2 format. Version 2 is o...
dc491c66bbb993d4fa1c3a0187350e35c1d693093d302fae14690f0b02e4ce77
Python
4,252
109
"""Packaging guards for ``pyproject.toml`` optional-dependency extras (r20a). These tests assert the metadata-level contract of the advertised extras, catching the two defects the r20a hardening pass fixed: * ``all`` was an empty extra (``all = []``), so ``pip install torchlens[all]`` silently installed nothing whi...
9a1b5fdd78da5a574c3656f44172e5a32bc107e1abd0484e66f92bb572ace79d
Python
4,253
100
from functools import partial from transformers import BertModel, DistilBertModel from transformers import pipeline from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModel, AutoModelForCausalLM import numpy as np import pickle as pkl import os import os.path from os.path import join as oj ...
fd5d4308460acad10c597536f0874ff50fe116c68eb4fc87f5dc4754b69e29bf
Python
4,253
107
"""Memory-timeline parity oracle + frozen torch-2.13 golden (W0.7, DEADLINE). Torch's still-alive PRIVATE categorizer (``prof._memory_profile()``) is the one oracle the rebuilt categorized timeline (observe, W3.2) can ever be checked against; after upstream deletes it the oracle can never be built again. This suite is...
4f7e3529044f433fc62b756b99a0ab7b5a21cc858c03df59bcad86d74629862f
Python
4,256
156
import numpy as np from anndata import AnnData from matplotlib import pyplot as plt def qc_plot( adata: AnnData, name: str, library_id: str | None = None, data_alpha: float = 0.8, tissue_alpha: float = 1.0, cmap: str = "Spectral_r", spot_size: tuple = (5, 40), show_color_bar: bool = Tr...
8ee24b5e52d30230921b5447eb74a6d6e4cf3cc594cdbedbd9fc5c754a73e721
Python
4,257
90
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import json import os import re import shutil import sysconfig from pathlib import Path from ultralytics.utils import LOGGER from ultralytics.utils.checks import ONNXRUNTIME_BUILDS, check_requirements def onnx2xi...
4daabf9ededbfff96a6844075dff0eea746841b9bd6e93ba18dc7217089eecc3
Python
4,259
90
"""Prepare PASCAL VOC datasets""" import os import shutil import argparse import tarfile from gluoncv.utils import download, makedirs _TARGET_DIR = os.path.expanduser(os.environ.get('MXNET_HOME', os.path.join('~', '.mxnet', 'datasets', 'voc'))) def parse_args(): parser = argparse.ArgumentParser( descript...
b24dce1af3de17c56f01faca353de5395e5df7e6680e4be199225d71cd76f535
Python
4,259
119
# %% [markdown] # # Customizing the pyramid # (advanced:pyramid)= # # # Multi-resolution pyramids are an integral part of ome-zarr image data # and enable fast rendering of large images. # The entrypoints to writing ome-zarr images in ome-zarr-py ({py:func}`ome_zarr.classes.image.OMEZarrMultiscale`, {py:func}`ome_zarr....
55f1bf042808818b9beb490efaa793789732df43a7015083110e149b1ccf35f1
Python
4,261
96
# -*- coding: utf-8 -*- """ Created on Fri Jun 10 09:56:26 2022 @author: 8 """ import torch import math import random import numpy as np import torch.nn as nn import torch.nn.init as init import matplotlib.pyplot as plt import torch.nn.functional as F import torch.optim as optim class MScnn(nn.Module): def __init...
6ebc1d62ee16b679b77538a364db410b2147693753645ad8e043cd71c5bf4b76
Python
4,261
102
from typing import Any from pathlib import Path import os import pandas as pd from mirp._data_import.generic_file import MaskFile def extract_mask_labels( mask=None, sample_name: None | str | list[str] = None, mask_name: None | str | list[str] = None, mask_file_type: None | str = Non...
70b9dde9281b512ed2b92e13b060ccdfda00667e4f53a4a87acaf0dc355644c0
Python
4,261
129
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in March 2020 @author: Nathan de Lara <nathan.delara@polytechnique.org> """ from functools import partial from multiprocessing import Pool from typing import Union, Optional import numpy as np from scipy import sparse from sknetwork.classification.base import...
51605dc1dafc2f1c52bca9a0f3b782483ae004f6cdb935a2c41e6e29b8dd4e2c
Python
4,262
129
import copy from functools import lru_cache import numpy as np import pandas as pd from permacache import permacache import tqdm.auto as tqdm from modular_splicing.models_for_testing.list import binarized_models from modular_splicing.evaluation.run_evaluation import evaluate_model_on_data from modular_splicing.legac...
2db3a09c21a330532cf7c822672352fbe00405aa47560719289f0ae7fdbda5ca
Python
4,265
112
import logging import os import tempfile import unittest import arviz as az from pathlib import Path from sklearn.model_selection import train_test_split from pmsurv.models.gaussian_process import GaussianProcessModel import tests.syntheticdata logger = logging.getLogger(__name__) @unittest.skip("Not yet ready") cla...
7dbd44daae594a4b2beafbd6ce4923f46049ff332b7227603b6e3cee939434ac
Python
4,265
121
from bioseq2seq.utils.logging import logger from bioseq2seq.transforms import register_transform from .transform import Transform, ObservableStats class FilterTooLongStats(ObservableStats): """Runing statistics for FilterTooLongTransform.""" __slots__ = ["filtered"] def __init__(self): self.filte...
39d830d8524a89bbab7687215f7377777c8674457ca3f3032e33a677d5ec7ba8
Python
4,266
130
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Reuires https://github.com/maenu/scholar.py:: pip install https://github.com/maenu/scholar.py/archive/master.zip !! Run from interpreter to retain data for debugging access run find_publications.py, then copy-paste download function """ from argparse ...
7cf885d704aba4bf44e15a339cb470eedbbc83ba8c81d49c6a2fba63df97403d
Python
4,266
149
"""myapp.py Usage:: (window1)$ python myapp.py worker -l INFO (window2)$ celery shell >>> from myapp import example >>> example() You can also specify the app to use with the `celery` command, using the `-A` / `--app` option:: $ celery -A myapp worker -l INFO With the `-A myproj` argument the pro...
dc1e561660d90acb138b346d32d0bc9ebdd83aac717c4bac6666df986e371f73
Python
4,266
129
# -*- coding: utf-8 -*- """Segment tree for Proirtized Replay Buffer.""" import operator from typing import Callable class SegmentTree: """Create SegmentTree. Taken from OpenAI baselines github repository: https://github.com/openai/baselines/blob/master/baselines/common/segment_tree.py Attributes: ...
b2a2b82dfb80b47b950fb393b0a6ca7ef0763a47ce0fe2b7eda73d8bf17c348b
Python
4,267
157
"""The ``celery logtool`` command.""" import re from collections import Counter from fileinput import FileInput import click from celery.bin.base import CeleryCommand, handle_preload_options __all__ = ('logtool',) RE_LOG_START = re.compile(r'^\[\d\d\d\d\-\d\d-\d\d ') RE_TASK_RECEIVED = re.compile(r'.+?\] Received')...
ffb79dcd9a22be16340e3cfd17ea1a88b20d13f4993441d054198ebd579892d7
Python
4,267
165
from datetime import datetime import numpy as np import torch import os import time from constants import get_args from motif_model import ( MotifModel, load_model, save_model, MotifModelDataset, evaluate_model, ) from load_psam_motif import read_motifs from map_protein_name import get_map_prote...
18613eef6d11cc83d288a794b3065c704146c0b59ffffb97ef357f9b6bef2ec2
Python
4,269
111
import os import cv2 import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd mpl.rcParams["pdf.fonttype"] = 42 def get_fb_dis(image_tif, labels_tif): data = cv2.imread(image_tif, 2) labels = cv2.imread(labels_tif, 2) cell_sigs = np.bincount(data[labe...
2aaa8a2bdf398f27be44e39ef73a8a00596fde3a28633c846a6f92aa42bc2a19
Python
4,269
104
"""Module which creates mesh lines from a line set Open3D relies upon using glLineWidth to set line width on a LineSet However, this method is now deprecated and not fully supporeted in newer OpenGL versions See: Open3D Github Pull Request - https://github.com/intel-isl/Open3D/pull/738 Other Framework Issues - ...
dc777d864d62605ca15100e6595b531c42c80eb2032e0b3a09dbbfb7da43fbf2
Python
4,269
91
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.legacy.losses import Reduction as Reduction from keras.src.losses import deserialize as deserialize from keras.src.losses import get as get from keras.src.losses import serialize as s...
e3161c9bd988203853d83e4d0bd82bffe64f67cc4f89e837670d35be7ca01bb8
Python
4,269
155
VALIDATION_STATIONS = [ "fowd_cdip_163p1", "fowd_cdip_168p1", "fowd_cdip_181p1", "fowd_cdip_185p1", "fowd_cdip_187p1", "fowd_cdip_188p1", "fowd_cdip_189p1", "fowd_cdip_194p1", "fowd_cdip_196p1", "fowd_cdip_197p1", "fowd_cdip_198p1", "fowd_cdip_200p1", "fowd_cdip_201p1...
7f0856d01fc003141d4c46250b9dd09d90d1a85be21a98e2c517431cb183e2d2
Python
4,270
127
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from sklearn.model_selection import train_test_split, TimeSeriesSplit from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_percentage_error from sklearn import preprocessing import ...
a3557814063402a35203fde3d9917cc4ae126215366989c9e8e81da5e546623a
Python
4,270
107
import random import unittest import numpy as np from angorapy.tasks.registration import make_task from angorapy.common.senses import Sensation from angorapy.common.postprocessors import RewardNormalizer, merge_postprocessors, \ StateNormalizer from angorapy.utilities.core import env_extract_dims def test_state...
d5f5d54fc45d7a4177a730fcefa7fbdc315c4a8351b345e6bcf085a2db1871d3
Python
4,270
119
import numpy as np class EdgeIndex(object): ''' find the index of the edge from node i to node j in edges ''' def __init__(self, edge) -> None: self.num_nodes = edge.max() + 1 self.index = {code:idx for idx, code in enumerate(self.encode(edge[0], edge[1]))} def enco...
1fa1fd16a1711415a913d8c4ba07ca40804446c13594ba94c70eb2c0d403c5d7
Python
4,271
169
"""Parameters for model and training """ from src.utils import DotDict epochs = 3 experiment_name = 'test_loop_1' id_vae_cmnist = 'test_vae_cmnist' id_vae_oscn = 'test_vae_oscn' id_mmvae_cmnist_oscn = 'test_mmvae_cmnist_oscn' id_classifier_cmnist = 'test_classifier_cmnist' id_classifier_oscn = 'test_classifier_oscn' ...
c27144029158edcb85bd8b74b31d9ebdf424fb4c791ff42c00851c651d076a6d
Python
4,271
126
from typing import List, Tuple import torch from pytorch_lightning import LightningModule from timm.models.vision_transformer import vit_small_patch16_224 from torch import Tensor from torch.optim import AdamW from lightly.loss import LeJEPALoss from lightly.models.modules import LeJEPAProjectionHead from lightly.tra...
e47c187b7e7712059a2efbd3ededd4513d7f81f8ba88769969640315a26cba4c
Python
4,271
117
import torch import torch.nn as nn import numpy as np from utils import fftshift_tensor,tensor_unsqueeze,ifftshift_tensor,get_mask_from_data import torch.fft as tfft def d_k_torch_batch(fov,mat_size,TAng, thre=0.2, device='cpu'): ''' get dipole kernel from fov,mat_size,TAng ''' batch_size = mat_size....
cd6dcb6112a6457e8c6a22d4afd0fbf6146a0d5b9ea07cfc2bf3842c96004d17
Python
4,272
129
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy import pytorch_li...
402116f86dae7cd73528591581996c2784fcf9278e0b07643e653d2cff641d73
Python
4,274
125
from functools import partial import numpy as np import pytest from gym.spaces import Discrete, Tuple from gym.vector.async_vector_env import AsyncVectorEnv from gym.vector.sync_vector_env import SyncVectorEnv from gym.vector.vector_env import VectorEnv from tests.testing_env import GenericTestEnv from tests.vector.u...
25d39bdff884e6531f18d912c64cd0cff0052cc3f6fed679c2d20a5b91dd066a
Python
4,275
106
from typing import Optional, Union import numpy as np import pandas as pd from anndata import AnnData from numpy import ndarray from scipy.sparse import issparse from ...logging import logger_manager as lm from .interpolation_deeplearn import DataSampler, DeepInterpolation, interpolation_nn def deep_intepretation( ...
00514d0d6e7d82972ff45160616d8fd21612e1a1d8151a3835e36b54668aeae1
Python
4,276
83
import numpy as np import tensorflow as tf import os, argparse import cv2 from data import ( process_image_file, process_image_file_medusa, ) # To remove TF Warnings tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' parser = argparse.ArgumentParser(descri...
6eb09a98b14c2b10cb08ee2e68f36ca8523bb4198f3d2db61e2d64cfa78850c1
Python
4,276
111
import numpy as np import tensorflow as tf from tensorflow.keras.layers import Embedding, Add, Dropout, Multiply, Conv2D, BatchNormalization, AveragePooling2D, \ Concatenate, Flatten, Dense, InputLayer, GRU, Bidirectional, GlobalMaxPool2D class DeepSmilesConfig(): def __init__(self...
b1f767573082fa6c9338a26814cfc0f4f6688daf39601483169d5ccff1323cbc
Python
4,276
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 Connector(_BaseTraceHierarchyType): _parent_path_str = "funnel" _path_str...
1fb17a20daa4708c6df6914950b419dd97b262e5a6f6047fad7676e5ba3976b9
Python
4,277
117
import argparse import os import sys import json from tqdm import tqdm from bulletin_download import main as bulletin_downloader from db.main import DBMain from local_extractor import main as extractor_main from local_extractor.utils import custom_exceptions STATES = [ 'DL', 'GA', 'HR', 'KA', 'KL', 'MH', ...
d9310e8e8d0275d4d7986c87c224b788efdb1f80dadabea1a49f50179c4af0ea
Python
4,277
121
"""The canonical weightsfree parity matrix (weightsfree memo sec 8.1 item 1). Per parity fixture, the gate assertion uses ONLY shipped authorities: ``real digest == meta digest AND discharge_against(real).verdict is CORROBORATED``. This is the metric that survived all four panel rounds unchanged and caught every one o...
a8dd94c982a9cf8b0f8643df2ce5b6f970bacce5b224a68313ef3d4da63dfbcf
Python
4,279
75
import time import torch from options.train_options import TrainOptions from data import create_dataset from models import create_model from util.visualizer import Visualizer if __name__ == '__main__': opt = TrainOptions().parse() # get training options dataset = create_dataset(opt) # create a dataset give...
d79885e52a871fd7144b073c90250f0228a04b4d25b6fcc2777723b6d292686e
Python
4,279
131
"""Tests for the xcp_d.utils.atlas module.""" import json from pathlib import Path import pytest from xcp_d.utils import atlas _XCPD_ATLASES = str(Path.home() / '.cache' / 'xcp_d' / 'XCPDAtlases') def test_get_atlas_names(): """Test xcp_d.utils.atlas.select_atlases.""" selected_atlases = atlas.select_atla...
f79092a2274b4f7426f0def63bff5b83e1e566e1dd14c1c0b3dfc48d2c6b9b0a
Python
4,279
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
3c7dbeb02e3242c9f1c763c232afa8cfa8b0a6086558c8cf2739bd256f5b41f7
Python
4,281
112
#!/usr/bin/env python """Export Parquet as plain tabular or quoted TSV, without retaining its schema.""" import argparse import base64 import csv import json import math import sys from collections.abc import Sequence from datetime import ( date, datetime, time, timedelta, ) from decimal import Decimal...
65686cd62a96c41639901305c21dca82d26f68d6f51a0402d53e993723b83d74
Python
4,281
132
"""Numbers-truth surface fixes: front door (A8), escape bytes (A11), memory footer (A7). Lane A07 (2026-08-27). Spec: the summary design memo build items 1-3. """ from __future__ import annotations import subprocess import sys import warnings from collections.abc import Generator import pytest import torch from tor...
a7dd43adc152e1dd26cca498fcce50efb8928ba96dd61d52f113d4a56ec353bf
Python
4,281
128
import os import pickle from concurrent.futures import ThreadPoolExecutor import numpy as np from scipy.sparse._csr import csr_matrix from tqdm import tqdm def load_mimic_data_and_vocab(path: str): with open(os.path.join(path, "mimiciv-2.2.pkl"), "rb") as f: data = pickle.load(f) vocab_path = os.pat...
68471d8d50cae0d2f1bf6eabca28499c0a12d9122ef6a295a327ee6b1696982a
Python
4,283
119
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections import numpy import time import hashlib logger = logging.getLogger(__name__) class Trinity_fasta_...
d67e257649a73d483edb69dc0af9090ecb1dc4d1a6bcc5781e43815a50519c68
Python
4,283
114
import torch import torch.nn as nn class SplicePointIdentifier(nn.Module): """ Represnts the core LSSI model. This is a convolutional neural network that takes in a sequence of RNA and outputs a prediction of the splicing probability at each position in the sequence. It only represents one of 3' or 5...
f5b3dba0065b823c1db8f41d3e8bb591566cfadff5b3c8e711affa22c86a00ec
Python
4,283
87
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
d952d22b8831fcee1234dc8ff520c3033028be076a1aaf7553a215b9d04b3654
Python
4,284
146
# -*- coding: utf-8 -*- """ This code will search for the parents of a single cell, get the DI for all individual, pair, and triplet of parents. It does so separately for different time intervals and types of restrictions on parent sets. No need to parallelize -- statsmodel will do so while fitting, and getting m...
00148af6dad00ee3315fa2d8087b764891194f7a981e639e05ae795430c8c00d
Python
4,286
127
import numpy as np import torch from torch import nn from fit.basefit import BaseFit3DPlus from models.densenet import DenseNet121 from models.efficientnet import EfficientNetBN from models.module import SEModule from models.resnet import resnet50, resnext50, wideresnet50 def get_optimizer(model, lr, weight_decay, o...
720260e0041e8ec502f189347696cd12c0fa6fafb443a2146e9e037118d9ff8a
Python
4,286
98
## Read write encoder # This version works with "wheel_tracker\only_rotary_teensy_prtc/only_rotary_teensy_prtc.ino" # on Teensy 3.5 # In addition to saving position / interrupt data, it also saves timestamps whenever a sync pulse is detected # It writes two files # - Position data csv # - _sync Sync data csv import ...
c1d1c28325bc9e65f49350c6961ce4c5cb82e2d821a9098eb606e2bde880c38e
Python
4,286
128
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Sep 28 13:59:56 2017 @author: papoutsi """ import numpy as np #from scipy.stats import norm from scipy.optimize import curve_fit def spike_count(data): if data[0]>0: data[0]=-1 # Find values above zero id_zero=np.nonzero(da...
c37c2d23365338e9f75fe73c61fc4b75b9590e9f72574f75f0ac201b72257a4d
Python
4,286
111
"""siamRPN RPN Code adapted from https://github.com/STVIR/pysot""" # pylint: disable=arguments-differ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from mxnet.gluon.block import HybridBlock from mxnet.gluon import nn ...
c669446d9b047bf1cd43df2abc7de86cadc9aed9c9f383ff59403314ec66a662
Python
4,287
132
#!/usr/bin/env python # test_triggerdelay.py # Copyright (C) 2013 Bastian Venthur # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any l...
d823857e5df61c0efe421a321e79a9582c16f798f3a60ea1f03fa842539a984b
Python
4,288
130
"""A compatibility wrapper converting an old-style environment into a valid environment.""" import sys from typing import Any, Dict, Optional, Tuple import gym from gym.core import ObsType from gym.utils.step_api_compatibility import convert_to_terminated_truncated_step_api if sys.version_info >= (3, 8): from typ...
df81400be5c5ef95082eb98b3298eda4cc69b64f16df098bad056a520005750f
Python
4,288
126
#!/usr/bin/env python # coding: utf-8 # In[4]: import pandas as pd from sklearn.model_selection import train_test_split, TimeSeriesSplit from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_percentage_error from sklearn import preprocessing import...
3c8ccce75a4dbdb5e6764244e72b7f1bdd9c617f829202fdbdc8dca2da25fa79
Python
4,291
109
"""Persistence honesty: structure-only saves never write a poison artifact. WT1 A-IV item 22 + M(weightsfree) W3 (lane A08): * Item 22 -- ``level="executable_with_callables"`` on a structure-only trace used to WRITE an artifact whose load ALWAYS refused (forced saved-args payloads under the marker fail the M-C2 c...
8b1f678a5018d840f3dc78ef2264c5fd0f03a48dbcce6df25913bf59bf264b16
Python
4,291
80
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
869c9e1943774708d6bf055a694e3b3f0c15d8cab928eec8a10d3768abecf399
Python
4,292
137
#!/usr/bin/env python # -*- coding: UTF-8 -*- import ConfigParser import os import shutil import subprocess import sys import tempfile def manage_loc_file(path, data): """ updates or inserts config lines like the following one: chembl_2011 ChemBL 2011 (~1.0M compounds) schema database_name user l...
298d8e69729a1d86b7a3a8bd1afd24ad099a76bebbeb07c6de69bd5fb3c5e9c3
Python
4,293
90
# pylint: disable=wildcard-import, unused-wildcard-import """ GluonCV-PyTorch model zoo """ from .action_recognition import * from .video_language.coot_model import MultiModalTransformer from .pose.directpose_resnet_fpn import * __all__ = ['get_model', 'get_model_list'] _models = { 'resnet18_v1b_kinetics400': r...
7cc2af907b073740358197501bc01868e929e8070ac2040b9506c2db6d2f410a
Python
4,293
123
import tvm from tvm import relay from tvm.contrib import graph_executor from PIL import Image import numpy as np import torch import torchvision.transforms as T import torchvision from torchvision import transforms from gluoncv.torch.engine.config import get_cfg_defaults from gluoncv.torch import model_zoo def _test_...
cc39f4c4fa7e3f198202b30a354754ce27f6adec316f56173a48bc5e3f556419
Python
4,294
131
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, ...
d7975c6e850912773154edada564ede331f7a3f934a9ab002e9d78f1866dfd8c
Python
4,294
103
"""``torch.overrides`` drift oracle (torchnative 8b / W2.8). TorchLens is BUILT on the ``__torch_function__`` protocol, so torch's own overridable-function registry is a free drift oracle: a torch upgrade cannot silently add protocol-visible functions TorchLens does not see. The frozen baseline (``tests/data/torchnati...
f20f5f09a38c4f7bfee5915e7e31e0de12e78719dff7f64d36657c22f5953e66
Python
4,294
134
#!/usr/bin/env python # Created on: November 26, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" __description__ = """ First stage of Decouple. """ import optparse parser = optparse.OptionParser(version=__version__, description=__description__) parser.add_option("-i", "--input", dest="input", defa...
f834ccb692673af759e88da85af8d81323b73c404bcf4d5a15370c891b3cddf6
Python
4,294
157
from matplotlib import pyplot as plt import numpy as np from typing import Optional, Union from anndata import AnnData def QC_plot( adata: AnnData, library_id: str = None, name: str = None, data_alpha: float = 0.8, tissue_alpha: float = 1.0, cmap: str = "Spectral_r", spot_size: tuple = (5,...
678197ad9a4f95c1e2a6bcbbb6e1ef0a724ddaa55f73dd579f70d67b6ae01793
Python
4,295
119
from galaxy.exceptions import ( AuthenticationRequired, MessageException, ) from galaxy.files.models import ( AnyRemoteEntry, FilesSourceRuntimeContext, ) from galaxy.files.sources._defaults import DEFAULT_SCHEME from galaxy.files.sources._fsspec import ( CacheOptionsDictType, FsspecBaseFileSour...
55197f5ce35cc27692fe96734ff34ec78e7e8ef8e96b31c20e86e0a5a4888f95
Python
4,298
141
""" Segment text using DocLayout Yolo model """ import argparse import json import os import cv2 from doclayout_yolo import YOLOv10 def _as_numpy(value): if value is None: return None if hasattr(value, "cpu"): value = value.cpu() if hasattr(value, "numpy"): value = value.numpy() ...
92dfdf3c0a5403b400990e1bc74f257b3c9a7fb07f87df6d288a7d42a6329c0d
Python
4,299
140
from permacache import permacache, stable_hash, drop_if_equal import tqdm.auto as tqdm import numpy as np from modular_splicing.evaluation.predict_motifs import predict_motifs from modular_splicing.utils.run_batched import run_batched def is_kaway(arr, k): """ Takes a boolean array (batch, sequence) and ret...
cca5a6a3d70649d6967425cf909cf6243dae8e3927a06a3b7cf1efa06386c62c
Python
4,299
135
"""A06 capture-options truth: ``save_grads`` predicates are honored. WALKTHROUGH list-A row 10 (first clause): the trace path silently DISCARDED selector/callable ``save_grads`` predicates -- ``callable -> "all"`` -- so a narrowing predicate saved EVERY gradient (memory blowups on real models). Predicates now ride the...
dcfbf3964e5a86219f9a130f89413b573cf2839788429c68de3bf284e967655b
Python
4,299
133
__author__ = 'quentin' class BaseIntVariable(int): """ Template class for defining arbitrary variable types. Each class derived from this one should at least define the three following attributes: * `sql_data_type`, The MySQL data type. This allows to use minimal space to save data points. * `hea...
2a2aa08ddfadb86c712a5f0101e7644840021bb24421803eb6da1d1df78f52f4
Python
4,300
79
import argparse class AcquisitionParameters: # spot: str # xOffset: int # yOffset: int # path: str # name: str # geometry: str # laserOffsetX: int # laserOffsetY: int # acqtype: str # ceTable: str def __init__(self, args): parser = argparse.Argument...
bcbabb2e7f453d957786a4388470a54cb1dfe166f3d8b55c7fcab811da204003
Python
4,300
152
import os import numpy as np import torch from modular_splicing.utils.io import load_model, model_steps from modular_splicing.utils.entropy_calculations import hbern from permacache import permacache @permacache( "spliceai/statistics/model_sparsity_2", key_function=dict(path=os.path.realpath, step=int), ) ...
ea379d1ac0ab50e698c8b61b017d5e365409d2cce2189d36805ca5ffc6a56731
Python
4,301
87
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
946520d496a261408466cc4b0c6fa4f9222ea0309a2bbd2d02b39cc8d95ae09c
Python
4,302
115
# utils from torch_geometric.data.data import Data from sklearn.model_selection import KFold from GNNSubNet import GNNSubNet from GNNSubNet import GNNSubNet as gnn import ensemble_gnn as egnn import copy import numpy as np import random def split(gnnsubnet: GNNSubNet, split: float = 0.8, random_seed: int = 42) -> tup...
a275db8294616a94d7711b535ba8cd544da1684a7c7dd51f8eaeec2307899c86
Python
4,302
93
# segment cells and save csv file of cells in organoids per well #imports from pathlib import Path import zarr import pandas as pd from stardist.models import StarDist3D from csbdeep.utils import normalize from skimage import measure import configparser import argparse import numpy as np #function definitions def loa...
cac9074128f1048f1f33fefdb4f531fed029fdd1469bd2479e8314c13a229f60
Python
4,303
135
""" Many models in Galaxy are not meant to be removed from the database but only marked as deleted. These models have the boolean attribute 'deleted'. Other models are deletable and also may be purged. Most often these are models have some backing/supporting resources that can be removed as well (e.g. Datasets have da...
de7b83ffb7ce809e99e84f8a4fc10ae5215e99e0930de9dba5b61a7089d7ea00
Python
4,304
123
# some of the code is from https://github.com/JinmiaoChenLab/SEDR import os import scanpy as sc import pandas as pd from pathlib import Path from scanpy.readwrite import read_visium from scanpy._utils import check_presence_download import numpy as np import seaborn as sns import matplotlib.pyplot as plt def plot_clus...
00eea84c08301bce3a5555d32afddb6bad04f0d2de2923f2744ab0376742b74f
Python
4,305
142
import os import sys import pandas as pd import anndata as ad from pyprojroot import here proj_root = str(here()) sys.path.insert(0, os.path.join(proj_root, "package/python")) from myanndata import grouped_obs_mean, get_barcode2group from utils import set_file_logger # * configs resource_dir = f"{proj_root}/19.snap...
1a55df502a9e1a0c25f6d0ff58f620c6b1c65db93264c7414ccae4df309cba02
Python
4,305
105
"""Shared-root corruption plant for the capture-oracle characterizer. b9-sol R75-1: ``_characterize._snapshot_events`` derives ground-truth events from the captured journal THROUGH the shared inverse oracle adapter (``producer_parity._oracle_adapter.op_event_from_record``) — the same root the production ingest migrati...
949a6f440e0541f9337a19e47a896be6f28ae3d5abe3fe0ae14b24358f34773c
Python
4,305
91
import pylustrator pylustrator.start() import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from copy import deepcopy datasets = ["mnist", "fashion_mnist", "cifar10", "letter_mnist"] experiment = "no_bias_gaussian_weights_128" decays = [15, 30, 45, 60, 75, 90, 180, 285, 390, 480, 600] # ...
0afbbeeb0548246571664d2cdc849858ab6d007ed994fdc24e479523eb595640
Python
4,307
152
"""Convert poly2d to mask/bitmask.""" import argparse import os from functools import partial from multiprocessing import Pool from typing import List import numpy as np from PIL import Image from scalabel.common.parallel import NPROC from tqdm import tqdm from bdd100k.common.utils import group_and_sort_files, list_...
5ecf60c6ef137cd43dacb89783b9446cfca64c03d249e4cbcdd0da6c91a647f8
Python
4,307
103
import os import glob from PIL import Image help_msg = """ The dataset can be downloaded from https://cityscapes-dataset.com. Please download the datasets [gtFine_trainvaltest.zip] and [leftImg8bit_trainvaltest.zip] and unzip them. gtFine contains the semantics segmentations. Use --gtFine_dir to specify the path to th...
a364720d1d43f80a72a66daf910cf733bbb7875d3f7aa7595ff2a7e175bc3fb9
Python
4,307
117
''' @saulzhang The implementation code of LoG filter algorithm by convolution filter approximately data: Nov,16,2019 ''' import torch import torch.nn.functional as F import numpy as np import torch.nn as nn from torch.autograd import Variable from math import exp from PIL import Image from torchvision.utils import sav...
a9390b4889249b21cca94574b24993e20ecc8889bee477f6880e61ec9644f1c8
Python
4,307
122
import sys import argparse import modeling import data_prep import os import numpy as np import scipy import matplotlib.pyplot as plt import pandas as pd from tensorflow import keras from sklearn.model_selection import train_test_split parser = argparse.ArgumentParser() parser.add_argument("library", help="name of lib...
00224302665bc03ad902f3be2ec1e745a79ffbc297edeb0cd4bc55520957b4bc
Python
4,308
133
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in July 2020 @author: Pierre Pebereau <pierre.pebereau@telecom-paris.fr> @author: Alexis Barreaux <alexis.barreaux@telecom-paris.fr> """ from typing import Union import numpy as np from scipy import sparse from sknetwork.topology.weisfeiler_lehman_core import...
049983295c92d860cd3fe8f61d2f6fc26f079f000780c4391d8d59792bf85546
Python
4,308
113
import os import logging import tempfile import unittest import arviz as az from pathlib import Path from pmsurv.models.exponential_model import ExponentialModel import tests.syntheticdata logger = logging.getLogger(__name__) class TestExponentialModel(unittest.TestCase): def test_setup(self): logger.in...
68111a1cafe0f782ef96a849077b98b8e6042dafd40ff29d87d3f9df365452c0
Python
4,308
96
import pandas as pd import numpy as np from nilearn import image from nilearn.masking import apply_mask # Set input and output paths data_dir = './Pilot_N3' ROIs_dir = f'{data_dir}/ROIs' fmri_prep = f'{data_dir}/derivatives/fmri_prep' fstlvl_dir = f'{data_dir}/derivatives/fmri_prep/firstlvl_out/contrast_files' df_out...
a7b3a97414c2695d7686ca8ace97c31b2ccc113c1cb83905330652197d7a2224
Python
4,308
173
import numpy as np import pandas as pd import pytest import pynapple as nap from pynapple.core.base_class import _Base from pynapple.core.time_index import TsIndex from pynapple.core.time_series import _BaseTsd class MyClass(_BaseTsd): def __getitem__(self, key): return key def __setitem__(self, ke...
ec1d003f654ad41d75098adb93045273a6a80bd33a3e8e9f22652855f9ce9681
Python
4,308
124
"""Worker Task Consumer Bootstep.""" from __future__ import annotations from kombu.common import QoS, ignore_errors from celery import bootsteps from celery.utils.log import get_logger from celery.utils.quorum_queues import detect_quorum_queues from .mingle import Mingle __all__ = ('Tasks',) logger = get_logger(...
ae717a01c20b66bc391ee0c3878409fe7c7d4f8abbd4d4526cbe80bea43cdecc
Python
4,309
117
import torch import torchvision import logging import os import pandas as pd from pathlib import Path import numpy as np logging.getLogger(__name__) def validate( model, loss_func, validate_loader, device, epoch): # loader adapted from deep learning in pytorch book for name, loader in [("Vali...
aa5f99b25158d62956481dc04e40c3723b9719bae4df342bd0c9cd3affd13a79
Python
4,310
112
#!/usr/bin/env python3 """ File: prepare_bryois_genotype_dump.py Created: 2022/01/26 Last Changed: 2022/02/10 Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of ...
3c6873fd258aedebc1e592b8088027a58a8d22f54d0af8d0fabf5a4f9ae91ebe
Python
4,311
129
# ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function of the ``tfep`` library. """ # =============================================================================...
41fe6245d2fd76a1126c1101e57da1a284930acd5a338675d32ab9a06459c0c8
Python
4,311
119
import numpy as np from mne.time_frequency import psd_array_multitaper from meegkit.dss import dss_line import matplotlib.pylab as plt import numpy as np import copy def nan_basic_interp(array): nans, ix = np.isnan(array), lambda x: x.nonzero()[0] array[nans] = np.interp(ix(nans), ix(~nans), array[~nans]) ...
460a7755ed707c3ff1f786ec3f6c32d6fa6ceb71cc0a13feffe5d56e2e07a8a6
Python
4,311
146
""" Methods for managing shapely-based metrics """ from __future__ import annotations from typing import Any from shapely import geometry __all__: list[str] = [ "segments_intersection", "detect_nearest_obstacle", ] def segments_intersection( segment_1: tuple[geometry.Point, geometry.Point], segmen...