sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1a7166eba214be02e44f56ee6da355c39d423400d6e86dd9cb71060a6a2806f0
Python
651
31
# pylint: disable=too-many-function-args, invalid-name, unused-argument """ HCP MNI dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = "/data/users2/ppopov1/datasets/hcp_mni/...
7882adf80cabcb78a054c67bb0566fcd3fddcde72c2e2e9a87cd3fbbb4870e68
Python
651
17
from pytorch_image_classification.scheduler.combined_scheduler import ( CombinedScheduler, ) from pytorch_image_classification.scheduler.components import ( ConstantScheduler, ) class MultistepScheduler(CombinedScheduler): def __init__(self, steps, base_lr, gamma, milestones): lrs = [base_lr * gam...
e1fff5812a6e13fc1dd1766efe2ac30e1c33f978b9b1b5b38c88488b4fc97da2
Python
651
18
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.domains.regex.main import main, regex_options from dreamcoder.dreamcoder import commandlineArguments from dreamcoder.utilities import numberOfCPUs ...
e62ff436aba94d5017326b25e4a7eee326dc18bbee79b94a83c63ce0c34e8aab
Python
651
24
"""Headless check that the pixel-size field exists and flows to _get_params.""" import os import pytest os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") @pytest.fixture def tab(): pytest.importorskip("PySide6") from PySide6.QtWidgets import QApplication app = QApplication.instance() o...
8fb42c31e45012dd91ecdc43c6a6ea983b23430923243ae16cbd583bbc0bf51d
Python
652
18
import os from torch.utils.cpp_extension import load _src_path = os.path.dirname(os.path.abspath(__file__)) _backend = load(name='_hash_encoder', extra_cflags=['-O3'], # '-std=c++17' extra_cuda_cflags=[ '-O3', '-U__CUDA_NO_HALF_OPERATORS__', '-U_...
ca8c341000805bfa51bea471a94d5c467260f1601e12dcfbef93e8e785ac246f
Python
652
19
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.domains.list.main import main, list_options from dreamcoder.dreamcoder import commandlineArguments from dreamcoder.utilities import numberOfCPUs ...
620ecf5fdea8e66c5e532e03f003a4ab9cc58c955e34c110e21df83860d3e2ed
Python
653
27
from ..neuralnodes import params import dataclasses @dataclasses.dataclass class Params(params.Params): filter_inh_dur: float = 8.0 filter_inh_gain: float = 1.0 filter_delay: float = 7.0 filter_exc_dur: float = 4.0 filter_exc_gain: float = 0.1 def _make_bounds(self): self.bounds = {...
b642cef338a79f8b20adb9293356f558e64f8759438f553eac565cf60cd5fb1e
Python
653
31
""" Set of utilities for segmentation and analysis of n-dimensional images. # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import __version__ = "$Revision$" from . import util from . import core from . import grey from...
7fc3d3d4ac057188eea45101e848d47519cc5e8712f4d7da6a2b99a8babb079a
Python
654
17
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer import torch import torch._dynamo torch._dynamo.config.suppress_errors = True class nnUNetTrainer_DefaultLoss(nnUNetTrainer): def __init__(self, plans: dict, configuration: str, fold: int, dataset_json: dict, unpack_dataset: bool = True, ...
5e78cb7bc8c0c7ad71669fbffbc117915e8c793442664666bd691e7c0262ed04
Python
655
28
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue269-base", "issue269-v1"] LIMITS = {"search_time": 600} SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "random-successors": ["--search", "lazy_greedy(ff(),randomize_successors=true)"], "p...
7765ad2995153022642107c2c22e957916d0dfa6cc7435ced3090f55cc1e2959
Python
655
28
#!/bin/env python """ OXASL - Prefiltering module This is run before any model fitting and is intended for volume selection, denoising etc. Pre-filtering processes do not depend on the type of ASL data (e.g. multiphase, vessel-encoded) Copyright (c) 2008 University of Nottingham """ try: import oxasl_enable exce...
b823a1346df35d8e557ecec99431bea143b9e37fcfbe92c9a02dadd9de42d680
Python
655
28
import setuptools setuptools.setup( name="PyReliMRI", version="2.1.0", description="A package for computing reliability of fMRI images", packages=setuptools.find_packages(), install_requires=[ "numpy", "pandas", "pytest", "nilearn", "nibabel", "scipy"...
27348bcf0b156a384fdc66f8af09ca385f66de8d8fb8c634eadf77000a4f9ba9
Python
656
25
from typing import TypeVar from elasticai.creator.graph._types import NodeConstraintFn from .vf2 import Graph, find_all_matches, match TP = TypeVar("TP") T = TypeVar("T") class SubGraphMatchError(Exception): def __init__(self): super().__init__("No matching subgraph found") def find_subgraph( pat...
40cb61893911d5043737ffba62f8550989590087ff234e6c217daad1f2eeebdb
Python
656
17
from __future__ import annotations from wikibaseintegrator.models.language_values import LanguageValue, LanguageValues class Labels(LanguageValues): def from_json(self, json_data: dict[str, dict]) -> Labels: """ Create a new Labels object from a JSON/dict object. :param json_da...
d34e34ac77369fc1d83a765811f998caf9712417d5a146ee3ba147cd4ebabbe4
Python
656
26
from matplotlib import pyplot as plt from matplotlib import animation import seaborn as sns def animate_matrix_change(matrices, file_path='animation.gif', fps=60): """ Plot a list of equally shaped matrices as an animation. """ assert len(matrices) >= 2 fig = plt.figure() frames_qty = len(ma...
ee0d1b8b7525de672b7934b2d774de26182204a9e47964bcf438d88f4ce61191
Python
656
17
from __future__ import annotations from wikibaseintegrator.models.language_values import LanguageValue, LanguageValues class Lemmas(LanguageValues): def from_json(self, json_data: dict[str, dict]) -> Lemmas: """ Create a new Lemmas object from a JSON/dict object. :param json_da...
f5e2a655903d5421bbaf48ea1661aeba97412dee43f726e9514751bc54e34aa4
Python
656
25
### Submit script "XY.py" to HPC (Slurm) cluster import subprocess ## Configurable job parameters job_name = "create_is-distance_matrices_CONTROL_length" # Name of the job output_file = f"{job_name}.out" error_file = f"{job_name}.err" script_to_run = "create_is-distance_matrices_CONTROL_length.py" # Name of the script...
99500f31120613df2097a7974370b65a8faa3ce825f656c7f90fd8b1b2eea9e8
Python
657
21
from setuptools.command.setopt import edit_config, option_base class saveopts(option_base): """Save command-line options to a file""" description = "save supplied options to setup.cfg or other config file" def run(self): dist = self.distribution settings = {} for cmd in dist.com...
81739f72124776983fb7c1f8f650e3fcf82ed3217444f08bbd983d8e982f4ddf
Python
658
28
from tqdm import tqdm from protonets.utils import filter_opt from protonets.models import get_model def load(opt): model_opt = filter_opt(opt, 'model') model_name = model_opt['model_name'] del model_opt['model_name'] return get_model(model_name, model_opt) def evaluate(model, data_loader, meters, d...
b26db6b54536ccb9efe4e3b0216b8159b14c71d700b5c78a461f8fe5b8e94c8c
Python
658
27
from abc import abstractmethod from typing import Protocol, runtime_checkable from torch import Tensor from elasticai.creator_plugins.grouped_filter import FilterParameters @runtime_checkable class LutronModule(Protocol): @abstractmethod def forward(self, x: Tensor) -> Tensor: ... @abstractmethod d...
df7c9d6648bc5a75d95109696654144c4c431c3c9f1c172eb6a83e0f148fac1f
Python
658
17
from typing import Callable, Optional import torchvision from Utilities.transforms import get_transforms class MnistDataset(torchvision.datasets.MNIST): def __getitem__(self, index: int): img, target = super().__getitem__(index) return {"data": img, "label": target} def get_mnist(train, config): ...
0a2c4e8c302e3c4e48c4b544ab4a6620dbfc7155bf9864bee5ae03323d1a61e8
Python
659
23
"""Basic analysis tools.""" from .file_dictionary import FileDictionary from .annotation_util import ( check_df_columns, df_to_hed, extract_tags, generate_sidecar_entry, hed_to_df, str_to_tabular, strs_to_sidecar, to_strlist, ) from .event_manager import EventManager from .hed_tag_manag...
ba001220edb0d685321fcfc23aa4365ffb34ac38636e1402df2268703d378767
Python
661
26
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. __all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", ...
e3f71dea1f626b7d9eab4ea81b85dd1226d6aa6ebd730909acefb48fca56a2d1
Python
661
27
from omegaconf import DictConfig import numpy as np from . import reducer_factory def apply_dimred(X: np.ndarray, cfg: DictConfig): ''' Applies dimensionality reduction to X and returns the reduced data matrix Parameters ----------- X: np.ndarray Latent space vectors of shape n_sample...
15de1ed3a7dbc9eda60fa97191f3d6a8de8f5a9d900d080b588f8a80e436c61e
Python
663
31
# pylint: disable=too-many-function-args, invalid-name, unused-argument """ HCP non MNI dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = "/data/users2/ppopov1/datasets/hcp_...
4087e2d2e6efb3a6f721bf287e50e5bfd59b883ce54917ef910d39343991c250
Python
663
33
from typing import Union import numpy as np from scipy.stats import spearmanr from torch import Tensor def get_summary( model: str, seed: int, num_exp: int, v_caus: float, v_hp: float, scale: float, weight: float, ss_n: float, e_star: Union[Tensor, np.ndarray], e_sim: Union[Ten...
d8de4c244dc2a4eb7e900e9acecf0feedc72eb78f5f400a9e84d0ce2f0bb876a
Python
663
34
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from relativescatter import RelativeScatterPlotReport import common_setup REVS = ["issue582-base", "issue582-v1"] SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_lmcut": [ "--search", "astar(lmcut())"], } ex...
e40b74468c2b8d33e9643567ffae1cbc6271b074b377629e0545dfc28d7e3eb9
Python
663
14
# 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 ...
dbed128f24e3dde8658f68290f5523d1d79201a6e4eed890086e78ca40bebea6
Python
664
23
import torch import torch.nn as nn class Network(nn.Module): def __init__(self, sched_iter=32): super(Network, self).__init__() dtype = torch.cuda.DoubleTensor self.l1 = nn.Linear(sched_iter, 300).type(dtype) self.relu1 = nn.ReLU().type(dtype) self.l2 = nn.Linear(300, 300)....
cebced9b8b25709823195b342f56f653771c73ef4b95a1f6fb8bf7cf28cb0209
Python
666
14
"""Cell-analysis helpers retained after the HTML builders retired. The HTML-rendering functions this module used to carry (top-N table, hemisphere asymmetry note, parent-structure roll-up) are superseded by the data-driven mounts in ``mounts.py`` / ``report_render.js``, sourced from ``point_sets.py`` - see ``RETI...
3f4acb87051856c15dbc78d7a702fd0900798fe26e18440c4014375c046c3537
Python
667
25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 12 18:57:59 2020 @author: usingh """ import psutil import multiprocessing ###Estimate procs and chunk #total cores available _max_procs=int(multiprocessing.cpu_count()) #total system memory in MB mem_values=psutil.virtual_memory() _max_mem=mem_valu...
e74e45628cceacf1f9901893a4e8796c295be0d77e2dd2897f5ca4f714cdc9d4
Python
667
29
#!/usr/bin/env python import sys, subprocess, re import matplotlib.pyplot as plt INFILE = sys.argv[1] if (len(sys.argv) == 2) else "outputs_from_test/stdout.out" x = [] y = [] nres = 0 for line in open(INFILE) : tokens = re.split("\s+",line.strip()) dssp_energy = float(tokens[12]) xi = int(tokens[0]) y...
032b852e49745605fa977b9a98e6dff2a8d5fec984cfc88c9571d500398d46e2
Python
668
26
#!/bin/env python3 ''' Example script to plot a sensor ''' import ithildin as ith import matplotlib.pyplot as plt import numpy as np import sys # read simulation results stem = sys.argv[1] if len(sys.argv) > 1 else 'results/bayes_26' sd = ith.SimData.from_stem(stem) label_time = 't' for idxs, sensor in sd.sensors.it...
8915c9aa04aebc0a69db0415e95d58014ca415db94e9b1b92cbe93d3fe52c83b
Python
668
24
# -*- coding: utf-8 -*- # # Supported Syncopy classes and file extensions # def _data_classname_to_extension(name): return "." + name.split("Data")[0].lower() # data file extensions are first word of data class name in lower-case supportedClasses = ( "AnalogData", "SpectralData", "CrossSpectralData"...
b536bf178abba3ba9bc049c19a32d49ac0c75224e09ec37486b6ae7bd9e24b4b
Python
668
19
import torch import yacs.config from pytorch_image_classification.config.config_node import ConfigNode def get_env_info(config: yacs.config.CfgNode) -> yacs.config.CfgNode: info = { 'pytorch_version': str(torch.__version__), 'cuda_version': torch.version.cuda or '', 'cudnn_version': torch...
bdc0da23123194a223a3973bb6ef243e890c82939a639e4aaf1cd083d87382e5
Python
668
24
""" SLIDING WINDOW AND AGEING FUNCTIONS These functions calculate the beginning of the sliding window and ageing coefficients for AnDePeD. """ # calculating window def update_window_beginning(self, time): if time - self.WINDOW_SIZE + 1 <= self.B: self.window_beginning = self.B else: self.wind...
4ecc3049d33ed7978a59e6b29b35d3b8a4081674ee44ade1a81031796674be2d
Python
669
29
from constants import var_t15 from constants import var_t5 from constants import var_t7 from constants import var_t2 from constants import var_t0 from constants import label_weak_strong from constants import label_large from constants import label_norm def choose(ac): if ac == 't2': return var_t2 if a...
efa7e181fa856489a221c9070120b7f786ea76c5151331915b7f417a76dff9f6
Python
669
28
#! /usr/bin/env python # -*- coding: utf-8 -*- import downward.suites import common_setup CONFIGS = { "ehc_ff": [ "--search", "ehc(ff())"], "ehc_add_pref": [ "--heuristic", "hadd=add()", "--search", "ehc(hadd, preferred=[hadd])"], #"ehc_add_ff_pref": [ # "--search", "ehc(add(), pre...
08394f2443617cb46462ec6416570757da0c2b6de4a9b1645a6b7dda2420c9fc
Python
670
26
import os import pytest os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") @pytest.fixture(scope="module") def app(): from PySide6.QtWidgets import QApplication a = QApplication.instance() or QApplication([]) yield a def test_config_menu_registers_and_rethemes(app): from regtools...
a9a95c41c3ea984a943e6082a14ca61148d1fc2e88e6291ecfe4cbe37d266c65
Python
671
25
import string CHARS = string.digits + string.ascii_uppercase + string.ascii_lowercase CHARSLEN = len(CHARS) def number_to_compact_repr(num): if num < 0: return f"-{number_to_compact_repr(-num)}" assert isinstance(num, int) s = "" while num: s = CHARS[num % CHARSLEN] + s num //...
e919e7459cc075fc50f4cafded69ecaf3785a3b60eabfe6e06617cbe17e80ff0
Python
671
25
import torch.nn as nn import numpy as np from abc import abstractmethod class BaseModel(nn.Module): """ Base class for all models """ @abstractmethod def forward(self, *inputs): """ Forward pass logic :return: Model output """ raise NotImplementedError ...
fbe88a0c2b32efc9ee4ca596620f7cf717cd99071ef6111a2647493493711fb0
Python
671
28
from setuptools import setup, find_packages setup( name="fastglioma", version="1.0", packages=find_packages(), install_requires=[ "setuptools", "pip", "pytest", "yapf", "tqdm", "pyyaml", "pytest==8.3.2", "pandas==1.5.3", "numpy==1....
128242f20558308bf6b40d4da550365c3c824f5a86a780449fb697ff9bded60c
Python
672
31
import sys def _pythonlib_compat(): """ On Python 3.7 and earlier, distutils would include the Python library. See pypa/distutils#9. """ from distutils import sysconfig if not sysconfig.get_config_var('Py_ENABLED_SHARED'): return yield 'python{}.{}{}'.format( sys.hexversi...
be15c20723ce95ad89bbe8cf19f16bcbb6d7a70da0529edeea82920f53b6d4e1
Python
672
28
# UTILITY FUNCTIONS ##################### import tensorflow as tf def tf_mat_vec_dot(matrix, vector): """ Matrix product between matrix and vector. """ return tf.matmul(matrix, tf.expand_dims(vector, 1))[:, 0] # TODO: tf.linalg.matvec(matrix, vector) def tf_outer_product(first_vec, second_vec): ...
c3644113b989b6b39fe75e9639354242505a0aa5ea421176a9e06a5c85205318
Python
672
27
from importlib import import_module as _import_module _EXPORTS = { 'plot_signal': '.raw', 'plot_raw_topomap': '.topomap', 'plot_feature_topomap': '.topomap', 'plot_3d_tensor': '.tensor', 'plot_2d_tensor': '.tensor', 'plot_adj_connectivity': '.connectivity', 'plot_graph': '.graph', } __all...
dc9bbca68cbfaa5cfd27e92080e54a5ed4b3b0ba78e0e26fa2ed657ab892be74
Python
672
23
"""Small thread-safe copies of measured observatory state.""" from __future__ import annotations from copy import deepcopy from threading import RLock from typing import Any class Telemetry: def __init__(self, **initial: Any): self._lock = RLock() self._values = dict(initial) self._values...
0c96b1b6827a9570121e066fab9ca260c3789ed81b4e593cbefae2d087508277
Python
674
24
import torch import torch.nn as nn class Network(nn.Module): def __init__(self): super(Network, self).__init__() dtype = torch.cuda.DoubleTensor sched_iter = 30 self.l1 = nn.Linear(sched_iter, 300).type(dtype) self.relu1 = nn.ReLU().type(dtype) self.l2 = nn.Linear...
3681658f7402239038df4a695b8df3e68bffa4f725c19cf6b0642d025fb646fe
Python
674
17
from __future__ import annotations from wikibaseintegrator.models.language_values import LanguageValue, LanguageValues class Descriptions(LanguageValues): def from_json(self, json_data: dict[str, dict]) -> Descriptions: """ Create a new Descriptions object from a JSON/dict object. ...
4cadd8bd0b96bd2e18fe57fda7e30d1cb504c0a422311a52f40639dfcb3a0bbf
Python
674
24
import autograd.numpy as np from autograd import grad from autograd.builtins import isinstance def test_isinstance(): def checker(ex, type_, truthval): assert isinstance(ex, type_) == truthval return 1.0 examples = [ [list, [[]], [()]], [np.ndarray, [np.zeros(1)], [[]]], ...
7f47ad7cce0a2ed363f631334c8b0ac838af91bc291732cb19789f92fdc5aef9
Python
675
22
import warnings import torch def simulate_bitshifting( x_q: torch.IntTensor, m_q_shift: torch.IntTensor, m_q: torch.IntTensor ): # TODO: check if torch.int64 could be downgraded to torch.int32 x_q = x_q.to(torch.int64) m_q_shift = m_q_shift.to(x_q.device) m_q = m_q.to(torch.int64).to(x_q.device) ...
a590205cdcfab513d41671c068a27dd310200f480b3de99c135dfde99833ef7a
Python
675
23
from setuptools.extern.more_itertools import consume # noqa: F401 # copied from jaraco.itertools 6.1 def ensure_unique(iterable, key=lambda x: x): """ Wrap an iterable to raise a ValueError if non-unique values are encountered. >>> list(ensure_unique('abc')) ['a', 'b', 'c'] >>> consume(ensure_un...
c5a2774ca66c49c793bfc9f5117504830d90df87fc75227b6d85735f1dd6e12e
Python
675
14
import pandas as pd import numpy as np import scipy.stats as sci def get_coexpression(gene_exp, gene_names): rank_test_py_exp = sci.rankdata(gene_exp, method = 'average', axis = 1) #Row ranks rank_test_py_exp = rank_test_py_exp - rank_test_py_exp.mean(axis = 1)[1] #Cente...
ff3906aac4454dcba88c53ab7ef339537c0e6a4fd6a2e358c0495e9151ecd541
Python
675
29
import torchio as tio import sys # I need to also pass in the number of the label that we're doing this for if (len(sys.argv) != 5): print('\n\nUsage: python betcrop.py <T1> <T2> <MASK> <BASE>\n\n') exit() # transform the t1, t2, and mask subject = tio.Subject( t1=tio.ScalarImage(sys.argv[1]), t2=t...
172c13b374d06876c2b47c089eaf14b93e34bbebf8a31a1fd790dd5814fca89b
Python
676
25
import torch from .ball import Poincare from .hyperboloid import Lorentz manifold_id = {Poincare:0, Lorentz: 1} def get_manifold_id(x): if isinstance(x, Poincare): return 0 elif isinstance(x, Lorentz): return 1 else: raise NotImplementedError #TODO don't need to include this def t...
79ae827e1293e287b1c0b89552a4c849bf7f3de46fa20560a39cea93fc3d7cf6
Python
676
17
""" Package for handling surfaces # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 1.05.17 """ __author__ = 'Antonio Martinez-Sanchez' from .utils import * from .surface import Particle, ParticleL, TomoParticles, ListTomoParticles, SetListTomoParticles, Simulation, \ ListSimulat...
5affd88163e1b0d1e1143197048164f54594513e1e7396532b7e4ebf0404972b
Python
677
26
""" Training and evaluation settings """ config = dict() """ Data related settings """ config['data_root'] = { '78 100': 'serialized-data/data_78x100-seed_1', '116 150': 'serialized-data/data_116x150-seed_1', '232 300': 'serialized-data/data_232x300-seed_1', '348 450': 'serialized-data/data_348x450-s...
a0ae9c7533326704b57c4a42912561f798c343a439f6360c3d534e3045290824
Python
677
24
# -*- coding: utf-8 -*- def get(network_spec): """Retrieve a PiNN network Args: network_spec: serialized specification of network, or a Keras model. """ import tensorflow as tf from pinn.networks.pinet import PiNet from pinn.networks.bpnn import BPNN from pinn.networks.lj import LJ ...
9393287544b232b5aac195a4fd8dc33fa17cce89e426f382c8a554386ba8790a
Python
678
17
import torch import torch.nn as nn import torch.nn.functional as F import yacs.config class DualCutoutLoss: def __init__(self, config: yacs.config.CfgNode, reduction: str): self.alpha = config.augmentation.cutout.dual_cutout_alpha self.loss_func = nn.CrossEntropyLoss(reduction=reduction) def ...
e6b7dfbffcf53fa8f3520440b3ddb27eb03b56750b2041dee219d73c3ddcbce9
Python
679
24
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute import common_setup import os exp = common_setup.IssueExperiment( search_revisions=["issue479-v2"], configs={ 'dfp-b-50k': ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimul...
eb74c4dbdc60fe947955c697affbaff58d4cbd6a5e6083b24ab460af5602f64e
Python
679
15
def test_batchrow_edit_fields_roundtrip(): from regtools.registration.gui.batch_2d_model import BatchRow r = BatchRow(image_path="a.tif", atlas_edit_mask_path="e.nii.gz", atlas_edit_fill=5.0) d = r.to_dict() assert d["atlas_edit_mask_path"] == "e.nii.gz" and d["atlas_edit_fill"] == 5.0 r2 = B...
cef17e5526229fab18d7ef958ea76817513321976e35f7c873dc53bc38e01f87
Python
680
24
import cv2 import numpy as np from PIL import Image image_idx = "01" gt_path = "/home/jenazzad/PycharmProjects/medical_image_segmentation/input/DRIVE/test/1st_manual/%s_manual1.gif"%image_idx predicted_path = "/home/jenazzad/PycharmProjects/medical_image_segmentation/output/baseline_unet_aug_do_0.1_activation" \ ...
cfd187b66510eadbb37f5363cbb0eecf970825948d150813a2757827e568d107
Python
680
13
from de.csbdresden.stardist import StarDist2D args = getArguments() print(args); img_seg = args[0] probability = args[1] overlap = args[2] model_file = args[3] n_tiles = args[4] #run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D],args=['input':'"+img_seg+"', 'modelChoice':'Model (.zip) from Fil...
315edbd8f1095277a17c2462100c4e19ac00ecbb57aa7a63c70598a3bc027d21
Python
681
22
#%% import os import numpy as np import seaborn as sns from xron.xron_train_supervised import main import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() #%% Load data DF = filedialog.askdirectory() # DF="/home/heavens/bridge_scratch/ELIGOS_dataset/IVT/control/kmers_guppy_4000_noise/" chun...
cd79a2e03ea4daba6c8d461ee0d2663c5df9d5723fbf523d8a7b6abe00f37fd2
Python
681
26
from subprocess import CalledProcessError import pytest from cuppa.misc.executors import RscriptExecutor class TestRscriptExecutor: def test_crash_on_error(self): executor = RscriptExecutor( args=["dummy_rscript"], ignore_error=True ) executor.run() asser...
1a2f95dc6bf71067f27762d55e75687079c5969ddae94abbcd4444ce765cf2d7
Python
682
32
from typing import Tuple import pandas as pd from .exposure import simulate_exposure from .outcome import simulate_outcome def simulate_agg_risk_and_dis_outc( dfE: pd.DataFrame, dfG: pd.DataFrame, num_exp: int, v_caus: float, v_hp: float, activation: str = "relu", scale: float = 1.0, ...
0df909621970bc76004c0ef2c601b9e2376209a5b678f05594cddebba4058976
Python
683
20
from sys import argv import pandas as pd import nibabel as nib from nilearn.image import clean_img, smooth_img subject = argv[1] task = argv[2] strategy = argv[3] nii = f'/m/cs/scratch/networks-pm/pm_denoise/{subject}/{subject}_task-{task}_SGdetrend.nii' confound = f'/m/cs/scratch/networks-pm/pm_denoise/{subject}/{su...
5df7bf45de34a0cc4f98a71e7a02c5247f773c2087ff5a155e3f94a631f883a6
Python
683
44
import numpy as np import scipy.stats import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from topaz.methods import GE_KL, PN, PU, GE_binomial, autoencoder_loss def test_autoencoder_loss(): pass class TestPN(): def test_pn_init(self): pass def...
7145cad721ee33804f474d84f5de4f9f4cccbbb1287bf084a07ae72b174414cc
Python
683
28
import numpy as np class Quadratic_func: def __init__(self, a=1, b=1): self.a = a self.b = b self.name = 'quadratic' self.formula = r'$\min\ f(x_1,x_2)={0}x_1^2+{1}x_2^2$'.format(self.a, self.b) def function(self, x): return self.a * x[0] ** 2 + self.b * x...
d68d368f22d5badc69e930b660225849f539c354c1f67f52cb73230929df84f6
Python
683
21
""" Generate txt files for MFA from excel file. """ import numpy as np import pandas as pd from pathlib import Path from helpers import load_config if __name__ == '__main__': config = load_config('speech_config.yaml') transcripts_dir = Path(config['stimuli_parameters']['stimuli_folder']) transcripts_dir....
1463bb6623f4718e09f9ede79ecb4ee77f06d3b9addffc3f419e82318f457235
Python
684
14
# if appear_feature is imported as a module, then logger will be effective. # Otherwise, if appear_feature is ran as a script, logger will not be recognized import logging import os import coloredlogs logger = logging.getLogger(__name__) logger.setLevel(os.environ.get('LOGLEVEL', logging.DEBUG)) # must have a handler, ...
19f59b1a7f2a895f6225d04ccac2fed83e3cd9ebdeebb4962575261aa30f8fb4
Python
684
18
from PIL import ImageDraw from typing import Optional from .shape import Shape, calculate_short_side class Ellipse(Shape): def draw(self, draw: ImageDraw.Draw, color: tuple[int, int, int]): draw.ellipse((self.x, self.y, self.x + self.width, self.y + self.height), fill=color) class HorizontalEllipse(Elli...
71878e3a16e92b441ce98b9c0b5cc5845bb7350565e61f4a40992abf72f831ab
Python
684
34
from sklearn.linear_model import LinearRegression import numpy as np def linreg( X: np.ndarray, property: np.ndarray ): ''' Perform linear regression of property vs X Parameters ---------- X: np.ndarray The free variables, shape n_samples x n_dimensions property: np.ndarra...
78c5eee18442bb861844b8ae7fcafa12ce7f694ae4ffd9a9283f43fec827fce1
Python
684
22
import scipy.stats import autograd.numpy as np from autograd.extend import defvjp, primitive from autograd.scipy.special import digamma rvs = primitive(scipy.stats.dirichlet.rvs) pdf = primitive(scipy.stats.dirichlet.pdf) logpdf = primitive(scipy.stats.dirichlet.logpdf) defvjp( logpdf, lambda ans, x, alpha: ...
9e818e388f034cd26b2f2a8e830f4c42857424ab71e2f7f2c3d47dd17fe7a5c9
Python
684
26
#! /usr/bin/env python # -*- coding: utf-8 -*- import common_setup import downward.suites # This experiment only tests the Lama-FF synergy, which sat1 did not # test because it did not work in the issue77 branch. CONFIGS = { "synergy": ["--heuristic", "hlm,hff=lm_ff_syn(lm_rhw(reasonable_orders=true))", ...
c142c48e257951f08c0e230e9f5c513c1d003bf0353124b96b78a7b46b362607
Python
684
19
"""Write MANIFEST.sha256.json: SHA-256 of every bundled data and configuration file. Source code is identified by the git commit; this manifest pins the research inputs. Run from the repository root after any intentional data change. """ import hashlib import json from pathlib import Path ROOTS = ("data", "configs") ...
c41408f88bd21d0756204922b79a0017cfdd5b0a2f78f9ec84303c094d60c279
Python
684
25
# -*- coding: utf-8 -*- # @Author: Sadamori Kojaku # @Date: 2023-06-15 12:30:50 # @Last Modified by: Sadamori Kojaku # @Last Modified time: 2023-06-15 12:50:47 import lfr params = { "N": 1000, # number of nodes "k": 50, # average degree "maxk": 100, # maximum degree "minc": 20, # minimum commun...
d361d175327222bd94e4f670f1b8534a06e2b44a6d6df01f674baefa6b01f2f6
Python
684
20
import scipy.stats import autograd.numpy as np from autograd.extend import defvjp, primitive from autograd.numpy.numpy_vjps import unbroadcast_f cdf = primitive(scipy.stats.poisson.cdf) logpmf = primitive(scipy.stats.poisson.logpmf) pmf = primitive(scipy.stats.poisson.pmf) def grad_poisson_logpmf(k, mu): return...
d651d36ef4a9276b38645476ea995628877f6c6602b3a2d657ae87ddf266769b
Python
684
23
"""Testing module tree.""" from treem import Tree def test_tree_traversal(): """Tests tree traversal.""" tree0 = Tree() tree1 = tree0.add(Tree()) tree2 = tree1.add(Tree()) tree3 = tree1.add(Tree()) pre = list(x for x in tree0.preorder()) post = list(x for x in tree0.postorder()) level...
dfb40887b825a43fe2c99d1a83cd5b9085082f4a52cd16ab407930d0b2b230ac
Python
685
29
# set QT_API environment variable import os import sys import argparse 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.gui_usbspectrometer as gui parser = argparse.ArgumentParser() parse...
5b4ead08146642bc9898cad15b6c109a6e6998d25231ba06145838daef0abdfb
Python
686
19
# # Copyright Bradley Lowekamp # # 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.txt # # Unless required by applicable law or agreed ...
d03cb98c31c01634c8d85b4bb9c83bf92f0e9fb88a4863c27971c3d9cb32b746
Python
686
30
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import configs import common_setup REVS = ["issue436-base", "issue436-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_satisficing_with_ipc11() default_configs_satisficing = configs.default_configs_satisficing(extended=True) CONFIGS...
f869f4cb4cf6c606a5c906ffab2e2eadd08fdf64855ad6e14fd9d80db919ff2e
Python
686
12
STYLE_ITEMS = ( ("spheres", "Spheres", "Space-filling atoms style."), ("cartoon", "Cartoon", "Secondary structure cartoons"), ("surface", "Surface", "Solvent-accsible surface."), ("ribbon", "Ribbon", "Continuous backbone ribbon."), ("sticks", "Sticks", "Sticks for each bond."), ("ball_and_stick"...
0940abc242aa26d55f569b4584de2ff6af4cc2bdd971187ab364226dabbe8b4b
Python
687
23
""" WikibaseIntegrator Library ~~~~~~~~~~~~~~~~~~~~~ WikibaseIntegrator is a Wikibase library, written in Python, for human beings. Basic read usage: >>> from wikibaseintegrator import WikibaseIntegrator >>> from wikibaseintegrator.wbi_config import config >>> config['USER_AGENT'] = 'Item Get Notebo...
3ba4f7f563475979000009e237d32b754b1b75ed06bc2acbbb3351ee72653b37
Python
687
22
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PeerJCode.settings") try: from django.core.management import execute_from_command_line ...
bbeedb8778585a4ed2ca2c070b6be011f58c2f7bf5641f2325b3dece429a5fdc
Python
687
30
# pylint: disable=too-many-function-args, invalid-name """ HCP Schaefer 200 ROIs (no FIX-ICA) dataset""" import numpy as np from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = DATA_ROOT.joinpath("hcp_schaefer/data_schaefer_200.npz"), ): ...
600356b4019d2d530b5338cb95cb4a7ed20b17c36211e139262aaf079a951b18
Python
688
19
# 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...
549838744a582c306c834ab164eea2aa38c15e8b703383fae508bc791debbf8b
Python
689
31
from __future__ import print_function from openbabel import openbabel mol = openbabel.OBMol() print('Should print 0 (atoms)') print(mol.NumAtoms()) a = mol.NewAtom() b = mol.NewAtom() mol.AddBond(1, 2, 1) print('Should print 2 (atoms)') print(mol.NumAtoms()) print('Should print 1 (bond)') print(mol.NumBonds()) obCon...
db09a6d33f0aa054aab357229098dc2878a9014ecb8f764a278c925081b94dcb
Python
689
22
from __future__ import annotations import os from pathlib import Path from shutil import rmtree TEST_RESULTS_DIR = Path(__file__).parent / "_test_results" TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch" def pytest_sessionstart(): file_dir = Path(__file__).parent os.environ["QUACC_CONFIG_FILE"] = ...
174cbde7073ab1f9125b028a6bd364a86c3bef871f8f82c87b51f2d80084ef3c
Python
690
28
import pytest import molecularnodes as mn from .constants import data_dir @pytest.fixture def filepath(): return data_dir / "1f2n.bcif" def test_bcif_init(filepath): from molecularnodes.entities.molecule.reader import read_structure reader = read_structure(filepath) assert reader.file_path == filep...
5d288097a1206646638521339ec8f2284c9e858de0821e72dca1494aea1492dd
Python
690
29
import torch from torch import Tensor from utils.common import Device def masked_scaled_mse( output: Tensor, target: Tensor, weight: Tensor, node_ids: Tensor, lambda_: float, device=None, spec_recons=None ) -> Tensor: """ MSE loss. """ if device is None: device = Device...
ec95fe4079b75b2a416770be8c7c758a4be3c00a86255e10f498a5f6648618c2
Python
690
34
from abc import abstractmethod from typing import Protocol from torch import Tensor class Quantize(Protocol): @abstractmethod def quantize(self, a: Tensor) -> Tensor: ... class MatMul(Protocol): @abstractmethod def matmul(self, a: Tensor, b: Tensor) -> Tensor: ... class Add(Protocol): @abstra...
8b055394cf7e3c327d8f806313c7e5d8dfbacf7dc6647fa57de4f19df5ad7dad
Python
692
17
# 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...
bb30a93ed8d4180994f8db325566f0966812702169443cbe04b0d65c565cf4ca
Python
693
22
# Run interface for Cog # https://cog.run/python from cog import BaseRunner, Input, Path class Runner(BaseRunner): def setup(self) -> None: """Load the model into memory to make running multiple requests efficient""" # self.model = torch.load("./weights.pth") def run( self, i...
cefa17a5cbe1cc1881162746cfda82d7f7e5b673a308c73e014c051e50bae76a
Python
693
9
"""SIGN_AT_RISK.py 2026-09-24. Gives VERIFY V-49 (14 Sept) an output file: of the neurons undetermined at 95%, how many have a runner-up transmitter of the opposite Pospisil sign? Output: 06-OUTPUT/sign_at_risk.txt""" import pandas as pd F = pd.read_parquet('D:/eucys/06-OUTPUT/flip_probabilities.parquet') u = F.z_sl < ...
1a233de8e4fe112eecb0cbfd7f83a278f34cbf5a6b0c531c5494342ff46cc310
Python
694
28
import subprocess import os __version__ = "0.4.6" base_version = __version__ __commit__ = "" try: _hsPath = os.path.abspath(os.path.dirname(__file__)) _commitFile = os.path.join(_hsPath, ".commit_version") if os.path.exists(_commitFile): with open(_commitFile) as f: __commit__ = f.read...
3cc40b4acd54a8cf14ef6811ef9974732a54a5ced97c65fd2c991d576ecac91d
Python
694
14
# Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux # 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 b...
8a07d53d52d9f077a23e81ec5ce65a82a78dd806e6e79fbcdadd62813a0ae991
Python
694
29
# set QT_API environment variable import os import sys import argparse 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.gui_displacement_measurement as gui parser = argparse.ArgumentParse...
91b118cea3abac80314cee3413b2e648a9e24ad333fdc3d95f4aa7404a27f895
Python
694
30
from .base_graph import BaseGraph from .graph import Graph, ReadOnlyGraph from .graph_iterators import ( bfs_iter_down, bfs_iter_up, dfs_iter, ) from .graph_rewriting import ( DanglingEdgeError, get_rewriteable_matches, produces_dangling_edge, ) from .name_generation import NameRegistry from .su...
b7a2a18ccda14faa73e1eafea89faa9d6808b1fdf1b938aafe186e2519a7e8de
Python
694
25
from pathlib import Path import time import numpy as np import openturns as ot import seaborn as sns import os import pickle import uptake.multiprocessing.run_studies_servor as umps def build_initial_dataset(expected_sample_size): testcase_id = "dataset_for_ANN_mechanadaptation_vs_passive_elliptic_news...
ca608493e8d713022485f79ed6463fa146b61ad13afb2746f1318f43a6fcd2a1
Python
694
26
import dotenv import hydra from omegaconf import DictConfig # load environment variables from `.env` file if it exists # recursively searches for `.env` in all folders starting from work dir dotenv.load_dotenv(override=True) @hydra.main(config_path="../configs/", config_name="train.yaml", version_base="1.1") def mai...