sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5de305a2c5c23635c1c83bde3fa9934a6d92d210fdd2aed8b2180efa6d8cb72b | Python | 940 | 37 | #!/usr/bin/env python3
import pandas as pd
import collections
import os
f_1 = open("files.txt", "r", encoding = "utf-8")
filename = []
i = 1
for file_1 in f_1:
line_1 = file_1.strip().split('\t') #改行コートをはがしてタブ区切
filename.append(line_1[0])
f_1.close
j = 0
list = []
for file in filename:
samplename = fil... |
dc32d841dc13cf5354c2b8c19abe7074d5579ed0696d1d7ee375a0a6cbb73afe | Python | 940 | 40 | import json
class TestImage:
def test_get_empty(self, client):
response = client.get("/api/image/")
data = json.loads(response.data)
assert isinstance(data, dict)
assert data['total'] == 0
def test_post_no_data(self, client):
response = client.post("/api/image/")
... |
9bb6efb78835cb8aafe204958fccf19bc9472b2d14efd2b7e446da5214cba376 | Python | 941 | 38 | """Committed allow-list for TorchLens parity pickle comparisons."""
from __future__ import annotations
ALLOWED_PICKLE_DIFF_FIELDS: dict[str, frozenset[str]] = {
"Trace": frozenset(
{
"backward_peak_memory",
"cleanup_duration",
"capture_end_time",
"forward_du... |
ba4c0d5fee03e133cdf40b805f0e0463fecb0b7492e68da57dce16be99de6942 | Python | 942 | 29 | # Generated by Django 3.2 on 2021-04-14 10:43
import biomedisa_app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0085_auto_20201130_1718'),
]
operations = [
migrations.AlterField(
model_name='profil... |
72729a0aad11aeeb4469bcd02e1e18a77019970069d209a0edc1e97041e4a137 | Python | 943 | 35 | 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=... |
770e49f5dfb2fcdc8ab55608e4e997a0ccf4f8800b2d1adbea22290c29e9762f | Python | 943 | 34 | __author__ = "quentin"
import unittest
from ethoscope.utils.description import DescribedObject
class TestExple(unittest.TestCase):
def test_exple(self):
ans = 1
ref = 1
self.assertEqual(ans, ref)
class TestDescribedObject(unittest.TestCase):
"""Test suite for DescribedObject base... |
1a96575372fdb5780eca7db21dae8282f5b3483d370a12d59b002dfd376d0db4 | Python | 944 | 27 | from setuptools import setup, find_packages
setup(
name='ethoscope_node',
version='trunk',
author=['Quentin Geissmann', 'Giorgio Gilestro', 'Luis Garcia'],
author_email=['quentin.geissmann@gmail.com', 'giorgio@gilest.ro', 'luis.garcia@uni-muenster.de'],
packages=find_packages(),
url="https://gi... |
370781d834d26240bec61388ee321a0d43ecce92618ac99b853085ae3634146a | Python | 944 | 66 | jana_40 = [
"#5C5C5C",
"#969696",
"#BEBEBE",
"#8B0000",
"#EE5C42",
"#8B3E2F",
"#CD3700",
"#FF7F24",
"#F4A460",
"#FFA500",
"#8B5A00",
"#8B8B00",
"#FFFF00",
"#9ACD32",
"#ADFF2F",
"#458B00",
"#90EE90",
"#32CD32",
"#008B45",
"#7FFFD4",
"#45... |
e502726fe8f11db673c524cb3480d9ab421c8b53e969f0d191a71d22baf85747 | Python | 944 | 31 |
import os
import itertools
import io
class Utils():
def output_file_path(self, srctotarget_file, targettosrc_file):
source_set = set()
source_trans = []
for filename in itertools.chain.from_iterable(
(srctotarget_file, ['..'], targettosrc_file)):
filename_set, filename_trans = os.path.basename(filename)... |
084986f91c2857913538550b8e2233f740df9f9691559c23e3c21892c274af29 | Python | 945 | 37 | __author__ = 'quentin'
import cv2
import numpy as np
class EthoscopeException(Exception):
def __init__(self,value, img=None):
"""
A custom exception. It can store an image
:param value: A value passed to the exception, generally a text message
:param img: an image
:type i... |
48b5e310c9dc687e13e9c1d3d78e9d1ab0745debcb9ee271f1aac6b9c281be6e | Python | 945 | 30 | import numpy as np
import pandas as pd
from operator import itemgetter
def coefs_list_10(final_data, final_models):
coefs_list = []
for i in range(len(final_data)):
X_test, y_test = final_data[i]
clf = final_models[i]
y_test_pred = clf.predict(X_test)
y_test_prob = clf.pre... |
661684579da24819977275df604f18380f341a60fdb5892f385e7d1425d824d5 | Python | 945 | 47 | import numpy as np
from neuron import h, gui
from neuron.units import ms
def test_top_local():
nseg = 1
s0 = h.Section()
s0.insert("top_local")
s0.nseg = nseg
s1 = h.Section()
s1.insert("top_local")
s1.nseg = nseg
pc = h.ParallelContext()
pc.nthread(2)
pc.partition(0, h.Sec... |
bf1bc64fdc4e86437208b7876f3801f968b0b1a2ef8003789eb9eb4311f81bae | Python | 945 | 28 | # ruff: noqa -- harvest-time provenance script, committed as run (lint header added at import)
import json
import os
import sys
import warnings
warnings.simplefilter("ignore")
out = sys.argv[1]
import torch
import torchvision
import torchlens as tl
print("torchlens", getattr(tl, "__version__", "?"))
from torchlens i... |
cf3d30f0b5dbfb27eb6d12885db6d1de3ad5560194b1bad8a2ed028b95b870c0 | Python | 945 | 25 | __author__ = "quentin"
class DescribedObject:
r"""
An object that contains a ``description`` attribute.
This is used to parse user option for the web interface.
This way, users can send option to the different objects used.
``description`` is a dictionary with the fields "overview" and "arguments"... |
d4f5112d1547bac7fcd73e95fbcd3d29952a0afbde7a7ae46f7f608d4bb00d57 | Python | 945 | 31 | """Utility method for comparing versions of libraries"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
def version_compare(v0: str, v1: str) -> int:
"""Returns 1 if version of v0 is larger than v1 and -1 otherwise
Use this method to compare Python package versions and see which ... |
120f13128b99379aee74cb2aaa755d9b3e97f7bcc7dc46fb0a0ab472f46e94eb | Python | 946 | 29 | import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import datasets
from layers.__init__ import ComplexDense, ComplexFlatten
from pdb import set_trace
(train_images, train_labels... |
144e7ac139f40e5758d2cddb870da2b3186bd749779123b70b2ab8433a129b6b | Python | 946 | 19 | 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... |
5da015bde0e1d4947cbfa4b351ece9f7824f599496e61d8a07748af7fb8716b4 | Python | 946 | 36 | # Generated by Django 3.0.4 on 2020-03-22 15:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0059_auto_20200322_1613'),
]
operations = [
migrations.RemoveField(
model_name='mushroomspot',
name... |
7dbceebd59cfbb55a3533f379e40153a4cccdab6db059f113d96ca16f4ddf152 | Python | 946 | 31 | from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data
from wyrm.processing import rectify_channels
class TestRectifytChannels(unittest.TestCase):
def setUp(self):
raw = np.arange(20).reshape(4, 5)
channels = ['ca1', 'ca2', 'cb1', 'cb2', 'cc1']
ti... |
d0d889f4ff801ddbf5df899792046053d85f85d27f3fb1ca6fbcfd0385ea6b64 | Python | 946 | 33 | """Worker Remote Control Bootstep.
``Control`` -> :mod:`celery.worker.pidbox` -> :mod:`kombu.pidbox`.
The actual commands are implemented in :mod:`celery.worker.control`.
"""
from celery import bootsteps
from celery.utils.log import get_logger
from celery.worker import pidbox
from .tasks import Tasks
__all__ = ('Co... |
3e5c71e26bd2061fe72f40c9cf80d13c4aa8fcaaefdeefc406c77bbf6a14928d | Python | 947 | 38 | import pytest
import rpy2.rinterface as rinterface
import rpy2.robjects as robjects
import array
identical = rinterface.baseenv['identical']
Function = robjects.functions.Function
SignatureTranslatedFunction = robjects.functions.SignatureTranslatedFunction
def test_init_invalid():
with pytest.raises(ValueError)... |
6851e90e7cf34d273a735792b546c598907fdd9f5d768846d0ff05823bc424fa | Python | 947 | 1 | import numpy as np
import pandas as pd
import time
import random
# [1] data preprocessing #
df = pd.read_csv('./data/GSE75688_GEO_processed_Breast_Cancer_raw_TPM_matrix.csv', index_col=0) # dimension = (genes x cells)
#df1 = df.iloc[0:3,:]
print("starting preprocessing:")
n1 = df.shape[0] # row genes
n2 = df.shape[1... |
795c404c54b359e078940c063dfad5e5e3baa1426c42616943688d1da75e8f95 | Python | 947 | 37 | #!/usr/bin/env python
'''
Output the parameters that makemodel supports with their ranges
'''
import makemodel
import json, sys
from collections import OrderedDict
#extract from arguments to makemodel
def makejson():
'''return dictionary of config options from makemodel'''
opts = makemodel.getoptions()
d=Ordere... |
b795b71b575fb6dcbb571d5a773aaaf9f55a11b346719d7870dc3ea01749a8a9 | Python | 947 | 27 | """
Copyright (c) 2015, EPFL/Blue Brain Project
This file is part of eFEL <https://github.com/BlueBrain/eFEL>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Free Software Foundation.
This library is... |
ed0ba86c2cda2f3bb5bed088b5952df9259163abee5b914a97fad40773ae6128 | Python | 947 | 36 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import YOLOv3Estimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.object_detection import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'dataset': 'sheep',
... |
f0e1e3c00f4e2c3dd4c814520752ca70078582fa68ad230fd14c0cd834782de1 | Python | 947 | 30 | #!/usr/bin/python3
# This script will decode all .NPY files in the directory
mypath = "/home/milch/predict.Q8/"
# to the tabbed text format
import struct
import numpy as np
import os
def parseNPY(path, fileJustName):
# load from the file
inputFile = os.path.join(path, fileJustName + ".npy")
matrices = np.... |
f4fe0023461b3ad2386743b60edf4b4c28c411a292c1ba8656e0ffd77fa0da30 | Python | 947 | 34 | import sqlite3
from .db import DB
class DistrictInfo(DB):
def __init__(self):
super().__init__()
self.table_name = 'MP_district_info'
self.table_desc = 'District level information'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE... |
16c770394b5a4eadf80ff9bef2987b1f61caf1d4e353be03c2526ec49ce1bba6 | Python | 948 | 28 | """Repository implementation for telemetry data using SQLAlchemy."""
import uuid
from contextlib import AbstractContextManager
from uuid import UUID
from dependency_injector.providers import Callable
from carbonserver.api.domain.telemetry import Telemetry
from carbonserver.api.infra.database.telemetry_sql_models imp... |
2f2595756fa85ea8547bbec4102c6a3c82902c4d4567d5d53e489ad06f288dad | Python | 948 | 37 | # useful exception for going into sleep
class GoodNite(Exception):
""" exception for when the lights should be off """
pass
class EndSession(Exception):
""" exception for when a session should terminate """
pass
class EndBlock(Exception):
""" exception for when a block should terminate """
pas... |
8044873913aad0130d787e0b0fd153151b0059b659e7009981d6d3f757ca5876 | Python | 948 | 30 | #!/usr/bin/python3
# This script will decode all .NPY files in the directory
mypath = "/home/milch/predict.Q16/"
# to the tabbed text format
import struct
import numpy as np
import os
def parseNPY(path, fileJustName):
# load from the file
inputFile = os.path.join(path, fileJustName + ".npy")
matrices = np... |
4d6fca25ae69c1da6caffeacec7ca74c119decd5cb20e0f1ee73a22a757e16bd | Python | 949 | 45 | import numpy as np
from imfun.external.physics import Q
names = ("value", "unit")
formats = ('float', "U21")
def quantity_to_pair(q):
return q.value, str(q.unit)
def pair_to_scale(pair):
return np.array(pair,
dtype=dict(names=names,formats=formats)).view(np.recarray)
def unpair_to_sc... |
a17b6cf0d5953512ca7efda0d19e64998961c1e8a2efd67dc594f75dc7591276 | Python | 949 | 34 | # -*- coding: utf-8 -*-
# @Author : Yue Liu
# @Email : yueliu19990731@163.com
# @Time : 2022/9/19 20:52
import setuptools
from dgc.version import __version__
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="deep_graph_clustering",
version="1.0.0",
author="Y... |
e732b92a3a9b6ec5d4e61f438e52c43a251f3d3e659bac961239603e3c66c51b | Python | 949 | 19 | 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... |
bb31d1c6b3e80abffb74740567ff6a521afb58a49dc45ff5b6c13d0d41cce4a2 | Python | 950 | 38 | ### Functional programming utils for imfun package (moved from lib.py)
import sys
import itertools as itt
from functools import reduce
def fnchain(f,n):
"""
returns lambda `*args`, `**kwargs`: f(..n times..f(*args, **kwargs))
"""
return flcompose(*[f]*n)
def fniter(f,x,verbose=False):
"S... |
45d6c1e483521ebffd1c3061621ffc2fa9ddebf76d4ba2cb3feb98a86726f7f2 | Python | 951 | 39 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 16:06:26 2020
@author: a
"""
import torch
import torch.nn as nn
import copy
import torch.nn.functional as F
class LinkAttention(nn.Module):
def __init__(self, input_dim, n_heads):
super(LinkAttention, self).__init__()
self.query =... |
4d58374472ace5f3bf1cff37f1062792505aa232cfcc105ddc229193ca65f2a1 | Python | 951 | 28 | from .models_for_testing import EndToEndModelsForTesting, STANDARD_DENSITY
def width_experiment(name, path):
return EndToEndModelsForTesting(
name=name,
path_prefix=f"model/{path}",
seeds=(1, 2, 3),
density=STANDARD_DENSITY,
)
# all of these use aat
AM_21 = width_experiment("... |
7e622009ff90d120e148885a0ff9a7bb9e0a684a6a1be3c349ce2a27427264ee | Python | 953 | 38 | import fire
from modular_splicing.gtex_data.pipeline.marginal_psis_dataset import (
generate_probabilistic_gtex_dataset,
)
class MarginalPsiV3:
data_path_folder = "../data/gtex_direct/marginal_psis/v3/"
@classmethod
def create(cls):
return generate_probabilistic_gtex_dataset(
dat... |
a3a0b11eebb7aa999fe5e515efc56ce94443847377c232d680dfa6201168b858 | Python | 953 | 25 | """Simple script to make sure basic usage such as training, testing, saving and loading runs without errors."""
import os
def run(command):
print(command)
exit_status = os.system(command)
if exit_status > 0:
exit(1)
if __name__ == '__main__':
if not os.path.exists('./datasets/mini_pix2pix'):... |
4d7213e0a6881abc88575c601d1bb64a6ca3cb910598adc3efdf0340ace708c8 | Python | 954 | 15 | from MoleculeACE.models.mpnn import MPNN
from MoleculeACE.models.gcn import GCN
from MoleculeACE.models.attentivefp import AFP
from MoleculeACE.models.gat import GAT
from MoleculeACE.models.cnn import CNN
from MoleculeACE.models.mlp import MLP
from MoleculeACE.models.ml import RF, GBM, SVM, KNN
from MoleculeACE.models.... |
6fe9f33b95e98485e1eda4f350f5226b2d380651bfca5b275851b35daa720933 | Python | 954 | 35 | import glob
import sys
import os
from setuptools import setup, find_packages, Extension
from Cython.Distutils import build_ext
import pysam
test_module_suffix = os.path.dirname(os.path.abspath(__file__)).split(os.sep)[-1]
test_module_name = "PysamTestModule_{}".format(test_module_suffix)
pysam_libraries = pysam.get... |
cb9f3c9ebbb359bae6d49f55fd717700062691d2be60f1700e2abf7060082704 | Python | 954 | 38 | from celery.result import AsyncResult
from flask import Blueprint
from flask import request
from . import tasks
bp = Blueprint("tasks", __name__, url_prefix="/tasks")
@bp.get("/result/<id>")
def result(id: str) -> dict[str, object]:
result = AsyncResult(id)
ready = result.ready()
return {
"ready... |
f180eba6e15ceffeedb19293f100a99ed9321c3bad59f584b28a370e9939d78b | Python | 954 | 26 | from setuptools import setup, find_packages
VERSION = '0.0.1'
DESCRIPTION = "A package for training and constructing neural networks for the approximation of nucleation collective variables"
LONG_DESCRIPTION = 'README'
# Setting up
setup(
# the name must match the folder name 'verysimplemodule'
name=... |
b6e8b16241e9ef98f4c94252e1101da829f8f21e97ab3aa2b64f094094db4d4f | Python | 955 | 27 | __author__ = 'quentin'
class DescribedObject(object):
r"""
An object that contains a ``description`` attribute.
This is used to parse user option for the web interface.
This way, users can send option to the different objects used.
``description`` is a dictionary with the fields "overview" and "ar... |
b7f27235c10c954f195f1144c9359a83f0339206c9b3ce31cc7134a2697332fc | Python | 955 | 31 | # TODO: ---- This is a work in progress ----
"""
Dataproviders are iterators with context managers that provide data to some
consumer datum by datum.
As well as subclassing and overriding to get the proper data, Dataproviders
can be piped from one to the other.
.. note:: be careful to NOT pipe providers into subclass... |
0b5a990b0652c32a62f82fc823d0fb9647f2c6c38579f883a294cede9044c247 | Python | 956 | 37 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in February 2023
@author: Thomas Bonald <thomas.bonald&telecom-paris.fr>
"""
import numpy as np
from scipy import sparse
from sknetwork.linalg import normalize
from sknetwork.utils import get_degrees
def get_tfidf(count_matrix: sparse.csr_matrix):
"""Get... |
c0676d5344c4ee663bd8d4a50b8dbf9cc17186a0f6106a97b1d654e286892e1b | Python | 956 | 32 | import logging
from sqlalchemy import (
select,
true,
)
from sqlalchemy.orm import joinedload
from galaxy.model.base import SharedModelMapping
log = logging.getLogger(__name__)
class GalaxySessionManager:
"""Manages GalaxySession."""
def __init__(self, model: SharedModelMapping):
self.mode... |
f7a2fd8b86761d2850c1a413cbcf64bd24437a77028880b37361660ee17bdca9 | Python | 956 | 36 | """
This script tests files with external trigger tags
"""
import glob
import os
import sys
import matplotlib.pyplot as plt
try:
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/")
PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/")
DAT... |
5f8a0d63d53a355c20a2191fe5bca856b71a07875037bde227d75198876582dd | Python | 957 | 37 | 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(
... |
c2b5404be66c36e1171a7bd80ff2c75a5c3c599c6d124cc90810788502c0b497 | Python | 957 | 29 | import pickle
import os
import sys
import numpy as np
import pandas as pd
with open(f"../result/clustering_sum_L1/sa2_clustering_L0_0.pkl", 'rb') as f:
L1_sum = pickle.load(f)
with open(f"../result/clustering_sum_L1/barcodes.txt", 'r') as f:
barcodes = [l.strip() for l in f.readlines()]
r = 0.4
which_col = L... |
b58545573f706b716761db5a3107bd8d5d21c10ec58228110ffa4e6d83179915 | Python | 958 | 16 | from qtpy import QtCore, QtGui
# first use APP.setStyle(QtW.QStyleFactory.create("fusion"))
DarkPalette = QtGui.QPalette()
DarkPalette.setColor(QtGui.QPalette.Window, QtGui.QColor(53, 53, 53))
DarkPalette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.lightGray)
DarkPalette.setColor(QtGui.QPalette.Base, QtGui.QColor(15... |
f32e7b7e3e79da8d7bc190c5e45e5345d6e26fcd48ffd589c050f1ab8b717bb2 | Python | 958 | 35 | from abc import ABCMeta, abstractmethod
from typing import List, Iterable
class Handler:
__metaclass__ = ABCMeta
def __init__(self, pids: Iterable[int], devices_by_pid: bool):
self.pids = pids
self.devices_by_pid = devices_by_pid
@abstractmethod
def devices(self) -> List[str]:
... |
09239c543f4a3d0bbfb84ceff6d1e92be5a403f82a126f5d975dbf4868a2874e | Python | 959 | 34 | """Market 1501 Person Re-Identification Dataset."""
from mxnet.gluon.data import dataset
from mxnet import image
__all__ = ['ImageTxtDataset']
class ImageTxtDataset(dataset.Dataset):
"""Load the Market 1501 dataset.
Parameters
----------
items : list
List for image names and labels.
flag... |
2432a6045c8f475d16bcad19263ebd507c3ead38f3f7f0a521033d47606465ff | Python | 959 | 36 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import datasets, plot, NDVar
from eelbrain.testing import hide_plots, requires_mne_testing_data
@hide_plots
@requires_mne_testing_data
def test_glassbrain():
ndvar = datasets.get_mne_stc(True, 'vol-7')
# source space only
p = plot.Gla... |
a28bc7a45e7660b929b02287095b70e473fa400a6a3b6dfe191d001744e3b856 | Python | 959 | 19 | import numpy as np
from seqpro.rag import Ragged
def test_to_ak_multi_leading_axis_record():
# (b=2, p=2, ~v) record with an opaque-string and a numeric field
var_off = np.array([0, 2, 3, 3, 4], dtype=np.int64) # 4 groups
char_off = np.array([0, 2, 3, 6, 7], dtype=np.int64)
chars = np.frombuffer(b"AC... |
625f7b4c7907d6fb7cf42f7d184694e9a5156740cc42cf82069914bdbbc213d1 | Python | 960 | 27 | from setuptools import setup, find_packages
import sys
setup(
name = 'mne-ari',
version = '0.1.2',
description = 'All-Resolutions Inference for M/EEG',
url = 'https://github.com/john-veillette/mne-ari',
author = 'John Veillette',
author_email = 'johnv@uchicago.edu',
license = 'BSD-3-Clause... |
c2619af2ada777159cf7e269b29bcc8d6cf861a57056ef6b778853d80ddc8dc1 | Python | 960 | 31 | from .biss import BissClassifier
import sys
if __name__ == '__main__':
# TODO: improve arg-parser!
# TODO: Get image path as argument??
"""Args: epochs(int), createPatches(0/1), pathModel(string), patchShape('z,y,x,c')
For cross validation: python train_biss.py crossval
"""
args = sys.argv[1:]... |
88ae6c9ee3bdac1d4c3fc8044482889ee269f8370f7e0f3e873627d5200733e0 | Python | 961 | 27 | import torch
def get_parameter(parameter, parameters, default_parameters):
""" Get parameter from the environmnet variables, otherwise
use the default value provided.
"""
return parameters[parameter] if parameter in parameters \
else default_parameters[parameter]
def update_parameters(para... |
bb8d4e59d35dee1c22a810b433ab0a0ce943635b024aab388723a53f7b5935fa | Python | 961 | 36 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import CenterNetEstimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.object_detection import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'dataset': 'sheep... |
38ffed222ebcceed9e2fd654b3c585a9355517029c1112f783ab767e4e0e9298 | Python | 962 | 37 | """Implement sample sheets
Revision ID: 3af58c192752
Revises: 338d0e5deb03
Create Date: 2025-01-09 10:35:08.825159
"""
from sqlalchemy import Column
from galaxy.model.custom_types import JSONType
from galaxy.model.migrations.util import (
add_column,
drop_column,
transaction,
)
# revision identifiers, ... |
765de8b5f2979d037db42d576cc919d0bbba150185741cabd36b01987d9a5443 | Python | 962 | 32 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._dimension import Dimension
from ._domain import Domain
from ._labelfont import Labelfont
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._rangefont import Rangefont
from ._tickfont import Tick... |
d5a078dc3e5d63a13da8ba75b7b7af43767c230216951d9e25cd238abdb2b5f8 | Python | 962 | 34 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture["num_motifs"] = 146
msp.arc... |
ec2b88fc1ce5a62d660582f22fb89ad5e56f88a76835d36ccc97287df588b8da | Python | 962 | 20 |
class 3dc:
def __init__(self):
def norm(v):
'''Calculate the norm of vectors stored in an array'''
# Example: nx3 array containing the coordinates of n 3D vectors
# v = np.array([[1, 2, 3]
# [...]
# [4, 5, 6]])
... |
2976b61b84373ed9fad5479601fd5d0f8b62fcebd03d6a20d18d0514516edd21 | Python | 963 | 40 |
class Pagination:
start = 0
end = 0
def __init__(self, length, limit, current_page=1):
self.length = length
self.limit = limit
self.pages = int((length - 1) / limit) + 1
self.current_page = current_page
self.calculate_start_end(current_page)
def calculate_sta... |
2d45995fda4fa592d5bb3800cfce6c264ead80a0da5caa9cd85869f75c7e13a7 | Python | 963 | 30 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for data API"""
import tempfile
import unittest
import warnings
from sknetwork.data.load import *
from sknetwork.data.toy_graphs import *
from sknetwork.data import Dataset
class TestDataAPI(unittest.TestCase):
def test_toy_graphs(self):
toy_graph... |
f470ff747628ef2b3fd457a2cdecbb6ef4ab8d1fb4431385f04a613add209aa5 | Python | 963 | 36 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import FasterRCNNEstimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.object_detection import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'dataset': 'shee... |
28692049abc5e65330b7871b49ae4bd5e2822ab2d259442b7d2baadadce075d3 | Python | 965 | 31 | import os
import numpy as np
import pandas as pd
from drug_interactions.utils.calc_metrics import calc_metrics
def main():
# dataset_type = "CHEMPROP_AFMP"
old_path = 'NewOldSimilar'
new_path = 'NewNewSimilar'
save_path = 'AllSimilar'
path = './data/csvs/results/All_Data/'
# calc_metrics(p... |
4a20aae625393ca68ffaae924257e9d3fec342114ef5f20ee431d109a826b686 | Python | 965 | 35 | import numpy as np
from .annotation import Annotation
class SkippedExon(Annotation):
"""
Represents an exon that can be skipped.
"""
@classmethod
def patterns(self):
return ["AD"]
def compatible_with_overlapping_junction(self, start, end):
# anything that overlaps this and do... |
de3d72fef8449efa416ee11426330b2d63d6ddbea59aba8a2f129e6cb0a6400a | Python | 965 | 36 | from distutils.core import setup
setup(
name='Decouple',
version='1.2.3',
packages=['Decouple', 'Decouple.BatchPlugins', 'scripts'],
license='LICENSE',
description='Decouple and recouple.',
long_description=open('README.md').read(),
author='Sven Kreiss, Kyle Cranmer',
author_email='sk@... |
7b4be4d689d04e738d9578f3572fed96915b41e11385dfcf552e68799e8ad202 | Python | 966 | 35 | 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=... |
b39f5bab8ee059403408ca7b7f05d4fccc4e0c9340f62fb467f18764f36b6b78 | Python | 966 | 28 | """
This module define MetricsFactory
"""
from metrics.metric_accuracy import MetricAccuracy
from metrics.metric_spearman_rho import MetricSpearmanRho
from metrics.metric_structure import MetricStructure
from metrics.metric_fmax import MetricFMax
from metrics.metric_smin import MetricSmin
class MetricsFactory:
""... |
ba7710a1f0fccb4e5c9d89ae9120794c28e6bdaa79850ac40d82eee980198234 | Python | 967 | 36 | import pathlib
import tempfile
import zipfile
import numpy as np
from impose import formats
data_path = pathlib.Path(__file__).parent / "data"
def get_czi():
td = pathlib.Path(tempfile.mkdtemp(prefix="impose_czi_"))
with zipfile.ZipFile(data_path / "lsm-fish.zip") as arc:
arc.extractall(path=td)
... |
2007413ca8304db7e0ed7aa324915f4a52d73b03b0ef07fcb2e8c966250c0456 | Python | 968 | 33 | import numpy as np
def real_ndim(x: np.ndarray):
"""
Determine dimensionality of an array based on its shape. This is unlike the ndim method, which shows the number
of dimensions based on the length of shape.
:param x: A numpy array.
:return: The number of dimensions.
"""
# Compute the nu... |
35902a02ebbffbdbc946d007ed03bbf4213d38fda15004f5b308854824fa25e5 | Python | 968 | 29 | """Test functions for specparam.metrics.definitions."""
from specparam.metrics.metrics import Metric
from specparam.metrics.definitions import *
###################################################################################################
########################################################################... |
4fc2bfe79ac3ff13153d3b2eb50c1a43145217aa9858684081ccf2dfbbd08f51 | Python | 968 | 37 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import SSDEstimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.object_detection import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'dataset': 'sheep',
... |
bda4ab73a09c2a93446e56f3b71817976f8605226f8949bf62802acc20af6435 | Python | 968 | 41 | from bokeh import colors
from angorapy.common.const import COLORMAP
palette = [colors.RGB(*[int(c * 255) for c in color]) for color in COLORMAP]
darker_palette = [c.darken(0.3) for c in palette]
tooltip_css = """
tooltip {
background-color: #212121;
color: white;
padding: 5px;
border-radius: 10px;
... |
be3346f8883eb165b95ba4d07d83f49bc0993c2372cf67feba6d351c6cc977bf | Python | 968 | 27 | from typing import Any
from pl_bolts.datasets.mnist_dataset import MNIST
from pl_bolts.datasets.sr_dataset_mixin import SRDatasetMixin
from pl_bolts.utils import _PIL_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _PIL_AVAILABLE:
from PIL import Image
else: # pragma: no cover
warn_missing_... |
dd30010f0caf9db0aebab10ad3dce1fdd8aadbb9f0ce46f416a952fc83991401 | Python | 968 | 30 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Mine_estimator(nn.Module):
def __init__(self, input_dim=2048, hidden_dim=512):
super(Mine_estimator, self).__init__()
self.mine_model = Mine(input_dim, hidden_dim)
def forward(self, X, Y):
Y_shffle = Y[torch.randp... |
0dda334ea40bbf22c5341294549cc2056d997ca911a622b3fa8045973e663c6e | Python | 969 | 34 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture["num_motifs"] = 100
msp.arc... |
1327bca66ed196a00a395c39e7f07d01cccfa108ce8edc869bcac378db7b84e8 | Python | 969 | 49 | from __future__ import print_function
import progressbar
import sys
from .flags import FLAGS
# Logging functions
# =================
def prefix_print(prefix, message):
print(prefix + ('\n' + prefix).join(message.split('\n')))
def log_debug(message):
if FLAGS.log_level == 0:
prefix_print('D ', mes... |
2779f02170429414c945b6b33a090460c8b14c779c0454587fbe6f47e9b0ee8a | Python | 969 | 25 | '''
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... |
5ed605993da579ee6b2c973a2571ea6c35a225d584fdcfe8e0706de9ef7aba7f | Python | 969 | 23 | import numpy as np
import torch
import opt_einsum as oe
from torch.autograd.functional import jacobian
from src.MODEL import *
#============================calculate the energy===================================
class Property(torch.nn.Module):
def __init__(self,density,nnmod):
super(Property,self).__init_... |
65cb64902459143d91ed41370f2f194648ff3d4502257cd1f3f10d6d63f8d535 | Python | 969 | 29 | # Copyright (c) OpenMMLab. All rights reserved.
from .barlowtwins import BarlowTwins
from .base import BaseModel
from .byol import BYOL
from .cae import CAE
from .classification import Classification
from .deepcluster import DeepCluster
from .densecl import DenseCL
from .mae import MAE
from .maskfeat import MaskFeat
fr... |
163b67e393772f150f89d432e25e265d96a4ed10b06f4cf4470f401aa0d8aaba | Python | 970 | 30 | """
This module define a L1 loss with min max norm
"""
# pylint: disable=W0223
import torch
import logging
from utils.utils import select_output_lm
class L1LossSoftmax(torch.nn.modules.loss._Loss): # pylint: disable=protected-access
"""
This class define a specific loss : L1 loss with a min max normalisation... |
1c3d94e5af4a230646e4f9bf8ece9425f8483801e47fe255deac4d20758890fc | Python | 970 | 26 | '''
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... |
84743b6531202c9cbeeaef97598ed73c6c6bfd03359fdc1ba0df7b120d39ea55 | Python | 970 | 38 | ## Small library for reading images and spectra exported as txt from Renishaw software
import numpy as np
import pylab as pl
import operator as op
from scipy import stats,ndimage,signal
bclose, bopen = ndimage.binary_closing, ndimage.binary_opening
def load_spectrum(fname):
"Read spectrum exported as text from R... |
9532fa52a278d63c492b71f0e7980111f1140dab377c0bd302a002e5551f6bf8 | Python | 970 | 28 | """Shared pytest fixtures for the CodeCarbon test suite."""
import pytest
from codecarbon.core.hardware_cache import clear_cache as clear_hardware_cache
@pytest.fixture(autouse=True)
def _reset_process_hardware_cache():
"""Isolate hardware/TDP/GPU probe caches between tests."""
# Import probe modules so cle... |
8b717271bc8599eb68de082c0e321537cb24d8950bc3c3a3317dd4122f7f37a0 | Python | 971 | 41 | import torch.nn as nn
class NoPresparseNormalizer(nn.Module):
"""
Do not normalize the input to the sparse layer.
"""
def __init__(self, num_motifs, affine):
super().__init__()
self.num_motifs = num_motifs
def forward(self, x):
return x
@property
def num_features... |
af3723065b6d07168422f0e2f4de9b57a28de0bc5595b33414f65dc8e8c6addb | Python | 971 | 33 | import torch
import torchvision
import torch.nn as nn
import torch.optim as optim
class BasicNet(nn.Module):
"""Simple CNN with a few convolutional
and pooling layers, used as an MVP in development.
"""
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size ... |
b39095df01f2609ab5820f196b1d70822a02aaeac2e81e5d429029d96836a62c | Python | 971 | 38 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 172
msp.architecture["channels"] = 200
psam_model = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P") + tuple(rbnsp_split_90... |
4bf4fef1554ee9854e772f38fe928a8f1584e27720063ea92dfa7037c31d2223 | Python | 972 | 33 | # -*- coding: utf-8 -*-
"""Helper utilities and decorators."""
from flask import flash
import matplotlib.pyplot as plt
def flash_errors(form, category="warning"):
"""Flash all errors for a form."""
for field, errors in form.errors.items():
for error in errors:
flash(getattr(form, field).la... |
bb03ef4e423147f5c05abcf8783db67e4e548af53f131acbdbef338ea4ad2fd8 | Python | 972 | 35 | """
Bring all subjects' heads to the same head position.
"""
import sys
sys.path.append('..')
import subprocess
import argparse
import mne
from config import fname
# Be verbose
mne.set_log_level('INFO')
# Handle command line arguments
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('subject'... |
ebc770f0dd9505f82517c7956df7f6879553fc5a13a016d14e6f3f01b0505ec9 | Python | 972 | 24 | # Power Usage Effectiveness Coefficient.
# Rhonda Ascierto. 2020-2021. Uptime Institute Annual Data Center Survey.
# https://www.missioncriticalmagazine.com/ext/resources/whitepapers/2020/2020AnnualSurvey_EndUser_v4s.pdf
from carbontracker.emissions.intensity.fetchers import electricitymaps
PUE_2020 = 1.59
# https:/... |
f15c3fa11295e98a4934a1af09fa158cf36329194071b700777604cd30215256 | Python | 972 | 31 | import numpy as np
from gym.vector import VectorEnvWrapper, make
class DummyWrapper(VectorEnvWrapper):
def __init__(self, env):
self.env = env
self.counter = 0
def reset_async(self, **kwargs):
super().reset_async()
self.counter += 1
def test_vector_env_wrapper_inheritance()... |
08c9b96a194600610bc9970a83589a732fb2833fe0bb83019282dfab3e21ab7e | Python | 973 | 33 | from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data
from wyrm.processing import square
class TestSquare(unittest.TestCase):
def setUp(self):
raw = np.arange(1, 21).reshape(4, 5)
channels = ['ca1', 'ca2', 'cb1', 'cb2', 'cc1']
time = np.arange(4)... |
0ee7de53d01e8bd3d5bef388578dcd5630ed3e4758f69572e2f1ba74964209a1 | Python | 973 | 34 | import numpy as np
from nilearn.image import load_img, new_img_like
import sys
import glob
import os
def t_to_cohensd(t_stat, n):
# calc cohens d as t / sqrt(n)
cohens_d = t_stat / np.sqrt(n)
return cohens_d
# in path
inp_dir = sys.argv[1]
img_list = glob.glob(f"{inp_dir}/**/*stat-tstat.nii.gz", recursive... |
101bea8bf3359506b6e3eadec98b9a095c61982f68d749bba21a0b98ee067540 | Python | 973 | 34 | # # -*- coding: utf-8 -*-
# # @Author : Yue Liu
# # @Email : yueliu19990731@163.com
# # @Time : 2021/11/25 11:11
from dgc.rand import setup_seed
from dgc.utils import normalize_adj
from dgc.utils import load_graph_data
from dgc.augmentation import diffusion_adj, add_edge, drop_edge, mask_feat
from dgc.visualizati... |
e2fa889d26c8e3e1ec43eea66674e92e6c09b37bc4f340df224c6ba43c39088b | Python | 973 | 28 | from permacache import stable_hash
def hash_model(m):
"""
Produces a hash of the model's state dict, along with some of its fields.
This is a legacy function, and should not be used for new code. Instead use
stable_hash directly on m. This function is only used for compatibility
with old ... |
5a84ebf93548d49b051799812e50995f11dc243bc85b9b11b07c7dc252031b1c | Python | 974 | 41 | """A set of common utilities used within the environments.
These are not intended as API functions, and will not remain stable over time.
"""
color2num = dict(
gray=30,
red=31,
green=32,
yellow=33,
blue=34,
magenta=35,
cyan=36,
white=37,
crimson=38,
)
def colorize(
string: st... |
2a2786336d4a4959033e8ec17e1889ac100bde78a59848b6bb2046a05ba2b7ed | Python | 975 | 32 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._marker import Marker
from ._selected import Selected
from ._textfont import Textfont
from ._unselected import Unse... |
57292a245faf5e46e3ea438c56d2205e03874dc80f9408dba4661fac291011e7 | Python | 975 | 18 | import fcntl
from galaxy.util import unicodify
def fork_safe_write(path: str, contents: str):
# The following write method looks a little funky and is inspired by https://twitter.com/_monoid/status/1317895053122150400.
# This should guarantee that we wait until all forks that inherit open FDs have proceeded ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.