sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d38667078d0638bc3bcda0220a209ac1f01be89f85f3df636541143c8297eab5
Python
3,216
89
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.4 # kernelspec: # display_name: tutorialAlice # language: python # name: tutorialalice # --- # + from pathlib import Path import re imp...
4921fc905aa2507a44a21c11b6f0f82b4959c6dba9355bd7d91bbe301098dbac
Python
3,217
84
""" Multi Step Attention for CNN """ import torch import torch.nn as nn import torch.nn.functional as F from bioseq2seq.utils.misc import aeq SCALE_WEIGHT = 0.5 ** 0.5 def seq_linear(linear, x): """ linear transform for 3-d tensor """ batch, hidden_size, length, _ = x.size() h = linear(torch.transpose(x...
717ead7fe8019e72a3fe45a16946abbb77156e15d66e0abeca7e033200af2541
Python
3,217
120
"""09. Run an object detection model on your webcam ================================================== This article will shows how to play with pre-trained object detection models by running them directly on your webcam video stream. .. note:: - This tutorial has only been tested in a MacOS environment - Pyt...
fb52102c3d5089a4b7c925d952a14b2af1951908e4bebc19ab81b527d46de215
Python
3,217
93
__author__ = 'quentin' from ethoscope.utils.description import DescribedObject from ethoscope.core.variables import BaseIntVariable from ethoscope.hardware.interfaces.interfaces import DefaultInterface from ethoscope.utils.scheduler import Scheduler class HasInteractedVariable(BaseIntVariable): """ Custom v...
55fd522e1dcecdf445bfe6129a1fcf98a11cd717a9fdfc5ab03340f8fac20928
Python
3,219
97
"""this script is used to help Process dataset for tracking mainly crop data like_SiamFC""" import numpy as np import sys from ..filesystem import try_import_cv2 def crop_hwc(image, bbox, out_sz, padding=(0, 0, 0)): """ crop image Parameters ---------- image: np.array, image bbox: np or list,...
89b345b3d74f563769f92f17585281aba975bef0143140955c5886ad162abc0e
Python
3,219
88
from collections import defaultdict def _get_node_successors(edges, from_id_col, to_id_col): edge_cnt = len(edges) node_successors = defaultdict(list) from_ids = edges[from_id_col].to_list() to_ids = edges[to_id_col].to_list() for i in range(0, edge_cnt): node_successors[from_ids[i]].appen...
981621462e939b7538ddb7191e769367d9840354c7c5d37d99a3cedb15c00153
Python
3,219
93
"""grind-p3 T11.8: RNG-monitor teardown always drains the restore queue. ``_teardown`` latches ``_torn_down = True`` at entry and its per-restore guard caught only ``Exception``, so a ``BaseException`` (a Ctrl-C landing in the registry/profile steps or inside one patch restore) escaped mid-unwind and permanently stran...
7e5ffd7338eab4da56f2e6264b4e8750b85826ac5a6b86ec2b5c65cc8fb0dea9
Python
3,220
75
# If the CT and masks are already available as NIFTIs # it's only necessary to perform the FSL operations. # This was the case with the dataset from Maastro. import csv import os from dcmrtstruct2nii import dcmrtstruct2nii, list_rt_structs FSL_DIR = "FSLDIR" if __name__ == '__main__': # Temporary folder to save ...
75ce54749e2f166ed87990d8f4c7cd7178f543886eee84da3525d075437c5f44
Python
3,221
115
#!/usr/bin/env python3 """Run tests locally by calling Docker.""" import argparse import os import subprocess def _get_parser(): """Parse command line inputs for tests. Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentD...
77008321d0b19843bf6ca075f9084e22030dfd01e12f2862f912312faefeffe2
Python
3,221
110
"""Convert COCO panoptic segmentation format from BDD100K bitmasks.""" import argparse import json import os from functools import partial from multiprocessing import Pool import numpy as np from PIL import Image from scalabel.common.parallel import NPROC from scalabel.common.typing import NDArrayI32, NDArrayU8 from ...
bb132fea482d9daf0a7c49efb1b8b5f14aebe2942e9d79a09889fdb6c69c15db
Python
3,222
87
#!/usr/bin/env python """Compare the current expected results file with the old expected results and plot the difference. """ """ Copyright (c) 2015, Blue Brain Project/EPFL All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the fol...
9a2250c00308e240139579f87ed85f7b02fb10afd3cd2e9dbe5aceeaf0752726
Python
3,223
89
"""Mypy strictness ratchet: the flag set may only ever GROW. R68 (3 consecutive hunt passes): the claimed mypy "package ratchet" was a comment — zero strictness flags beyond ``check_untyped_defs``, nothing pinning the config, so a lane could narrow it (or the claim could stay aspirational) without any gate noticing. T...
ae081d3bd06501a026b2e724d7f815588c901f2c4b6eb68ff094ba908950843e
Python
3,223
79
import pickle import torch import torch.nn.functional as F # from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,\ SimpleEncoder,LocalDis...
ef0af7e1041d3c78b6e4a627e9484a759d791106782234400469422591a4248b
Python
3,223
86
import dominate from dominate.tags import meta, h3, table, tr, td, p, a, img, br import os class HTML: """This HTML class allows us to save images and write texts into a single HTML file. It consists of functions such as <add_header> (add a text header to the HTML file), <add_images> (add a row of imag...
7e933317b7baad5367fae4d17feff3008f776df8b120e692d40df80418c4612a
Python
3,225
87
import os import torch from tqdm import tqdm import schnetpack as spk class EnvironmentTypes: def __init__(self, loader, model, device=torch.device('cuda')): self.loader = loader self.model = model self.device = device self.max_n_atoms = 30 for batch in loader: ...
c5fee7394c6ef0fbce8cf8ecebbe760a6fd6e0a25833c122bc71d818ea3e3912
Python
3,225
87
import numpy as np import tensorflow as tf import sys import os sys.path.append("../utils") from func_model import extraData, apply_rev_comp, train, evaluate os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # tf.config.threading.set_intra_op_parallelism_threads(5) tf.config.threading.set_inter_op_parallelism_threads(10) #--...
df4c15d5ee0574281660425b70e74007d561a433f807dd1ed960cc8192b039f7
Python
3,225
93
import os import pickle from copy import deepcopy from typing import Tuple from drug_interactions.reader.dal import DrugBank, DrugDAL, Drug from tqdm import tqdm class DrugPreprocessor(): """ An object that contains all the preprocessing methods for the drug bank. Attributes: path: A string of t...
80fd2905c88318bbe6aa77858efed56ea14886eb14be4f9b993bbc3634038312
Python
3,226
93
# import the pyabf module from this development folder import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_SRC = os.path.abspath(PATH_HERE+"/../../src/") PATH_DATA = os.path.abspath(PATH_HERE+"/../../data/abfs/") sys.path.insert(0, PATH_SRC) # for importing sys.path.append("../../src/") #...
f9299d902db6328da477e0aa613080cf48a887c55d569d3ae951d35f29d87925
Python
3,226
112
import numpy as np from numpy.random import default_rng, SeedSequence import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from tqdm import tqdm import multiprocessing from multiprocessing import Pool, freeze_support, current_process, RLock from functools import partial import pathlib from causal_...
7a1cc79739a14718b018b01e6c65abf7e3a5c39bacb80d541ac4ed600c6cd718
Python
3,227
43
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
86c8d9147163e3623b262d58d00cf6239dfe9df50376f681bdb50f825a784422
Python
3,227
85
import argparse import pandas as pd from pyfaidx import Fasta from statsmodels.stats.multitest import fdrcorrection import sys def get_sequence(region): print(region) key, start, end = region.split("-") tmpseq = chrs[key][int(start):int(end)].seq return tmpseq.upper() parser = argparse.ArgumentParser(...
bf301c5fbdf6c95667f0f3a1ae7f07f88164e6c02b9096a4d40912bf396b8e11
Python
3,227
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 pytorch_l...
14b18cb20d87a2b568be02d2d5243d363ac237d9342c16f9f7c58f3501c167ac
Python
3,229
108
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module providing :class 'DataGenericWriteProxy' representing data file. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import abc import numpy from . import signal_log...
51f622facac2f00080c04b807fe5cc701a5f4108ff5db788a2c3852949d5ce1e
Python
3,230
78
#!/usr/bin/env python import pandas as pd import os import sys import sqlite3 import argparse from sqlalchemy import create_engine import csv def read_promoter_file(promoters): col = ['frag_chr', 'frag_start', 'frag_end', 'frag_id', 'gene', 'project'] gene_prom = pd.read_csv(promoters, sep = "\t", names = co...
fcae2fab98a39b3e5beb267b66ca7cb721343b1baedfbbeac5ef75891aaeb91a
Python
3,230
109
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 from anndata import AnnData import warnings from stlearn.plottin...
84dc73a420fd6782635a2d55db18823948354756affab9d8a7ec655da106c52e
Python
3,231
108
"""Multi-exit module lookup collision tests.""" from __future__ import annotations import pytest import torch import torchlens as tl from torchlens._errors import AmbiguousOpLookupError class TupleExit(torch.nn.Module): """Module returning two output tensors from one module call.""" def forward(self, x: t...
7fbba99b1e30e0ebdd6a9fd4ff9308f309a4b69c2d11a870cd5b20e4c1474527
Python
3,233
109
# This example requires the following dependencies to be installed: # pip install lightly import pytorch_lightning as pl import torch import torchvision from torch import nn from lightly.models import utils from lightly.models.modules import MaskedVisionTransformerTorchvision from lightly.transforms.mae_transform imp...
f763e6c95d531882fb57ab93d185b61ff920dd18d3387869391cf65546442ba4
Python
3,235
93
import pytest import numpy as np import nway.meta_registration as mr import nway.transforms as tf @pytest.mark.parametrize("include_original", [True, False]) def test_MetaRegistration_init(include_original): m = mr.MetaRegistration(include_original=include_original) names = [] for candidate in m.candidate...
4d289a97950476841f354182aa88fbbc3a96e94c525cea8eb0a290a08c8db958
Python
3,236
99
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
7b20b239a0933964ddeaeaa9bd09b3e4797057756fcb98f93cbecfa050ca661e
Python
3,236
83
from __future__ import annotations from pathlib import Path import zipfile from larvaworld.portal.datasets.discovery import discover_raw_datasets def test_discover_raw_datasets_returns_empty_for_missing_root(tmp_path: Path) -> None: candidates = discover_raw_datasets("Schleyer", tmp_path / "missing") asser...
a87f4aeab3a96e9738ebe58a051edc02abff75074b4621431cca0d0bc8d157cd
Python
3,236
72
import os import XML_Parse as parse from collections import Counter import numpy as np import pandas as pd import matplotlib.pyplot as plt ####################################################################################################################### # Branch Number Analysis required functions: def branch_...
ebd2ac3cd13975ceb9848e6014a93fd6771c6be5e7115f583887333fcaaf815c
Python
3,236
61
from dataProcessing.modules import * import pandas as pd from torch.utils.data import DataLoader class Data: def __init__(self, directory, module, subseqlength, emb_word_len, need_train): print("#################################################") print("Read training, validation, test datasets, an...
2c64d598dd65af856ead25ddd9efedd3d53b2b051956766a95bc150bd184b751
Python
3,237
94
import networkx as nx import numpy as np from stlearn.utils import _read_graph def shortest_path_spatial_PAGA(adata,use_label,key="dpt_pseudotime",): # Read original PAGA graph G = nx.from_numpy_array(adata.uns["paga"]["connectivities"].toarray()) edge_weights = nx.get_edge_attributes(G, "weight") G.re...
c6a63f6fff8293b232c0a8dc8c457a53a9b7035090f74f8fe4745efd4d5638a3
Python
3,237
82
from dataclasses import dataclass from typing import Optional, Tuple import torch from transformers.file_utils import ModelOutput @dataclass class BaseModelOutput(ModelOutput): last_hidden_state: torch.FloatTensor = None last_pair_repr: torch.FloatTensor = None hidden_states: Optional[Tuple[torch.FloatTen...
ab5908d0fe66ee801cb81014705c70c4d408d66c8d1589ba217915d8e79596d0
Python
3,238
71
import numpy as np import pytest import vampire.common as common import vampire.xcr_vector_conversion as conversion def test_pad_middle(): with pytest.raises(AssertionError): conversion.pad_middle('AAAAA', 2) assert 'A---B' == conversion.pad_middle('AB', 5) assert 'A--BC' == conversion.pad_middle...
06f447d4dedd4a11ab506a7a1c3fa8bb6435f7dcd5e947f380b63c85e320ae66
Python
3,240
96
import os import sys from pathlib import Path import pandas as pd import pytest from larvaworld.lib import reg, sim RUN_WINDOWS_HEAVY = os.environ.get("LW_ENABLE_WINDOWS_HEAVY") == "1" pytestmark = [ pytest.mark.integration, pytest.mark.heavy, pytest.mark.skipif( sys.platform.startswith("win") a...
c7e50a7b4ce8fcefd472f221f49098df286f0e935f914f15b5fe4f462cef1a65
Python
3,240
104
from pathlib import Path import shutil import tempfile from typing import Union, Optional, List, Tuple import functools import warnings import numpy as np import pytest import face_rhythm as fr """ WARNING: DO NOT REQUIRE ANY DEPENDENCIES FROM ANY NON-STANDARD LIBRARY MODULES IN THIS FILE. It is intended to be run...
0e0c6c4afb0e0a593b1cb7198f2f723629e6b494b6741b362a6c416d60836107
Python
3,241
89
import numpy as np from modular_splicing.motif_perturbations.compute_perturbations import ( motif_perturbations_individual, ) def compute_effect( model, exon, effect_thresh, cl, *, kind_of_effect="linear", minimal_probability_requirement_for_effect, always_include_at_least=5, ): ...
1995213c1c2b464ac89d923e7fdc47d51a506460d0b1730738010dba6e1705b2
Python
3,241
87
"""R10-3: the op_log_fields invariant on LOADED torch artifacts. ``Op.func`` is ``FieldPolicy.DROP`` and ``__getstate__`` hard-nulls it, so ``callable(lpl.func)`` false-fired on EVERY loaded torch trace — the torch-only ``op_log_fields`` contract had zero loaded-torch coverage (the only loaded callers were non-torch b...
46433f6fd5291310aaba1716238ab7b840db49ce1f7aabda24f5b47778a689ae
Python
3,242
106
""" Creates a feature location index (FLI) for a given BED/GFF file. FLI index has the form:: [line_length] <symbol1_in_lowercase><tab><symbol1><tab><location> <symbol2_in_lowercase><tab><symbol2><tab><location> ... where location is formatted as: contig:start-end and symbols are sorted in lexig...
8a786a289fc18fa975f5eadc21139da19dc48986357c235a4d9f41cb0cc7d424
Python
3,242
77
import unittest from unittest.mock import MagicMock, patch from cellxgene_gateway.cache_entry import CacheEntry from cellxgene_gateway.cache_key import CacheKey from cellxgene_gateway.items.file.fileitem import FileItem from cellxgene_gateway.items.file.fileitem_source import FileItemSource from cellxgene_gateway.item...
da8fd5cca7f16773ad19c894f415b99e5e35252f4470cfcfd680448978de9b72
Python
3,242
107
import types import torch from LRP.layers_ours import ( forward_hook, safe_divide, RelProp, IndexSelect, ) from LRP.BERT import BertModel import torch.nn.functional as F def convertProtBertToLRPModel(model): # Relprop of TransformerClassifPerProtLayerNorm model.forward = types.MethodType(forwa...
1f0b876f4310fde903bb045d3c25b3bf4dbb3d3809e376fa1eb955fe6679d128
Python
3,243
109
import torch import torch.nn as nn class MotifModel(nn.Module): """ Represents a motif model that classifies a sequence as either matching or not matching a given motif. """ def __init__(self, hidden_size, window_size): super().__init__() self.conv1 = nn.Conv1d(4, hidden_size, ker...
35276e9bba92b0b6faae2f84ca1ed54627f21f2a7095f92361ec7e7eddd59f1b
Python
3,243
114
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Workflows for collecting and saving anatomical outputs.""" from nipype.interfaces import utility as niu from nipype.pipeline import engine as pe from niworkflows.engine.workflows import LiterateWorkflow...
6e32a2745c52ed0bd59c0c73553cdaa4b064e01b45dd7060d00ecb5883e2b4d1
Python
3,243
87
"""The :program:`celery beat` command.""" from functools import partial import click from celery.bin.base import LOG_LEVEL, CeleryDaemonCommand, CeleryOption, handle_preload_options from celery.platforms import detached, maybe_drop_privileges @click.command(cls=CeleryDaemonCommand, context_settings={ 'allow_ext...
78543f08089fda8da2a1032329b2d7c8536a90db96ffdecece6e0d68fd6fe952
Python
3,243
84
"""R1 core plumbing tests (memo A1/A2/A6): the three-checkpoint core, offline. Minimal real-checkpoint rows proving the registry -> preflight -> offline fixture pipeline end to end; the RG gallery (B1) builds on these fixtures. Every assertion is payload identity against an independent same-process rerun -- never the ...
90c24059cac213b9c7d0fea2d0415f66998b38f3d4b38b5e0c3525c6a2252c5e
Python
3,243
101
#!/usr/bin/env python """Convert GlimmerHMM gene predictions into protein sequences. This works with the GlimmerHMM specific output format: 12 1 + Initial 10748 10762 15 12 2 + Internal 10940 10971 32 12 3 + Internal 11035 11039 5 12 4 + In...
041c85364263ee88b9e8d227f78b042fc5948ba46e3f1e657c0db6897299b696
Python
3,244
84
import numpy as np import pandas as pd from tqdm.auto import tqdm from .._utils import _k_largest_index_argsort TINY = np.finfo(float).tiny def get_activators_n_seqlets( activations, sequences, kernel_size, padding=0, num_seqlets = 100, num_filters=None ): num_filters = num_filters if ...
bff7f7ed61f7474999444765e4ad38497a13ff816a9b5cbc5d6f9aa5fc432426
Python
3,244
112
#!/usr/bin/env python from __future__ import print_function import xml.dom.minidom from xml.parsers.expat import ExpatError import argparse import sys import re description = """ This script converts the default Release Notes from JIRA to a ITK's wiki format. Specifically input such as: <h2> Epic </h2> <ul>...
cddff9b6b230ab5dffa19ea758a1509df79ab11414f8b54ac09562f6947c2993
Python
3,244
77
"""M10 ratchet: every Trace field has exactly one owning component. The declared ownership map (``_trace_components.py``) is the design artifact the Trace decomposition executes against. This test is the ratchet: a new Trace field without a declared owner — or a stale map entry — fails here, so the god object cannot r...
8e3dfabb8dfba6e6904bb6bdb7ee257f28d815708b405d1ee1b24095a7e9e0d1
Python
3,245
79
import logging from typing import Optional from carbonserver.api.errors import NotAllowedError, NotAllowedErrorEnum, UserException from carbonserver.api.infra.repositories.repository_projects import ( SqlAlchemyRepository as ProjectSqlRepository, ) from carbonserver.api.schemas import ProjectCreate, ProjectPatch, ...
c4ea998e90aed657b6dc9e067d62fd5cc96c7603ca714ddc6903ef4c0efc82c0
Python
3,245
106
import logging import yaml import copy import argparse import numpy as np from pymatgen.core import Molecule from atomate.qchem.fireworks.core import SinglePointFW from atomate.common.powerups import add_tags from fireworks import LaunchPad, Workflow from instance_mongodb import instance_mongodb_sei from firework...
040295313e768f8c0357b92ad99f01750700b16da8187349eff99518a84276de
Python
3,246
111
model = dict( type='MoCo', queue_len=65536, feat_dim=128, momentum=0.999, backbone=dict( type='ResNet', depth=50, in_channels=3, out_indices=[4], norm_cfg=dict(type='BN'), init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), neck...
2d391bd84e4c6d57238e5cbb6fd49297476612a940e5938155e71a8463e1b59b
Python
3,246
113
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 14:43:07 2023 @author: longzheng """ from keras.models import Sequential, load_model from keras.layers import Conv2D, MaxPooling2D, Dropout, Dense, Flatten from keras.optimizers import Adam import pandas as pd import deepchem as dc import numpy as np from keras.callb...
61f341b9a0ccdaa0e610749f34360064211f42a3a5df7760cbb0d45c1db46e86
Python
3,247
119
#!/usr/bin/env python3 import os import pandas as pd f_1 = open("files.txt", "r", encoding = "utf-8") filename = [] i = 1 for file_1 in f_1: line_1 = file_1.strip().split('\t') filename.append(line_1[0]) f_1.close j = 0 list_all = [] list_title = [] for file in filename: samplename = file.split('.')[...
46dcd0f46a127142dde9893fe0c02be28acae64b133cde6f5f922c833fb0b821
Python
3,248
70
import glob import sys import pandas as pd from nilearn.glm import compute_fixed_effects def fixed_effect(sub, task_type, contrasts, input_path, output_path, save_beta=True, save_var=True, save_tstat=True): """ This function takes in a subject, task label, set of computed contrasts using nile...
e4770b851a468bd55c8862aeea333590178555f40a707b2c60f1fbbca65506f8
Python
3,248
106
import os import platform import sys from pathlib import Path from pkg_resources import parse_version from setuptools import find_packages, setup def main(): version_file = Path(__file__).parent / 'VERSION' with open(str(version_file)) as fin: version = fin.read().strip() install_requires_base =...
91dab0840f679f8543ae836dd6a0c2c8115adae07da7390e842fd64312718cf7
Python
3,249
122
import abc import copy import numpy as np class BaseShape(abc.ABC): def __eq__(self, other): same_cls = self.__class__.__name__ == other.__class__.__name__ try: same_sig = np.allclose(self.to_point_signature(), other.to_point_signature()) exc...
04b0f4caed899e62c01482a216c7bbcbbd8ed8027127e8e4e2ef6224c344006a
Python
3,250
75
import numpy as np from tqdm import tqdm from mp_dip.utils.interpolate_head_features import get_positions, interpolate_feature def prepare_data(examples, mp_params): """for mmp3""" # [ number of examples, number of atoms, number of channels, number of atom features # bad, it should be "same features, vs...
cfb846b550c434602e2a0d7e166539b973e9a77ce29bb25813d1802e62f3f0ea
Python
3,250
89
from utils import * import os import pickle import math import numpy as np import torch import torchvision from torch import nn from torchvision import datasets, transforms import matplotlib.pyplot as plt from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader, Dataset, Subset from torchvi...
92d1a79a1767a0261cc1bb06f0588a54db634c5e7ac036deed87b57be5f9c344
Python
3,251
86
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
ed43c643b3cb86cd81ce812fb1736bbe7e4f5f1297c3440fe90ef237d5324e09
Python
3,251
116
from pathlib import Path import re from natsort import natsorted # Our modules import data def ls_cohorts(): return [f.name for f in Path(f'data/').iterdir() if f.is_dir()] def get_weights_tree(basepath): node = {} node['dirs'] = {} node['fnames'] = [] for f in basepath.iterdir(): ...
13adfc123eceb9f434154b24e5e384530e0d215bb15df1fbcb008c25cecda999
Python
3,252
103
""" Unit tests for the Monitor class. This module contains tests for the core Monitor functionality that coordinates the tracking pipeline. """ import threading import time from unittest.mock import MagicMock, Mock, patch import pytest # Note: Actual imports would need to be adjusted based on the real module struct...
5b4f8692f35eb67a18c31be8610f62cf97d19645a0e97e2babf293639390c86f
Python
3,252
79
"""Plots for the time model object. Notes ----- This file contains plotting functions that take as input a time model object. """ from itertools import cycle from specparam.utils.select import find_first_ind from specparam.plts.utils import savefig from specparam.plts.templates import plot_params_over_time from spec...
669fc3c94689aec42a0c884f4272e26716b6bc87cdbcb139e9cd89d9556cc3c4
Python
3,252
123
#!/usr/bin/env python3 # ---------------------------------------------------------------------------------------- # Imports and paths import os import sys import importlib my_path=os.path.dirname(os.path.realpath(__file__)); # Make sure biswebpython is in your path n=os.path.abspath(my_path+'/..') sys.path.insert(...
78ef117c7747b7e47f202ab78e19c4c25150ba108dfb1ab3d3979047d34efbc6
Python
3,252
108
"""Smoke coverage for predicate-mode capture dispatchers.""" from __future__ import annotations import time import torch from torch import nn from torchlens import _state from torchlens.backends.torch.model_prep import ( _cleanup_model_session, _ensure_model_prepared, _prepare_model_session, ) from torc...
3225915b2fd8720364a713f5ed2a9f5c6f7f4f0533ceda9ce7397c70a8cdbbe4
Python
3,253
86
# validate cross correlations for a single set of mfov comparisons # as dumped from mfov using the export_xcorr_comps_path hack. import time import tifffile import dill import os import re import numpy as np from xcorr import BatchXCorr from rcc_xcorr.xcorr import XCorrUtil as xcu export_xcorr_comps_path = '/gpfs/s...
6a1a5b58e05dc8f10c9351daff539671a46e6032bacb0ad734593f163002abcf
Python
3,253
101
####################################################################################################### ##################### Preprocessing for multi-task models ############################################# ####################################################################################################### import...
87771b870fdc0a21d7e74e68d192cf0d3efd557e501522455401d4763a782975
Python
3,253
90
#========================================================================== # # 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...
a685c3736442da5d16abc36a2d78cf5c872e47d27eda7a7de83f9d9a4607637b
Python
3,253
105
import os import shlex import subprocess import h5py import numpy as np import torch import torch.utils.data as data BASE_DIR = os.path.dirname(os.path.abspath(__file__)) def _get_data_files(list_filename): with open(list_filename) as f: return [line.rstrip() for line in f] def _load_data_file(name): ...
6c54393480e8f9762fdf350b317d1be011030571881ee02b8f721f408dee60a8
Python
3,254
101
"""Util functions.""" import os import os.path as osp from itertools import groupby from typing import Dict, List, Tuple from scalabel.common.io import load_config from scalabel.label.to_coco import get_instance_id from scalabel.label.typing import Label from scalabel.label.utils import check_crowd, check_ignored fr...
815c7699eeada763baf05de1956f4df0bac164ac8827cdd194d00230131ab5a5
Python
3,254
94
# 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...
a5389a152146d37446ff0cb378a4d2162f13bd65ffa153f12dbc57ff86b33ac2
Python
3,254
105
# --- 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 Selected(_BaseTraceHierarchyType): _parent_path_str = "bar" _path_str = "...
a9f9d0bb14952987b45aa434f45c13b6b00c10403b2b26a9d353a52aa6b47006
Python
3,255
103
# Copyright 2023 DeepMind Technologies Limited # # 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 agree...
2a045fc8d8a3846ed314a4d7ec6e1bf64806fcd3530e7b8a361eb41c4398da0b
Python
3,256
91
""" Install tigramite """ from __future__ import print_function import pathlib import os from setuptools import setup, Extension from setuptools.command.build_ext import build_ext import json # Handle building against numpy headers before installing numpy class UseNumpyHeadersBuildExt(build_ext): """ Subclasse...
79ecb54f1c306417182c4bec3792c545e5c810582840f4b7e387cc74582ee758
Python
3,256
81
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
b408b9b8be592db871c102610ce442f0514b6edb0999889cd83506c09333f4aa
Python
3,256
116
import json import pickle import sys from datetime import date, datetime, time, timedelta, timezone from unittest.mock import Mock import pytest from kombu import Queue from celery.utils.serialization import (STRTOBOOL_DEFAULT_TABLE, UnpickleableExceptionWrapper, ensure_serializable, ...
0beee05479cd7809ba7a77014600323ecdc3ac5c5dff16a2fb5c5cc32a4b383b
Python
3,257
90
"""W051-TRACK / AUD-CODE 2.13: the emission ledger is keyed by sink OBJECT. Two sinks of one class (two JSONL files: local + NFS) used to share ONE row keyed by class name: a failure in either latched both, the healthy sink was silently starved from that step on, and the counts merged. """ from __future__ import anno...
becbd1bcb3ea7835898056c6a1276a27e3c150237c91eebf526fa31c57d04370
Python
3,257
76
from __future__ import division import unittest import numpy as np from wyrm.types import Data from wyrm.processing import correct_for_baseline from wyrm.processing import swapaxes class TestCorrectForBaseline(unittest.TestCase): def setUp(self): ones = np.ones((10, 5)) # three blocks: 1s, -1s,...
2b3159dd81119d373c76b1d9f6398c6fe97a02f85dd559331a2cb96fc5965419
Python
3,258
104
# 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...
b165d25eb1bf3b295d6854e555cc4bca6d88f2ecbffa744e0afbb4d88a71a90e
Python
3,258
81
"""Abstract superclass for model training workflows. """ import os import logging import crf_util class Workflow(object): """Abstract superclass for all workflows. Attributes: condition_name (str): String label for current trial. data_dir (str): Path to dataset folder. Set by settings file. ...
56f4b71b4c2b9bff411f707b131e66b0b2ffd54413b42ab91bc74323adc87a6a
Python
3,259
96
from __future__ import absolute_import import sys from pip._internal.cache import WheelCache from pip._internal.cli.base_command import Command from pip._internal.models.format_control import FormatControl from pip._internal.operations.freeze import freeze from pip._internal.utils.compat import stdlib_pkgs DEV_PKGS ...
6edefe5aa2c6f1257c0a79daa829dd642a7f82c1bd2a27ff9f7e0560f81ea776
Python
3,260
120
from sklearn.tree import DecisionTreeClassifier import numpy as np from sklearn.metrics import mean_squared_error ROOT = 0 LEFT = 1 RIGHT = 2 NEG = 0 POS = 1 def clean_str(s): return s.lower().replace('/', '___').strip() def impurity_mse(y): """Lower impurity (closer to 0) is better """ y_mean = np....
a0e74fe4af6b2f7cbf7b621c7aeb97e9e92730acd46e888ae433851d4c467019
Python
3,260
90
import sys from robustness import datasets from robustness.attacker import AttackerModel from robustness.model_utils import make_and_restore_model import robustness.data_augmentation as da from torchvision import transforms import torch import numpy as np from model_analysis_folders.all_model_info import IMAGENET_PATH,...
cc1a96acd6e9ca0b2dcf60002cafbe15a548ca6593ace8594ed2a1d3e9ce3542
Python
3,260
102
"""Models describing the column targets a rule builder workbook can carry. The target definitions themselves live in ``rule_targets.yml``; header parsing onto these types lives in ``rule_target_columns.py``. """ from typing import ( Literal, ) import yaml from pydantic import ( BaseModel, RootModel, ) f...
443209afa275a4e5a7d45ced9ab9c268293597a384220bd0162cc0394ea01741
Python
3,261
100
def get_all_episodes(fn_in): # Input # fn_in : input file # # Output # samples : list of episodes (each has 'xs','ys','xq','yq' structure) # Find range where episodes are present with open(fn_in,'r') as fid: lines = fid.readlines() lines = [l.strip() for l in lines] assert('Evaluation episode 0' in li...
5cfb09bd99db54625a110bfd69cf3e1847f8c83397f86a42ffbbba8719adaeb7
Python
3,261
106
"""add_cascade_delete_for_projects Revision ID: 2a898cf81c3e Revises: f3a10c95079f Create Date: 2025-10-05 11:40:28.037992 """ from alembic import op # revision identifiers, used by Alembic. revision = "2a898cf81c3e" down_revision = "f3a10c95079f" branch_labels = None depends_on = None def upgrade(): """ ...
763fc4055944812bd24d77f063fde4a2da3912a45f2299ae7bfd6db78a1ebc77
Python
3,262
66
"""Default configs for center net""" # pylint: disable=bad-whitespace,missing-class-docstring,bad-indentation import os from typing import Union, Tuple from autocfg import dataclass, field @dataclass class CenterNetHead: bias : float = -2.19 # use bias = -log((1 - 0.1) / 0.1) wh_outputs : int = 2 ...
ccc36bff6051efeb58ed62fa7b7b02392860c219330768412ad805f39ffc9b63
Python
3,262
61
## The generate_custom_model function will generate a model with a custom exon length by Lanczos resampling of the position bias coefficients. It also allows to modify the bias term in the SumDiff layer. import numpy as np from quad_model import * from tensorflow.keras.models import Model, load_model ORIG_MODEL_FILE_...
a60facb24f1a4c094fb5ed988c2a6b6234481a298d65c1cffb5e211f442c72d5
Python
3,263
89
#!/usr/bin/env python3 """ state_geometry.py — Vendored 5D state-geometry feature extractor. Self-contained pure-numpy implementation of `compute_phi_5d` and its dependencies. Originally lived in `paper5_5d/pipelines/reprocess_car_local.py`; vendored here so this testsuite is a complete self-standing deposit that does...
137b400d161087dc640f837c6f4934235a02ec385ee13e50dd9f7fb39c2c5f28
Python
3,264
108
from typing import Any, Callable, Optional, Union from pl_bolts.datamodules.vision_datamodule import VisionDataModule from pl_bolts.datasets import MNIST from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAILABLE: from torchvision import transf...
4401ead4ca020af53dd7ca72cb8836ccf3a47def5b518b47dcc0130a07b22cdb
Python
3,264
85
# coding=utf-8 # Copyright 2024 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...
7221051319fb31fd9e11cc1b531c3757db5ae764c25b3ea007aba8b5fd5871ad
Python
3,264
99
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
c59c6058ec864e78731781c28062822e7191f421bce20d068a54ec27ef0a66e0
Python
3,264
96
"""R10-4: the save-side "is this type/factory load-reconstructible?" predicate was a namespace prefix test (``root in {"torch", "torchlens"}`` / ``builtins``), while the safe unpickler admits torchlens types ONLY on the vetted-inert ``_SAFE_TORCHLENS_TYPES`` allowlist (not appliance modules), torchlens callables only v...
160cedee38013fe797442a590a44a9c48c228c001e8cd265deca12fbf477f18e
Python
3,265
79
import os from functools import partial import torch from safetensors.torch import load_file as safe_load_file from transformers.utils import ( SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from transformers.utils.hub import cached_file, get_checkpoint_shard_files de...
e2cf8e3345afa3da9067c7a76a74866069eb72683ec3e8933a7f1b3bddcdfb75
Python
3,265
100
"""Utilities to report on available options for fitting, modes, evaluations, etc.""" from specparam.modes.mode import VALID_COMPONENTS from specparam.reports.strings import gen_mode_str_lst, gen_mode_params_str_lst, gen_metric_str_lst from specparam.reports.strings import _format #####################################...
0ce92031eb01a8281db7d146ce6b7d91690e4fc93a5bf7939f116e8e733a6444
Python
3,267
113
# 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 app...
f485452a7d5bf0150900baa8654b195b1840f44b94c492765db6ee2fe637f33d
Python
3,267
112
model = dict( type='DenseCL', queue_len=65536, feat_dim=128, momentum=0.999, loss_lambda=0.5, backbone=dict( type='ResNet', depth=50, in_channels=3, out_indices=[4], norm_cfg=dict(type='BN'), init_cfg=dict(type='Pretrained', checkpoint='torchvision...
b6dcfe37d558d3dc6c87fb515908440bc04d557635fcd230dd72235e9ba731c6
Python
3,268
60
import pysam.utils addreplacerg = pysam.utils.PysamDispatcher('samtools', 'addreplacerg') ampliconclip = pysam.utils.PysamDispatcher('samtools', 'ampliconclip') ampliconstats = pysam.utils.PysamDispatcher('samtools', 'ampliconstats') bam2fq = pysam.utils.PysamDispatcher('samtools', 'bam2fq') bamshuf = pysam.utils.Pysa...
1dad802d2f54baf8a77a41671eea4ee08598a68a5739637d5e057b484c2a3706
Python
3,269
127
import numpy as np import scipy.linalg as sl from keras.src.backend.common import dtypes from keras.src.backend.common import standardize_dtype from keras.src.backend.common.backend_utils import standardize_axis_for_numpy from keras.src.backend.numpy.ops.core import convert_to_tensor def cholesky(a, upper=False): ...