sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
618e19f03a053f2802d88cccf3984d01e35ee2727f64df8824718436df92b929
Python
9,651
343
# Individual Cases Text Parser # From Tamil Nadu Bulletins from __future__ import annotations import multiprocessing import sys import pathlib import argparse import os import re import json import pdfplumber if sys.version_info >= (3, 8): from typing import TypedDict, Dict, List, Optional else: from typing_...
9fb42bce27ef8fdbcb9439663e0834a49c74e7941f787bb50c64907044f95959
Python
9,652
236
"""Functions for building the input features (reference ccd features) for the HelixFold model.""" import sys import numpy as np from copy import deepcopy from helixfold.common import residue_constants from helixfold.data import pipeline_multimer, pipeline_rna, pipeline_rna_multimer from helixfold.data import label_uti...
cdaf5105b93d3996962a90b64f0cb9fcadac78a10ac6d6f86f95b2a42a97926b
Python
9,652
279
from __future__ import annotations import faulthandler import logging import logging.handlers import os import os.path import sys import threading import weakref from typing import TYPE_CHECKING, Any, Optional, TextIO import toml if TYPE_CHECKING: from bream4.device_interfaces.devices.base_device import BaseDevi...
e0a07c77505b1f612372b5ce964b982658182e89075c6d1224937ad06fe3621b
Python
9,652
238
""" Variety of functions for computing motif perturbations. """ from types import SimpleNamespace import numpy as np import torch from permacache import permacache, stable_hash from modular_splicing.evaluation.predict_splicing import predict_splicepoints from modular_splicing.utils.run_batched import run_batched d...
ff298e5943bf07fd775f1fc788c2987dab33bedca80574cf88ecb01db4bd7d76
Python
9,652
217
from ..utils import gislib, utils, constants from ..core.trajectorydataframe import * import numpy as np import inspect def stops(tdf, stop_radius_factor=0.5, minutes_for_a_stop=20.0, spatial_radius_km=0.2, leaving_time=True, no_data_for_minutes=1e12, min_speed_kmh=None): """Stops detection. Detect the s...
f0ba540e883cc9089cdf8c0b8df41de2077e36ffe9867ccfa3b8655dcd12aaff
Python
9,653
199
"""05. Deep dive into SSD training: 3 tips to boost performance =============================================================== In the previous tutorial :ref:`sphx_glr_build_examples_detection_train_ssd_voc.py`, we briefly went through the basic APIs that help building the training pipeline of SSD. In this article, w...
9f36a14003c53efb916fa175d41a3953f7af5fdbfadcfdbfd8fb915c422fd3bc
Python
9,656
314
import numpy as np from numpy import cos, pi, arange, ones, zeros from numpy.linalg import norm from scipy.fftpack import dct,idct from scipy import sparse from ..core import fnutils from numba import jit def l1sp_scale_to_smooth(scale,p_=(4,-3)): return scale**p_[0]*10**p_[1] def l1sp_gauss_scale_to_smooth...
f1d49b8ab8170f58535576cf23a912f248aa8e2020b1d32b852f61cd92cb4074
Python
9,658
222
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 4, cue validity 1, AI vs learning speed analysis. It differs from the main Experiment 4, cue validity 1 configuration file in just one aspect - it is set to train more (N=100) models. ...
4c87f8d235e0bb4958f956fc4022897269e5f9252e40496d2d6ffdafe875420f
Python
9,660
247
"""Conformance packs C0-C2, profiles, mutation plants (MEMO 4, build B4). Anti-vacuity, executed: the well-behaved fake provider passes every cell BEFORE any plant is trusted to fail one; every plant in the closed set turns its intended cell red; toys earn NOTHING (the runner refuses every claim on config-built eviden...
841cce7c2348c2bc87b2ac7c9cf7ee954738cbf76e63c7cec3d3b9dccc4edb99
Python
9,660
285
""" .. _exa-intro: .. currentmodule:: eelbrain Introduction ============ Data are represented with there primary data-objects: * :class:`Factor` for categorial variables * :class:`Var` for scalar variables * :class:`NDVar` for multidimensional data (e.g. a variable measured at different time points) Multiple vari...
9698edded328b7cf42d70e8d4cde65147255d2e00682f5903c458e2acc662b92
Python
9,662
269
import squidpy as sq import pandas as pd from collections import Counter import anndata from scipy.sparse import csr_matrix import numpy as np import os import math from tqdm import tqdm import matplotlib.pyplot as plt import seaborn as sns sns.set_theme() def create_dataframe(adata, coord_key, celltyp...
3fe459b1aa9e1a7ca7cdea71e42db4efdc404cee5036bf377972ef01003ee30e
Python
9,669
349
#!/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 TGraph logger = logging.getLogger(__name__) class TNode: """...
b061ad5bc4ea06aeee9fb8de5f1b51c4d3483fadfd63f7bce8d378fff5768d5b
Python
9,669
267
#!/usr/bin/env python3 """ Database Cache Refresh Script for Ethoscope This script refreshes all database cache JSON files by extracting metadata directly from databases and creating properly timestamped cache files. It supports both SQLite and MySQL databases and ensures cache filenames reflect actual database metada...
7e68b6b2b32242173735a48a97849cc5dd19bdf9ac7cb439dfe791214d60d1f8
Python
9,674
295
"""Tests for Phase 3 repr and tensor display ergonomics.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl matplotlib = pytest.importorskip("matplotlib") matplotlib.use("Agg") class _InfModel(nn.Module): """Tiny model that produces a non-finite out.""...
e1f02b73e6d9fce9d71a2c8d2254df19b2242775c1278c0ccea5b71d3d727a02
Python
9,674
184
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
c83d89a8a4bec0b5e409eb0208ed7718ddc8670aacdbbaf1660eb5fc179f4701
Python
9,676
307
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Functions for interpolating over high-motion volumes.""" import os import nibabel as nb import numpy as np import pandas as pd from nipype import logging from xcp_d.utils.confounds import _infer_dummy...
547c37ad34b776d5980cbfc845aac77b17498121a84c343a951a055f07c500b8
Python
9,679
274
"""Checks kit item 3: loop-session chassis + registry lifecycle (memo 4.2). Contracts pinned here: every hook handle removed on every exit path including optimizer exceptions; construction is silent and does no device work (D20); bitwise same-seed checks-on/off runs (zero user-RNG consumption); the step-check family r...
20a0448e749ce90094d30151034e83309a9a921e33929d62cd34018c1f93cf29
Python
9,680
219
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 4, cue validity 0.5, AI vs learning speed analysis. It differs from the main Experiment 4, cue validity 0.5 configuration file in just one aspect - it is set to train more (N=100) models...
32058e848f4798e2f15b95d0c43bd5eeac2f79cf5678948586505925f032d00e
Python
9,682
308
"""Image domains for PyTorch. This module provides image domains for PyTorch. The image domains are used to convert images between each domain and library's internal common space. The internal common space is defined as follows: - Channel axis: 1 - Pixel range: [0, 1] - Image size: arbitrary - Color space: RGB """ f...
88c6c5e74f67e77f0dc823e7f7538191187088f6c3c8569c8960045e030c8113
Python
9,682
276
import threading from absl import logging from keras.src import backend from keras.src import losses from keras.src import metrics as metrics_module from keras.src import tree from keras.src.legacy.saving import serialization from keras.src.saving import object_registration MODULE_OBJECTS = threading.local() # Lega...
e9d40d27081ae01fa3bcab04b4e3847d9197aaa216804795a17c0254bb252816
Python
9,683
214
#!/usr/bin/env python3 """ Dx Z++ — what makes brainlat's feature distribution different? For each of the 15 canonical features, compare brainlat's distribution (HC + AD separately) to the pooled distribution from the other 3 AD cohorts (ds004504 + ds006036 + figshare). Identify features where brainlat is systematical...
d9f17b7d7c44d4ab18143eeff5b6b3a2c8e48de7df67ba7335c8ff820b48c05a
Python
9,684
212
import pandas as pd import numpy as np from sklearn.model_selection import KFold, StratifiedKFold, RepeatedStratifiedKFold, GridSearchCV from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score, \ classification_report, make_scorer from sklearn.pipeline import Pipeline, mak...
432e8a4400433d5af7be36e233cc6d9a7198b9ac4fdb628e17837266ae5b1c61
Python
9,686
246
"""Transforms for YOLO series.""" # pylint: disable=not-callable from __future__ import absolute_import import numpy as np import mxnet as mx from mxnet import autograd from .. import bbox as tbbox from .. import image as timage from .. import experimental __all__ = ['transform_test', 'load_test', 'YOLO3DefaultTrainTr...
4a4dc858f15b99634642b8788ab3b87bca004a312fb0e006a0c77480743d3219
Python
9,686
241
""" after DTV images has been generated, collect into For FreeCAD library parts dataset and Thingi10K dataset """ from __future__ import print_function, division import os import os.path import sys import time import json import glob import numpy as np import pandas as pd pd.options.display.float_format = '{:,.2g}'.f...
13e076cc05c0a7eadc3a233b632a978ad7d3153b7f484b3edecf4be68ef10c20
Python
9,688
262
from collections import defaultdict import json import numpy as np import pandas as pd from tqdm import tqdm from pyspark import SparkConf from pyspark.sql import SparkSession from pyspark.sql.Catalog import dropGlobalTempView from omop_learn.backends.backend import OMOPDatasetBackend from omop_learn.data.common impo...
fa3ad6898e801121362f97805f631b175cece0d0c46f198843ddf878022a614c
Python
9,689
325
from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from rdkit import Chem import itertools, operator from dcCustom.feat import Featurizer from dcCustom.feat.mol_graphs import ConvMol, WeaveMol def one_of_k_encoding(x, allowable_set): if...
3c4e6d088f8dd846a58ef22b35d0b9bad568f3b1828664a6aeb62a5a1664f753
Python
9,690
275
"""Rescue recovery oracle vs ``TorchFunctionMode`` dunder respelling. The rescue re-run arms a ``TorchFunctionMode``; with a mode active torch dispatches C-level operator dunders as their named method, so the mode-free primary logs ``__radd__`` / ``__truediv__`` / ``__iadd__`` while the rescued trace logs ``add`` / ``...
63fa2286da2de45e9c58106470a300b82407ee5d2b69908f2f5312b2a5f6ecb0
Python
9,690
309
from __future__ import annotations from abc import ABC, abstractmethod from typing import Callable, Iterator import warnings import torch import torch.nn as nn from torch.nn.parameter import Parameter from bdpy.dl.torch.domain import Domain, InternalDomain def _get_reset_module_fn(module: nn.Module) -> Callable[[],...
ca4b1186c655f018bcf145530a374e9869c21a434831e709959c6c628374e66e
Python
9,690
320
import copy import numpy as np import pytest GENERIC_KWARGS = dict([ ("image_data", np.ones((30, 29, 28), float)), ("separate_slices", False), ("translation", (1.0, 1.0, 1.0)), ("rotation_angle", 90.0), ("noise_iteration_id", 2), ("noise_level", 2.0), ("interpolated", True), ("interpol...
116cab22b2623baaed88d27bb75a3d47fa99e9c49353141a26bebde4aaa8722c
Python
9,691
258
"""A final Op label resolves through ``trace.ops`` to its own Op, or refuses. Raw labels (``{type}_{type_idx}_{raw_idx}``) and final labels (``{type}_{type_idx}_{step_idx}``) share one shape. Once grouping folds passes into one layer the two numberings drift apart, and one Op's unsuffixed raw spelling can equal anothe...
4a79822fb4e79185645bd333a275a357dd873c8bf95d7ed064e9c39cd1a54faa
Python
9,691
258
"""TensorFlow recurrence grouping: multi-pass layers, relabel safety, tamper oracles.""" from __future__ import annotations import dataclasses from typing import Any import pytest tf = pytest.importorskip("tensorflow") keras = pytest.importorskip("keras") import torchlens as tl # noqa: E402 from torchlens.backend...
5efe7f78b688b0f7a22e6066b746c9a194f7d3e6cae02a77c9172e04606ee624
Python
9,691
283
"""F10 lovely item 7: container/query/result conversion laws. Containers point, records show (voice rule 1); honesty tokens are shared vocabulary and cannot be laundered by any presenter (rule 4); no public dataclass on the swept surfaces inherits an auto repr (D31, extended sweep); no ANSI/OSC-8 bytes in any returned...
8e55773e1ff2af80d0a985d7e48d7354a0bdd5584398f2bf68c4559b7b29fa7f
Python
9,692
260
""" The BatmanNet pretrain function """ import sys sys.path.append('../') import time import argparse from argparse import Namespace from logging import Logger import rdkit from tqdm import tqdm import os from timeit import default_timer as timer import torch import torch.nn as nn import torch.optim as optim import to...
da436788373723055bc7f5eda06fd92c1427127f8a7ac216fbfd37edf7aa14e2
Python
9,692
196
from typing import Optional, Union try: from typing import Literal except ImportError: from typing_extensions import Literal import matplotlib as mpl import numpy as np from pyvista import MultiBlock, PolyData, UnstructuredGrid from .three_dims_plots import wrap_to_plotter from .three_dims_plotter import _se...
040fa73e911cb091183ffe167e264e273f46d869ef721604633fff8a951e77d8
Python
9,694
268
from __future__ import annotations import pytest from pybind11_tests import numpy_vectorize as m np = pytest.importorskip("numpy") def test_vectorize(capture): assert np.isclose(m.vectorized_func3(np.array(3 + 7j)), [6 + 14j]) for f in [m.vectorized_func, m.vectorized_func2]: with capture: ...
02f511b2cc3892d485ed11bb61f9ca1e8db0a3849c72060498f344f9e56b9c40
Python
9,695
306
"""Kernels for SPD matrices.""" from array_api_compat import array_namespace as get_namespace from ._backend import _add_to_diagonal from ._check import check_function from .base import ctranspose, invsqrtm, logm from .mean import mean_riemann def kernel_euclid(X, Y=None, *, Cref=None, reg=1e-10): r"""Euclidean...
712aa586ecbbeb42049978650a95d04d2df0513a4d88ca293c29a4d39b722b73
Python
9,696
266
#!/usr/bin/env python3 """ File: plot_genotype.py Created: 2021/04/08 Last Changed: 2021/07/07 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 tre...
72022a0249088443b9edcb2d4af8e774a654a539f9ec3d84234fcf4e27aa32dc
Python
9,697
273
''' load the RBNS data ''' import csv import re import h5py import urllib import gzip from io import StringIO import requests import numpy as np import time import os from utils_rbns import create_datapoints from constants import get_args from map_protein_name import get_map_protein rbns_data = 'metadata_rbns.csv' #...
b3650881006db049d54f19ea7e48ee9a9804736ad285e5ce960cd8a1c6fe2cc7
Python
9,698
197
import pandas as pd import random holidaysfile = 'src/random_holidays_EPobjects_list.csv' def add_ddy_objects(command1 ,command2 ,idf1,ddy_data): """ #Add Sizing:DesignDay object from .ddy file to IDF command1 is a boolean to add the ddy objects or not if command1 is True and command...
4cef3f18333fba2a57610403c8b088e495720ba66d76a597d8f086bee7afa0f5
Python
9,699
260
""" History data access helpers for the page assistant agent. Thin string-formatting wrappers over Galaxy managers (HistoryManager, HistoryContentsManager, HDAManager, DatasetCollectionManager). The manager layer owns pagination, visibility/deleted filtering, and the implicit-conversion HID-uniqueness handling so this...
89ce4cb48f53bb73c1f3f67214867c1ddd00e3514571a0ea53512ba6dcbe7f06
Python
9,699
288
import os import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.cluster import KMeans, MiniBatchKMeans def kmeans_plot_multiple( embed_dict_t, graph_list, coords, taskname_t, output_path_t, k=20, dot_size=10, scale_bar_t=None, minibatch=True, pl...
41f1868dc1f72d021ce99440becb72a94866710a8782acd42f60c0c762865a2c
Python
9,700
334
"""This module defines Galaxy's custom exceptions. A Galaxy exception is an exception that extends :class:`MessageException` which defines an HTTP status code (represented by the `status_code` attribute) and a default error message. New exceptions should be defined by adding an entry to `error_codes.json` in this dir...
6c3b8161d204e7014ff5bb9b760c9e65e855f9ab9da47a53821e2224efc7d2cc
Python
9,702
242
"""Cross-backend agreement for the INCIDENTAL bare-label all-keys binding. There was never a documented contract for what ``layer_dict_all_keys[bare layer_label]`` resolves to on a multi-pass layer -- bare-label addressing of multi-pass layers refuses on every path that matters (``multipass_bare_label_ambiguous``). Bu...
db44c74dabfcef66b734271a47d642a49c62dd385f6a6b60081a29d1687a898c
Python
9,704
333
from typing import List, Optional, Union import dynamo as dyn import numpy as np import ot import pandas as pd from anndata import AnnData from scipy.sparse import csr_matrix, issparse from scipy.sparse.csgraph import floyd_warshall try: from typing import Literal except ImportError: from typing_extensions im...
517f8a41bb82722e332adbe2128bf3c647797a75a8c5964309e56056d243f234
Python
9,706
224
import tensorflow as tf import tensorflow_datasets as tfds import numpy as np from pdb import set_trace import cvnn.layers as complex_layers from cvnn.montecarlo import run_montecarlo def normalize_img(image, label): """Normalizes images: `uint8` -> `float32`.""" return tf.cast(image, tf.float32) / 255., labe...
fb1003ce71bf14e0d6a1ddecb9b5a6d4fdbd59b97e4f5efb493ff6b02a17b1b1
Python
9,706
248
import os import pandas as pd from tqdm import tqdm import torch from torchmetrics import MeanSquaredError, R2Score, SpearmanCorrCoef, PearsonCorrCoef from omegaconf import OmegaConf from Bio import pairwise2 import sys script_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(script_dir...
45d40cbdf9b7290f89cb2c97905a45d336e9d8529178fb0625e9f438a7043657
Python
9,709
256
"""Lazy out reference placeholders for portable TorchLens bundles. This module defines the lightweight references attached to lazy-loaded outs and grads. Each ref stores the bundle path, tensor metadata, and expected checksum so materialization can open a blob file on demand, verify integrity, return a tensor, and clo...
81edd6ceb94867ae03dd30dd11e27fc1e18607022380b8a6c4ab72223af2bcc1
Python
9,709
209
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from utils import setup_fonts,parse_config, build_output_dir,palette_by_model import numpy as np import os,math def combined_mutation_dataframe(args,prefix,output_dir,test_csv): models = {'seq-wt (LFN)' : f"{args.best_BIO_DIR}/{prefix}.{arg...
9129ce500315e26e3d86d9704c4155ce35eda3b998a3baed4a36ba58e61abb56
Python
9,709
263
import torch import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') import numpy as np import seaborn as sns from utils import parse_config, setup_fonts, build_output_dir def load_checkpoint(model_path): checkpoint = torch.load(model_path, map_location='cpu') opts = checkpoi...
6769bdf5478a13294694f73aa9caecedd0021be440d0d76bd2a5fc340fa910a8
Python
9,710
250
# coding: utf-8 # In[1]: # get_ipython().magic(u'matplotlib inline') import sys import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import scipy.io as io import pickle import json # In[2]: SBJ = sys.argv[1]#raw_input('Enter SBJ ID to process:')#'IR63' # # Log ...
ef4461f444f32fc44176c945afa84344e53ad5b7cd35f3243bd0d3dd99589e7d
Python
9,711
278
"""Visualization identity oracle (separate from the surface byte oracle). Forward and rolled DOT sources are byte-stable across processes (verified by the two-process control below, run BEFORE the goldens were frozen), so they are compared against full-source goldens. Backward DOT embeds ``id()``-derived grad_fn node ...
0a8738cc79db533500071acf0989ce3a0b27d66086be2bf9d9281f2d65f6d9ac
Python
9,712
235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 31 14:19:51 2021 @author: Florent Meyniel, Audrey Mazancieux Perform a Finite Impulse Response (FIR) analysis of the time series of activity extracted in the LC. The script assume that this time series has been preprocessed to remove the effect of ...
86f7f40a7a0c94c132e1e18931751b0755fa80d8351813410df6fd02fcfc1a83
Python
9,712
299
#!/usr/bin/env python """ TODO - consistent variable naming for p, min_percentile, max_percentile """ import numpy as np def robust_normalize(arr, p=1., axis=-1, method='standard score'): """ References: ----------- https://en.wikipedia.org/wiki/Normalization_(statistics) """ if method == 'm...
7fafd0be1d8bf3af35a5af46e59104e5500aab234e1ef4ecc97663f842aca422
Python
9,713
221
#Convert all HOC files in a folder to CNG files #Author: Ruben Ascoli, rascoli@princeton.edu, undergraduate, Princeton University #George Mason University Department of Bioengineering #Failures: weird formatting or not using pt3dadd method import os import sys import pdb # from .sort import swc_sort def hoc...
4073011ac689dac0ca54968f73b924b3179e01b735743a072c053d9a1fa417af
Python
9,715
210
""" Model Training and Testing ========================== `RectiPy` provides methods for training and testing of RNNs via the `fit_*` and `test` methods implemented on the `rectipy.Network` class. These methods provide a wrapper to standard `torch` training and testing procedures. Here, we will describe how you can co...
60c1d9ff2fbea3022d9c279578dcc83e94790c2f4f676b616d1d6ae10edc8787
Python
9,715
210
""" Model Training and Testing ========================== `RectiPy` provides methods for training and testing of RNNs via the `fit_*` and `test` methods implemented on the `rectipy.Network` class. These methods provide a wrapper to standard `torch` training and testing procedures. Here, we will describe how you can co...
46ff8b5bdc44f3692ac7f3d32747dfad5026beb23fbe9b2e94d9b78aa722dc24
Python
9,719
261
"""Regression tests for r18b bridge/hf.py hardening. Covers four A3 findings on ``torchlens/bridge/hf.py``: * A3-06 -- autoroute predicates must decline implausible modality/chat values. * A3-07 -- list image preprocessing must not run per-item transforms N+1 times. * A3-13 -- tokenizer provenance must report honest ...
1fe59de4be1fe50f937eed961b59936326fa661eb44288527ac16b1c22a98c54
Python
9,721
341
from typing import List, Tuple, Dict, Union, Optional import argparse import logging from pathlib import Path from pprint import pprint import numpy as np import numpy.typing as npt from ase import units as ase_units import plotly.express as px import plotly.graph_objects as go import pandas as pd import torch...
589844fba48f2aca9522d557d941cc826d60b8231248ed3fd8dd1d0e99ef6a40
Python
9,721
276
# 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...
62969a28ca1f5d2247081fbd5d8d7101832d059fcd8a12b0023d4c638a0bac70
Python
9,721
186
""" Analogous to CDR3 length, we can deterministically find the contiguous string of amino acids that match the corresponding V and J gene. Here we reconstruct the one-hot vector that encodes this information and add a loss concerning how well we are doing in matching it. Here's something we can use to check to make s...
b56073dd3a72c8283deda0f530e4cf85777c2a21bc29090f3ed33fe19e297deb
Python
9,721
343
import os import traceback import numpy as np import pandas as pd import seaborn as sns from .. import settings from os import PathLike import matplotlib.pyplot as plt from matplotlib.axes import Axes from typing import List, Union, Sequence from tensorboard.backend.event_processing.event_accumulator import EventAccumu...
aeffd5fa4b9c1c69bc91aaa2ffb1942f9c3a2f8a4b9f44e0e1b1805b2e42f158
Python
9,722
329
""" Mock hardware implementations for testing. This module provides mock implementations of hardware components like cameras, stimulators, and sensors for use in tests. """ import threading import time from typing import Any, Optional from unittest.mock import MagicMock, Mock import numpy as np class MockCamera: ...
c4eab57267755c4211735cfab14abfcd2a58a35ac8768332276dbc007a7088b4
Python
9,722
246
#!/usr/bin/env python3 """ build_trained_model.py — Fit and serialize the canonical trained model. Produces ``trained_model/trained_model.json`` containing every parameter needed to apply the trained classifier to a new cohort *without retraining*. ``deploy_classifier.py`` consumes this artifact. The trained model h...
3b2e37b3a723101df4db01f60f46991b4e9f1ae56d93bbd081464466aca5d439
Python
9,726
219
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
1c77ba522f58b1c6483994ba17bab8e06936420782fde3a88f5447924b77124d
Python
9,730
333
""" roi_figs.py This script contains functions defining ROI mask and projection figure panel analyses. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ from util import logger_util from analysis import misc_analys, roi_analys from paper_fig_util import helper_fcts logger = logger...
c95a288fd373d2373b04f642adf69ece3dea20849e9701324fa6aac2ba155a1d
Python
9,731
214
from typing import Iterable, Any from dataclasses import dataclass from mirp.settings.utilities import setting_def @dataclass class ImageInterpolationSettingsClass: """ Parameters related to image interpolating / resampling. Images in a dataset are typically resampled to uniform voxel spacing to ensure th...
ceafe2a6f13edc0b312989176d4b4660e021aa0e02721c7f476e242d4b746a34
Python
9,733
258
"""Direct liveness killers for ``_check_postprocess_contract`` (b9-sol R74-1). The postprocess contract checker was a surviving mutant: a return-None disarm stayed green across the mutation arming suite because the driver only ran validation files, and the planted enforcement tests in ``tests/test_postprocess_dag.py``...
d61348f59681a72c8d08395e36a2d6543af7a74794b7f9978c5948c3ccc510a4
Python
9,733
245
import gzip import os from pathlib import Path import shutil import tarfile import pandas as pd from tqdm import tqdm from Bio.SeqIO.UniprotIO import UniprotIterator from utils.Gene_ontology_utils import Ontology from collections import Counter import logging class SwissProtExtractor: def __init__(self, dataset_n...
68b7cffbd5c4098d7b7d07b4a41a0c5933fde64195fedb67caab84374412a9a6
Python
9,734
306
# -*- coding: utf-8 -*- # # eFEL documentation build configuration file, created by # sphinx-quickstart on Mon May 11 14:40:15 2015. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
a3a29b02e934ff91e6d5c82d154ca19899838060815f6378517f448ad92f5bbc
Python
9,734
218
from copy import deepcopy import os import numpy as np import multiprocessing import tensorflow as tf import tensorflow.keras as keras import tensorflow_addons as tfa import gc from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking from tf_spiking.helper import TrainingHistory from training.brightn...
76bb4c1834dbf1a7e493eec4aeab75982426c9d347b3a7d213b672ca58893978
Python
9,736
243
"""Five-step facade order: the testable spec, pinned (workstream A10). Architecture memo 5.4 / neuro memo D15: (1) underscore -> plain ``AttributeError`` immediately; (2) redirect table -> typed teaching ``AttributeError``, no dependency check; (3) refusal table -> typed ``AttributeError``; (4) real active name -> per...
0125879be06b4c1214266949118f3e9c519c2746c77d04a25172a047f3c2265c
Python
9,739
268
"""B1-02: the semantic-output scratch never survives onto a settled product. Four session-time fields are written at capture entry (``user_funcs.py``) and consumed ONLY by ``decode_outputs_for_trace``: _output_style _output_head _output_tokenizer _semantic_output_metadata Two of them pin LIVE USER OBJECTS -- ...
d23a7665604e8a42de0cc4d4516f9b697b24390da6fcfc102e004c57fcc497dd
Python
9,739
282
from typing import Optional, Sequence, Union import numpy as np import pandas as pd from anndata import AnnData from esda.moran import Moran_BV, Moran_Local_BV from libpysal.weights import WSP from .find_neighbors import neighbors def spatial_bv_moran_obs_genes( adata: AnnData, obs_key: str, connectivit...
2526e4f25ff414e1cd37b3b7d01af9a50ccd4d221aecf6309799181de4a129bc
Python
9,740
317
"""Tests for PIL-only node plot primitives.""" from __future__ import annotations import subprocess import sys from io import BytesIO import numpy as np import pytest import torch from PIL import Image, ImageDraw from torchlens.viz import render_heatmap, render_image_scatter, render_lineplot from torchlens.viz._ten...
0454effaf30fb6f7548bcd1d681192d1e90fb337ca1730a144b5535163cbddae
Python
9,741
264
"""Regression gate: rolled-view edge labels must never collide with anything. Renders the same 16-model rolled inspection set used to tune the edge-label placement constants, lays each graph out with ``dot -Tjson``, and runs the exact per-label geometry audit (``tests/support/label_geometry.py``). Any hard violation ...
279938567b0b4c6d694c094cb192121e06a0b06939845d5bb9e8dc3acd0f28d8
Python
9,741
266
"""Checks kit item 5/8: decrement skip ledger, watchdog, clip tiers. The decrement goldens (memo test plan row 4): the naive fire-count subtraction is asserted WRONG under K=4 accumulation (locking the refuted method's failure so it cannot return as an optimization), the decrement ledger is exact on 1-skip / consecuti...
e4f4f859ee65afbea269c23c0c734f4ea6d107d00b4855be6048a375f32c3b1b
Python
9,742
242
import warnings import re from tqdm import tqdm import torch import pandas as pd import transformers import scipy import numpy as np import logging def get_next_word_distr( prefix: str, model: transformers.PreTrainedModel, tokenizer: transformers.PreTrainedTokenizer, num_tokens: int = 2, cdf_thres...
ac964f2c81779afa8843edf10f974893d2b7732436bc52514f054104e6db04b7
Python
9,744
256
"""Annotations TRAVEL POLICY red tests (lane F40a, foldA D6). The foldA round-3 headline receipts, as permanent regressions: * R11 -- a fresh ``run(inputs=...)`` product carried the ORIGINAL episode ledger (``provenance_tier=exact``) under ``path_faithfulness=VERIFIED`` with zero warnings. * R12 -- the same class...
9e5666cc44f7ff722f36b1322febdfa6edc5309abb8ee49da09bc55a54b0e376
Python
9,745
308
#!/usr/bin/env python #========================================================================= # # Copyright NumFOCUS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://...
fce2daffe41f392a92fe2e939757895923c8b51a9c35d3602b4969e364d19083
Python
9,745
243
"""Fully Convolutional Network with Stride of 8""" from __future__ import division from mxnet.gluon import nn from mxnet.context import cpu from mxnet.gluon.nn import HybridBlock from .segbase import SegBaseModel # pylint: disable=unused-argument,abstract-method,missing-docstring __all__ = ['FCN', 'get_fcn', 'get_fcn_...
27972ba34e2ace7b2cc1971d8a117de40f2e38f14cb05183783c080fc2241e91
Python
9,746
278
import copy import io import matplotlib as mpl from matplotlib import pyplot from matplotlib.figure import Figure from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas) import matplotlib.patches as mpatches from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np from...
52f433f65fe0c35cf5afdfe91ed066445314ff8aece62d6134de25fdd3ccf543
Python
9,746
278
import copy import io import matplotlib as mpl from matplotlib import pyplot from matplotlib.figure import Figure from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas) import matplotlib.patches as mpatches from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np from...
82d13f16bded3277a95e9229fe9279ecf4864ad37acfdc5fbd11a881d3104b5e
Python
9,746
225
# -*- coding: utf-8 -*- # @Author: gviejo # @Date: 2022-01-17 14:10:40 # @Last Modified by: gviejo # @Last Modified time: 2022-01-18 17:40:08 import pynapple as nap import pandas as pd import numpy as np def computePlaceFields(spikes, position, ep, nb_bins = 100, frequency = 120.0, smoothing = 2): place_fields...
893789fb59bf0be847edb1657400e0c8fcf721e30bc8c6f22bfc3fcc82077b51
Python
9,746
251
import uuid import pytest from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup from celery.canvas import chain, chord, group, signature from t.canvas_helpers import ids_in_as_tuple from t.integration.conftest import get_redis_connection from t.integration.tasks import ExpectedException, add, fail, identity, redi...
5139e7179263f8b0a043852a7a9d65d6b7a884d173a14362fe93bdc2656e0d89
Python
9,748
224
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
7a48323b198603a6941267d727e3512d56ae251de9c672ddea3ade9541e27ded
Python
9,748
315
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import atexit import queue import numpy as np import slowfast.utils.logging as logging import torch import torch.multiprocessing as mp from slowfast.datasets import cv2_transform from slowfast.visualization.predictor import...
b10a5bfd2754c297854968039c43e94d34c785e3a36b7a0fc4d35bde7dcef2dd
Python
9,748
278
import logging import os import stat import sys from unittest import mock import pytest from codecarbon.core.cpu import ( RAPL_PERMISSION_HELP, IntelRAPL, _create_warn_function, is_rapl_available, ) def test_permission_warning_is_emitted_once(caplog): """The scan hits every domain: warn once, th...
e8cabd21c7a428b2484f4a03da6b19094c93ce926e018e14cafb989ad9dbf105
Python
9,748
260
"""Logging configuration. The Celery instances logging section: ``Celery.log``. Sets up logging for the worker and other programs, redirects standard outs, colors log output, patches logging related compatibility fixes, and so on. """ import logging import os import sys import warnings from logging.handlers import Wa...
bc2d6ecc307db317d1075c08114e5182c5dfcc86f48ae60fbbd1565b4cb852c3
Python
9,749
299
# SOURCE: vendored from https://github.com/cyanrain7/TRPO-in-MARL @ master # (algorithms/actor_critic.py + algorithms/utils/{util,mlp,act,distributions}.py, # unmodified architecture; only added lightweight args/space shims so the real # Actor/Critic modules can be constructed and called outside the full training # run...
2d80938845e8c040dea6b1fc0876ffa049af207bdc382ef0d9ceb2428b2fbcf6
Python
9,750
284
from typing import Any import numpy as np from neurogym.core import TrialEnv, TrialWrapper from neurogym.utils import spaces class RandomGroundTruth(TrialWrapper): # TODO: A better name? def __init__( self, env: TrialEnv, p: np.ndarray | None = None, ) -> None: super()._...
9b83dd00eef8cd4bb84602c0840b9f360171637adc2f17bf2fbc47ad36c08645
Python
9,756
288
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
24434a1776fdc488f98b4b3daf0d02edf95338e09b83a4918de845ff18ddcdda
Python
9,757
247
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Base autoregressive flow layer for PyTorch. """ # ============================================================...
ad3106e4590633fcd9dd5d8be93a37fa1f44e26230e21f0e693166f26f81c631
Python
9,758
217
""" Exploring Data Components ========================= This example explores the different data components, exploring the isolated aperiodic and periodic components as they are extracted from the data. """ ################################################################################################### # sphinx_g...
ad78ef49a595c429a9c842d2898a869c7ecd7d1dc6ff98e80347e8fa10049c02
Python
9,760
312
import glob import numpy as np import random import fnmatch import os from PIL import Image from matplotlib import pyplot as plt import PIL from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA #from tensorflow.keras.utils import to_categorical from sklearn.metrics import confusion_...
597aed8a6b61efbe6128244816e94e5993e210528f3523b3be34c10ba2dd7189
Python
9,761
306
"""Paddle backend derived-gradient preview tests.""" from __future__ import annotations from typing import Any import pytest paddle = pytest.importorskip("paddle") import torchlens as tl # noqa: E402 from torchlens.backends import BackendUnsupportedError # noqa: E402 from torchlens.backends.paddle import GradOpt...
f5c488c791e1a525405161261213a680fcddab0b300f21a744c79beb4b559c14
Python
9,761
221
""" Théo Gauvrit 24/08/2021 Try to implement the Alenda et al 2010 method absed on histograms of the Membrane potential Vm to discriminate Upstate and Downstates from resting menbrane potential recordings. The computing of the trough is changed to the direct mean of the Vm """ import numpy as np import pyabf import sc...
559bbcd943e2977353f6379e80aaaf06e779b9b3d039ff249f05cbe31344b02b
Python
9,762
329
# --- 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 Cells(_BaseTraceHierarchyType): _parent_path_str = "table" _path_str = "t...
cc5cc1a666889037cbf43584162419de63284ed6ce5c863d3a4b87604161af17
Python
9,763
181
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
a1dc1285e1d57aa4f55d2fa43d723a2687cc180870d3b75722e5da61560509c6
Python
9,765
235
import os import pandas as pd import numpy as np import pdb from sklearn import linear_model import scipy from optparse import OptionParser regr = linear_model.LinearRegression() def get_single_trial_bias(subject, condition, meta_data_condition): ################# load single trial biases #####################...
6c00e37821ca100074fda25521522c667009dbd5da4664a270161a64626f3b45
Python
9,766
300
""" Socket-based messaging between larvaworld and an external process. Provides the message envelope and the client and server endpoints used to drive a remotely simulated brain model. """ # Copyright 2017 Dan Krause # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file...