sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7b056c6740c4ffd585b2ef87947f646e1d97f0071d915db0a10730990ee003de | Python | 347 | 12 | import pandas as pd
REFTIME = pd.Timestamp("1900-01-01")
def to_unixtime(str_time_array):
unix_times = (pd.to_datetime(str_time_array) - REFTIME) // pd.Timedelta("1d")
return unix_times
def from_unixtime(unix_time_array):
datetimes = [pd.to_datetime(t * pd.Timedelta("1d") + REFTIME) for t in unix_time_a... |
a305fdb9f1b2bccd5a8268c3889e17500d71aa856e8feb551ec3fc40163cf2ce | Python | 347 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.ajd."""
import sys
import warnings
from ..geometry import ajd as _moved
warnings.warn(
"pyriemann.utils.ajd is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.ajd instead.",
DeprecationWarning,
stacklevel=2,
)
sys.... |
51e630f32d071680673f38aa9d56174adf23a85b640e090208c3e1613108685d | Python | 348 | 8 | """ranking module"""
from sknetwork.ranking.base import BaseRanking
from sknetwork.ranking.betweenness import Betweenness
from sknetwork.ranking.closeness import Closeness
from sknetwork.ranking.hits import HITS
from sknetwork.ranking.katz import Katz
from sknetwork.ranking.pagerank import PageRank
from sknetwork.ranki... |
638c0a63476f98cfbd7e5f498cb48a74364bb7860edbe5bc6009739e6f38d6fa | Python | 348 | 13 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._line import Line
from . import colorbar
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".colorbar"], ["._colorbar.Colo... |
63b18592c0cfb328db808cbef841c77699d1fca0a0de46b1e67c95d36bf38ff6 | Python | 348 | 17 | # Generated by Django 2.2.2 on 2019-08-19 13:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0046_auto_20190819_1515'),
]
operations = [
migrations.RemoveField(
model_name='upload',
name='stride_size_... |
973bb04b7d07fdaf8324c96ce8a146813420589a8204e28152014e06bc86ed4f | Python | 348 | 10 | from setuptools import setup, Extension
marisa_module = Extension("_marisa",
sources=["marisa-swig-python3_wrap.cxx",
"marisa-swig-python3.cxx"],
libraries=["marisa"])
setup(name = "marisa",
ext_modules = [marisa_module],
... |
e0d2aeecc5aee8bb462e0f2f0b350975838222895773f79e87dfc8983220e31b | Python | 349 | 12 | """Tests for the xcp_d.utils.doc module."""
import os
from xcp_d.utils import doc
def test_download_example_data(tmp_path_factory):
"""Test download_example_data."""
tmpdir = tmp_path_factory.mktemp('test_download_example_data')
example_data_dir = doc.download_example_data(out_dir=tmpdir)
assert os.... |
ebcd588f0f46e255b16a4eb3a7f265b2f4dfb13ff61c5247f968db5ae03c8070 | Python | 349 | 23 | """Workflows for processing BOLD data."""
from xcp_d.workflows.bold import (
cifti,
concatenation,
connectivity,
metrics,
nifti,
outputs,
plotting,
postprocessing,
)
__all__ = [
'cifti',
'concatenation',
'connectivity',
'metrics',
'nifti',
'outputs',
'plotti... |
6785b9ae9209649b44df7a414e0e52bb278fc7bcfcd6efb08be581a809eda37c | Python | 350 | 12 | import math
def margin_of_error(values, confidence_interval=1.96):
num = len(values)
mean = sum(values) / num
variance = sum(list(map(lambda x: pow(x - mean, 2), values))) / num
standard_deviation = math.sqrt(variance)
standard_error = standard_deviation / math.sqrt(num)
return mean, standar... |
73c3d304632deadd86bc56afbc95d213c13bfb4759ee8b289b6e688b37ca2688 | Python | 350 | 12 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._tickfont import Tickfont
from ._tickformatstop import Tickformatstop
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._tickfont.Tickfont", "._tickform... |
2fc86cc035830ed913102e679e13ea0a6d3ebd6a117d9189f22a5aba91dfde3a | Python | 351 | 17 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import os
from eelbrain import *
import mne
PATH = 'test-ica.fif'
ds = datasets.get_mne_sample()
if os.path.exists(PATH):
ica = mne.preprocessing.read_ica(PATH)
else:
ica = mne.preprocessing.ICA(0.95)
ica.fit(ds['epochs'])
ica.save(PATH)
g = g... |
59bb70d7613475d8cbc540994578b1538fad2960cf850503330e24ca852f610b | Python | 351 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.test."""
import sys
import warnings
from ..geometry import test as _moved
warnings.warn(
"pyriemann.utils.test is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.test instead.",
DeprecationWarning,
stacklevel=2,
)
... |
6afa11f851196ef40122b50a64e8097b0f0d9e0e0e7aa0c1cb7dae11744a1505 | Python | 351 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.base."""
import sys
import warnings
from ..geometry import base as _moved
warnings.warn(
"pyriemann.utils.base is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.base instead.",
DeprecationWarning,
stacklevel=2,
)
... |
6e5de54301b5c550c8666e7102c48e14324b95b578ff883673532e3a4e2f0fa6 | Python | 351 | 12 | from PyQt5 import QtWidgets
from PyQt5 import QtCore
from .tracker_control_ui import Ui_TrackerControl
class TrackerControlWidget(QtWidgets.QWidget):
def __init__(self):
flags_ = QtCore.Qt.WindowFlags()
super(TrackerControlWidget, self).__init__(flags=flags_)
self.ui = Ui_TrackerControl()... |
92ad8bd438677b13c98abedbb16a5888d72dd77d2daaa2d41bd80ab36c5c25b8 | Python | 351 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.mean."""
import sys
import warnings
from ..geometry import mean as _moved
warnings.warn(
"pyriemann.utils.mean is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.mean instead.",
DeprecationWarning,
stacklevel=2,
)
... |
c5fe0e3d6d9f21b21117135b866f7504117b88c6dbc07007411efa7dcd3688b6 | Python | 351 | 12 | #!/usr/bin/env python
"""
# Author: Yahui Long
# File Name: __init__.py
# Description:
"""
__author__ = "Yahui Long"
__email__ = "long_yahui@immunol.a-star.edu.sg"
from .utils import clustering, project_cell_to_spot
from .preprocess import preprocess_adj, preprocess, construct_interaction, add_contrastive_label, get_... |
f1c31554eec34d1bf8c296bd47b429266c16eb3ad6dfbc8f0e873596672e23f6 | Python | 351 | 12 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
if __name__ == '__main__':
try:
from deepspeech_training import train as ds_train
except ImportError:
print('Training package is not installed. See training documentation.')
ra... |
309f456d269228700a70c356aec6ac4d0e41823625389dcb97ebbbe461257d11 | Python | 352 | 13 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._marker import Marker
from ._textfont import Textfont
from . import marker
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".marker"], ["._marker.Marker... |
0cc912d76171335079133193d8cf9f9c2357d415f601573b60ecf25066f1436c | Python | 353 | 11 | import os.path
import matplotlib.image as mpimg
def get_brain_pictures():
this_folder = os.path.dirname(__file__)
back = mpimg.imread(os.path.join(this_folder, 'brain_back.png'))
side = mpimg.imread(os.path.join(this_folder, 'brain_side.png'))
top = mpimg.imread(os.path.join(this_folder, 'brain_top.pn... |
a35d854e72b06d166deb1772a125f5ef2692d3fe0566c37494e5b7381bd78065 | Python | 353 | 14 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp.... |
d2ea58dfda55f39128e52615b2c2f80c6422421ca9af2b8eb0cd7b0e1f3d317f | Python | 353 | 15 | from .models_for_testing import EndToEndModelsForTesting, STANDARD_DENSITY
MD_2 = EndToEndModelsForTesting(
name="MD_2",
path_prefix="model/msp-290a1",
seeds=(1, 2, 3),
density=STANDARD_DENSITY,
)
MD_3 = EndToEndModelsForTesting(
name="MD_3",
path_prefix="model/msp-290b1",
seeds=(1, 2, 3),... |
41c4419fa449a61487742ffc7e81b521f07bcd3d32062b6cc9b309eae85f8f0b | Python | 354 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-8a2_1",
original_model_step=4010295,
... |
fd86db9db9428613680d25a0c984e7bda80fa0f08e34dea4174570cb9f3feaef | Python | 354 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-8a2_1",
original_model_step=4010295,
... |
80fd2f50111c70c3cd6e6a86fd77872086f86b28a5f1557ebd5c89aa1f96b8bb | Python | 355 | 7 | from .preprocessing.filter_genes import filter_genes
from .preprocessing.normalize import normalize_total
from .preprocessing.log_scale import log1p
from .preprocessing.log_scale import scale
from .preprocessing.graph import neighbors
from .image_preprocessing.image_tiling import tiling
from .image_preprocessing.featur... |
d389e0ac9ec0852cd34674b478829cf60fb38a8a9ced9bee8fa6a310ed976d87 | Python | 355 | 18 | # Auxilary utilities for image-funcut
from . import array_handling as ah
from . import baselines
from . import coords
from . import deco
from . import extrema
from . import fnutils as fu
from . import misc
from . import units
from .misc import ifnot,rezip
from .random_proc import ar1
from .array_handling import re... |
7e61bb48103d09ec1098d49c95d639d4251db36be945e001b8e726a4b5b41809 | Python | 356 | 12 | # membrane noise
from brian2 import mV
from pypet import cartesian_product
input_dict = {'ext_drive': [0.],
'sigma_noise': [3.5, 4.0, 4.5, 5.0, 5.5]*mV}
# 'sigma_noise': [1., 1.5, 2., 2.5, 3.]*mV} # no spikes
name = 'hdf5_data'
# explore_dict = n_list(input_dict) # check later if I need that
explore_d... |
95f6cd25a10de8e0a184a1ca54cd093ec63652a7afa4c74eb9ef94c7ecb4280d | Python | 356 | 17 | import pytest
import celery
def test_version():
assert celery.VERSION
assert len(celery.VERSION) >= 3
celery.VERSION = (0, 3, 0)
assert celery.__version__.count('.') >= 2
@pytest.mark.parametrize('attr', [
'__author__', '__contact__', '__homepage__', '__docformat__',
])
def test_meta(attr):
... |
ab9920da19d3b8348be553b4b425e7e518b3de28687554ed1553fd3dd10415b1 | Python | 356 | 15 | import torch
import torch.nn as nn
from .linear_effects import LinearEffects
class FullTableLinearEffects(LinearEffects):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.mu = nn.Parameter(
torch.randn(self.num_motifs, self.num_motifs, self.width)
)
def compu... |
e1eab974083b133f95d78698568957a96ecda69f2f4ee2b684638d1f777c4749 | Python | 356 | 16 | import torch
import torch.nn as nn
from bioseq2seq.utils.misc import aeq
class DecoderBase(nn.Module):
"""Abstract class for decoders.
Args:
attentional (bool): The decoder returns non-empty attention.
"""
def __init__(self, attentional=True):
super(DecoderBase, self).__init__()
... |
3cddbdcddc6a57cae3036d0191113f312527c936ef000a08b3d61131f1ca5a85 | Python | 357 | 18 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import tensorflow.compat.v1 as tfv1
def main():
with tfv1.gfile.FastGFile(sys.argv[1], "rb") as fin:
graph_def = tfv1.GraphDef()
graph_def.ParseFromString(fin.read())
print("\n".join(sorted(set(n.op for n in graph_def.node))))
i... |
ba1c9644aec3d39b021532799c6ba0f03b52cdacf220961d717860eb2bfe0d2b | Python | 357 | 12 | import numpy as np
# TODO: Do advanced prediction based on profiling work.
def predict_energy(total_epochs, epoch_energy_usages):
avg_epoch_energy = np.mean(epoch_energy_usages)
return total_epochs * avg_epoch_energy
def predict_time(total_epochs, epoch_times):
avg_epoch_time = np.mean(epoch_times)
... |
3b8863be8d2dd7cff767ce6274b25269c7110003a86a2626e86f28f0ab8550d8 | Python | 358 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-8a2_1",
original_model_step=4010295,
... |
ce8c02d1b7d00da74342bed2a2246e3684092abda3829dec253afbbbf3711500 | Python | 358 | 16 | # from .embedding.scvi import run_ldvae
from .embedding.diffmap import run_diffmap
# from .embedding.scvi import run_ldvae
from .embedding.fa import run_fa
from .embedding.ica import run_ica
from .embedding.pca import run_pca
from .embedding.umap import run_umap
__all__ = [
"run_diffmap",
"run_fa",
"run_i... |
da830981cf6a830769f649f9d34dee71c3916d69a12c00443911fbef1701d5a9 | Python | 358 | 13 | #!/usr/bin/env python3
import os
import fileinput
html_files = [f for f in os.listdir() if f.split('.')[-1] == 'html']
for f in html_files:
with fileinput.FileInput(f, inplace=True) as file:
for line in file:
print(line.replace('_static', 'static'), end='')
try:
os.rename('_static', 'static... |
48732e456f6541934c30fc97e88c5ee05336bcc43bf8d2be196fbe36db84c95a | Python | 359 | 19 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=dict(type="SpliceAIModule", output_size=3),
)
msp.data_dir = "../data/gtex_dataset/"
msp.acc_thresh... |
6b9e80aa968d5a4da8c9f83ff0667b5d92637de39588e67b7e2c7c9d76fa9bf4 | Python | 359 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.kernel."""
import sys
import warnings
from ..geometry import kernel as _moved
warnings.warn(
"pyriemann.utils.kernel is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.kernel instead.",
DeprecationWarning,
stackleve... |
ab131e24af67a2c1ee3b3dd87fe4158606a8ad61bf77e28cabfaee84411163ff | Python | 359 | 24 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = 1e-3
msp.window = 40
msp.batch_size = 150
msp.architecture = dict(
type="SplicePointIdentifier",
cl=40,
asymmetric_cl=(2, 6),
hidden_size=100,
n_layers=5,
)
msp.extra_params += " --only-trai... |
b19fc49199ade92990052adf38cfe6d7a0b1eeb06fb0e7fcf0cca48ebe48f39e | Python | 359 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.median."""
import sys
import warnings
from ..geometry import median as _moved
warnings.warn(
"pyriemann.utils.median is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.median instead.",
DeprecationWarning,
stackleve... |
65bb50b59be539cfd882f53a2a7286cfb0056a16a1d2ada293c3800070767ad3 | Python | 360 | 13 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._font import Font
from ._hoverlabel import Hoverlabel
from . import hoverlabel
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".hoverlabel"], ["._font.... |
96534395560b34d961c1674de3e1daca2cda308f27e6ec649be1d9803b22ff85 | Python | 360 | 12 | import argparse
import json
import os
parser = argparse.ArgumentParser(description="you should add those parameter for pretrain")
parser.add_argument("--config", dest="config", help="path to the JSON config file", required=True)
args = parser.parse_args()
with open(args.config) as config_file:
config = j... |
b80121e04f9b22640da321978fa993f8f5633f494c0b94cb32ebe5e886cd769c | Python | 360 | 13 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._hoverlabel import Hoverlabel
from ._line import Line
from . import hoverlabel
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".hoverlabel"], ["._hover... |
d29f4350992949a2bbe86fbdda4c08f7f4316328c3af9ee2c7809f790d7f3f1f | Python | 360 | 12 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
if __name__ == '__main__':
try:
from deepspeech_training import evaluate as ds_evaluate
except ImportError:
print('Training package is not installed. See training documentation.')
... |
1ea2c8b5152092abfb97f87827f48a09c367e6c95b74e4cd35ea6af8fe2ed89f | Python | 361 | 25 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = 1e-3
msp.window = 40
msp.batch_size = 150
msp.architecture = dict(
type="SplicePointIdentifier",
cl=40,
asymmetric_cl=(2, 20),
hidden_size=100,
n_layers=4,
)
msp.extra_params += " --only-tra... |
35e5dff92d42392293eac6de7a2310becdcf77499451d274bc3f7c79fc2cf70c | Python | 361 | 14 | 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... |
dc98a6bf31664c091f4881ea82ab6b9e6189d82045a6630a63281ad889f973a9 | Python | 361 | 22 | from neuron import h, gui
def assert_equal(a, b):
assert a == b, f"{a} != {b}"
def test_external():
s = h.Section()
s.nseg = 5
s.insert("dst")
s.insert("src")
h.gbl_src = 321.0
assert_equal(s(0.5).dst.get_gbl(), h.gbl_src)
assert_equal(s(0.5).dst.get_param(), h.param_src)
if __n... |
f6792293970477fc03e2a155b8ab3144ff70ced9316c2f2580b6e1bbc356d2b6 | Python | 361 | 15 | __author__ = 'quentin'
import mysql.connector
db = mysql.connector.connect(host="localhost",
user="root",
passwd="",
db="psv_db")
cur = db.cursor()
cur.execute("DROP TABLE IF EXISTS song")
cur.execute("CREATE TABLE song ( id INT UNSIGNED PRIMARY KEY... |
3843148f27017e2b69e868144dee838a3aa03967bce514ce6c76cfdecbbd6b4e | Python | 362 | 7 | """Composition-expectation harness (compo wave 0, workstream P03).
The composition ledger, universe registry, diagnostic-site censuses (S-17 /
S-18), option receipt oracles, and shared product/model galleries live in
this tree. The normative spec is the compo design-review memo, section 7
rows 0.1-0.9; the U merge gat... |
7ccc676c1535092cae0483dcead0e7a251934a6dc312b6dbd7482a609a7323aa | Python | 362 | 11 | def checkType(arr, n=2):
# If the first two and the last two elements
# of the array are in increasing order
if arr[0] <= arr[1] and arr[n - 2] <= arr[n - 1]:
return True
# If the first two and the last two elements
# of the array are in decreasing order
elif arr[0] >= arr[1] and arr[n... |
95fd055a872bf8b4c83db6a2f0ef2d6f5da93c8ecf4bea4ae8921badc2e4544c | Python | 362 | 10 | def check_type(arr, n=2):
# If the first two and the last two elements
# of the array are in increasing order
if arr[0] <= arr[1] and arr[n - 2] <= arr[n - 1]:
return True
# If the first two and the last two elements
# of the array are in decreasing order
elif arr[0] >= arr[1] and arr[n... |
0dbcb0d5ca2ad9c18cfa0ad613ec0a6f63b2c95c9f8b01ca5e7b22e259ff5f4d | Python | 363 | 17 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import sys
from common import sort_items
if len(sys.argv) < 2:
print("Sort the dictionary")
print(("Usage: ", sys.argv[0], "[directory]"))
exit(1)
directory = sys.argv[1]
files = glob.glob(directory + "/*.txt")
for filename in files:
print(fi... |
2a8f777e605ff0d60c88bffd96fbd1b783b6c2ae6b801a6fd3fc1cce972eb96d | Python | 363 | 17 | def default_key(x):
""" Default comparison function."""
return x
def order(seq, key=default_key, reverse=False):
""" Return the order in which to take the items to obtained
a sorted sequence."""
o = list(range(len(seq)))
def wrap_key(x):
x = seq[x]
return key(x)
o.sort(ke... |
2c52a7822e8eab893313e792d3cb41481d5c98e97b42882c2eca54225a344b58 | Python | 363 | 25 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = 1e-3
msp.window = 40
msp.batch_size = 15
msp.architecture = dict(
type="SplicePointIdentifier",
cl=40,
asymmetric_cl=(20, 2),
hidden_size=100,
n_layers=5,
)
msp.extra_params += " --only-trai... |
486c98d98abf84021c22055d3095bbe277c4c689b1856f2883c32c65da1b2853 | Python | 363 | 27 | from .emission_track import (
Tracker,
track,
__version__
)
from eco2ai.tools.tools_cpu import (
CPU,
all_available_cpu
)
from eco2ai.tools.tools_gpu import (
GPU,
all_available_gpu
)
from eco2ai.tools.tools_ram import (
RAM,
)
from eco2ai.utils import (
available_devices,
... |
92bc04a80cf7c62bfc908596bb9cd3189b0d58f77648d07205b3db1d9c40e5d8 | Python | 363 | 17 | from setuptools import setup, find_packages
setup(
name='chcochleagram',
version='1.0',
author='Jenelle Feather',
author_email='jfeather@mit.edu',
packages=find_packages(include=['chcochleagram', 'chcochleagram.*']),
install_requires=[
'numpy',
'matplotlib',
'jupyter',
... |
d9b4204c956ea0dcfa1f20da35d3ce2c4d3c44f8128c3ec7ba4e5cfec6a3538e | Python | 363 | 19 | import sqlite3
from .db import DB
class Overview(DB):
def __init__(self):
super().__init__()
self.table_name = 'MP_overview'
self.table_desc = 'Overview'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL',
'ca... |
97460375c1d9ee6cd0fd2df0ef559d75e777d50f06b14f287b968156b0a47687 | Python | 364 | 9 | from .conf_ranker import ConfRanker
from .no_ranking_ranker import NoRankingRanker
from .random_ranker import RandomRanker
from .model_ranker import ModelRanker
from .energy_ranker import EnergyRanker
from .tfd_ranker_sim import TFD2SimRefMCSRanker
from .sasa_ranker import SASARanker
from .rgyr_ranker import RGyrRanker... |
f1383eb04493ab6ffa3cf2dc24fa308a37f93166912ee7b7fd2ba3149750ef10 | Python | 365 | 18 | import sys
import os
import re
import json
import numpy
import nrrd
import os
import copy
import gzip
import requests
import zlib
import numpy as np
import pandas as pd
import pickle as pk
from IPython.display import display, Markdown
from collections import OrderedDict
from allensdk.core.reference_space_cache import R... |
2cf83a550f416383cc72743dd2658fb3dc2ca19123b0b86a9d507c04a2c48882 | Python | 366 | 9 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from .basic import (
tqdm,
PickleableDataClass,
as_list, as_sequence, ask, deprecated, deprecated_attribute, intervals,
LazyProperty, keydefaultdict, n_decimals, natsorted,
log_level, set_log_level, ScreenHandler,
)
from .system import IS_OSX,... |
5e849dc6984b0b3944ea687e40d96da9d5a9f42e32aa5b4035dedef4558ad83d | Python | 366 | 20 | from flask import Blueprint
from flask import render_template
admin = Blueprint(
"admin",
__name__,
url_prefix="/admin",
template_folder="templates",
static_folder="static",
)
@admin.route("/")
def index():
return render_template("admin/index.html")
@admin.route("/index2")
def index2():
... |
7fc3bbbf48a706e5f2a6ee980665ffe2061ff32779e718f2a3f2042676dd4510 | Python | 366 | 12 | """The lightly.embedding module provides trainable embedding strategies.
The embedding models use a pre-trained ResNet but should be finetuned on each
dataset instance.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.embedding._base import BaseEmbedding
from lightly.embed... |
03ac534d861974625972be60cd13141ff42faae2e35224da1329bd00a21df1cb | Python | 367 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.distance."""
import sys
import warnings
from ..geometry import distance as _moved
warnings.warn(
"pyriemann.utils.distance is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.distance instead.",
DeprecationWarning,
s... |
50713012c3a5e8045f368672342aea6eeeb3b3ce0968cb5639b1f158b9499487 | Python | 367 | 18 | """Flash Attention CUTE (CUDA Template Engine) implementation."""
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("fa4")
except PackageNotFoundError:
__version__ = "0.0.0"
from .interface import (
flash_attn_func,
flash_attn_varlen_func,
)
__all__ = [
"fla... |
942d06f60c125689fd1ed289b03dd6d436f37d9122b543543308525c526117f8 | Python | 367 | 21 | import time
from codecarbon import track_emissions
@track_emissions(
measure_power_secs=3,
pue=2,
force_carbon_intensity_g_co2e_kwh=1,
log_level="DEBUG",
)
def train_model():
"""
This function will do nothing.
"""
print("30 seconds before ending script...")
time.sleep(30)
if __n... |
c7788435960255dd2c9cff90dd2b2c48581e8ab22cdcce85ea4e3df920da03c5 | Python | 367 | 14 | """Backward-compatibility shim. Module moved to pyriemann.geometry.geodesic."""
import sys
import warnings
from ..geometry import geodesic as _moved
warnings.warn(
"pyriemann.utils.geodesic is deprecated and will be removed in "
"0.14.0; use pyriemann.geometry.geodesic instead.",
DeprecationWarning,
s... |
de49525222ca65cbe3253370f795cc7b8544d189200e9c40dc1b5ace69c89afd | Python | 367 | 11 | """BdPy: Brain decoding toolbox for Python.
Developed by Kamitani Lab, Kyoto Univ. and ATR.
"""
# `import bdpy` implicitly imports class `BData` (in package `bdata`) and
# package `util`.
from .bdata import BData
from .bdata import vstack, metadata_equal
from .util import create_groupvector, divide_chunks, get_refda... |
61a4c39975529f8be73facbc5016fd4925dfad25ec1ba853d25a5d80cb813bab | Python | 368 | 13 | from pl_bolts.models.vision.image_gpt.gpt2 import GPT2
from pl_bolts.models.vision.image_gpt.igpt_module import ImageGPT
from pl_bolts.models.vision.pixel_cnn import PixelCNN
from pl_bolts.models.vision.segmentation import SemSegment
from pl_bolts.models.vision.unet import UNet
__all__ = [
"GPT2",
"ImageGPT",
... |
61daa1ef8c0832659ebe67c066c2ddab597a3eb53f5c6f1ae5613879762f8890 | Python | 368 | 14 | """Backward-compat shim. Module moved to pyriemann.geometry.covariance."""
import sys
import warnings
from ..geometry import covariance as _moved
warnings.warn(
"pyriemann.utils.covariance is deprecated and will be removed in 0.14.0; "
"use pyriemann.geometry.covariance instead.",
DeprecationWarning,
... |
15ab4c0840c9f6ea2bc89b233a874eb7ad4291f6ec75c2a7bb7d51ff5233eb4d | Python | 369 | 14 | """Backward-compat shim. Moved to pyriemann.geometry.tangentspace."""
import sys
import warnings
from ..geometry import tangentspace as _moved
warnings.warn(
"pyriemann.utils.tangentspace is deprecated and will be removed in 0.14.0;"
" use pyriemann.geometry.tangentspace instead.",
DeprecationWarning,
... |
4a9f4e4b44cd90e009e4dba1fbae0b6c01ddd74b90bd6e0291ec6fadcddd5db1 | Python | 369 | 15 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2010 University of Zürich
# Author: Rico Sennrich <sennrich@cl.uzh.ch>
# For licensing information, see LICENSE
import sys
from command_utils import load_arguments
from bleualign.align import Aligner
if __name__ == '__main__':
options = load_arguments(sys.ar... |
958634f3d08eb8898baff6eaadd7cc455b7756736d9790f6015e6826e5d5c166 | Python | 369 | 11 | from modular_splicing.models_for_testing.list import non_binarized_models
def short_donor_models(at_sparsity=0.178e-2):
"""
Produce the models for the knockdown analysis.
Output is a dictionary mapping from model name to ([list of models], motif_names_source).
"""
return {x.name: ([x.model], "rb... |
050ff4645ff7bbb3c870a6d671b504af2566238c0391911bdd6704308a4bd43d | Python | 370 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-8a2_1",
original_model_step=4010295,
... |
9b2c4facd18680d346dab13fd4a6a702b82a9eeb1a26584abef31b3c4ca57284 | Python | 370 | 16 | def _test_image_nuclei_2d():
from stardist import data
return [(data.test_image_nuclei_2d(), {"name": "nuclei_2d"})]
def _test_image_he_2d():
from stardist import data
return [(data.test_image_he_2d(), {"name": "he_2d"})]
def _test_image_nuclei_3d():
from stardist import data
return [(dat... |
ca53d3269f40665b6ea281d1eddc2d7a6d5cbe418fbf0f3172987a2ef4962179 | Python | 370 | 9 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from .default import _C as cfg
from .default impor... |
d12cc872962e9c1cee01170baf27c95f0e670fd9fa4554ab5ef3767464ee13db | Python | 370 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-8a2_1",
original_model_step=4010295,
... |
d41d068d20ad7a4de1312dc781f69bcf6a449837179df2c8e297306d15d26d0b | Python | 370 | 8 | """Module defining inputters.
Inputters implement the logic of transforming raw data to vectorized inputs,
e.g., from a line of text to a sequence of embeddings.
"""
from bioseq2seq.evaluate.ensemble import Vote, Prediction, prediction_from_record
from bioseq2seq.evaluate.evaluator import Evaluator
__all__ = ['Vote','... |
10afd4d5758f0d2d22d550db6f5fbd78afad3540d17979127f7c3d5a44d940a4 | Python | 371 | 20 | CUDA_VISIBLE_DEVICES = "0"
AGE_FROM = 3
AGE_TO = 34+1
AGE_FROM_M = AGE_FROM * 12
AGE_TO_M = AGE_TO * 12
#dense net settings
target_size_dense_net = [256,256]
#unet settings
target_size_unet = [512,512]
unet_classes = 2 #bg and segmentation
#for post processing
softmax_threshold = 0.5
major_voting = True
scaling_... |
62670c1316b18489ff525c70f7ae46ad17de49a31ac9664701ffa83a57f8d7d6 | Python | 371 | 11 | import tensorflow as tf
from cvnn import layers, activations
if __name__ == '__main__':
for activation in activations.act_dispatcher.keys():
print(activation)
model = tf.keras.Sequential([
layers.ComplexInput(4),
layers.ComplexDense(1, activation=activation),
lay... |
253191e34905df9ffd82a2d54c4214ff6c49fd7b63b9e3ab427c266b770255e4 | Python | 373 | 16 | def ids_in_as_tuple(tuple_repr):
"""Return the id of every node in an as_tuple() tree."""
ids = []
def walk(tup):
if tup is None:
return
(res, nodes) = tup
(node_id, parent) = res
ids.append(node_id)
for child in nodes or ():
walk(child)
... |
89482d6ca5bd6f08bd39d62fa2b3b4a8a5025a80b0d6458a874f5c2937398579 | Python | 373 | 13 | import logging
import sys
logger = logging.getLogger("pyriemann")
if not any(isinstance(h, logging.StreamHandler) for h in logger.handlers):
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = logging.Formatter("%(message)s")
handler.setFormatter(formatter)
logge... |
9e0782dde42f21864049670df58309299d08f784b8830530094ae14b397ce0e5 | Python | 373 | 15 | try:
# First check if we're in a ray program and need a soft tf import
from ray.rllib.utils.framework import try_import_tf # type: ignore
tf1, tf, tfv = try_import_tf()
assert tfv == 2, "nfp requires tensorflow 2"
except ImportError:
# Next try a regular tf import
try:
import tensorf... |
6b23414b0cbde051ba45293da39e505e5e64bed94fd41f4c1580ad58cda7b2bc | Python | 374 | 12 | import torchmetrics
from typing import *
from torch import Tensor
class RescaledMAE(torchmetrics.MeanAbsoluteError):
def __init__(self, compute_on_step: Optional[bool] = None, rescale: float = 1):
super().__init__(compute_on_step=compute_on_step)
self.rescale = rescale
def compute(self) -> Te... |
f512d9e1139d06daf14974dd8ee6571a680e4d95a6c600e334abf58e917e57f3 | Python | 374 | 18 | #!/usr/bin/env python3
"""
multiple sequence alignment using muscle
"""
from .utils import run_cmd
def muscle(configs):
"""Multiple sequence alignment using muscle
"""
file_i = configs['file_seq']
file_o = configs['file_aln']
maxiters = configs['maxiters']
cmd = ['muscle', '-in', file_i, '-... |
32194acef94d9c365cfab2dd12d48a63aa81ed910dbfc7fd97b4e3810fd4e7ca | Python | 375 | 24 | import numpy as np
from neuron import h, gui
from neuron.units import ms
s = h.Section()
pp = h.range_parameter(s(0.5))
# Defaults set in the PARAMETER block:
assert pp.x == 42.0
assert pp.y == 0.0
# Assignable:
pp.x = 42.1
assert pp.x == 42.1
h.stdinit()
h.tstop = 5.0 * ms
h.run()
# Values (not) set during the ... |
8bdc294bf8f67db13f39816e4ad2ad4195cf55b2bc424398ade645bb938b4f43 | Python | 375 | 18 | # Generated by Django 3.0.4 on 2020-03-22 15:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0058_auto_20200322_1514'),
]
operations = [
migrations.RenameField(
model_name='mushroomspot',
old_name='da... |
2c7a09f67fdc105427249f4efaff0a6be313a9fdee34de39448629579035da36 | Python | 376 | 12 | from pyabf.abfReader import AbfReader
class Section(AbfReader):
def __init__(self, fb, infoBytePosition):
AbfReader.__init__(self, fb)
self.seek(infoBytePosition)
self._blockStart = self.readStruct("I")
self._byteStart = self._blockStart*512
self._entrySize = self.readStru... |
58e3480d7227d2b0c17d27c35ca60fdcaf57d802737a52908a26696e10ba9332 | Python | 376 | 9 | """Single source of truth for the face-rhythm package version.
Kept in its own module with NO other imports so build-time tooling
(``setuptools`` dynamic version lookup via ``attr``) and CI scripts
(``.github/scripts/increment_version.py``) can read/update it without
triggering heavy imports (``torch``, ``cv2``) from ... |
8b7b1fb668cad9416ac1d55e0a4ae44d52766b4f40e7e8795b56875748f6b7ec | Python | 376 | 9 | # -----------------------------------------------------------------------------
# Copyright (c) 2013, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... |
d323a7f5ea24ad8bb4543acc1efdbf1e5ec7a4e03f425a712f9d0e613c8ad9f4 | Python | 376 | 13 | """Python interface to the Dudman lab Mouse Joystick Rig."""
# This file is generated automatically from metadata
# File edits may be overwritten!
from mouse_joystick_interface.__about__ import (
__author__,
__copyright__,
__email__,
__license__,
__description__,
__url__,
__version__)
from ... |
b13328c865f4d589c7e77294d3f708397e404e0877b3f7488dc3f4b6937a3f5e | Python | 377 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._x import X
from ._y import Y
from ._z import Z
from . import x
from . import y
from . import z
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name_... |
f98ba85e163dcf13a71cd79cbdb966df02fe3012473757ccde2e1b4ae39bc4cd | Python | 377 | 17 | import os
from enum import Enum, auto
# indices of simulation parameters
class EnumSimParams(Enum):
chanum = 0
# type of model
class EnumNNModels(Enum):
fcsnet = 0
# file name
class FILENAME:
# general format for saving model in .h5 format
tfModelPID = "model-PID" + str(os.getpid())
tfModelSaveF... |
faeb51b735f450b034cea7a53c4d1ab1d85af34a3a08d5b72454100b1332e0f7 | Python | 377 | 9 | """Visualization tools"""
from __future__ import absolute_import
from .image import plot_image, cv_plot_image
from .bbox import plot_bbox, cv_plot_bbox
from .keypoints import plot_keypoints, cv_plot_keypoints
from .mask import expand_mask, plot_mask, cv_merge_two_images
from .segmentation import get_color_pallete, DeN... |
4a37f77b67adb2ec73e32f99a76e6b858133aa535a35daec89c8305547a8fd0a | Python | 378 | 19 | import logging
logging.info("Initializing Django settings for Celery integration tests")
DEBUG = True
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
CELERY_BROKER_UR... |
678148d8f36ece5f4e1771989aec4278d9c91b339ba804f84ae55465897232e8 | Python | 378 | 9 | class Weight_Scheduler():
def __init__(self,init_weight,final_weight,start_lr,end_lr):
self.init_weight = init_weight
self.final_weight = final_weight
self.start_lr=start_lr
self.end_lr=end_lr
def __call__(self,lr):
return self.init_weight+(self.final_weight-self.init_we... |
7722ad175f01e4cee3a5edb88e818e38f4fe7c1678c9b735429780c58a939562 | Python | 379 | 18 | # Generated by Django 3.2.6 on 2024-09-05 04:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0112_auto_20240905_0532'),
]
operations = [
migrations.RenameField(
model_name='specimen',
old_name='name_r... |
d00121fe9c9bfbfb1ae6780e70d6a2dd69f704d172de57299a1cee9ee555bdaf | Python | 379 | 14 | import datasets
from omop_learn.omop import OMOPDataset
datasets.config.MAX_IN_MEMORY_DATASET_SIZE_IN_BYTES *= 1000
# train using the huggingface (hf) ecosystem.
# less code when you want to do standard stuff,
# since you're using built-in training + eval loops.
dataset = OMOPDataset.from_prebuilt("eol_cohort6")
h... |
e9b14b2518e07862042c954097ce71b71ddac8dc28a2c17031b7515ba03efcbd | Python | 379 | 12 | # Copyright (c) OpenMMLab. All rights reserved.
from .base import BaseDataSource
from .cifar import CIFAR10, CIFAR100
from .image_list import ImageList
from .imagenet import ImageNet
from .imagenet_21k import ImageNet21k
from .ldpolypvideo import LDPolypVideo
__all__ = [
'BaseDataSource', 'CIFAR10', 'CIFAR100', 'I... |
29dc545135fc597c94b30357315cf9aead8e5dedf272b4d3d5638711f653a7cd | Python | 380 | 16 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 80
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(type="NoMotifModel")
msp.architecture["affine_sparsity_enforcer"... |
bbdd4d509b944bfe9e70f617b48fab624e25dd215d620bae7aed09edaa395186 | Python | 380 | 14 |
from setuptools import setup
setup (name = 'msem',
version = '0.1',
description = 'Python processing of Zeiss mSEM images',
author = 'Paul Watkins',
author_email = 'pwatkins@gmail.com',
url = '',
long_description = '''
Image processing for mSEM section stitching, section alig... |
cfda3b817e5e2ec8673c62ef8aa63eb33e61c58201bc10ddbb0135cc53f65e7e | Python | 380 | 13 | from .data_split import DataSplit
class NoSplit(DataSplit) :
def __init__(self) -> None:
self.split_type = 'no_split'
self.split_i = 0
super().__init__(split_type=self.split_type,
split_i=self.split_i)
def get_smiles(self,
subse... |
f9fac21c5540985eae58ba62fd074dc96e940de8bf2e13b327f0a209a30867f6 | Python | 380 | 14 | import numpy as np
np.random.seed(0)
class ContrastiveLearningViewGenerator(object):
"""Take two random crops of one image as the query and key."""
def __init__(self, base_transform, n_views=2):
self.base_transform = base_transform
self.n_views = n_views
def __call__(self, x):
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.