sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e3cb3e3ab6be2c88b21a0af264d35209283935d26b0f9da1dc00b8a394038527 | Python | 2,267 | 74 | # Author: AnNi/LuanXuke
# Update time: 20211117 pm
# Usage: python CalculateISOR.py -g XX.gpe -b XX.bam
import sys
import argparse
import pysam
import time
def main(g, b, o):
samfile = pysam.AlignmentFile(b, "rb")
regiondp = {}
regiondn = {}
strand = {}
startd = {}
endd = {}... |
d09bb458a686f941ef9af0776c244a970cc6231011ade9d6abc821414ea41c69 | Python | 2,268 | 65 | """
© 2022, ETH Zurich
"""
import os
from xgboost import XGBRegressor
import chemprop
import tempfile
import pandas as pd
import joblib
from rescoss_logp_ml.utils import ROOT_PATH
from rescoss_logp_ml.descriptors import get_2d_features
def get_model_savepath(model_name, split_type, target):
if model_name == "r... |
6d69f72d7041fc767c2460df4e23da0f429e9688acf89fbcf9251978d337586f | Python | 2,269 | 61 | # TODO(julia): delete or rewrite this file
import random
import numpy as np
from roboscientist.equation import operators
def generate_formula(all_tokens, max_len, functions):
while True:
const_ind = 0
formula = []
tokens_required = 1
for _ in range(max_len):
token = ra... |
865debe476c8ca060233ce13cf2889b445f1d617f6875ad77fdb741372dfabfe | Python | 2,269 | 73 | import numpy as np
import pimms
from time import time
import logging
import dipy.tracking.streamline as dts
import AFQ.recognition.utils as abu
logger = logging.getLogger('AFQ')
@pimms.calc("tol", "dist_to_atlas", "vox_dim")
def tolerance_mm_to_vox(img, dist_to_waypoint, input_dist_to_atlas):
# We need to cal... |
45b64b17578716ee872a7a8dda129f3f743f6b3d5f6eb70d575e634970fdfa27 | Python | 2,271 | 67 | from dataclasses import dataclass, field
from typing import List, Iterator, Tuple, Iterable, Optional
from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.utils.metamodelcore import URIorCURIE
from oaklib.io.streaming_writer import StreamingWriter
import sssom.sssom_datamodel as sssom_dm
from oaklib.type... |
77e28b79f125a5d06c2b979d183d81a206b8b5d907e1ea0fa4e1fcaf0b20749e | Python | 2,271 | 75 | ####################################################################################################
# Copyright (c) 2019 - 2023, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis>
#
# This program is free ... |
055093e9394b445690d47bc1af0f14d8e8247458b440ba998d5ab96fab1d7dc9 | Python | 2,272 | 98 | # %% [markdown]
# ##
import datetime
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymaid
import seaborn as sns
from src.graph import MetaGraph
from src.io import savecsv, savefig
from src.pymaid import start_insta... |
4e05eab24b61941a376e532b4a0fce6c226ce1ff3018a002630c189aec51a171 | Python | 2,272 | 62 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 2 10:38:45 2021
@author: paulmueller
Runs calculation for each patient in one go
"""
import os
import subprocess
import glob
def write_submit_file(cmd, time_in_sec, job_name):
"""Create the submit file for the cluster."""
h = str(int(tim... |
b414bca61ec604218a9b2f82c26ef53c8bf3d44962436479f7b8a2e2ccfa24ea | Python | 2,272 | 84 | import argparse
import torch
from torchvision import utils
from model import Generator
from tqdm import tqdm
def generate(args, g_ema, device, mean_latent):
with torch.no_grad():
g_ema.eval()
for i in tqdm(range(args.pics)):
sample_z = torch.randn(args.sample, args.latent, device=dev... |
44158b47baab5c1c67742a64f8e25ab290cff2f28d251bcc2f230a6ec750abf6 | Python | 2,273 | 86 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from sklearn.model_selection import ParameterGrid
from graspy.datasets import load_drosophila_left
from graspy.utils import binariz... |
da2bbbcc5f73f199dc51ba6cf817e39af1193b5596016f8fb8d704ff982f1ac3 | Python | 2,273 | 71 | """Run python inside the running UE editor (Python Remote Execution).
python3 ue.py "print(1)" or python3 ue.py -f script.py
On Linux the editor binds its UDP socket to 127.0.0.1:6766 and never sees
the 239.0.0.1 multicast discovery, so this client skips discovery: it sends
an "open_connection" unicast ... |
222f229a0b8c09b324b4bce3457c6f46847e3f4d27b97b023cb9da9e5178a598 | Python | 2,275 | 67 | # 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... |
3e685baaccbcff297ef810d61920a1b36055da3dc6f60b22ce67c3936fcdb99b | Python | 2,275 | 84 | from dataclasses import dataclass, field
from typing import List
import kgcl_schema.datamodel.kgcl as kgcl
from oaklib.datamodels.vocabulary import IS_A
from oaklib.interfaces.patcher_interface import PatcherInterface
from oaklib.types import CURIE, PRED_CURIE
def _change_id():
return "_"
@dataclass
class Ont... |
25e7b8eb6e14fa20ba61ec1fd90cbb94d921b0203b5b5e5142d2fe899fc9d198 | Python | 2,277 | 53 | # 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... |
fa72c29bce47f973deda8f802e5713b2cb1b40ef7df084800b5f71405c2ea936 | Python | 2,277 | 85 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i + offset
i += 1
retur... |
29251d0746e1f4c9fa4a9aaa9f24d6485bf2bbb108ec6de64d7c7ce9e75c1678 | Python | 2,278 | 81 | import random
import torch
import networkx as nx
from graphxai.datasets.feature import make_structured_feature
def net_stats_generator(G):
'''
Args:
G (nx.Graph):
'''
deg_cent = nx.degree_centrality(G)
def get_feature(node_idx):
return torch.tensor([G.degree[node_idx],
... |
9201d1188433227606dee18551614d60038db8444aba76dac2eceae8fdda39ad | Python | 2,284 | 63 | from ..normalizers import UnitGaussianNormalizer
import torch
from torch.testing import assert_close
from flaky import flaky
@flaky(max_runs=4, min_passes=3)
def test_UnitGaussianNormalizer_created_from_stats(eps=1e-6):
x = torch.rand(16, 3, 40, 50, 60) * 2.5
mean = torch.mean(x, dim=[0, 2, 3, 4], keepdim=Tru... |
c306a6da19bff9f140cfc8b9d550546460034df8b5f4a2cc5256a7f4e4dd3eb9 | Python | 2,284 | 72 | # Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang)
# Apache 2.0
import os
import re
import json
import random
from itertools import chain
from collections import Counter
from imblearn.over_sampling import RandomOverSampler
def round_score(score, floor=0.1, min_val=0, max_val=2):
score = max(min(max_val, ... |
2a010ec8ad83f50405162ecd349d3c085466dce3d25f3ff34305bb1303751250 | Python | 2,285 | 68 | """
gcmol
Created by: Martin Sicho
On: 10.06.22, 16:50
"""
#THESE FUNCTIONS WERE ADDED BY HELLE FROM:
# https://github.com/BenevolentAI/guacamol/blob/8247bbd5e927fbc3d328865d12cf83cb7019e2d6/guacamol/utils/data.py#L11
# to solve AttributeError: module 'utils' has no attribute 'canonicalize_list'
from typing import ... |
b7540296dc8c744f693c5dac8593c79808d5fb2b2726a2bcad2d4b2204dae577 | Python | 2,286 | 82 | import matplotlib.pyplot as plt
import numpy as np
from numba import njit
from numba import prange
from scipy.stats import entropy
from algorithms import *
from data_gen import *
from datasets import *
#A = simulate_window_linear_2(1000,100,w=0.3)
#plot_covariance_matrix(A, "Linear signal")
#a=1/0
recons... |
a5292b44bdc4f7c604ea009bb1de7eb7595fec5b97512893f4f950e1a42337a3 | Python | 2,287 | 71 | from abc import ABC
from typing import Iterable, List, Tuple
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.types import CURIE, PRED_CURIE
class RelationGraphInterface(BasicOntologyInterface, ABC):
"""
An interface that provides relation graph abstractions.
.. ... |
bb16a0af4386f4874180031b2997427dc2ce3014acc031074c9e740357a231b2 | Python | 2,287 | 91 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from sklearn.model_selection import ParameterGrid
from graspy.datasets import load_drosophila_left
from graspy.utils import binariz... |
2f63397e3beacb75b5e2d54a726282f31cc2850b9b03919a71d7b2f8c5230fcf | Python | 2,288 | 30 | """generate_opendrive_world from an .xodr and shoot it. odr.py XODR OUTDIR [smooth 0/1] [pose;pose...]"""
import sys, os, queue, time, math, carla
sys.path.insert(0, os.path.dirname(__file__)); import scene
xodr, out = sys.argv[1], sys.argv[2]; os.makedirs(out, exist_ok=True)
smooth = bool(int(sys.argv[3])) if len(sys.... |
f23ca6f49df86a74b1f7547593465a0b22702623f7d673203fa55f1a8f3ffbfa | Python | 2,290 | 64 | import ipdb
import random as rand
import torch
import argparse
import numpy as np
from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train, val, GSAGE_3layer, GAT_3layer_basic, JKNet_3layer
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.datasets imp... |
4efa4058e64735474d2f88243d8814733f937a026d33be2fd0016ccf32c309ed | Python | 2,291 | 69 | import csv
import sys
from dataclasses import dataclass, field
from typing import Any, Dict, Union, Tuple
from linkml_runtime import CurieNamespace
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
from linkml_runtime.utils.yamlutils import YAMLRoot
from oaklib.interfaces.obograph_interface import OboGr... |
8f32029d49b8f107833c78681c3d640e56d6019aa102e8f87e3cbd091d3d8bc9 | Python | 2,291 | 65 | #%%
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
except:
pass
from pymaid_creds import url, nam... |
532a4e17041b4ed89d40affa179a2848e6e71ff2b83c83cd1e871c4414fbddbf | Python | 2,292 | 55 | ####################################################################################################
# Copyright (c) 2016 - 2021, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
f48b36d278d1d7dcf5a314bb260174bbb6087068b1beb50c7780f10586562e1f | Python | 2,293 | 75 | import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import ndex2
from oaklib.datamodels.obograph import Edge, Graph, GraphDocument, Node
from oaklib.implementations.obograph.obograph_implementation import (
OboGraphImplementation,
)
__all__ = [
"CXImplementation",... |
636197da7992c17fc427886a00c89b93d43832c5c3c7bc406b0c6b53461f16a2 | Python | 2,294 | 57 | import unittest
from oaklib.datamodels.vocabulary import HAS_PART, IS_A, PART_OF
from oaklib.indexes.edge_index import EdgeIndex
from tests import CELL, IMBO, NUCLEUS, VACUOLE
RELS = [
(NUCLEUS, IS_A, IMBO),
(NUCLEUS, PART_OF, CELL),
(VACUOLE, PART_OF, CELL),
]
EXPECTED = [
# by subject
([NUCLEUS... |
b8ba296ea5c8611b2683b7ea2a1e77d27f5bde471a3269087adf4ba96aaf313f | Python | 2,295 | 62 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from maskrcnn_benchmark.modeling import registry
from torch import nn
@registry.ROI_BOX_PREDICTOR.register("FastRCNNPredictor")
class FastRCNNPredictor(nn.Module):
def __init__(self, config, in_channels):
super(FastRCNNPredictor, self... |
4c1b6f9dc6b0d6daf3a95f628a64f6b42472e9701b86e289997b2b24010287f1 | Python | 2,297 | 74 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from os.path import join
from warnings import catch_warnings, filterwarnings
import pytest
from eelbrain import *
from eelbrain.pipeline import *
from eelbrain.testing import TempDir, path, requires_mne_sample_data
class Experiment(MneExperiment):
meg_sy... |
085785f496ab59cf4ba90c3d626dfb3f8e00a2e2a5f00332f1b87baf46e417bf | Python | 2,299 | 91 | #!/usr/bin/env python
# Read annotation file, print selected stuff in human-readable format.
# AUTHOR: Tom Skelly (thomas.skelly@fnlcr.nih.gov)
import os
import sys
import optparse
import re # regular expressions
import cPickle as pickle
from tt_log import logger
import Annotations as anno
VERSION = '201504... |
8bf69760830a98676d5034323d7cd13d14f17a6db4873c3cba928f2637125dcd | Python | 2,300 | 74 | import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from maskrcnn_benchmark import _C
# TODO: Use JIT to replace CUDA implementation in the future.
class _SigmoidFocalLoss(Function):
@staticmethod
def forward(ctx, logits, targets, gamma... |
75151175b4444c59f012043c581d70c36bd171f364003bfd45154e7eef158648 | Python | 2,302 | 82 | '''
Figure 6.
Example of trace and fit
'''
from brian2 import *
import yaml
from file_management import *
from pylab import *
import matplotlib.font_manager as fm
import os
from fitting import run_model
from scipy.signal import butter, sosfilt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from matplotlib... |
ceabaf4dee5993921accb29128a8fc0842aaf48096d4a06b8081c3fe705659f8 | Python | 2,302 | 69 | """Multi-seed runners and parameter sweeps for robustness analysis.
These tools let experiments be run across multiple random seeds for
mean +/- std variance bands, and across parameter ranges for sensitivity
analysis (tornado plots and dose-response curves).
Use case: take any of the experiments/0X_*.py protocols an... |
15a2b1cd3040bbbf5196b4ffa7e1695bd387969ea0603b13ce3cec4cf58f0370 | Python | 2,303 | 78 | import numpy as np
from graspologic.embed import select_dimension, AdjacencySpectralEmbed
from graspologic.utils import augment_diagonal
from giskard.align import joint_procrustes
from sklearn.preprocessing import normalize
from hyppo.ksample import KSample
import time
def embed(adj, n_components=40):
elbow_inds,... |
ead96c79c9dc41231fe403289f4b41270ba569b4412e7243e448911ea1bb6149 | Python | 2,303 | 82 | """
Title
-----
AdEx network + synapses
Description
-----------
The Dendrify implementation of the Adaptive exponential integrate-and-fire model
(adapted from `Brian's examples <https://brian2.readthedocs.io/en/stable/examples/frompapers.Brette_Gerstner_2005.html>`_).
In this example, we also explore:
- How to add r... |
5d6e9414b774ed5df70ca168d9589034359a04f3d69b4b1d38e71ae7bdd1d6a5 | Python | 2,304 | 57 | #!/usr/bin/env python3
# This script is called by local/make_dihard_2018_dev.sh, and it creates the
# necessary files for DIHARD 2018 development directory.
import sys, os
def prepare_dihard_2018_dev(src_dir, data_dir):
wavscp_fi = open(data_dir + "/wav.scp" , 'w')
utt2spk_fi = open(data_dir + "/utt2spk" , '... |
9bab33bbb526db26519b137c2d77eea96a1ddb41e25cf69e4de68f1a7d1dd8d3 | Python | 2,305 | 52 | from spike2calcium_linear_ALS_SD 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/dff_v00/*.npz'))
# new fit based on the clean-up data
flist = sorted(glob('GCaMP8_exported_ROIs_s2f_full/dff_... |
bc7b5fca87f0c4c9e77e179dc12863939f08ae5f4fa34634b90669752ec76997 | Python | 2,306 | 57 | #!/usr/bin/env python3
# This script is called by local/make_dihard_2018_eval.sh, and it creates the
# necessary files for DIHARD 2018 evaluation directory.
import sys, os
def prepare_dihard_2018_eval(src_dir, data_dir):
wavscp_fi = open(data_dir + "/wav.scp" , 'w')
utt2spk_fi = open(data_dir + "/utt2spk" , ... |
4841600f46966b74d2ff5f19c3bb537160fa157dfab76fb1e84311dea394ea11 | Python | 2,307 | 54 | #%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pymaid
import pyoctree
from pymaid_creds import url, name, password, token
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
rm = pymaid.CatmaidInstance(url, token, name, pas... |
d4b17e824e3dbce0a63d263d95140e28b8a4ee67b29535915643d63fd6ff14df | Python | 2,307 | 68 | from __future__ import print_function, division
import numpy as np
import multiprocessing
from ase.db import connect
from piml.feature.voronoi import Voronoi
from piml.regression.regression import Regression
lr = 0.009405740333386713
atom_fea_len = 237
n_conv = 6
h_fea_len = 67
n_h = 2
descriptor = Voronoi(max_num... |
d0cbd9c8075538ae8b4606d03303de09808933b87dc5069d874eaa47e9a60dd7 | Python | 2,308 | 63 | #!/usr/bin/env python3
"""
File: identify_ct_mediated_eqtls.py
Created: 2020/06/08
Last Changed: 2020/06/10
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
t... |
2acfc044595a9f1f26119367d987c466ef975617b60754210b1fb0c397505db4 | Python | 2,309 | 68 | import torch
class AbstractDataset(torch.utils.data.Dataset):
"""
Serves as a common interface to reduce boilerplate and help dataset
customization
A generic Dataset for the maskrcnn_benchmark must have the following
non-trivial fields / methods implemented:
CLASSES - list/tuple:
... |
5a90cf1b21eedaf6d40e11c52cf92c480132e17c71904f60c00c43b23be6bbfc | Python | 2,309 | 85 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i + offset
i += 1
retur... |
9073bc11ef4903c932adf6ffb6056f4bb2a2bac814749790f9d66633707692e2 | Python | 2,309 | 52 | from datetime import date
import pandas as pd, sys
import xlsxwriter
'''
format the outputs from ANNOVAR table_annovar.pl with OMIM and GNOMAD
merged.rare.EHdn.annovar.omim.hg19_multianno.txt
merged.rare.EHdn.annovar.gnomad.hg19_multianno.txt
'''
gnomad_file = sys.argv[1]
omim_file = sys.argv[2]
outfile = sys.argv[3]... |
0fd5913dcf81a70e2e03dd7ecca9b4ba7f96a119c7b9648d20cf457a7c0c1d25 | Python | 2,310 | 75 | """
This module provides the NonStrandSpecific class.
"""
import torch
from torch.nn.modules import Module
from .deeper_deepsea_arch import DeeperDeepSEA
def _flip(x, dim):
"""
Reverses the elements in a given dimension `dim` of the Tensor.
source: https://github.com/pytorch/pytorch/issues/229
"""
... |
298618070bfb15aaa5e96e61f7551e270449f29a6d11b4e737f180136aad4438 | Python | 2,310 | 88 | # libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import biovec
import math
import pickle
from sklearn.model_selection import train_test_split, KFold, cross_val_score, StratifiedKFold
from sklearn.preprocessing import StandardScaler, LabelEncoder, normalize
from sklearn.metrics impo... |
c6e0f8611ed9e7513267f02cec53d1942f7af7e514f579b954ad72f7b2cb25d7 | Python | 2,310 | 85 | from copy import deepcopy
from dataclasses import dataclass
from typing import List, Optional, Union
from oaklib.types import URI
VAR_NAME = str
WHERE_CLAUSE = str
DELETE_CLAUSE = str
INSERTCLAUSE = str
@dataclass
class SparqlQuery:
"""
Represents a SPARQL query
"""
distinct: bool = None
select:... |
d3ef205655035b51d509a3e66b585b83aa0517cf2a5c3a3338476112d02e42cd | Python | 2,311 | 81 | # 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... |
7a5ef2a46078bcca6a806905a6c1d0cfa97c86fdcdacf411ed9937e08d71d4c8 | Python | 2,312 | 56 | from easydict import EasyDict
from configs.task1_baseline import task1_baseline_config
from copy import deepcopy
# Augmented conv1D config
task1_augmented_config = deepcopy(task1_baseline_config)
task1_augmented_config.past_frames = 50
task1_augmented_config.future_frames = 50
task1_augmented_config.frame_gap = 1
task... |
e131ac25597f5e37cb4c518445e7eb54c9ba2553fced06df0e8c39ff81728b93 | Python | 2,312 | 82 | import torch
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import GridSearchCV
from graphxai.datasets import ShapeGGen
from graphxai.gnn_models.node_classification.testing import GIN_3layer_basic, GIN_2layer, t... |
9330efc34ab61eadad3fbeeb5b292417d6fdb1ab498bbfe0126582f94be3eb7c | Python | 2,313 | 50 | from spike2calcium_sigmoid_ALS 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/dff_v00/*.npz'))
# new fit based on the clean-up data
flist = sorted(glob('GCaMP8_exported_ROIs_s2f_full/dff_v0... |
aea70d8068b173aa8c030e3dbe18b3d85e2db8232d78551c96afce54ef40661f | Python | 2,313 | 85 | """Plot group-average power maps and coherence networks for each state.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 5_plot_networks.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
import os
import numpy as np
fro... |
b35f1e4c4d1adc101ac826778c947dcc49dc2976181d3f4b9b02ae5ca4beb264 | Python | 2,313 | 85 | """Plot group-average power maps and coherence networks for each state.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 6_plot_networks.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
import os
import numpy as np
fro... |
54643b192f9626aa78403bcd0f6efdb055d9fa03cc92bcb7c689df289e100d0d | Python | 2,314 | 57 | ###
# #%L
# Triangulated surface for deforming in 3D.
# %%
# Copyright (C) 2013 - 2023 University College London
# %%
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, incl... |
8db9d8ad452b42bd003ba32d8f69e5c603f316619eb98726c00f75afb796a18f | Python | 2,314 | 68 | from __future__ import print_function, division
import numpy as np
import multiprocessing
from ase.db import connect
from piml.feature.voronoi import Voronoi
from piml.regression.regression import Regression
lr = 0.009405740333386713
atom_fea_len = 237
n_conv = 6
h_fea_len = 67
n_h = 2
descriptor = Voronoi(max_num... |
daf8ba3e9890b660eaaa447784076007191998ac47478c5244f0d629f997e247 | Python | 2,314 | 90 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
if len(case) > column_nb:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i... |
f323852a9745ffb5ba8e30c42475a0fb8cdf1aa1a705ab5c62534d8cbc359791 | Python | 2,315 | 69 | # 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... |
df409d373adf5594acd23c3d4065faf164a241ec8a065deab7c7558455bfa010 | Python | 2,316 | 57 | """
=========================================
Using RecoBundles for bundle recognition
=========================================
For bundle recognition, pyAFQ defaults to use the waypoint ROI approach
described in [Yeatman2012]_. However, as an alternative approach, pyAFQ also
supports using the RecoBundles algorithm ... |
ed429021016406d867f2628f96dfc956136874c116ffd881434b90ba022de2cd | Python | 2,316 | 69 | import sys
import numpy as np
import circularFiltering as flt
import network_filter as nwflt
from time import time
kappa_z_array = np.array([0.01,0.03,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,30,100])
# choose a kappa_y according to system variable
kappa_z = kappa_z_array[int(sys.argv[1])]
# number o... |
6145bcb26f7fb6eeccdeae3e2dfba3bd34253d6a1f4f5f9c1b10d4b971c98108 | Python | 2,317 | 71 | # 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... |
bb74852051d5b12bb84796b6bcf36277b8fd7af65d5b2ff199529401729cec4c | Python | 2,317 | 63 | #!/usr/bin/env python3
"""
File: matrix_preparation.py
Created: 2020/10/08
Last Changed: 2020/10/20
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free ... |
7fed61006729e0e9465ed9d0ae9aaaec7ed2e1ab4937b75b614a1e03f5235ab6 | Python | 2,318 | 69 | import sys
import os
if sys.platform == 'darwin':
import multiprocessing
else:
import psutil
import numpy as np
import pandas as pd
import itertools #install as more-itertools
from pathlib import Path
import networkx as nx
from networkx.algorithms import bipartite
import pickle #already part of standard li... |
ebe06ee89cfcfc3c6df2f89e825e962108cd3b8673394dcd6c248ae0e20d8a3c | Python | 2,318 | 54 | # 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... |
b7fbba374057214f4d49fd2673fc0921db44e1155abc3e8feb5e6082ddb00023 | Python | 2,319 | 49 | #!/usr/bin/env python
# Copyright 2014 Johns Hopkins University (Authors: Vijayaditya Peddinti). Apache 2.0.
# script to generate the file_patterns of the AIR database
# see load_air.m file in AIR db to understand the naming convention
from __future__ import print_function
import sys, glob, re, os.path
air_dir = sy... |
e7dda91900c68e3fcef88c23efc31e15c0c39d7471b0d854652b325990377168 | Python | 2,319 | 90 | from scripts.script_master import Script_Master
from time import time
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Optional app description')
parser.add_argument('--script', type=str)
parser.add_argument('--losses', default="", type=str)
parser.add_argument('--data'... |
37833027e34ce5a6ba079142c848f2ad76244107f0aac43147b206580b5ab6d8 | Python | 2,321 | 71 | #!/usr/bin/env python3
# Copyright 2020 Audio, Speech and Language Processing Group (ASLP@NPU), Northwestern Polytechnical University (Authors: Zhuoyuan Yao, Xiong Wang, Jingyong Hou, Lei Xie)
# 2020 AIShell-Foundation (Author: Bengu WU)
# 2020 Beijing Shell Shell Tech. Co. Ltd. (Author: Hui BU)
#... |
6f31a98060d97f115c5d1abeca7ec4de1bb1297c217606d48fbc623cab198c22 | Python | 2,321 | 87 | from os.path import basename
from pathlib import Path
import numpy as np
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left, load_drosophila_right
from graspy.utils import binarize, symmetrize
from src.models import select_dcs... |
a76e2c449295850d756260db9a947dfd89df5bd32fc03f090bd41304e0925f17 | Python | 2,321 | 77 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
import subprocess
import urllib.request
import pandas as pd
from tmkit.util.Writer import Writer
class XML:
def __init__(
sel... |
3e31d37b5cd19098ab823260f9dd790f0ab31c27719ba0dea73f78fa4ed37452 | Python | 2,322 | 67 | # 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... |
c7355b9123a1c7589a00fb35ebbd67e7d723d72b51576f6a661a781c90e6970b | Python | 2,323 | 61 | # Copyright 2020-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 agre... |
96dcddb561ea402443a7fbae46be9c5bb0260a326be21ab0fd6bfa3b65db92f4 | Python | 2,324 | 48 | """ffmpeg helpers shared by workers (stdlib + the ffmpeg binary)."""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
def probe(path: Path) -> dict:
"""``{"frames", "fps", "width", "height"}`` via ffprobe."""
out = subprocess.run(["ffprobe", "-v", "error", "-select_s... |
3f3b7012d511e0ca991c87913ac2c2225da0a378887a1ac53dec50431ada1bb6 | Python | 2,325 | 78 | # Importing bunch of libraries
import os
import sys
import time
import random
import warnings
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm_notebook as tqdm
from skimage.io import imread, imshow
from skimage.transform import resize
import tensorflow as tf
from keras.models import Model, loa... |
8b354422fc24d852cd29316f33acd71497fd28d4922705b2817a67347717c65b | Python | 2,325 | 86 | from copy import deepcopy
from dataclasses import dataclass
from typing import List, Optional, Union
from oaklib.types import URI
VAR_NAME = str
WHERE_CLAUSE = str
DELETE_CLAUSE = str
INSERTCLAUSE = str
@dataclass
class SparqlQuery:
"""
Represents a SPARQL query
"""
distinct: bool = None
select... |
405639e09553ab0aef27c158364308361bae15659a8778d1a5d46bb7535dfa2f | Python | 2,326 | 77 | import os
import pandas as pd
from functools import partial
from torchvision.datasets.folder import default_loader
from torch.utils.data import Dataset
class CelebAHQ(Dataset):
image_base_folder = "celebahq/CelebAMask-HQ"
def __init__(self, root, split="train", transform=None, loader=default_loader):
... |
1f3c0236ae3078b7de80ee85c565405db7aef272b87faf8f37ceeb5c8a14ed75 | Python | 2,327 | 74 | """ Script to calculate the statistics of the generated tldrs """
from argparse import ArgumentParser
import glob
import pandas as pd
from multiprocessing.pool import Pool
from tqdm.auto import tqdm
import json
import nltk
from nltk.util import ngrams
import numpy as np
def get_novelty(summ, text, ngram=1):
summ... |
2ffc0d6a4a5c68707b8ec657b41261d45244676650697c8366fe2e087fd1db24 | Python | 2,327 | 81 | import torch
from torch.utils.data import DataLoader
import M2TR.models
import M2TR.datasets
import M2TR.utils.distributed as du
import M2TR.utils.logging as logging
from M2TR.utils.registries import (
DATASET_REGISTRY,
LOSS_REGISTRY,
MODEL_REGISTRY,
)
logger = logging.get_logger(__name__)
def build_m... |
1863010e40f22531393021537f219dfe01a32b31ac1b2c198e20ee27b6d19c1a | Python | 2,329 | 80 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import argparse
import cv2
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
import time
def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo")
parser.add_argument(
... |
9205cbd146d281a7a86ac1e34ae3fce48020b10420278963d9061e568766e870 | Python | 2,329 | 42 | # 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... |
04a8cead3442465cc34674d0e24b059d3c92555b2a62b8eb320b428539dd07d3 | Python | 2,331 | 83 | #!/usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from setuptools import find_packages
#### Snip from setup.py for tensorflow-forward-ad
## with workaround for cython/numpy
try:
from Cython.Distutils import build_ext
except ImportError:
from setuptools... |
75c7db0d25a4fb658197089f0e78e01ec1739fba653165dd1f61f16320d4cba0 | Python | 2,331 | 68 | """
This script is both a demo for those who are new to running LFADS
and a test script to rapidly test changes. The main steps to
running LFADS are:
1. Create a configuration YAML file to overwrite any or
all of the defaults
2. Create an LFADS object by passing the path to the
configuration... |
d7c1a992f8695830249429774fe4b53c5963efba1ca4a6208fffb76428339fca | Python | 2,331 | 67 | ####### ####### #######
# This script discretizes a parabola on a 2d grid and check to see that
# the output converges to the theoretical limit.
####### ####### #######
import pytest
import numpy as np
import torch
import math
from ..differential_conv import FiniteDifferenceConvolution
def get_grid(S, batchsize, de... |
86f1bb0ee6c676ac0942063df80b3498fbee56be2011ce5978c184b3f65bccf5 | Python | 2,332 | 66 | ''' Define the sublayers in encoder/decoder layer '''
import torch
import torch.nn as nn
__author__ = "Xuhan Liu"
class ScaledDotProduct(nn.Module):
''' Scaled Dot-Product Attention '''
def __init__(self, temperature, dropout=0.):
super().__init__()
self.temperature = temperature
self... |
b587c8f4dcca8fa3bffe054db0f5cb1b2eacb8daa2caf15879b4f6d5fdf150d3 | Python | 2,332 | 70 | #!/usr/bin/env python3
# Copyright Ashish Arora
# Apache 2.0
# This script create a utterance and location mapping file
# It is used in score_for_submit script to get locationwise WER.
# for GSS enhancement
import json
from datetime import timedelta
from glob import glob
import sys, io
from decimal import Decimal
SAM... |
60bacffa80111ff79077d73f3dee7fe2f210f84ebf19c3746632482a3774ba10 | Python | 2,333 | 80 | from collections import defaultdict
from typing import Iterator, List
import sssom_schema as sssom
from oaklib.datamodels.vocabulary import (
EQUIVALENT_CLASS,
HAS_DBXREF,
IS_A,
SKOS_BROAD_MATCH,
SKOS_CLOSE_MATCH,
SKOS_EXACT_MATCH,
SKOS_NARROW_MATCH,
SKOS_RELATED_MATCH,
)
DEFAULT_CONF... |
ac78302be619cb307ec21ada8b63e8af874344587bd26555fdedcf2164353057 | Python | 2,334 | 61 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style as style
style.use('seaborn-poster') #sets the size of the charts
style.use('ggplot')
ds = pd.read_csv('results/All.csv')
model = list(ds["Model"])
X = ['Accuracy', 'F1-Score', 'MCC', 'Bal Acc']
models = ['ANN + Prot... |
fe5b281c199410c509ec06b9c529b6885b5e2933925425424291cbf1e3936474 | Python | 2,334 | 70 | #!/usr/bin/env python
# Look for a list of polyadenylation triggers in a sequence. The
# default list of motifs below is taken from:
# Derti et al, (2012). A quantitative atlas of polyadenylation in five
# mammals. Genome Research, 22, 1173-1183. doi:10.1101/gr.132563.111
import os
import sys
import string
import re... |
edf02c381cb409cc698dc3cb12729d32223adcecc8fb321b3ea31a2c3b9f4265 | Python | 2,335 | 74 | import torch
from torch import nn
from torch.nn import functional as F
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, bias=True, negative_slope=0.2, scale=2 ** 0.5):
super().__init__()
if bias:
self.bias = nn.Parameter(torch.zeros(channel))
else:
sel... |
2b6c04dffe09d54b3a80994ae64ebc041c9f27db7537e0448ab86952399ac370 | Python | 2,336 | 64 | #!/usr/bin/env python
"""Script to update from SIMA 0.x to 1.x
To convert old SIMA directories to the newest version:
>> python update_version.py /path/to/datasets
For help and additional arguments:
>> python update_version.py --help
NOTE: Conversion is not necessary to read datasets created with SIMA 0.x
SIMA 1.x i... |
4ca8651cd99c9a944ad2631d6c2e71295622d0c21b23a77968ce671c9a6d9f02 | Python | 2,336 | 92 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import List
import pandas as pd
from tmkit.channel.Workbench import Workbench
def obtain_single(
df_prot: pd.DataFrame,
... |
c22835e677fcd0b96f645a355d9b1cbbecd84cd6890c575fb99d6d83d408fcd5 | Python | 2,336 | 74 | import time
import datetime
import math
import os
def print_out(*args):
return print(*args)
def evaluate(function_to_run, *args, input_space=None, **kwargs):
'''
Wrap a funciton which performs experiment.
Measure and print how much time it spends
Guess how much time needed to run all the simulati... |
131cf64ed7216d7663058b652c3b8520bc850634dd61b1563d6e66f5070116c5 | Python | 2,337 | 90 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
if len(case) > column_nb:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i... |
630d1af548d62977986f9bf7e53ff8c7e874ec0914f9be88a945c23f1503b6bb | Python | 2,337 | 90 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
if len(case) > column_nb:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i... |
83d94a4791d01acb94755ab7815dcf0814763379c66e1c421df3f3786431df9e | Python | 2,337 | 81 | """
File: eqtl.py
Created: 2020/03/19
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Lice... |
ca808bd29e149f87ce7397710b2d85f7ab587b25971342fd93d606f9ac6bec52 | Python | 2,337 | 90 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
if len(case) > column_nb:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i... |
2d0f84b0e79ca23ce4b018906d3561decae1a073cd8536ae387b0a3ecd88bc3e | Python | 2,338 | 84 | from curses import A_CHARTEXT
import os
import re
import time
from matplotlib.pyplot import delaxes
import numpy as np
import pickle
import glob
import random
import matplotlib.pyplot as plt
from spatial_test import data_clp
from experiment import setup_seed, stft_general_data, stft_general_test
from train ... |
e67e72686f725bd2dce7788d74fa08cd7c87053755302cd391fd09607bb84e22 | Python | 2,338 | 90 | import csv
import os
import sys
def feature_to_index(cases, column_nb, offset=0):
feature_set = set()
for case in cases:
if len(case) > column_nb:
feature_set.add(case[column_nb])
l = list(feature_set)
index = {}
i = 0
for f in l:
if f != '':
index[f] = i... |
f2bf4dc9a5fc092b0c55149144784abef73599bc5d67c3bf9252485c3bdf6a54 | Python | 2,338 | 89 | # libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import biovec
import math
import pickle
from sklearn.model_selection import train_test_split, KFold, cross_val_score, StratifiedKFold
from sklearn.preprocessing import StandardScaler, LabelEncoder, normalize
from sklearn.metrics impo... |
7ec69a2ed2fb8cfe7e73d0970a96d12d63dff216684b58d89be0d83c9ec0aa5c | Python | 2,339 | 83 | #!/usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from setuptools import find_packages
#### Snip from setup.py for tensorflow-forward-ad
## with workaround for cython/numpy
try:
from Cython.Distutils import build_ext
except ImportError:
from setuptools... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.