sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f25fe766f0c1fa212a9b4d088ba753a7242b12b63462f9033f6e6c28e44ba7e5 | Python | 1,609 | 57 | import os
import matplotlib.pyplot as plt
import numpy as np
tasks = ["GoTask1", "GoRtTask1", "RomoTask2"]
go_task_list_values = np.linspace(0, 1, 8)
def plot_graph(data_a, data_v, ax_a, ax_v, letter, legend=False):
for s in range(data_v.shape[1]):
ax_a.plot(
data_a[0, s], label=f"$u_{{mod... |
363b2bb3eec6c6a29ad9b1a516eabd64142f0443f6dbf754a86783b85b33e7af | Python | 1,612 | 52 | #from https://github.com/Tagar/stuff/blob/master/spinner.py
import sys
import threading
import time
import itertools
class Spinner:
def __init__(self, message, delay=0.1):
self.spinner = itertools.cycle(['-', '/', '|', '\\'])
self.delay = delay
self.busy = False
self.spinner_visib... |
ccac3977ff22642146f31b354d092c59734779ab3fdd4f8ff81b06e72be5d7a8 | Python | 1,612 | 46 | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2018/8/4 下午11:32
# @Author : yuchangqian
# @Contact : changqian_yu@163.com
# @File : gluon2pytorch.py
import os
import mxnet as mx
from gluoncv.model_zoo import get_model
import torch
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-m'... |
1e302332d6a1d60bdaa0ef774dd1272ec161660d8baf6cc68e233c966f3a36fd | Python | 1,613 | 29 | """Physics substepping convergence on Chaos: same drive (throttle then brake) on Town10HD_Opt spawn 79
for several fixed_delta_seconds / max_substep_delta_time; writes JSON with speed and z-acceleration per tick."""
import carla, json, sys, math
c = carla.Client('localhost', 2000); c.set_timeout(60); w = c.get_world()
... |
b68c5c3eb312011e0042a5776fa8b6d28d34b03cea28358dcdd76ddd043f60c2 | Python | 1,613 | 63 | """
Functions for managing and accessing API keys
See `<https://github.com/ActiveState/appdirs>`_
"""
import logging
import os
from pathlib import Path
from appdirs import user_config_dir
from oaklib.datamodels.vocabulary import APP_NAME
APIKEY_SUFFIX = "apikey.txt"
APIKEY_ENV_SUFFIX = "API_KEY"
def get_apikey_p... |
229d48c42174adf335629b438399e2146736e03ff49571cd539285f01f4b8307 | Python | 1,614 | 50 | """Utility and helper functions.
Modules
-------
- :py:mod:`~osl_dynamics.utils.array_ops` — Array operations (covariance ↔
correlation conversions, matrix decompositions, etc.).
- :py:mod:`~osl_dynamics.utils.logger` — Logging utilities for pipeline
scripts.
- :py:mod:`~osl_dynamics.utils.misc` — Miscellaneous he... |
3229b84edb399abddefbf55d5e6171fe8e98ce8c2a096e16dc9b617059c51037 | Python | 1,614 | 55 | import numpy as np
from pdb import set_trace
def equalized_odds(data, pred_labels, true_labels):
females = data[:,64]
males = data[:,65]
female_pred1_true1 = (females*true_labels*pred_labels).sum() / (females*true_labels).sum()
male_pred1_true1 = (males*true_labels*pred_labels).sum() / (males*true_labels).sum(... |
384fa7faaa470e2fd11e27c47a764415827bd162ad9c803a362dd7443a02b9f5 | Python | 1,614 | 49 | from pathlib import Path
import cv2
import pandas as pd
from dotenv import dotenv_values
from tqdm import tqdm
from cenfind.constants import datasets
from cenfind.core.data import Dataset
from cenfind.core.detectors import extract_nuclei
from cenfind.core.measure import flag
from cenfind.core.visualisation import dra... |
5278431ef2ea55d04bc9d027a8dc905f411cd6e5dfc3693c4b8ef6d7fc08e467 | Python | 1,614 | 66 | import pytest
import torch
import time
from tensorly import tenalg
tenalg.set_backend("einsum")
from pathlib import Path
import sys
from neuralop import get_model
# Read the configuration
from zencfg.from_commandline import make_config
import sys
from .test_config import TestConfig
def test_from_config():
"""T... |
dabf28018fccb710ad96f3807ef6d6cd45dc705bd04e6d302f408ab9e3f8c049 | Python | 1,614 | 55 | # Copyright (c) Open-MMLab. All rights reserved.
import numbers
from ...dist_utils import master_only
from ..hook import HOOKS
from .base import LoggerHook
@HOOKS.register_module()
class WandbLoggerHook(LoggerHook):
def __init__(self,
init_kwargs=None,
interval=10,
... |
9dae1c133ac85f3ebd29a7a47b5c3775c4934b28adc7f5dbd4255242ba82825c | Python | 1,615 | 37 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
b413dacac05b51017379df1cd27c8553beef1d90605c09c45a126169f545c991 | Python | 1,615 | 56 | # -*- coding: utf-8 -*-
# File : test_numeric_batchnorm.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 27/01/2018
#
# This file is part of Synchronized-BatchNorm-PyTorch.
import unittest
import torch
import torch.nn as nn
from torch.autograd import Variable
from sync_batchnorm.unittest impor... |
f56d53c71ef36f39b8e81199a384f85746313dbda58f77fc814ca6137bc8d881 | Python | 1,615 | 39 | """Constants for use across OAK."""
import os
import pystow
from oaklib.utilities.caching import FileCache
__all__ = [
"OAKLIB_MODULE",
"FILE_CACHE",
"SEMSQL_SQLITE_URL_BASE",
"SEMSQL_SQLITE_DOWNLOAD_KWARGS",
]
OAKLIB_MODULE = pystow.module("oaklib")
FILE_CACHE = FileCache(OAKLIB_MODULE)
TIMEOUT_SE... |
3b6df63132a0ff3399b6f4f9e9f02c682fdaabadd91cc71a603ea983f39cd56f | Python | 1,616 | 47 | import pandas as pd
from subprocess import Popen, PIPE
import os
from datetime import datetime
# Abrir último csv
file = "videos.csv"
if os.path.exists(file):
videos = pd.read_csv(file)
else:
videos = pd.DataFrame(columns=["date", "computer", "parts_filename", "filename", "size", "duration"])
# Se busca los v... |
bc04f2720041f16d60d997a63339b10d901508a227fc868d6555a567b1637ac4 | Python | 1,617 | 41 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Accessible tool for statistical analysis of MEG and EEG data.
For the full documentation see <http://eelbrain.readthedocs.io>.
"The human brain is like an enormous fish. It's flat
and slimy, and has gills through which it can see."
... |
be7d56fb060da557e11c2bd1c6d7e628e3b45c57ae61e934769046ce5fac32a4 | Python | 1,617 | 48 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
dad4c79882d1fc6406ea2aa9b0899871ad6696d497ddf896a74b6799de9b6cbb | Python | 1,617 | 49 | """
Contain some metrics
"""
import numpy as np
# from lifelines.utils import concordance_index
# from pysurvival.utils._metrics import _concordance_index
from sksurv.metrics import concordance_index_censored
from sksurv.metrics import integrated_brier_score
def c_index(true_T, true_E, pred_risk, include_ties=True):
... |
26dd3663f829158ea76ca2c44f44bd7e9b96b7cef945220d1f54ec9e5381b426 | Python | 1,618 | 44 | """
Report results of bootstrap hypothesis testing that vowel discrimination
performance is worse during cooling than control conditions.
Tests performed separately for each ferret, and vowels in noise or clean
conditions.
Motivation:
------------
Bootstrap data contains the number of correct trials for each stimulus... |
4636d446eb8a57ba533986a84e9ec9860e756bc51120220ec74c38a9713c121f | Python | 1,618 | 58 | import os
import numpy as np
import torch
from torch.autograd import Variable
from pdb import set_trace as st
from IPython import embed
class BaseModel():
def __init__(self):
pass;
def name(self):
return 'BaseModel'
def initialize(self, use_gpu=True, gpu_ids=[0]):
self.use... |
53c74d7df4fd33d0cc99c93077661cc003bd1fc56d0eff9f35e923eede8de62f | Python | 1,618 | 55 | '''
Operations on dictionaries, describing the geometrical system
'''
import numpy as np
def wrap(**names_and_systems):
'''
e.g. wrap(cilia=my_system) -> {'cilia': transform(my_system)}
'''
wrapped = {}
for key in names_and_systems:
wrapped[key] = transform(names_and_systems[key])
retu... |
35f5613f3f9582be21fc05668c26c7e3edd0248b5cecb1c3541b6965c66e5e03 | Python | 1,619 | 55 | '''
'''
import numpy as np
def check_orientation(origin, points):
'''
*origin* is a point inside a (convex) shape
Meaning of orientation:
- look from origin to the triangle plane
- return True if the triangle points are oriented counter-clockwise, returns True (orientation is suitable for FBEM)
... |
5ddfcda7556b7231194a0203f5d9c1dda21a66b8f4b641bb98b1676f011aa42d | Python | 1,620 | 38 | """Clip manifest round trip and validation."""
import numpy as np
from carla_cosmos.clip import Clip, video_file_name
from carla_cosmos import controls
from tests.test_contracts import make_manifest
def test_manifest_round_trip(tmp_path):
manifest = make_manifest(fps=30, frames=5)
manifest.seed = 7
clip... |
f053773eab741b47606a3eb58b7c64e7786eda168241807b895d5c455cf63fcd | Python | 1,620 | 54 | import logging
import unittest
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.resource import OntologyResource
from oaklib.utilities.graph.relationship_walker import walk_up, walk_down
from oaklib.datamodels.vocabulary import IS_A, HAS_PART
from pronto import Ontology
... |
ffb8447e0fe6561fd6dbe77b77264cd25b3740394c239a56b71f16af33f48489 | Python | 1,622 | 67 |
# %%
import numpy as np
import pandas as pd
from contools import Cascade_Analyzer
# set up toy adjacency matrices
adj = np.array([[0, 50, 100, 0, 0],
[0, 0, 0, 100, 0],
[0, 0, 0, 100, 0],
[0, 0, 0, 0, 100],
[0, 0, 0, 0, 0]])
adj = pd.DataFrame(adj)
ad... |
4378253d24662af6e2c57d8c9cf6cd7f11166e5bad1cfd138a5b6cb5e0372fdd | Python | 1,625 | 56 | from typing import Optional, Tuple
import norse.torch as snn
import torch
from norse.torch import LIFAdExRefracParameters, LIFAdExRefracState
from norse.torch.module.exp_filter import ExpFilter
from cgtasknet.net.save_states import save_states
class SNNlifadexrefrac(torch.nn.Module):
def __init__(
self,... |
60fca900a1b2b83117befa07cbf849c28164442d44aa34a453ec1626dd6850af | Python | 1,626 | 58 | '''
To rotate geometrical objects.
- Initial contribution by Gary Klindt
'''
from scipy.linalg import norm, det
import numpy as np
def rotateVector(vector, alpha, axis, eps=1e-8):
"""
return a rotated vector by alpha around axis
"""
vector = np.array(vector)
axis = np.array(axis)
if (norm(axi... |
cb40d34bd0408e5f856a223a8f5bbffb88efb8bc0fa8588563a6c8e1a9b5c1c9 | Python | 1,626 | 42 | import unittest
from oaklib import get_adapter
from oaklib.datamodels.obograph import SynonymPropertyValue
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.resource import OntologyResource
from oaklib.uti... |
e3932232beafc5f8661b896475dffe70231b96388d63d9c850acee00b8a91371 | Python | 1,626 | 59 | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import os, random, sys, math
import numpy as np
import matplotlib.pyplot as plt
import networks
device = 'cuda'
batch_size = 25
Z = 128
T = 1
transform_train = transforms.Compose([
transforms.ToTensor(),
])
trainset... |
f5b0453b47acebd94ae9c6527e712350b5b8afc64b4b8a4386c649fbf97fcb71 | Python | 1,627 | 59 | import numpy as np
import pandas as pd
import seaborn as sns
import plotly.express as px
import xarray as xr
import sys, getopt
np.bool = np.bool_
def main(argv):
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print... |
8ae24b649c142564d643ff549663565a0d3442d3323d802744effce6d4f28f34 | Python | 1,628 | 59 | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import os, random, sys, math
import numpy as np
import matplotlib.pyplot as plt
import networks
device = 'cuda'
batch_size = 25
Z = 128
T = 1
transform_train = transforms.Compose([
transforms.ToTensor(),
])
trainset... |
a98b050701a1e07c48c7d1019dd7ea991db7570e539be84fd2a8ca00c3e5153e | Python | 1,628 | 58 | """
DanQ architecture (Quang & Xie, 2016).
"""
import math
import numpy as np
import torch
import torch.nn as nn
class DanQ(nn.Module):
def __init__(self, sequence_length, n_genomic_features):
"""
Parameters
----------
sequence_length : int
Input sequence length
... |
ba5808257792f5bb18f0b3c7f4d78d5c6d8c9880877edb133c5c0840a9542c59 | Python | 1,628 | 47 | import numpy as np
from scipy.ndimage.morphology import binary_dilation
from skimage.filters import gaussian, threshold_otsu
from skimage.morphology import closing, square, remove_small_objects, convex_hull_object
from skimage.segmentation import clear_border
from skimage.measure import label
import pandas as pd
from s... |
fe9b39e6207ad1e3749e1dc0f4dbc2798c7a4bce65fb46f1fed42ee4ca795846 | Python | 1,628 | 43 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
23bc563ee564d148bd18cfda6a79b4f670caf2133f3a3edfb71918029234c3ab | Python | 1,629 | 44 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
54641e8e766bb1d9e13e8fb04f6b39d7f372cbe5f778b6d28dfd0540e1d62fdc | Python | 1,630 | 47 | import numpy as np
from multiprocessing import Pool
from xinyang_toolbox import write_runner_input
from CUR import *
import os
import subprocess
from ase.io import read, write
# initialize parameters
processors = os.cpu_count()
mat_num = 800
images = read('MD.traj', index=':')
write_runner_input(images, convert_unit=... |
45fe042c05b50b11ae57500fa42349984332ea09c02ad1d6f99a9ba6191f2e3b | Python | 1,631 | 67 | from mmcv.utils import Registry, build_from_cfg
from torch import nn
BACKBONES = Registry('backbone')
NECKS = Registry('neck')
ROI_EXTRACTORS = Registry('roi_extractor')
SHARED_HEADS = Registry('shared_head')
HEADS = Registry('head')
LOSSES = Registry('loss')
DETECTORS = Registry('detector')
def build(cfg, registry,... |
d9864044e848f24b79cf3d3d8e88be44ab1aa187a2096fc26796415bb169fbee | Python | 1,631 | 52 | '''
Makes a high quality compressed mp4 movie from a tiff sequence (4 MB/s).
Runs recursively on a cluster using `parallel`.
Argument: folder name
'''
import imageio
import sys
import os
import yaml
from file_management.batch_processing import *
from file_management.configuration import *
default_fps = 30.
### Comma... |
1336f1a68b40a785c98ff378ccef8d48f728252a6ff784e337a698fb5b6f8fd6 | Python | 1,633 | 50 |
from rdkit.Chem import AllChem, Mol
from rdkit.Chem.AtomPairs.Sheridan import GetBPFingerprint, GetBTFingerprint
from rdkit.Chem.Pharm2D import Generate, Gobbi_Pharm2D
class _FingerprintCalculator:
"""
Calculate the fingerprint while avoiding a series of if-else.
See recipe 8.21 of the book "Python Cookb... |
2ed3f4ab7c6f2f2eeb2cb53cb00d69134168633d67b25c9198ca94c9816a292b | Python | 1,636 | 61 | import os, argparse, glob
import torch
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--path', required = True)
parser.add_argument('--num_splits', default = 50)
parser.add_argument('--path_to_split', default = '../../test_inds_SG_homophilic.pt')
args = parser.parse_args()
# Load in
split... |
dd337d2f088a0d07cab359a4d9392adf7d4592dfd897cad54b25c9b464fb8393 | Python | 1,636 | 41 | from .typing import Excitation, SourceLabel
def parse_excitation(excitation: Excitation):
"""Parse any excitation format into a list of tuples consisting of port name and mode index.
Args:
excitation: Excitation of various types
Returns:
List of tuples consisting of port name and mode in... |
14b071b742ea5b36b854740b34f6c2241b1c565c708a18fdc58ce5b180bb5228 | Python | 1,637 | 37 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
0c21a60b41c20b042195842fd0b5f3c2fa6cef3cb78cc04b131d64fd254d747c | Python | 1,638 | 62 | # Libraries
import pandas as pd
import numpy as np
# --------------------------------------
# Constants
# --------------------------------------
# Load dataset
dataset = pd.read_csv('raw.csv',
#nrows=10000,
parse_dates=['patient_dob',
'date_collected',
'date_outcome',
... |
3ddd48be69ec30bd911d7d422af573c5c9e85b017fee6fdb305892831d97b665 | Python | 1,638 | 67 | import glob
import os
import torch
import torch.nn as nn
from a2c_ppo_acktr.envs import VecNormalize
# Get a render function
def get_render_func(venv):
if hasattr(venv, 'envs'):
return venv.envs[0].render
elif hasattr(venv, 'venv'):
return get_render_func(venv.venv)
elif hasattr(venv, 'e... |
784e29a1c77957bc030edf81b37f409e8f8847db7c7a8458c4256358277b2952 | Python | 1,638 | 45 | import ReadData as rd
from options.train_options import TrainOptions
import time, utils, sys
import numpy as np
from termcolor import colored
def test_data_reading():
start_time = time.time()
opt = TrainOptions().parse()
opt.shuffle = "False"
vl = rd.ValLoader(opt)
max_idx = vl.nr_of_patients()
... |
83fa0baa3a828ea521c9c761d3100b14b812362ba8392619ddc005b78415cc00 | Python | 1,638 | 36 | """Match Town10's saved sky sharpening to the default RGB camera profile.
Run with UnrealEditor-Cmd <project> -run=pythonscript -script=<this file>.
Only changes the placed sky's sharpening; preserves other authored settings.
"""
import json
from pathlib import Path
import unreal
profile = Path(unreal.Paths.project_c... |
f5091b2c6cf4cc7b098c5c36ab79e679ab93e323084e7f646e45b6f2a43e52f2 | Python | 1,638 | 38 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
845e6869967ebc8ecdfa3ff2ee2c8981890103d5fe0771d25bc7f5c2c36e03f0 | Python | 1,640 | 49 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
88688a4dde94b2a4d306c85053f8d95336007cbd6b4a283262d67f3eebad6195 | Python | 1,641 | 38 | # Copyright 2018 SciNet (https://github.com/eth-nn-physics/nn_physical_concepts)
#
# 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... |
174e941519135a0d88dff139d8885a61f1b1d640a39124abcb3127e39243449d | Python | 1,642 | 46 | import time
import torch
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from torch_geometric.utils import from_networkx
from sklearn.model_selection import train_test_split
from graphxai.datasets.utils.bound_graph import build_bound_graph
from graphxai.gnn_models.node_cla... |
2acf7e6bd8374bffd4dd14114879969126843811021c018fefe34579bc544f4a | Python | 1,642 | 52 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Blob helper functions."""
import numpy as np
# from scipy.misc impo... |
64b02191b7ca2a3ab95eeb42838fa2a72403bed5e5ae35867a39ff3936b81841 | Python | 1,643 | 51 | #!/usr/bin/env python
from __future__ import print_function
import os
import re
transdir = '/export/a04/gkumar/corpora/ECA/callhome/LDC97T19/callhome_arabic_trans_970711/transcrp'
devtest = {}
evaltest = {}
train = {}
devConv = 0
testConv = 0
trainConv = 0
pattern = re.compile(r"\d+\.\d*\s\d+\.\d*\s[AB]")
for root,... |
d40f1b4bb044267bd560c04b1fad637792474fe25e03787fd82309a2c3d1addc | Python | 1,643 | 37 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
f833a132d3214798786153e19c89092b421fba9112bc2bf4b2b936c02d05c5b8 | Python | 1,643 | 47 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
913af1ea44c647ce47d54147b9a3e26d3cb54172cebe5337887d9e718d2742c2 | Python | 1,644 | 44 | # Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
5cea94dd2384f1a9a164d92c16f3a0eb8eb896cb408bf11a7b725304303d92b9 | Python | 1,647 | 46 | #TODO: this samplesheet maker is very similar to BipSeq, can probably make one script otu of these
# loop through all subdirs to find all fastq files
import os.path
import glob
import os
import re
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for BrianGVEx.')
parser.a... |
43dffaca68dd07c6f10b355214678c3a83de0eda8e233ef82b30d94df5bae7b0 | Python | 1,649 | 60 | import os
import torch
from torch.nn import functional as F
module_path = os.path.dirname(__file__)
def upfirdn2d(input, kernel, up=1, down=1, pad=(0, 0)):
out = upfirdn2d_native(
input, kernel, up, up, down, down, pad[0], pad[1], pad[0], pad[1]
)
return out
def upfirdn2d_native(
input,... |
c5fb8e86bff814685a453625f08b0d23d8fced29469a4cfb0c873db60a6d5f77 | Python | 1,650 | 53 | '''
args: num_threads, ncycle
'''
import os
import logging
import subprocess
import sys
import carpet.various.parallel_with_threads as pwt # to find fixpoints faster
import carpet
## Setup logging
carpet.setup_logging('master.log')
script_path = '.'
script_name = "worker_basin.py"
sim_name = 'basin'
def run_script... |
7dec8af06f5a5dd2712501e6566a7d19029001dd51b057377fd9dc886a9dca7d | Python | 1,652 | 44 | from dff import *
import os, sys
import warnings
warnings.filterwarnings('ignore')
from glob import glob
# get cell list information
flist = sorted(glob('GCaMP8_exported_ROIs_s2f_full/data_v01/*.npz'))
cell_info=["_".join(os.path.basename(f).split('_')[:6]) for f in flist]
cell_info_uq = np.unique(cell_info)
bname = ... |
9a24a1ac43e93a7836c5133a3ec59a7c9b243b349692ab18e62a6efdfe723865 | Python | 1,652 | 59 | #!/usr/bin/env python
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import carla
import argparse
def main():
argparser = argparse.Argumen... |
f1ecc7a614a2c1738c0b2c34555c30f93b95b372c216f8e89e7677eae3294fdf | Python | 1,652 | 57 | import pytest
import torch
from ..coda_layer import *
from ..spectral_convolution import *
device = "cuda" if torch.backends.cuda.is_built() else "cpu"
# device = 'cpu'
@pytest.mark.parametrize("token_codimension", [1, 2, 5])
@pytest.mark.parametrize("n_dim", [2, 3])
@pytest.mark.parametrize("norm", ["instance_norm"... |
52155e6dc3514e1fcb78bbb7291baccee183da2b02befd5bc72effda6015ff36 | Python | 1,653 | 49 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
272ee94886ccd55ec5acdda2f8d03c83c63d98257590b754b5d0420cfb689144 | Python | 1,654 | 62 | import matplotlib.pyplot as plt
import numpy as np
from .SpikeTrainComparator import SpikeTrainComparator
s_reference = (
np.random.rand(100) * 10000.0
) # generate reference spike train at 10 Hz
data_stochasticity = 10.0 # ms, standard deviation of the gaussian jitters
# consider different level of stochast... |
3e3b9f183cb6c6cb016f7dc31a088ccffa474ea124838080494812c44ee8c55b | Python | 1,656 | 84 | #%%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import math
aa = pd.read_csv('data/axon-axon.cs... |
1982adb3813d3468fc9ea66bbad084f2b846c4f31954b515d8db3355905a5796 | Python | 1,657 | 34 | """integration.py
Integrate multiple output .csv files to one big file for plotting, and add one column entitled "method" to indicate the improve methods used, which will become the labels of the figure.
You should call this script with a name of a text (or csv) file. The file should contain N lines of a filename (wi... |
95d0bf197d0c20b68da05f747aa44110d99df4c97aff02eead15084c6b096048 | Python | 1,658 | 52 | # Copyright 2018 SciNet (https://github.com/eth-nn-physics/nn_physical_concepts)
#
# 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... |
e6689545de3837a87049a12bef84c627bf6470f6e0105bb1a59e23e49e4d79e4 | Python | 1,658 | 53 | import sys
import argparse
import gzip
parser = argparse.ArgumentParser(description='Annotate Sieberts eQTLs with TSS distance after liftover. The file format is quite specific so this is not reusable')
parser.add_argument('eqtl_file', help='File with columns as in description')
parser.add_argument('gtf', help='GTF fi... |
2de1f7dd6d9533c9d6a7e2c3c1a2d675696d598fd9aa67e48a361f8ee71fa553 | Python | 1,659 | 41 | import os, sys; sys.path.append('..')
import torch
from torch_geometric.datasets import TUDataset
from graphxai.explainers import IntegratedGradExplainer
#from graphxai.explainers.utils.visualizations import visualize_mol_explanation
from graphxai.gnn_models.graph_classification import train, test
from graphxai.gnn_mo... |
4aacd7eec67fb3dcdf4238f0edea8ddae674df22ad831928e3fae29725c3bd6c | Python | 1,659 | 58 | import pymesh
import numpy
"""
read_ply.py: Save a ply file to disk using pymesh and load the attributes used by MaSIF.
Pablo Gainza - LPDI STI EPFL 2019
Released under an Apache License 2.0
"""
def save_ply(
filename,
vertices,
faces=[],
normals=None,
charges=None,
vertex_cb=None,
hbond=... |
40ec54fd57f24a96c746ad97cbb6b576b57b9e456556b406fbd1338d316c68b4 | Python | 1,660 | 39 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
8d43ba20af515f6754d6abf9cb2877ab1521988464a05b35934d68fe3ffca3d6 | Python | 1,660 | 39 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
ccb2ff82ea5216b6dda953fee10be5b0364649df507be34d5b8d5edcc2e0e511 | Python | 1,660 | 56 | import os
import sys
import numpy as np
from scipy.spatial.distance import cdist
from biopandas.pdb import PandasPdb
from feature import create_basic_features
from data.process_label import generate_coords_transform, generate_lddt_score
# modeldir = "/bml/ccm3x/models/"
# refdir = "/bml/ccm3x/reference/"
# outdir = ... |
6df6ec3422fb3f7fb90a1dce104c3dc9ef188accf2800e0bce9624c327305e37 | Python | 1,661 | 55 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
84ff353f0d1e73bca36c24512ffcda8d5589a983d18331f9690721ef063fddc8 | Python | 1,661 | 36 | """Hand server-produced control videos back to the client next to the generated video."""
from __future__ import annotations
import re
import shutil
from pathlib import Path
from typing import Any
def canonical(name: str) -> str:
"""``camera:front:wide:120fov`` -> ``camera_front_wide_120fov`` (file-name safe vi... |
5e3382bc6b9e3864eb892f136a0f0b96a49d758fa4ce1cfc26b150782f0d5304 | Python | 1,662 | 24 | """Animated WebP from frame dirs. anim.py OUT.webp DIR[,DIR2] [--w 800] [--step 2] [--fps 10] [--labels a,b]"""
import argparse, glob, os
from PIL import Image, ImageDraw, ImageFont
ap = argparse.ArgumentParser(); ap.add_argument("out"); ap.add_argument("dirs")
ap.add_argument("--w", type=int, default=800); ap.add_argu... |
fc5402fcbdc52d3f38ddad13c9fb9f4b57883d8ece3cbe53d2ca60690d194ef0 | Python | 1,662 | 52 | ###################################################################
####
#### Version: 1.1.7
#### Date: 6/24/2023
#### Description: This file contains the starting point of the application and handles command line arguments, as well as OS specific code.
#### Author: Evan Cobb
####
#####################################... |
dc9e25fa08830d90d1b04b784ed51fda5988dbf133982414de35e59eccb7de07 | Python | 1,663 | 45 |
# loop through all subdirs to find all fastq files
import os.path
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for BipSeq.')
parser.add_argument('samplesheet', help='BipSeq samplesheet from synapse')
parser.add_argument('cram_dir', help='path to cram file dir for in... |
f5a40080bdc6624da2b235f29b8fe29fb5719254ebf4e399681ff0970955342f | Python | 1,663 | 47 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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
#
# less required by applicable law or agreed to i... |
883507df07773c3dad0e554265d3b3c566614a687f8fee2e78b038ce35aaf202 | Python | 1,664 | 41 | import os, sys; sys.path.append('..')
import torch
from torch_geometric.datasets import TUDataset
from graphxai.explainers import IntegratedGradExplainer
#from graphxai.explainers.utils.visualizations import visualize_mol_explanation
from graphxai.gnn_models.graph_classification import train, test
from graphxai.gnn_mo... |
96a3ddc16a2060cd587f43c02a2c012386ae500b72596ea9039e22571c5b65d6 | Python | 1,664 | 44 | import tensorflow as tf
from tensorflow.keras import backend as K
class FCN:
def __init__(self, input_shape, nb_classes, verbose=False, build=True, is_train=True):
if build:
self.model = self.build_model(input_shape, nb_classes, is_train)
if verbose:
self.model.sum... |
dd3eae233035c09044014acabb60e7c5786f11f552407a8702a3b5757b09db6f | Python | 1,664 | 73 | """spikebench: an open spike train time-series classification benchmark"""
import codecs
import os
import sys
import setuptools
here = os.path.abspath(os.path.dirname(__file__))
with open('README.md', 'r') as fh:
LONG_DESCRIPTION = fh.read()
def read(*parts):
with codecs.open(os.path.join(here, *parts), '... |
f6cef082ecc0302f03db33c8339bccdf7f13c5e4c616f4712af5c79bf2ce2e3e | Python | 1,665 | 41 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
0b67e76e887fc5b57c79bb1329bf8a5a4dc1a24b305ad5fd51e24fb90f8a4e19 | Python | 1,667 | 41 | import os, sys; sys.path.append('..')
import torch
from torch_geometric.datasets import TUDataset
from graphxai.explainers import IntegratedGradExplainer
#from graphxai.explainers.utils.visualizations import visualize_mol_explanation
from graphxai.gnn_models.graph_classification import train, test
from graphxai.gnn_mo... |
518027bfc2e01a3a1c7f8ee53017cd36c52a40f1f132443fe5077b590db36e68 | Python | 1,667 | 53 | import numpy as np
import csv
from collections import defaultdict, Counter
INFILE = 'tldr_email_arxiv_authors/tldr_eval_correctness_arxiv_authors.tsv'
arxiv_id_to_blobs = defaultdict(list)
with open(INFILE) as f_in:
reader = csv.DictReader(f_in, delimiter='\t')
for row in reader:
arxiv_id_to_blobs[row... |
c1e5273d784d4cabfbc1f89a4a6114a6e47018c632dfcf1e6584cd3de7cce35d | Python | 1,667 | 43 | """
AS build using annotations text file to reject.
"""
import time
from scripting.spectrum import metadata
from scripting.spectrum.io import persist
from scripting.spectrum import dataset
from scripting.utils import interpolate
BETWEEN = [' Start', ' Stop'] #start and stop labels in annotation text file
HOURS = [(0, ... |
c83fd590f196d3de8ab7f50c7e1937f37b489bad63340d43fdcd2d456e98c069 | Python | 1,667 | 60 | """
tests
Created by: Martin Sicho
On: 28.04.22, 14:08
"""
import os.path
import tempfile
from unittest import TestCase
from drugex.data.corpus.corpus import SequenceCorpus
from drugex.data.corpus.vocabulary import VocGraph
from drugex.molecules.converters.standardizers import DefaultStandardizer
from drugex.molecule... |
995ef4b5f0de7ec3ecd946fdc9c463a6de9c9dd1d97c831ae5e2892e55f8919e | Python | 1,669 | 47 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
4e0cd2521e4cb509de8ff72678c20dad5e313648c8c4bba86e79e15aed5c7fd7 | Python | 1,670 | 47 | # basic imports
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
def compute_strength_map(C):
strength_map = np.zeros((7, 11))
for e, exp in enumerate(C):
s = e % 77
x = int(s/11)
y = s - x * 11
strength_map[x, y] += exp
return strength_ma... |
2e9c4e24b25871401b7643c429dcd7f284ece768a52b049ea7f06fb54eeae81a | Python | 1,672 | 42 | from torch.nn.modules.module import Module
from torch.nn.functional import avg_pool2d, max_pool2d
from ..functions.roi_align import RoIAlignFunction
class RoIAlign(Module):
def __init__(self, aligned_height, aligned_width, spatial_scale):
super(RoIAlign, self).__init__()
self.aligned_width = int(... |
4b5269db7878422107f08a6cd7f62000abc9bb8c350ea287b7d6b9ac18360e91 | Python | 1,672 | 52 | """Parser for GAF association formats"""
import csv
from dataclasses import dataclass, field
from typing import Iterator, Optional, TextIO, Union
from oaklib.datamodels.association import (
Association,
NegatedAssociation,
ParserConfiguration,
)
from oaklib.parsers.xaf_association_parser import XafAssocia... |
aa2cb37b380501816c2d4ed7b70834dfa9e52b384b91a7918d1ad323e287ee51 | Python | 1,672 | 43 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
d864c005d35829160e96b7782e46faa83269d6f36e791407e0a3b560c32a6c7a | Python | 1,672 | 54 | from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="schumannet",
version="0.1.0",
author="Junha Cha",
author_email="junhacha@yonsei.ac.kr",
description="Construction of cell-type-specific functional gene net... |
1c274711b25cb49e5f33297c1208f0c5c54dd02f6722201a6981c8fbeeea6cb9 | Python | 1,673 | 34 | import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
from Brain_study.Train_SegmentationGuided import launch_train
import argparse
TRAIN_DATASET = '/mnt/EncryptedData1/Users/javier... |
5f9ca79f56661506fe69d1cac967b9f5433cec6e2a480da012299c4fda27d7dd | Python | 1,674 | 39 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
8a04622cf83dcabd344b134d524a5ffa68214e3d015bf5fcbe4ead1d38f95b6b | Python | 1,674 | 52 |
"""
Created on Thu Oct 26 11:19:58 2017
@author: Utku Ozbulak - github.com/utkuozbulak
"""
import torch
from misc_functions import get_example_params, convert_to_grayscale, save_gradient_images
class VanillaBackprop():
"""
Produces gradients generated with vanilla back propagation from the image
"""... |
d8d20cb68505afce67a0bb8c5adbdfd44df3fd221131e960f4e8ca8c4ac8c6bc | Python | 1,675 | 78 | #%%
# %%
import numpy as np
import pandas as pd
import logging
from box import Box
import matplotlib.pyplot as plt
import pathlib
#%%
fix_scalar = lambda x : x.item() if x.ndim==0 else x
def read_npz(file_name):
data= np.load(file_name,allow_pickle=True)
data_dic={ k: fix_scalar(data[k]) for k in data}
... |
615858b95802c592b53a9a36a6bf78e56472b1e702598e80deb06fc9c35d9da1 | Python | 1,676 | 63 | #!/usr/bin/env python3
# From https://github.com/broadinstitute/viral-ngs/blob/master/pipes/Broad_LSF/run-pipe.sh
import os
import sys
import re
from snakemake.utils import read_job_properties
LOGDIR = sys.argv[-2]
jobscript = sys.argv[-1]
props = read_job_properties(jobscript)
# set up job name, project name
jobname... |
b461adfb30d9a01c7170d64210ba6fae0ed51c55ee4291b8e8c9e6f97f127c8a | Python | 1,677 | 62 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 14 15:56:30 2021
@author: zhang.9325
"""
import tensorflow as tf
import cv2
import numpy as np
import os
import shutil
from keras.preprocessing.image import img_to_array
def get_prediction(file):
model = tf.keras.models.load_model('models/nn_model_o')
img = c... |
ceaf755d0e9afdba424984eebd4b7483489c18a4cb2aff6cc6ee131764b3e14f | Python | 1,677 | 38 | #!/usr/bin/env python
# Copyright 2015 David Snyder
# Apache 2.0.
#
# Using the annotations created by refine_annotations_bn.py, this script
# creates the segments, utt2spk, and wav.scp files.
#
# This file is meant to be invoked by make_bn.sh.
import os, sys
wav_dir = sys.argv[1]
out_dir = sys.argv[2]
with open(os... |
e81acbe95af8273cc65d2656ddbc63390a49cf762b8c0512c2d12db215a6a996 | Python | 1,678 | 32 | # basic imports
import pickle
import numpy as np
# framework imports
from cobel.misc.gridworld_tools import make_open_field, make_gridworld
# make linear track environment
linear_track = make_open_field(1, 10, goal_state=0, reward=1)
linear_track['starting_states'] = np.array([9])
pickle.dump(linear_track, open('envi... |
165610663eb58bd07d281b92fa779ec2a6d36053065c11912bc9ee0c1e5ae2ea | Python | 1,679 | 49 | # basic imports
import numpy as np
import pickle
import matplotlib.pyplot as plt
# params
modes = ['default', 'reverse', 'dynamic']
styles = {'default': '-', 'reverse': '-.', 'dynamic': '--'}
# load data
data = {'tmaze': {}, 'box': {}}
for mode in modes:
data['tmaze'][mode] = pickle.load(open('data/changingGoal_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.