sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9e8396b241968848716b18a3ceba6812219fa0e78041e3f6086420c9f3e4aa39 | Python | 9,033 | 285 | # TODO rename this file to something more descriptive
import tqdm.auto as tqdm
import attr
from permacache import permacache, stable_hash
import numpy as np
from modular_splicing.utils.construct import construct
from modular_splicing.knockdown.compute_knockdown import (
compute_with_and_without_knockouts,
)
fro... |
8817cbb5267c4a2c51ab824205f9cdce2a9632ca25e9af9ea2bb54139792451a | Python | 9,035 | 200 | #%% Packages
import os
import torch
import copy
import utils
import warnings
import numpy as np
import tgan_utils
import matplotlib.pyplot as plt
import torch.optim as optim
from TGGAN.TGAN import Discriminator, Generator
import draw_utils
warnings.filterwarnings('ignore')
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
de... |
92e40f1e4cef3f04964b1d240f361e62429e4cc6b53dff8794634acc8d5fbe98 | Python | 9,035 | 257 | """Edge-case tests for train-mode capture."""
from __future__ import annotations
from collections.abc import Callable
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._capture_state_helpers import reset_compiled_model_unwrap_warning_state
from torchlens.... |
0fb88452439aa874bf96bd1d34ae1ac987ea6451e59f05a54138491274f37c08 | Python | 9,036 | 237 | from cmath import nan
import pickle
from matplotlib import pyplot as plt
from numpy.lib import math
from scipy.sparse.construct import rand
from ssm.plots import gradient_cmap, white_to_color_cmap
import seaborn as sns
import numpy as np
import os
import os
from scipy.io import savemat,loadmat
import os
from os import ... |
5e14649a2a072a3dd07568f2f015c831ffca687ab63e6c16030beaaa30a57e15 | Python | 9,036 | 248 | """P1: the non-differentiable summary-transform role (explorer memo item 1).
The refusal surface the memo names -- the trace-side train-mode validator,
its fastlog sibling, the streaming validator, and the grad path -- with the
NARROW declared-role carve-out: a ``summary(fn)`` transform reduces a
detached view after t... |
b73fbd1899accc3eb633bd980d4acabf45577915250d764757fee2a111610946 | Python | 9,038 | 321 | import numpy as np
from skimage.transform import AffineTransform
import PIL.Image
import os
import json
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
from typing import List, Any, Tuple, Optional
def summarize_registration_success(pair_outputs):
"""checks which pairs succeeded in re... |
a0fdb9617b107cd0fe57017e306a253865f419b45e23355cf5225f20fd6b5087 | Python | 9,041 | 309 | """Dependency graph implementation."""
from collections import Counter
from textwrap import dedent
from kombu.utils.encoding import bytes_to_str, safe_str
__all__ = ('DOT', 'CycleError', 'DependencyGraph', 'GraphFormatter')
class DOT:
"""Constants related to the dot format."""
HEAD = dedent("""
{IN... |
b93bac79a54c4979f02bd02e1c81773622091c0ccdbc91077946fa305d6ad8e8 | Python | 9,042 | 262 | """The ``celery control``, ``. inspect`` and ``. status`` programs."""
from functools import partial
from typing import Literal
import click
from kombu.utils.json import dumps
from celery.bin.base import (COMMA_SEPARATED_LIST, CeleryCommand, CeleryOption, handle_preload_options,
handle_re... |
c63abb8a106058588fa37d9350980798309e8741b10cd7fa1d03e11a593eb195 | Python | 9,042 | 237 | from bioseq2seq.transforms import Transform
import random
import re
import numpy as np
def getLongestORF(mRNA):
ORF_start = -1
ORF_end = -1
longestORF = 0
for startMatch in re.finditer('ATG',mRNA):
remaining = mRNA[startMatch.start():]
if re.search('TGA|TAG|TAA',remaining):
... |
6326d96dab27faa1e652bedc5262b8f67d1d5e2708926b0b2e1accc4ac80fbd0 | Python | 9,045 | 270 | #!/usr/bin/env python3
import argparse
import difflib
import json
import zipfile
from pathlib import Path
MANIFEST_NAME = "opencc-resource-manifest.json"
MAX_DIFF_LINES_PER_FILE = 400
MAX_EXAMPLES = 20
def parse_args():
parser = argparse.ArgumentParser(
description="Compare two OpenCC resource zip arch... |
16f753529ccb7bc5a2bd2b4501a36f58df88da88399d8de0e40a4d7ed9463264 | Python | 9,047 | 221 | r"""
Saddle-Node Homoclinic Continuation: the ``mtn`` Demo
======================================================
This gallery reproduces auto-07p's ``demos/mtn`` homoclinic-bifurcation
tutorial — M. Scheffer's predator-prey model with a saddle-node homoclinic
orbit — using PyCoBi's :meth:`ODESystem.continue_homoclini... |
d7a45f5f2abe603ea5b3a093e55aa50aa1c4b726c7f15d86b3adf8baeed6397d | Python | 9,047 | 330 | """Tests for IO-S3 export wrappers across all DataFrame-producing surfaces."""
from __future__ import annotations
import json
import re
import sys
from pathlib import Path
from typing import Any
import pytest
import torch
import torch.nn as nn
pd = pytest.importorskip("pandas")
import torchlens as tl # noqa: E402... |
fcd32b62427ed2139483a402cecb2ac60399e814cc1c9175023840de24b879af | Python | 9,047 | 232 | import random
import os
import torch
import numpy as np
import pandas as pd
from torch_geometric.utils import remove_self_loops
from rdkit import Chem
from rdkit.Chem.Scaffolds import MurckoScaffold
def save_print_log(msg, save_dir=None, show=True):
with open(save_dir + '/log.txt', 'a+') as f:
f.write(msg... |
8eee7c6d2c2bbf41ae6b6005352d542a42f8c892a698af0b948835ca6d06d19c | Python | 9,051 | 269 | #!/usr/bin/env python3
"""
Test script to compare RAPL domains (package-0 vs psys) with reliable CPU stress using 7z b.
This helps diagnose why RAPL readings might not match powerstat measurements.
"""
import os
import subprocess
import time
print("=" * 80)
print("RAPL Domain Comparison: package-0 (CPU) vs psys (plat... |
d286f289c0dec08b2672f3fb348435c6649fa117e2c37acd80587e1c45749674 | Python | 9,052 | 260 | """The obligation registry: Table A + Table B (oracles D9, build item 3).
Every correctness contract is defined ONCE in Table A (obligation
definitions: what a quantity/behavior means, its unit and convention, its
state contract, its required evidence grade) and bound to every generated
place it is accepted or emitted... |
faa333973a0d2bcae9f75538462db5cb3d0df4e8827e38dc2be6ccd135bd354f | Python | 9,052 | 250 | """Batch context, row validation, and user-key validation (extract item 4).
The :class:`BatchContext` is the one per-batch fact carrier the store
pipeline threads through pooling, transforms, and the post-store hook seam
(the plumbing named in extract memo section 8 for future stats/telemetry
sinks). It carries identi... |
aaa5adeb84400e6f75eadf00d251f059f0338d0a3e7b9d723596fcfe5813a28b | Python | 9,056 | 248 | """MLX recurrence grouping: multi-pass layers, relabel safety, tamper oracles."""
from __future__ import annotations
import dataclasses
import os
import sys
from typing import Any
import pytest
mx = pytest.importorskip("mlx.core")
mnn = pytest.importorskip("mlx.nn")
import torchlens as tl # noqa: E402
from torchl... |
bd1938843abd41d4d0a9e95d45d46e30bfd14703c6806d3d40abffbea32544b4 | Python | 9,056 | 251 | """F11 pattern-folding v1 gates (collapse memo item 12 / D11 / K5).
Typed AST parsing ({k} sugar, acyclic name-inlining, typed syntax
refusals), the honesty core (external-edge and junction refusals, counted
disclosures, near-miss suggestions, no-match warning), K5 chip grammar in
the DOT source, the v1 combination re... |
bc6cae535f1f2ddfa05fde7fae7ef1d6d77b4c72a0ef085d8a7e450a3cf5066c | Python | 9,057 | 265 | """
This file implements the LiveWire segmentation algorithm. The code is ported from:
1. https://github.com/pdyban/livewire: LiveWireSegmentation and compute_shortest_path functions/class.
2. https://github.com/Usama3627/live-wire: include the _compute_graph and compute_shortest_path functions.
"""
import math
from... |
4e1a0c8861f25ec0a203316c0c033ba34fe59926f49d7294d49835ba458357b6 | Python | 9,058 | 162 | """Тор 128x128 (размер задаётся cfg.grid_h/grid_w). В каждой клетке ресурс r in [0, K(x,y)].
Ёмкость K — пятнистая: равномерная еда убивает эволюцию, нужен дефицит и поиск.
Отрост логистического типа, но к ёмкости, а не мультипликативный: клетка,
выеденная в ноль, способна восстановиться (r += g*(K-r)).
"""
import num... |
224729b27f514af300eb150dde211f9c3b4300177eafb04266a861cf2d9d1588 | Python | 9,059 | 232 | # Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the Monodepth2 licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
from __future__ import absolute_import, division, print_function
import o... |
8744820f7b8576810e309b698c51eea5ab1c50a55fde91c8e91b3aabb27315d9 | Python | 9,059 | 286 | # coding=utf-8
# Copyright 2025 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... |
bb8131b29b42c8d654436645494d81b0481ff9582c83961a56d4c1cd3ae62a78 | Python | 9,060 | 203 | """W051-MECH regression pins for AUD-CODE 4.6: the DLA identity budget.
The identity gate ``sum(rows) + constant == native`` budgeted ONE global
scalar taken at the largest-magnitude element (residual 7.6e-06 against a
tolerance of 2.4e-03 on gpt2 head-grain DLA, ~300x): a wrong small row on a
low-magnitude element co... |
cc358aa73b10a741615d70f69b457886b2f6d8b06628b053e456cb6e42a3c15b | Python | 9,060 | 245 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
5e45812ace30a75c707391e0ac10753234c1e49d3bfa2178f9e6cbf010b58fed | Python | 9,064 | 249 | """
====================================================================
Comparison of pipelines for transfer learning
====================================================================
We compare the classification performance of MDM on different strategies
for transfer learning.
Matrices are simulated from a toy ... |
694a33c6f6ddf4445a813a82930cce131ba30d6978383ff61d913de9e4d21416 | Python | 9,064 | 230 | import logging
from typing import (
Any,
cast,
Literal,
TYPE_CHECKING,
)
from fsspec import AbstractFileSystem
from pydantic import field_validator
from urllib3.exceptions import LocationParseError
from urllib3.util import parse_url
from galaxy.exceptions import (
AuthenticationRequired,
Confi... |
41a8698ef030e26e69782a0dac9a192540f5067be5b221bd9ae8f971c7485fe0 | Python | 9,066 | 290 | import argparse
import gc
import os
import random
import sys
import time
import warnings
from distutils.command.build import build
import matplotlib.pyplot as plt
import numpy as np
import tensorflow
from tensorflow import TensorSpec, function, io
from tensorflow.keras.layers import Input
from tensorflow.keras.models ... |
d37f6bc54e5108b5d2ef0c57332950fe73d37438a815368466a11f97a1a269a9 | Python | 9,066 | 205 | """B5: the neighbourhood acceptance test for the guarded site join (leverage D-3).
The identity contract is about a RELATION, so the primary assertion is the
JOIN'S REFUSAL on the touched cohorts — plus graph-neighbourhood (parent /
child site-key signature) agreement on every corroborated key, IN ADDITION TO
shape an... |
c0baf8213fbdc2969fc8d28967fa61c69067c7e2d5f6b9fc5477092ba8dc4ad3 | Python | 9,068 | 209 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 30 17:28:03 2022
This script contains custom statistical functions and wrappers.
@author: emilia
"""
import numpy as np
from scipy.stats import shapiro, ttest_ind, ttest_1samp, mannwhitneyu, wilcoxon, chi2, pearsonr
def get_sem(data, dim=0):
... |
d8bf924177330ef19f07202d0f34b4da792a43051181cf63b473ca8b7c6f9a6a | Python | 9,069 | 226 | """steering-vectors bridge against the real package on a tiny cached Llama.
Each test compares ``tl.bridge.steering_vectors.vector`` on saved activations
with ``steering_vectors.train_steering_vector`` run directly on the same model.
Skips when steering-vectors, transformers, or the checkpoint is unavailable.
"""
fro... |
8b75df4bb477cc63fd6289dd58bfd881c759775def26dc879391e36d8d26f8b7 | Python | 9,070 | 289 | # Algorithm by Bruhn, Weickert, Schnorr
import sys
import numpy as np
from numpy import array
from scipy import ndimage
from scipy.ndimage.interpolation import map_coordinates
from numba import jit
from functools import partial
from .warps import Warp
from imfun.multiscale import pyramid_from_zoom
from imfun.fi... |
7361a3b3cac12f3dd35bcb5eccfe640c25f08a38eb0fc772a4dc5b38d25ccad9 | Python | 9,071 | 226 | """5. Train PSPNet on ADE20K Dataset
=================================
This is a tutorial of training PSPNet on ADE20K dataset using Gluon Vison.
The readers should have basic knowledge of deep learning and should be familiar with Gluon API.
New users may first go through `A 60-minute Gluon Crash Course <http://gluon-... |
32d48c30387c69044c792fc8bfb5f9a8f5c3bb83cf5724eb51309288c8052f0a | Python | 9,072 | 214 | import warnings
from collections.abc import Iterable, Mapping
import numpy as np
import pandas as pd
from anndata import AnnData
from mudata import MuData
from scipy.sparse import sparray, spmatrix
# Utility functions
def _get_values(
data: AnnData | MuData,
key: str | Iterable[str] | None = None,
use_r... |
d50e0ae7f10725f58dcb5d7d76a4296a59edfdc8cb20994e2906141d794ebdac | Python | 9,073 | 239 | #!/usr/bin/env python
# coding: utf8
__doc__ = """
Copyright (C) 2014 Ingo Fruend
This code reproduces the analyses in the paper
Fruend, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
Permission is hereby granted, free of charge, to any pe... |
1c9a6c6784cd9990bdd5f7e10a47a2ba19c962f6c818f82decc97e674ee280da | Python | 9,074 | 216 | """
Duplication and transposable element analyzer.
Copyright (C) 2023 Tham Cheng Yong
This file is part of NanoVar.
NanoVar 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 3 of the License, or
(... |
d0825aff76e67f94219105f94664dc1fd20b97b34e9c29c56291d9b20ade775f | Python | 9,076 | 249 | """Regression tests for r18i3 utils/__init__.py residue findings M12/M13/M14.
Each finding is a diagnostic/state-hygiene bug that r18i-2 diagnosed but could
not reach from its options.py lease:
* M12 -- ``_log_ops_for_mode`` restored training modes via a recursive
``model.train(root_mode)`` that clobbered mixed chi... |
ec779c008e757203a4689a457cee9e878f83d64b8ce89d5f52eae16494be8793 | Python | 9,076 | 157 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
fa24f038eaa70166e02aa2e5bded98e445f58b0d7f157639761da68ff74b2d2c | Python | 9,076 | 157 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
f6ecbe36492480057fcedd2e2de89dfccb35cc60ec45bdc64a65187cfd8b1be9 | Python | 9,077 | 291 | """Performs LR analysis by grouping LR pairs which having hotspots across
similar tissues.
"""
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
import pandas as pd
import seaborn as sb
from anndata import AnnData
from sklearn.cluster import DBSCAN, AgglomerativeClustering
from tqdm import ... |
9bae21f35055b1568e7c17db2b56ace3f552291020a7908f55c2d33a411a02f0 | Python | 9,078 | 271 | """A-GATE save/load legs: every gate claim repeated after a round trip.
Test law 2 (foldB D18): in process, every pair short-circuits toward
identity evidence, so gate bugs are invisible at notebook scale — every
cross-member claim must therefore also be proven AFTER a save/load round
trip. This file repeats both defe... |
1034af5c0ada6fe82d850bbbe89663911c0e393b1c3680141142bf4864290641 | Python | 9,080 | 334 | # -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot as plt
import random
import sklearn
import seaborn as sns
import scipy as sp
from matplotlib import rc
import matplotlib.ticker as mtick
import matplotlib as mpl
from scipy import signal
from sklearn.linear_model import LinearRegres... |
0b6d18e8f27ccaf3e51bb6e1990f0a1675fd4de362550e5ebd0ba23bd26ae8bf | Python | 9,085 | 280 | import numpy as np
import scipy.linalg as spl
import warnings
from itertools import product
class TimeSeriesTooShortError(Exception):
"""Raised when the time series in the input data have less than three elements"""
pass
#----get_neighborhood_vol----#
# OFFSETS
OFF27 = np.array(list(product((-1,0,1), repeat=... |
ac99bd6b8baea534e03b8418788ecb8e064db9dcd2c0454ce5f477949dc294eb | Python | 9,086 | 285 | import tqdm.auto as tqdm
import numpy as np
import attr
from permacache import permacache, stable_hash, drop_if_equal
from modular_splicing.data_for_experiments.standardized_sample import (
model_motifs_on_standardized_sample,
)
from .baseline import fm_baseline_nonbinarized
from .calibrate_sparsity import calibr... |
f61076a887c63065d07e920226424250aa3ec175d83737a5e09abc8b1c0ffd90 | Python | 9,086 | 178 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from multiprocessing.pool import ThreadPool
import torch
from PIL import Image
from ultralytics.models.yolo.segment import SegmentationPredictor
from ultralytics.utils import DEFAULT_CFG, NUM_THREADS
from ultralyt... |
9b6d1271aa13790576735345db5fe001c5ddf5879cef3cffbd3f73bf84b35228 | Python | 9,088 | 284 | from __future__ import print_function, division, absolute_import
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c10... |
cc917a885800925b1dc8b280aa45caeaa691948e9f08d484af8d79db230b06fb | Python | 9,089 | 251 | #!/soft/devel/python-2.7/bin/python
import sys
import datetime
def add_elem_dictionary(dictionary, key, elem, repet = False):
if key in dictionary:
aux = dictionary.get(key)
if repet:
aux.append(elem)
dictionary[key] = aux
else:
if not elem in aux:
... |
0a14a54c22a9d360364f92e15962dcf8602e465af382c140fbe3c3d256d454db | Python | 9,091 | 243 | #!/usr/bin/env python3
"""
Diagnostic I — Tier 1.3: topographic IAF + hemispheric asymmetry.
Tests adding regional IAF (frontal/posterior/gradient) and alpha/theta
asymmetry (L-R in frontal, posterior, global hemispheres) on top of 7D
and 7D+FOOOF baselines, with HC-anchored normalization.
Feature variants:
5D ... |
83d87f49989e8941cbcf2382c1abd5e7f8858c2f6cad5df7e9739c94e606c1f5 | Python | 9,092 | 243 | import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
from scipy import ndimage
from scipy.spatial.distance import pdist, squareform
class Calculater():
def __init__(self, img, edge):
self.img = img.astype(float)
self.edge = edge
self.find_conve... |
0f4f1b2d4c05ecc586e4a8c05a7efd2058de5270c36771e023d9d6d5ab1e1818 | Python | 9,094 | 206 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 18:04:08 2021
This is the configuration file for Experiment 1. To run the experiment, pass the path to the folder which is to contain
the data from all Experiments on lines 178 and 179.
@author: emilia
"""
import numpy as np
import itertools
imp... |
bf335962df0ab38df2c838c30818a3a67c234fd29914b655905d21ae8723a96f | Python | 9,094 | 256 | """P5 backward module-containment tests."""
from __future__ import annotations
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.validation.invariants import MetadataInvariantError, check_metadata_invariants
class _ModuleContainmentModel(nn.Module):
"... |
b73dafb101a2c9d94b21aa5d86896ce2036c4412361de2bc086fb1fcdbb7f123 | Python | 9,095 | 209 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 18:04:08 2021
This is the configuration file for Experiment 2, post-cue delay length = 0 cycles variation. To run the experiment,
pass the path to the folder which is to contain the data from all Experiments on lines 206-207.
@author: emilia
"""... |
26f3d2d704c63e931c03c1623272caf037844c2b7e5406b7d30820432bb11310 | Python | 9,096 | 276 | import numpy as np
from collections import Iterable
from skimage.measure import regionprops
from monai.transforms import Transform, MapTransform, SpatialCrop
from monai.transforms import (
Compose,
EnsureTyped,
ThresholdIntensityd,
ScaleIntensityd,
ScaleIntensity,
Resized,
RandGaussianNoise... |
12b2604b3093b61360ad2af7b90433e8d5b93ca3ffaccc63b6d8cc23a7d5012b | Python | 9,097 | 264 | """Behavioral tests for the lightweight viz display surfaces.
Covers the PIL visualizer factories (``tl.viz.heatmap`` / ``channel_grid`` /
``histogram``), the batch summary renderers, ``causal_trace_heatmap``, and the
``Layer.show()`` / ``Op.show()`` tensor display path.
"""
from __future__ import annotations
import... |
49d0814dbd299d2177ce0e35197ff1e8ea5a03ff7bbba16b1b006c18faffac66 | Python | 9,097 | 283 | import os
import urllib
import gzip
from io import StringIO
import numpy as np
import scipy
import tqdm.auto as tqdm
from permacache import permacache, stable_hash
import pandas as pd
from modular_splicing.data_pipeline.spliceai_data_processing_pipeline import (
create_dataset_from_splice_table,
)
from modular_... |
73025711dc52ecd18db0b5bb6a111f6f68ecfee3222aa890ff398022f61d9f8a | Python | 9,097 | 248 | from __future__ import annotations
import matplotlib.pyplot as plt
import numpy as np
from tqdm.auto import tqdm
from ..utils import build_gt_id2annotations
from ..utils import build_pr_id2annotations
from ..utils import COLORS
from ..utils import load_json_from_file
from ..utils import transform_gt_into_pr
from ..ut... |
dc16890886569a4a507ea2fc75eff78196c86639da1c599be98022aa138bb5ea | Python | 9,101 | 165 | """Геном = плоский набор весов MLP N_IN -> n_hidden (tanh) -> N_OUT (сейчас 25 -> 12 -> 12).
Никакой fitness-функции нет и не будет: размножение — следствие поведения,
а не оценка сверху. Отбор идёт сам, как в Avida.
"""
import numpy as np
from .config import N_IN, N_OUT, N_ACTIONS, A_FORWARD, A_EAT, A_GIVE, A_TAKE
... |
e407eae47781fc4f1dd15dd53302f29e267eb8d4c6c5cbe77001c56f9b92f17c | Python | 9,101 | 253 | """
Encoding TCRs as one-hot vectors and back again.
Someday this may do the same for BCRs.
The current gene names are for Adaptive data.
Erick: try to keep everything that assumes this gene set in here so
generalization is easier.
"""
from collections import OrderedDict
import pkg_resources
import numpy as np
impo... |
b4115f9ac1ea0bff9e39d1833af9f54c11a91caf2235e1dda4672331f9621e1b | Python | 9,103 | 251 | #!/usr/bin/env python3
import sys
import argparse
# Check the current python version before running.
if sys.version_info < (3, 8, 0):
sys.exit("Error: MetalHawk requires Python 3.8 or greater.")
# _end_if_
import textwrap
import pandas as pd
from tqdm import tqdm
from os import linesep
from pathlib import Path
f... |
f45de9d5ed820ab15d4d668230a6b88fc2de9831afce25f840ec7fd046022b92 | Python | 9,103 | 242 | from typing import Any
import numpy as np
import copy
import pandas as pd
from mirp._images.generic_image import GenericImage
from mirp._imagefilters.generic import GenericFilter
from mirp._imagefilters.utilities import FilterSet2D, FilterSet3D
from mirp._images.transformed_image import TransformedImage
from mirp.se... |
9284d379964788e2a33112effe9866c2fc5476cf750992dd94f03850d65ce283 | Python | 9,104 | 270 | # ruff: noqa: SIM201 SIM300 SIM202
from __future__ import annotations
import pytest
from pybind11_tests import enums as m
def test_unscoped_enum():
assert str(m.UnscopedEnum.EOne) == "UnscopedEnum.EOne"
assert str(m.UnscopedEnum.ETwo) == "UnscopedEnum.ETwo"
assert str(m.EOne) == "UnscopedEnum.EOne"
... |
b784fb9470fb8c0165f8a6a9f3ebb88dd1fddc4649839e5b56f2927ea2f03125 | Python | 9,104 | 205 | """r15 write-class closure: observable host writes witnessed, raw-pointer access fail-closed.
Regression guard for the four r15 findings that COMPLETE the tensor-WRITE class:
* H2 -- a host write through a view's zero-copy storage handle to bytes OUTSIDE the view's
own extent (storage ``__setitem__`` / ``np.as_stri... |
40aaeb439f12f0c9ea1c353d763e8e6ca2693f5933135139f2cca64a7afc6e66 | Python | 9,106 | 195 | """RCNN Target Generator."""
from __future__ import absolute_import
from mxnet import autograd
from mxnet import gluon
from ....nn.coder import MultiClassEncoder, NormalizedPerClassBoxCenterEncoder
class RCNNTargetSampler(gluon.HybridBlock):
"""A sampler to choose positive/negative samples from RCNN Proposals
... |
ebf6b4652c96f0a5b912d6be216b1c1b06892c5e1b022af089130782b5d0c06e | Python | 9,106 | 332 | from neuron import h,gui
import numpy as np
import random
import math
from findNodePositions import *
import sys
from DH_Cell import *
h.load_file('stdrun.hoc')
if len(sys.argv) > 0:
nrn = int(sys.argv[1])
else:
nrn = 1 ## Base model -- Fastest simulation and most strongly polarized
if nrn == 1:
a =... |
6c74ab5fc54a3e3d3bf777a5c80159b5af527618faabfbd6194220534444571e | Python | 9,109 | 230 | """2. Dive Deep into Training TSN mdoels on UCF101
==================================================
This is a video action recognition tutorial using Gluon CV toolkit, a step-by-step example.
The readers should have basic knowledge of deep learning and should be familiar with Gluon API.
New users may first go throug... |
98335b106c7364c6c1463f5ba51cc9354ea057105b3b71a3aaae658c68b065a4 | Python | 9,109 | 236 | import sys
sys.path.append('..')
sys.path.append('../..')
import os
import datasets as dat
from analysis_lib import *
import numpy as np
from copy import deepcopy
import scipy
# Analyze few-shot learning task. Compare human and machine samples.
map_gold_simple = { # simple queries
"3 after DAX" : "DAX 3",
"DAX ... |
ecfdd8547be56e3b7bc20506bbe4d5d0b3465029350f830b8a70a01da553ba64 | Python | 9,109 | 227 | # --- 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 Fillgradient(_BaseTraceHierarchyType):
_parent_path_str = "scatter"
_path... |
f6b69e052e5440ed953876d921786a8603beec98f10603cf74b480415944ca26 | Python | 9,114 | 233 | from typing import Optional, Tuple, Union
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
import anndata as ad
import numpy as np
import pandas as pd
from anndata import AnnData
from pyvista import PolyData, UnstructuredGrid
from scipy.sparse import issparse
from scip... |
d9e05043a90daff8bc03653108f9e6c1d8a7497a82c60049f551d158709479db | Python | 9,115 | 246 | """Spectral utilities."""
from itertools import repeat
from functools import partial
import numpy as np
from specparam.modutils.docs import docs_get_section, replace_docstring_sections
###################################################################################################
###############################... |
2232391cdd140f7ec269f39f2489cf1e1bd37157b7e3ff11730aa175623a6afc | Python | 9,117 | 251 | #works for
# pandas==0.25.1
# numpy==1.17.2
# scikit-learn==0.21.3
# Theano==1.0.4
# tqdm==4.36.1
# dill==0.3.3.1
####
#Code tested on my machine;
######################
from cox_nnet_v2 import *
import numpy
import sklearn
from sklearn.model_selection import train_test_split
import pandas as pd
import time
import r... |
5649dfd79ba9eb7bc8c65bd8318f3c574068901d01745e88c0f1a0fc5cf9086e | Python | 9,117 | 208 | """Corpus-scoped fidelity oracles on REAL features (memo B10; lane F19).
O14 (fixture admissibility, discriminative in both directions), O1b (the one
theorem-shaped empirical bound), O1c (pinned per-cell baselines with
headroom, regenerated ONLY via tools/regen_transforms_baselines.py), O1d
(the self-baselining SRP-vs... |
6a2d28813bc9ea59e1bedf8b245e85df93e9b57226e1e253564527ffc911f5fd | Python | 9,117 | 313 | """Edge-count introspection coverage for Trace, Module, ModuleCall, Op, and Layer."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
def _trace(model: nn.Module, inputs: torch.Tensor, **kwargs: object) -> tl.Trace:
"""Capture a TorchLens trace for edge... |
725d1c82be91f481de1add5936a0267bea9bf08a06dad1f9fa2534224f3bca9f | Python | 9,117 | 251 | #works for
# pandas==0.25.1
# numpy==1.17.2
# scikit-learn==0.21.3
# Theano==1.0.4
# tqdm==4.36.1
# dill==0.3.3.1
####
#Code tested on my machine;
######################
from cox_nnet_v2 import *
import numpy
import sklearn
from sklearn.model_selection import train_test_split
import pandas as pd
import time
import r... |
1890548dd242f721663bbd6adef90b8bed6a9474ff88b38173aabd08739208fd | Python | 9,118 | 247 | #!/usr/bin/env python3
"""
File: compare_pvalues.py
Created: 2021/11/01
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 this source t... |
e7c8d1e1a178de759b2dc0e992ac08073a485d0189794cc8d496acc40e078198 | Python | 9,118 | 274 | # 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... |
bad2928516f6c28c3cecb87f3cbb4b74297c16e8fb45d446383e110752baacff | Python | 9,119 | 262 | """
Contains methods for the computation of flank robustness of motifs, effectively
to what extent given motifs can have their flanks clipped.
"""
from collections import Counter
import itertools
from more_itertools import chunked
from permacache import permacache
import numpy as np
import pandas as pd
import torch
... |
48f7e26c7b6f38acc3fec1eba4467ad077cb69edc685aad4e1383b481ddcf973 | Python | 9,120 | 258 | """
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
"""
from __future__ import absolute_import
import os
import sys
from pip._vendor.six import PY2, text_type
from pip._internal.utils.compat import WINDOWS, expanduser
def user_cache_dir(appname):
r"""
Retu... |
fe3163b8768dd230ed7a2f03aa1bcdde9522088fafce8b692304d227968c09f1 | Python | 9,121 | 313 | """
Simulation of individual agents without a full experiment.
Runs one or several larva models in isolation, which is used to inspect a
model's behaviour and to fit its parameters.
"""
from __future__ import annotations
import random
import numpy as np
import pandas as pd
from typing import TYPE_CHECKING, Any, Opt... |
cc8b043cf46b0ea85a209e24cbc39315b84d8bd2ed3c12ba4f4dcbae18f55bf3 | Python | 9,124 | 244 | import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
from scipy import ndimage
from scipy.spatial.distance import pdist, squareform
class Calculater():
def __init__(self, img, edge):
self.img = img.astype(float)
self.edge = edge
self.find_conve... |
34aef154ef17114b94d09678abca58b472635f59f020bcfb63a74090a9809bf7 | Python | 9,127 | 238 | import torch
from einops import rearrange
import numpy as np
operation_seed_counter = 0
def generate_mask_pair(img):
# prepare masks (N x C x H/2 x W/2)
n, c, t, h, w = img.shape
mask1 = torch.zeros(size=(n * t * h // 2 * w // 2 * 4, ),
dtype=torch.bool,
dev... |
b8fa5614dc03b1fcb229f91724831183c82766336544f136155c01491081558f | Python | 9,129 | 305 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Distributed helpers."""
import functools
import logging
import pickle
import torch
import torch.distributed as dist
from pytorchvideo.layers.distributed import ( # noqa
cat_all_gather,
get_local_process_group,
... |
4c855b7de125d12a94a5add19237759d421bfb6d3bd8f25b2a49bf447e38dfed | Python | 9,130 | 226 | import wandb
import numpy as np
import os
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import argparse
from sklearn import metrics
import torch.nn.functional as F
from datasets.esc50 import get_test_set, get_training_set
from models.mn.model import get_model as get_mobilenet
from models.d... |
90e2d72ce67bcfa3eb875d793b14296039c31fb66bca985d249f3f38416f59d1 | Python | 9,131 | 208 | import numpy as np
import random
import copy
from gym import spaces
class IntervalDiscrimination_2D(object):
"""
Interval discrimination task in 2D touch chamber environement.
After an initiation signal appears at one corner of the arena, the agent has
to navigate to the initiation cue and poke it to s... |
bfd04a48d6132504995d70cb08911654d60b0f738ccef1e5504e3bdf95442038 | Python | 9,132 | 233 | """
This module define the training dataset manager
"""
import logging
from collections import Counter
import pandas as pd
import torch
from dataset_manager.data_factory import DataFactory
from datasets_pre_processing.classification_contact_dataset import (
ContactDataset_per_amino_acid,
)
from utils.json_loader im... |
c00991fb0ff200eac90da322c348cb92329fe8c26d8da087cae34801cabc42bb | Python | 9,132 | 278 | """
General utility functions and ABCD specific util functions
Author: Dominik Kraft
"""
import pandas as pd
import numpy as np
from neuroCombat import neuroCombat
def load_mri(dataset, exclude):
"""
This function loads MRI data, either from PNC or HBN
------
Input:
- dataset = either PNC or HBN ... |
2bcf4c49520e63e4ddedc488a4aebc223f418ec6078676a85b8c62b45908c2d4 | Python | 9,133 | 229 | """
Estimate pseudotime using spectral embedding methods.
We also include plotting and error calculation functions .
"""
import numpy as np
from matplotlib import pyplot as plt
from scipy import optimize
from scipy.interpolate import UnivariateSpline
from scipy.stats import spearmanr
from sklearn import manifold
from s... |
5ee340b41355dec56ed6c03f40f40edf3f31daf148e291f09573f83a6e4ad038 | Python | 9,133 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "bar"
_path_str =... |
6d691d72d62607050fdc1ea4f0209276df7f86180a1b9860b544809c9a9d97ac | Python | 9,133 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "pie"
_path_str =... |
e9541910c8d2f532638636688e725edb415ca447c13600478292a366b149584b | Python | 9,133 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "box"
_path_str =... |
d6076e8514058c4a136f64d63c743f6ca59758fa029ac483119dfc3dc47b0670 | Python | 9,134 | 280 | import os
import re
import simplekml
import numpy as np
import matplotlib.pyplot as plt
from tqdm.auto import tqdm
from tlib import tutils
from .geotif import get_geoms, get_centroid
def points_to_kml(lons, lats, group='points', kml=None):
"""
Puts given points into a simplekml kml object.
:param lons:... |
7486bd3033e8d0e1327dab34aadb5622d57a02e8254816b1f31b5bc069f263b9 | Python | 9,140 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "cone"
_path_str ... |
87a4042dcbe15ca6a9b4e8aee4bb7af25fa92e2d1596057a19a60a9980b8a9d8 | Python | 9,140 | 250 | #!/usr/bin/env python3
"""
File: count_n_ieqtls.py
Created: 2021/12/20
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 this source tr... |
3340fc86f5060a3be8e3bd61ba3be5db09a5c10493cabce4148e1c5d0a16d8f0 | Python | 9,141 | 290 | """Tests of randomize for `pynapple` package."""
from contextlib import nullcontext as does_not_raise
import numpy as np
import pytest
import pynapple as nap
@pytest.mark.parametrize(
"data, min_shift, max_shift, mode, expectation",
[
# data type
(nap.Ts(t=[1, 2, 3]), 1.0, 1.0, "drop", does... |
c4ea02cd366de116e9e38613bf9e5bcb056e66f1cd1356a4e58b6e0c65f5cba5 | Python | 9,142 | 260 | """Reading logic for ome-zarr.
Primary entry point is the :func:`~ome_zarr.io.parse_url` method.
"""
import logging
from pathlib import Path
from urllib.parse import urljoin
import dask.array as da
import zarr
from zarr.abc.store import Store
from zarr.storage import FsspecStore, LocalStore, StoreLike, StorePath
fr... |
b1557bdebb61ce2b746755606c48c8d1a121f0bd29ebfdde77a372fe8773a3c4 | Python | 9,143 | 256 | # SOURCE: vendored from QuKunLab/SPACEL @ main
#
# SPACEL ships several independent torch sub-tools sharing one package. This staging
# module vendors the two that are genuine torch nn.Module architectures with no
# non-base dependency in the model-definition code itself:
#
# 1. Spoint's `PredictionModel` (SPACEL/Spo... |
7cb4594cbd4d26d2fe401391f896ca013a4a49fe5315a9f73518f93a9e15cf1d | Python | 9,145 | 262 | """
Preprocess an example bed file in a format readable by PrismNet
"""
import os
import argparse
import json
import pandas as pd
import numpy as np
import pyBigWig
pd.options.mode.chained_assignment = None # default='warn'
# Example .bed file for positive sites
# chr1 10019768 10019769 . ... |
365695e21056961a9b84cf84a025ec6cada81af489e9910d46ea329f53fdca06 | Python | 9,147 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "table"
_path_str... |
546c54122e0e2568d5eb169bdbaa4c1cf6483a11731062852eae0be1f2797a73 | Python | 9,147 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "splom"
_path_str... |
55327321791cc9c0e090f93a65f3f3fab1c4a227819359990ffcd8adab698bf7 | Python | 9,147 | 268 | # --- 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 Hoverlabel(_BaseTraceHierarchyType):
_parent_path_str = "image"
_path_str... |
2e828555b5ed00778a22ba40887b7ab6458abd601ef9eadad1bd847edeced2f7 | Python | 9,148 | 261 | """A rerun re-saves the trace's requested sites, not the old raw op positions.
Regression pin: the capture-engine rerun re-saved by the ORIGINAL capture's
raw op indices. A staged edit inserts an ``intervention_replacement`` op, so
every later op shifts by one: after ``attach_hooks`` on a plain capture saved
with ``tl... |
32581141e0678590651bd3e357025e1233833aaebad70c44ac43196a8d4a0078 | Python | 9,149 | 210 | import os
import unittest
import tempfile
import sqlite3
import numpy as np
from bdpy.dataform import SQLite3KeyValueStore
class TestSQlite3KeyValueStore(unittest.TestCase):
def _init_test_db(self, db_path):
sqls = [
# Create tables
"""
CREATE TABLE IF NOT EXISTS key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.