sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b0bc0009598264fe744d32987a697d2ad522171a248beae458783987158d8649
Python
552
26
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue592-base", "issue592-v2"] SUITE = suites.suite_satisficing() CONFIGS = [ IssueConfig("seq-sat-lama-2011", [], driver_options=["--alias", "seq-sat-lama-2011"]), Issu...
f9172eef7be94c7fba93430bbe6918c1872bb53c662b34c55031390924491388
Python
552
26
import numpy as np class BatchLoader: def __init__(self, batch_size: int = 4): self.batch_size = batch_size self.items = [] @property def full(self) \ -> bool: return len(self.items) >= self.batch_size @property def empty(self) \ -> bool: r...
6fae73c05778a9b92113d41e87c302f8e74d7906bd2dba3d3c1f26cf557745c7
Python
553
18
""" Authored by: Neel Kanwal (neel.kanwal0@gmail.com)""" # This file creates histograms from prediction to better understand ROC plots. # Update paths to processed datasets import matplotlib.pyplot as plt import pandas as pd import numpy as np import os from utils import plot_histogram # Give path to ex...
2340fb2c69a06715548bc254eec970f82573d02ce0bf2ae784fe07fc007056da
Python
554
29
import sys import subprocess from setuptools import setup from setuptools.command.build_ext import build_ext from setuptools.command.build_py import build_py class Build(build_ext): def run(self): if subprocess.call(["make"]) != 0: sys.exit(-1) super().run() class BuildPy(build_py):...
614ac7aca0060deefe04eb8e9bfedae30efbbf714711705093ab27cea336843f
Python
554
22
# Metaparameters for optimization params = {} # Base 2 power to generate Sobol samples params["base2_power"] = 9 # ec.py # Number of particles params["n_particles"] = 2 ** params["base2_power"] # run_pso.py # Number of iterations params["n_gen"] = 1000 # run_pso.py # Total number of models evaluated params["max_ev...
e74b7e5e33b1614db9dbb0405ba55fc63239f36cc71c57d63e2e38caea9452e1
Python
554
21
from elasticai.creator_plugins.grouped_filter import FilterParameters def build_af_parameters() -> list[tuple[FilterParameters, FilterParameters]]: current_channels = 1 params = [] def filter(w, o, s=1): nonlocal current_channels params.append( FilterParameters( ...
6c977fed4ced16bba57d96d7a640acf07871d13df19e32f0d157d13859f76649
Python
555
38
from . import ( assets, blender, color, converters, download, material, nodes, session, ui, utils, ) from .assets import template from .entities import Molecule from .ui.addon import register, unregister try: from .scene import Canvas except ModuleNotFoundError: pass __...
fb530a736ca155d8f773adda71071519f3d3ba9e35f485aecd2aa3f017f24937
Python
555
24
import os import torch import numpy as np def list_of_distances(X, Y): return torch.sum((torch.unsqueeze(X, dim=2) - torch.unsqueeze(Y.t(), dim=0)) ** 2, dim=1) def make_one_hot(target, target_one_hot): target = target.view(-1,1) target_one_hot.zero_() target_one_hot.scatter_(dim=1, index=target, valu...
aa2e49c102766d857b29d43a7df3cd9ba9b8e0fec86499b39ce60d9debbbe5c0
Python
557
15
import APT_interface as apt import PoseUNet_resnet as PoseURes import tensorflow as tf class Pose_mdn_unet(PoseURes.PoseUMDN_resnet): def __init__(self,conf,**kwargs): conf.mdn_use_unet_loss = True PoseURes.PoseUMDN_resnet.__init__(self,conf,**kwargs) if self.name == 'deepnet': ...
21dc43cd1bd363632128731d554bae402d592098b2b74280ad333f2e00e87184
Python
558
22
import shutil from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) def read_requirements_file(filename): req_file_path = path.join(path.dirname(path.realpath(__file__)), filename) with open(req_file_path) as f: return [li...
5ccebfd63cb73d1920d740d67aa463f1e59a2de75eb6680c1e16085bd6af1183
Python
558
17
import os from argparse import ArgumentParser import torch from tqdm import tqdm parser = ArgumentParser() parser.add_argument('--esm_embeddings_path', type=str, default='data/embeddings_output', help='') parser.add_argument('--output_path', type=str, default='data/esm2_3billion_embeddings.pt', help='') args = pars...
9cb62519ae042e90aafb50a2cea651b28aa9d28312fcbe52d40325da50fc8a4d
Python
558
17
# /usr/bin/python2.7 from otscore import calcMitScore for tech in ["5gRNA","12gRNA"]: namelst = ['sgID', 'gRNA', 'OTS', 'Mismatch','Prediction'] f = open('OT/{0}.tab'.format(tech) , 'w') f.write('{0}\n'.format('\t'.join(namelst))) f1 = open('../Data/{0}/POTseq.tab'.format(tech),'r') f1.readline() ...
cba09fc67b8811aed14292527511d66568844b5e8f2637675d9f71d7682464b8
Python
559
21
import nibabel as nib import pickle def save_dict(di_, filename_): with open(filename_, 'wb') as f: pickle.dump(di_, f) def load_dict(filename_): with open(filename_, 'rb') as f: u = pickle._Unpickler(f) u.encoding = 'latin1' ret_di = u.load() #print(p) #ret_di ...
d3aa8379a8af872c8b1a872947d07a0cb9637f42d604729f036eafad8db5cabd
Python
559
18
from wikibaseintegrator.datatypes.string import String class MusicalNotation(String): """ Implements the Wikibase data type 'musical-notation' """ DTYPE = 'musical-notation' PTYPE = 'http://wikiba.se/ontology#MusicalNotation' def set_value(self, value: str | None = None): a...
5456142eb2b31fc04d2630c5d2c63f4bd0d416b096d25ee27ef09e1048f4e6ae
Python
560
24
import sys def main(f): zic1 = '206373_at' probesets = get_probesets() fh = open(f, 'r') for line in fh: if line.startswith("Scan"): print line.rstrip() if line.startswith(zic1): print line.rstrip() for probeset in probesets: if line.startswit...
ff7732a5e7c09d55ac42cc425cdc1f2e88fdcd497b2f034623782b7e8ae3144c
Python
561
19
import torch from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN def test_unetdiscriminatorsn(): """Test arch: UNetDiscriminatorSN.""" # model init and forward (cpu) net = UNetDiscriminatorSN(num_in_ch=3, num_feat=4, skip_connection=True) img = torch.rand((1, 3, 32, 32), dtype=torch....
9785680f5fc450c6741cbbfff19ba06128c5ec27b3d6e6b3f4e8b49c59f505a7
Python
562
24
#! /usr/bin/env python from lab.parser import Parser class CustomParser(Parser): def __init__(self): Parser.__init__(self) self.add_pattern( "num_sga_patterns", "Found (\d+) SGA patterns.", required=False, type=int) self.add_pattern( ...
ccec0cf788caaaa186b1c6e37b3a9dcd2f6e8870819ef1cd0107f43ff3f351a9
Python
562
23
""" Metrics for quantifying stimulus selectivity """ import numpy as np def compute_osi(stimuli, R): """ Orientation Selectivity Index (OSI) Arguments: stimuli (n_stim, ): angles in rad. R (n_stim, ): response/rates Returns: float """ pref = np.where(stimuli == 0)[0][...
d2f8605a70dc27001af047354febc96c91ce95d40c58bf757d24419d1440cbc3
Python
562
25
from __future__ import annotations from pathlib import Path import pytest FILE_DIR = Path(__file__).parent MRCC_DIR = Path(FILE_DIR, "mrcc_run") def mock_execute(self, directory, *args, **kwargs): import gzip with ( gzip.open(MRCC_DIR / "mrcc.out.gz", "rb") as f, open(Path(directory, "mrcc...
e142111a98428f2883fb22ffc6875e2300186efa9465b4e0201e7e7b67804a13
Python
563
21
def disable_logfile_if_none(optimizer, logfile) -> None: if logfile is not None: return current = getattr(optimizer, 'logfile', None) close = getattr(current, 'close', None) if close is not None: close() optimizer.logfile = None def flush_logfile(logfile) -> None: flush = getat...
307369f446ccfc1861a5253fa0529fdc26b0dc291fa23f1074b884438ff3f396
Python
564
22
# Stitching core module - provides stitching algorithms and utilities from .stitcher import Stitcher from .tile import Tile from .run_tissuecyte_stitching_classic import ( create_section_json, get_section_data, stitch_section, generate_tiles, generate_avg_tiles, get_section_avg, ...
fc1ad5a2770c1cfcf05f2a8edc10f8fbdb8ccb482660818e60861c419d72c07e
Python
564
27
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue546-base", "issue546-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "seq_opt_fdss_1": ["--alias", "seq-opt-fdss-1"], "seq_opt_fdss_2": ["--alias", "seq-opt...
9f990f054865a2d249e1d51f41bf0898489eee3ed7487686fb97e6f79d1d8ea8
Python
565
23
import torch.nn as nn class LSTM(nn.Module): def __init__(self, cfg): super(LSTM, self).__init__() self.lstm = nn.LSTM( input_size=cfg.WORD_EMBED_SIZE, hidden_size=cfg.HIDDEN_SIZE, # int(hidden_size / num_directions), num_layers=cfg.NUM_LAYERS, ...
3cbf190023c8d2cf1b1808dcaa8c221ba7124d13ceed43506dbcee4113599918
Python
566
5
from .option import sir_parse2class, class2dict, OptionClass, dict2str, print_dict, infer_json_from_name, AI_parse, save_json, sir_parse2dict, dict2class from .tools import timeblock, WriteOutputTxt, mkdir, mkdirs, mkdir_with_time, get_timestamp, product_of_tuple_elements, set_seed from .image_process import F_cal_aver...
2eb05f03925f563a0e0f5ee29f351a19f7d5cf5979b1e3b47d171f45fbc7655f
Python
567
13
from unittest import TestCase from elasticai.creator_plugins.grouped_filter import FilterParameters class GetInChannelsByGroup(TestCase): def test_two_in_channels_in_two_groups_gets_0_1(self): p = FilterParameters(kernel_size=1, in_channels=2, out_channels=2, groups=2) self.assertEqual(((0,), (1,...
78e48dfd0a8f31cae6ad5c1f8858db85b4a7daee49b2f9faadf4269b03e174c8
Python
567
20
import glob from tqdm import tqdm def flatten_list(list_of_lists): flat_list = [item for sublist in list_of_lists for item in sublist] return flat_list def get_files(path, extension=".wav"): filenames = [] for filename in tqdm(glob.iglob(f"{path}/**/*{extension}", recursive=True)): print(filen...
18e8f8267d52bff9f246a1f22be5ad826f5e21097061ae7c9646dd96533a70ab
Python
568
27
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue546-base", "issue546-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "seq_sat_fdss_1": ["--alias", "seq-sat-fdss-1"], "seq_sat_fdss_2": ["--alias", "seq...
1d28ee8ab886eee34a9329df274b5e6c7d7aec387925b08c623e68c45bb22225
Python
568
24
import tensorflow as tf import numpy as np def create_rot_mat(theta): return tf.constant( [ [1.0, 0.0, 0.0], [0.0, np.cos(theta), -np.sin(theta)], [0.0, np.sin(theta), np.cos(theta)], ], dtype=tf.float32, ) def rotate(x, theta): ndim = x.ndim -...
3e2c8ec16002230a4d2b3bdf6d624bf334325547d8879143eddcbe414156167f
Python
568
17
import json def create_custom_nab_windows_file(dataset: str, full_windows_file_path: str, export_windows_file_path: str): with open(full_windows_file_path) as full_wfile: full_windows = json.load(full_wfile) win_to_export = None for key in full_windows.keys(): if dataset in key: ...
1ed3ecd0bbe7ce3bd08b5679ac60ab8f325e4c32eac80c553a0992af69f6927c
Python
569
28
def filter_opt(opt, tag): ret = { } for k,v in opt.items(): tokens = k.split('.') if tokens[0] == tag: ret['.'.join(tokens[1:])] = v return ret def format_opts(d): ret = [] for k,v in d.items(): if isinstance(v, bool) and v == True: ret = ret + ["--...
c7d966d2827a69539e58ea32ddbe3425756418ef0dfd87f6f48291550168f82a
Python
569
16
import APT_interface as apt import os # Alice's dataset name = 'alice' val_ratio = 0.1 lbl_file = '/home/kabram/Dropbox (HHMI)/temp/multitarget_bubble_expandedbehavior_20180425_FxdErrs_OptoParams20181126_dlstripped.lbl' nviews = 1 for view in range(nviews): conf = apt.create_conf(lbl_file,0,'tfds','/home/kabram/t...
eb4085a7679561d073abc09107311abb259175fcec670435f6f4c7e05939ad08
Python
569
26
from setuptools import setup, find_packages setup( name='deepsramp', version='0.1', packages=find_packages(), install_requires=[ 'torch', 'pandas', 'scikit-learn', 'joblib', 'tqdm', 'matplotlib', 'seaborn', ], entry_points={ 'conso...
c9e8bb41adfea481712bdb06c0338ba5c0aab59285f6f6b2a30bd07cac62d15e
Python
571
19
class NTXent(nn.Module): """ Normalized Temperature-scaled Cross Entropy Loss """ def __init__(self, temperature=1.0): super().__init__() self.sim = nn.CosineSimilarity(dim=-1) self.xent = nn.CrossEntropyLoss() self.temperature = temperature def forward(self, z_candi...
55b66765b7eb1e2eb05f1d011fdbff0e2ac530302cc1c2372b2956735a7a3b33
Python
572
18
from elasticai.creator_plugins.quantized_grads.base_modules import BatchNorm2d from elasticai.creator_plugins.quantized_grads.fixed_point import ( FixedPointConfigV2, QuantizeForwHTE, QuantizeParamToFixedPointHTE, QuantizeParamToFixedPointStochastic, ) def test_batchnorm_fxp_init(): conf = FixedPo...
958a7bfeef6085149d5143b6503ebc6b96f16bc1114341c353f322a6f0b46474
Python
573
24
import unittest class TestLogoMain(unittest.TestCase): def test_imports(self): try: from dreamcoder.domains.logo.main import ( animateSolutions, dreamFromGrammar, list_options, outputDreams, enumerateDreams, ...
07702f0b56916158fbee32100e808da1cd19d8cb991cd96bfef80437a869b33d
Python
574
28
import sys from pybioshell.core.data.sequence import read_ASN1_checkpoint if len(sys.argv) < 2 : print(""" Converts a sequence profile (in ASN.1 format) produced by psiblast to a flat tabular format USAGE: python asn1_to_profile.py input.asn1 EXAMPLE: python asn1_to_profile.py d1or4A_.asn1 CATEGORIES...
17e4a3fca3d1b5593d0c2790e2f1566d99b15919432879292729ae9c5eac6031
Python
574
22
# -*- coding: utf-8 -*- # @Author: Sadamori Kojaku # @Date: 2022-11-04 00:14:13 # @Last Modified by: Sadamori Kojaku # @Last Modified time: 2022-12-11 21:03:06 # %% import belief_propagation import networkx as nx import numpy as np from scipy import sparse # Create a karate club network. A = nx.to_scipy_sparse_mat...
e09c4ad85035a66fa337bd30c5d5477df13d32a319fcd04c145a35ac0f0dd3c3
Python
574
23
"""Survival precision-recall, calibration-slope, and sharpness diagnostics.""" from .area_under_pr_curve import ( auprc_ic, auprc_right_censor, auprc_right_censored_grid, auprc_uncensored_grid, ) from .calibration_slope import ( calibration_slope_interval_censor, calibration_slope_right_censor,...
e708b45fd4cd58bd8fd0977178fdfe6268da339edcbf62a360eefa749bc27d35
Python
574
29
from elasticai.creator.vhdl.design.signal import Signal def x(width: int) -> Signal: return Signal(name="x", width=width) def done() -> Signal: return Signal(name="done", width=0) def enable() -> Signal: return Signal(name="enable", width=0) def clock() -> Signal: return Signal(name="clock", wid...
3d53e8a01d233f986464450b482c02d3be39df65056d1d8fb60bb4239cf0982b
Python
575
24
#!/usr/bin/env python """ requests.certs ~~~~~~~~~~~~~~ This module returns the preferred default CA certificate bundle. There is only one — the one from the certifi package. If you are packaging Requests, e.g., for a Linux distribution or a managed environment, you can change the definition of where() to return a s...
8809debc06fa0291ba804663215703430dcac5bddf138824caa5d27b29d461f9
Python
575
24
"""Error handling module for HED.""" from .error_reporter import ( ErrorHandler, separate_issues, get_printable_issue_string, get_printable_issue_string_html, check_for_any_errors, sort_issues, iter_errors, ) from .error_types import ( DefinitionErrors, TemporalErrors, SchemaErr...
ab8ffaf6ba41aeaab859122b56bbc982726222debc7215c35fdc86a8e84ad072
Python
576
13
from unittest import TestCase from codex.data.neurotransmitters import lookup_nt_type, NEURO_TRANSMITTER_NAMES class NtTest(TestCase): def test_lookup_nt_type(self): for nt in NEURO_TRANSMITTER_NAMES.keys(): self.assertEqual(nt, lookup_nt_type(nt.lower())) self.assertEqual(nt, look...
b2629417c9568d5b264a66767fe1c94dfd7fc4f2244a9188b031da017292928d
Python
576
15
import Pose_openpose import open_pose4 as op class Pose_multi_openpose(Pose_openpose.Pose_openpose): def __init__(self,conf,name='deepnet',**kwargs): super(Pose_multi_openpose,self).__init__(conf,name=name,**kwargs) self.conf.is_multi = True def get_pred_fn(self,model_file=None,max_n=None,imsz...
b2d884862cba49b192281adff5a2d6510eaef6b66f5dd65809bf4303e643878e
Python
576
26
""" Adjoint-based sensitivity-analysis module for pymeep. Authors: Homer Reid <homer@homerreid.com>, Alec Hammond <alec.hammond@gatech.edu>, Ian Williamson <iwill@google.com> """ from .objective import * from . import utils from .utils import DesignRegion from .basis import BilinearInterpolationBasis from .optimiza...
e857afbb07f4725c0118083d403189d5d3e00295468d29895eb16f65f7a17e0c
Python
576
26
""" Set of utilities for segmentation and analysis of n-dimensional images. # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 02.04.14 """ __author__ = 'martinez' __version__ = "$Revision: 001 $" from . import pexceptions from . import disperse_io from . import graph from . import vt...
51ea3a0e5e587951444affebcf6c89c1afbd703bcc6a8b23dc2834a3de8c5797
Python
577
22
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Nov 5 11:32:39 2023 @author: benozzo """ import numpy as np from scipy import stats, linalg def computeS(A, sigma2): #from Casti et al., 2023 (CDC2023) nS = A.shape[0] Q = sigma2 * np.diag(np.ones(nS)) Sigma = - linalg.solve_continuous...
5539929a66c99db7c1ceaab04154a1cc328487b83da0de3c7bccc33ecf449133
Python
577
26
# Logistic Regression from sklearn.linear_model import LogisticRegression # Decision Trees from sklearn.tree import DecisionTreeClassifier # Random Forest from sklearn.ensemble import RandomForestClassifier # Support Vector Machines from sklearn.svm import SVC # Imbalance Random Forest from imblearn.ensemble import...
9b97be149286eda4b9190e03ac024bef2252d46f3aa98ef3fcd76cb6f9a251df
Python
579
19
''' python setup.py build_ext -i to compile ''' from distutils.core import setup, Extension from Cython.Build import cythonize from Cython.Distutils import build_ext import numpy setup( name='Sim3DR_Cython', # not the package name cmdclass={'build_ext': build_ext}, ext_modules=[Extension("Sim3DR_Cython",...
a717fa5d80886839b289ffb1cd34bf3e998154d6e2318a78b0bc3224196555cc
Python
579
26
#!/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 * diagramfile = sys.argv[1] posfile = sys.argv[2] plotfile = sys.argv[3] with open(diagramfile) as f: diagram = ya...
2fb28b16d5a3621a777d4898c571570c6fe289a9ee68c2cb7c6dda593204a5d3
Python
580
21
"""Test measure functions defined like SNR.""" import pytest from console.utilities.snr import signal_to_noise_ratio @pytest.mark.parametrize("noise_snr", [ (0.2, 41.1), (0.5, 32.7), (1.0, 26.8) ]) def test_snr_calculation(noise_snr, test_spectrum): """Test snr calculation.""" num_samples = 400 ...
9bc3296fb2359f447d6a3187e2dcd312738388f2fc4ea4eef4e9dee604010751
Python
580
23
#Path hack. import sys; import os sys.path.insert(0, os.path.abspath('..')) from volume import * from mysql import db class task: def __init__(self, id): self.id = id self.local = True self.channel_id , self.segmentation_id = db.query("select channel_id, segmentation_id from tasks where id="+str(...
f17e75b4c36f560df99bbce16b889a275235630cf5f9eb18628ac682d8d4b20b
Python
580
26
import numpy as np from median.median import Median def test_init(): buff = np.array([0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7, 7, 7, 8, 9]) print(len(buff)) assert len(buff) % 2 == 1 buff = Median(initB=buff) def test_int(): data = np.random.default_rng().integers(0, 5, size=30) # data = np.array([...
69c81fb1e382e7974dad50336812a95221f767a57b43509ac6c890dcaee90be1
Python
581
23
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2022 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import logging __version__ = '0.3.6' class DistlibException(Exception): pass try: from logging import NullHandler except Impor...
8850c9e61b7e3c79cd0aef3bcf90e1501056255c31ddd97f7019d1e0796236e6
Python
581
22
""" Set of processes for being in mult-processor mode within spatial package # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 11.01.17 """ __author__ = 'martinez' ####### HELPING FUNCTIONS ####### PROCESSES # Radial Averaged Fourier Transform alone process # points: array with poi...
9aafb43130d72ce094a4543de787498fd4fe7f19ba63fc9485c23da8c289755c
Python
581
25
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)) ...
d8e849414b4ec6ca1658d1ea07bccba03fa50424c67d1d38e5a14973ab00aa8f
Python
581
21
import numpy as np def get_label(layer, event): cords = np.round(layer.coordinates).astype(np.int16) val = layer.get_value() if val is None: return if val != 0: if 'Shift' in event.modifiers: layer.selected_label = val elif layer.mode =='pan_zoom': data =...
fd9159859a260c156fa3111d57ec683485c871ee9580f1e8eb2399dbd601727c
Python
581
17
import unittest import torch # local imports from shapelearningtheory.analysis.gradients import * class TestJacobian(unittest.TestCase): def test_identity(self): net = torch.nn.Identity() batchsize = 4 height = 8 width = 6 channels = 3 x = torch.randn(batchsize, chan...
cbe80c1fdcdd76c2821f3e76ccf92342be9415b858e1033f31b3b30401715bb5
Python
582
29
# external import pytest # project import textdistance ALG = textdistance.MLIPNS @pytest.mark.parametrize('left, right, expected', [ ('', '', 1), ('a', '', 0), ('', 'a', 0), ('a', 'a', 1), ('ab', 'a', 1), ('abc', 'abc', 1), ('abc', 'abcde', 1), ('abcg', 'abcdeg', 1), ('abcg', 'a...
aa59a1df6e520557ef1ba31ef6073936c879b1dc07070cc706ae9a117b4ab0b0
Python
583
20
from typing import Callable, List, Optional from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet InstallRequirementProvider = Callable[ [str, Optional[InstallRequirement]], InstallRequirement ] class BaseResolver: def resolve( self, root_r...
e495c18db3417e107ce2cb7f0ed9335961fc8b8645ca3e2706ebdae2c29b6c8f
Python
583
25
"""Package containing Qt widgets. The program is organized in widgets. Roughly one widget is stored in one module. A module should start by importing: - packages that are in the Python library - additional packages (in this order: numpy, scipy, PyQt5) - relative imports Leave an empty line between each group of ...
356cf0d354b3eb486b91a7f8ffcdb6cfbdcb8b7ace3cb89c7c5ea9ee65ccb8d9
Python
584
28
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v3"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("seq-opt-bjolp...
356ef1dacfec4ecf3b8a068765bb7a77d58ef42975c784fef1e19eea86115b72
Python
584
25
import pandas as pd import numpy as np import h5py df = pd.read_csv('test_sequences.txt', delimiter = "\t", header=None) print(df.head()) df.columns = ['sequences', 'expression'] df = df.drop(['expression'], axis=1) with h5py.File(('test_seq_onehot.h5'), 'r') as hf: X = hf['test_seq_onehot'][:] from tensorflow i...
44a98869a21c5243869b5d39af2ca9f8ff8f3831b05948b33cc870d2932423e6
Python
584
28
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v1"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("seq-opt-bjolp...
f7bbb79976a7e71b60079609f860f2887cd10d738e73b3a8ca00801c461cbd26
Python
584
28
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v2"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("seq-opt-bjolp...
1454e7b813487f49136ab276d8b1897d8b6a22ce04a925872cddbd2dcb276a92
Python
585
22
#!/bin/env python """ OXASL - Brain extraction Copyright (c) 2008 University of Nottingham """ import fsl.wrappers as fsl def brain(wsp, img, thresh=0.5): """ Extract brain from wholehead image """ bet_result = fsl.bet(img, seg=True, mask=False, fracintensity=thresh, output=fsl.LOAD, log=wsp.fsllog) ...
b36c8863922892bdd33759b7f07ada486db02b36871bd158fa559c94fb43db4e
Python
585
19
import os import sys sam_path = sys.argv[1] modified_sam_path = sys.argv[2] sam_file = open(sam_path) modified_sam_file = open(modified_sam_path, 'w') for line in sam_file: if line.startswith('@'): line = line.strip() modified_sam_file.write(line + '\n') else: fields = line.strip().sp...
78fb6c6feaa9960ad1d9facc4842ebd4459f4aac2ecd84e9d43f56870b18e174
Python
586
18
# -*- coding: utf-8 -*- from tempfile import TemporaryDirectory def test_help_option(script_runner): ret = script_runner.run(['dcm2bids_helper', '--help']) assert ret.success def test_helper(script_runner): i_tmpDir = TemporaryDirectory() o_tmpDir = TemporaryDirectory() ret = script_runner.run(...
4a80a243b5c4f5e682be7057a8bbb78dafc093fc169fa606301ea9ad6c382fd6
Python
587
30
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue67-v1-base", "issue67-v1"] SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_blind": [ "--search", "astar(blind())"], "astar_lmcut": [ "--search", "astar(lm...
b54759d49a4b5c7318dfe6ea0513c1720fb737929d9fafe81198b26d5b4c90c2
Python
587
17
from ._version import __version__ from .flagio import load_unweighted_flag, load_weighted_flag, \ save_unweighted_flag, save_weighted_flag from .flagser import flagser_unweighted, flagser_weighted from .flagser_count import flagser_count_unweighted, \ flagser_count_weighted __all__ = ['load_unweighted_flag', ...
6e1c6768373da2ab6254f6e1ac2cd6f4492c11bbdbe4e404d89a4010691a9e61
Python
588
12
import bsub import os nconfigs = 19 outdir = '/groups/branson/home/bransonk/tracking/code/APT_develop/deepnet/bsubout' cwd = os.path.dirname(os.path.abspath(__file__)) for cfgi in range(4,5): jobname = f'mem{cfgi:02d}' logfile = os.path.join(outdir,f'{jobname}.log') errfile = os.path.join(outdir,f'{jobname...
1113d0ecf9e93da85b94e24f28ec8ef51a81e4d5b7d060a7147e75caa301371e
Python
590
22
from elasticai.creator.hdl_ir import ( IrFactory, collect_transitive_implementation_closure, ) from elasticai.creator.ir import Registry factory = IrFactory() def test_can_remove_dead_implementations_from_reg(): g = factory.graph() reg = Registry( main=g.add_nodes( factory.node("a...
69e3758c342712904b8881d5d39be0f7b5c2b1715e7d20c8f0db583267a01033
Python
590
26
"""Utility methods and class for fingerprinting-related functions. Author: Seth Axen E-mail: seth.axen@gmail.com """ from ..util import E3FPError class E3FPInvalidFingerprintError(E3FPError, TypeError): """Fingerprint is incorrectly formatted.""" class E3FPMolError(E3FPError, TypeError): """Mol is of incor...
a7d7244bbf83728be29539addc9e7e98a20d0aba326bc75a935550492630a3ef
Python
590
10
# 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 ...
f21f05f86d5b02feea360369bf11a4e33da45cc10203d16992494088f383bd85
Python
591
25
import meep as mp cell_size = mp.Vector3(6, 6, 0) geometry1 = [ mp.Cylinder(center=mp.Vector3(), radius=1.0, material=mp.Medium(index=3.5)) ] sim1 = mp.Simulation(cell_size=cell_size, geometry=geometry1, resolution=20) sim1.init_sim() geometry2 = [ mp.Cylinder(center=mp.Vector3(1, 1), radius=1.0, material=...
aceb71e05536dfa87495e03e80ea480b6d2cf2e0254368c261140d5d011ef4db
Python
592
14
""" Task class: This class specifies the task variables """ class Task: """ This class specifies the instance variables and methods of the object-based memory task """ def __init__(self): """ This function defines the instance variables unique to each instance """ self.n_days = 21 # number ...
39fbb11c0e296d8c6258573af507c7eb44f524e32e0598073e28e2c4cc46c16c
Python
593
21
from sklearn.feature_selection import VarianceThreshold def low_variance_feature_selection(X, threshold): """ This function implements the low_variance feature selection (existing method in scikit-learn) Input ----- X: {numpy array}, shape (n_samples, n_features) input data p:{float} ...
a11f5f01bb59ceada7f4f010f8a8434babb4b77b2dd9732a548a08804ace6b59
Python
593
25
from .features import OptopatchGlobalFeatureExtractor from .utils import \ crop_center, \ generate_optimizer, \ generate_lr_scheduler, \ get_nn_spatio_temporal_mean, \ get_nn_spatial_mean, \ pad_images_torch from .ws import \ OptopatchBaseWorkspace, \ OptopatchDenoisingWorkspace __all...
2c9803722a2e70f656dded0ecc5097cd3c8554da1b258cf37e026f93d15988d4
Python
594
26
#! /usr/bin/env python # -*- coding: utf-8 -*- import downward.suites import common_setup import configs CONFIGS = configs.default_configs_optimal(ipc=False, extended=False) print(sorted(CONFIGS.keys())) print(len(CONFIGS)) SUITE = downward.suites.suite_optimal_with_ipc11() SCATTER_ATTRIBUTES = ["total_time"] exp...
5dc529acc772bef71e61a65307cf20c0836451dfa529d6ae624088085cbd4603
Python
594
24
NEURO_TRANSMITTER_NAMES = { "DA": "dopamine", "SER": "serotonin", "GABA": "gabaergic", "GLUT": "glutamate", "ACH": "acetylcholine", "OCT": "octopamine", } def lookup_nt_type(txt): if txt: if txt.upper() in NEURO_TRANSMITTER_NAMES: return txt.upper() txt_low = tx...
9f0d35861796bcccb93b9e1407db9e2990ad28a9260bb9c3a8f8fda408446204
Python
594
21
import uuid from queso.sensors.pennylane.sensor import brick_wall_probe from queso.sensors.pennylane.sensor import Interaction, Measurement, Sensor from queso.sensors.pennylane.sensor import Phase, U3 def test_calculate_state(): n_layers = 2 n = 4 probe = brick_wall_probe(n=n, d=2, n_layers=n_layers) ...
10e985e8bff5a23c7b04f104ae1beb6365d0280a33b1e3fbe20806956219db4d
Python
595
21
from .cross_validate import chemprop_train, cross_validate, TRAIN_LOGGER_NAME from .evaluate import evaluate, evaluate_predictions from .make_predictions import chemprop_predict, make_predictions from .molecule_fingerprint import chemprop_fingerprint from .predict import predict from .run_training import run_training f...
2398948b51875e075c7d16b4c2ec72bcc2b020250b404a8eb54df16d8361a2bc
Python
595
21
from __future__ import annotations import pytest pytest.importorskip("tblite.ase") pytest.importorskip("phonopy") pytest.importorskip("seekpath") from ase.build import bulk from quacc.recipes.tblite.phonons import phonon_flow def test_phonon_flow(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) atoms =...
951ac2c57466a8158419e63fea0bc97f36683c0ffef214100e4ea97416d06a69
Python
595
29
import sys from pybioshell.core.data.io import read_scorefile if len(sys.argv) < 2 : print(""" Simple example that parses a score file (Rosetta output) USAGE: python3 read_scorefile.py score-file EXAMPLE: python3 read_scorefile.py scores.sf CATEGORIES: core/data/io/read_scorefile KEYWORDS: scorefile i...
9f713fb17558d7d206285e107a0994415f6ce5f24918ca7a3774223d831906b4
Python
595
24
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Compute basic topological network properites of a connectome and its controls Author(s): Daniela Egas S. Last updated: 12.2023 ''' import json import sys sys.path.append('../../../library') from structural_basi...
ac2f73a0cec006d670d7f8abfbf63f66e114287e722300825ce09946ff389319
Python
595
27
from setuptools import setup requirements = [ "numpy", "scanpy", "numba", "pandas", "scikit-learn", "scipy", "seaborn", "matplotlib", "pytest", "torch" ] setup( name="Annotatability", version="0.0.5", packages=["Annotatability"], url="https://github.com/nitzanla...
c460eb5d810f4b4ebcecd876386323475dd15a6927bad5e5b16d8024acf738cf
Python
595
16
#!/usr/bin/env python # -*- coding: utf-8 -*- from plot_methods import os, plt, plotMorphologyTable from cellsim16popsParams_default import multicompartment_params import analysis_params if __name__ == '__main__': params = multicompartment_params() ana_params = analysis_params.params() ana_params.set_PLOS_...
e86ae88ae488a7e889f4aab504fd89b7f68bb25075b079dbeee1c2054a1f3df0
Python
595
28
"""Software for fitting HMP on EEG/MEG data.""" from importlib.metadata import PackageNotFoundError, version from . import ( basedata, crossvalidation, distributions, estimators, io, models, patterndata, patterns, projectors, utils, visu, ) try: __version__ = version("...
b7b659c6cc1df3a092a4a5df68e9ae25f137765744d4c49604beec9bc3993e6d
Python
599
14
# Copyright (c) OpenMMLab. All rights reserved. from .backbones import * # noqa: F401,F403 from .builder import (BACKBONES, CLASSIFIERS, HEADS, LOSSES, NECKS, build_backbone, build_classifier, build_head, build_loss, build_neck) from .classifiers import * # noqa: F401,F403 ...
701744b709be2312a292f0710a47872fabf014f564b5bebfe348102622ac6c4d
Python
600
22
# This document contains plot utilities def latex_plt(matplotlib): """ This function updates the matplotlib library to use Latex and changes some default plot parameters :param matplotlib: matplotlib instance :return: Updated matplotlib instance """ pgf_with_latex = { "axes.labelsize": 6,...
ef33e695b0a870ceb618c9b996262e60350a31293b9de9c19263864e492906b3
Python
601
22
"""Setup pyprep.""" import sys from setuptools import setup import versioneer # Give setuptools a hint to complain if it's too old a version # 30.3.0 allows us to put most metadata in setup.cfg # 38.3.0 contains most setup.cfg bugfixes # Should match pyproject.toml SETUP_REQUIRES = ["setuptools >= 38.3.0"] # This e...
28cc315766cf7a1dfc9da394c6ed4ca787be52dc747f24a7767d4b88e2e1a754
Python
602
16
from .resnet import * from .mobilenet_v2 import * from config import visual_backbone_list def get_visual_backbone(args): if args.visual_backbone in visual_backbone_list: model = eval(args.visual_backbone)() if args.pretrain_vis_path !="": model.load_model(pretrain=args.pretrain_vis_pat...
3e2678573374406cee85967c0d1c37a3805e1512ca1cda0d27e8cb9374a16991
Python
602
24
import numpy as np from typing import Tuple """ This module contains Matlab functions that do not have equivalents in python libraries. """ def matlab_gauss2D(shape: Tuple[int, int]=(3, 3), sigma: float=0.5 ) -> np.array: """ 2D gaussian mask - should give the same result as MATLAB's ...
67d3a86c13f11fe4011d55d76b9cd50580f9b297db1e0057fce8122a7495bc62
Python
602
18
import torch import torch.nn.functional as F def gram_schmidt(vectors): orthogonalized = [] for vector in vectors: for ortho_vector in orthogonalized: projection = torch.dot(vector, ortho_vector) / torch.dot(ortho_vector, ortho_vector) vector = vector - projection * ortho_vector...
8328270005ddb59b86573f0587a1cfa9ce50bb2971f846f0e4ba05767fbfd357
Python
602
21
from numpy import array def read_gene_indices(path: str): with open(path, "r") as f: lines = f.readlines() assert ( len(lines) % 3 == 0 ), f"number of lines in {path} needs to be a multiple of 3" triples = [lines[i * 3 : (i + 1) * 3] for i in range(int(len(lines) / 3))] gene_indi...
c0a3fa784b78aa5700799c1f554fc96ca51cadf4902a45b84a05239469b9d132
Python
602
20
from typing import Protocol import torch from torch import Tensor, nn from elasticai.creator.base_modules.math_operations import Quantize class MathOperations(Quantize, Protocol): ... class LeakyReLU(torch.nn.LeakyReLU): def __init__(self, mathops: MathOperations, init: float = 1e-2) -> None: super()....
ca38ea85d2de714501f53ec6797ccc65b0164cc4d901799d97dc479f93782332
Python
602
26
import torch from elasticai.creator_plugins.quantized_grads.base_modules import Linear from elasticai.creator_plugins.quantized_grads.fixed_point import ( FixedPointConfigV2, QuantizeForwHTE, QuantizeParamToFixedPointHTE, QuantizeParamToFixedPointStochastic, ) def test_conv1d_fxp_init(): conf = F...
eaa3a90e01008653cbe059e421e2bd9772b0b9278673d3b140a0ba00e243f71a
Python
602
19
import torch from .conv1d import MathOperations as Conv1dOps from .linear import MathOperations as LinearOps from .lstm_cell import MathOperations as LSTMOps class TorchMathOperations(LinearOps, Conv1dOps, LSTMOps): def quantize(self, a: torch.Tensor) -> torch.Tensor: return a def add(self, a: torch...
f7f7b6a5c3c92344af7f2293d6947564e7fac844120577b16c7516f50768f1e5
Python
602
20
from typing import Any import torch class Binarize(torch.autograd.Function): @staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: if len(args) == 0: raise TypeError x = args[0] out_of_range = torch.logical_or(torch.gt(x, 1.0), torch.lt(x, -1.0)) c...
5c02cebd70c1d5ef4c5f5113115909a09c4430823191e12d492d8d7b6de2eb37
Python
604
19
''' Adopted: DeeperCut by Eldar Insafutdinov https://github.com/eldar/pose-tensorflow ''' def pose_net(cfg): net_type = cfg.net_type if 'mobilenet' in net_type: print("Initializing MobileNet") from deeplabcut.pose_estimation_tensorflow.nnet.pose_net_mobilenet import PoseNet cls = PoseNe...
240cc958fadcb25673ca5eabb25676c11afd4eea06a621718d3f07dbd61cb5d4
Python
605
22
from math import sqrt # Spherical harmonics SPHERICAL_HARMONICS_LMAX = 10 # Maximum angular momentum for spherical harmonics # pairs info BASE_TRANSLATIONS = 20 # Assume all primitive translations are within [-BASE//2, BASE//2) # two-center integrals TWOCENTER_RGRID_DEN = 100. / 12. # 100 points at 12 bohr AOFT_QGR...