sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
aa0465919bc9ca9b51d073506c58e6b83f2bc8afcbb750d5b38b848a5026459d | Python | 485 | 26 | from sys import argv
from msp import MSP
from msp_donorlike import setup_as_adjusted_donor, train_in_parallel
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_adjusted_donor(msp)
msp.architecture["sparse_spec"] = dict(
type="ParallelSpatiallySparse",
sparse_specs=[
dict(type="NoSpars... |
4f33b4dd3c228dce3bd1bc60dd6f5ba717e4dd96dd07fce8c6647264d475151c | Python | 486 | 21 | # Generated by Django 2.2.1 on 2019-05-24 21:37
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Widget',
fields=[
('id', models.AutoField(a... |
7df1f8cfeda81538f8a3e90108a3182a1cdf4eca53525c003b3de25523ff0eae | Python | 486 | 26 | import numpy as np
from neuron import gui
from neuron import h
def simulate():
s = h.Section()
s.insert("thread_newton")
t_hoc = h.Vector().record(h._ref_t)
x_hoc = h.Vector().record(s(0.5).thread_newton._ref_x)
h.stdinit()
h.run()
t = np.array(t_hoc.as_numpy())
x = h.Vector(x_hoc.a... |
a562981b278f7c14aacc1092ff9c03a3f6c28c5f523a1fd275d7eef9e88c63ec | Python | 486 | 18 | """
I moved around the info page module. Ensure it still works.
"""
import os
import sys
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/")
sys.path.insert(0, PATH_SRC)
import pyabf
import glob
if __... |
0add2255934e44a188e6f23a6710dd8f905e2e6a0a0da376569ce285c35db339 | Python | 487 | 22 | import pytest
from rpy2.robjects import packages
has_dbplyr = None
try:
from rpy2.robjects.lib import dbplyr
has_dbplyr = True
msg = ''
except packages.PackageNotInstalledError as error:
has_dbplyr = False
msg = str(error)
@pytest.mark.skipif(not has_dbplyr,
reason=msg)
class ... |
16d16686428247681a2ad4f241fd4053e2230fa4f3ad6d65191b8acf8aa19929 | Python | 487 | 19 | __author__ = "quentin"
import json
import sys
if __name__ == "__main__":
if len(sys.argv) < 3:
raise Exception("Wrong number of args, JSON_FILE, field, value")
file = sys.argv[1]
field = str(sys.argv[2])
with open(file) as f:
data = json.load(f)
if len(sys.argv) == 3:
... |
3ca369fe34f93eb625f157d1e5c64b4b9d3bebeb9263059def134c700a5803c5 | Python | 487 | 20 | from .arrow_model import _construct_arrow, construct_arrow, construct_arrows
from .line_model import (
_construct_line,
construct_align_lines,
construct_axis_line,
construct_line,
construct_lines,
generate_edges,
)
from .morphofield_model import (
construct_field,
construct_field_plain,
... |
737bee091a97988d8314facbeac2584c60c44a620a9a54b47d8e1c7ce8ff444e | Python | 487 | 18 | import os
from drug_interactions.utils.calc_metrics import calc_metrics
def main():
# dataset_type = "CHEMPROP"
for folder in ['TTANewNew']:
path = f'./data/csvs/results/All_Data/{folder}'
print(folder)
for dataset_type in os.listdir(path):
print(dataset_type)
... |
93f6ff4f4cc4cd47f88705acdb1cd50132fe792a562092580f894be527c07b03 | Python | 487 | 23 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 64764 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec... |
c8295b667285890fd0417c4bf722dd2f2cac573df8d8a7a97ac56ff3c0a5846a | Python | 487 | 17 | import torch
import torchvision
import torch.nn as nn
import sys
sys.path.append("..")
from train.vgg import _vgg
model = _vgg("vgg16", "D", True, dropout=True)
model = nn.DataParallel(model)
# checkpoint = torch.load("/data2/cdcm/models/vgg-4.pt")
checkpoint = torch.load("/scratch/other/cdcm/models/vgg_dropoutw-0.0... |
2e74535a4f29cf6afb0548f655426206cb4f8d207008fd205034646dc8465b6e | Python | 490 | 18 | """Get loader by name.
Loaders define how configuration is read, what happens
when workers start, when tasks are executed and so on.
"""
from celery.utils.imports import import_from_cwd, symbol_by_name
__all__ = ('get_loader_cls',)
LOADER_ALIASES = {
'app': 'celery.loaders.app:AppLoader',
'default': 'celery.... |
4483dfa301c4b1a1990bef5974fa3ba5f056bfe9370d2cd3e57fa777cee4fb45 | Python | 490 | 25 | from sys import argv
from msp import MSP
from msp_donorlike import setup_as_adjusted_acceptor, train_in_parallel
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_adjusted_acceptor(msp)
msp.architecture["sparse_spec"] = dict(
type="ParallelSpatiallySparse",
sparse_specs=[
dict(type="No... |
bc9fce260112aebb5fcbc3d612e207837df197477e8a7aa406b959d7825f0172 | Python | 490 | 16 | #!/usr/bin/env python
'''Given a results.csv file and password for db, put the contents into google sql'''
import sys, re, MySQLdb
import pandas as pd
conn = MySQLdb.connect (host = "35.196.158.205",user = "opter",passwd=sys.argv[2],db="opt2")
cursor = conn.cursor()
data = pd.read_csv(sys.argv[1])
for (i,r... |
5c51ba14ba7d34a6ecbe59d76a490d50c68511bf89ad906a7cd82726fa8c3117 | Python | 491 | 23 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 9241 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=... |
7d0d8217a4b91107372a1b7cccc6ea2aa5ff0b41adf9eacb3393d2c3198231ad | Python | 491 | 20 |
class EmbeddingFeature():
def __init__(self, **kwargs):
pass
def __repr__(self,):
return "EmbeddingFeature"
def __call__(self, old_drug_bank, new_drug_bank):
train_drug_ids = set(old_drug_bank.id_to_drug.keys())
test_drug_ids = set(new_drug_bank.id_to_drug.keys())
... |
8e083c36311fe873410619a82cb5b6d052042bda58e81c5657cf9fa3afd5ca36 | Python | 491 | 19 | # Generated by Django 3.2.6 on 2024-11-18 09:59
import biomedisa_app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0116_auto_20240905_0758'),
]
operations = [
migrations.AlterField(
model_name='uplo... |
a7208caac6d1a3c54de5a9131481531b8a4f792ef96d641149bfac9d80c61257 | Python | 491 | 19 | # Generated by Django 3.2.6 on 2024-09-05 05:19
import biomedisa_app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0114_auto_20240905_0636'),
]
operations = [
migrations.AddField(
model_name='specim... |
cd2b73ad667ea6fd8db1dfa9076f361605b72809f54f22a3cff97ce6d25a3c9d | Python | 491 | 20 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for his.py"""
import unittest
from sknetwork.data.test_graphs import test_bigraph
from sknetwork.ranking import HITS
class TestHITS(unittest.TestCase):
def test_keywords(self):
biadjacency = test_bigraph()
n_row, n_col = biadjacency.shape
... |
7e5f822bf4d0ba36967558f3ae9a1408b410cb726c31222cd61703569d1be738 | Python | 492 | 21 | # Copyright (c) 2025, Tri Dao.
import cutlass
import cutlass.cute as cute
from cutlass import Int32
@cute.jit
def clz(x: Int32) -> Int32:
# for i in cutlass.range_constexpr(32):
# if (1 << (31 - i)) & x:
# return Int32(i)
# return Int32(32)
# Early exit is not supported yet
res = ... |
c830def347c8ca305a38b9c12cfabd2c0db9fe1e1055059526ff719d53dddc6a | Python | 492 | 20 | """
See how the datetime string looks for every ABF file
"""
import os
import sys
import glob
import time
import numpy as np
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/")
sys.path.insert(0, PATH... |
edb13dc16e7fea310f2a5d21615bb663d8cdada3956efcf65213997d501994aa | Python | 492 | 21 | 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... |
6a59b8820c874593e6f6f7981d5c31dd3931406f02d400cce7849aaa631ceb4f | Python | 493 | 21 | import itertools
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
x = np.linspace(0, 1, 100)
for a, b in itertools.product([2, 6, 9], [2, 6, 9]):
values = stats.beta(a, b).pdf(x)
plt.plot(x, values, label=f"a={a}; b={b}")
plt.xticks([0, 1])
plt.xlim(0, 1)
plt.xlabel("Action")
plt.y... |
be320fa385dac38023866c7c57f2f28f471a8cce39feca16c6f1582643e44c10 | Python | 493 | 13 | from torch import nn
from torch.nn import functional as F
class CustomCrossEntropyLoss(nn.Module):
def __init__(self, gamma=0):
super(CustomCrossEntropyLoss, self).__init__()
self.gamma = gamma
self.cross_entropy_loss = nn.CrossEntropyLoss(reduction='none')
def forward(self, pred, targ... |
bec74cd8c881cbe377a80019b6fa4e6f110d4308855e162d66c1eb470a43aacf | Python | 493 | 21 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import tensorflow.compat.v1 as tfv1
from google.protobuf import text_format
def main():
# Load and export as string
with tfv1.gfile.FastGFile(sys.argv[1], "rb") as fin:
graph_def = tfv1.GraphDef()
graph_def.ParseFromString(fin.read())
... |
cfcfd11f6cc87acaed8cb0eb92a2f7d2603b16741447d74d368ee565b88dfcff | Python | 493 | 21 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 146
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rcrb"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="... |
03506c65b65298eb019bf271e9c45f1dc3a73c086d9b1a692ac4caf52b5ff7e3 | Python | 494 | 17 | import pytest
import numpy as np
from src.modeling import ConditionalGaussianMixture
def test_cgmm_prediction():
# Create simple data: Y = X + noise
X = np.random.randn(100, 2)
Y = X + 0.1 * np.random.randn(100, 2)
model = ConditionalGaussianMixture(n_components=2, random_state=42)
model.fit(X... |
49882f8bc67b00d0c2584aac4d8db855b84b89d450aaffd9db39f1242383c84c | Python | 494 | 17 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._label import Label
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from . import label
from . import legendgrouptitle
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__,... |
abe8edc3df6d039e4191186dd47ffde472ec116c69254f45ac262b648fd0907c | Python | 494 | 17 | """Validation contract clauses an exemption audit record may cite.
Shared by the exemption ledger (``test_validation_exemption_ledger.py``) and
the per-entry registry ledger (``test_validation_registry_ledger.py``) so both
check citations against one list.
"""
from __future__ import annotations
VALIDATION_CONTRACTS ... |
b2cf699c6eb2fbb3fdb727557bbc8b85ee3afe53ca5852f8f5d24131dc67a89c | Python | 494 | 19 | import torch
def CORAL(source, target):
d = source.size(1)
ns, nt = source.size(0), target.size(0)
# source covariance
tmp_s = torch.ones((1, ns)).cuda() @ source
cs = (source.t() @ source - (tmp_s.t() @ tmp_s) / ns) / (ns - 1)
# target covariance
tmp_t = torch.ones((1, nt)).cuda() @ targ... |
582e338e8cd41b562e91882adbea558dd1bd5530b1418273bfeb688ae6fd2729 | Python | 495 | 15 | # make mne backwards-compatibility
import packaging.version
import mne
MNE_VERSION = packaging.version.parse(mne.__version__)
V0_19 = packaging.version.parse('0.19')
V0_22 = packaging.version.parse('0.22')
# 0.22 renamed read_ch_connectivity → read_ch_adjacency
if MNE_VERSION < V0_22:
mne.channels.find_ch_adjac... |
cd02a385219bc7dac1af428f5c80fd793a5bc227977246e49143deef5d579ea9 | Python | 496 | 29 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Initialize interfaces."""
from xcp_d.interfaces import (
ants,
bids,
censoring,
connectivity,
execsummary,
nilearn,
plotting,
report,
restingstate,
workbench,
)
... |
4e70c7f6d13ad8023b976bdba5542d3f5edb3cc996ed4322f9da2a5a6b60df98 | Python | 497 | 24 | __author__ = 'quentin'
import json
import sys
if __name__ == "__main__":
if len(sys.argv) < 3:
raise Exception("Wrong number of args, JSON_FILE, field, value")
file = sys.argv[1]
field = str(sys.argv[2])
with open(file) as f:
data = json.load(f)
if len(sys.argv) ==3:
... |
94e25117ed6427e2bf2831e2daf936cef44267b1c3e0980faf19b22a2c068eb2 | Python | 497 | 23 | import pyvista as pv
from pyvista import Plotter
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
def _interactive_plotter() -> Plotter:
"""Create an interactive window for using widgets."""
plotter = pv.Plotter(
off_screen=False,
window_size=... |
c6826c0d260d32ed9835153bab3a0e04c59bd3fdc9f00f26924e009594a229a0 | Python | 497 | 21 |
# This file was generated by 'versioneer.py' (0.17) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
version_json = '''
{
"date": "2019-01-21T13:35:44+0100",
"dirty": false,
"error... |
f526dd0abe26feef9487e7e7b8f83b55282059facec64ab822103274986a9e10 | Python | 497 | 21 | import sqlite3
from .db import DB
class TableOverview(DB):
def __init__(self):
super().__init__()
self.table_name = 'Metadata_Tables_Overview'
self.table_desc = 'A description of all the state tables there are in this database'
self.cols = self.getcolumns()
def getcolumns(se... |
3b3300a25916d663dadb0f2237a2795e7275109a3a5d762f7a780736fa1fbee8 | Python | 498 | 20 | """
Refactor the membrane test module to provide a clean interface.
You can always refactor the core later.
"""
import os
import sys
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/")
sys.path.insert(... |
961d95d06a0632333d31a752890f94db87470866840b93452c4b70d16542a3f1 | Python | 498 | 14 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .ava_dataset import Ava # noqa
from .build import build_dataset, DATASET_REGISTRY # noqa
from .charades import Charades # noqa
from .imagenet import Imagenet # noqa
from .kinetics import Kinetics # noqa
from .ssv2 ... |
1018239f7862dd50f666329aed47a807df8188597b94fc1a829b416178c355e1 | Python | 500 | 17 | import pathlib
from PyQt6 import QtWidgets
data_dir = pathlib.Path(__file__).parent / "data"
def test_load_session(mw, qtbot, monkeypatch):
# Load example session
example_session = data_dir / "brillouin.impose-session"
monkeypatch.setattr(QtWidgets.QFileDialog, "getOpenFileName",
... |
230514f98e67d6cb096b34349c2ef85b8eaad8641424ae8310cdc67ddb2f4648 | Python | 500 | 21 | """
Display shortcut wiring for the simulation apps.
"""
from __future__ import annotations
from larvaworld.portal.runtime.display_shortcuts import (
DISPLAY_SHORTCUTS_RAW_CSS,
DisplayShortcutsConfig,
DisplayShortcutsController,
DisplayShortcutsDialog,
build_display_shortcuts_dialog,
)
__all__: l... |
93f861bfc891b303648837b2f5325285395e10467ff05c0ae73626411fa5b9d0 | Python | 500 | 14 | from os.path import join as oj
import os
from os.path import dirname
repo_dir = dirname(dirname(os.path.abspath(__file__)))
# main_dir = '/scratch/users/vision/chandan/embedded-ngrams/'
# main_dir = '/home/chansingh/mntv1/embedded-ngrams'
# main_dir = '/scratch/embgrams/embedded-ngrams'
main_dir = repo_dir
data_dir = ... |
cec97a1d97a402b722b270b97c1daf93b959c851863a21cdeeb81a7b220a7a09 | Python | 500 | 21 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import matplotlib
import sys
from tqdm import tqdm, trange
def use_inline_backend():
"Check whether matplotlib is using an inline backend, e.g. for notebooks"
backend = matplotlib.get_backend()
return backend.endswith('inline') or backend == 'nbAgg... |
cf6e5736ab1642e6793cec72849f94d8991f5ddcab4ede08edcf96c5aafb41e5 | Python | 500 | 20 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Wii utils."""
def get_x_y(tl, tr, br, bl):
"""For given wii sensor values:.
- tl - top left
- tr - top right
- br - bottom right
- bl - bottom left
in int or floa... |
fd0faa7af9c2f9362e06ef89a6bfd1b909fad757671a4e50384474785154be5d | Python | 500 | 15 | # This file lists batch jobs. Run the batch jobs with::
#
# $ trf-tools-make-jobs jobs.py
#
from alice import PARAMETERS, alice
JOBS = [
# Batch-compute TRFs for all subjects:
alice.trf_job('gammatone-1', **PARAMETERS),
alice.trf_job('gammatone-1 + gammatone-on-1', **PARAMETERS),
alice.trf_job('gamm... |
600efee53e19900a90add130da62aabaadaf36847cccaae4d4f316f22cfd2dec | Python | 501 | 15 | from PIL import Image
from lightly.transforms.fast_siam_transform import FastSiamTransform
from .. import helpers
def test_multi_view_on_pil_image() -> None:
multi_view_transform = FastSiamTransform(num_views=3, input_size=32)
sample = Image.new("RGB", (100, 100))
output = helpers.assert_list_tensor(mul... |
7b0750e800e69ca905dee50b3773954467f4928cdcdb2a8448640ffa8ff81331 | Python | 501 | 17 | from __future__ import annotations
import unittest
from coco_froc_analysis.utils import update_scores
class TestUpdateScore(unittest.TestCase):
def setUp(self):
self.json_data = [{'score': float(score) / 100.0}
for score in range(0, 105, 5)]
def test_thresholding(self):
... |
9000ebc98267444bd710a8c8d596f01b21b69dec54ab9f2d1864e3ece019fc02 | Python | 501 | 17 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import datasets, plot, boosting, epoch_impulse_predictor
from eelbrain.testing import hide_plots
@hide_plots
def test_datasplit():
ds = datasets.get_uts()
ds['x'] = epoch_impulse_predictor('uts', ds=ds)
trf = boosting('uts', 'x', 0, 0... |
e9d3b4a474214cc2cc442bc254a2187ae649e07d1ed31bf3cbc33b4bef64555c | Python | 501 | 23 | import json
import pytest
from database import UserModel
@pytest.mark.second
class TestUser:
@classmethod
def setup_class(cls):
UserModel.objects.delete()
def test_create_first_user(self, client):
response = client.post("/api/user/register", json={
"username": "user",
... |
f66662899c221489a8a688c250e572002ca7cbc7f3c2e1c31785668b6c76358c | Python | 501 | 23 | from sys import argv
from msp import MSP, step_for_density
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
path = f"model/rbnsp-80-adj2_{msp.seed}"
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path=path,
original_model_step=step_for_densi... |
5e29a8bf9a5785d73158f7c83ff860e9ed7e8f4c64d744aa7174e89e1e873f2a | Python | 502 | 17 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._angularaxis import AngularAxis
from ._domain import Domain
from ._radialaxis import RadialAxis
from . import angularaxis
from . import radialaxis
else:
from _plotly_utils.importers import relative_import
__all__, __getatt... |
87fc01aa2cde0b38dca70689a7c8e4c32c2c5aeb34798afe3c56c0f7a5553400 | Python | 502 | 17 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._domain import Domain
from ._imaginaryaxis import Imaginaryaxis
from ._realaxis import Realaxis
from . import imaginaryaxis
from . import realaxis
else:
from _plotly_utils.importers import relative_import
__all__, __getatt... |
9e2fefbc644d7de1268bd99153280e5fca9c4f049373f6f9f694fde17c63be07 | Python | 503 | 16 | from pathlib import Path
import shutil
if __name__ == "__main__":
in_dir = Path(r"F:\CEST_Data")
out_dir = Path(r"D:\Scibo\Promotion\__7_Denoise_CEST\Sim_data")
count = 1
for sim in in_dir.glob("*"):
c = 1
for img in sim.glob("*.nii"):
shutil.copy(img, out_dir / f"{str(coun... |
ab5a34beae65fa35f6b954f08f164f094d07ef7d9b7decf4342b6ce70b4e5caf | Python | 503 | 12 | __version__ = "1.1.dev"
from .source_level import rsa_stcs, rdm_stcs, rsa_stcs_rois, rsa_nifti, rdm_nifti
from .sensor_level import rsa_evokeds, rsa_epochs, rdm_evokeds, rdm_epochs
from .searchlight import searchlight
from .rsa import rsa, rsa_gen, rsa_array
from .rdm import compute_rdm, compute_rdm_cv, rdm_array, pic... |
bcc1b46309a1e8a360ec7d4debab7682651e3be1cdbe4c41850b91589f52b2f0 | Python | 503 | 23 | """
Helper functions for porting R code into python/stLearn.
"""
import os
ro = None
pandas2ri = None
localconverter = None
def rpy2_setup(r_path):
"""Sets up rpy2."""
os.environ["R_HOME"] = r_path
import rpy2.robjects as robjects_
from rpy2.robjects import pandas2ri as pandas2ri_
from rpy2.rob... |
a4e6359d8f151a1be8175a862ddb40223c4f55f16421a09570d8a8bed16a1d62 | Python | 504 | 23 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-05 14:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0026_auto_20181004_1849'),
]
operations = [
migrations.RemoveFiel... |
ae1e74402a9dc131df4a3eb720e493e06e6d4b8a2a647c59b6de4a5581925b95 | Python | 504 | 13 | __author__ = 'satra'
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(ext_modules=[Extension(
"infoclient", # name of extension
["infoclient.pyx"], # our Cython source
langu... |
beae68f2fbbe08f614c380a41af22d0e33fbdb51404b421fffe5a69857f7c88d | Python | 504 | 29 | __author__ = 'quentin'
from ethoscope.tracking.cameras import *
from ethoscope.tracking.trackers import AdaptiveBGModel
import cv2
import cv
import numpy as np
from ethoscope.tracking.roi_builders import DefaultROIBuilder
# we start from a cropped video:
cam = MovieVirtualCamera("/stk/pysolo_video_samples/single... |
453bcbd77275a5aa2b484053656d58266ece14225ddca48723604b522d120c75 | Python | 505 | 16 | """Prepare PASCAL VOC tiny motorbike datasets"""
import os
import autogluon as ag
if __name__ == '__main__':
root = os.path.expanduser('~/.mxnet/datasets/')
if not os.path.exists(root):
os.makedirs(root)
filename_zip = ag.download('https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip', ... |
6d9847903075bf0400c113323521c5eb2708c7ecbe3eaf4eb5a8a446cd8ee4be | Python | 505 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=5),
post_bottleneck_lsmrp_spec=dict(type="Early... |
ec6bb239cce9785b2b8c047520e58c70079a35fd8d763f215f3819533c1571cf | Python | 505 | 16 | """
Vertical axis: Subject numbers, horizontal axis: Read the CSV file containing data as elements and perform the Friedman test.
"""
from scipy import stats
import csv
buffer = []
with open('./sheet.csv') as f: # This does not support BOM (Byte Order Mark), so please be cautious with the CSV save settings
... |
0b798abb37a456da0db91d77035e975cc617c10d22224165c10a9d60015a3be4 | Python | 506 | 25 | #!/usr/bin/python
import sys
import os
import pandas as pd
import numpy as np
import math
import re
filedir = sys.argv[1]
if re.match(".+\/$", filedir) is None:
filedir += '/'
snps = pd.read_csv(filedir+"input.snps", delim_whitespace=True)
pcol = 5
head = snps.columns.values
snps = snps.as_matrix()
snps = snps[np.... |
14364ba2bac87d81516783908342d7877059252a528259038552b53abce41939 | Python | 506 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=5),
post_bottleneck_lsmrp_spec=dict(type="Early... |
2dbbbd74bfca8d72c8bf98cb977467a249e6cdb3f9badce51eb754bd307f597e | Python | 506 | 19 | import abc
from typing import List
from uuid import UUID
from carbonserver.api import schemas
class Emissions(abc.ABC):
@abc.abstractmethod
def add_emission(self, emission: schemas.EmissionCreate) -> UUID:
raise NotImplementedError
@abc.abstractmethod
def get_one_emission(self, emission_id) ... |
6facf72749bad7247c1f667659dcbd23018e131a1fc2bd23ab6aad5dfbed8cdb | Python | 506 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=17),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
a1032a3adab9bc56adf0777fade231d9990062162757c7274acf68181a47f9aa | Python | 506 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=65),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
eea4e52d8deab236e4665de4ad786c6432bc4b32b613494a8da155e1972a314c | Python | 506 | 19 | import sys
import pathlib
try:
PATH_HERE = pathlib.Path(__file__).parent
PATH_ABFS = PATH_HERE.joinpath("../../data/abfs/").resolve()
PATH_SRC = PATH_HERE.joinpath("../../src/").resolve()
print(PATH_SRC)
sys.path.insert(0, str(PATH_SRC))
import pyabf
except:
raise EnvironmentError()
1
if _... |
84599b083a828d992ee458db86c0629b20f7df7ebbca3506304bef387399ebc7 | Python | 507 | 14 |
from setuptools import setup
setup (name = 'aicspylibczimsem',
version = '0.1',
description = 'Extension of aicspylibczi that reads and processes msem metadata (xml)',
author = 'Paul Watkins',
author_email = 'pwatkins@gmail.com',
url = '',
long_description = '''
Msem czi file... |
8911b6fdcded06b695fe38652919180d1bf69bf5ece22e9df860a8dc81eb502d | Python | 507 | 15 | import os
import numpy as np
from pcntoolkit.normative_model.norm_utils import norm_init
model_path = '/project_cephfs/3022051.01/untested_models/Cerebellum_GenR/HBR_10MDTB-CerebellumFunc-linear_7K_2sites/Models'
for m in range(30):
print(m)
nm = norm_init(np.zeros((5,5)))
model_name = os.path.join(model... |
a2f50ca8403216dd8375577d658a34f093a3746757ffc733c5699453fe4c35c7 | Python | 507 | 22 | import sqlite3
from .db import DB
class TravelSurveillance(DB):
def __init__(self):
super().__init__()
self.table_name = 'KL_travel_surveillance'
self.table_desc = 'Summary of Travel Surveillance'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
... |
a8d5c360f1833a32684b7569476f3f21d7d00e44fcf8437e71d70255f6911266 | Python | 507 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=65),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
b691d9c9cc6fb922224f0ffb03e119c41427537b396b69b91e0f2f1bae6bfe59 | Python | 507 | 21 | 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["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=17),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
1862205a304a92a1815a402b069c46e122753c52df508f3cd71fc82c11c2f405 | Python | 508 | 19 | from sys import argv
from msp import MSP
msp = MSP()
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
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="FCMot... |
73078b0f1cf6d04c373ad111de5f067fa8625c2d34387c6575d52f2579fd2b29 | Python | 508 | 19 | from sys import argv
from msp import MSP
msp = MSP()
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
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="FCMot... |
7ff79e1e123d309ced29f88bbf84844a9bc6aa6cd8cba1a73c62e63501697f2f | Python | 508 | 23 | from sys import argv
from msp import MSP, step_for_density
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
path = f"model/rbnsp-80-adj13x4-nsp_{msp.seed}"
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path=path,
original_model_step=step_fo... |
8fdbf03b2472660e3be8aa30940d37009a16c36ba21c591d00e384d5133c2968 | Python | 508 | 19 | from sys import argv
from msp import MSP
msp = MSP()
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
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="FCMot... |
6eb9a858020e2ec6098196e472fd8e6d2b74cbff2b48719ce653d32df7e5af10 | Python | 509 | 19 | from sys import argv
from msp import MSP
msp = MSP()
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
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="FCMot... |
3ad236b3713c508daad6dc68da80b0ecebabaf47713384de9dd40c39d62b7707 | Python | 511 | 14 | import auggam.data as data
import experiments.config as config
from os.path import join as oj
if __name__ == '__main__':
# rs_vary_ngrams_test = data.load_fitted_results(
# fname_filters=['ngtest'],
# results_dir_main=config.results_dir,
# )
# rs_vary_ngrams_test.to_pickle(
# oj(con... |
470cc7f567da1d8d35bbb35944b2ba79aec35b47acaa10d063b5a36fab74afde | Python | 511 | 26 | import os
import sys
import pytest
def _test_path(test_dir: str, arg: str) -> str:
if os.path.isabs(arg):
return arg
return os.path.join(test_dir, arg)
def main() -> int:
test_dir = os.path.dirname(os.path.abspath(__file__))
test_paths = [_test_path(test_dir, arg) for arg in sys.argv[1:]]
... |
561d4c95ed0ad467b66ca7fe940f3beccc25f5da67e37643f3f99c32c935dfbf | Python | 511 | 24 | import abc
from dm_control import mjcf
from angorapy.tasks.world_building.entities import Robot
class PhysicalWorld(abc.ABC):
"""A physical world in which an environment is simulated."""
@property
@abc.abstractmethod
def robot(self) -> Robot:
...
@property
@abc.abstractmethod
d... |
8651ee1b989eb6b8b28e5d43aadb9fe9f32f243474a33072349edb65b24dac10 | Python | 511 | 18 | import logging
import os
logger = logging.getLogger("carbonserver")
formatter = logging.Formatter(
"[%(name)s %(levelname)s @ %(asctime)s] %(message)s",
datefmt="%H:%M:%S",
)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
if not logger.handlers:
logger.addHandler(handler)
env_level = os.... |
24c950b200f4ba8ec9871c0d16a551607afa1313517068884bc823ecff7f3fda | Python | 512 | 13 | from .basedatatypes import BaseFigure
class FigureWidget(BaseFigure):
"""
FigureWidget stand-in for use when anywidget is not installed. The only purpose
of this class is to provide something to import as
`plotly.graph_objs.FigureWidget` when anywidget is not installed. This class
simply raises an... |
f1cacf108c36a6d8e5d9f36f1ea25389267eb58bbdeed02257fe3b55c62ee79e | Python | 512 | 27 | """
Implicit folder structure
/data
/mimic-iv-2.2
/hosp
/patients.csv
/diagnoses_icd.csv
/procedures_icd.csv
/mimic-iv-note-2.2
/note
/discharge.csv
/icdcodes
/icd{9,10}_{diagnosis, procedure}.{xlsx,txt}
"""
from scripts.mimic.preproc... |
4914a724dcaf91540c7edea2b7e6b98d42e7aaa9dc21d5e48e894c2602e543e0 | Python | 513 | 19 | from setuptools import setup
import json
with open("metadata.json", encoding="utf-8") as fp:
metadata = json.load(fp)
setup(
name="lexibank_asjp",
description=metadata["title"],
license=metadata.get("license", ""),
url=metadata.get("url", ""),
py_modules=["lexibank_asjp"],
include_packag... |
12e78f57308dac911cd0fe36f2d1c0cb1ddc4694a079a7239e2b2b1b064de2d6 | Python | 514 | 25 | import torch
import torch.nn.functional as F
def sce_loss(x, y, alpha=3):
x = F.normalize(x, p=2, dim=-1)
y = F.normalize(y, p=2, dim=-1)
# loss = - (x * y).sum(dim=-1)
# loss = (x_h - y_h).norm(dim=1).pow(alpha)
loss = (1 - (x * y).sum(dim=-1)).pow_(alpha)
loss = loss.mean()
return lo... |
179be4d1cf99ad74fbb067d72246b6d40f7d163fb8741b2dea96ca89c8d37c7c | Python | 515 | 21 | 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... |
b027dacbeb7e5c92a26f3a09640148b46d2d34f619911f2ced9915a70f52b622 | Python | 515 | 17 | from PyQt5 import QtWidgets
from PyQt5 import QtCore
from score_behavior.video_control_ui import Ui_VideoControlWidget
class VideoControlWidget(QtWidgets.QWidget):
def __init__(self):
# noinspection PyUnresolvedReferences
flags_ = QtCore.Qt.WindowFlags()
super(VideoControlWidget, self).__... |
b8b5906409e1b20948c0e0d45f9316956cefb8517890f576b322dbc415a5533a | Python | 515 | 21 | from json import loads
from pathlib import Path
from nmodl import dsl
def test_example():
"""
Test for the Python API from example
"""
examples = dsl.list_examples()
# ordering may be off so we use a set
assert set(examples) == {"exp2syn.mod", "expsyn.mod", "hh.mod", "passive.mod"}
dri... |
6bc59699078007611641803ce857e7af8a4eef3190628b2455f4ad29c85aa3ce | Python | 516 | 24 | import sqlite3
from .db import DB
class Calls(DB):
def __init__(self):
super().__init__()
self.table_name = 'MP_calls'
self.table_desc = 'Toll free helplines of COVID.'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL',
... |
b5e008dcb251e98418784d75aa6f1b35802210e1117d2e1a5e7db190b908bf25 | Python | 516 | 33 | __author__ = 'quentin'
from ethoscope.tracking.cameras import *
import cv2
# cam = MovieVirtualCamera("/home/quentin/Desktop/drosoAdult_short.avi")
#
cam = V4L2Camera(0,target_fps=50)
for t,frame in cam:
cv2.imshow("Test", frame)
cv2.waitKey(1)
for t,frame in cam:
cv2.imshow("Test", frame)
cv2.w... |
1ece1bd28afb527eed8ecb48ebdf32ce59b1ddb2ca3e2864ec92dd8d90a1f396 | Python | 517 | 19 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._aaxis import Aaxis
from ._baxis import Baxis
from ._caxis import Caxis
from ._domain import Domain
from . import aaxis
from . import baxis
from . import caxis
else:
from _plotly_utils.importers import relative_import
... |
5984dcb90c93ec61ec77c660fd1f89283ffb6ecdbaee38c6b6e44c32b7f77e22 | Python | 517 | 22 | try:
from ._version import version as __version__
except ImportError:
__version__ = "unknown"
import logging
import sys
from .llsdir import LLSdir
__all__ = ["LLSdir"]
logger = logging.getLogger(__name__)
logging.basicConfig(format="%(levelname)s:%(name)s | %(message)s")
if "--debug" in sys.argv:
logg... |
3ee22e667a23b6eefef86a9f19c75adac6f46176fd4fd7ef59d6335d9796fc73 | Python | 518 | 15 | import tensorflow as _tf
gpus = _tf.config.list_physical_devices("GPU")
if gpus:
try:
# Currently, memory growth needs to be the same across _GPUs
for _gpu in gpus:
_tf.config.experimental.set_memory_growth(_gpu, True)
_logical_gpus = _tf.config.list_logical_devices("GPU")
... |
a8793c88496e87f6032d846a4739f7e227e3d4f37008f63c49631567bad01e54 | Python | 518 | 14 | import torch
class LabelSmoothLoss(torch.nn.Module):
def __init__(self, smoothing=0.0):
super(LabelSmoothLoss, self).__init__()
self.smoothing = smoothing
def forward(self, input, target):
log_prob = torch.nn.functional.log_softmax(input, dim=-1)
weight = input.new_ones(input.... |
0dc1605cfcfabd6024f4f88bd6ebdea40c7e9ca2abddbc28260ab48b6bdd3e38 | Python | 519 | 22 | # Generated by Django 3.2.6 on 2024-09-05 05:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0115_specimen_pic'),
]
operations = [
migrations.RemoveField(
model_name='specimen',
name='pic',
... |
195d332cae5a76376da4af1c60d47fa793c6e55406f28f0308145722ac41a40d | Python | 519 | 19 | """
Ensure no ABFs have empty sweepC arrays
"""
import os
import sys
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/")
sys.path.insert(0, PATH_SRC)
import pyabf
import glob
import numpy as np
if __n... |
9b69640c9a09668709d7cb1ca40aec507bb378f67c43eb9eec3df25d0e47fd13 | Python | 519 | 10 | """gnn module"""
from sknetwork.gnn.base import BaseGNN
from sknetwork.gnn.base_activation import BaseActivation, BaseLoss
from sknetwork.gnn.base_layer import BaseLayer
from sknetwork.gnn.gnn_classifier import GNNClassifier
from sknetwork.gnn.layer import Convolution
from sknetwork.gnn.neighbor_sampler import UniformN... |
d3c2e0ffdbbde60a77d4a99bb382c359b0383b31b5e44356875e2c52ff6f4346 | Python | 519 | 20 | # Generated by Django 2.1.5 on 2019-01-23 17:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0029_auto_20181219_1207'),
]
operations = [
migrations.Al... |
4e52058a430ba710a1085a529876c382cff9db197cf4e6ea6b9f3c48366a212d | Python | 520 | 18 | # Copyright 2023 Blue Brain Project, EPFL.
# See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0
import re
def camel_case_to_underscore(name):
"""convert string from 'AaaBbbbCccDdd' -> 'Aaa_Bbbb_Ccc_Ddd'"""
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
typename = re.sub(... |
5f1fa33b8cb9bf1c1a9f4049865d3a150885627968e4b9da0b78cb69333c1541 | Python | 521 | 18 | 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... |
955cbb62ecdbf9003bda370caad005ec0139e8e73a5530343ca0f46c187e7f54 | Python | 521 | 19 | """
Previously the ABF writer used fixed scaling factors.
Practice auto-scaling based on the ABF data.
"""
import sys
import os
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/")
sys.path.insert(0, PA... |
a624691410f4fd9ee66f1e3cc3c064c0f41b8d7e36f56807f5ecbe5ce7410baa | Python | 521 | 26 | from ._version import __version__
from . import classification
from . import tangentspace
from . import channelselection
from . import estimation
from . import spatialfilters
from . import clustering
from . import stats
from . import embedding
from . import preprocessing
from . import datasets
__all__ = [
"__vers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.