sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ef0967d3145ade219d0a4ca628950de7bc42896b245042471ff3450a3543d7d2 | Python | 2,861 | 79 | import cocotb
import pytest
from cocotb.triggers import Timer
import elasticai.creator_plugins.adders as adders
from elasticai.creator.arithmetic import int_arithmetic
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.multipliers.utils import (
generate_mult_test... |
f85797824c5d17bfa63621a9e00ce99a5ca15c93351b8d562478683c7354e565 | Python | 2,861 | 96 | from tvm.contrib import graph_executor
from torchvision import transforms
from PIL import Image
import tvm
from tvm import relay
import numpy as np
from tvm.contrib.download import download_testdata
import torch
from torchvision.models import vgg16, VGG16_Weights
VGG16 = vgg16(weights=VGG16_Weights.IMAGENET1K_V1)
V... |
82845c469fc767471c3c7ca147322e5b6ea73b4500009872cd20d3dd5f07cfb8 | Python | 2,862 | 74 | import tensorflow as tf
import numpy as np
class Logger(object):
"""
Logger class for writing scalar, image, and histogram summaries for TensorBoard.
"""
def __init__(self, log_dir):
"""
Initialize the Logger object and create a TensorFlow summary writer.
Args:
... |
d701a0ca7465466771f03417d8f355d1303b57fc3e2d02a9a3dd1d6c91ddfb3c | Python | 2,863 | 79 | import PoseTools as pt
import sys
import os
import deeplabcut
import APT_interface as apt
import tempfile
import h5py
from leap.training import train as leap_train
import leap.training
import numpy as np
leap_orig_dir = '/groups/branson/bransonlab/mayank/apt_expts/leap_orig2/leap'
main_script = 'training.py'
class ... |
02d4d09ad6de33c72e423992c733fca968d4cde12304ca2a8c47773442f56fc4 | Python | 2,864 | 82 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
892c4d1cb858ccd47c8c863aa1a7a78f43ecc07eab562da400be97435f7a4361 | Python | 2,865 | 82 | '''Command-line tool functionality for `cellmincer train`.'''
import yaml
import logging
import os
import sys
from cellmincer.cli.base_cli import AbstractCLI
from cellmincer.train.main import Train
class CLI(AbstractCLI):
'''CLI implements AbstractCLI from the cellmincer.cli package.'''
def __init__(self):... |
bc2744c395dde566d001b5146cd70a58afc5e3850b7eec762a3e28e24e6b406f | Python | 2,865 | 73 | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import logging
import os
import sys
import tensorflow as tf
import matplotlib.pylab as plt
from tensorflow.keras import layers
from tensorflow.keras import models
import numpy as np
import PIL.Image as Image
import glob
... |
9f58a71984101718a3cf2f130434c0f50898485c8d03da4933fef8631aa396fc | Python | 2,866 | 80 | # Extract and save smoothed population rates used in Fig 6
# from full dataset
from os.path import join
from get_paths import *
import pickle
import numpy as np
import h5py
## Load data
# Load simulation results
fname_simulations = "data_TVAT_popsmooths.h5"
fname_optimization = "data_unified_model_searc... |
fdd86f89dd32f8a16e4c6e4e7dd8ebea54c5373daba3a425147b14c95667dbd3 | Python | 2,866 | 83 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
01f29d55e35def075a04c31fad7a8a714956c8cf7bcb201c86e6c5fb564ee4f8 | Python | 2,867 | 85 | # regtools/tests/test_ccf_section_browse.py
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import numpy as np
import pytest
pytest.importorskip("PySide6")
import nibabel as nib
import tifffile
from PySide6.QtWidgets import QApplication
from regtools.ccf_boundary_editor.viewer import CCFCon... |
330873051df384f7e95613dd9dc983c524581d80809e4aac3dd3ec73acd22888 | Python | 2,868 | 72 | # Quantal analysis wrapper function
import os
import numpy as np
import matplotlib.pyplot as mp
import pyclamp.qnp.qmod as qmod
import pyclamp.gui.iplot as iplot
from pyclamp.dsp.fpfunc import *
from pyclamp.dsp.iofunc import *
from pyclamp.dsp.lsfunc import *
def anal(data, e = None, nmax = None, modelprob = 2, re... |
a4648bd7341f5b2b05cd447773183843b1c07e679ef51273f57b11c1a614c56e | Python | 2,868 | 60 | #!/usr/bin/env python
## this script creates dataframes from the full distance matrices for Features (pre- and post-session),
## and Naming (pre- and post-session) and saves them to a new CSV file
## The dataframes contain the distances values for each pair of subjects.
import pandas as pd
from pathlib import Path
# ... |
f6fd7e8e8fbed2aefb49d4515d6f83c43ba7e7aa6e01cec09baaaec9d5a8adf8 | Python | 2,868 | 71 | from ruamel.yaml import YAML
import sys
import os
def main():
from parser_dicts_variables import dict_dl4miceverywhere_to_manifest
dict_manifest_to_dl4miceverywhere = {value: key for key, value in dict_dl4miceverywhere_to_manifest.items()}
# Read the information from the manifest
with open('manifest.b... |
81d746dc4bc8399232d774f6c1a9aa7fc03bcd5867d9d706bd7fbe5122501397 | Python | 2,870 | 88 | """CLI script to validate HED schema files for compliance and format consistency."""
import argparse
import sys
from hed.errors import HedFileError, get_printable_issue_string
from hed.schema import load_schema
from hed.scripts.schema_script_util import missing_hed_ids, sort_base_schemas, validate_all_schemas
def g... |
ae8ae3895495037083570172423f2b22d3882267a29497eddc0af1264e0dd8d6 | Python | 2,870 | 89 | import numpy as np
import torch
from sklearn.metrics import ConfusionMatrixDisplay
import matplotlib.pyplot as plt
def count_correct_predictions(outputs, y):
"""Usage: before a sigmoid or a softmax function.
"""
if len(outputs.data.shape) < 2:
predicted = (torch.sigmoid(outputs).data > 0.5) * 1
... |
f150725c34200d55641bd42f71756ee02062fd05cff17b2104454ad2c9efeedc | Python | 2,870 | 90 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
47ebe5b3ada5a0fecb25a5dcd98494d1dd8777c7c9ca77326fa9da9fcb775936 | Python | 2,871 | 29 | """posthoc_banc_untyped_giants_2026-10-02.py — POST HOC, descriptive (after DOMINANT_BANC, 2 Oct night).
In BANC, 13 of the 18 'different' dominant pairs have as largest input one of two untyped left neurons. What do they connect to?
If one sends most of its output to Kenyon cells and the other to T4/T5/Tm9, they carry... |
7d27970654a374ec49eaf8e98227caa2efc843c642ea6e6750e8f3596bf2d292 | Python | 2,872 | 92 | import numpy as np
import logging
import random
from hippo.environments.w_maze import WmazeTasks
from hippo import get_store_path, save_config, save_object
from hippo.agents.prefrontal_agent import LocationRewardMerger
from hippo.models.cscg import CHMM
from hippo.environments.high_level import HighLevelWMazeEnviro... |
9eec28fb988a0e929da8bc0bb3ee575e9308b1b12e57a1604070b2155744e4ea | Python | 2,872 | 67 | import contextlib
import copy
import io
import os
import shutil
import tempfile
import unittest
from hed import load_schema, load_schema_version
from hed.schema import HedKey, HedSectionKey
from hed.scripts.schema_script_util import missing_hed_ids
from hed.scripts.validate_schemas import main
class TestRequireIds(u... |
d118c4c75f3a3144ebda5d4e257139286b9e8e9138c14634d1759a8d26df715e | Python | 2,872 | 65 | """Registry of selectable Qwen3 language substrates.
A profile states what to load and how; tensor dimensions are never taken from here but
read from the loaded model's configuration. Revisions are immutable Hugging Face commits.
"""
from __future__ import annotations
from dataclasses import asdict, dataclass
@data... |
f001fe1bfb29cc16e5805c2fc999ca8b5ffa41b56844df793ed5b5dceeac63cb | Python | 2,872 | 90 | import bct
import numpy as np
from utils import stats, ICON_cpl_func, make_dir, pickle_dump
from joblib import Parallel, delayed
from joblib.externals.loky import set_loky_pickler
set_loky_pickler('pickle')
import os
os.environ['OPENBLAS_NUM_THREADS'] = "1"
os.environ['MKL_NUM_THREADS'] = "1"
direc = os.path.abspat... |
14277100ce3a0cc186fea761d35f977c4a8e04e4ce5877800246169da5a9d8c2 | Python | 2,873 | 93 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
678a2f7dd98ce3624fcd900cdabdc59864b6d8e07c22dd33d1f7481a5134745e | Python | 2,873 | 87 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
7e352de887dd5885a76e91c2a19a6e564238959ae82ed3c7f460a79096cca423 | Python | 2,873 | 85 | import tensorflow as tf
from tensorflow.keras import backend as K
# one-hot encoding: tensorflow genome ops
# https://github.com/tensorflow/io/blob/0b70504f1425504e1c0149ee8cb8fd55cfb9082b/tensorflow_io/python/ops/genome_ops.py
@tf.function()
def _nucleotide_to_onehot(nucleotide):
"""Encodes a nucleotide using a ... |
d5654f5e52ba018f82cf571184081c52c47de9ee8a90b41cf56c8be32c666717 | Python | 2,873 | 73 | """
Configuration for the integration tests.
These tests talk to a REAL Wikibase instance and are deselected by default
(see the pytest addopts in pyproject.toml). Run them with:
WBI_INTEGRATION_MEDIAWIKI_API_URL=http://localhost:8880/w/api.php \
WBI_INTEGRATION_USER=admin \
WBI_INTEGRATION_PASSWORD=chang... |
4c9ad140b1450fd37c1eb6a20e04fda3dda3466a07b6d905f33a0af936425232 | Python | 2,874 | 70 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/MNIST_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["cuda"]= str(config["cud... |
f76f473e43577eae61c03a4ced68c4aae4f4157879410cb5ea1ce403ccf59eaa | Python | 2,874 | 82 | # Node-group asset "Curve Vectors" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING... |
11e1787f3df677fa1dbf6cd5c71e57b78c81b3d54561837af372936a46f3f3dc | Python | 2,875 | 84 | """Utility functions for adjacency matrices."""
import warnings
import numpy as np
def _extract_unweighted_graph(adjacency_matrix):
input_shape = adjacency_matrix.shape
# Warn if dense and not square
if isinstance(adjacency_matrix, np.ndarray) and \
(input_shape[0] != input_shape[1]):
... |
872c00c9bd38a5566811ec87acedbd91b2db69f5ff405825b8f4586806d92e4f | Python | 2,875 | 71 | from torch import nn
class MLPSpatialFilter(nn.Module):
def __init__(self, num_sensor, num_hidden, activation):
super(MLPSpatialFilter, self).__init__()
self.fc11 = nn.Linear(num_sensor, num_sensor)
self.fc12 = nn.Linear(num_sensor, num_sensor)
self.fc21 = nn.Linear(num_sensor, nu... |
1349e6c24d75b21b54f91d2fb408fe1c68b1025ff5bf440ece7c0397011858bf | Python | 2,876 | 102 | """Q-Chem calculator IO."""
from __future__ import annotations
import struct
import warnings
from pathlib import Path
from typing import TYPE_CHECKING
from ase import units
from emmet.core.qc_tasks import TaskDoc
from pymatgen.io.qchem.outputs import (
gradient_parser,
hessian_parser,
orbital_coeffs_pars... |
2981959e988f22054346d8f3a4244795addc6bfc040b993a28d6005113a7e0fe | Python | 2,876 | 79 | import sys
import argparse
from pathlib import Path
import dolfin as d
import numpy as np
from smart import mesh_tools
from phosphorylation_parser_args import add_phosphorylation_preprocess_arguments
def refinement2hEdge(refinement: int, hEdge: float = 0.2) -> float:
return hEdge / 2**refinement
def main(
... |
cd9f484e5bab5d7519efa15e75c6a58f430ee0e77c507cea5d5c2ebb58ba2b00 | Python | 2,876 | 78 | # Copyright (c) 2023-2024 Blue Brain Project/EPFL
# 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 ... |
1a5d9f5648428ee304683f964fbd54048b30d6b82afd96b2043f3495a356deca | Python | 2,877 | 89 | import bpy
from bpy.props import BoolProperty, StringProperty
from .. import __package__, assets, download
def addon_preferences(
context: bpy.types.Context | None = None,
) -> bpy.types.AddonPreferences:
if context is None:
context = bpy.context
try:
return context.preferences.addons[__pa... |
2f7a3ae450aa1b40b561a3d9b850facd0a592fcc4735d17d86100ed817e905cd | Python | 2,878 | 90 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 30 19:41:08 2021
@author: divyoj
"""
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation
import numpy as np
import seaborn as sns
sns.set_style("whitegrid")
start=100;
stop=100;
step=1
def calculate_pa_p... |
91b09b13129922c84ad48367e49fb4a0ea866bdc0edd1b206d6335f3345eb2f9 | Python | 2,878 | 70 | """Select the best model run based on free energy
"""
# Set up dependencies
import os
import pickle
import numpy as np
from sys import argv
from utils.visualize import plot_loss_curve
if __name__ == "__main__":
# Set hyperparameters
if len(argv) != 6:
print("Need to pass five arguments: data type, d... |
0cce3d240e0d3178eea2b7aa1684daacfac139d9cfa8f74a0af250bf90652bca | Python | 2,879 | 85 | import os
import cv2 as cv
import numpy as np
from tqdm import tqdm
from skimage.measure import label
from tiffile import imread, imwrite
def filterImage(img: np.ndarray, minIdx: int) -> np.ndarray:
'''
Mask small, noisy elements from an image below
a certain threshold area
Arguments:
img... |
6c7cdf27658d9892c4ab5435499e660525cbc9f4c682c6f6a2efea2090b3f2a4 | Python | 2,879 | 74 | import unittest
import torch
from torcheeg.models import (BCDiscriminator, BCGenerator, BDiscriminator,
BGenerator, EEGfuseNet, EFDiscriminator)
class TestGAN(unittest.TestCase):
def test_bgan(self):
g_model = BGenerator(in_channels=128)
d_model = BDiscriminator(in_c... |
fae322c5d67429c8e3698fcdcb547d051eca464ed0957259407f61cf53060dc6 | Python | 2,879 | 76 | #! /usr/bin/env python
from lab.parser import Parser
parser = Parser()
parser.add_pattern('initial_h_value', 'initial h value: (\d+)', required=False, type=int)
parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int)
parser.add_pattern('ms_construction_time', 'Done initial... |
31c4591eba8a7e68285114eb704fb3e1630cff512048314c505fb941751a6de2 | Python | 2,880 | 60 | #!/usr/bin/env python
## this script creates dataframes from the full distance matrices for Features (pre- and post-session),
## and Naming (pre- and post-session) and saves them to a new CSV file
## The dataframes contain the distances values for each pair of subjects.
import pandas as pd
from pathlib import Path
# ... |
27e2ba2ac064bc0a092b96e92f657e3ef65c5285922cf649a7fcf67ccec25c87 | Python | 2,881 | 79 | import numpy as np
import seaserpent as ss
from .cave import CaveDataset
__all__ = ["Aedes"]
class Aedes(CaveDataset):
"""Mosquito (Aedes aegypti) brain dataset.
Note: this dataset is currently private and is not accessible to the public.
Parameters
----------
label : str
... |
83a6c2cac198dd30b82225e468214eb83ec9252ae1249dfe12db6f4687555444 | Python | 2,881 | 68 | import sys, os
import numpy as np
import pandas as pd
import pickle
from scipy.stats import zscore
from scipy.io import loadmat, savemat
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/analysis')
from utils import get_behav_data_15days, get_pval
#######################... |
ffdfa8d8b1bec515d4c4552392733a82fd4b1ed473e0c79e1a23b38c9f1ecdd4 | Python | 2,881 | 69 | # MIT License
#
# Copyright (c) 2024 Zihan Zhang, Yi Zhao, Harbin Institute of Technology
#
# 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... |
6011eb5aaeb6127dbaa3d7a0ea862c546a4a59c61adc2cee9a2310ef0aa5c454 | Python | 2,882 | 75 | import argparse
import matplotlib.pyplot as plt
import os
import pandas as pd
import plot_likert
import seaborn as sns
sns.set_context("paper")
sns.set_theme(style='white', palette='vlag', rc={'grid.linestyle': 'dotted'})
# Read data
# Read data
parser = argparse.ArgumentParser()
parser.add_argument('--filename', ty... |
ad4f672d3cf420981bdaa877ce81e407e60e31697973770ede04dda48e896a9d | Python | 2,883 | 40 | """posthoc_census_convergence_2026-10-02.py (post hoc robustness check). In the census's lobe cut-out, 7 of the 50 channels do
not settle with the rate theory's damping 0.2 in 3,000 steps (residual up to 3e-3 per ms). Same first-order census, with
every baseline settled (damping 0.05, up to 8,000 steps): does the ranki... |
524d1bd83fdf96be687abf92f593c36525026be1c7aa5bd1d86afd6820835471 | Python | 2,884 | 97 | import os
import sys
sys.path.append(os.path.abspath('../'))
from multiprocessing import Lock
from model.KuramotoClassFor import Kuramoto
import concurrent.futures
import itertools
import gc
import numpy as np
import scipy.io as sio
import csv
from npy_append_array import NpyAppendArray
import matplotlib.pyplot as pl... |
883a32f0387f041aa3c0cb2541958aae602effa171e42c32fdd1c9fcd0f31ed6 | Python | 2,884 | 74 | """`--reg_spacing` must ANTI-ALIAS intensity volumes, never nearest-neighbor them.
ANTsPy's ``resample_image`` interp_type codes are
``0=linear, 1=nearestNeighbor, 2=gaussian, 3=windowedSinc, 4=bSpline``.
Decimating an intensity image with NN point-samples the grid: high-frequency
structure folds back into the co... |
b16b7b1a80dd76ffed2372a14e084c61937b69e90ca4a4ef8e4ece70141c554f | Python | 2,884 | 96 | from __future__ import annotations
import pytest
jf = pytest.importorskip("jobflow")
import os
from ase.build import bulk
from quacc import flow, job
from quacc.recipes.emt.core import relax_job
from quacc.recipes.emt.slabs import bulk_to_slabs_flow
@pytest.mark.parametrize("job_decorators", [None, {"relax_job": ... |
7330aabffc5132172786afc1c7846df46ff05af598516bb7a742a5bd3bf082eb | Python | 2,886 | 78 | import numpy as np
import unittest
import pyntbci
FS = 100
FS_INTER = 4000
FS_TARGET = 50
FMIN = 150.0
FMAX = 2000.0
SPACING = 1.5
class TestAudScale(unittest.TestCase):
def test_freq_aud_roundtrip(self):
freq = np.array([0.0, 100.0, 1000.0, 4000.0])
aud = pyntbci.envelope.freq_to_aud(freq)
... |
f53669a98822adbb9571153b7a85931560c181b67fa094d4617447df5455228c | Python | 2,886 | 106 | import sys, os
import numpy as np
from collections import Counter
import pandas as pd
class samSingleRead(object):
def __init__(self, read):
self.qname = read[0]
self.flag = read[1]
self.rname = read[2]
self.pos = read[3]
self.mapq = int(read[4])
self.cigar = read[5... |
4bc32ef99b21090c1443610a7891e6214a0d87137fa066b571abd456356e1fa8 | Python | 2,888 | 82 | import numpy as np
import nibabel as nib
import os
from glob import glob
from scipy.ndimage.measurements import label
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
# inspired by the NVIDIA nnU-Net GitHub repository available at:
# https://github.com/NVIDIA/DeepLearningExamples/tree/master/... |
9d5f3fdfd9b9e59239fa8a2c9c247635452596722130590f734b77843821105f | Python | 2,888 | 78 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera_TIS as camera
import control.core as core
import contr... |
41d21bd2cbff361d69af70877b1ff713bdb3c9a3861e479c40d61e8102f13d3d | Python | 2,889 | 106 | from __future__ import annotations
from typing import Iterable
import pandas as pd
import numpy as np
try:
from importlib import resources as impresources
except ImportError:
## Try `importlib_resources` backported for Python<3.7
import importlib_resources as impresources
## Classifier =================... |
5f5f953824a269e9a269d18b473eb217d4b65edbe30bdb7938a73ea970f2a336 | Python | 2,889 | 76 | """Install actions. Every step returns Result and accepts an injectable
`runner` (argv -> (returncode, stdout, stderr)) so tests never spawn processes.
pip/download failures are non-fatal: the caller logs the warning and continues."""
import os
import shutil
import subprocess
from installer import Result
_... |
2683ddbc3ca9a9727e39bdb7f5b7e33cd088d82238f9547fd1d4b001ad8b6aa8 | Python | 2,890 | 79 | # coding: utf-8
import numpy as np
from .Sim3DR import get_normal, rasterize
_norm = lambda arr: arr / np.sqrt(np.sum(arr ** 2, axis=1))[:, None]
def norm_vertices(vertices):
vertices -= vertices.min(0)[None, :]
vertices /= vertices.max()
vertices *= 2
vertices -= vertices.max(0)[None, :] / 2
re... |
767b0261444a22a76b28832f5f9dcedd719164076690b80c784df9f911782b71 | Python | 2,890 | 100 | import torch
import torch.nn as nn
from diff_frech_mean.frechetmean.manifolds import Lorentz
from diff_frech_mean.frechetmean.utils import d2arcosh, darcosh, darcoshsq_diff
def hessian(X, y, w, K):
"""
Args
----
X (tensor): point of shape [..., points, dim]
y (tensor): mean point of shape ... |
cacd2843cf9db5d7737fb8702a89c9164e9afa4c0ef3c7f435ea1742df5c6155 | Python | 2,892 | 62 | # -*- coding: utf-8 -*-
import os
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from supar.config import Config
from supar.utils.logging import init_logger, logger
from supar.utils.parallel import get_device_count, get_free_port
def init(parser):
parser.add_argument('--path', ... |
220918c6c955b0d60f7418fc35ff36edea03ef6230facec8c65d037e595955c8 | Python | 2,893 | 82 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import argparse
parser= argparse.ArgumentParser(description='This script is used to produce the baselines and store the training-validation split of the data for subsequent training.')
parser.a... |
76607ea3d7a938a2d155b13000b70bbd35fd47608fa38c0a3ef42715d02a9a13 | Python | 2,893 | 91 | def readline(line):
"""
Read one line from the *config* file, if the line is not tagged as a comment
Parameters
----------
line : str
A line of the *config* file
Returns
-------
key_name : str
Keyname of the parameter. The name bef... |
a2a7b5cc8d85330d0b660e2adc23722bea982892496a20a3ee736677776431b8 | Python | 2,893 | 81 | # Node group ".OKLab Matrices" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenera... |
1eb25b4abe2d8385af91801920d0094a20b327c3d60d76a9fc23595675413b85 | Python | 2,895 | 34 | """posthoc_sff_review_checks_2026-09-28.py (post hoc, descriptive; answers the act7-atrest review).
(1) On the 20-odour panel the searches used, how many of Test 1's 31 function-determined types are still detectable?
(2) Among every sign set the searches evaluated, what is the lowest loss other than the truth's?
(3) On... |
3ec636fb8aeb297e1155e442d681a9d65075a660bd78a37cf3f7fe6c3f6e3a80 | Python | 2,895 | 104 | import types
import functools
# from jaraco.functools 3.3
def method_cache(method, cache_wrapper=None):
"""
Wrap lru_cache to support storing the cache data in the object instances.
Abstracts the common paradigm where the method explicitly saves an
underscore-prefixed protected property on first call... |
e931018690b7996ac90da67b134d3150b0b730c2d0ba47cd5767ffc1cf6ed242 | Python | 2,896 | 72 | import pandas as pd
import seaborn as sns
from script.paper_plots import plot_bars
import sys
#********************************** PLOT Utils******************************************
def get_palette(n_models):
palette = sns.cubehelix_palette(start=0.3, hue=1,
gamma=0.4,dark=0.1, light=0.9... |
49a56046b657ffeabe5e34b6f993d30f2779cffc40770e17c1b650e31c193a8c | Python | 2,897 | 102 | import sys,argparse
from pybioshell.core.data.io import find_pdb, read_scorefile
from os.path import expanduser, join
home_dir = expanduser("~")
# It is assumed VisuaLife library is installed in your $HOME/src.git/visualife/src/ directory
sys.path.append(join(home_dir, "src.git/visualife/src/"))
from core.Plot impo... |
51c8279cf3de8efc63996e5c9ccc757f3b842377065416ed961d7afc1b67cc52 | Python | 2,897 | 92 | from __future__ import annotations
import os
from pathlib import Path
import pytest
from ase.build import bulk
from quacc import change_settings
from quacc.recipes.emt.core import relax_job
from quacc.settings import QuaccSettings
FILE_DIR = Path(__file__).parent
def test_file(tmp_path, monkeypatch):
with ope... |
54100980ff419b0d3c9653b6a6c0c6be6715dc79917e28f52acfc5248efe2779 | Python | 2,897 | 89 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
b4d1274bb66fea5d7435b903d79b1020459f5e0fb26952e7322fb3fee5ed844f | Python | 2,897 | 83 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
15c9ac5c1692cf717258bf6a0c150794e5736462645e383c841642ab3c057f34 | Python | 2,899 | 78 | import sys
import os
out_dir_path = sys.argv[1]
models = ["default", "TINYX0111", "TINYX011", "TINYX01", "TINYX2", "TINYX3"]
use_cases = ["sepsis", "viral", "covid"]
execution_times = []
for model in models:
execution_times.append([])
for use_case in use_cases:
execution_times[-1].append(0.0)
for i... |
94595d9f9f1ec7d945630c690b5f48ae8db799a04e92544444a7f9d3a1aecac5 | Python | 2,899 | 88 | from collections.abc import Iterator
from importlib import resources
from pathlib import Path, PurePath
from typing import ContextManager
PathType = str | PurePath
Package = resources.Package
def get_file_from_package(package: Package, file_name: str) -> ContextManager[Path]:
"""
This is a context manager, b... |
daceee2e62470f90398147fc1bd7378e21d70f9bb99781ffa623f758fa46ff76 | Python | 2,899 | 70 | from torch.utils.data import Dataset
from sklearn.model_selection import StratifiedKFold
import torch
from torch import tensor,float32
import pandas as pd
from random import shuffle
import h5py
import numpy as np
from sklearn import preprocessing
class Data_MDD(Dataset):
def __init__(self, data_path, cs... |
4b4dd233407cc4d073ce6952335454be0e2439f59683a71f77ea052b22bf41db | Python | 2,900 | 87 | import os
import numpy as np
import pytest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
pytest.importorskip("pyqtgraph")
@pytest.fixture(scope="module")
def qapp():
from PySide6.QtWidgets import QApplication
return QApplication.instance() or QApplication([])
def test_brush_stamp_pa... |
dbe31b0ed3f3909fb91b5c24fe4f1d3adfe3338840fd5ff5976dc81936f2bae6 | Python | 2,900 | 103 | import numpy as np
from datetime import datetime
from pathlib import Path
from abc import abstractmethod
from torch.utils.data import Dataset
from utils.logger import get_logger
from utils.util import check_cache_files
class BaseDataset(Dataset):
'''
Base class for all datasets
'''
def __init__(self, ... |
78936594418855103fecd7af0e67c40fdcfc0077a3a3ef77979ed201cd034b3a | Python | 2,901 | 72 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
c0b6507a82b08ef2a550324412a8be474790461013a777319d522d4d6c2029de | Python | 2,903 | 86 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
c19c6653432ab1779fe988d371d99573e8e1e43b117616efd4444ae125fe389a | Python | 2,904 | 58 | #Define activity flow mapping function
import numpy as np
def actflowcalc(actVect, fcMat, separate_activations_bytarget=False, transfer_func=None):
"""
Function to run activity flow mapping algorithm
actVect: node vector with activation values
fcMat: node x node matrix with connectiivty values
... |
7f45da39fbf7168610fc61fc6829233f4afbae32949cec9f2c164aecea4ed88a | Python | 2,905 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
c69361e963894ac9570be41ec6a850494093711a3d9644ab87f54184289b78f5 | Python | 2,905 | 88 | # Import libraries
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import torch.nn.functional as F
import matplotlib.pyplot as plt
import os
import pickle
import numpy as np
from sklearn import metrics
from sklearn.model_... |
ce3f05e90953c16d5734039516b921483a19038a8e10bccfb8accfadf3cb4eee | Python | 2,905 | 99 | """Base classes for parameter estimation in HMP models."""
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Any, Optional
import numpy as np
from hmp.patterndata import PatternData
@dataclass
class EstimationResult:
"""Results from parameter estimation.
Param... |
8d8d6bcb5ef88979671042b60d1d3ba6b896c8895b23bc39fc0ba45344f6bedf | Python | 2,906 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
acb2b31593369a37adf54a8a148bb3079cfb665e6e5e3112fea4f21852f8e23c | Python | 2,906 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
1ff00ba56112479c9d894fa2f8dfe5f777bce7b32b7691e0e1d0e4f1bd2ee3bd | Python | 2,907 | 101 | # Node-group asset "Group Info" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
fr... |
b6dcc05de3eb372e11a248b7942c2cf22086441370296e941466348dab7e7d8b | Python | 2,907 | 69 | import torch
from torch_geometric.nn import MessagePassing
from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set
import torch.nn.functional as F
from torch_geometric.nn.inits import uniform
from conv import GNN_node, GNN_node_Virtualnode
from torch_scatter import ... |
1433f17b11cc54f1c65081d3cc2252c13828690d4da0bc49d61aa8991f25713d | Python | 2,908 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
0a5e0b68458db1fcd28d2c64b347bb98b94eb16b97bb3969999ba668b1e6dcee | Python | 2,910 | 75 | """
This script computes the averaged-ROI beta-series for the task data. It also
applies the Fisher transform, regresses the mean FD and saves the matrices.
@author: trianaa1
"""
import glob, os, sys
import numpy as np
import pandas as pd
from scipy.io import savemat, loadmat
from sklearn.linear_model import Linea... |
f2d4b303737a69d15f787670efb6f8a34e3b55d47a919f7793cfb17fcfda27ea | Python | 2,910 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
7e871acd9fde3acf5e83829417cd90560e9f774b6d8242f77f19bd6bcd85c91b | Python | 2,911 | 89 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
786e10d73e51a7e485e7f9e1922fd6643924a6b35417a697c537ece38e6adf89 | Python | 2,912 | 81 | # coding=utf-8
# Copyright 2020 The Google AI Language Team Authors, Allegro.pl, Facebook Inc. and the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... |
7d6dbdfb5e5edde68280b6ce3328f5f2ad07c532d5b6406bdd9382db7e5b457c | Python | 2,912 | 89 | from __future__ import absolute_import
from deepsignal2.utils.process_utils import complement_seq
from deepsignal2.utils.process_utils import get_refloc_of_methysite_in_motif
def get_contig2len(ref_path):
refseq = DNAReference(ref_path)
chrom2len = {}
for contigname in refseq.getcontignames():
... |
63a6a13c8ae70ec63a5a2d463c8fc25dfd09717601fc6c6c81659d00a58c0f35 | Python | 2,913 | 75 | #============================================================
#
# Artifact reduction from ECG
# Main experiment in the FGDAE paper
#
# author: Ahmed Shaheen
# email: ahmed.shaheen@oulu.fi
# github id: AhmedAShaheen
#
#===========================================================
import matplotlib.pyplot as plt
fro... |
888365300fe643445b50a381be1db539a4801ea7fe2b951345bd38f24e9031a8 | Python | 2,913 | 113 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
from pathlib import Path
from quacc import (
change_settings,
flow,
get_settings,
job,
redecorate,
strip_decorator,
subflow,
)
from quacc.wflow_tools.customizers import customize_funcs
def test_strip... |
04ba10d0458c94db1a681a9dd689be6d5daa22e8cfa38bc43acc32ddaa77d595 | Python | 2,915 | 92 |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.feature_selection import mutual_info_regression
from sklearn.base import BaseEstimator, TransformerMixin
def base_from_ped(chr_merge):
seq_all=[]
for i in range(chr_merge.shape[0]):
seq... |
b94a9ccf94973f86197ad1b1297d9726a41296559d9db563128b80cb1a23a4b0 | Python | 2,915 | 67 | """Tests for atlas_files() and atlas_installation_status() helpers."""
import os
import pytest
from regtools.atlas.registry import (
ATLAS_REGISTRY,
atlas_files,
atlas_installation_status,
get_atlas,
)
class TestAtlasFiles:
def test_allen_ccf_25um_returns_expected_keys(self):
... |
e747130a9d6e514945b7af52e029e57a8f88b94ae46b375845f64107a08e9de4 | Python | 2,915 | 77 | import torch
from torch import nn
from typing import List, Dict, Callable, Any, Optional, Union
from .equivalent import TensorLinear, TensorBiLinear
from .activate import TensorActivateDict
__all__ = ["ReadoutLayer"]
class ReadoutLinearMLP(nn.Module):
def __init__(self,
n_dim : int,
... |
f5656b83581538af329596284717d7e2e979cead5667959f4817f7f1f71fd08f | Python | 2,916 | 90 | import numbers
import cv2
import numpy as np
import PIL
import torch
def _is_tensor_clip(clip):
return torch.is_tensor(clip) and clip.ndimension() == 4
def crop_clip(clip, min_h, min_w, h, w):
if isinstance(clip[0], np.ndarray):
cropped = [img[min_h:min_h + h, min_w:min_w + w, :] for img in clip]
... |
31d6c0d2206e2163acc5286ed9aaf130e9d00944d6fe619f2d324499c8abefbd | Python | 2,917 | 69 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
7b60a0599a61ac7ef766bb278f60441712ef3b8e9662323096940227ad4af78d | Python | 2,917 | 104 | # Node-group asset "Break Curves" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
... |
d35778400e800c07748b232d4ff79956f5fa8db2c1dedbba664d1b7117069814 | Python | 2,919 | 80 | import pandas as pd
import seaborn as sns
from script.paper_plots import plot_bars
import sys
#********************************** PLOT Utils******************************************
def get_palette(n_models):
palette = sns.cubehelix_palette(start=0.3, hue=1,
gamma=0.4,dark=0.1, light=0.9... |
90fc25608ba5fcaace2a4c4e08eef58fbffba67a2a1082942d0a6366858f831b | Python | 2,920 | 59 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
a0a02277e71dcf5d23a9898a826f0c1c01f3a669587acfcd1d6ccbccdc123693 | Python | 2,920 | 94 | from __future__ import annotations
from copy import deepcopy
from pathlib import Path
import numpy as np
import pytest
from ase.atoms import Atoms
from ase.build import bulk, molecule
from ase.calculators.emt import EMT
from ase.io import read
from quacc.atoms.core import get_atoms_id
from quacc.schemas.prep import ... |
d1c9bfe8161d1cb1f71c2633857022d156963a120906e2ec7bdfa6d7cb867712 | Python | 2,921 | 81 | '''
Script to generate PLECs for the dataset.
NOTE: It's very important that the ML table that you use lines up with the PLECs.
So each line number in the ML table should correspond to the line number in the PLECs .npy file.
This is incorporated in the ML-table generation script. Therefore, generate the ML-table aft... |
e8af32168277021cf1e201c632237b3a9cc3f569fcea7a5f07fab66803e3128a | Python | 2,922 | 45 | # -*- coding: utf-8 -*-
import argparse
from supar import BiaffineDependencyParser
from supar.cmds.run import init
def main():
parser = argparse.ArgumentParser(description='Create Biaffine Dependency Parser.')
parser.add_argument('--tree', action='store_true', help='whether to ensure well-formedness')
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.