sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
68bb1d0644e94b09fc45c2db4397185adf640039bcc08faa556d2075173397ff | Python | 1,691 | 60 | import numpy as np
from hippo.free_energy import expected_free_energy
class TreeNode:
def __init__(self, action, data):
self.action = action
self.data = data
def actions(self, transition, filter_actions=True):
actions = set(np.arange(transition.shape[0]))
# Do not turn left ... |
7c2bde68cdf58d78a0921840ecdcfeed7242fd616e85ff9ac8e0e24071308d49 | Python | 1,692 | 80 | """To see the steady-state activation/inactivation variables and time constants in EGL19"""
import numpy as np
import math
import matplotlib.pyplot as plt
import os
group_name = 'cell2018'
x = np.arange(-90, 90, 0.1)
vhm = 5.9
vhh = -50.6
ka = 7.5
ki = 12.0
vhhb = -20.5
kib = 8.1
ahinf = 1.43
bhinf = 0.14
chinf = 5.9... |
c2f39cf336f125617e1764a9b2503848b1ccaac5a5d9a4acfb1f694c481f246b | Python | 1,692 | 37 | from torch.utils.data import DataLoader
from datasets.dataset import MyDataset
from torch.utils.data.distributed import DistributedSampler
from datasets.preprossing import *
import os
def get_dataloader(args):
src_lang = SrcLang(args.vocab_src_path)
tgt_lang = TgtLang(args.vocab_tgt_path)
train_data_path... |
ec3d7ce25a9e109ffa0f1f451ad1c1db73ee9f2a49f9a818b5d49acf618307a0 | Python | 1,692 | 38 | from simclr import SimCLR
import yaml
from data_aug.dataset_wrapper import DataSetWrapper
import os, glob
import pandas as pd
import argparse
def generate_csv(args):
if args.level=='high' and args.multiscale==1:
path_temp = os.path.join('..', 'WSI', args.dataset, 'pyramid', '*', '*', '*', '*.jpeg')
... |
07f0033361ffd2a017c07e32ac1a0c845f38277438372f595fad693e13f9458c | Python | 1,693 | 67 | import unittest
from parameterized import parameterized
from tests.utils import Utils
from HyDGL.graph_element import GraphElement
class TestGraphGeneratorSettings(unittest.TestCase):
@parameterized.expand([
[
GraphElement(
features={
'feature_0': 0,
... |
1da3279741516359745d6214ce04de5cf732e0e90ac998758ab6a80c4fc1ba1d | Python | 1,693 | 74 | from __future__ import annotations
import json
from dataclasses import asdict, is_dataclass
from pathlib import Path
from typing import Any
try:
import numpy as np
except Exception:
np = None
def _jsonable(value: Any) -> Any:
"""
Recursively convert common MorphoGlia values into JSON-safe objects.
... |
2b7db82912b932b876c69511e0426ab2ffbf9625b2654d4e78f17e7bd3223f75 | Python | 1,693 | 18 | """posthoc_convention_ei_2026-09-30.py (POST HOC, descriptive). CONVENTION_AUDIT's one miss (Shiu's convention with
uncalled cells unsigned: share 0.221, yet runaway): the balance law of PHASE_MAP is about excitatory against INHIBITORY
output, and unsigned cells are neither. Excitatory / inhibitory local-neuron output ... |
53abe856c4f2d872fc70d1375b323e4eae9ec0818aa042b5e184a08876869bf1 | Python | 1,693 | 51 | # 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... |
cef312a02737255afb49fb03326e9d8405b37e94324001226b08fa9f8ced6a0e | Python | 1,693 | 51 | import os
from torch.utils import data as torch_data
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.SubcellularLocalization")
@utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",))
class SubcellularLocalization(data.ProteinDataset):
"""
... |
f974a75fdc4e603960e69e0d5edec9079cfcee3220da6dc1d141b8b73ac3e1a3 | Python | 1,693 | 46 | """
Here we add to collected_results.csv new columns that:
a) normalize the overhang depth dnorm=d/2 and height hnorm=h/0.5
b) represent the ratios d/h, h/d (taking care not to divide by zero!)
c) represent sine and cosine of the overhang view angle towards the sky:
d/sqrt(d^2+h^2) and h/sqrt(d^2+h^2)
d) add the are... |
05da7a3e2d8a81514a0e65d0cbd3ac9b471154896e3e23f166df99cd1da753b3 | Python | 1,695 | 48 | import pandas as pd
import numpy as np
from tqdm import tqdm
import h5py
df = pd.read_csv('train_sequences.txt', delimiter = "\t", header=None)
df.head()
df.columns = ['sequences', 'expression']
df['sequences'] = df['sequences'].astype('str')
df['expression'] = df['expression'].astype('float')
mask = (df['sequences'].... |
a5e6d59de75429fb03489139fe4b002239f313340fd609d70680a1eb753ca8eb | Python | 1,695 | 44 | import os.path
from ckg.graphdb_builder import mapping as mp, builder_utils
############################################
# The Drug Gene Interaction Database #
############################################
def parser(databases_directory, download=True):
config = builder_utils.get_config(config_name="drugGeneI... |
502c75bf1fe876cbf6368d5a311f8e0d2adbc35d412fbc4ca6c4d525b0c6ff06 | Python | 1,696 | 58 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utility functions
Created on Thu Jun 13 2019
@author: jmagraner
"""
# %%
import autograd.numpy as np
### Orthogonalise output matrix ###
def apply_orth_transform(params,specs):
# NOTE: more careful implementation needed!
# This implementation does not support... |
700c8599f6ab487024d2f705309a6cd1c7df610725e73426aaec20ff01080c44 | Python | 1,696 | 51 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite = suites.suite_optimal_with_ipc11()
configs = {
IssueConfig('astar-cegar-original-100... |
7f151961688cc9c90294731479f9fe8e8a4e082140aef7829f47c6800f18f69a | Python | 1,696 | 44 | from elasticai.creator.arithmetic import FxpConverter, FxpParams
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.code_generation.addressable import calculate_address_width
cl... |
27f009d7178f3446c3f67a078ab0a077dcf5486469c38aff8040b38bb5fdc358 | Python | 1,697 | 51 | # Copyright (c) 2023 Se42 Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/why-not-lgpl.html
#
# Unless required by applicab... |
6c045ecad54cc2733e85b7150fc384831f0061879a6e32a13f442b2bce2dc40d | Python | 1,697 | 50 | from types import SimpleNamespace
from typing import cast
import torch
from torch import Tensor, tensor
from elasticai.creator.nn.binary.binary_quantization_function import Binarize
from tests.tensor_test_case import TensorTestCase
def binarize(x: Tensor) -> Tensor:
return cast(Tensor, Binarize.apply(x))
clas... |
db06795be53a4ee7490f5fcd2d4c237253296e898533dd6536fd75ffad2c7c66 | Python | 1,697 | 70 | """
pygments.console
~~~~~~~~~~~~~~~~
Format colored console output.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
esc = "\x1b["
codes = {}
codes[""] = ""
codes["reset"] = esc + "39;49;00m"
codes["bold"] = esc + "01m"
codes["faint... |
a3ca06abb34f1977f41d30394842e8c6fb34757ac678105f3754006e0d9720d1 | Python | 1,698 | 62 | import os
import numpy as np
from pathlib import Path
from torch.utils.data import Dataset
from torchvision import datasets
from torchvision import transforms
from PIL import Image
from segm.data import utils
from segm.config import dataset_dir
class ImagenetDataset(Dataset):
def __init__(
self,
... |
25506844067bbd243b5c8cfcc44d98e6144d247af120948899a7c67f5f2a6132 | Python | 1,699 | 51 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite = suites.suite_optimal_with_ipc11()
configs = {
IssueConfig('astar-cegar-original-100... |
6f5e593d4a8ec7407dbe858dfac56b252387341e49b5757407fe81ca53debca7 | Python | 1,699 | 40 | import time
from utils import *
def validate(args, val_loader, model, tgt_lang):
batch_time = AverageMeter('Time', ':5.3f')
acc_ans = AverageMeter('Ans_Acc', ':5.4f')
acc_eq = AverageMeter('Eq_Acc', ':5.4f')
progress = ProgressMeter(len(val_loader), [batch_time, acc_ans, acc_eq], args, prefix='Tes... |
85ee5240a19258ddeceb2fe158c670feee096dbd8592c2766aa6fd8a9eac0d29 | Python | 1,699 | 62 | from yacs.config import CfgNode as CN
import SimpleITK as sitk
# copied from Jack's branch (thanks man :P)
# config definition
_C = CN()
# system
_C.SYSTEM = CN()
# filter
_C.FILTER = CN()
# thresholding, denoising and masking params
_C.FILTER.FILTER_STRENGTH = 70
_C.FILTER.THRESH_LOWER = 60
_C.FILTER.THRESH_UPPER ... |
9acd999974c406d396fb226affbbd2e3c145b1544ff391b1f64de36cfd097cf8 | Python | 1,699 | 67 | # built-in
from math import isclose
# external
import hypothesis
import pytest
# project
import textdistance
ALGS = (
textdistance.arith_ncd,
textdistance.bwtrle_ncd,
textdistance.bz2_ncd,
# too slow, makes CI flaky
# textdistance.lzma_ncd,
textdistance.rle_ncd,
textdistance.zlib_ncd,
... |
66f2b9bfb14a8fe43cda1d0e6e52ecb4a26aa592cf788d59a76b4aab20a02a29 | Python | 1,700 | 58 | '''
If you want to test the validity of pip installation, please move this file outside of the git project directory,
otherwise it is testing the files inside the project instead of pip installation.
'''
import torch
'''
test the operators
'''
from acsconv.operators import ACSConv, SoftACSConv
B, C_in, D, H, W = (... |
e1dd7ddb618504f9bdd96717539368b1a517cba282cd7591f717902a29ff733c | Python | 1,700 | 50 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites, configs
from downward.reports.compare import CompareConfigsReport
import common_setup
REVISIONS = ["issue462-base", "issue462-v1"]
exp = common_setup.IssueExperiment(
search_revisions=REVISIONS,
configs=configs.default_configs_satis... |
ab5143c6f0f859c585f4346881a161770a603f64e9d6668feb6356b63928a84a | Python | 1,701 | 81 | import pickle
import os
import numpy as np
# Utility functions
def save_var(var, file_path):
'''
save_var saves a var to a specified filePath
INPUT:
var: the variable to be saved
file_path: the filepath you want to save the var, for example data/.../var.pckl. If the path does not exist, it c... |
ddeeb814e8f2ce884a6719da5fa9cda0f32ee89da6a51be216d4dfcb7bcdafa8 | Python | 1,701 | 56 | from botorch.settings import validate_input_scaling
import optuna
def objective(trial):
# Binh and Korn function with constraints.
x = trial.suggest_float("x", -15, 30)
y = trial.suggest_float("y", -15, 30)
# Constraints which are considered feasible if less than or equal to zero.
# The feasible ... |
1222db4e2f4aba39b86356937fbbf85b6c6e1b03f2accd301555a22bb34279c8 | Python | 1,702 | 44 | import os
import unittest
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.model import retrieve_model
import tensorflow as tf
class TestRetrieveModel(unittest.TestCase):
def setUp(self):
self.path = ".model_test_model"
origin = os.path.dirname(os.... |
0612571b506f2164f2564188932861bd6a3556277608a30dfdf30f7911027218 | Python | 1,703 | 50 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 16:47:56 2022
@author: haotian
"""
import h5py
import os
import numpy as np
from collections import defaultdict
from matplotlib import pyplot as plt
from tqdm import tqdm
def seq2kmer(seq:str,k:int = 5):
return [seq[x:x+k] for x,_ in enumer... |
11554ebaf1ada0f11d162f1236799daa5090ae10b157e909b1dc2d75c0a75c64 | Python | 1,703 | 59 | import hashlib
import logging
import sys
from optparse import Values
from typing import List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
from pip._internal.utils.misc import read_chunks,... |
6fb6c086af93f1854fd828233a78259f39c3aa3e514fe3b70c049a84d389558d | Python | 1,703 | 47 | import torch
from diff_frech_mean.frechetmean.backward import frechet_ball_backward, frechet_hyperboloid_backward
from diff_frech_mean.frechetmean.forward import frechet_ball_forward, frechet_hyperboloid_forward
from diff_frech_mean.frechetmean.manifolds import Lorentz, Poincare, get_manifold_id
from diff_frech_mean.... |
8baaf3104d541db5f2d250dbc26499be921f8545b4f9226d01b26719b9252b1e | Python | 1,703 | 56 | """Plot timelocked features."""
from __future__ import annotations
from pathlib import Path
from typing import Annotated
import matplotlib.pyplot as plt
import mne
import mne_bids
import pte
from pytask import Product
import motor_intention.plotting_settings
import motor_intention.project_constants as constants
PLO... |
dbd10b0a17b147cf833d4db19ee254d04fe0bb61a3c4741bae2e5feb67abb80e | Python | 1,703 | 53 | import os
from pathlib import Path
import tarfile
import requests
import numpy as np
from scipy import sparse
import pandas as pd
from nilearn import input_data
def get_neuroquery_data_dir():
default_dir = Path(os.environ.get("HOME", "."), "neuroquery_data")
data_dir = os.environ.get("NEUROQUERY_DATA_DIR", d... |
fb721797ee829eeb957b9652602ccbf7fb0647ce381eb6a9c4717cf2d3e1d50b | Python | 1,703 | 53 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DI... |
31c4a7ec4723842d319320ea41e688effe68230616048a760383fb26b62cf9d9 | Python | 1,704 | 55 | # 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... |
76b71434adf732238cbd0b45d998a3056aeabe5e0ea40fe31c28b9ed12bd4750 | Python | 1,704 | 58 | # Node group "Ray Tangent" (ShaderNodeTree), 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 regenerated fr... |
a8aa2958ede5085034eef7e0682a61ec00d88111709c69bb8f6d652896f7e564 | Python | 1,704 | 40 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue648-base", "issue648-v1"]
SUITE=suites.suite_optimal_strips()
SUITE.extend(suites.suite_ipc14_opt_strips())
CONFIGS = [
# Test label reduction, shrink_bucket_based (via... |
9850f0d1abd26d559415ed5b8f3bac9aa1e7f02c17029ed77411e03b0016df6b | Python | 1,705 | 44 | import os.path
import re
from ckg.graphdb_builder import builder_utils
############################
# IntAct - MutationDs #
############################
def parser(databases_directory, download=True):
relationships = set()
config = builder_utils.get_config(config_name="mutationDsConfig.yml", data_type='da... |
b3c92433c1e677f6a787a219db7e6c2fad1b4adb04cfdd2892438428c18aff31 | Python | 1,705 | 52 | from __future__ import annotations
import os
import shutil
import tempfile
import uuid
import optuna
from optuna.trial import TrialState
from optuna_dashboard.artifact.file_system import FileSystemBackend
from optuna_dashboard.streamlit import render_objective_form_widgets
from optuna_dashboard.streamlit import rende... |
b56f4160a07415dff5a0e27248af8f3d776fc5059b109e26033e46f0ecdcc289 | Python | 1,705 | 44 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2020 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at you... |
b622bb913321e11ceb8153f8a69437edc0b542ba466920bfdcda7f803d9ef98d | Python | 1,705 | 42 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'dgn_preproc_frmv.ui'
##
## Created by: Qt User Interface Compiler version 6.8.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##... |
e38e07584cb7f38d058ee6b08b0fa3a678a9b3eec51ae4d2ec5b6c429df9b69c | Python | 1,705 | 39 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Found... |
b261a236e47dc9693f1d0e8d575223baa1ff05fa9fd56f23e95e0baeafe20c96 | Python | 1,706 | 55 | #!/usr/bin/env python3.6
import sys
from os.path import expanduser
sys.path.append(expanduser("~")+'/src.git/visualife/src')
from core.SvgViewport import SvgViewport
from core.Plot import Plot
from core.styles import ColorRGB, color_by_name
BOX_SIZE = 10 # size of every square used to represent a hydrogen bond on a ... |
215cbafe0b5ba56937722810f8e76b1ac3547d7d1b711160796528ac7354f8da | Python | 1,707 | 46 | import numpy as np
from scipy.spatial.distance import *
import bct
from struct_consensus import struct_consensus
import os
from utils import make_dir
direc = os.path.abspath('../../data/preprocessed_data/')
scaling_path = os.path.join(direc, 'scaling_analysis')
make_dir(scaling_path)
resolutions = ['060', '125', '2... |
485f587d3448ad7164a40a8a11aa4608c735a93dbb5d0cae19f2577fdf7b7b0e | Python | 1,707 | 49 | # ----------------------------------------------------------------------
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... |
9a1da71d4bfc558702411457de64a4e7b3422435a325d7542fdee8ea2db12f41 | Python | 1,707 | 51 | """Create a reproducible train/val/test split.
python -m src.split --data-dir data --seed 42
"""
import argparse
import json
import random
from pathlib import Path
from .data import list_pairs
def make_split(data_dir, seed=42, test_frac=0.2, val_frac=0.3):
"""Split image filenames into test / train / val.
... |
a1ab321d61e1a33386ba5b377f035d6b09a03a46f48cba498a6ea5f7d62ad291 | Python | 1,707 | 63 | import numpy as np
from sklearn.metrics import roc_auc_score, recall_score
def ic_roc_auc(preds, trues, locs, drugs):
locs = locs.astype(bytes)
t = []
for l in np.unique(locs):
sub = locs == l
if len(np.unique(trues[sub])) > 1:
t.append(roc_auc_score(trues[sub], preds[sub]))
... |
d0b1ac7ecc4124ba851f006427b8995331d6d965bc004d3ce88e21aaf8ba3e3e | Python | 1,707 | 58 | """
Depth DataManager
"""
from dataclasses import dataclass, field
from typing import Dict, Literal, Tuple, Type, Union
import torch
from nerfstudio.cameras.rays import RayBundle
from nerfstudio.data.datamanagers.base_datamanager import (
VanillaDataManager,
VanillaDataManagerConfig,
)
@dataclass
class Dep... |
0407acbefe72744d670c16473df9a22cf3fd0990cc074b9e553a14a03035dff2 | Python | 1,708 | 53 | # -*- coding: utf-8 -*-
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 3
_version_minor = 1
_version_micro = 1
_version_extra = ''
# Construct full version string from these.
_ver = [_version_major, _version_minor, _version_micro]
if _version_extra:
_ver.append(_vers... |
0ca8ac89184787cf004dd732dd6c5c4d70dbd39ae7030d3b78c1869005f59e2f | Python | 1,709 | 45 | """
Simple test for parameters.
"""
import unittest
import numpy as np
import sympy as sp
from neurolib.models.multimodel.builder.base.params import (
count_float_params,
float_params_to_individual_symbolic,
float_params_to_vector_symbolic,
)
class TestSymbolicParams(unittest.TestCase):
def test_cou... |
ecb2e3cccae8103fe4f3bcc706ffeb576bbde14a317dffee27bb1ed7f62a5d19 | Python | 1,709 | 43 | from segmentation import segment_electrodes, electrode, point_of_electrode, representative, probe, load_probes
import argparse
import numpy as np
import pickle
def rename_probes(probe_locs_file, probe_names, probe_file):
probe_locs = np.loadtxt(f'{probe_locs_file}')
if np.shape(probe_locs)[0] != np.shape(pro... |
0569f029f02b2b0387bacca3d9e591eadc64db2f5293a67c2b7b22f48c6d9f97 | Python | 1,710 | 55 | import pytest
import torch
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn import Sequential
class SimpleSigmoid(torch.nn.Module):
def __init__(
self,
total_width: int,
frac_width: int,
num_steps: i... |
19668b7ee729aee9ee52cbf289c0b9513aed86c5edf6bc74bb7118b1c6fd67da | Python | 1,710 | 56 | from __future__ import print_function,division
import os
import numpy as np
import pandas as pd
def parse_args():
import argparse
parser = argparse.ArgumentParser('Script for splitting coordinates table and image list into train and test sets')
parser.add_argument('--images')
parser.add_argument('-... |
81750ad18fe43c9b1cf5924bd4674f0ec6d5bae43b6865bf9053dcc9ad79ed91 | Python | 1,710 | 52 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_D... |
6e2dbd1565061d583bb0269915ba9034aabd8e7684b887d2bf92c84448ba00b1 | Python | 1,711 | 38 | # 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... |
bcfcbd5b54f45aa70ffde70d8bca823b28b38c6c59ec58e99da8ec40c5c8c379 | Python | 1,711 | 56 | from __future__ import annotations
import pytest
ct = pytest.importorskip("covalent")
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 # skipcq: PYL-C0412
@pytest.mark.parametrize("job_decorators", [None, {"... |
c25be92e623646362cf2111c82b6493e88eb81d781896209ab23c8bc2ac4cef4 | Python | 1,711 | 54 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
e098c60e9c4cc89e6914e0ab73373e13aa4d78aedae988cf8f13b03d72afd9b7 | Python | 1,711 | 45 | import os
import numpy as np
from cmdstanpy import CmdStanModel
from datetime import datetime
"""
this file serially runs the stan model for each mouse and saves the betas,
if you have a computing cluster I recommend parallelizing this process across mice
by submitting a job for each mouse using SLURM
"""
data_path ... |
1fc3225a48704a910a1a97341000895e983b3a6f81fb7b60224324d2249bdaca | Python | 1,712 | 43 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import wx.adv
import os
import deeplabcut
... |
8259325a6b9911131de36ef98fafb3fefc5f14c4eb04811fbed4ce706bb681cf | Python | 1,712 | 67 | # Node-group asset "Edge Length" (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
f... |
399f6757ddccb0d9a9f61bd0aca74a556d85f4e18b80821abb2af732f76c07b6 | Python | 1,713 | 54 | """Plot timelocked features."""
from __future__ import annotations
from pathlib import Path
from typing import Annotated
import matplotlib.pyplot as plt
import mne
import mne_bids
import pte
from pytask import Product
import motor_intention.plotting_settings
import motor_intention.project_constants as constants
PLO... |
ce6d008cf717075550ff7fdd3438a4ec024c18be73d568cbd72aa1ead2ccf900 | Python | 1,713 | 54 | ################################################################################
# Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md
#
# All rights reserved.... |
d0eb8f992b24530547b0f8aaed5cadcc8f21955c6481d1fc3391eda33d2102c3 | Python | 1,713 | 56 | """Testing module io."""
import json
import numpy as np
import pytest
from treem.io import TreemEncoder, load_swc, save_swc
class MyObject:
def __init__(self, value):
self.value = value
def test_io_encoder_success():
"""Tests JSON encoder for successful serialization."""
data = [[1, 2, 3], np.... |
2a0de1d256aa051a8717374486b475c2658a01e72180917a2308b728a1c4bf41 | Python | 1,714 | 46 | from memory_profiler import memory_usage
import os
def some_func(*args, **kwargs):
return args, kwargs
def test_memory_usage():
# Check that memory_usage works with functions with star args.
mem, ret = memory_usage((some_func, (1, 2), dict(a=1)), retval=True)
assert ret[0] == (1, 2)
assert ret[1... |
7a0fe1c9bbee19ce424ba27e177cf336cd28f9ebc8c2bf22ec08622325db5638 | Python | 1,714 | 65 | from compute_opt import *
import nibabel as nib
import glob
import os
from nilearn.image import clean_img
from nilearn.masking import compute_brain_mask, apply_mask
from collections import defaultdict
class BehavPLS():
def __init__(self, X, Y, nb_sub, nPerms= 100, nBoot=100, seed=1, seuil=0.05,verbose=True, **kwa... |
08ee6e26a5b56b34b0e68ee354d0fd4ffcc111402240fc25f96bbc6bd1155640 | Python | 1,715 | 49 | # This script runs the pipeline on single tomograms
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"
# Here you can choose which GPU to use
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import cryovesnet
dataset_directory = "/media/amin/mtwo/Handpicked/116"
pl2 = cryovesnet.Pipeline(dataset_directory,pattern='*.rec.nad')
... |
a60fbfbac1e1c9265bedd7f1e6e37eb054256ca31e8ab5eda173a1b725ee5806 | Python | 1,715 | 55 | from abc import abstractmethod
import multiprocessing
import threading
from typing import Callable
from merlin.core import analysistask
class Executor(object):
def __init__(self):
super().__init__()
@abstractmethod
def run(self, task: analysistask.AnalysisTask, index: int=None,
... |
3350d4d4989f5f93ec5eb58e51dafbaff45ffb4d1389963c052b382352e6ba2c | Python | 1,716 | 63 | # 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... |
59790ced6e206fd08da1e91ae29a874b6cf4099a98aeb639676e1ca034122795 | Python | 1,717 | 59 | # -*- coding: utf-8 -*-
#
# Constant definitions used throughout SyNCoPy
#
# Builtin/3rd party package imports
import numpy as np
from scipy.signal import windows
# Module-wide output specs
spectralDTypes = {
"pow": np.float32,
"abs": np.float32,
"real": np.float32,
"imag": np.float32,
"angle": n... |
2a1114eaa6ee0070ddce2b6ea2bf890cc56d86162d0f13687305c07e49db5591 | Python | 1,718 | 60 | import numpy as np
def cleaning(matrix, index):
if index==1:
rows = 1
prev_mean =0
columns_tocut = 0
mean_all = np.mean(matrix[rows,:])
dev_all = np.std(matrix[rows,:])
for columns in range(0,50, 10):
local_mean = np.mean(matrix[rows,columns:columns+10])
... |
711735168b61a10ba7183e72085c9ed441472ee9b61a4fea1eda4e9b662102c8 | Python | 1,718 | 44 | import time
from utils import *
def train(args, epoch, train_loader, model, criterion, optimizer):
batch_time = AverageMeter('Time', ':5.3f')
data_time = AverageMeter('Data', ':5.3f')
losses = AverageMeter('Loss', ':.4e')
progress = ProgressMeter(len(train_loader), [batch_time, data_time, losses],
... |
81bcdb02be5172b6fb1d232ff8fae2b2b4628bfd96aa97ac38ea37c0fbc16a17 | Python | 1,718 | 41 | import anndata as ad
import numpy as np
import pandas as pd
import pytest
from scipy import sparse
NUM_CELLS_PER_GROUP = 10
NUM_NOT_DE = 10
NUM_DE = 10
@pytest.fixture
def adata():
"""Synthetic screen with NT controls and a target gene split into non-perturbed and knocked-out cells."""
rng = np.random.defaul... |
8b319621d85d20d995e71f5f6653c97f59e3553c3cfdc72cc23362e9feb3034f | Python | 1,718 | 43 | # Written by Minh Nguyen and CBIG under MIT license:
# https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
import unittest
import numpy as np
import cbig.Nguyen2020.dataloader as dataloader
class DataloaderTest(unittest.TestCase):
""" Unit tests for different filling strategies """
def setUp(self):
... |
b1994a493f042d955cd0bc29f31fae3cf297fd6dd137b40070324e027cb67745 | Python | 1,718 | 67 | # Node-group asset "Rotation RELION" (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... |
f7b710deb5a9b970ec2672736f6f2005badf4f7223b64572b63b559fa4ee7ef7 | Python | 1,718 | 63 | """CCF Boundary Editor - pull CCF region-boundary contours to correct
registration misalignment, then re-quantify against the modified annotation.
"""
from .contour_edit import (
ContourComponent,
SliceEditState,
apply_slice_edits,
build_components,
)
from .io import build_modified_annotation... |
3e61a31845acff14a3c099db7e236bd33b06c10c95fa3654109acb9e991f9365 | Python | 1,719 | 53 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite = suites.suite_optimal_with_ipc11()
configs = {
... |
52978a6af04eb10b4bc0bb71f550e3b7efb9a7182ce904c1ec4435842e3ba695 | Python | 1,719 | 45 | import numpy as np
def dilate_2d_indices(rr, cc, shape):
if len(rr) != len(cc):
raise RuntimeError('indices should have the same length')
n_pixels = len(rr)
rr_dilate = np.array([0, ] * (n_pixels * 3 ** 2))
cc_dilate = np.copy(rr_dilate)
offset = 0
try:
for dy in (-1, 0, 1):
... |
5a29fe10830b11c7e45fd71616d638aa24bee1b84f3153591b5624778b855296 | Python | 1,719 | 51 | # -*- coding: utf-8 -*-
''' Script to submit to cluster the ICA script'''
import os
from sys import path
from stormdb.access import Query
from stormdb.cluster import ClusterBatch
from sys import argv
proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition'
os.environ['MINDLABPROJ']= proj_name
wd = "/projec... |
c0c89a7ac9de4f6c51b3e8a4c3959ffad9a495457275e3a5076a5000b2dccc5e | Python | 1,719 | 39 | from simclr import SimCLR
import yaml
from data_aug.dataset_wrapper import DataSetWrapper
import os, glob
import pandas as pd
import argparse
from torchsummary import summary
def generate_csv(args):
if args.level=='high' and args.multiscale==1:
path_temp = os.path.join('..', 'WSI', args.dataset, 'pyramid',... |
3bf0028de0c1f6fb07444352c93a0d0e8efb8ba23dbf0f23113ee7d5425b3ed4 | Python | 1,720 | 50 | import numpy as np
from skimage.filters import gabor_kernel
from scipy import ndimage
def genKernelBank(sigma_range, freq_range):
out_kernel_bank=[]
for i in range(4):
theta = i / 4. * np.pi
kernel_bank_per_theta = []
for sigma in sigma_range:
for freq in freq_range:
... |
ba8f248ffe9a56c05844e53f3ee477078477bf945cec65f3eb7b28265cbd5f75 | Python | 1,720 | 43 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : mRMR_fsel.py
# Author : Yufeng Liu
# Date : 2023-02-11
# Description :
#
#=====================... |
01d46dd3dc35d1fa7b0245756c4ec139cf71b80632ad1c2828264e141589ba8c | Python | 1,721 | 59 | import pandas as pd
import numpy as np
import math
import torch
from scipy.io import loadmat
import pickle
from utilities.preproc_func import *
from utilities.Dataset import *
# class ScikitFeatSubsetDataset(torch.utils.data.Dataset):
#
# def __init__(self, X:np.array, y:np.array):
#
# self.X= X.astype(flo... |
469a747757d4b2675092a86d6cd2f9bf30270c1624803ddf70998a2426f4789a | Python | 1,721 | 56 | __version__ = "0.0.3"
import os
import tarfile
from pathlib import Path
path = Path(os.path.dirname(__file__))
BiochemRoot = os.path.join(path, 'files', 'biochemistry')
rxns_file = "reactions.tsv"
ff = Path(os.path.join(BiochemRoot, rxns_file))
if not ff.is_file():
file = tarfile.open(os.path.join(Biochem... |
d7920dda0eaf061960a5c5fb4246f2205ab05677737ab1e2897dadb6f6253e16 | Python | 1,721 | 52 | """
Generate docs/reference/ files to disk.
This is roughly equivalent to what the `mkdocs-gen-files` plugin would have done.
"""
from __future__ import annotations
import tomllib
from pathlib import Path
from urllib.parse import urljoin
with Path("_zensical.toml").open("rb") as config_file:
config = tomllib.loa... |
51de3b096535a2f9a74b04ca93be4aec9b817106aa2c1fdefca12fcb41e820b3 | Python | 1,722 | 44 | import numpy as np
import os
import pandas as pd
from tabulate import tabulate
from constants import *
_CLASS_COLS = [f'class_item_{i + 1}' for i in range(N_ITEMS)]
_SCORE_COLS = [f'score_item_{i + 1}' for i in range(N_ITEMS)]
_Q_ACCURACY = 'accuracy'
_Q_ABS_ERR = 'absolute_error'
def main(res_dir):
predictions... |
bc76574f1e4ea62fb3d2228bf2add1e8dd56eb120c1dc21cb8b158d0b7966edc | Python | 1,722 | 53 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup_no_benchmarks import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite = suites.suite_satisficing_with_ipc11()
c... |
ad8838b43d2557a8e94e3a39bc31c40d9416b6deb2a50b4d272f212cd4c411ab | Python | 1,723 | 63 | import sys, math
from pybioshell.core.data.io import Pdb
from pybioshell.core.data.basic import Vec3
from pybioshell.std import vector_core_data_basic_Vec3
from pybioshell.core.calc.structural.transformations import *
from pybioshell.utils import LogManager
LogManager.INFO()
if len(sys.argv) < 2:
print("""
Cal... |
b2f9965c674fda8976b83ab2fa24f410fbef584f546339acb61ed1bcf05a9a99 | Python | 1,723 | 59 | # -*- coding: utf-8 -*-
#
# Auxiliary functions for querying things/people
#
__all__ = []
def user_yesno(msg, default=None):
"""
Docstring
"""
# Parse optional `default` answer
valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
if default is None:
suffix = " [y/n] ... |
f27011d105e16c24c2d88cfcba3b2426563152a85ba9885d6a26004d5515a8dc | Python | 1,723 | 54 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from downward.reports.scatter import ScatterPlotReport
import common_setup
from relativescatter import RelativeScatterPlotReport
SEARCH_REVS = ["issue547-base", "issue547-v2"]
SUITE = suites.suite_satisficing_with_ipc11()
CONFIGS = {
'l... |
52bf317fb6b78709def468e863f5f82bf6fbebb9e941b27c47239a21e48ae20f | Python | 1,724 | 57 | import logging
logger = logging.getLogger(__name__)
class HierarchicalAgent:
def __init__(self, model_pf, model_hippo, fe_threshold, name=""):
self.model_pf = model_pf
self.model_hippo = model_hippo
self.name = name
self.fe_threshold = fe_threshold
self.fe_sequence = []
... |
dae36999abd3ecaaf15299e9a0bb334740fbd33b87b2dda697196d9a1973fde4 | Python | 1,724 | 47 | # class from: https://github.com/tanjimin/C.Origami/blob/main/src/corigami/data/data_feature.py
# made for comparison with the c.origami to compare with HiC data
import numpy as np
class HiComparison():
def load(self, path = None):
self.hic = self.load_hic(path)
def get(self, chromosome, start, wind... |
7d640167898b14aeaa3947ed198e13cd0e2d493e1dfbc7a67acb254373580968 | Python | 1,725 | 48 | import argparse
import glob
import os
from PIL import Image
def main(args):
# For DF2K, we consider the following three scales,
# and the smallest image whose shortest edge is 400
scale_list = [0.75, 0.5, 1 / 3]
shortest_edge = 400
path_list = sorted(glob.glob(os.path.join(args.input, '*')))
... |
9189c80e044a9b7738362d9a6d1dc3e0ee7327ce4fe53d1ce5ec8e5d92cb1c96 | Python | 1,725 | 56 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DIR = o... |
aebd63bff5d3735e869ea8c743c8c8376c22cc7ee3b99846324394c1ff08f99d | Python | 1,725 | 54 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.spatial.distance import squareform, pdist
import seaborn as sns
def vectorized_correlation(x, y, reduction="mean"):
dim = 0
x = np.array(x)
y = np.array(y)
centered_x = x - x.mean(axis=dim, keepdims=True)
center... |
1ff077214dd9f5ba79b92530efd4407ae2d006f97b2e70a6883b2688d8cc0c36 | Python | 1,726 | 68 | import os
import pandas as pd
import json
from tkinter import filedialog, ttk
from tkinter import *
import logging
def read_tsv_from_df(fname):
df = pd.read_csv(fname, delimiter='\t')
return df
def write_tsv_from_df(fname, df):
df.to_csv(fname, sep='\t', index=False)
def read_json_to_dict(fname):
... |
588c9cac13e2185735a899803218b940c48f0eb022d19dacf98cba103ecc6550 | Python | 1,726 | 61 | """Base jobs for DFTB+"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.calculators.dftb import Dftb
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from typing import Any
from ... |
73e414b4182631c5332d606e374aa955f8bd22471a5e8c176f1fdbaad792835b | Python | 1,726 | 57 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DIR = o... |
e7d4aaad6b27cd3a550f5533f4a10de0a33619991e27fb55ba094424c06e7e10 | Python | 1,727 | 42 | # pylint: disable=line-too-long
""" A script for downloading a few fMRI datasets that were uploaded to github.
It will download a variant of ABIDE1 dataset (it is smaller than the one we used in our work)\
and COBRE dataset, both ready for experiments within this framework.
To use them in experiments, set ... |
3ac0e82e55b22d0319db45e7b0e53ef42b0ba8ae15ed0d558c3f14041bee12be | Python | 1,728 | 46 | from unittest import TestCase
from pyseg.vtk_ext import vtkAddAttributesAlgorithm
import vtk
__author__ = 'martinez'
class TestVtkAddAttributesAlgorithm(TestCase):
def test_Execute(self):
# Read reference
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName('../data/border.vtp')
... |
72723659f92d7884572cb46844e41eb8380fc0bc4d53ab1f30c8071c9390f44e | Python | 1,728 | 48 | import tensorflow as tf
import h5py
import pandas as pd
from pickle import load
import argparse
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("--model_path", help="path to saved model",
default="model/noisy_chardonnay_model.h5", type=Path)
parser.add_argument("--te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.