sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
cb2647df6aeb1789c0a8db495c1570266a00798f2abf1ed21cc9a44ea4690069 | Python | 6,690 | 129 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
35867fa0a407dfdfb921dde3dcbd23c1c1d084eaac385f99ad2bdde1a3ceb5a6 | Python | 6,692 | 221 | """Conversion functions for organizing model results into alternate representations."""
import numpy as np
from specparam.bands.bands import check_bands
from specparam.modutils.dependencies import safe_import, check_dependency
from specparam.data.periodic import get_band_peak_arr
from specparam.data.utils import flat... |
f02bd4b9822e9b7ff504cd4273291e4c808a2cb0c599bb9897c301d4713a3d24 | Python | 6,692 | 197 | import numpy as np
import tqdm.auto as tqdm
from permacache import permacache, stable_hash
from .gtex_data_table import exon_junction_data
@permacache(
"modular_splicing/gtex_data/pipeline/marginal_psis/compute_psis_from_junction_data_2",
key_function=dict(gene_ensgs=stable_hash),
)
def compute_psis_from_jun... |
fd227c0ff5e6646c5b8097d54fa2c1d1a3921bab7dda037f58cee4a8bfaa6ee8 | Python | 6,692 | 189 | import numpy as np
import torch
import torch.nn as nn
from torch import hub
from . import vggish_input, vggish_params
class VGG(nn.Module):
def __init__(self, features):
super(VGG, self).__init__()
self.features = features
self.embeddings = nn.Sequential(
nn.Linear(512 * 4 * 6... |
153fd32d2fb69d37df9e0da3e463549b9bf34ff775256212c4bbfb756b76cdcc | Python | 6,693 | 169 | import warnings
from matplotlib.figure import Figure
import matplotlib.gridspec as gridspec
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas)
import numpy as np
from .. import units
from ..head import custom_widgets
class MPLIndentation(object):
def __init__(self):
... |
2e30d64312dfcc3c4280a260758ee9abe27073c3713b43da4015a4a64a60d80c | Python | 6,694 | 131 | #from SocialGNN_modelfunctions import SocialGNN, SocialGNN_E, CueBasedLSTM, get_inputs_outputs, get_inputs_outputs_baseline
from SocialGNN_withU_modelfunctions import SocialGNN, SocialGNN_E, CueBasedLSTM, get_inputs_outputs, get_inputs_outputs_baseline
import os, sys
import pickle
import numpy as np
from collections i... |
b3f89146beec94c8c56784ad5dd76cc862dbf9e65461cb7072cea95472f197d3 | Python | 6,694 | 193 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 26 09:18:12 2022
@author: LABadmin
"""
def GetChoiPerAnimal(AllData,iteration=0, plot = 0):
itRange = range(1,len(AllData)+1)
if (iteration!=0):
itRange = iteration
probs = np.zeros((1,6))
totPerfs = []
totCons = []
for i in itRange:
... |
fc871f4eec40bff044854a646db2eae785189608a9824d23558ab0d97204547b | Python | 6,694 | 170 | from .model import get_unet3d
from .datagen import TestGenerator, TrainGenerator
from .utils import Preprocessor, reassemble_patches, post_process
import numpy as np
import time, glob, os
from pickle import FALSE,dump as pickle_dump
from shutil import rmtree
from tensorflow.keras.models import load_model
from tensorfl... |
a4ead84d45eeaefd2d7bb6ff2d4c306062c373c40df5b215c90960b233e5d804 | Python | 6,695 | 156 | import torch
from torch import nn
import torch.nn.functional as F
class nnUNet(nn.Module):
@staticmethod
def physics_block(in_channels, out_channels):
fcl = torch.nn.Sequential(torch.nn.Linear(in_channels, out_channels),
torch.nn.SELU(),
... |
93d7f891096b037099b4770fb3498019436c4fa16062a0b99ea610af3ce32c5a | Python | 6,696 | 249 | from __future__ import annotations
import collections.abc as cabc
import warnings
from concurrent import futures
import pytest
import flask
from flask.sessions import SecureCookieSessionInterface
from flask.sessions import SessionInterface
from flask.testing import FlaskClient
def test_teardown_on_pop(app):
bu... |
bc04caa1313ea676535293aaa0ada080cb86c51f80ecedf4bd6355277affd64a | Python | 6,697 | 231 | """
Widget for editing the trial schedule of an experiment.
"""
from __future__ import annotations
from typing import Any
import panel as pn
import param
from larvaworld.lib import reg, util
from larvaworld.portal.buttons import add_button, remove_button
from .widget_base import collapsible_family_box, family_box,... |
c503a9924a05941db1277bccb1ce8f7ff737b278ae2c23f5aebe6f8a1c431226 | Python | 6,697 | 187 | import subprocess
import sys
import time
import argparse
import os
import shutil
from datetime import datetime
import sys
from threading import Thread
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog
from PyQt5.Qt... |
1439a075adffe9ad181e328dd00517a895402de70c8a1541ec007b52d1fe9ae7 | Python | 6,698 | 198 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.potentials.tblite``.
"""
# ====================================... |
25310f8a94d095156ac1275d7ef1c496ac7c718962f32457bc2f12e734c9c0c3 | Python | 6,698 | 176 | import inspect
import logging
import os
import re
import sys
import time
from qtpy import QtCore, QtWidgets
# TODO: add timer?
def newWorkerThread(workerClass, *args, **kwargs):
worker = workerClass(*args, **kwargs)
thread = QtCore.QThread()
worker.moveToThread(thread)
# all workers started using thi... |
0bb19a7b23799ee4375cd5f976768808c03d6b3c1fd726dce3a5f43b53e124af | Python | 6,699 | 177 | """
The registered feature generator for molecules.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/features/features_generators.py
"""
from typing import Callable, List, Union
import numpy as np
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
# from d... |
a7a7a3dfdcf89ebbca43bb64898c6fd441146d1f0afa82c2c9b568f089c5e4c8 | Python | 6,703 | 182 | from silence_tensorflow import silence_tensorflow
silence_tensorflow()
import tensorflow
tensorflow.get_logger().setLevel('ERROR')
#from tensorflow import keras
from tensorflow.keras import layers
#from tensorflow.keras.layers import Lambda, Dense, Input, Dropout, Activation, Flatten, BatchNormalization, Dropout
from... |
31045e68b3c7d03f4db7ff91a5c218ee2e685ea801297e1336124a5bae792549 | Python | 6,705 | 206 | import hashlib
import json
import logging
import re
from pyhocon import ConfigFactory, HOCONConverter
from .dict_tool import merge_dict
logger = logging.getLogger(__name__)
NEW_LINE = '\n'
RE_HOCON_INCLUDE = [
r'include\s+(?:required|url|file|classpath)\(.*\)',
r'include\s+".*\.(?:conf|hocon)"',
]
RE_HOCON... |
f1e1683576887e3ecbd896b69e3249fe8d63b1a52420050f601a64c7c06bf9d8 | Python | 6,705 | 192 | """Observe-kit item 9: check_determinism -- one controlled verdict, cost disclosed.
The default answers exactly one question (do N isolated same-seed runs
agree?) with a three-state verdict that never generalizes to "deterministic";
seed sensitivity is a separately-requested second verdict from exactly one
extra discl... |
b729ae982e6ab162d9d5f3b8a78ed0a475c3d2bc48a6e82fcf3d1388878b3f30 | Python | 6,706 | 206 | import argparse
import math
import os
import re
import sys
import time
import unicodedata
from functools import partial
from itertools import product
from typing import Dict, List
import numpy as np
import pandas as pd
import tensorflow as tf
from joblib import dump, load
from tensorflow.keras import Input
from tenso... |
2e1c8fd82c7ef3bd12b3e5246d82a17198c6bdfdc1ca786bc4bb10412c2c2f28 | Python | 6,707 | 196 | from datetime import datetime
from unittest import mock
from uuid import UUID
import dateutil.relativedelta
import pytest
from api.mocks import DUMMY_USER, FakeAuthContext
from carbonserver.api.errors import UserException
from carbonserver.api.infra.repositories.repository_runs import SqlAlchemyRepository
from carbon... |
013436b9beab137f742f373cf5e3cbbc81f9ccc5d24ee049a625e8895354e62c | Python | 6,708 | 188 | #!/usr/bin/env python
"""
Downloads and prepares (parts of) the "German Distant Speech" corpus (TUDA) for DeepSpeech.py
Use "python3 import_tuda.py -h" for help
"""
import argparse
import csv
import os
import tarfile
import unicodedata
import wave
import xml.etree.ElementTree as ET
from collections import Counter
impo... |
41301d05231bbb4678a195ded5b66d432b8957b75356b4f969b5f8e98531c97e | Python | 6,709 | 177 | import os
import pandas as pd
import numpy as np
import transformers
import sys
from os.path import join
import datasets
from typing import Dict, List
from dict_hash import sha256
import joblib
import random
import numpy as np
import sklearn.tree
from sklearn.metrics import accuracy_score
from sklearn.base import BaseE... |
0d2569af2a234e85f8e11ef6a99ebf3fec3819ac40d4e3921518bb39140d8128 | Python | 6,711 | 190 | from __future__ import annotations
import panel as pn
import pytest
from larvaworld.lib.param.spatial import Area
from larvaworld.lib.reg.generators import EnvConf, FoodConf
from larvaworld.portal.config_widgets import (
build_area_widget,
build_border_widget,
build_env_params_widget,
build_food_conf_... |
749538da318caf4fde83ebf0107a1eb002509f2306893d41839f4d6215cc9465 | Python | 6,711 | 216 | from galaxy.datatypes.data import (
get_file_peek,
Text,
)
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
get_headers,
)
@build_sniff_from_prefix
class AthenaProj... |
821e6f8a5e3521b4b6ca973ffe80dedc24a86cbce704306a7482a4a0b1b71c72 | Python | 6,711 | 193 | # --- 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 Surface(_BaseTraceHierarchyType):
_parent_path_str = "volume"
_path_str =... |
957029c6ce96215ad0402d60f299a0c5f25909f8fb8652bddad4f3d9a312e37d | Python | 6,712 | 202 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module tfep.analysis.bootstrap.
"""
# =======================================... |
362ab33fb8cfde399f1d7d69ee736fb0ebfa75f3a580252676a92a81629ec104 | Python | 6,714 | 206 | """Map user-supplied workbook column headers onto Galaxy's column target types.
Headers are matched loosely so that "MD5 Sum", "MD5" and "Hash MD5" all reach
``hash_md5``. See ``rule_target_column_specification.yml`` for the cross-language
set of accepted spellings.
"""
import re
from dataclasses import dataclass
fr... |
b4e9fc8df6ddfebe0774ddfaae8c169d4d7f2480ab912af4fd55da7076f4594d | Python | 6,714 | 178 | # sMNIST model specification
import torch
import torch.distributions as dist
import torch.nn as nn
import torch.nn.functional as F
from numpy import prod, sqrt
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torchvision.utils import save_image, make_grid
from torch.utils.data ... |
0db3e0f8d87c09c19cfe1c3389fb009d08feed2d1cfe0145216dd817d9dfa9c6 | Python | 6,716 | 185 | """
How do we really want to interact with epochs, generate stimulus waveforms,
and keep track of digital outputs?
HIGH LEVEL - how to request a waveform
abf.setSweep(5,channel=1)
print(abf.sweepY)
print(abf.sweepC)
print(abf.epochs) # sweep-agnostic epochs for all channels
print(abf.epochs[1]) # ... |
8afe62e13fc391be87d912de78124e1c13819b8e5835a64d205a189c221af839 | Python | 6,716 | 196 | from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.optimizers import optimizer
@keras_export(["keras.optimizers.RMSprop"])
class RMSprop(optimizer.Optimizer):
"""Optimizer that implements the RMSprop algorithm.
The gist of RMSprop is to:
- Maintain a moving (disco... |
edebc06e46d4c7f1c1b66ca6a5f3aaf7af9a4bf471fb7d054cfc714d2c3611e5 | Python | 6,716 | 167 | """The legacy summary spellings are gone: each refuses typed, naming its successor.
Clean break (no aliases): the eight legacy ``summary()`` keyword spellings and
the legacy ``level=`` preset names no longer route to a historical renderer.
Each one raises ``InvalidArgumentError`` whose message names the new-grammar
ar... |
f45ead4bf0f038b543543f97475a89bd9eaaf281cb581265acbdca29bac3b1b6 | Python | 6,716 | 188 | """
Manager for workflow invocation completion detection and recording.
This module provides the WorkflowCompletionManager class which handles:
- Checking if workflow invocations have completed
- Recording completion details in the database
- Polling for invocations that need completion checks
"""
import logging
fro... |
ffeebca06e3db0ce651511a6d94817b52bb421b9d526e151ced93b18d5db1a1e | Python | 6,717 | 140 | from __future__ import division
from psychrnn.tasks.task import Task
import numpy as np
class PerceptualDiscrimination(Task):
"""Two alternative forced choice (2AFC) binary discrimination task.
On each trial the network receives two simultaneous noisy inputs into each of two input channels. The network must... |
52cefb664fe66cc5143294443275ebd7b73569459a6dfaf90e38ededc2ef7238 | Python | 6,718 | 184 | """C-KINETO acceptance gate legs (torchnative W2.4/W2.5; run by D02).
Runs the correlation-ID join on pinned real checkpoints on a REAL
CUDA/CUPTI host and emits a JSON artifact per cell; gate prose is GENERATED
from the artifact, never typed. The gate law (memo 4.2, the review's two-part
accounting, per model per pha... |
9d363b534ed12772f8d83694324abc2fb79001c21efc56b35b759d2921419e82 | Python | 6,718 | 171 | from ..utils import gislib, utils, constants
from ..core.trajectorydataframe import *
import numpy as np
import inspect
def filter(tdf, max_speed_kmh=500., include_loops=False, speed_kmh=5., max_loop=6, ratio_max=0.25):
"""Trajectory filtering.
For each individual in a TrajDataFrame, filter out the trajec... |
e390b72fbba359da4b07dcb0eddeb8bf6afa4e704983ecb665bdf79c72418030 | Python | 6,718 | 238 | # -*- coding: utf-8 -*-
import os
import re
import glob
import pickle
import numpy as np
import pandas as pd
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
# clean seq length, exAA
def clean_len_exaa(inp, maxlength, output):
pattern = r"[BJOUXZ]"
records = []
with ... |
eb2ebd5f07af60ea7ec5697d993c94fbe41efa9602ad0cde617c7a9fb56ddc1c | Python | 6,718 | 258 | from __future__ import print_function,division
import numpy as np
import torch
import torch.utils.data
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import re
import csv
import random
import copy
from math import sqrt
from scipy import stats
import torch.nn.functional as F
device_ids = [0, ... |
d5da140fc27a79b2eb281cc7b52c7d9cc741c57c442cbb9d02b5c53611ff3c07 | Python | 6,719 | 149 | ##########################################################################
## ##
## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
e7b6e086b0d22e5b82a9cabafe9b5ee6fcd1fc2339a01310c76907bddafb5b1b | Python | 6,719 | 129 | # Copyright (c) 2025, Ted Zadouri, Tri Dao.
# We recommend locking GPU clocks before running the benchmark to ensure consistent results.
# This can be done using the following commands (1830 MHz is the clock for H100):
# sudo nvidia-smi -i 0 -pm 1
# sudo nvidia-smi -i 0 --lock-gpu-clocks 1830,1830
# See more here: htt... |
6ad37feb1d832b58d9e74d9a18a2a9c5043a99ea21161e2dfd7a21dadaa40262 | Python | 6,721 | 220 | import pandas as pd
import xarray as xr
import hobj.benchmarks.mut_highvar_benchmark as highvar_module
import hobj.benchmarks.mut_oneshot_benchmark as oneshot_module
from hobj.learning_models.random_guesser import RandomGuesser
def _make_highvar_images_df() -> pd.DataFrame:
rows = []
for category in ["CatA",... |
76bd15fd2d07270f671fa5d182f64aa05acc4047a43cd6a52e87bdea3be7afa5 | Python | 6,722 | 189 | """
Numerical tools used throughout pyrho.
Classes:
InterruptablePool: A wrapper for multiprocessing.Pool that handles
keyborad interrupts more gracefully.
Functions:
get_table_idx: Returns the lookup table index of a configuration.
log_mult_coef: Computes the log of a multinomial coefficient.
... |
77103569517b1018f804b0059d8cb8e205078344432128c6b410397a9d13269b | Python | 6,722 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
2cb58801c09ca17f35fb312429637517c995eb746dfed9730089912d1fdc1f05 | Python | 6,723 | 166 | from os.path import basename
from pathlib import Path
from typing import (
cast,
)
from galaxy import exceptions
from galaxy.files import ConfiguredFileSources
from galaxy.files.uris import stream_url_to_file
from galaxy.managers.context import ProvidesUserContext
from galaxy.model import DatasetInstance
from gala... |
539fdec3ba6df40c41d69be19fb46166c44ec21f979146749858c99773ebe7f2 | Python | 6,725 | 180 | import re
import numpy as np
import torch
import cv2
import os
from PIL import Image
import matplotlib.pyplot as plt
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [ atoi(c) for c in re.split(r'(\d+)', text) ]
def calculate_mean_life(liv_worm_sec):
dead_worm_... |
56e8b095ab66ce3ad327f58265ae65ff70f71cba661f48fee147265e94b35c16 | Python | 6,726 | 206 | import math
import numbers
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import init
from einops import rearrange
# from basicsr.utils.registry import ARCH_REGISTRY
def make_model(args, parent=False):
return ShuffleMixer(args)
class PointMlp(nn.Module):
def __init__(self, dim... |
6761d78d3cd1e87863164e2eb743311b7b28fc9de9d601688c324509512fecca | Python | 6,726 | 149 | import os
import mne
import nibabel
import numpy as np
from mne.datasets import fetch_fsaverage
from tqdm import tqdm
from mp_dip.research.show_example_dipole import show_example
from mp_dip.utils.interpolate_head_features import memoized
from mp_dip.utils.mne_freesurf_labels import read_freesurfer_lut
from sklearn.n... |
7cbdf0042609c66a23d71676fa77a78a3a6bb7c4c4f36fc90b9f758b5d43ab38 | Python | 6,727 | 198 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import queue
import cv2
import slowfast.utils.checkpoint as cu
import torch
from detectron2 import model_zoo
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from slowfast.datasets import... |
ecc1203798db7367453f62d18f7d2b5ef2254d5c32c4e68998e3d5c13118e13e | Python | 6,727 | 192 | """Tests for the trace-level receptive-field table."""
from __future__ import annotations
from collections.abc import Iterator
from fractions import Fraction
import pytest
import torch
from support.rf_isolation import preserved_rf_registry
from torch import nn
import torchlens as tl
from torchlens.receptive_field i... |
032f7ec44dbe32d4008f259da9fbc140aa01b214d4aa8de21e278ab3bd936717 | Python | 6,728 | 182 | import csv
import json
import tempfile
from pathlib import Path
import numpy as np
import pytest
from lightly.utils import io
class TestCustomMetadataIO:
def test_save_metadata(self) -> None:
metadata = [("filename.jpg", {"random_metadata": 42})]
metadata_filepath = tempfile.mktemp(".json", "met... |
081efd21627e7559b336ca21a9d644f12a1d2c123713858a83b8e7b4e087af90 | Python | 6,731 | 183 | import os
import sys
import traceback
from pathlib import Path
from typing import Dict
import pandas as pd
import snapatac2 as sa2
from snapatac2 import AnnData
code_root_dir = "/projects/ps-renlab/szu/projects/CEMBA2"
pack_dir = f"{code_root_dir}/package/python"
sys.path.insert(0, pack_dir)
import utils #pyright: ign... |
20de246bef606e150db67c225d44504ab1e45522c8d2a03aadfc51985bf37444 | Python | 6,731 | 186 | from unittest.mock import patch
import boto3
import pytest
from botocore.exceptions import ClientError
try:
from moto import mock_aws
except ImportError:
from moto import mock_s3 as mock_aws
from celery import states
from celery.backends.s3 import S3Backend
from celery.exceptions import ImproperlyConfigured
... |
334a2a22873af00cbddf67c8421fde4ee472bb873fec4ba962c5044f506f5062 | Python | 6,731 | 193 | # --- 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 Surface(_BaseTraceHierarchyType):
_parent_path_str = "isosurface"
_path_s... |
469b493480e4149d7d06c275ec7ca49d6abf6a7f53ae778011d5ded39a3fb3d4 | Python | 6,733 | 187 | """Microbenchmark: seqpro.rag.to_packed vs ak.to_packed vs NumPy gather.
Run in the bench env:
pixi run -e bench python benchmarks/bench_to_packed.py --out bench_to_packed
Outputs <out>.csv and <out>_*.png. Sweeps n_rows, mean length, length
distribution, source (RAM vs memmap), dtype itemsize, and thread count, ... |
6343bfca981b02cf916f70e1ba190511842ca19220e9c5552c839bd078ed62f4 | Python | 6,734 | 206 | from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from werkzeug.datastructures import FileStorage
from flask import send_file
from mongoengine.errors import NotUniqueError
from ..util import query_util, coco_util
from database import (
ImageModel,
Dat... |
b5c97eb0573e290bfd66e663aca67bcf3c2d97a0d0f61c5dedf7009d64d13c34 | Python | 6,734 | 173 | """
Datatypes for Anvi'o
https://github.com/merenlab/anvio
"""
import glob
import logging
import os
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import (
DatasetProtocol,
HasExtraFilesAndMetadata,
)
from galaxy.datatypes.text import Html
log = logging.getLogger(__name... |
c96ef1d0a8f23e0e6c037a06d1f305033b432ee36619f9a24537a830b7266ea8 | Python | 6,734 | 158 | """
Computes pca on the activations to the 165 sound set for all models
and computes the effective dimensionality.
"""
import sys
sys.path.append('/om2/user/jfeather/projects/auditory_brain_dnn')
print(sys.path)
import numpy as np
import torch as ch
from pathlib import Path
import pickle
import matplotlib.pylab as p... |
5241fb5903f2caea14737119c3b2f68690251211e581042d2914071b1d4ce516 | Python | 6,736 | 195 | from __future__ import annotations
import base64
import json
import os
import urllib.request
from typing import Any
import pytest
from pytest_celery import (LOCALSTACK_CREDS, REDIS_CONTAINER_TIMEOUT, REDIS_ENV, REDIS_IMAGE, REDIS_PORTS,
CeleryTestSetup, RabbitMQTestBroker, RedisContainer)
f... |
92920a429896392bfd24b3a0f1983604e494733c6ad7b3955daad1ae16302270 | Python | 6,738 | 196 | """
BASIL GUI for Oxford ASL - Preview widgets
Copyright (C) 2020 University of Oxford
"""
import os
import shutil
import tempfile
import numpy as np
import nibabel as nib
import fsleyes
import fsleyes.overlay as fsloverlay
import fsleyes.displaycontext as fsldc
import fsleyes.views.orthopanel as orthopanel
import f... |
9501c9dbf5d0ee973f10d46c90eb62af83dc69a047bb8171814ee7d76b1257dc | Python | 6,738 | 174 | # SOURCE: vendored from john1226966735/CoKT @ main
# (CoKT/Code/DKT_QE.py + CoKT/Code/CoKT.py, copied verbatim)
#
# CoKT (Collaborative Embedding for Knowledge Tracing, WSDM 2022): the CoKT class
# subclasses DKT_QE's "question-level DKT" base model (InputModule fuses a question
# embedding with the correctness label v... |
6e62afdcbd9f97f8c572012b36bda3fb67f8cc993f32d72d0eb186c423293e81 | Python | 6,739 | 236 | """Checker functions."""
from inspect import isgenerator
from itertools import chain, repeat
import numpy as np
###################################################################################################
###################################################################################################
def ... |
ad3b739c4e7a478a3a8af5275458d8d4fa2bf3aff3e4f4df6ca5c4e950e4bcb5 | Python | 6,739 | 139 | import sys
sys.path.append('..')
from src.utils import set_random_seed
import argparse
import torch
from torch import nn
from torch.utils.data import DataLoader
from torch.optim import Adam
from torch.nn import MSELoss, BCEWithLogitsLoss
import numpy as np
import random
from src.data.featurizer import Vocab, N_ATOM_TY... |
2da0c262c6c3a18866a9c28fcf455ea8d1b15970ee212e7bdfe889506cb3160c | Python | 6,740 | 181 | import h5py
import os
import numpy as np
import networkx as nx
import pickle as pkl
import scipy.sparse as sp
from datetime import datetime
from pathlib import Path
def load_hdf_data(path, network_name='network', feature_name='features'):
"""Load a GCN input HDF5 container and return its content.
This funtio... |
fa96b02113ca09ee8135495f9f8c734bb3a002b546640dd62924d319fa2fc099 | Python | 6,744 | 160 | """Failure-arm reporting: routed warning, partial_log note, empty_cache gate.
Pins the B8-35/B8-44/B8-45/R16-4b fixes in ``backends/torch/backend.py``:
- The historical unconditional stdout banner ("Feature extraction failed;
returning model and environment to normal") was factually false on
rescue-recovered capt... |
c90efebe6059c15a726eaddc05c0b5442faa0698e1dd8f8cdcbfd75167dd16cd | Python | 6,745 | 135 | #!/usr/bin/env python3
"""Протокол A2, часть 1 (ЧЕРНОВИК 13 октября 2026, прогонов не было): два новых
контроля на входах 8-9, константа и «близнец», рядом с self и shuffled.
Основание: ИДЕИ_2026-10-13.md §2.1 и §5.2, REPORT.md §6 пункт 3. shuffled
берёт энергию нового случайного агента каждый тик и потому разрушает н... |
d5001117a3ee382d3ae2c1b0f5dd67f32d72cd381e72bba85a4441ed94533e02 | Python | 6,748 | 174 | from __future__ import annotations
import pytest
from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup
from tenacity import retry, stop_after_attempt, wait_fixed
from celery import Celery, chord
from t.integration.tasks import add
from t.smoke.tasks import long_running_task, summarize_results
PENDING_OPERATIONS_... |
1c70a28369ed8bd6ad9eee9c208dd79c277cd04de791a6a2d86dd71a0f2171e5 | Python | 6,750 | 166 | from keras import backend as K
from keras.engine.topology import Layer
import numpy as np
import tensorflow as tf
class EmbedViaMatrix(Layer):
"""
This layer defines a (learned) matrix M such that given matrix input X the
output is XM. The number of columns of M is embedding_dim, and the number
of row... |
23f4da0a2e57dfe108000473279af875c5571b0f5091665e0b2b22795f3e0901 | Python | 6,753 | 209 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 8 00:09:49 2017
@author: Rong Chen
@author: Ce Gao
"""
import logging
from collections import Counter
# pylint: disable=C0103
# Invalid constant name
logger = logging.getLogger('pipe.summary')
# pylint: disable=R0902
# Disable too many return
... |
cfba90a3dbaee541b61d799b7f882ab4f2b97eeb835e97f2a3aca53e0473690a | Python | 6,753 | 184 | import bct
import numpy as np
from tqdm import tqdm
from sklearn.utils import check_random_state
def strength_preserving_rand(A, rewiring_iter = 10, nstage = 100, niter = 10000,
temp = 1000, frac = 0.5,
energy_func = None, energy_type = 'euclidean',
... |
db5c52c771b8620cc41a9bc9597611e88d1b7d7bdbaa1b69b391dfc93b045d86 | Python | 6,753 | 194 | from Bio import SeqIO
import os,sys,re
import shlex
import pandas as pd
import subprocess
def download_GENCODE(species="human"):
if species == "human":
parent = "ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_38/"
prefix = "gencode.v38"
else:
parent = "ftp://ftp.ebi.ac... |
832868c10a8eaee4610d0e269f0c5c9a2d6a578da598774aa3155eab28313bae | Python | 6,754 | 194 | """
This module contain all correlation based code
"""
import numpy as np
from .tools import histogram
def correlogram(t1, t2=None, bin_size=.001, limit=.02, auto=False,
density=False):
"""Calculate cross correlation histogram of two spike trains.
Essentially, this algorithm subtracts each sp... |
ced6ea219d0cb9644b4c0f914fa93904a56fbae936f873e8143f7eab7b87a3eb | Python | 6,754 | 216 | """Fixtures and testing utilities for :pypi:`pytest <pytest>`."""
import os
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any, Mapping, Sequence, Union # noqa
import pytest
if TYPE_CHECKING:
from celery import Celery
from ..worker import WorkController
else:
Celery = WorkContro... |
65e960ef3e9c6306a35402b86482c39849221a548b75ca8023792477a32667e9 | Python | 6,755 | 170 | from __future__ import division
import argparse, datetime, os
import logging
logging.basicConfig(level=logging.INFO)
import mxnet as mx
from mxnet import gluon, nd
from mxnet.gluon.model_zoo import vision as models
from mxnet.gluon.data.vision import transforms
from mxnet import autograd
from networks import resnet1... |
c184f78565ec7477308f82c670d7929757642d318eeac414b7a8196de9446134 | Python | 6,756 | 185 | """Lane F44 stage 2: the nested-capture matrix for logged injections.
foldA MEMO s5 item 12's last clause: every capture-shape cell that could
interact with injected-op recording is PINNED -- either it works with
correct anchored identity, or it refuses/no-ops typed and disclosed.
Cells:
* nested ``tl.trace`` inside... |
d04404bab16edcb5a04890a56ade360ba23134da1e57ed959c189074fd443891 | Python | 6,756 | 161 | import os
import sys
from robustness import datasets
from robustness.attacker import AttackerModel
from robustness.model_utils import make_and_restore_model
from robustness.imagenet_models.clip import clip
import torch
from PIL import Image
from model_analysis_folders.all_model_info import IMAGENET_PATH
sys.path.appe... |
76151d69a4aa796d21b2132b28ff9f16aad5b7fe9260b737faaa292e71fae6fe | Python | 6,761 | 186 | import cv2
import numpy as np
from scipy.ndimage import filters, measurements
from scipy.ndimage.morphology import (
binary_dilation,
binary_fill_holes,
distance_transform_cdt,
distance_transform_edt,
)
from skimage.segmentation import watershed
from misc.utils import get_bounding_box, remove_small_ob... |
411074b6e9b59123f18a9f5d09578fa53d8fc84ce07b6a39656efa3f6318abdb | Python | 6,762 | 212 | import numpy as np
from nilearn.image import concat_imgs, math_img
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from fmri_encoder.plotting import (
plot_colorbar,
concat_colormaps
)
from irnlm.utils import check_folder
from fmri_encoder.data import fetch_masker
from irnlm.data... |
1bb3120f34104c0af18674d2a968baf958eb0f608ea745db9b2193b4d05ec14e | Python | 6,763 | 201 | from __future__ import annotations
import base64
import json
import os
import sys
from collections.abc import Iterable, Sequence
from dataclasses import dataclass
from typing import cast, ClassVar, TypeAlias
from openai import AuthenticationError, OpenAI
from openai.types.chat import ChatCompletion
from openai.types.... |
5d75ddef2c5ebe6695ce13618e6ee18cd42bbc28949683b59d9c55b4ef36e529 | Python | 6,763 | 209 | from functools import partial
from itertools import product
from typing import Callable
import numpy as np
import pygame
import pytest
from pygame import KEYDOWN, KEYUP, QUIT, event
from pygame.event import Event
import gym
from gym.utils.play import MissingKeysToAction, PlayableGame, play
from tests.testing_env impo... |
af4138a36c7bbfa9aabf31c4f3c764294944869093f4e0014467dbdc41e4d7e4 | Python | 6,763 | 198 | import matplotlib.pyplot as plt
import numpy as np
import torch
from typing import Iterable, Union, Any, Tuple
from pandas import DataFrame
from .utility import retrieve_from_dict
class Observer:
"""Class that is used to record state variables, outputs, and losses during calls of `Network.train`,
`Network.tes... |
f53e3cb4348c321c77598a4e249e865aadbbac0ffa56da95cc84b22ea17eff88 | Python | 6,763 | 199 | import math
import numpy as np
import pickle
import time
from manfit_our import manfit_our
from manfit_cf18 import manfit_cf18
from manfit_km17 import manfit_km17
import matplotlib.pyplot as plt
import scipy.io
# xiayq @ 12/11/2022
# xiayq0121@zufe.edu.cn
# refered to Z. Yao and Y. Xia, Manifold Fitting un... |
0bc0f4dc75aaaadefccfb6c3201998fe63216cabbf3fe7adaac99408d906e3ee | Python | 6,764 | 185 | #!/usr/bin/env python3
"""
File: generate_starting_vectors.py
Created: 2021/07/12
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 tr... |
58e2d0ec9e1e338607b12c7204d539c8faaeabed1d0791720ffb6db59d5182c4 | Python | 6,764 | 190 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for check.py"""
import unittest
from sknetwork.data import cyclic_digraph
from sknetwork.data.test_graphs import test_disconnected_graph
from sknetwork.utils.check import *
from sknetwork.utils.format import check_csr_or_slr
class TestChecks(unittest.TestCase):... |
87d3cc76a5352ab375860061e6720e514951ab9529db34c1bfa3868094ed8e31 | Python | 6,765 | 162 | """Detect peaks in data based on their amplitude and other features."""
from __future__ import division, print_function
import numpy as np
__author__ = "Marcos Duarte, https://github.com/demotu/BMC"
__version__ = "1.0.4"
__license__ = "MIT"
def detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising',
... |
e8699f862fb33abef610e9ff1f7855fb0059cb1c5b037b61eba1823207df82f8 | Python | 6,765 | 115 | """Default configs for torch image classification"""
# pylint: disable=bad-whitespace,missing-class-docstring
from typing import Union, Tuple
from autocfg import dataclass, field
@dataclass
class ImageClassification:
model: str = 'resnet101'
pretrained: bool = True
global_pool_type: Union[str, None] = None... |
20eb9cd09e466feeab8ec8ae0b2cbdd141d29155cd2177ec53c0f54a343497a2 | Python | 6,768 | 194 | """Reaching to target."""
import numpy as np
from neurogym.core import TrialEnv
from neurogym.utils import spaces, tasktools
# TODO: Ground truth and action have different space,
# making it difficult for SL and RL to work together
# TODO: Need to clean up this task
class Reaching1D(TrialEnv):
"""Reaching to th... |
c539b5f37d01e7f74afb3a26515831bb0409f4130223405ea89daa20b56eba29 | Python | 6,768 | 229 | import torch as th
import dgl
from dgl.data.utils import load_graphs
from torch.utils.data import Dataset #, DataLoader
import pandas as pd
import numpy as np
#from copy import deepcopy
from rdkit import Chem
from joblib import Parallel, delayed
import os
import tempfile
import shutil
from ..feats.mol2graph_rdmda_r... |
fb3f49df6512ca1da958ccc7388d56ab6c94699433e1da5e2fe62c9b0a75c66d | Python | 6,769 | 177 | import numpy as np
from sklearn.utils import check_random_state
def match_length_degree_distribution(W, D, nbins=10, nswap=1000,
replacement=False, weighted=True,
seed=None):
"""
Generates degree- and edge length-preserving surrogate con... |
5deed605589706869874cc3b79f265eb10fcaf2ecb352946573ee6f2577f286a | Python | 6,770 | 151 | ''''MIT License
Copyright (c) 2020 Constantin Pape
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 the rights
to use, copy, modify, merge, publis... |
18c59ffa1dd0824a571904624f4b08119552109a0b31d69023c467d3ec7d2464 | Python | 6,772 | 242 | """Define fitting modes."""
from collections import OrderedDict
from specparam.modes.mode import Mode
from specparam.modes.paramdef import ParamDefinition
from specparam.modes.funcs import (powerlaw_function, lorentzian_function, double_expo_function,
gaussian_function, skewed_gauss... |
cc81e464ecfff181406a9f8f4bdd849a68d7d660c9ff9ab5533847c5bd33a02d | Python | 6,772 | 192 | """Workflows for parcellating anatomical data."""
from nipype import logging
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
from xcp_d import config
from xcp_d.config import dismiss_hash
from xcp_d.interfaces.... |
ed7123ad8c02d3d0e9cfae15d43251c1146e296d17a04e3ee97116e12429c3d9 | Python | 6,773 | 148 | '''C++ backend of LDDMM and LDDMM_3D_to_slice (CPU, float64).
:class:`CppEngine` implements the engine interface of ``_lddmm_common`` on top of the
compiled extension ``_stalign_cpp`` (sources in STalign/_cpp, built by setup.py). A whole
iteration (sample points, deformed source, contrast fit, analytic gradients, FFT... |
4697ea8d919c4de755413280742ef1aa8c4e5f5b0cfc11fb68e0a2c8cf39533f | Python | 6,774 | 159 | import logging
from PyQt5 import QtWidgets, QtCore, QtGui
from score_behavior.ObjectSpace.trial_dialog_ui import Ui_TrialDialog
class TrialDialog(QtWidgets.QDialog):
trial_dialog_error_signal = QtCore.pyqtSignal(str, name='TrialDialog.trial_dialog_error_signal')
def __init__(self, caller=None, trial_params... |
014146dbcab2ab024886e888930f084516c041b83702b42da3336b64729616ca | Python | 6,775 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
3913a4b0151b85719aca2ce0a3d3f04d30d4417714ffea734922662a98912f8d | Python | 6,775 | 199 | ###############################################################################
# Perform clustering the identified SVGs from the AKI kidney and 3dst RA
###############################################################################
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.c... |
4cae0da357fc87d7ffc13836400ce84962d45129f214f98631c3203deb85e49b | Python | 6,775 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
8976401b9d85e820bfbf98bb8c19561d01a56ef0739989442411bcd34581ecac | Python | 6,775 | 174 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
This implementation is based on
https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/random_erasing.py
pulished under an Apache License 2.0.
COMMENT FROM ORIGINAL:
Originally inspired by impl at https://github.com/zhunzhong... |
b0d34c45da3d535075c7449387e7c6aab26b99897076b53025bc5e921052dce0 | Python | 6,775 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
b226c95763969935b8df086dc5b85b0c2c007a5fb8fe2725861c591dd2891d9b | Python | 6,775 | 165 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from ..utils.tf import keras_import
Input, Conv2D, Conv3D, Activation, Lambda, Add, Concatenate = keras_import('layers', 'Input', 'Conv2D', 'Conv3D', 'Activation', 'Lambda', 'Add', '... |
03a621c27399a3c25d5484ff23781bbf69b69f42cfe69718276cb60e95dd9d7c | Python | 6,777 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
28890d4c592314f22742379384eb5b3fe7d930aa8037ec0404e436346cfdfd9a | Python | 6,777 | 181 | import numpy as np
import pandas as pd
import geopandas as gpd
import shapely
import pytest
import functools
from ...core.trajectorydataframe import FlowDataFrame
from ...utils import constants, gislib
from ...models.gravity import Gravity, exponential_deterrence_func, powerlaw_deterrence_func
distfunc = gislib.getDis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.