sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
dd0763f8fc69d1ac8eff32631b6ed62aed0d82de03ee7235e13fbe2316d5d81e | Python | 4,031 | 80 | import argparse
import prescient.simulate as traj
from prescient.train.model import *
import prescient.perturb as pert
import prescient.simulate as traj
def create_parser():
parser = argparse.ArgumentParser()
# perturbation parameters
parser.add_argument("-p", "--perturb_genes", required=True, help="Prov... |
14b89cb993764ab1f85fcd0d903de5086361bc8f0ced97e647562f39e17ec32e | Python | 4,032 | 138 | """Utility classes/methods.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import inspect
import warnings
class E3FPError(Exception):
"""Base class for E3FP-specific errors.
This class is provided for future E3FP-specific functionality.
"""
class E3FPWarning(Warning):
"""Base E3FP warning class... |
ebe8787491d1b39a5367c05663f1764cb312ac2cee1876e5d95df362d16d22cc | Python | 4,033 | 123 | import pandas as pd
import numpy as np
import os
import sys
import time
import scanpy as sc
import matplotlib.pyplot as plt
# Step1: Concat Peak Matrix of Human and Macaque (Union Peakset)
import scipy.sparse
input_dir_Human = '../Human_ATAC/ArchR/Peak_df/Union'
Count_df = pd.read_csv(os.path.join(input_dir_Human, '... |
11e463ccd9532d2fb88a8228adec2d6c42994acb2305a425c8f262feff32a012 | Python | 4,034 | 109 | import sys
import scanpy as sc
import anndata
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import subprocess
import os
import cell2location
import scvi
from matplotlib import rcParams
rcParams['pdf.fonttype'] = 42 # enables correct plotting of text
import seaborn as... |
6cd2a702350adc2e480beb7048cbe9b649bd696e9143bf90c85f83efda109fe2 | Python | 4,034 | 129 | """Base jobs for Onetep."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.calculators.onetep import Onetep, OnetepProfile
from quacc import get_settings
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.dicts import recursive_dict_merge
if ... |
c52f0386b8f8fba4d9cf0f9e4ea32d9d5a2e4865ebe8a878b6711136e03b68ec | Python | 4,035 | 117 | """Utilities to determine interface information for mmCIF files."""
from eudockscore.utils.pdb import (
load_pdb_file,
get_ca_coords,
get_chain_ids,
get_sparse_matrix,
)
from Bio import PDB
import numpy as np
import torch
import logging
import warnings
logging.disable(logging.WARNING)
warnings.filterw... |
20f6a2b0b98bb025d9b7c5125c3be989d11322bd709f61dbc88daa357174aa4d | Python | 4,036 | 118 | # Node group ".MN_utils_aa_atom_pos" (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 re... |
36922b5ad4d13c227b9f7d21d41256ccd30dbf50866df816f56ab083ad155e71 | Python | 4,036 | 91 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
'''
Compute neighborhood complexity of (E-E) BBP V5 connectome and controls
Note: This script generates some duplicated data. I have decided to keep it, because the files are small and potentially useful
in case t... |
77a0d4134e012bcee66fbe965efdc024415b31af0a1bab8953e64ef66f0b9fa1 | Python | 4,036 | 116 | # Node-group asset "Sample Mixed Color" (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_CHE... |
ce9defaa1b441abdb6d30e5bfbcb80c99dec982be1abd2641765adfc0afd31c9 | Python | 4,036 | 137 | #
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from collections.abc import MutableMapping
from d... |
eeb545b1f57df6ed5a5592e440093caa9d636037aa6c9a55abfc83b280469a08 | Python | 4,036 | 127 | # 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... |
084e678cae046a6576448549227218f45be5b2269f789cd10ec2d6e4865e866d | Python | 4,037 | 95 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
from pybullet_tools.pr2_problems import create_floor, create_table
from pybullet_tools.pr2_utils import get_top_grasps
from pybullet_tools.utils import connect, get_pose, set_pose, Point, disconnect, HideOutput, \
wait_for_user... |
7e03235f07e9e54789d7e7449ca876b333352a1556758a96c51064ea370f163a | Python | 4,037 | 111 | import os
import torch
import pandas as pd
import numpy as np
from Bio import SeqIO
from torch.utils.data import DataLoader
from utils import set_seed, create_predict_dataset
from model import RNASeqClassifier
import RNA
import argparse
# Set random seed to ensure reproducibility
set_seed(42)
def load_models(model_ba... |
df385fe8e57df57ed6d350ef734af0c8d9128622b06caa0a0ba5fc67b0eed871 | Python | 4,037 | 74 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
def main(revisions=None):
suite=suites.suite_optimal_strips()
suite.extend(suites.suite_ipc14_opt_strips())
# only DFP configs
config... |
f1274fb17677093bb79fe34825c926512d724ba31aeb1f53fb6a5627042e5675 | Python | 4,037 | 122 | import nibabel as nib
import numpy as np
import seaborn as sns
import pandas as pd
import scipy.io as sio
import time, os, pickle, json
import matplotlib.pyplot as plt
import matplotlib as mpl
# from nod_utils import save_ciftifile
from os.path import join as pjoin
from matplotlib import font_manager
from sc... |
37d40624cddc2b1deca8eb5f85caf70e2aec75cdf87bfff9996d6a1cf053fcc5 | Python | 4,038 | 110 | import os
import logging
import tifffile
from skvideo import io as skio
from matplotlib.colors import Normalize
import numpy as np
import torch
from typing import List, Optional
from cellmincer.datasets import build_ws_denoising
from cellmincer.models import load_model_from_checkpoint
from cellmincer.util import co... |
60316fff106bc03054107948e7f8dc6d15ceb9dc8e44280ed987a0897efdb4de | Python | 4,038 | 141 | from collections.abc import Callable
import pytest
from elasticai.creator.graph.subgraph_matching import find_all_matches
from elasticai.creator.ir.graph import AdjacencyMap, Graph, GraphImpl
@pytest.fixture
def new_graph() -> Callable[[], Graph[str, str]]:
def new():
return GraphImpl(lambda: "default")... |
7d1238772532e838c312733ccef7f63de3e9f1d8e3d1c1c4aea907c4fb218e01 | Python | 4,038 | 100 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import numpy as np
from sklearn.metrics import balanced_accuracy_score, accuracy_score
import argparse
from sklearn.model_selection import StratifiedKFold
from sklearn.linear_model import LogisticReg... |
aa5eb2acd8ff26466d11857348398c459ef42679ff21f0aa7746b0333c1644d5 | Python | 4,038 | 130 | import dill
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.multiclass import OneVsRestClassifier
from collections import defaultdict
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import jaccard_similarity_sc... |
874c08729ee04cddf48a573f2978772f2397c4fa2f4545171f2b3af4d7e4d135 | Python | 4,039 | 121 | #!/usr/bin/env python3
"""
m6a_ont_data.py
Author: Anupama Jha <anupamaj@uw.edu>
The script takes positive and negative
objects Morgan Hamm generated and makes
a ML object from it.
"""
import argparse
import numpy as np
import configparser
from sklearn.model_selection import StratifiedKFold
def read_data(positive_pa... |
9c4f5ba23f9c39f8379c6f1bafeadf981303007a0ca672258ab03bcb8aef3237 | Python | 4,039 | 95 | import numpy as np
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
from matplotlib import cm
import os
### Helper Functions
##################################################################################
###################################... |
1a879bd771a501db0b3df0f4efd20ed181e48462bc0262623e88ab89b1b73e92 | Python | 4,040 | 129 | # Parameters for evolution
from numpy import array, zeros, ones, cumsum
from copy import deepcopy
params = {}
# Number of subjects
params["num_subjects"] = 1
# Does or does not have D-wave (0-no, 1-yes)
params["D+"] = [0]
# Total number of waves (D-wave + I-waves)
params["measured_waves"] = 4
# Extra I-waves for fu... |
8744f554e4618d8ae363d61ace70b90c06d27bc74ae6daae2bd8c5a6e2f0b1a7 | Python | 4,041 | 132 | """
Optuna example that optimizes multi-layer perceptrons using Catalyst.
In this example, we optimize the validation accuracy of fashion product recognition using
Catalyst, and FashionMNIST. We optimize the neural network architecture.
You can run this example as follows, pruning can be turned on and off with the `-... |
8fb48169de45fc68725c4a4c7ca7860d6870cdb225ce372030aea76f1d257677 | Python | 4,041 | 115 | import os
import numpy as np
import torch
from specs import *
from allen_data import \
ProcessedAllenNeuronMorphology, \
ProcessedAllenNeuronElectrophysiology
def load_morphology(
optosynth_data_path: str,
cell_id: int) -> ProcessedAllenNeuronMorphology:
return ProcessedAllenNeuronMorpholo... |
39898a55a66624a1e21aa3cfd8d65d63b1e66193a97cae00aa7f72d5111ffa8b | Python | 4,042 | 113 | # 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... |
97f0f1d69e8c9bb4358bf2e390e5f5980faf5a4d44bca6bd642e4838e79aad31 | Python | 4,042 | 125 | """
Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
"""
import re
from pathlib import Path
from typing import Union
from .extern import packaging
from .warnings import SetuptoolsDeprecationWarning
_Path = Union[str, Path]
# https://packaging.python.org/en/latest/specification... |
c7c39c773a0d09074cc51a83e52747349916540ae68135452176590f08e4396c | Python | 4,042 | 114 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
e1b052ace91b2b976fab281bd57e1cbbc8d96a65c36608388577a8850742f4d1 | Python | 4,043 | 117 | from src.dijkstra.transforms import (
GetStartEndPoints,
InterpolateImage,
get_cos_similarity,
)
from src.SIRE.transforms import CreateSIREGrid
from src.utils.general import transform_points
from dijkstra3d import dijkstra
import os
from monai.transforms import Compose, LoadImaged
from monai.data import ITK... |
b1d1ee19f063ef3b4e878b555074ffd427a3900e65b70a9211840adf49b96576 | Python | 4,044 | 43 | """FIG_MARGIN.py 2026-10-02. Report figure F17 (how many signs must be right depends on the distance to the line):
(a) along paths towards the line and away from it, the number of single cells whose wrong sign alone loses >= 5 channels,
against the excitatory share of the local neurons' output;
(b) every checked cel... |
3e4d2f41f4be2d4ba61a1fc0d0a79b367eb8a7285e42815da0a0fedc7a0578b8 | Python | 4,046 | 96 | # -*- coding: utf-8 -*-
import numpy as np
from scipy import interp
from matplotlib import pyplot as plt
from sklearn.metrics import auc
base_fpr = np.linspace(0, 1, 101)
def PlotROC(save, *files):
for l, f, c0, c, auroc in files:
fig = plt.figure(figsize=(4.5, 4), dpi=300)
ax = fig... |
5ceac4a90dca562e05223635ffc10266e94a809b50d6b7eda52829ac5a471210 | Python | 4,048 | 117 | # 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... |
a17de0479e9852b5f555ff5f289f2d7724827c2cc4a4e36e7492d8b6002c2aa9 | Python | 4,048 | 115 | import io
from uuid import uuid1
import bl_ext.blender_org.molecularnodes as mn # type: ignore
import bpy
import matplotlib
import matplotlib.pyplot as plt
from MDAnalysis.analysis import rms
from PIL import Image
matplotlib.use("Agg")
# Annotations are auto-registered
# Unregister previous class if any while debugg... |
be12863a82a01ad208458b4e8811b8c7d2296c5073a5cd56e592b90509d7a887 | Python | 4,049 | 118 | # --------------------------------------------------------
# DaSiamRPN
# Licensed under The MIT License
# Written by Qiang Wang (wangqiang2015 at ia.ac.cn)
# --------------------------------------------------------
import cv2
import torch
import numpy as np
def to_numpy(tensor):
if torch.is_tensor(tensor):
... |
a6b49589638397ef1280f2f26df777a69d88285b7ef696c5cc8eeee59e7bd4f0 | Python | 4,051 | 110 | # 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... |
bbc9cba40ca6881cdd5c9df0c74aec81e1dfd41a59a2f6a09eda6e76380257bd | Python | 4,051 | 91 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for helper functions required to transcribe the images
1. adjust_gamma(): Performs gamma correction on input image
2. imgs_to_array(): Converts each image in folder into a numpy array & concatenates them
3. get_lcd(): Takes input image filename & extract... |
e6077110a02e79841618ed3994cb74e857b5042afbfb912a4ba08700cce57252 | Python | 4,051 | 132 | from __future__ import print_function
import cProfile
import os
import pstats
import numpy as np
from examples.motion.viewer import sample_box, get_distance, is_collision_free, \
create_box, draw_solution, draw_roadmap, draw_environment
from pddlstream.algorithms.incremental import solve_incremental
from pddlstr... |
0a12831f3980b2140e85c47122a5d53304c2a529241d8601bb384239dbeefcc4 | Python | 4,052 | 163 | import os
import random
import numpy as np
import torch
import math
import time
import datetime
import json
from json import encoder
FORMAT_INFO = {
"inchi": {
"name": "InChI_text",
"tokenizer": "tokenizer_inchi.json",
"max_len": 300
},
"atomtok": {
"name": "SMILES_atomtok"... |
4905bdca4a652225fc06110714d3831bd07a6b57a58d65722fd5c88e7c8b2f9c | Python | 4,052 | 124 | extensions = dict(
required_params=["x", "y", "training_frame", "random_columns", "group_column"],
set_required_params="""
parms$training_frame <- training_frame
args <- .verify_dataxy(training_frame, x, y)
if (!missing(random_columns)) {
parms$random_columns <- random_columns
} else {
... |
91a5f00b595c6c076c370707914cb85d86732b6b5ece5b5f64935c15b8c3cd9d | Python | 4,052 | 93 | import os
import tempfile
import unittest
from torcheeg.model_selection import TrainValTestSplitCrossTrial
from .test_utils import _make_dataset
class TestTrainValTestSplitCrossTrial(unittest.TestCase):
_splitter_class = TrainValTestSplitCrossTrial
_parameters = {'train_trials': [0, 1, 2], 'val_trials': [3]... |
24846989bc30ff8e734a53c87735528750ece941d22995cf1eb0218163690ecc | Python | 4,053 | 115 | from copy import deepcopy
from multiprocessing.pool import Pool
from batchgenerators.utilities.file_and_folder_operations import *
from medpy import metric
import SimpleITK as sitk
import numpy as np
from nnunet.configuration import default_num_threads
from nnunet.postprocessing.consolidate_postprocessing impo... |
3fc86c02c8a2bd7a37abf5e1ebb7c838003af5cbe5ffc8037c31a21ff6b82dc0 | Python | 4,053 | 136 | # 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... |
07291771e423132f84d0f5e5e3eb77e68ed243b921f16c237e60115979739a6b | Python | 4,054 | 125 | from typing import Any, cast
import torch
from elasticai.creator.arithmetic import (
FxpArithmetic,
FxpParams,
)
from elasticai.creator.base_modules.conv1d import Conv1d as Conv1dBase
from elasticai.creator.nn.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.fixed_point.conv1d.design... |
dfad3c0a515c7ccb4351eb7efd7d6d4680013909f536a0ebf0772584efd91af1 | Python | 4,054 | 65 | """DEFAULT_ALONE.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30-DEFAULT-ALONE.md
F1 = published signs with only the 150 uncalled AL local neurons inhibitory. Test A: 50 glomeruli; Test B: the real fly.
usage: python DEFAULT_ALONE.py [run|analyse] (workers: DA_WORKERS, default 4; resumable)"""
import sys,... |
f05723fa79e82656b70c4df7c30f4837d3855d87d55c5f641dce1fb33b9e29e3 | Python | 4,054 | 143 | """
Core recipes for Lennard-Jones Potential.
NOTE: This set of minimal recipes is mainly for demonstration purposes
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.calculators.lj import LennardJones
from quacc import job
from quacc.runners.ase import Runner
from quacc.schemas.ase ... |
393d5785f422166fc06396341a82f08ba47eacdcdd937c22bdb25b837bbb7cc1 | Python | 4,055 | 103 | import sys
import os
import csv
from collections import defaultdict
import numpy as np
import pandas as pd
def load_summary_structures(filepath: str) -> (pd.core.frame.DataFrame, set):
"""
Loads from the summary structures file and
returns the table and all of its unique labels.
"""
... |
5c49abfcc8f8b27d5062969ad1d69533e7b7caee852e8dc8505934d7bfc1ef32 | Python | 4,055 | 127 | # Meep Tutorial: Hz-polarized transmission and reflection through a cavity
# formed by a periodic sequence of holes in a dielectric waveguide,
# with a defect formed by a larger spacing between one pair of holes.
# This structure is based on one analyzed in:
# S. Fan, J. N. Winn, A. Devenyi, J. C. Chen, R. D. Meade,... |
29b3b1a64189ac9277c525d427774f8e3350878c72334b261463ad3dcfb8182b | Python | 4,056 | 102 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from sklearn import manifold
from sklearn.model_selection import train_test_split
from time import time
from sklearn.decomposition import PCA
import pickle
from pair_scatter_plots import caa_plot_pairs
f... |
5eb769b8fc5353b91510a08ee1c344a7663b1e794a68a6dd6a5d813019836bb4 | Python | 4,057 | 137 | """Configure tests."""
# Authors: The PyPREP developers
# SPDX-License-Identifier: MIT
import mne
import numpy as np
import pytest
from mne.datasets import eegbci
@pytest.fixture(scope="session")
def montage():
"""Fixture for standard EEG montage."""
montage_kind = "spherical_1005"
montage = mne.channel... |
7841e9e186efb7079c77804c75729d0e213d0089049c93145490a3751acc5307 | Python | 4,057 | 114 | from argparse import ArgumentParser
from logging import getLogger, StreamHandler, Formatter, INFO, DEBUG
from pathlib import Path
from re import search
from textwrap import dedent
from numpy import isnan, array
from scipy.io.wavfile import write
from .. import __version__
from ..dataset import Dataset
from ..trans im... |
fa2956fdbe78b642e3e41902c102b0033d2f3e0eb6f66fa1b29d98d87ea02619 | Python | 4,057 | 129 | # Node-group asset "Evaluate on Instances" (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_... |
3f363503b95fa3c35f0e013b5efea393d6855e892c18ec3a6fcb139ab3bac8a1 | Python | 4,059 | 107 | """Utility to summarize statistics on logs, given an experiments file with starred experiment names."""
import os
from datetime import datetime
from collections import defaultdict
import re
def getExperimentNames(experimentsFile):
"""Experiment names should be marked with an *"""
with open(experimentsFile) as ... |
5e53f9257e38f8d536489c7949d060db684042f552b905baa301c0d87657f373 | Python | 4,060 | 102 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Generator
class GLULayer(nn.Module):
def __init__(self, dim):
super(GLULayer, self).__init__()
self.dim = dim
self.sig = nn.Sigmoid()
def forward(self, x):
out,gate = torch.chunk(x, 2, dim = se... |
bfa651abbc789d06600442fc547ba5959a0a1fc6836e490e8fdfc4c2305fa2fb | Python | 4,060 | 122 | import torch.nn as nn
import math
import torch
import config as cfg
def conv_bn(inp, oup, stride):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, 1, bias=False),
nn.BatchNorm2d(oup),
nn.ReLU6(inplace=True)
)
class InvertedResidual(nn.Module):
def __init__(self, inp, oup, st... |
269ab0f5d7bdc279f5151bb2ffca970686287f1ccbc150efb63ac3faa1d7df7a | Python | 4,061 | 129 | #!/usr/bin/env python
'''derived class definitions for LFP predictions'''
import numpy as np
from lfpykit import RecExtElectrode
class PeriodicLFP(RecExtElectrode):
'''
Modified version of lfpykit.RecExtElectrode that incorporates periodic
boundary conditions for electrostatic forward models in 2D.
P... |
1463c4fb4dba10d3ed4022bceb24e2929b0003f323f32bb017746ae348377701 | Python | 4,062 | 128 | import argparse
import cv2
import time
import numpy as np
import threading
try:
import seabreeze as sb
import seabreeze.spectrometers
except:
print('seabreeze import error')
# installation: $ pip3 install seabreeze
# installation: $ seabreeze_os_setup
from control._def import *
class Spectrometer(object)... |
173acf2947dc5a2b1a8e3b2d7e2fc5a15d091f10fdb52b0066a34eba3aaad544 | Python | 4,063 | 85 |
# 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
#
# ... |
2ebb5289347aec3cec0b32a26c0d7c2c21b525dd3461542b791e9a0f4545e53c | Python | 4,064 | 115 | # 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... |
b4890f3543e77763286c0a9358d3f39281cf404d1108e8c54945fbcb077a5771 | Python | 4,064 | 127 | from unittest import TestCase
import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fftfreq
from scipy.fftpack import fft
from scipy.ndimage import convolve1d
from soundsig.sound import plot_spectrogram
from soundsig.thirdparty.transform import WaveletAnalysis
from soundsig.timefreq import wavelet... |
a444b8a88c3b6e3d9fd563c0cb3efcae941a1519d6279b0e79eb6579397f74fd | Python | 4,065 | 115 | """Set up MATLAB PREP CI environment."""
# Authors: Austin Hurst
# Stefan Appelhoff
import shutil
import time
from pathlib import Path
from urllib.error import URLError
from urllib.request import Request, urlopen
from zipfile import ZipFile
from mne.datasets import eegbci
def download(url, dest, retries=5... |
fcde7bf9a832bb293a8a03840841caac331d6829c9c5ab297e0120c688574ae5 | Python | 4,065 | 114 | import os
from abc import ABCMeta
from pathlib import Path
from typing import Union
import databpy
import numpy as np
from nodebpy import geometry as g
from nodebpy.builder import GeometrySocket
from ... import blender as bl
from ...nodes.geometry import SetGeometryVolume
from ..base import EntityType, MolecularEntity,... |
e43669a7f380d3a2267922e47282323c19032b47baafcfbd448414c877cf69cf | Python | 4,067 | 76 | import numpy as np
import matplotlib.pyplot as plt;
import matplotlib.patches as patches;
import matplotlib.colors as colors
import seaborn as sns
def addNetColors(fcMatrix):
""" A function to generate a heatmap figure with CAB-NP colors added along axes of FC matrix; python 3
fcMatrix: a node x node... |
18a8b38724bb11246253aeeef149c124b9b8ea0a1abbdf77ec47215d66cf0659 | Python | 4,068 | 120 | from __future__ import annotations
import os
import re
import sys
from functools import lru_cache
from typing import cast
from .api import PlatformDirsABC
class Android(PlatformDirsABC):
"""
Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
`appname <platfo... |
2fe60d40f33c2df5da5a93569b61633bb6ce1a2eb6134b6dc7c707425bffeb9c | Python | 4,068 | 97 | import argparse
import cv2
from cv2 import imread, resize
import numpy as np
import os
import pandas as pd
from tqdm import tqdm
from constants import *
from src.preprocessing.helpers import cutdown
"""
this script is used to serialize simulated preprocessing. It is expected that the directory with simulated preproc... |
52e509fb8c4bafbfccd1fc9a3590a72543df4986ac06db2366f805fe36c128c8 | Python | 4,068 | 118 | import math
import meep as mp
# This file realizes a 1D, one-sided Fabry-Perot laser, as described in Fig. 2 of Optics Express, Vol. 20, pp. 474-88, 2012.
# Cavity definitions
resolution = 400
ncav = 1.5 # cavity refractive index
Lcav = 1 # cavity length
dpad = 1 # padding thickness
dpml = 1 # PML thickness
sz =... |
a088c0359a8f4c0cf5d1f841f97bb28812738e3f04955ff1f1d2a72b26aac514 | Python | 4,069 | 95 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExper... |
e87a34779dc357a4e5d50470147c997abaa19027cc82bfbd75e8625bca307501 | Python | 4,071 | 121 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from model import const
import numpy as np
from copy import deepcopy as c
class GRU(nn.Module):
"""Some Information about GRU"""
def __init__(self, in_feat, out_feat, g, dropout=0.0):
super(GRU, self).__i... |
8e1ea02c73bdfdc3215cea8a87e9c27697faa32256131c21727425eb87df0401 | Python | 4,072 | 92 | import yaml
import numpy as np
from pathlib import Path
import seaborn as sns
from matplotlib import pyplot as plt
def cross_val_evaluation(final_experiment_dir, metadata):
label_names = metadata['label_names'][1:]
results = {}
for split in ['test', 'train']:
eval_fps = list(Path(final_experiment_dir).glob(... |
c372fd74e8f39269683e6dbd869ba7d18ca1938adefd41b6c6b407e505eb4caa | Python | 4,072 | 172 | from __future__ import annotations
import asyncio
import sys
from types import ModuleType, SimpleNamespace
from quacc import flow, job, subflow
from quacc.wflow_tools.context import NodeType, tracked
def test_decorators(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
@job
def add(a, b):
ret... |
f0d8a0e10deb5ca5cf0a5e3a357983dbdb0999cb22d8ee69f6b52dc64c0d33db | Python | 4,072 | 165 | # utils.py
import bz2
import gzip
import logging
import subprocess
from pathlib import Path
def open_by_suffix(file_name, mode="r"):
"""Opens file based on suffix."""
# noqa modified from https://stackoverflow.com/questions/18367511/how-do-i-automatically-handle-decompression-when-reading-a-file-in-python
... |
b91306e4a1b9fd68b122832e9e45506a454fcc771fd9902dbc3a33edd6cc527e | Python | 4,073 | 91 | '''
Description:
Figure plotting for the learned latent space.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import numpy as np
from plotting import *
from plotting import _removeTopRightBorders, _removeAllBorders, linearSegmentCMap
# ======================================================
base_dir = "../r... |
e80e52ad42441141f16c6b5bb1cc14d8da42cb3fb7ced883946587a51461b09f | Python | 4,073 | 96 | from typing import Dict, Generator
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._internal.exceptions import NetworkConnectionError
# The following comments and HTTP headers were originally added by
# Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03.
#
# We use Acc... |
7d89c19b610cf3fc24ea775ad167191e45fe26d409f50f471a90ec9508d91541 | Python | 4,074 | 102 | import torch
import pandas as pd
import os
import numpy as np
from gt4sd.frameworks.granular.train.core import parse_arguments_from_config, train_granular
from gt4sd.frameworks.granular.ml.module import GranularModule
from gt4sd.frameworks.granular.dataloader.dataset import build_dataset_and_architecture
from gt4sd.fr... |
a407305c97bdfb206f53eedd875ba61538c4a32fb690ac455f8cd4804a457e8c | Python | 4,076 | 107 | """Implementation of CLI find command."""
import numpy as np
from treem.io import SWC
from treem.morph import Morph
from treem.utils.geom import fibonacci_sphere, rotation, rotation_matrix
def _filter_by_comparison(nodes, getter_func, target_val, compare_op):
"""Encapsulates the repetitive comparison filtering ... |
d0f6e468044b86d5b3771f594736eec86b3e1bb64247cf317ed3a44ec7ea33a4 | Python | 4,077 | 122 | #!/usr/bin/env python2.7
from __future__ import print_function
import argparse
from pddlstream.retired.satisfaction import solve_pddlstream_satisfaction
from pddlstream.algorithms.satisfaction import constraint_satisfaction, dump_assignment
from pddlstream.language.generator import from_test, from_gen_fn, from_fn
fr... |
2e85bfdd680a5e6e524f207997792303854efdc40fd64b1486236f0511e6b619 | Python | 4,078 | 98 | import PoseTools
import socket
import numpy as np
import os
import imageio
import tensorflow as tf
from multiResData import int64_feature, float_feature, bytes_feature
import open_pose
def create_iterators():
from stephenHeadConfig import conf
if socket.gethostname() == 'mayankWS':
conf.cachedir = '/ho... |
5e292ab5f3d2bcebd3095d911cfca8a33cbede4ce0f5f08ba41b30295f1759db | Python | 4,079 | 64 | # 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... |
e089d3078653201b641857e5180bbc215f6ad0e494873f194d9f227cdcad5d27 | Python | 4,080 | 107 | import re
from collections import Counter, defaultdict
def test_coda_vowel(s):
s = ord(s[-1])
if s < 0xAC00 or s > 0xD7A3: return None
coda = (s - 0xAC00) % 28
if coda == 0:
return 3
if coda == 8:
return 2
if coda == 27:
return 1
return 0
def test_irregular_cand(s... |
27b3794f1db3a471026f63a0b3ab14629db643021d735c79f8b398d5422e9749 | Python | 4,081 | 121 | # Node group "Depth Difference Sample" (CompositorNodeTree), 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 ar... |
354f5ebc35d6ae6f7a06842c88520cbfbdeb2b8cb4e713aa5b889248b0e34087 | Python | 4,081 | 172 | import pytest
from sleeplab_format.models import *
from sleeplab_format import writer
@pytest.fixture(scope='session')
def subject_ids():
return ['10001', '10002', '10003']
def subject_metadata(sid):
return {
'subject_id': sid,
'recording_start_ts': '2018-01-01T23:10:04',
'lights_of... |
675fc967fd1a003958889bd30836b7e84b4de71e3387adf2f068369b0f5df930 | Python | 4,081 | 55 | """FIG_PHASE_MAP.py 2026-09-30. Report figure F13 from PHASE_MAP rows (antennal-lobe cut-outs of Shiu et al.'s v783 file and
of BANC): (a) healthy share of random sign sets against the excitatory share, for three strengths of the excitatory
local-neuron synapses; (b) the line s* against that strength, with the fitted b... |
d38e3992996f3205abb862b499c6e72fd5965f311a3ea6b72a86de6dc47064c1 | Python | 4,081 | 124 | # Copyright (C) 2024 by mao jiashun and wang jianming
# Copying and distribution is allowed under AGPLv3 license
import os
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence
from torch.autograd import Variable
import numpy as np
import pandas as pd
import sys
sys.path.append(r'/home... |
d626b73a8d004c7f79ab45c8733325aef8afa274d5465f374854ffbe6f0f0357 | Python | 4,082 | 102 | """Module to extract contineous data-driven descriptors for a file of SMILES."""
import os
import sys
import argparse
import pandas as pd
import tensorflow as tf
from cddd.inference import InferenceModel
from cddd.preprocessing import preprocess_smiles
from cddd.hyperparameters import DEFAULT_DATA_DIR
_default_model_di... |
e7b008e48be8dadfeec13a2e3ec5ebf2ecdb964119413b912ef63639e83d386d | Python | 4,083 | 69 | """MEANFIELD.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30o-MEANFIELD.md
A noiseless firing-rate reduction of Shiu et al.'s LIF model (all constants from their model), run on the PHASE_MAP cut-outs.
Does it put the runaway line where the spiking model does? usage: python MEANFIELD.py"""
import sys, os, ... |
c7454baa2ed7e71406275f4232f29e2b4d4a9034cc9cc3d724e65839f62beea1 | Python | 4,084 | 128 | '''Simplified version of DLA in PyTorch.
Note this implementation is not identical to the original paper version.
But it seems works fine.
See dla.py for the original paper version.
Reference:
Deep Layer Aggregation. https://arxiv.org/abs/1707.06484
'''
import torch
import torch.nn as nn
import torch.nn.function... |
e2d469493d3661bab27d924e28bbfe186edc95b0a9a4f48e880f35d3bf249983 | Python | 4,084 | 113 | # 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... |
c4a5dc29533311c21430da7ddf6bda787dca2a95f451ec23dd64e188d6bd8f3d | Python | 4,085 | 105 | # coding=utf-8
# Copyright 2020 Mesh TensorFlow authors, T5 Authors and 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://www.apache.org/licenses/LICENSE-2... |
157d02ff472cd0c3b5e7d4b4ca57d6327c94ee773e5cb40ea21da0cde99f0ec3 | Python | 4,086 | 115 | # 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... |
64f95227604da3214ec693a70cbcd6540f5c94e5d88352823f6c046044ce4eac | Python | 4,086 | 128 | # 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... |
918acec51ce6b31ac344ede74fe0ea06e879e70e6cbd3afec60286088a172174 | Python | 4,086 | 135 | import argparse
import os
import os.path as osp
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# def tabularize_languages(mem_data, reg_data, human_data, epoch=100, participant_id=None):
# pass
#
#
# def visualize_languages(mem_data, reg_data, epoch=100, participant_id=None):
# mem_da... |
b1ea8534f83718e5d75a7a751279562ddb05ef6be61f5c97e998f04ae5ee5566 | Python | 4,086 | 150 | from abc import abstractmethod
from collections.abc import Mapping
from typing import Protocol, Self, TypeVar, overload, runtime_checkable
from ._attribute import AttributeMapping
from .graph import Graph, ReadOnlyGraph
@runtime_checkable
class Node(Protocol):
@property
@abstractmethod
def attributes(sel... |
4f5f903a292f42eaa3d21a2135452f878f8f3d90e46ef927366f4e09bfa97c82 | Python | 4,087 | 146 |
"""
MoCHI transormation module
"""
import math
import torch
import numpy as np
def get_transformation(
name,
custom = {}):
"""
Get a transformation function by name.
:param name: transformation function name (required).
:param custom: dictionary of custom transformations where keys are funct... |
73957408ae2a289d62d653c1a30ffff836853a4cf6795c3bff4fb61258de0c3c | Python | 4,087 | 151 | from contextlib import ExitStack
import cocotb as ctb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
from cocotb.types import LogicArray, Range
from elasticai.creator.file_generation.resource_utils import get_file_from_package
from elasticai.creator.testing import eai_testbench
p... |
07bd9e1faf5db9327b810d91ac04b7e459330067b25d799c611f1b98c01c7d86 | Python | 4,088 | 149 | ################
# Dependencies #
################
import scanpy as sc
import scanpy.external as sce
import anndata as ad
import pandas as pd
import decoupler as dc
import gc as py_gc
##############################
# Science dataset Processing #
##############################
# Data reading
input_file = "SLE/data/Sci... |
72621667812deb8caa789d400516d27f1d52baa9dd95c1bb70cce96253162a10 | Python | 4,090 | 114 | import numpy as np
import random
import torch
import sys, os
sys.path.append(os.path.abspath("."))
def createModelData_T(rules, num_examples, num_inputs, num_outputs):
inputs = np.random.uniform(
size=(num_examples, num_inputs), low=-4, high=4
) # random inputs
outputs = np.zeros(shape=(num_exam... |
7423e9a6e50ff7ee77bfbac1431e730c3a32cab277ef4b8789763bb772a15f1e | Python | 4,091 | 110 | # -*- coding: utf-8 -*-
from collections import defaultdict
import logging
from matplotlib import ticker
from downward.reports.scatter import ScatterPlotReport
from downward.reports.plot import PlotReport, Matplotlib, MatplotlibPlot
# TODO: handle outliers
# TODO: this is mostly copied from ScatterMatplotlib (sca... |
b316ebb2835913dbe1820545c88f8c70b72e826bfd975321aa54e262512d6319 | Python | 4,091 | 132 | #! /usr/bin/python3
#
# Copyright (c) 2019 Warren J. Jasper <wjasper@ncsu.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) a... |
a43869736fabecd786e3b816f9c00224fc636caba11ccf243db1140b8c371f17 | Python | 4,092 | 107 | """The Dice/Hausdorff foreground masker in registration metrics.
Dice used to threshold the 5th percentile of nonzero voxels. That assumes
background is exactly zero, which holds for an atlas template and fails for
real imaging data: on a registered TissueCyte volume 97.5% of voxels are
nonzero, so the mask claim... |
c35de1ac84d6230cafc04bca660fd98cbf41bd4e1404399bd0256bc5cd4bcef2 | Python | 4,092 | 154 | """Core recipes for Gaussian."""
from __future__ import annotations
from typing import TYPE_CHECKING
import psutil
from quacc import Remove, job
from quacc.recipes.gaussian._base import _LABEL, run_and_summarize
if TYPE_CHECKING:
from typing import Any
from ase.atoms import Atoms
from quacc.types imp... |
5d66f39e6733ae981f4c901da1f00db309c75282305506d4ea87501e23e7e6da | Python | 4,093 | 140 | # Node-group asset "Primitive Arrow" (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_CHECKI... |
10a8482a48b01e7cae3086fafcbbc11d3899c13c0b16c170547f0c5465d8a228 | Python | 4,094 | 105 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
import numpy as np
from setting import *
# Arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-n", "--name", type=str, help="Dataset name")
argParser.add_argume... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.