sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
00e1c2c7df21c865286b59b0808a7ba309eb8f259894b5851d057adb5912915b | Python | 16,952 | 388 | import wandb
import numpy as np
import os
from torch import autocast
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import argparse
from sklearn import metrics
from contextlib import nullcontext
import torch.nn as nn
import torch.nn.functional as F
from torch.hub import download_url_to_file
... |
b9402c6c3b48eebb189816fba2a38cb89d0980cfa1184f50847150ee520f28bc | Python | 16,952 | 400 | # code adapted from https://github.com/jfzhang95/pytorch-deeplab-xception/
# pylint: disable=arguments-differ,unused-argument,missing-docstring,unused-variable
"""Xception, implemented in Gluon."""
__all__ = ['Xception65', 'Xception71', 'get_xcetption', 'get_xcetption_71']
from mxnet.context import cpu
import mxnet.glu... |
796e7bc170236fcf7ecff26e6736a89d4b31e016a723595f8453646d764f538b | Python | 16,953 | 387 | import pickle
from AttentiveFP.AttentiveLayers import Fingerprint
from AttentiveFP import get_smiles_array
import torch
import pandas as pd
from torch import optim
import os
import torch.nn as nn
from utils.metrics import recall, precision, mcc, roc, accuracy, f1, bacc
import numpy as np
import torch.nn.funct... |
ae6b3c674c68d419e43153402539894c147a5935592e0e669a275297faf94497 | Python | 16,957 | 420 | """The R0 DEEP SWEEP (testing MEMO build row A4; PR-smoke blocking).
Fourteen real upstream architecture families (plus the structural fixtures)
built from vendored real configs at fixed seeds, ZERO network, swept DEEP:
exact recipe classification, per-family facet floors with shape checks
against the model's own dims... |
777538a912d4a4bdf030f1d461cab6b94996685e11039be77b5f0db1801187d4 | Python | 16,963 | 383 | import pandas as pd
# import yaml
import numpy as np
#import scipy.ndimage
import time, os, sys
import skimage.io
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 300
from cellpose import utils
from matplotlib import cm
from skimage.filters import threshold_otsu
from skimage.measure... |
ca3446b212a73992878686daa71f3bc8816732a563fd0325ecae5618b1e1ac91 | Python | 16,964 | 438 | """The ONE private registry kernel behind every typed public domain door.
Registry law (architecture memo 6.1): one PRIVATE kernel, many typed public
domain doors, never a public universal registry. Every supported open class
gets lifecycle completeness (register / unregister / list / info / snapshot),
a monotone epoc... |
a499ebce4713b43b3a579db645bcc1a83f6a320d2afda03c0058aceadd08a5a7 | Python | 16,969 | 361 | import wandb
import numpy as np
import os
from torch import autocast
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import argparse
from sklearn import metrics
from contextlib import nullcontext
import torch.nn as nn
import torch.nn.functional as F
from torch.hub import download_url_to_file
... |
7594da750a729524812e5816e0430bee683f79b8f5d184a3d722033f35459b67 | Python | 16,972 | 419 | from typing import Any, List, Optional, Type, Union
import torch.nn as nn
from torch import Tensor
from models.basic import DeepLearningBackbone
from models.utils import get_nonlinear, get_norm
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url ... |
7382d07b84684f6578632024d76633431cb46c8be586869be491aad70a7bc94f | Python | 16,979 | 428 | """Gradient-inside-geometric receptive-field tripwire tests."""
from __future__ import annotations
from collections.abc import Iterator
import pytest
import torch
import torch.nn.functional as functional
from support.rf_isolation import preserved_rf_registry
from torch import nn
import torchlens as tl
from torchlen... |
06b2e9fea3d76b816ebcb085ab2bbdb5d35be8a51af694662046c86875b5bfd7 | Python | 16,982 | 537 | """
Notebook runtime management for the portal.
Ensures a notebook server is available and resolves the notebook belonging to
a given dataset or model.
"""
from __future__ import annotations
import atexit
import importlib.util
import json
import os
import socket
import shutil
import subprocess
import sys
import temp... |
cb856a063a17a9d7fbb2b2ba3cb6944f4901ff3d12cb6b71d5da938310432be9 | Python | 16,983 | 336 | ##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
1134bfdffead486280f783c1cc46f4acd331c1085e5492760776af0ce2ea98d9 | Python | 16,989 | 520 | """Training pattern tests for train-mode capture."""
from __future__ import annotations
import types
import pytest
import torch
from torch import nn
from torch.nn import functional as F
import torchlens as tl
from .conftest import MultiTapModel, TeacherStudentPair, TinyResnetWithProbe, TwoLayerMlp
class SharedFr... |
985c4922454ed91355702b7bd05aa7753bb96946d845026519f259ffeb1210e3 | Python | 16,996 | 494 | # AUTOGENERATED by config_manage.py build_config_types — do not edit manually.
# Run `make config-rebuild` to regenerate from the config schema.
from datetime import timedelta
from typing import Any
class GalaxyAppConfigurationAttributes:
"""Type annotations for schema-defined "galaxy" config attributes."""
... |
d031e8ab9209559ba4232e74866e0b6d1c9792a16fb3f3d7fc617a545c92321a | Python | 17,004 | 557 | import base64
import decimal
import json as _json
import sys
import re
from functools import reduce
from _plotly_utils.optional_imports import get_module
from _plotly_utils.basevalidators import (
ImageUriValidator,
copy_to_readonly_numpy_array,
is_homogeneous_array,
)
int8min = -128
int8max = 127
int16m... |
994a8faad2d7c1abd5d24fbcf7e15e9b54f5f74ddafb61e8ff89dbae8e6888a7 | Python | 17,008 | 483 | """
Contains class for gaussian process hyperparameter optimizations.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
import tempfile
import os
import pdb
from deepchem.hyper.grid_search import HyperparamOpt
from deepchem.... |
3a1bb46ddfa3225461a6a782825ecd63187846f94b2a0530a633c7f576597064 | Python | 17,011 | 429 | """Resolver release-gate keys: private torch builtins and the module-boundary identity."""
from __future__ import annotations
import importlib
from dataclasses import replace
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._io imp... |
17d6c2f00941c81bc83426059b5aefc455e3b19ff5c6d4ddc5ccfe604396b9d4 | Python | 17,012 | 424 | #!/usr/bin/env python3
"""
File: plot_double_regplot.py
Created: 2021/05/24
Last Changed:
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 tree.
""... |
adec3f967d6845eb6181e21e00624d09ccc3d0fe8228664f4ca723259d7d1079 | Python | 17,019 | 442 | """Non-tensor Python model-input contract for sparse runnable execution.
These tests lock the honesty rule that a sparse runnable ``run`` may never report
``VERIFIED``/``ATTESTED`` after silently replaying the recorded taken path for a
*changed* non-tensor Python input (bool/int/float). A changed control input can
mak... |
e0649bcacc20d800bda89300f88b5d1802023a7ce1d4dc208ffbcf8b2d621f0c | Python | 17,024 | 459 | import io
import os
import shutil
import zipfile
from absl import logging
from keras.src.api_export import keras_export
from keras.src.legacy.saving import legacy_h5_format
from keras.src.saving import saving_lib
from keras.src.saving.orbax_util import build_orbax_abstract_pytree
from keras.src.saving.orbax_util impo... |
dffc5a461e8f890f1e6d3d996e2e567ae83edb51838673fa008f3ce24047e5c2 | Python | 17,026 | 557 | from functools import lru_cache
from typing import Generator
import numpy as np
import pandas as pd
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
from mirp._features.histogram import get_discretisation_parameters, HistogramDerivedFeature
from mirp.settings.feature_para... |
3abf1ad2e23aa560fe82f6591b73be3b6aa58d8a447b79e57a72738e1a388639 | Python | 17,030 | 394 | """Server-Sent Events (SSE) connection manager for real-time notifications.
Manages per-worker in-memory mapping of user IDs to asyncio.Queue instances,
enabling push of events from any thread (e.g. Kombu control queue worker)
to async SSE endpoint handlers running in the uvicorn event loop.
"""
import asyncio
import... |
f1f9d9a348746fa6cc9fd20eea76384da4d9073691689e65b6f3e0a954504b8a | Python | 17,030 | 515 | """Run simple cell optimization"""
"""
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... |
9cdfdd3bb80f76965c5a95440380bb1403c4e64c85affd766a4011aa69805b7d | Python | 17,042 | 550 | """
Compatibility checks between an experiment and its environment.
Reports the mismatches that would make a run meaningless -- an experiment
requiring an odor source in an environment that defines none, and similar --
before the simulation starts rather than after.
"""
from __future__ import annotations
from datacl... |
d8290682a4ab65306c79d974b09deb7392c638a9448fe08ba725ed007f9cc709 | Python | 17,044 | 465 |
"""Pairing logic for multimer data pipeline."""
import collections
import functools
import string
from typing import Any, Dict, Iterable, List, Sequence
from helixfold.common import residue_constants
from helixfold.data import pipeline_a3m
import numpy as np
import pandas as pd
import scipy.linalg
MSA_GAP_IDX = res... |
384f937ca306c737ffd47750c8f6b9ca0f3e7c15b5849c747aff439a6e2bbbc7 | Python | 17,045 | 490 | '''
The Green Algorithms calculator is a modularized two-pages application
fully implemented in [Dash](https://dash.plotly.com/). The code base is organized as follows:
* the `app.py` script generates and runs the app,
* the `pages\home.py` and `pages\\ai.py` scripts define the page-level features of the app,
* the `... |
da4c617613405e3c26573a728a75fc03801d72d467c2ee0de564fbec968b9b22 | Python | 17,047 | 448 | import re
from typing import Any, Dict, List, Optional
import os.path as osp
from itertools import chain
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from .graph_preprocessing import GraphDataProducer
from scipy.signal import find_peaks
from .auc_roc import auc
class OrcaAnl... |
6fe4894d48bfc54ff3cbb3d944360a624829ffc03a7e369843180e2b0fe25cae | Python | 17,048 | 471 | """
Basic Agent-based modeling classes
"""
from __future__ import annotations
from typing import Any
import random
import sys
from datetime import datetime
import agentpy as ap
import numpy as np
import pandas as pd
from ... import vprint
from .. import reg, util
__all__: list[str] = [
"BasicABModel",
"ABM... |
01f812b50b2177e99ec7ce438e1bce9b4affa94fadb204ddcba15b6fefcdafe5 | Python | 17,066 | 396 | import numpy as np
import torch
from torch.autograd import Variable
from torch import autograd, optim, nn
import torch.nn.functional as F
from torch.distributions import Categorical
from collections import namedtuple
use_cuda = True
if torch.cuda.is_available() and use_cuda:
device = torch.device('cuda')
else:
... |
2691b6582fab9adb7346e1879e0d7365576d4b5804b69055d2a6d94d9c3d3230 | Python | 17,066 | 463 | """
Author: Derek van Tilborg -- TU/e -- 20-05-2022
All code for featurizing a molecules into molecular descriptors, molecular graphs, one-hot endode SMILES strings and
tokens.
- Featurizer: Main molecule featurizer class that converts SMILES strings to computable info.
... |
cf77765642c071443f49dbd17b7aed15d67125673176c93155cb9028d1996340 | Python | 17,070 | 370 | #!/usr/bin/env python3
"""
File: check_expression_distribution.py
Created: 2021/11/30
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... |
845b9e48e609470d5abcaddbf406ca2cf531f2a02d5667a14c20c61057752489 | Python | 17,074 | 367 | """2. Train Mask RCNN end-to-end on MS COCO
===========================================
This tutorial goes through the steps for training a Mask R-CNN [He17]_ instance segmentation model
provided by GluonCV.
Mask R-CNN is an extension to the Faster R-CNN [Ren15]_ object detection model.
As such, this tutorial is also... |
7aec467346d639bd289b436c555e5fda5b2e662ab86e533457668110df3fae6b | Python | 17,075 | 425 | #!/usr/bin/env python3
"""
SQLite Database Duplicate Data Finder
This independent script recursively searches for SQLite database files and identifies
those containing duplicate data. It can check specific tables (VAR_MAP, METADATA)
or all tables based on command-line options.
Usage:
python find_duplicate_data.py... |
bb53f5e68b491f5299f5d06de81aa02f2fd6a3243f6ee5863c5e297cbae8e89c | Python | 17,078 | 571 | """Tests of `signal_processing` for pynapple"""
import re
from contextlib import nullcontext as does_not_raise
import numpy as np
import pytest
import pynapple as nap
def test_generate_morlet_filterbank():
fs = 1000
freqs = np.linspace(10, 100, 10)
fb = nap.generate_morlet_filterbank(
freqs, fs... |
27aff1556b46f1ef35e6e9edd8962d566ffb379b4380b386d227d9f5fb9174fc | Python | 17,091 | 512 | # -*- coding: utf-8 -*-
"""
This code will search for the parents of a single cell, get the DI for all individual, pair, and triplet of parents.
It does so separately for different time intervals and types of restrictions on parent sets.
No need to parallelize -- statsmodel will do so while fitting, and getting m... |
37798e04a87efa482431499c15b710268f3a7132911f3f936e4e6b3fb53b96da | Python | 17,099 | 449 | # pylint: disable=unused-argument
"""Pyramid Scene Parsing Network"""
from mxnet.gluon import nn
from mxnet.context import cpu
from mxnet.gluon.nn import HybridBlock
from mxnet import gluon
from .segbase import SegBaseModel
from .fcn import _FCNHead
# pylint: disable-all
__all__ = ['DeepLabV3', 'get_deeplab', 'get_dee... |
082066c1a18f70a1ab1b547a53865bdba151eb833a791bdd3b7247cd744701a7 | Python | 17,104 | 382 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
4ab4f6bbd5fc66704a8bc5da58be38e661e6ff8828106efe28e16401ef1faeb3 | Python | 17,114 | 408 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" PLUS-RNN model classes and functions """
import sys
import numpy as np
from s... |
555b28ae22471a79d8977362e35fcc20c0944d47e974ea5e74781e0d145e2c2f | Python | 17,130 | 424 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
f0f61dbc040800ec796323c8ad6de3acb08192315fce602197d73a153c6fe5e9 | Python | 17,132 | 196 | #!/usr/bin/env python3
"""Разбор пилотов 13 октября 2026 (seed'ы 101-103, не подтверждающие данные).
Печатает markdown, который кладётся в runs/a2/pilot/PILOT_2026-10-13.md и
runs/b2/pilot/PILOT_2026-10-13.md."""
import json, statistics as st, math, sys
P = "/home/claude/pilot"
def rows(name):
try:
return ... |
bc2396e159e2518adba8f3392402457507246ca75af10205517b3e1c7f698dcb | Python | 17,141 | 493 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Selection(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_... |
28828fcc91696fa530721498f49bbdfa4c5e997f408e1f55a7a9ae38ea390dca | Python | 17,142 | 455 | """
Unit tests for sleep restriction functionality.
Tests for DailyScheduler and mAGOSleepRestriction stimulator classes.
"""
import json
import os
import tempfile
import time
import unittest
from unittest.mock import MagicMock, Mock, patch
from ethoscope.stimulators.sleep_restriction_stimulators import (
Simple... |
7890dc0debf1babe27d765cf5d66c14ecc37c8a8504dc4aea402b776e85f0896 | Python | 17,146 | 467 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from tqdm import tqdm
from ..utils import _raise, consume, move_channel_for_backend, backend_channels_last, axes_check_and_normalize, axes_dict
import warnings
import numpy as np
... |
60d4510096ededfe874b1b9883af7462d07a4864615043e3978f5a63a9340784 | Python | 17,152 | 498 | """
Mock infrastructure for testing ModelManagers.
"""
import os
import shutil
import tempfile
from collections.abc import (
Callable,
Hashable,
)
from typing import (
Any,
cast,
)
import mako
from galaxy import (
di,
quota,
)
from galaxy.app import UniverseApplication
from galaxy.auth import... |
1da6178c63415c47a2a3cfb2776c4e7a29da11d7e876bccde6e20894ab516104 | Python | 17,153 | 424 | """One-backward reads: accessor, suppression, engine, and table core (F04).
Covers M(reads) acceptance rows 1-4, 9, 14, 15 at toy scale: the substrate
census invariants, suppression stability with its paired negative, the
id-rejoin fallback, oracle agreement, batched == sequential with exact call
counts, target-order ... |
fbeb2176209e7de7e0de4e4f1fb6eb39b729a24d8331c6cf9435ee517319e610 | Python | 17,157 | 439 | """F06 B1/B3/B4: binder contract, noise tunnel, GradientShap.
Attrib memo D1-D7 and D10: the two wrapping routes and their typed refusals,
NT semantics (zero-noise degenerate exactness, seeded determinism, stored
noise banks, aggregation vocabulary, repeated-reference identity, integer
leaves unchanged, composition ru... |
78ddffbb2d40a81b667fde9e5ff68f9247042d847e8e3fbbedf83495e5472844 | Python | 17,159 | 622 | """
Come estrarre i potenziali siti dalle proteine???
- Abbiamo delle statistiche sulle distanze ...
dato un certo aminoacido.. che si fa???
* Vediamo a quanti aminoacidi è connesso che rispettano le statistiche ...
* Tra tutti i risultanti, prendiamo tutti i gruppi a 3,4,5,S-1
- Calcola matrice di adiacenza
- Per s... |
003cb1344a59032c14bdcd3be0b8b1ca9e0cce6ffef3f93c0be79c816e59a1fb | Python | 17,169 | 85 | imagenet_templates = [
'a bad photo of a {}.',
'a photo of many {}.',
'a sculpture of a {}.',
'a photo of the hard to see {}.',
'a low resolution photo of the {}.',
'a rendering of a {}.',
'graffiti of a {}.',
'a bad photo of the {}.',
'a cropped photo of the {}.',
'a tattoo of a... |
52f3fa54b63a16dba7410b85d689d762827fd4542e9ef4bb3cf3b8aab954553a | Python | 17,172 | 442 | #!/usr/bin/env python3
"""
ds005385 (Wascher et al. 2025, Dortmund Vital) — CAR + 5D + Extras
===================================================================
Combined 5D + extras (FOOOF/topo/conn/asym) ingest for the
selective age-60-70 HC slice (109 subjects). Mirrors lemon_reprocess.py
pattern so outputs land in... |
0e06d9b4202bb1079904c8ad52fbb21092d93612f429a2cdad64697d5b3620ba | Python | 17,176 | 471 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Math and geometry utility functions to manipulate coordinates.
"""
# =========================================... |
f7f25cbf9c6fed08a68943f7996c0743eb62741ce7dd4a3981e1efb7537d617f | Python | 17,176 | 395 | import torch
import random
import numpy as np
from itertools import compress
from rdkit.Chem.Scaffolds import MurckoScaffold
from collections import defaultdict
from sklearn.model_selection import StratifiedKFold
def generate_scaffold(smiles, include_chirality=False):
"""
Obtain Bemis-Murcko scaffold from smi... |
0c311872581048d68c2fe12d9c21469ace56aec2217f73a4e13bffbc35c66fd8 | Python | 17,183 | 526 | """A shared module's alias spelling refuses at every door; its canonical name fires everywhere.
``self.enc = blk; self.dec = self.enc`` registers one module object under two
addresses. ``named_modules()`` reports it once, under the first name, and
TorchLens labels every call of it with that canonical name (``enc:1``,
... |
48f112caec474ed7b3ed702118ffb76bd73d1b9184194b4748c555ab348a1a3b | Python | 17,187 | 385 | """Bounded JSON reads for attacker-controlled ``.tlspec`` manifest boundaries.
A hostile ``.tlspec`` can carry a deeply-nested ``manifest.json`` whose stdlib
``json.load`` blows the C recursion stack -- an uncaught ``RecursionError`` that
escapes ``tl.load(path)`` before any descriptor-parse graceful-degradation net
r... |
1804ba16cf32eedefe0cec5af7aec4835bd43aa2b0570bb24a21e7632b7a0cca | Python | 17,191 | 421 | #!/usr/bin/env python3
"""
5D Eval — Diagnostic A: within-group scatter audit.
Question: why does 5D give big group-level effects but poor individual
classification? Is it because (a) individuals scatter widely around their
own group centroid (overlap with other groups), or (b) disorders are
multi-modal (sub-types)?
... |
392392d3365abbce324d26acc6ecd918beedea4e48b35b4021f623510342bc66 | Python | 17,199 | 491 | #!/usr/bin/env python3
"""
File: compare_explained_variance.py
Created: 2022/01/18
Last Changed: 2022/07/25
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 th... |
c787af412bf87d3e4230f5dceb14cd55bc9d5eae8a43597be9ced8bb19d21965 | Python | 17,210 | 550 | """
Unit tests for larvaworld.lib.model.modules.sensor
Tests the Sensor base class and its subclasses (Olfactor, Toucher, Windsensor, Thermosensor, OSNOlfactor).
Focuses on sensory processing logic: perception modes, decay, gain updates, brute_force modulation.
Following FUNDAMENTAL RULE: Read source code first, test... |
926beab09745de9c4dedb07c8821e74511f18d283a375d7d8a35aebf86e139fa | Python | 17,213 | 462 | """Configuration introspection and defaults."""
from collections import deque, namedtuple
from datetime import timedelta
from celery.utils.functional import memoize
from celery.utils.serialization import strtobool
__all__ = ('Option', 'NAMESPACES', 'flatten', 'find')
DEFAULT_POOL = 'prefork'
DEFAULT_ACCEPT_CONTENT... |
ea992769cc93490f435caf897ec71ab3e9168a4040c9c6f3ccf3a6fa08e6a4f0 | Python | 17,215 | 411 | """
signif_grps.py
This module contains functions to run analyses of ROI groups showing
significant differences between unexpected and expected sequences in the data
generated by the Allen Institute OpenScope experiments for the Credit
Assignment Project.
Authors: Colleen Gillon
Date: October, 2018
Note: this cod... |
8cb835bba2997a137d73602080f4f0423059e7ec947921dad70592c01bd86ab1 | Python | 17,216 | 398 | import time
import numpy as np
import pandas as pd
from library.comput_utils import circgaufunc, boxfunc2d, gaufunc2d_angles, gaufunc2d, cal_hd_np, pair_diff
def createMosProjMat_p2p(startpos, endpos, posvec_mos, posvec_CA3, act_sd):
"""
Create weight matrix with shape (N, M), from M mossy neurons at the st... |
32296b07f77d64f0df9cd6e7ec9da146ec6836440c9502012f9f07ebaa618896 | Python | 17,218 | 461 | # Copyright 2021 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 agr... |
ee4f68ac05cd36febcb248ce552f867cde90daf51607664742c2a1e372a907d2 | Python | 17,218 | 504 | """Historical CNN/MLP architectures: CaffeNet, OverFeat, NetworkInNetwork, Maxout, Highway, Pi-Net.
A family of landmark architectures from 2012-2020 that defined modern deep learning.
---
CaffeNet-original-LRN (Jia et al., 2014 BVLC CaffeNet):
Paper/Source: https://github.com/BVLC/caffe/tree/master/models/bvlc_ale... |
2aea9a23dd001f9fbc58fb775a114bf551cc754b6ccf47cbb941241e5a202279 | Python | 17,220 | 409 | # miscellaneous tools
import os
import subprocess
import sys
import pandas as pd
from collections import defaultdict
import gzip
from numpy import unique
import numpy as np
import pickle
#import HTSeq
#import pysam
#PATH = './'
PATH = os.path.dirname(__file__)
HOME = os.path.expanduser('~')
STAR_PATH = os.path.joi... |
9ffc95d3a0fd26217b928bb2989c11bb76a1a2cab97a418daaf05a912e5f69d7 | Python | 17,221 | 383 | #!/usr/bin/env python
"""Tools to visualize the weights/filters/neurons in a (convolutional) network."""
import math
import os
from typing import List, Iterable, Union
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy
import tensorflow as tf
import tensorflow_addons as tfa
import tensorflow... |
7aaa842edef4c05d9ea7714d112e4a2ebb8e571596559e3f07b9ca359ca2a71f | Python | 17,223 | 339 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from __future__ import print_function
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
import os, iterto... |
f04557304ca25cd6b83ea1ab723b59c19c4aa79ef65629dc9509132a98c8d598 | Python | 17,228 | 541 | import pickle
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pytest import approx
from scipy.stats import mode
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_va... |
e98749c369cff68a781595a655f9fbdf7cd390b3dbb1fb779da6cd70ecbf472a | Python | 17,229 | 410 | import sys
sys.path.append('../TM2_segmentation')
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
import logging
import SimpleITK as sitk
from scipy.signal import medfilt
import numpy as np
import nibabel as nib
import skimage
import functools
from skimage.transform import resize
import subprocess
import pandas a... |
1c954fc7b82524f92ac5920f364f7155b53c26d3697dbab0859ba1055f8ba893 | Python | 17,230 | 399 | """Round-21 security regression: first-party pickle-REDUCE RCE in the bundle unpickler.
Before r21 the bundle ``metadata.pkl`` unpickler admitted the ENTIRE ``torchlens.*``
callable namespace as a pickle REDUCE target (``callable(obj) and
_is_torchlens_owned(obj)``). Because ``torchlens.utils._module_is_installed`` do... |
b9f4983d8dccc1e4eb4d1f4658d594dbb03fc2bca96d4d73f320059bbcc59dca | Python | 17,236 | 462 | #!/usr/bin/env python3
"""
EC-vs-EO alpha reactivity feature extraction (Dx T).
Two cohorts support extraction from raw data:
- LEMON (BrainVision 2500 Hz, S200 = eyes-open, S210 = eyes-closed;
16 alternating 1-min blocks).
- ds006036 (EEGLAB .set, photomark task; events.tsv contains
"open eyes" and "close... |
13e3757a69849fbe24da602f377ff7e7f745a3ec31cecb90df32ce02c99a58e8 | Python | 17,242 | 600 | """
Pynapple class to interface with NWB files.
Data are always lazy-loaded.
Object behaves like dictionary.
"""
import errno
import importlib
import os
import warnings
from collections import UserDict
from numbers import Number
from pathlib import Path
import numpy as np
from tabulate import tabulate
from .. import... |
80956b29f6ab88a6d95a8fb7162a9e9cff68f3ea597c5d91fdf5c4bc7b14d442 | Python | 17,257 | 397 | import numpy as np
from scipy import stats
import pandas as pd
from datetime import timedelta
from collections import defaultdict
from skmob.measures.individual import home_location
from ..utils import constants
import sys
from tqdm import tqdm
tqdm.pandas()
from skmob.utils.gislib import getDistanceByHaversine
def _r... |
c0a98c464f58b9d13a65b401b722911e2a19ed5ab3344a916d8ceddf350efe29 | Python | 17,259 | 479 | """
====================================================================
Classify fNIRS data with block diagonal matrices for HbO and HbR
====================================================================
This example demonstrates how to classify functional near-infrared spectroscopy
(fNIRS) data using block diagona... |
fd7c07404c86bcccdab1c07140217decd073f38d01c0de5c0312e819b42a6da2 | Python | 17,267 | 447 | """Session-provenance-stamp leak closure (r79, r78 free HIGH).
Round-78 (free, review) demonstrated ONE root bug outside the r77 predicate's
session-scoped world: session cleanup removed provenance stamps by RE-TRAVERSING
the live model tree (``_restore_session_param_state`` iterated
``model.parameters()``; ``_undecor... |
cf1c5e7419c46164bf7f386ff3438f392dd310561255115d5888b0c35bc4e867 | Python | 17,269 | 427 | import random
import os,re
import matplotlib
matplotlib.use('Agg')
from tqdm import tqdm
import numpy as np
import pandas as pd
from scipy.signal import convolve
from collections import defaultdict
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio import SeqIO
from utils import parse_config, buil... |
eafbf1c957820aade9edbca3372bdc4ce2b25d56cfdc0b5acf4d78b47a707786 | Python | 17,270 | 450 | """
Node API Module
Handles node system management including information, daemon control,
configuration management, and system actions.
"""
import datetime
import os
import signal
import socket
import subprocess
import netifaces
from .base import BaseAPI, error_decorator
# System daemons configuration
# docker_con... |
b68606d3436663b7686cf3f5eb1fc70047eb38869059d7bae19b22cb706a80ab | Python | 17,276 | 444 | import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.src import ops
from keras.src import quantizers
from keras.src import testing
from keras.src.quantizers.fake_quant import FakeQuantWithMinMaxVars
... |
531b0033926a3d58d36b7da593e6920f99f22bdac7b63cc025faa22a7a170069 | Python | 17,277 | 413 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" PyTorch dataset classes and functions """
import sys
import random
import num... |
e8c58fa25a30d6e1efb39cf74647b890c855da411bdd1d174c8984d30d289b7d | Python | 17,278 | 449 | import inspect
import math
import textwrap
from keras.src import backend
from keras.src import dtype_policies
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.backend import KerasTensor
from keras.src.backend.common import remat
from keras.src.backend.common.keras_tensor import a... |
03045fe508e3a09a39b6fcadf14ea2a26553b002273fda0e89af5fb063245389 | Python | 17,279 | 456 | # Copyright 2021 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 agr... |
6b04fe849436e3da89752263386d52c635a65d00ecbb0ff4e58aced47d20898c | Python | 17,279 | 530 | from __future__ import annotations
import sys
import pytest
import env
from pybind11_tests import IncType, UserType
from pybind11_tests import builtin_casters as m
def test_simple_string():
assert m.string_roundtrip("const char *") == "const char *"
def test_unicode_conversion():
"""Tests unicode convers... |
c3b89e06f421d949845858c12f2c5d27082c88a69ac3f6f19d10ed5b52ed5d24 | Python | 17,279 | 480 | from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
from torch.utils import model_zoo
__all__ = ['PolyNet', 'polynet']
pretrained_settings = {
'polynet': {
'imagenet': {
'url': 'http://data.lip6.fr/cadene/pretrainedmodels/polynet-f71d82a5.pth',
... |
7652641575b1fd16964d8bbf90a6837cb17b01a7c3b2e862071010080c72b8c5 | Python | 17,293 | 423 | """R0 axes rows (testing MEMO build row A5).
The four measured cross-cutting axes at zero network: the eager/sdpa FACET
DIFF asserted explicitly (D7 class 1, the top measured class), kwargs
identity + the static shadowing intersection check (D7 class 3), the
pass-qualification pin on distilgpt2's 2-pass residual adds ... |
7d4fac972d1ebe5ae256e943e83e5530002e570d949996602fb19caf71ed8263 | Python | 17,296 | 420 | #!/usr/bin/env python3
"""
proper_cv.py — Per-fold rank-norm + whitening + LDA evaluation
================================================================
Replaces the current pre-CV-normalization pipeline (which fits
rank-norm and whitening once on the full pool, then re-uses the
fits across LOO/LOCO folds) with a st... |
329f0b8f9461527774ce00d605f165892e7b5aee44f83d27e6048add9e54084f | Python | 17,304 | 471 | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
import pytest
from larvaworld import DATA_DIR
from larvaworld.lib import reg
from larvaworld.lib.sim.manifest import RunManifestSession
from larvaworld.portal.datasets import dataset_manager_app
from larvaworld.... |
ddbf54e348afe9a39f7e3e0013c48d7838def5183126b3cf2555bf87dd9071b8 | Python | 17,307 | 342 | import numpy, voxcell
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from parcellation_project.split import decide_split as splt
import hdbscan
from scipy.spatial.distance import pdist,squareform
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
from sklearn.metr... |
3e0a5a5d481b3ca4f81a57420d7f112908a1c919cac0c71e9ae24d2241450380 | Python | 17,309 | 432 | """Geocode a place name and fetch the OSM data that covers it.
Public entry points:
- :func:`geocode` -- a place name, or a list of them, -> a Shapely polygon for the
place(s), via OpenStreetMap's Nominatim service.
- :func:`get_data_by_geocoding` -- geocode a place (or places), then download (and by
default crop... |
daaed81e6193fb463a6b5dcf626e18d17990820a497c99b657b9b9ee3907fbe1 | Python | 17,309 | 465 | import numpy as np
from absl.testing import parameterized
from keras.src import testing
from keras.src.metrics import regression_metrics as metrics
class MeanSquaredErrorTest(testing.TestCase):
def test_config(self):
mse_obj = metrics.MeanSquaredError(name="my_mse", dtype="int32")
self.assertEqua... |
4569eb589601e919fb8d9a89563515358863a591b86d573516d929aa84ca416a | Python | 17,318 | 455 | # https://www.kaggle.com/code/vidushibhatia/2-ultrasound-nerve-seg-unet-from-scratch
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
impo... |
fb96bf95560cda8bf944126bb767720bbeef69369adeae3fd41ed452b42ffd39 | Python | 17,320 | 408 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
GAMMA_RELU = 1.7128585504496627 # =np.sqrt(2 / (1 - 1/np.pi))
# %% nonlinearities
class scaledReLU(nn.ReLU):
# TODO integrate the scale here so that we can put the alpha and beta in here
def forward(self, input):
... |
f067286593a0ddc11f686686caaaf40f0f27525743e44e09001222687d7d9658 | Python | 17,321 | 517 | """Functions for highpass, lowpass, bandpass or bandstop filtering."""
import inspect
from collections.abc import Iterable
from functools import wraps
from numbers import Number
import numpy as np
import pandas as pd
from .. import core as nap
def _validate_filtering_inputs(func):
@wraps(func)
def wrapper(... |
039d58b636af837f00b2de7fbefc314112772703992265863739647f73b2c162 | Python | 17,323 | 473 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.ClosedOpenModel import ClosedOpenModel
from M... |
49eef581ae3d7d787e4d5cbde74d31839a91563adb6b6e7cb637da29aec8bd08 | Python | 17,324 | 500 | #!/usr/bin/env python3
"""
STEPS 3D calcium diffusion in realistic morphologies with geodesic binning
Last updated: 09.04.2026
Author: Laura Keto
Description
-----------
This script performs 3D calcium diffusion simulations in realistic astrocyte
branchlet morphologies using the STEPS simulator. The intracellular spa... |
50cc4def1a60066ec5eb184bbe57ec6288845b25fa2494a071488b9a409d4d9e | Python | 17,325 | 418 | import gc
import numpy as np
import paddle
import paddle.nn as nn
try:
from paddle import _legacy_C_ops as _C_ops
except:
from paddle import _C_ops
from ppfleetx.distributed.protein_folding import dap
from ppfleetx.models.protein_folding.common import (
init_gate_linear,
init_final_linear )
from heli... |
fcaffd612066295bc49c8494c823222e9f6a67a7e00551b0637d0da1ad753b78 | Python | 17,327 | 490 | import json
import logging
import os
import shutil
import socket
import tempfile
from autouri import AbsPath, AutoURI
from .cromwell_metadata import CromwellMetadata
from .cromwell_workflow_monitor import CromwellWorkflowMonitor
from .nb_subproc_thread import NBSubprocThread, is_fileobj_open
logger = logging.getLogg... |
0b7dd3a2831ef8d27d98369646a858d76f95a7d762f6f24563cb7b45e94ede4c | Python | 17,328 | 436 | # Copyright 2025 Google.
#
# 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 writing, soft... |
8afbffb79b9d99d73a213bdbadea4507054d5d1c22e4b297c5d8c60a6c2b3a32 | Python | 17,334 | 440 | """Shape-matrix tests for analyzer/modifier/transform functions.
These tests verify that each in-scope function applies independently across
arbitrary leading and trailing dimensions around its key axes. Some tests are
expected to fail in Phase A — those failures form the Phase B backlog.
"""
from __future__ import a... |
22e53b99a95783ec006706c724d3c90573cc931e92794aa75af7429b0d707d03 | Python | 17,340 | 497 | """
Base classes for nested, composable configurations.
Provides the nested configuration container that lets ``param`` classes hold
other ``param`` classes as attributes, together with the helpers that generate
such classes, read their defaults and expand shorthand keyword forms.
"""
from __future__ import annotatio... |
5c984e9297d9dbca2b512c4fe4e550789e42fb609b1d16f782e5f9373810f1fe | Python | 17,342 | 366 | from typing import TYPE_CHECKING
from sqlalchemy import (
and_,
func,
literal,
or_,
SQLColumnExpression,
true,
union,
union_all,
)
from sqlalchemy.orm import aliased
from sqlalchemy.sql import (
ColumnElement,
select,
Select,
)
from sqlalchemy.sql.expression import (
CTE... |
58b8bb24a8fdfd9a64f3da69cc2ed64c8a3290927b4cb3896d449978f3675b51 | Python | 17,349 | 397 | # Copyright (c) 2024, Tri Dao.
from functools import partial
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torchvision.ops import StochasticDepth
from flash_attn.modules.mha import MHA
from flash_attn.modules.mlp import Mlp
try:
from... |
a3c0b9fd4fdcd7d00bc42d58b276851b88598c255855c316cee79a9dce1a9564 | Python | 17,349 | 437 | """FW2-SECIO artifact-I/O hardening batch: perms, glob safety, ceilings, containment.
Each test proves a specific artifact-boundary guarantee and FAILS against the
pre-fix behavior:
* B8-10 -- ``metadata.pkl`` / ``manifest.json`` and the bundle directories are
written private (0600 / 0700), matching the already-060... |
13195c389ebe4270bced3b22b1947e5d9e28e3b0c0cb44f285fba3af75491563 | Python | 17,351 | 460 | """Tests for xcp_d.ingression.utils."""
import json
import os
from unittest.mock import patch
import nibabel as nb
import numpy as np
import pandas as pd
import pytest
from xcp_d.ingression import utils as ingress_utils
def _minimal_nifti_3d(shape=(4, 4, 4), path=None):
"""Write a minimal 3D NIfTI (e.g. mask) ... |
618c8c9e9c21a8cad00f49870b15af91a899d686480f21b7bed2fecb3d8286f5 | Python | 17,353 | 414 | import numpy as np
import pandas as pd
from pandas.errors import ParserError
import os
import datetime
import logging
import glob
from score_behavior.score_config import get_config_section
logger = logging.getLogger(__name__)
# indices:
# - cur_scheduled_run: the ordinal number of run as per experiment sheet. That... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.