sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fb020130a2e9dcff74ce2c47a341bd61ce83a4fce3b5f08a53a020e0947a86c3 | Python | 1,043 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
099eab26c3edfceb5d2e10f108b26e24c21ea97dc274de289dfa7c455989c8f6 | Python | 1,044 | 40 | """
test advanced stimulus waveform generation.
"""
from imports import *
plt.style.use('bmh')
COLORBLIND_COLORS = ['#377eb8', '#ff7f00', '#4daf4a', '#f781bf',
'#a65628', '#984ea3', '#999999', '#e41a1c', '#dede00']
if __name__ == "__main__":
abf = pyabf.ABF(PATH_DATA+"/18702001-biphasicTra... |
1700ea03edf164a61af9d408919b1ee3915962c8df18fcc24525c552ba4acb97 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
29fafbb89f37ef890c366702df3977586eb740a1741426c4efddbcc124cd9439 | Python | 1,044 | 29 | from unittest import mock
from carbonserver.api.infra.repositories.repository_telemetry import (
SqlAlchemyRepository,
)
from carbonserver.api.schemas_telemetry import TelemetryCreate
from carbonserver.api.services.telemetry_service import TelemetryService
TELEMETRY_ID = "f52fe339-164d-4c2b-a8c0-f562dfce066d"
d... |
320d9717c56fac7aa26198f5082116d3311ecef32c7d1aaef7f5b0f363a49c1d | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 1 * msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
36f8c88a9b9894bea76db34e5e321dd6fe7b17a639e590a6672594b3cca85ba1 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
3f940b6ba6efe2df20f5cbd0e25c9d2359ed97fb467e679271b2d7b23b1b545a | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
4fe054d4cd008599ca9ba77328805f6256d010a54629843676f31b32f61d2bd5 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
59dad0dc87fb394a463af958f064fbbe5afb6f5196d52481b6646d93d686c0ce | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
65984d3930b899fb2a5eca0d54aea5af5304abab7a58fe695978e94aafc53187 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
6c02195dd024ac1cad232865c231261c36c1859c62d44d5e447691a40747a5cf | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 1 * msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
72c596f5bef26b11d6bbb4b17392545d0d08999321deae7b9ac9b1974f4a363e | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
8a46e791c347983901ad04863242b72bdf6a674553685bad217107c4d7aaeb2a | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
9a5a2de4491195c0bc2650471e403ccab25636fe91f30f8602cf91370b7ef3c4 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
a9575c54cbaf46f6eac51800598403dd4c397e45aabf36399e0480fa44f518c4 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
ca7a20be8b1a33b9f507341545521b4e5083a6f39a9cd0ea265f12cfdfbb8c14 | Python | 1,044 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec... |
d31e8d17e37252aeac605dcdcf30385c686f4d4ab00cea7e8d8647e66c099667 | Python | 1,044 | 42 | import os
import sys
import torch
from diffusers import FluxPipeline
model_path = sys.argv[1]
prompt_type = sys.argv[2]
if prompt_type == "file":
with open(sys.argv[3], "r") as f:
prompt = f.read().strip()
elif prompt_type == "text":
prompt = sys.argv[3]
print(f"Creating image from prompt: {prompt}")... |
071129665a9ba9a01702d982c36b0271d1a9401bdad98850ed8f1f4b2f5bed36 | Python | 1,045 | 35 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._contours import Contours
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._marker import Marker
from ._textfont import Textfo... |
1662e148d6b7ed9a93e3eb8c0c2668d9fdfd5e47bb7ad680957434f28b8887af | Python | 1,045 | 27 | """Example program to demonstrate how to send a multi-channel time series to
LSL."""
import time
from random import random as rand
from pylsl import StreamInfo, StreamOutlet
# first create a new stream info (here we set the name to BioSemi,
# the content-type to EEG, 8 channels, 100 Hz, and float-valued data) The
# ... |
5b90c0e8545df8ea69791285823da0b4ba8dbe391790240f995ea583710dbbe7 | Python | 1,045 | 33 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for loss"""
import unittest
from sknetwork.gnn.loss import *
class TestLoss(unittest.TestCase):
def test_get_loss(self):
self.assertTrue(isinstance(get_loss('CrossEntropy'), CrossEntropy))
self.assertTrue(isinstance(get_loss('BinaryCrossEn... |
61c9e43402cbf370e474df9879fb6cae10731337227b5c4cbb4e6c4de981ef25 | Python | 1,045 | 32 | import setuptools
from distutils.core import setup
with open("psychrnn/_version.py", "r") as f:
exec(f.read())
with open("README.md", "r") as f:
long_desc = f.read()
setup(
name='PsychRNN',
version=__version__,
packages=['psychrnn', 'psychrnn.tasks', 'psychrnn.backend', 'psychrnn.backend.models'... |
665f65717756e6938ecc2ea1c794f84259eca75923936172b12f22e3902d1b34 | Python | 1,045 | 26 | import torch
import torch.nn as nn
class CLF(nn.Module):
def __init__(self, feat_dim, num_layers, hidden_size, n_class):
""" Simple MLP Classifier (num_layers=0 for linear classifier) """
super(CLF, self).__init__()
input_size = feat_dim
self.num_layers = num_layers
if num_l... |
8bc45fc3983e582823ee62278fff554c00ce1e74549e5021ae48f95a89ed562e | Python | 1,045 | 38 | import os
import sys
import math
import pickle
from typing import Dict, List
from dataclasses import dataclass, field
import numpy as np
import matplotlib
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import pyprojroot
code_root_dir = str(pyprojroot.here())
pack_dir = f"{code_root_dir}/package/... |
2b336f2434001df65cce34089e07b4d930ba54ee4745fb6fc0c8fd53bc5b9599 | Python | 1,046 | 43 | """ Layer/Module Helpers
Hacked together by / Copyright 2020 Ross Wightman
"""
from itertools import repeat
import collections.abc
# From PyTorch internals
def _ntuple(n):
def parse(x):
if isinstance(x, collections.abc.Iterable) and not isinstance(x, str):
return x
return tuple(repeat... |
49a7d5bfab644a4abb004c036e1d8c8738668c54368fefab41081fb3a0e45425 | Python | 1,046 | 26 | from src.models.mmvae_cmnist_oscn import MMVAE_CMNIST_OSCN
from src.models.vae_mnist import VAE_MNIST
from src.models.vae_cmnist import VAE_CMNIST
from src.models.vae_oscn import VAE_OSCN
from src.models.classifier_oscn import Classifier_OSCN as Classifier_OSCN
from src.models.classifier_cmnist import Classifier_CMNIST... |
5bc9542284b4dfc6cdb2ab455c160126e3f49f46e234277b6595030655679f9c | Python | 1,046 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="S... |
88667158b1117a97e8abec80a5823c28dcbfbaea2e7de008bbcaffa95f4917ec | Python | 1,046 | 31 | from ._ai_assist import AiAssistProposal
from ._ai_assist import AiAssistSession
from ._geometry import shape_to_xyxy_bbox
from ._osam_session import get_osam_session
from ._osam_session import release_osam_session
from ._shape_builders import MASK_REQUIRED_SHAPE_TYPES
from ._shape_builders import Detection
from ._shap... |
93fb9d48ceef005c85ddc52162ec150b73bc05ef93d59bb403f68da2b7589ff9 | Python | 1,046 | 39 | '''
Plot Heatmap
'''
import sys, os
os.chdir('/home/obanmarcos/Balseiro/DeepOPT/')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
from scipy.interpolate import griddata
import scipy as sp
K_layers = pd.read_csv('./results/HyperParams.csv')
K_layers_psnr = np.array((K_la... |
c9882da3c24e9a7160adefe90316483897f052a02ed921fb53f7b3a82e4d4b98 | Python | 1,046 | 37 | from datetime import datetime, timezone
from pathlib import Path
def ensure_dir(path: Path | str) -> Path:
"""A thin shim over the Path class.
Creates a directory if it doesn't exist and
returns the resolved and expanded path
to that directory.
Args:
path: A directory as a path or a stri... |
091c54c1adade33464a8df948e867221508d688ea05347bcfc608b61ab681f31 | Python | 1,047 | 36 | # -*- coding: utf-8 -*-
from galaxy.datatypes.data import Text
from galaxy.datatypes.data import get_file_peek
import json
import os
class Json( Text ):
file_ext = "json"
def set_peek( self, dataset, is_multi_byte=False ):
if not dataset.dataset.purged:
dataset.peek = get_file... |
0f82f7e19321acf0ea25d9ac76313bad6d6a313ad2a04a1e5ab2875fe5eb9ff3 | Python | 1,047 | 45 | from __future__ import unicode_literals
import os
import sys
import urllib
import wget
import traceback
import uuid
import gzip
import zlib
import json
import numpy
import requests
import re
import copy
from copy import deepcopy
from collections import OrderedDict
try:
import pandas as pd
except ImportError:
... |
28c4aa5926d07d9061b81e516e1292918e4750a9552fccd82d267800fb1205d1 | Python | 1,047 | 55 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 27 00:29:42 2017
@author: Ce Gao
@author: Rong Chen
"""
# pylint: disable=C0103
# Disable module level constant name checking
import sys
import logging
# Local module
from .view import View
from .sequence import Sequences
from .configs import configs
from .blast import ... |
330bb3831c85f2ab64ee99588a81a3b5673010ec15abef98cd28b3f9cf6936a7 | Python | 1,047 | 31 | from __future__ import annotations
import platform
import sys
import sysconfig
import pytest
LINUX = sys.platform.startswith("linux")
MACOS = sys.platform.startswith("darwin")
WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin")
CPYTHON = platform.python_implementation() == "CPython"
PYPY = p... |
9301ce2d9167393ad1862123b5cc004d886c5db7f97bccd5d4e0a810ab86f198 | Python | 1,047 | 38 | #!/usr/bin/env python3
import contextlib
import signal
import warnings
class TimeOut(contextlib.ContextDecorator):
"""
Timeout context manager/decorator.
Adapted from https://gist.github.com/TySkby/143190ad1b88c6115597c45f996b030c on 12/10/2020.
Examples
--------
>>> from time import sleep
... |
93c6f7714e91cb5895f1bac373a11ec6ceb4b07d09ebf1239c998db286cc4e4e | Python | 1,047 | 29 | # -*- coding: utf-8 -*-
'''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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/LI... |
f5a7c049df2fd8b1397923f1285bb6361bd475b8a38467463b23ea780da0cfa6 | Python | 1,047 | 44 | """Add cleanup_event_user_assoc table
Revision ID: 338d0e5deb03
Revises: c44ae5f3dcf1
Create Date: 2025-07-02 13:59:34.849280
"""
import logging
import sqlalchemy as sa
from galaxy.model.migrations.util import (
create_table,
drop_table,
table_exists,
)
log = logging.getLogger(__name__)
# revision id... |
f8f08f6e55a91c6b3be7ce78fce779fdd8de64343682615f61fbeb63ade5f84f | Python | 1,047 | 31 | """
Author: Bruno De Santi, PhD
Affiliation: Multi-modality Medical Imaging Lab (M3I Lab), University of Twente, Enschede, The Netherlands
Date: 20/09/2023
Description: Functions for loading reconstructions and cup masks (.mat)
Paper/Project Title: Automated three-dimensional image registration for longitudinal photo... |
8f310435236775699683a3c219d30538585f1a875d17f8a46b8e03cc203a8e1a | Python | 1,048 | 33 | import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('--positive-fa', required=True)
parser.add_argument('--negative-fa', required=True)
parser.add_argument('-k', type=int, default=3)
parser.add_argument('--output', required=True)
args = parser.parse_args()
with open(args.output, 'w') as f... |
086427e6de11d75c6256ed556ba16a3950c08379ef7366392c6a208c5b11e9f5 | Python | 1,049 | 35 | import sys
from ij import IJ
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input_file = sys.argv[-4]
black_background = sys.argv[-3] == "yes"
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]
# Open the input image file.
input_image_plus = IJ.openImage(inp... |
631b9e282d0f9485a0705ea7411009d469e1ec69d7bd48fb311b95b970a353f4 | Python | 1,049 | 30 | import sys
import csv
import simulatorutils
def WriteCSVFromList(filename, list):
fieldnames = ['track ID', 'time (s)', 'x', 'y', 'z']
with open(filename, 'w', newline='') as file:
csvwriter = csv.writer(file, fieldnames)
csvwriter.writerow(fieldnames)
for cell in list:
fo... |
e5ab810dc38f41951720ccb5b941195b9d7e7d5d8b782704edb5a267b7dfd54d | Python | 1,050 | 35 | #! /usr/bin/python
import sys
from collections import defaultdict
def __main__():
input_file = open(sys.argv[1], "r")
top_hits = int(sys.argv[2])
output_file = open(sys.argv[3], "w")
remember_ids = defaultdict(int) # defaultdict with 0
for line in input_file:
"""
Write comments ... |
127949fdbf6b5fdb0cb12290ec3a92b3e8c543035fdd42df6c1ea3e00bf81b8a | Python | 1,051 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="S... |
8f2f9253f31afd9e7373d94d75f8733622da2804bcbe616bfe9e54cc64dbd617 | Python | 1,051 | 29 | # -*- coding: utf-8 -*-
'''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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/LI... |
a0b24b484e06066dd6c965b88bf7ae670f86a5fd19e52df23eb879f87a9e3798 | Python | 1,051 | 28 | from unittest import TestCase
import spateo.io.bgi as bgi
from ..mixins import TestMixin
class TestIOBGI(TestMixin, TestCase):
def test_read_bgi_as_dataframe(self):
df = bgi.read_bgi_as_dataframe(self.bgi_counts_path)
self.assertEqual(
{"geneID": "0610009B22Rik", "x": 9776, "y": 1266... |
eaa6acd15538460b66243c5a8d5227392a33de3d0846920c90db8aca864b9146 | Python | 1,051 | 48 | import subprocess
import sys
"""
We only need that file because galaxy do not understand the -t $'\t' term.
Otherwise that would be the right XML-only solution:
sort -u
$ignore_case
$is_numeric
-t $'\t'
#if $adv_opts.adv_opts_selector=="advanced":
-k$adv_opts.col... |
42a73bc299dac35c42f2e278e779147c3e33e9f9a27f1138c848dfaffddf819a | Python | 1,052 | 35 | import numpy as np
import os
import pytest
from mirp.extract_features_and_images import extract_features_and_images
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
@pytest.mark.ci
def test_basic_ct_feature_extraction(tmp_path):
image = np.zeros((128, 128), dtype=float)
image[32:64, 32:64] = 1.0
... |
dd77db8057e85630f7a47cf8c67142ed8bc9d9d6a50efdafa5495cb637435501 | Python | 1,052 | 35 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
6f6a359c989f10b4d3dff6eff60ec6ad3855cbe193ab822c28a98b57cbe77953 | Python | 1,053 | 34 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._domain import Domain
from ._hoverlabel import Hoverlabel
from ._insidetextfont import Insidetextfont
from ._leaf import Leaf
from ._legendgrouptitle import Legendgrouptitle
from ._marker import Marker
from ._outsidetextfon... |
f49cca650733088272eeea49c66bf8b1d24811174e18734f032b5c4a0cead986 | Python | 1,053 | 32 | from embgam import EmbGAMClassifier
import datasets
import numpy as np
# set up data
dset = datasets.load_dataset('rotten_tomatoes')['train']
dset = dset.select(np.random.choice(len(dset), size=10, replace=False))
dset_val = datasets.load_dataset('rotten_tomatoes')['validation']
dset_val = dset_val.select(np.random.ch... |
27b70da1b55f0bc80e0f87317e3d89b94478f442ed0b992e8771d10b0983de72 | Python | 1,054 | 30 | """
This module create TransformerClassifPerProt
"""
# pylint: disable=W0223
import torch.nn as nn
class TransformerClassifPerProtMoreExpressive(nn.Module):
"""
This class define a Transformer model that classify an entire protein to ONE classe
"""
def __init__(self, transformer_embedder, num_classes... |
a785272911e5c11cc12b7aee9f8dc146126ed365190b314880027e53f9a1edd9 | Python | 1,054 | 41 | import matplotlib.pyplot as plt
from numpy.testing import assert_allclose, assert_equal
from .. import utils
def test_path_data():
circle = plt.Circle((0, 0), 1)
vertices, codes = utils.SVG_path(circle.get_path())
assert_allclose(vertices.shape, (25, 2))
assert_equal(codes, ["M", "C", "C", "C", "C",... |
b52d30bba35e1d78b4d93718164807cd79f2d1258094a15335006d06101d33de | Python | 1,054 | 48 |
import numpy as np
import re
IN_MAP = np.asarray(
[[0, 0, 0, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
)
# One-hot encoding of the inputs: 0 is for padding, and 1, 2, 3, 4 correspond
# to A, C, G, T respectively.
in_map_list = IN_MAP.tolist()
base_map_dict = {
0: 'N',
1: 'A',
... |
c282522c5193e3cf655d59f3895f3af94cae41383b0c913ff437ef413d0f1c88 | Python | 1,054 | 35 | import torch
def log_likelihood(labels,
predicted_distributions,
reduction_fn=torch.mean):
"""
Computes the logarithm of the general survival likelihood
for right censored data:
L(t,e) = S(t)^(1-e) * f(t)^e
for a batch of predicted distribution objects.
... |
0ee6440b07b9e5315221d1dea0bd061c705738a5284a242231b1eef19c303871 | Python | 1,055 | 34 | import tensorflow as tf
def non_trainable(model: tf.keras.Model):
for layer in model.layers:
if 'Readout' in layer.name:
layer._trainable = True
else:
layer._trainable = False
def assertion_block(model: tf.keras.Model):
for layer in mo... |
107ac7a5e72ba718845bb5a896dd66ab26eb5f3957bdf0cf1df84790441ccc46 | Python | 1,055 | 30 | """
Script to compute FLOPs of a model
"""
import os
import argparse
import torch
from gluoncv.torch.model_zoo import get_model
from gluoncv.torch.engine.config import get_cfg_defaults
from thop import profile, clever_format
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Compute FLOPs ... |
1fb746c0d6e1f05bd08ac3007e4a7e3c3b47ed76d5545c16997ca350ddf0073e | Python | 1,055 | 23 | import os
import sys
import numpy as np
"""
this is the only script you actually should call, it will submit a job
this job makes the features, and then does the regression.
only change the home_dir variable, everything else should run!
"""
homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio... |
5a6f7c1f98dec80c5afd1c81de10a3255649d8a34c1b608fdb37c3e4047f54e6 | Python | 1,055 | 48 | __author__ = 'quentin'
import cv2
import unittest
import os
from ethoscope.roi_builders.target_roi_builder import SleepMonitorWithTargetROIBuilder, TargetGridROIBuilder
try:
from cv2.cv import CV_AA as LINE_AA
except ImportError:
from cv2 import LINE_AA
images = {"bright_targets":"../static_files/img/bright... |
eacdee55b2c4a13a0fb406ba53cbee3ffa20b34eb7c2019bd8eecc6a5f849b89 | Python | 1,055 | 38 |
#/data/ethoscope_results/008aeeee10184bb39b0754e75cef7900/ETHOSCOPE_008/2015-11-09_18-05-18/2015-11-09_18-05-18_008aeeee10184bb39b0754e75cef7900.db
from glob import glob
import os
import time
import db2video
PATH = "/data/ethoscope_results"
files = [y for x in os.walk(PATH) for y in glob(os.path.join(x[0], '*.db'... |
544b899d1d140cc5a700c568eb5dbd46426a55f35dc426566260e6e35a289e5b | Python | 1,056 | 38 | # coding=utf-8
# Copyright 2025 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... |
84c708a8ca4f13eaa89fbc8aa63e5db2aa991126f3d851c9185991bfa4a0654b | Python | 1,056 | 32 | from typing import Any, List, Sequence
from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T
class MultiViewTransformV2:
"""Transforms an image into multiple views and is compatible with transforms v2.
Args:
transforms:
A sequence of v2 transforms. Every... |
8f1f747a7d16c5d3e9eed89fcf2f04875cda64e0910282c14a913f480d1c686f | Python | 1,056 | 34 | import fire
from modular_splicing.models_for_testing.main_models import AM, FM_full
from modular_splicing.motif_perturbations.perturbations_on_standardized_sample import (
all_mpi_on_standardized_sample,
)
from working.donorlikes import am_multiple_donors, lm_multiple_donors
main_models = FM_full.binarized_models(... |
bcf9955714119e353873f4af86c03d477d7a10f3bc7e1caa3fdbb8f63ed1aea8 | Python | 1,057 | 36 | import h5py
import numpy as np
from scipy.linalg import svd
def get_checkpoints(filename):
checkpoints = []
file_model = h5py.File(filename, 'r')
for file_key in file_model.keys():
if "update" in file_key:
chkp = int(file_key.split('_')[1])
checkpoints.append(chkp)
file_... |
2c77294a203983e267bc0a4376c395f73432a4a5b29153789988f2f032ae4f7f | Python | 1,058 | 34 | import functools
import os
from neurogym.utils.logging import logger
def suppress_during_pytest(
*exceptions: type[BaseException],
message: str | None = None,
reason: str | None = None, # noqa: ARG001
):
"""Logs and suppresses specific exceptions during pytest, re-raises otherwise.
Args:
... |
493e7e3c5f9a7e7cb8b3908828fe7dac820d18c84f4b5c115d8972b9c246aac5 | Python | 1,058 | 46 | #!/usr/bin/env python
import urllib
import urllib2
def getListFromFile(infile):
idlist = []
for line in infile:
line = line.strip()
if line.isdigit():
idlist.append(line)
return idlist
def getListString(args):
if args.id_type_ff == "file":
list_string = ",".join(... |
6f323c0b04d99485342ffdf32e7cc6c864583a402221f1da6c4626ecffba1e59 | Python | 1,058 | 53 | """mysecureapp.py
Usage::
Generate Certificate:
```
mkdir ssl
openssl req -x509 -newkey rsa:4096 -keyout ssl/worker.key -out ssl/worker.pem -days 365
# remove passphrase
openssl rsa -in ssl/worker.key -out ssl/worker.key
Enter pass phrase for ssl/worker.key:
writing RSA key
```
cd examp... |
9c0e8ee5d850f9c5a3b378df133bd7fa1dbfd0702ca0fe271fb22561b76da316 | Python | 1,058 | 40 | import numpy as np
class MetricManager():
"""
Class for managing the training of the model.
"""
def __init__(self, modes = ['train', 'val']):
self.modes = modes
self.outputs = {}
for mode in modes:
self.outputs[mode] = {}
self.outputs[mode]['epoch'] = []... |
d8e28f8979fab20ba6ff4d911f577f4c1a1772935c36ca284fdf07b7da56b9a6 | Python | 1,058 | 38 | """The ``celery list bindings`` command, used to inspect queue bindings."""
import click
from celery.bin.base import CeleryCommand, handle_preload_options
@click.group(name="list")
@click.pass_context
@handle_preload_options
def list_(ctx):
"""Get info from broker.
Note:
For RabbitMQ the management... |
137566f07ae0151b4ebc88553ba9373daafbe12b7bece4dcc695ac261883f72c | Python | 1,060 | 37 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["propagate_sparsity_spec"] = dict(
type="OnlyAllowInfluenceOnSplicesites"
)
msp.architecture["final_processor_spec"].update(
dict(
bottleneck_spec=... |
fe5a3010347e0e71a29af4a1345ed808560f25400d35f9b54ddd26f69be3275b | Python | 1,060 | 34 | #!/usr/bin/env python
#=========================================================================
#
# Copyright NumFOCUS
#
# 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://... |
8be6c3e38000ad4685b21c9da96ede17c77c513dccc07596add1099ca99f2bdc | Python | 1,061 | 23 | import os
import sys
import numpy as np
"""
this is the only script you actually should call, it will submit a job
this job makes the features, and then does the regression.
only change the home_dir variable, everything else should run!
"""
homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio... |
c0664a25e38b1bc76a892b6ae91939a8b880ad1991b1e82eead70f04ecfb97d9 | Python | 1,061 | 30 | #!/usr/bin/env python
'''Return the top and R statistics for every row of the database that has them'''
import sys, re, MySQLdb, argparse, os, json, subprocess
import pandas as pd
import makemodel
import numpy as np
def getcursor():
'''create a connection and return a cursor;
doing this guards against droppe... |
c54e13161535de2bb9c209cb2cc8b7486537d2db87059398ae5402047a6875ac | Python | 1,061 | 27 | # Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved.
#
# Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://creativecommo... |
09a38a5edfda2969674a34ebb9171700308d33dc83b5234d5fddbc709a40e6d4 | Python | 1,062 | 41 | from typing import List, Optional, Union
import torch
from torch_geometric.data import Data
from torch_geometric.transforms import BaseTransform
class Absolute(BaseTransform):
r"""Sets the node features to be absolute values of the original node
features.
Args:
cat (bool, optional): If set to :... |
dec200495806791dd28e9fc24c923c68293b3f934c6564e4ad86feaec7c6701e | Python | 1,062 | 41 | import os
import sys
from typing import List
from pathlib import Path
import numpy as np
import snapatac2 as sa2
# test
# work_dir = "/Users/szu/git-recipes/mouseBrainAtlas/CEMBA2"
# sample = "CEMBA190718_8F"
# qc_dlt_dir = f"{work_dir}/17.snapatac2/result/qc_bmat-dlt/"
# out_dir = f"{work_dir}/17.snapatac2/result/qc... |
585f5e3a25e3d8ca008631f85877f5499c8b7557293bc88814fea391324ee411 | Python | 1,063 | 28 | import glob, os, mne, numpy as np
root = "data/figshare_stroke/edf_extracted"
print("--- any sidecar files anywhere in the tree? ---")
for ext in ("*.tsv", "*.json", "*.csv", "*.mat", "*.txt"):
hits = glob.glob(os.path.join(root, "**", ext), recursive=True)
print(f" {ext}: {len(hits)}", hits[:3])
edf = "dat... |
d9ed04849b327c1fba01ea5db6bf67a091e783189ea54cfbc39831cb2b138fa9 | Python | 1,063 | 34 | __author__ = 'quentin'
from ethoscope.tracking.roi_builders import SleepDepROIBuilder
from ethoscope.tracking.cameras import MovieVirtualCamera
from ethoscope.tracking.monitor import Monitor
from ethoscope.tracking.trackers import AdaptiveBGModel
from ethoscope.tracking.interactors import SystemPlaySoundOnStop
from ... |
f94e5b9d5afce4843084ef0ed955549d1865964b2fa999dbd0aa747b07e5b68c | Python | 1,063 | 32 | import numpy as np
import math
def torusUnif(n, R, r):
# generate n samples uniformly from a torus
# R : the radius from the center of the hole to the center of the torus tube
# r : the radius of the torus tube.
#
# There is an R package with the same name
# Algorithm 1 of Diaconis P,... |
9c2f8d084a413c0aed0578b451177482ef6e425ce4284c0a74c775220de9b685 | Python | 1,064 | 36 | '''load_mri'''
import numpy as np
import nipy
def load_mri(fpath):
'''Load a MRI image.
- Returns data as 2D array (sample x voxel)
- Returns voxle xyz coordinates (3 x voxel)
- Returns voxel ijk indexes (3 x voxel)
- Data, xyz, and ijk are flattened by Fortran-like index order
'''
img ... |
c1bea9765d205d6ec567ac036d0e8e75c6d53ebfa41ef56c2963eb1687199d7d | Python | 1,064 | 40 | from SEEGFusion import ImageFusion
import SimpleITK as sitk
import sys
from os.path import dirname, abspath, join
def main(argv):
if len(sys.argv)<2:
print('python Fuse.py ct_path mri_path output_path')
exit()
elif len(sys.argv)<3:
print('please especify MRi')
exit()
elif l... |
27cffe754d2e4b2dc12491dc7f4f5ab96594c8a2111e7d6786df10e82b091dbf | Python | 1,065 | 44 | import pytest
import tensorflow as tf
from psychrnn.backend.rnn import RNN
from pytest_mock import mocker
import sys
if sys.version_info[0] == 2:
from mock import patch
else:
from unittest.mock import patch
# clears tf graph after each test.
@pytest.fixture()
def tf_graph():
yield
tf.compat.v1.reset... |
2db66f18c2af532249b19028719c574b94d6a012f6b24347ab98bc74706bc9e5 | Python | 1,065 | 40 | import numpy as np
import cv2 as cv
from F01 import Feature
class F02(Feature):
def get_map(self, img, img_f01, eroded_roi):
map_float32 = self.get_map_float32(img, img_f01, eroded_roi, normalize=False)
return np.uint8(map_float32)
def get_map_float32(self, img, img_f01, eroded_roi, normaliz... |
91132125760659f838e6da639fc53da40a3b5cbb2a3a017cc609ee8a96d86d07 | Python | 1,065 | 36 | """The module describes the ``uname`` job metrics plugin."""
from . import InstrumentPlugin
from .. import formatting
class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
return "Operating System", value
class UnamePlugin(InstrumentPlugin):
"""Use uname to gather opera... |
9ed7746a570631f6b90d92f2ac26f0bd5d41bce8203f2e406347a69bf0e44bd6 | Python | 1,065 | 36 | #!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from auryntools import *
from auryntools.stats import *
# This code snipped assumes that you have run the example simulation
# sim_coba_binmon with default paramters.
# This generates spk output files under /tmp/
filename = "/tmp/coba.0.e.spk"
... |
f1cd724d6a02616780e6bec0bffd9f87761d4226ac1b687aac2aea8154f154da | Python | 1,065 | 42 | """Add not-null constraints to user_role_association
Revision ID: 1fdd615f2cdb
Revises: 349dd9d9aac9
Create Date: 2024-09-09 21:28:11.987054
"""
from alembic import op
from galaxy.model.migrations.data_fixes.association_table_fixer import UserRoleAssociationNullFix
from galaxy.model.migrations.util import (
alt... |
fc9bc5b247cd75427adecc8c849fb0b2f229924667f634e2dc64a218fe7ec8f9 | Python | 1,065 | 36 | ### Simple PCA in python
### Based on:
### (c) Jan Erik Solem
### link: http://www.janeriksolem.net/2009/01/pca-for-images-using-python.html
import numpy as np
def pcax(X):
# Principal Component Analysis
# input: X, matrix with training data as flattened arrays in rows
# return: projection matrix (with importan... |
45b70b3f99f01af51dd5811d721bd9dd15a76db62bf1c7e08e3d09e5386f4a54 | Python | 1,066 | 42 | """
Widget for choosing which output groups a simulation records.
"""
from __future__ import annotations
import panel as pn
import param
from .widget_base import collapsible_family_box, family_box, param_controls
__all__ = ["build_collections_widget"]
_COLLECTIONS_FIELDS = ("collections",)
def build_collections_... |
6640f4b5fba3193f0c4eadacfc47aa20423d8193d2d024cccf242ec25976a20f | Python | 1,066 | 30 | # -*- coding: utf-8 -*-
'''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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/LI... |
69547fd7fb34d1c8d9c4169b83a30a52972a1880eec96bbd2ef6dd225ca11789 | Python | 1,066 | 32 | import numpy as np
from nfp.frameworks import tf
# Code from https://www.tensorflow.org/tutorials/load_data/tfrecord
def _bytes_feature(value):
"""Returns a bytes_list from a string / byte."""
if isinstance(value, type(tf.constant(0))):
value = value.numpy() # BytesList won't unpack a string from an... |
81c182300abd7dfb462c89f2024c61967817b21a34f7c4eeebc7eaa23216f9d8 | Python | 1,066 | 42 | #!/usr/bin/env python3
import amdsmi
def main():
try:
# Initialize AMD SMI
amdsmi.amdsmi_init()
# Get all GPU handles
devices = amdsmi.amdsmi_get_processor_handles()
if not devices:
print("No AMD GPUs detected.")
return
for idx, device in... |
e64f33da4fcfb9efaef754f5640cdf2cd1b0dd724f7b252de31806938703a557 | Python | 1,066 | 19 | #!/usr/bin/env python3
"""Пилот B2, вторая порция: постепенная смена правила (switch_ramp_ticks 60 и 150)
при яде -0.5, условия life и life_frozen, seed'ы 101-103, 20k тиков. Не
подтверждающие данные; для решения §0.1 черновика B2."""
import sys, os, time
os.environ.setdefault("OMP_NUM_THREADS", "1")
REPO = "/home/clau... |
42fc3f65df5b854b5b0d3132b87b28c0374135b621b62c9bcb5af39acb0351cf | Python | 1,067 | 24 | original_network = "/home/hjorth/HBP/DELME/networks/pd0_1k_swap"
updated_network = "/home/hjorth/HBP/DELME/networks/pd2_1k_swap"
output_network = "/home/hjorth/HBP/DELME/networks/pd2_output_network"
import os
original_network_file = os.path.join(original_network, "network-synapses.hdf5")
updated_network_file = os.pa... |
6423746e60b6764182c23e0ef61487572775606fe49c2542194b3d118d88674d | Python | 1,067 | 33 | import numpy as np
import pytest
from scipy.spatial.transform import Rotation as R
from coeffnet.transforms.rotations import RotationMatrix
"""Check the rotation matrices against those from scipy."""
radian_angles = [
(0.0, 0.0, 0.0),
(np.pi / 2, 0.0, 0.0),
(0.0, np.pi / 2, 0.0),
(0.0, 0.0, np.pi / 2... |
a0afae2dd0944a51cf0ff32853f473fe1dd5557dcb8ed9f05e5c29123fd42431 | Python | 1,068 | 32 | import unittest
import numpy as np
from spitfire.time.integrator import odesolve, FailedODESolveException
class TestMaximumResidual(unittest.TestCase):
def test_maxres(self):
maxres = 1.
tcutoff = 1.
X0 = np.array([1.])
def rhs(t, x):
return -0.1*x if t<tcutoff else np... |
f1929d4f0f2c1e87582f06ed5fb7aedfeb92a02d2b81b1fd04a333aeea9fea46 | Python | 1,068 | 44 | import argparse
import subprocess
def main():
parser = argparse.ArgumentParser(description="Simple wrapper for rbdock")
parser.add_argument(
"-n", "--num", type=int, help="Number of docking poses to generate"
)
parser.add_argument("-s", "--seed", type=int, help="Random seed")
args = parser... |
11c5927dabf932a5cde4401a8d8f0cfc23239a78aac2b5c92ff91962e4c5df64 | Python | 1,069 | 33 | import functools
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QCursor
from PyQt5.QtCore import Qt, QEventLoop
class ShowWaitCursor(object):
def __enter__(self):
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
# This overloaded function call makes sure that all events,
... |
571d7106df78524e7197e8c9837636b08f6cd8499f84702f1dd34ae7708b3b51 | Python | 1,069 | 34 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import glob
import os.path as osp
_ext_src_... |
69a38700a0d1c7e85031e3dd3aafeb642757a9462ec89aa5fca40547927b3ed0 | Python | 1,070 | 31 |
# -*- coding: utf-8 -*-
#
#
# PyCoBi software framework for parameter continuation and automated bifurcation detection. See also:
# https://github.com/pyrates-neuroscience/PyCoBi
#
# Copyright (C) 2021-2022, Richard Gast.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
c0c7f20f6918dfce6b96a8075367890d7d2e2b73db7888401ef2b6a6b5731bd9 | Python | 1,070 | 28 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
e34f14d99455fd41542cbe4d34cff732830b67d64fa86f1dd0ddef8ab46694c2 | Python | 1,070 | 34 | import torch
import torch.nn as nn
from .linear_effects import LinearEffects
class SumGaussianLinearEffects(LinearEffects):
def __init__(self, *, num_gaussians_each, **kwargs):
"""
For each 79 x 79 table of motif effects, we have num_gaussians_each gaussians,
each with a mean and a st... |
f5000df70b74de673f2592a00d71e602d9e498ab430e0078cfc956676e2938f1 | Python | 1,070 | 34 | #@String (label="Input File", description="Input File") traces_file
import os
import re
from tracing import PathAndFillManager
from ij import IJ
import shutil
traces_filename = os.path.split(traces_file)[-1]
print('file is: ' + traces_file)
print('filename is: ' + traces_filename)
logfiles = "/app/modules/snt/logfi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.