sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f789597d5ace0d07506a2f9c3ebca1f25881214bfbcb1f031a34d6a668e55dfe
Python
831
20
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """check_us.py —— 扫描 main.tex 中 \texttt 与数学模式之外的裸下划线。""" import re src = open('game/docs/arxiv/main.tex', encoding='utf-8').read() # 先抠掉 \texttt{...}(允许一层花括号嵌套) stripped = re.sub(r'\\texttt\{(?:[^{}]|\{[^{}]*\})*\}', '', src) bad = [] for i, l in enumerate(stripped.split(...
8c57efbebecd713cc2bb3c2790bc413e9775c71582cf4d0b0f17c2763e42f9c1
Python
833
25
import os import sys from pysitk.definitions import DIR_TMP from pysitk.definitions import ITKSNAP_EXE from pysitk.definitions import FSLVIEW_EXE from pysitk.definitions import NIFTYVIEW_EXE DIR_ROOT = os.path.realpath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) DIR_TEST = os.path.join(DIR_RO...
c5d622f370ec468dba11305cdb93c604df4e8b404a790ac5fe47efea1d7e9508
Python
833
39
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup from relativescatter import RelativeScatterPlotReport REVS = ["issue67-v4-base", "issue67-v4"] SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_blind": [ "--search", "astar(blind())"], ...
cf0d8ac4f41dddb246e4baaf1d653c7cb30ee2860f4e4247b10da58c3379de70
Python
833
25
#from setuptools import setup, find_packages from setuptools import setup setup( name='odopy', version='0.1.0', author='Brian Szekely and Christian Sinnott', author_email='bszekely@nevada.unr.edu', packages=['odopy', 'odopy.test'], scripts=['src/odopy/headCalibrate.py'], #url='http://pypi.python.o...
0a6637a3e815fe3568afafa021d3d5f6170c8adf5e51f0f78d6e7883fbece677
Python
835
23
# 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...
0a94385f5975769279b64e5f5aa120c2540efd645c47490ffd50feee9e0428ef
Python
835
25
#!/bin/env python3 """ Ithildin module for Python ========================== This module offers tools to read, analyse and draw the simulation results of the C++ computational cardiology framework ithildin. """ from . import defect, filament, graph, log, pdl, phase, plot, pulse, points, simdata, topology, varfile, xd...
1e31b821b86e0818cd3b526b75bb2de61a75bd19b71c73d41a5058c669a60dd0
Python
838
34
from abc import abstractmethod from collections.abc import Collection, Hashable, Iterator, Mapping from typing import Protocol, Self class ReadOnlyGraph[T: Hashable](Protocol): @property @abstractmethod def nodes(self) -> Collection[T]: ... @abstractmethod def iter_edges(self) -> Iterator[tuple[T...
b4a1669aea36c43f3498ab2d1b5907cdcfa416e6625586c0bf7b5f5434f2ce03
Python
838
24
""" 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 """ from deeplabcut.gui.analyze_videos import * from deep...
a1b895343bfe9f06905d5cae00acf95a2132b971669f7fbe668e92aff04ea187
Python
839
18
from .env_modules.createc_control import Createc_Controller from .env_modules.episode_memory import Episode_Memory from .env_modules.dissociate_env import DissociateEnv from .env_modules.img_attrib import mol_property from .env_modules.net_framework import img_classifier from .env_modules.img_conv import ResNet1...
c90d850d7f37bea00b1301556ca0c162f7b1935857a49d3dd22c0e735f5991e4
Python
839
27
"""Constants used the project. Mostly paths to data, logs and so on""" import datetime import os import platform from path import Path PROJECT_ROOT = Path(os.path.dirname(os.path.dirname(__file__))) ASSETS_ROOT = PROJECT_ROOT.joinpath("assets") WEIGHTS_ROOT = ASSETS_ROOT.joinpath("model_weights") LOGS_ROOT = ASSETS_R...
ceee36ad7cefe59a684ce168dcf1144e8c3f9a11c099d1a37d8e24dc2448e0fe
Python
839
30
from experiment_management import run_experiment import argparse parser = argparse.ArgumentParser() parser.add_argument("-d", action="store_true", help="Dry run") parser.add_argument("-t", action="store_true", help="Test") args = parser.parse_args() if __name__ == '__main__': experiments = ["BOTHCNN"] dry_r...
0c5e5126dc990807e87e4d4c73697be3f450fba09db5b8d7da33bb39ccb50abc
Python
840
35
from numpy import std, square, mean def unsigned_to_signed(unsigned_array,N): signed = 0 for i in range(N): signed = signed + int(unsigned_array[i])*(256**(N-1-i)) signed = signed - (256**N)/2 return signed def split_int_2byte(number): return int(number)% 256,int(number) >> 8 def split_s...
53f0f591baf734dc88c7fd03e5b1e67cd79814245bf42655a62fb14a18e82335
Python
840
34
import asyncio import inspect import sys from memory_profiler import profile @profile async def my_func(): a = [1] * (10 ** 6) b = [2] * (2 * 10 ** 7) await asyncio.sleep(1e-2) del b return len(a) async def main(): # Ensure @profile preserves the coroutine nature of async functions so #...
61abbbee7045d36256a8a4eabab01bd8f5a4b525c927240365f6e21bc8f412d2
Python
840
15
""" 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 Foundation...
46ede95bc17009c2836ae2c2db997330c09e72b570c633b2dcab89a1745fc37d
Python
841
35
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute from lab.suites import suite_all import common_setup import os exp = common_setup.IssueExperiment( search_revisions=["issue469-base", "issue469-v1"], configs={"astar_blind": ["--search", "astar(blin...
8bb2a3de7cfa046fc012f4b0975df4b68d70a96dca23a08a28dd7d6cc42f72f6
Python
841
27
import unittest from file_io import load_image, save_image from cythonized.ada_thr import adaptive_threshold from cythonized.img_pca_filter import img_pca_filter import time class MyTestCase(unittest.TestCase): def test_pca(self): img = load_image(r"D:\GitHub\Segment-Splicing-Search\data\gt\512_128_tiff\1...
96cb416a24ff395ab5162e13ea08f28aa8fa1a71d9348a8102a6bf21a429a4c9
Python
841
39
from memory_profiler import profile import logging # create logger logger = logging.getLogger('memory_profile_log') logger.setLevel(logging.DEBUG) # create file handler which logs even debug messages fh = logging.FileHandler("memory_profile.log") fh.setLevel(logging.DEBUG) # create formatter formatter = logging.Form...
7beac81a672afd08fac0a67e4530a6972c69e11b7368934e50f88363cdcd4d0b
Python
842
29
import zipfile import gdown import os import tarfile import requests, io def main(): ## Download early model r = requests.get("https://blastospim.flatironinstitute.org/html/early_embryo_model.zip") z = zipfile.ZipFile(io.BytesIO(r.content)) z.extractall('.') ## Download late model r = requests...
a31a75440eb87b6ca4a28e7871f27bfa0f3535a5d0c9c24b913c5d6d2c482f28
Python
842
27
# 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...
f3dd0ea6f9eb5816eca52aa8d7d1aa14d74dca7cccf6a60e9d3639d6ec67d74c
Python
842
37
# .. an example to test decorator with precision keyword argument .. """ Test profiling using imported ``profile`` function with precision specified as parameter to ``profile`` function. This is useful if the python script we're trying to profile is called as a module (like `python -m test_module`) and so we can't spec...
3f117ae47c842adcb486cb2031e145b6719fb3f6fdac435a0c1e0d6ba6113de6
Python
843
29
#!/usr/bin/env python from setuptools import setup import progress setup( name='progress', version=progress.__version__, description='Easy to use progress bars', long_description=open('README.rst').read(), author='Giorgos Verigakis', author_email='verigak@gmail.com', url='http://github.c...
e34db7e8f18da648305260d4193b8a95826e02fc70482d990b1c48ed64cc7cd0
Python
843
31
# built-in from math import isclose # external import pytest # project import textdistance ALG = textdistance.JaroWinkler @pytest.mark.parametrize('left, right, expected', [ ('hello', 'haloa', 0.7333333333333334), ('fly', 'ant', 0.0), ('frog', 'fog', 0.9166666666666666), ('ATCG', 'TAGC', 0.8333333...
f756b6994a3bbdbc9f65d70a636f2080c0b7a722f3b78ebcde92844c20a85e03
Python
843
53
import os import numpy as np from PIL import Image from topaz.utils.data.sampler import (RandomImageTransforms, ShuffledSampler, StratifiedCoordinateSampler, enumerate_coordinates) class TestRandomImageTransforms(): def test_init(self): ...
5a2b874c6e8ad0466f2c8d63c852b05c4aebb599247932566532be4f75078984
Python
847
31
#!/usr/bin/env python2.7 from __future__ import print_function import os from pddlstream.algorithms.search import solve_from_pddl from pddlstream.utils import read from pddlstream.language.constants import get_length def read_pddl(filename): directory = os.path.dirname(os.path.abspath(__file__)) return rea...
2056ee38e05d771d319fdce991300ef43aac23d58916b2706cd0d4e5d83a2a79
Python
848
29
#!/usr/bin/env python from setuptools import find_packages, setup VERSION = "0.6" with open("README.md", encoding="UTF-8") as f: readme = f.read() with open("requirements.txt", encoding="UTF-8") as f: required = f.read().splitlines() setup( name="nucleus", version=VERSION, description="Nucleus ...
39c9f622db02c7e39ae81a31ba5b60fbf6b98c79cb730a4c90da78c8e6de725c
Python
848
26
from google.cloud import pubsub_v1 import preprocessing import json import sys def receive_messages(project, subscription_name): """Receives messages from a pull subscription.""" subscriber = pubsub_v1.SubscriberClient() subscription_path = subscriber.subscription_path( project, subscription_name) ...
4d5aece563ee81d2328d145eb425ca0a165bf32248a5a9ab584192de9f11c0cc
Python
848
32
import sys import matplotlib.pyplot as plt angle = [] pdf = [] cdf = [] random_values = [] for line in open(sys.argv[1]) : if line[0] == '#' : continue values = line.strip().split() if len(values) == 1 : random_values.append( float(values[0]) ) else : angle.append( float(values[0]) ) pdf.append( float(...
826a18518e988e198def63d6064cce59fa0207245c538a154f12daeba4e99a63
Python
848
30
import torch import torch.nn as nn class RadialFunction(nn.Module): """ Contruct a radial function (linear layers + layer normalization + SiLU) given a list of channels """ def __init__(self, channels_list): super().__init__() modules = [] input_channels = channels...
ddb7d3c8f0164f9184c5c3bc07e82fdd06277f9318823bf751545c3dfb610f23
Python
848
31
import argparse from pathlib import Path import cv2 from tqdm import tqdm def processing(img): img = cv2.resize(img, (720, 720)) img = cv2.fastNlMeansDenoisingColored(img, None, 10, 10, 7, 21) return img def main(args: argparse.Namespace): src = Path(args.source) tar = Path(args.target) pre...
28940dd5e401afc8882b948aac9e3b957bf11b4049ecb9b7f16e334f4bfff259
Python
849
44
from .package_data import __version__ from .core import ( IDNABidiError, IDNAError, InvalidCodepoint, InvalidCodepointContext, alabel, check_bidi, check_hyphen_ok, check_initial_combiner, check_label, check_nfc, decode, encode, ulabel, uts46_remap, valid_conte...
62de24340774a43caffcd70384eee42ceb8dab59169ede4832fdf57e1cc9a7b0
Python
849
34
import subprocess def test_cli(tmp_path, stat_img): output_dir = tmp_path / "mni_test" output_dir.mkdir() ret = subprocess.run( [ "atlasreader", "--atlas", "harvard_oxford", "aal", "--threshold", "7.0", "--probabi...
be1b6067619149d17a18eec3ccfb6b630388aff9bead5bc11e071a59ab0e18a5
Python
849
33
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 ln2_filter_exc_dur: float = 1 ln2_filter_exc_g...
d0c61d13ed61a7fd4443a73a2eb0eec50294d06d93b03bd3ae18f22f35bbe78f
Python
849
30
""" Helper functions """ import os import pandas as pd import warnings def write_excel(save_to, dataframes): """ Write dictionary of dataframes to excel Arguments: save_to (str): path where to save dataframes (dict): dictionary of dataframes Returns: None """ if os.path....
15f1e345ee5bb76b1f578b4d69e929550518742695aa7758bad9837fdd6f6c26
Python
850
21
import numpy as np from specs import * class VoltageToFluorescenceConverter: """Logistic conversion.""" def __init__(self, specs: VoltageToFluorescenceSpecs): a1 = np.exp(- specs.beta * specs.v1) a2 = np.exp(- specs.beta * specs.v2) z = (specs.f2 - specs.f1) / (specs.f1 * a1 - specs.f2...
3eeba27e1462e52f60ac5f5ec3981e678504d93f621f7d2c79b9335c656c6135
Python
850
29
import pytest import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from tests.integration_tests.nn.fixed_point.precomputed_routine import ( routine_testing_precomputed_module, ) @pytest.mark.ghdl @pytest.mark.parametrize( "total_bits, frac_bi...
1f9130d997129c8ff10f818d0ae248ac5db39d028bfb91c844f0a7cb5d6b4209
Python
851
26
from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector from OnlineDetectors.contextOSE.cad_ose import ContextualAnomalyDetectorOSE class ContextOSEDetector(OnlineAnomalyDetector): """ This detector uses Contextual Anomaly Detector - Open Source Edition 2016, Mikhail Smirnov smirmik@gmail....
ac12d2c14efa88f68ac2cb1e1b3381e69514cf07cc9ace3e1b171c4267638c52
Python
851
23
# 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...
c348caa0a3531d643c43f59659ba32cbfd475aabe2f2ecedbf9ec87115ba1250
Python
851
36
import torch import torch.nn as nn class Autoencoder(nn.Module): def __init__(self, input_dim, d): super().__init__() self.d = d self.encoder = nn.Sequential( nn.Linear(input_dim, 1028), nn.ReLU(), nn.Linear(1028, 512), nn.ReLU(), ...
1cf05b29848345c291b6d19d48d2a02504a3ecb812b2f6ecba9add0c2ff3ca60
Python
852
26
import numpy as np from nodebpy.nodes.geometry import CurveToMesh, SetHandleType, SetSplineType from molecularnodes.nodes.geometry import AtomsToCACurves def test_atoms_to_ca_splines(fetch): """ This test is for if the chains are still connected as continuous, even though they are separate by a larger dis...
577c5f0698de4420bbe1776c1a39dda922bc2f12f7ace193c3786e9eb45771e3
Python
852
26
# # 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 ...
5a0ada71e5f77474963efcaa11175d9bc6bd809e1b0af20531fa8b8b825adf8e
Python
852
30
# -*- coding: utf-8 -*- from glob import glob import os import pytest from dcm2bids.sidecar import Sidecar @pytest.fixture def sidecarFiles(): dataDir = os.path.join(os.path.dirname(__file__), "data", "sidecars") return glob(os.path.join(dataDir, "*.json")) def test_sidecar_lt(sidecarFiles): sidecars...
b000469d851a528095da3647d8aa336a4ff1c62ad4af0186ea3e1b9fa64442a0
Python
852
32
#54121 -+sycu 6y from psychopy import parallel import serial ##### Set port address to match your local machine paddress = '/dev/parport0' # '0xDFF8' or 'COM1' in Windows ################################################## try: port = serial.Serial(paddress) port_type = 'serial' except NotImplementedError: ...
f35a545859bb9453c570a25450017e4585b2db452267a5588d4b5ee0b03475ca
Python
852
16
# this file must be run if changes are made to the model.py file from numba.pycc import CC from ednm.model import Model cc = CC('aot_jacobian') @cc.export('jacobian', '(float64, int32, float64, int32, int32, float64[:,:], float64[:,:], float64[:,:,:], float64[:,:,:], float64[:, :], float64[:, :], \ float...
ffd7a891a264b9bdfa15450c4fa3abbb1a8af02d179df2d837aaf01322b8932b
Python
852
30
#!/usr/bin/env python #================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : morphology_utils.py # Author : Yufeng Liu # Date : 2022-04-18 # Description : # #==============...
6677e2765fa0ac209dd347f6536ba374036782d6c680d5d36ddd86f5c9a08581
Python
853
36
#!/bin/env python3 ''' Draw Feynman diagrams for the quasi-particles in the 2D patterns of cardiac arrhythmia ''' import matplotlib.pyplot as plt import sys import yaml from pdlfeynman.diagram import * plt.rc('font', family='sans-serif') plt.rc('text', usetex=True) plt.rc('text.latex', preamble="\n".join([ r'\u...
df529a667ce4671706bd04acf473f5c1b8549a666d3c9de7038edaf06db9b3e9
Python
853
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm import common_setup def main(revisions=None): SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { 'cea': ['--search', 'eager_greedy(cea())'], 'cg': ['--search', 'eager_gree...
1ad13fe058784241cc4e4db9e23214a558b965240cb9ea7be493f36ddb0a5248
Python
854
30
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Mitchell R. Vollger import argparse import pysam if __name__ == "__main__": parser = argparse.ArgumentParser( description="", formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument("infile", help="input fasta fi...
8f209e85096ef2d9bcffd691b5d7b5a9a77edf67d90fc45415d371f645b23f26
Python
854
29
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Submit to cluster ERF function ''' import os import os.path as op import numpy as np import pickle from warnings import filterwarnings from sys import argv from stormdb.cluster import ClusterBatch from stormdb.access import Query project = 'MINDLAB2020_MEG-AuditoryPat...
82e970cb13eeb8f2e8460488c0b48870c7ebeb02528d16d5f2d354181b3134c5
Python
855
32
#!/usr/bin/env python # -*- encoding: utf-8 -*- import sys import os sys.path.insert(1, os.path.join("../../../../h2o-py")) import h2o from tests import pyunit_utils import requests def redirect_relative(): conn = h2o.connection() # get default requests arguments req_args = conn._request_args() heade...
a8a1166ebf24408160f93455ec17840fe159a1c4a5486309390fe4f51138bd76
Python
855
33
import os import sys sam_file_path = sys.argv[1] readids_file_path = sys.argv[2] test = sam_file_path.strip().split(".") sam_file = open(sam_file_path) seq_dict = {} for line in sam_file: if not line.startswith("@"): line = line.strip() words = line.split() if(words[0] not in seq_dict.key...
26f80cb4673bf65f3a2f031b538a8aed8e161ce03e3d248f627deb124a061b29
Python
856
29
from typing import Iterator from elasticai.creator.hdl_ir import Registry def m_to_n_lut_cost(m: int, n: int) -> int: return int(n / 3.0 * (2 ** (m - 4) - (-1) ** m)) def estimated_lower_lut_cost_by_implementation( reg: Registry, ) -> Iterator[tuple[str, int]]: for name, impl in reg.items(): if...
a667df885a43dab9453593e6501fb11f3233fc2d1b3f67d21adc1d989cbd14a0
Python
856
33
#! /usr/bin/env python # -*- coding: utf-8 -*- import downward.configs import downward.suites # "ipc=False" skips portfolio configurations which we don't need to # test here. CONFIGS = downward.configs.default_configs_optimal(ipc=False, extended=True) # pathmax is gone in this branch, remove it: for key, value in li...
b94a3de2f0e3391c975dad6f7f4e3c3fa7304720e04b30d771e7986be9c7fcbc
Python
856
27
import numpy as np from PIL import Image from scipy.stats import pearsonr def load_images(image_paths): images = [] for path in image_paths: img = Image.open(path).convert('L') img_array = np.array(img) images.append(img_array) return images def calculate_plcc(subjectiv...
c5603f8a9e5163cef22bc2357ecc8b8dd19554229f43bc7aaa104eebc9393629
Python
856
28
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import sys from cirrocumulus import concat, launch, prepare_data, serve def main(): command_list = [concat, launch, prepare_data, serve] parser = argparse.ArgumentParser(description="Run a cirro command") command_list_strings = list( m...
422717b3c4acd70ddc8d1a2123f806dac93182d9d7d4c43adc7bff4036cf763e
Python
857
17
"""Merge the part files of REAL_ODOURS into 06-OUTPUT/real_odours_counts.npz (row k kept from whichever file ran it). 2026-09-25.""" import numpy as np, glob, os OUT = 'D:/eucys/06-OUTPUT/real_odours_counts.npz' Z = dict(np.load(OUT)) for f in ['D:/eucys/tmp/real_odours_counts_B.npz'] + sorted(glob.glob('D:/eucys/tmp/r...
db7e766a027fa7ed79a1007cad7cf0e74b6d03fe54411e5bebaf3aeeba6e938d
Python
858
34
import unittest import torch from torcheeg.models import GRU, LSTM class TestRNN(unittest.TestCase): def test_gru(self): model = GRU(num_electrodes=32, hid_channels=64, num_classes=2) eeg = torch.randn(2, 32, 128) pred = model(eeg) self.assertEqual(tuple(pred.shape), (2, 2)) ...
15ac70e4db55db61f01ebc8dc32f69033efa8c706042613220a67e0991fb09dd
Python
859
34
from collections import Mapping #class StarRoadmap(Mapping, object): class StarRoadmap(Mapping, object): def __init__(self, center, planner): self.center = center self.planner = planner self.roadmap = {} """ def __getitem__(self, q): return self.roadmap[q] def __len__...
396c02a5a3172842e008c4e53a2a5a0ed9d7f0148b5ffbd6138b094e87896b16
Python
859
40
## moving point charge with superluminal phase velocity in dielectric media emitting Cherenkov radiation import meep as mp sx = 60 sy = 60 cell_size = mp.Vector3(sx, sy, 0) dpml = 1.0 pml_layers = [mp.PML(thickness=dpml)] v = 0.7 # velocity of point charge symmetries = [mp.Mirror(direction=mp.Y)] sim = mp.Simulat...
52436c008eeb17dc078ddea2a3906b9a84aa9d67cd3539f5f15c44faf8b7ffbb
Python
859
18
import os, sys BASE = os.path.dirname(os.path.abspath(__file__)) FILES_PATH = os.path.join(BASE, "files") TRAINED_NN_PATH = os.path.join(FILES_PATH, "NN") TRAINED_NN_MSEED = os.path.join(TRAINED_NN_PATH, "NN_MS.npz") TRAINED_NN_BIGG = os.path.join(TRAINED_NN_PATH, "NN_BG.npz") MODELS_PATH = os.path.join...
a38453e3111a7f2d5ca23c8cf12f4265c6be8b76d9a5415320ceca4830a1608f
Python
859
31
import os import random import torch import torch.backends.cudnn as cudnn import torch.distributed as dist from config import * from core.worker import main_worker if __name__ == '__main__': args = get_parser() cudnn.benchmark = True if args.debug: rank = 0 local_rank = 0 else: ...
eaff6ebc5a89d672e58e2998a397908f80dc3db6d1b075df5d3cf6b6b0b36b47
Python
859
24
from regtools.registration.report import _render_grouped_metadata def test_groups_known_keys(): meta = { "atlas": "allen_ccf_25um", "registration_method": "ants", "random_seed": 42, "laplacian": {"rtol": 0.01}, "timing": {"total_sec": 123.4}, "environment"...
517c6270f2988ce83a7136d47ab4687bdf02366bd338c5c8fb55a2315d99c357
Python
860
17
""" 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 Foundation...
86f0269a25a567f6f02601f5387cbaf1527cfa90ff368db36560ca8f53f3958c
Python
860
19
df = pd.read_csv('Exp_Pl_protID_to_OGID.csv') # Find entries present in all columns conserved = set(df['ath']).intersection(df['zma'], df['ppp'], df['cre']) # Find entries present only in each column only_ath = set(df['ath']) - set(df['zma']) - set(df['ppp']) - set(df['cre']) only_zma = set(df['zma']) - set(df['ath'])...
9a1fda9291c95d3b2499febf9f86a2871b6036dc2eb63ba6e2af4387c1715968
Python
860
31
# Configuration file for the Sphinx documentation builder. import os import sys sys.path.insert(0, os.path.abspath("..")) project = "ColabMDA" copyright = "2024, Shammit Kumar Paul" author = "Shammit Kumar Paul" release = "0.1.0" # -- General configuration --------------------------------------------------- extensio...
b6933140dd184239d6566b12c30f647784b320fd0c57303435256f3f12c9d54e
Python
860
31
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment configs = [ IssueConfig( "cegar-10K-original", ["--search", "astar(cegar(subtasks=[original()],max_states=10000,max_time=infinity))"]), IssueConfig( "cegar...
ce18295c233e11b8dc54a8548ccd25b23ef42c47b564b0af79fd8b9b7decdea5
Python
860
17
""" 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 Foundation...
f77c3cd395c6af40e6d37498607d3fc6aef4c8e496b2ffc36320c9646ccfab02
Python
862
31
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment configs = [ IssueConfig( "cegar-10K-original", ["--search", "astar(cegar(subtasks=[original()],max_states=10000,max_time=infinity))"]), IssueConfig( "cegar...
442924bbf07b8ae7c70891b741df68f942892e8bd3efdac1dc011e67ce6675ca
Python
863
17
try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='classification_models_3D', version='1.1.0', author='Roman Sol (ZFTurbo)', packages=['classification_models_3D', 'classification_models_3D/models'], url='https://github.com/ZFTurbo/classificat...
522e0d764c56a2cfff7c6a4d22023f5114437c1a52409bd0a725befcafba51d1
Python
863
31
import h5py import numpy as np colors = {0: 'CO', 1: 'C1', 2: 'C2', 3: 'C3', 4: 'C4', 5: 'C5', 6: 'C6', 7: 'C7', 8: 'C8', 9: 'C9', 10: 'C0'} def load_data(h5_path, dataset_path, return_labels=False, remove_zero=True, shuffle=True): with h5py.File(h5_path, 'r') as...
599a6f39d873f6db536a4f0c0f7d53c6a6f0970c25f18263dc18db6b6ede1963
Python
863
33
import sys from pybioshell.std import vector_std_shared_ptr_core_data_sequence_Sequence_t from pybioshell.core.data.io import read_clustalw_file from pybioshell.core.data.sequence import SequenceProfile if len(sys.argv) < 2 : print(""" Reads a multiple sequence alignment (MSA) (in .aln format) produced by Clusta...
5e436e62cd3ffc2f0ab9930a6ae722df42be0114e0d9ae573ba36dae565e1c56
Python
863
33
import sys from pybioshell.core.data.io import Cif, write_mol2 from pybioshell.core.chemical import MonomerStructure if len(sys.argv) < 2 : print(""" Converts a small molecule structure from CIF to MOL2 file format. The last, optional parameter of the script provides the name of a given molecule, that will be s...
626ea282ec36cd9814aff721ccffa7bb3b2ae1e8a71b260325015e47da22e743
Python
863
23
"""Tests for loading nexus device configuration.""" from pathlib import Path from pypulseq import Opts from console.interfaces.device_configuration import NexusConfiguration, RxConfiguration, SystemLimits, TxConfiguration from console.utilities.load_configuration import load_nexus_config, load_system_limits def tes...
efc264164b0051869b2e862ca46aad416d6eb09ba4369974e51ec21ed450b545
Python
863
33
""" Contains Exception classes for image io. # Author: Vladan Lucic Max Planck Institute for Biochemistry # $Id$ """ from builtins import str __version__ = "$Revision$" class FileTypeError(IOError): """ Exception reised when nonexistant file type is given. """ def __init__(self, requested, defined):...
0c21b08169f89a31661a7418028be4ee165dc24c3c66deaeeac4d31729055416
Python
864
25
# 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...
61de268be77a8ea98df7b789764437d349ea05ee60312c3aed39827d2ae7d5ec
Python
864
29
import numpy as np import os import merlin from merlin.util import imagereader from merlin.util import dataportal root = os.path.join(os.path.dirname(merlin.__file__), '..', 'test') def test_read_dax(): print(root) dataPortal = dataportal.LocalDataPortal( os.path.join(root, 'auxiliary_files')) d...
c4ba6ac2f8ccb0841937e05147f596fc1b75eb01b28c38d691285c264b8ac239
Python
864
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal from downward.reports.scatter import ScatterPlotReport import common_setup REVS = ["issue214-base", "issue214-v3"] CONFIGS = {"ipdb": ["--search", "astar(ipdb())"]...
36598b1c2f0ab5b62f1e8eb8abe7f9d512e1c459ef0d3001368d3568868f3d68
Python
865
27
import sys import os data_file = open(sys.argv[1]) total_duration = 0 num_samples = 0 total_reads = 0 last_duration = -1 for line in data_file: if " completed reads" in line: total_reads += int(line.strip().split(":")[-1]) continue elif "duration" in line: secs = line.strip().split(":...
425987db2c51a7d1ad594af587837fc15a50199f2b5faf7cd98e8db1a33b9779
Python
865
27
import numpy as np from PIL import Image from scipy.stats import spearmanr def load_images(image_paths): images = [] for path in image_paths: img = Image.open(path).convert('L') img_array = np.array(img) images.append(img_array) return images def calculate_srocc(subject...
c7fa621812ed5d5256bbf012c95cdae497822c3fe26b0661f9a20c6dfcaa5043
Python
865
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal from downward.reports.scatter import ScatterPlotReport import common_setup REVS = ["issue214-base", "issue214-v4"] CONFIGS = {"ipdb": ["--search", "astar(ipdb())"]...
d53d55d91cc0355ce21ce3020ed6eaf5a2a6eaa48474aad5bdaf7c8d6904c49e
Python
865
24
import os import glob import csv from nltools.data import Brain_Data from nltools.mask import expand_mask import pandas as pd mask = Brain_Data('/home/intoumanis/sugar/code/other/AAL3v1.nii') mask_x = expand_mask(mask) # Read all the cropped nifti files, extract the avg BOLD within each ROI and save it in a csv file ...
0b6d5f65a14e0f8c53f97e65dbf28c8a3ac8fb65f3d9feef5cf9d04d16ba20e0
Python
866
27
import os import numpy as np from cmdstanpy import CmdStanModel # example usage for single animal data_path = "/jukebox/witten/yoel/saved_results" mouse_id = 26 data = np.load(os.path.join(data_path, f"behavior_data_mouseid_{mouse_id}.npy")) data_for_stan = { "X": data["X"], "y": data["y"].astype(int), "...
8e99afe2f0a6f55cac560142e8c057806c9f043bba95a8dd5a6f9ed18c5efdc0
Python
866
33
import yaml import sys import argparse import shutil import os import BEBE.evaluation.evaluation as evaluation import BEBE.utils.experiment_setup as experiment_setup import BEBE.training.train_model as train_model def main(config): expanded_config = experiment_setup.experiment_setup(config) model = train_model.tr...
68818cdd8907a8add31d2e065b7061ad89b932d9f20f4bb7f488e628865994ac
Python
867
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal from downward.reports.scatter import ScatterPlotReport import common_setup REVS = ["issue214-base", "issue214-v5"] CONFIGS = {"blind": ["--search", "astar(blind())...
36cea6a8543cdbe71ecffa260c17f7cf656dc810ec50287ab5e413d3d0d91680
Python
868
27
from collections import defaultdict from pddlstream.utils import INF class ActionInfo(object): def __init__(self, terminal=False, p_success=None, overhead=None): """ :param terminal: Indicates the action may require replanning after use """ self.terminal = terminal # TODO: infer f...
9feb9332d000a9a958b6957d0dfc66f4f9b2d10bb450c7979311595c3ac81d38
Python
868
34
"""Standalone GUI launcher for the Point Reorient tool.""" import sys from regtools.gui.app_scaffold import AppScaffold from regtools.point_reorient.gui import PointReorientTab class PointReorientApp(AppScaffold): def __init__(self): super().__init__( title="Xu Lab - Point Reorien...
cb38a174763a2189ad7641c88fe71c617005f6a6238ef2e4086e6140868e0a5e
Python
869
28
from __future__ import annotations from pathlib import Path import pytest from ase.io import read from numpy.testing import assert_equal from quacc.atoms.deformation import make_deformations_from_bulk FILE_DIR = Path(__file__).parent def test_make_deformations_from_bulk(): atoms = read(FILE_DIR / "ZnTe.cif.gz...
6034ce6b1fe277bbb389ce0a4122af252a7858b54ba3de42594ff86c1e78dea3
Python
870
11
#---------------------------------------------------------------------------------------------------------------------------- # Author: Brandon S Coventry CAP Lab Purdue University Weldon School of BME # Date: 09/02/20 # Revision History: N/A # Purpose: This is the setup file to get spiking reinforcement learni...
e40814ddd864573b1e1d1612992cbc81bec040fb4b97a89668c56b4ec9c67cec
Python
870
28
import re import os from pyfaidx import Fasta from otscore import calcCcTopScore for file in os.listdir('../../OT/'): tech = file.split('.')[0] namelst = ['sgID', 'seq', 'mismatch', 'chr', 'strand', 'start', 'end', 'span', 'score'] f = open('OT/' + file, 'w') f.write('{0}\n'.format('\t'.join(namelst))) ...
240da6b43d5d1fe6e4a20647d9249a4660e345ecf72d75fd90dd4cf29484d953
Python
871
36
import coverage import pytest import os import sys WARN_TEXT_COLOR = "\033[93m" WARN_PERCENT = 60 cov = coverage.Coverage() cov.start() retcode = pytest.main(["tests/unit"]) passing = retcode == 0 if len(sys.argv) > 1 and sys.argv[1] == "i": retcode = pytest.main(["tests/integration"]) passing = passing and...
53f3a3cd98b4b84e1728d7b93d709220ef6a4eb850d44c3aa1aefdc954a2b07b
Python
871
31
"""This module contains custom exceptions for Bayesian Optimization.""" from __future__ import annotations __all__ = [ "BayesianOptimizationError", "ConstraintNotSupportedError", "NoValidPointRegisteredError", "NotUniqueError", "TargetSpaceEmptyError", ] class BayesianOptimizationError(Exception...
0aef456d042ded42fa84e731f444199ebc08e1e96cf147c121a05c49afada683
Python
872
32
import os import tempfile import unittest from torcheeg.model_selection import LeaveOneSubjectOut from .test_utils import _make_dataset class TestLeaveOneSubjectOut(unittest.TestCase): def setUp(self): self._directory = tempfile.TemporaryDirectory() self.addCleanup(self._directory.cleanup) ...
bea293c97a1baa9cc5eeedd6e25bc11c5f69a96ef82d97eac2a66ba85634bce4
Python
872
25
import argparse import numpy as np import pandas as pd from scipy import stats # For whole data prediction # loc : mean of standardized expression from train data # scale : 1 def postprocess(x): return stats.norm.cdf(x, loc=0.06201038511068657, scale=1) if __name__ == '__main__': parser = argparse.ArgumentP...
69a71e8f7920bcd1eea3cd712cfb68bd6edc9fa449dcf0498cda228343b7f70e
Python
873
28
import re import os from pyfaidx import Fasta from otscore import calcCropitScore for file in os.listdir('../../OT/'): tech = file.split('.')[0] namelst = ['sgID', 'seq', 'mismatch', 'chr', 'strand', 'start', 'end', 'span', 'score'] f = open('OT/' + file, 'w') f.write('{0}\n'.format('\t'.join(namelst)))...
e19c5ef733dfaffb341e1fb272cf8eac865b3c070619ccca08e352d42bde82b7
Python
873
21
# regtools/tests/test_ccf_session_section_index.py import json from regtools.ccf_boundary_editor.session import save_session, load_session def test_section_index_round_trips(tmp_path): p = tmp_path / "s.json" save_session( str(p), slice_states=[], input_paths={"annotation": "a.nii.gz"}, curren...
2ebb7080751d1a79f4a2165358862459f2c31b7133dd629731cea3d1b2c08d45
Python
874
31
"""CLI flag parsing for the 2D atlas edit mask (--atlas-edit-mask-path / --atlas-edit-fill).""" from regtools.registration.cli import build_parser def test_cli_parses_atlas_edit_flags(): parser = build_parser() args = parser.parse_args( [ "--fixed_image", "t.nii.gz",...
2602cd230348a42d95e8af6aa019f3555190beea37906881d0498146fcddb9fd
Python
875
29
import os os.environ["TORCH_HOME"] = "." import torch from PIL import Image from torchvision import models from cog import BaseRunner, Input, Path WEIGHTS = models.ResNet50_Weights.IMAGENET1K_V1 class Runner(BaseRunner): def setup(self) -> None: self.device = torch.device("cuda" if torch.cuda.is_avail...
4032c7822adf73aff88a377381df93eef3e96a537f40c49513427e4a28face99
Python
875
29
import matplotlib.pyplot as plt def set_style(style='default', w=1, h=1): sdict = { 'default': { 'figure.figsize' : (4.98 * w, 2 * h), 'lines.linewidth': 1, 'lines.markersize': 1.5, 'font.size' : 10, 'legend.frameon' : True, 'font.family'...
6350d4494234bf623f305fb2781bc995751b3aab9643d4697593e9ab34c39461
Python
877
29
"""Helpers for the optional JAX backend.""" from __future__ import annotations from contextlib import contextmanager from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Iterator _JAX_STACK = frozenset({"jax", "jaxlib", "numpyro", "ott", "flax", "optax"}) @contextmanager def jax_impo...
52aff94865e4215b9d35286282754cb0413314524a753d1cb1dfa67e457ef0c8
Python
878
34
import torch from torch_geometric.data import InMemoryDataset class GNNDataset(InMemoryDataset): def __init__(self, root, train=True, transform=None, pre_transform=None, pre_filter=None): super().__init__(root, transform, pre_transform, pre_filter) if train: self.data, self.slices = to...
a842faf27e3799fe284891d7103deab2d8f53d9a0d1c0f2a6b4cae0d3725ec35
Python
878
27
#****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC 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 F...