sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4524e3927b0cd0701e38826762c675949efc2c897f609e3f4712ee6f96bf444f | Python | 1,903 | 68 | from graspy.inference import LatentDistributionTest
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.models import SBMEstimator, DCSBMEstimator
from src.data import load_left, load_right
f... |
9b13c79459d2933aaef2917bf5753fba5c2b554a418201d23a57ac2e07e9659e | Python | 1,903 | 61 | import subprocess
from pathlib import Path
from typing import Dict, List
import pandas as pd
from sqlalchemy import create_engine
def pipe_subprocess(cmd1: List[str], cmd2: List[str]):
# https://stackoverflow.com/questions/13332268/how-to-use-subprocess-command-with-pipes
# https://stackoverflow.com/question... |
911af51c67afdd8a368509369941acb09d336ffb9234bb5f47166e478e11a310 | Python | 1,904 | 63 | # 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... |
ba21cc842f5a6f5c2ac241bf647d598f44bdaed6b51fd8308e324cf448f146e6 | Python | 1,904 | 68 | from graspy.inference import LatentDistributionTest
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.models import SBMEstimator, DCSBMEstimator
from src.data import load_left, load_right
f... |
d38462f8246a3f6ee91e241c37b9215a40ad8a22fcfb13c4dfc8375cf6c292fe | Python | 1,904 | 57 | #### Analysis on experiments
# Built-in
import os
import gc
# Libs
import numpy as np
import pandas as pd
from scipy import stats
# Plot
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import seaborn as sns
from matplotlib.backends.backend_pdf import PdfPage... |
dc0c0a79df73867bea61a6021b1db8506cfec4641d0983ac8f16cc4f43dc6c3e | Python | 1,904 | 56 | #
# Copyright (c) 2018 Institute for Basic Science
#
# 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, including without limitation the rights
# to use, copy, modify, merge... |
dd14b8a1f459a12dcbd82291c9defa301ed82c2e76cb520cf4e7d7ab8a8da461 | Python | 1,905 | 63 | import io
import gzip
import os
import urllib.request
import tarfile
import numpy
import pandas
import scipy.io
import selene_sdk.sequences
def run():
target_column = "rl"
local_file = "sample_et_al.tar"
# Download the data.
urllib.request.urlretrieve("https://www.ncbi.nlm.nih.gov/geo/download/?acc=... |
fcc315d760ab4dba7060ded0fa0ac7726aab96321004fd22280a31d293b1251e | Python | 1,906 | 48 | import unittest
from oaklib.interfaces.association_provider_interface import (
associations_objects,
associations_subjects,
)
from oaklib.parsers.parser_base import ColumnReference
from oaklib.parsers.xaf_association_parser import XafAssociationParser
from oaklib.utilities.associations.association_index import... |
1f5cdd735a52fa8a25f736b26f1b460ebf6b9084feafa7f24b3e28c4c6d83462 | Python | 1,909 | 57 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
21dcb6f7491e77b1118dad53e59b1f4c92088d6470ee14a2d7c852de83d670ea | Python | 1,909 | 62 | #!/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 argparse
import sys
import carla
MAP_LAYERS = {
'Buildings': car... |
74e8b8ae0e799dc311097dc55c8e7fd7296ce024e986f2503f4532b34e9a447f | Python | 1,909 | 54 | import argparse
from pathlib import Path
import tifffile as tf
from cenfind.core.data import Dataset
from cenfind.core.visualisation import visualisation
from cenfind.core.log import get_logger
def register_parser(parent_subparsers):
parser = parent_subparsers.add_parser(
"predict",
help="Predic... |
15f740f606b525b4df2db2d8d54b04f5f5cd4c3aea0363f29cd5f9dba782b6d0 | Python | 1,911 | 74 | import os
import sys
import pytest
import numpy as np
from skimage.io import imread
sys.path.insert(0, '.')
if os.environ.get('TF_KERAS'):
import efficientnet.tfkeras as efn
from tensorflow.keras.models import load_model
else:
import efficientnet.keras as efn
from keras.models import load_model
PANDA... |
0d309243a172a4d557cce26939256c6a523f750e815bda3e1f48739f7c3085a6 | Python | 1,912 | 88 | #%%
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from src.data import load_metagraph
data_loc = Path("maggot_models/data/processed/2020-09-23/connectors.csv")
connectors = pd.read_csv(data_loc, index_col=0)
connectors = connectors[connectors[... |
714163842a987f816bfb389d6f58b5a2a95bd0c73da3be432dea78633d3da3a5 | Python | 1,912 | 77 | import torch
import matplotlib.pyplot as plt
import numpy as np
import argparse
import pickle
import os
from torch.autograd import Variable
from torchvision import transforms
# from utils.build_vocab import Vocabulary
from PIL import Image
import re
def to_var(x, volatile=False):
if torch.cuda.is_available():
... |
c0912ce434badac07918f3e70ef7915ed6bfbe18a5067401ce7596477b82c609 | Python | 1,912 | 54 | # 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... |
15291936f0302e71584ac93c470a9fa68dc72cc1bb2887bfe0604eecf3d5aafb | Python | 1,914 | 59 | import ucr_sound_net
from experiment import setup_seed, one_dim_data
from train import train
from utils.dataTrans import get_dataloader
from sklearn.model_selection import train_test_split
from model import SoundNet, SoundNet_no_padding, SoundNet_UCR,SoundNet_ERing, SoundNet_UCR_np
import numpy as np
import torc... |
425370dba2ae395756cec18357de250464fc6f83b626a629c965cec948a2aa80 | Python | 1,914 | 74 | 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
from graspy.utils import binarize, symmetrize
from src.models import select_dcsbm
from src.utils impor... |
61a19981273fbfd12fe8448d13d4498558f8aef45f51a33602817edeb6cb1ca3 | Python | 1,914 | 61 | # %%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
from data_settings import data_date, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
connectors = pd.read_csv('scripts/brain_completene... |
7246adbf5b8c3ac153f5940d7de2ac39da00241bc08dd549ac90266e60a05ed6 | Python | 1,914 | 74 | 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
from graspy.utils import binarize, symmetrize
from src.models import select_dcsbm
from src.utils impor... |
bf8ce4246812cc871aae2b1132680e62c7ca73421835ad34240222457f75571e | Python | 1,914 | 55 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register backbones
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.config import cfg as... |
fe5b6d8c35685be5b945a9bdfd0a3fb25697a0315a37d4c0c8c6b3405ad58308 | Python | 1,914 | 53 | # 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... |
465241b3575a01ee047fea4e7a5b553902149ddde6925e21652161da024e307b | Python | 1,916 | 48 | ####################################################################################################
# Copyright (c) 2019 - 2021, 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 ... |
a04269533728af6121d7fb968f853893ba287f4d1c0ba7979277e0872c1ef7ac | Python | 1,916 | 60 | import numpy as np
"""
read_msms.py: Read an msms output file that was output by MSMS (MSMS is the program we use to build a surface)
Pablo Gainza - LPDI STI EPFL 2019
Released under an Apache License 2.0
"""
def read_msms(file_root):
# read the surface from the msms output. MSMS outputs two files: {file_root}.ve... |
cac0ae8480651e972c7f877bd66dd5586495a1799d225c49e85f96e8fcf28498 | Python | 1,917 | 74 | 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
from graspy.utils import binarize, symmetrize
from src.models import select_dcsbm
from src.utils impor... |
d0602a6aca09249d7ca2e043b253f960d6e2507b3b957b1a6be41e565a7b6f6f | Python | 1,917 | 71 | #%%
import math
import os
from operator import itemgetter
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.cluster import GaussianCluster
from graspy.embed import AdjacencySpectralEmbed, OmnibusEmbed
from graspy.models import SBMEstimator
from graspy.plot import ... |
ed7ae1b2c758a162132d3caed11e62e64224062ce0e52a215710f832eb6da875 | Python | 1,917 | 74 | 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
from graspy.utils import binarize, symmetrize
from src.models import select_dcsbm
from src.utils impor... |
f847179da0b9e7971189c300ff995038848b1bdba5c80c894f789ec7b5afe5ad | Python | 1,917 | 59 | from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Descriptors
from rdkit.Chem import rdMolDescriptors
def is_benzenoid(smiles: str):
"""
Determines if a molecule is a benzenoid (benzene or substituted benzene).
Args:
smiles (str): SMILES string of the molecule
Retu... |
f5070a32db01d75df45d95ae3c06d33fdbbca2bace1dcbdcc842dc76889dae54 | Python | 1,919 | 61 | 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... |
2534445f236e494e60122f76c0de394f00896caffa397a56baa5227fb3111001 | Python | 1,920 | 67 | import plotly.graph_objs as go
import numpy as np
import RV.constants as c
def get_power_spectrum_plot(freqs: np.array, all_Pxx_den: np.array, channel_names: list, mean_Pxx_den=True):
"""Generates power spectrum plot of given data.
Args:
freqs (np.array): Frequencies.
all_Pxx_den (np.array)... |
56f6a6c529a171cd531ba062fc454818dca77348c606f55e2fdad25011056bfa | Python | 1,920 | 77 | # %% [markdown]
# ##
import os
import numpy as np
import seaborn as sns
from graspy.utils import pass_to_ranks
from src.data import load_metagraph
from src.io import savefig
FNAME = os.path.basename(__file__)[:-3]
print(FNAME)
def stashfig(name, **kws):
savefig(name, foldername=FNAME, save_on=True, fmt="pdf", ... |
aca8522bfd56f226310a6855bdf15982f1df047d21c69a47c1e8d8ad18bd645f | Python | 1,920 | 57 | ####################################################################################################
# Copyright (c) 2019, 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 softwar... |
a12fc44f530bd9fcf577e1f5805e5a54000aee5a4e8f08ba20f29ca77ea82f1c | Python | 1,921 | 57 | import torch
import numpy as np
import pandas as pd
from utils.my_utils import *
class MySoftmaxTransformer(object):
def __init__(self):
self.ref = 10
self.sigma = 0.05
self.lim = [-1, 1]
self.interval = (self.lim[1] - self.lim[0]) / (self.ref - 1)
self.reference = [self.lim... |
787a5126945591b15dfe9d9d5ef12ada9b4da1b92c68afb2a393e3ddae0ed052 | Python | 1,922 | 59 | import torch
from norse.torch.functional.lif_adex import LIFAdExParameters, LIFAdExState
from cgtasknet.net.lifadex import SNNlifadex
def test_init_lif_adex():
input_s, hidden_s, output_s = 100, 100, 100
SNNlifadex(input_s, hidden_s, output_s)
def test_set_custom_params_lif_adex():
input_s, hidden_s, o... |
d9869bcf8a5b70759b6cb621f0825012883d13ffc220d0252a6bfefe34855e56 | Python | 1,922 | 42 | #!/usr/bin/env python3
# Copyright 2018 Ashish Arora
# Chun-Chieh Chang
import argparse
import os
parser = argparse.ArgumentParser(description="""Creates the list of characters and words in lexicon""")
parser.add_argument('dir', type=str, help='output path')
parser.add_argument('--data-dir', type=... |
7677cea0f98bc8e3d98816ba7f83bcb850cd55a6b9e2e77980a28461ccbe576a | Python | 1,923 | 48 | import numpy as np
import matplotlib.pyplot as plt
x, y = np.loadtxt('TS_regimeI_BS1_lambda_1D.dat', unpack=True, usecols=[0,1])
plt.plot(x, y, label="1D diffusion", color='blue', linestyle='solid', linewidth = 4, marker='o', markerfacecolor='blue', markeredgecolor="navy", markersize=12)
x, y = np.loadtxt('TS_regime... |
65ef84067b840e6cc427e9d55d1c58e395296aed78d118b2c18a85ce6fcdaa9c | Python | 1,927 | 48 | import unittest
import numpy as np
import torch
from selene_sdk.samplers.samples_batch import SamplesBatch
class TestSamplesBatch(unittest.TestCase):
def test_single_input(self):
samples_batch = SamplesBatch(np.ones((6, 200, 4)), target_batch=np.ones(20))
inputs = samples_batch.inputs()
... |
730337599eb67a0b18ca6eb50a64876b53592c67a37fb7994c42d8c4659dd56d | Python | 1,927 | 58 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from imlib.dtype import *
import matplotlib.pyplot as plt
import numpy as np
import scipy.misc
def imread(paths, mode='RGB'):
"""Read image(s).
if `paths` is a list or tuple, then read a list of imag... |
f80f4bd509604eaa23cf7b12724a9a195105ae7fadc851b76f8927c48903356f | Python | 1,927 | 42 |
# Set last attribute as class
data.class_is_last()
# Subset features of interest
data_to_BFS = data.subset(col_range='2-4,13,14,15,18,21-last')
# Get selected features through cfs algorithm
cvselect, fullselect = cfs_selection(data)
# Use the full dataset, or can use the subset from cvselect/fullselect
d... |
0dd9f8e1c2f998e465f0f52b618c7e3950703f7e44dd427deec13f4f5411da9b | Python | 1,928 | 55 | import numpy as np
import pandas as pd
from rdkit import Chem
class SmilesChecker:
@staticmethod
def checkSmiles(smiles, frags=None, no_multifrag_smiles=True):
"""
This method is used to check the validity of the SMILES strings and to check if they contain given fragments.
Parameters
... |
0e2c6f823b4a2d352618cd690662c42b987aed0fa5273d9e596469240cf0d8d4 | Python | 1,929 | 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... |
830516d87eccde217db6dd8417f563a9a2a657382236811b6fa329adf71aa09d | Python | 1,929 | 47 | import numpy as np
import matplotlib.pyplot as plt
x, y = np.loadtxt('TSSA_tristable_lambdau3_1D.dat', unpack=True, usecols=[0,1])
plt.plot(x, y, label="1D diffusion", color='blue', linestyle='solid', linewidth = 4, marker='o', markerfacecolor='blue', markeredgecolor="navy", markersize=12)
x, y = np.loadtxt('TSSA_tr... |
f2d51a6a758d327a13dd9565a97c7b48075d1722517772445950bfb195b819d5 | Python | 1,929 | 73 | """Post-hoc calculation of state-spectra using a multitaper.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 4_calc_multitaper.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
import os
import pickle
import numpy as n... |
0e4a970ea83b9a22c161006742d3ea29d04893b481b1828d1a1cdfe86efee9fd | Python | 1,930 | 61 | # 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... |
7f0752fdff67e55c2c7d8afae3c81899b4b48f70b7b7dbfee9a203b308123f32 | Python | 1,930 | 69 | #!/usr/bin/env python
# coding: utf-8
# Evaluation: Transformer Dose Calculation
## Import libraries and define auxiliary functions
import h5py
import json
import numpy as np
import sys
sys.path.append('../src')
from models import dota_energies
from preprocessing import DataRescaler
from evaluation import gamma_analy... |
282a0c2e29e121c1daf2018e73d1355354680b5208bacf3fb52da14b298d7c4e | Python | 1,931 | 48 | import numpy as np
import matplotlib.pyplot as plt
x, y = np.loadtxt('TS_regimeII_BS1_lambda_1D.dat', unpack=True, usecols=[0,1])
plt.plot(x, y, label="1D diffusion", color='blue', linestyle='solid', linewidth = 4, marker='o', markerfacecolor='blue', markeredgecolor="navy", markersize=12)
x, y = np.loadtxt('TS_regim... |
46221415b51633357749c4d7989b2cb07242c825ee962f48a2c88727e964ace5 | Python | 1,931 | 54 | # 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... |
b742819f83bdc13112472e1216422704ff253537510763c48daa7f8a77be602b | Python | 1,931 | 68 | import multiprocessing
from abc import ABC, abstractmethod
class ParallelException(Exception):
pass
class ResultCollector(ABC):
@abstractmethod
def __call__(self, result):
pass
class ListCollector(ResultCollector, ABC):
@abstractmethod
def getList(self):
pass
class ParallelP... |
5f793055a3eb7d79e503fd8c209801f6c1c4439cf7adecc0596cc7805d0c0e79 | Python | 1,932 | 51 | #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... |
c4ec402a4fe7237dc5aa8ddac6414178de5153564e71026126ed3d9478cf60da | Python | 1,932 | 65 |
from __future__ import print_function
import unittest
import argparse
import glob
import math
import os
import sys
import time
try:
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x... |
147c69b907cb94099f8d2197ee73aa05426fa3b90a1f637f98b0bdf1f86e3be6 | Python | 1,933 | 47 | #!/usr/bin/env python3
import pysam,sys
import argparse
import numpy as np
from cmseq import __version__
parser = argparse.ArgumentParser()
parser.add_argument('--version', action='version', version=f"CMSeq {__version__}")
parser.add_argument('--minlen', help='Minimum length of alignment for a read to pass', type=int... |
76784fb13fd92db125a76680e928a0f57c0c83d2ac10263dc8f9a0dc06b19976 | Python | 1,933 | 43 | ####################################################################################################
# Copyright (c) 2019, 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 softwar... |
123300a4473116875141f72ea6fbf6c4cfed6b21ca2a2319786ed8e46f4f6637 | Python | 1,934 | 56 | # 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... |
60aac328a2010839d3699449e44d561def0cc74a33939001ad319d7a8279f003 | Python | 1,934 | 39 | # 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... |
7fbef2cbb46e478135cf5ee9dc2105018c329662e53a641fb226ad8fa68a8af8 | Python | 1,934 | 69 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import defaultdict
from collections import deque
import torch
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __... |
e36cb7c3bfa97142d47ca97bb0fcb859d4956e724d8e933a906d488c5f69dccc | Python | 1,936 | 57 | # 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... |
25878c247683450f5a2b3260c6b276108f6bdb76ca4310dc3ef671841db864d7 | Python | 1,937 | 48 | import numpy as np
import matplotlib.pyplot as plt
x, y = np.loadtxt('TS_regimeIII_BS1_lambda_1D.dat', unpack=True, usecols=[0,1])
plt.plot(x, y, label="1D diffusion", color='blue', linestyle='solid', linewidth = 4, marker='o', markerfacecolor='blue', markeredgecolor="navy", markersize=12)
x, y = np.loadtxt('TS_regi... |
2565e2875991504c81e70f60975c6df5b04698b785b63e248b65ec5ec7073e00 | Python | 1,939 | 67 | from drugex.logs import logger
import numpy as np
import pandas as pd
import logging
import os
import copy
from rdkit import Chem
from rdkit.Chem import RDConfig
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdDepictor, rdMolDraw2D
opts = Draw.DrawingOptions()
Draw.SetComicMod... |
87d05866ca476b634e756cd4094f205150d7f9035fbe411d01553081e7b99f02 | Python | 1,939 | 49 | # 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... |
e4ddc9dd45bb2625abbb23efa55ded5ac84ebfec195602a1253367c697bf6ff7 | Python | 1,939 | 89 | #!/usr/bin/env python3
"""Parallelisation runs for phys2cvr."""
import os
import numpy as np
from phys2cvr import stats
def _l_glm_lagmap(
i,
step,
regr_shifts,
outdir,
func,
denoise_matrix,
orthogonalised_matrix,
extra_matrix,
mask,
r2model,
debug,
lag_idx,
):
"... |
32b435559c070b602bed5cda3a0ef4a4af00ae61b8c91e8fb7db042b7304a659 | Python | 1,940 | 61 | __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
from tmkit.base import PDB as bpdb
class PDB(bpdb.Sequence):
def __init__(
self, pdb_fp: str, prot_nam... |
bfc524c2752d6c2e80393c7fa0929df056152ecc21d10d8ed2516fe48b43a5d3 | Python | 1,940 | 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... |
047ce7e00c5bbcafef6168b7f47a3cbbf188469df89a4835364708d13a6546d5 | Python | 1,941 | 66 | import argparse
from pathlib import Path
import cv2
from tqdm import tqdm
from cenfind.core.data import Dataset
from cenfind.core.visualisation import create_vignette
def register_parser(parent_subparsers):
parser = parent_subparsers.add_parser(
"vignettes",
help="Create png versions of channel+... |
168c466d8aad249fd673b48751cfe10d33c0b83c74322b592da51b39142652fe | Python | 1,942 | 57 | """``carla-cosmos-tokens``: manage API tokens on the host (never over HTTP).
carla-cosmos-tokens list
carla-cosmos-tokens add --label "ci"
carla-cosmos-tokens revoke <id>
Inside the container: ``docker exec <name> carla-cosmos-tokens list``.
"""
from __future__ import annotations
import argparse
import ... |
547ad5f181fc08f8915c8d6b08f9877c1ae9d73afc6a8cf7914fc80f029c51ae | Python | 1,945 | 69 | import matplotlib.pyplot as plt
import numpy as np
from statsmodels.stats.proportion import proportion_confint
def plot_density(misc, palette=None, ax=None, coverage=0.95):
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=(4, 6))
n_possible_left = misc["possible1"]
n_possible_right = misc["pos... |
dc0895e8d56cacd03e849def2b89d926031312c2337550e2111c1fbdd3c89d85 | Python | 1,945 | 52 | # 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... |
e563e10d38aa6e7d78048ba388c55612b8530f51973f705e74b74ef83e4ff845 | Python | 1,945 | 46 | from spike2calcium_single_decay 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/*.npz'))
cell_info=["_".join(os.path.basename(f).split('_')[:6])[:-4] for f in flist]
cell_info_uq = np.uniq... |
eb07390cb17db4b145d91a2b20a9f66820809be662d0d4647876f8f6fc6ba87c | Python | 1,945 | 75 | import datetime
import time
from pathlib import Path
from pickle import dump, load
import numpy as np
import pymaid
from requests.exceptions import ChunkedEncodingError
from src.data import load_maggot_graph
from src.pymaid import start_instance
import matplotlib.pyplot as plt
out_path = Path("maggot_models/experimen... |
0081831a6330f041356b8388cb8cacfdd025dfebe6bdb08a7236af23f000b914 | Python | 1,946 | 64 | import os
import numpy as np
from siVAE.model.output.analysis import infer_FA_loadings
from siVAE.model.plot import plot_images
from siVAE.model.output import analysis
# Plotting
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib.backends.backend_pdf impo... |
cfe36f2f2007ad054aabe6450225fa5e3432f5a4914e88b8e584b08c9e50eb28 | Python | 1,946 | 44 | import tensorflow as tf
def _parse_function(example_proto):
keys_to_features = {
"input_feat_shape": tf.FixedLenFeature([3], dtype=tf.int64),
"input_feat": tf.VarLenFeature(dtype=tf.float32),
"rho_wrt_center_shape": tf.FixedLenFeature([2], dtype=tf.int64),
"rho_wrt_center": tf.VarL... |
92565aa43548171b5b8d00f020565c4da866f569a5c0036fce46cd050c9322b8 | Python | 1,947 | 37 | """Run the engine's Harmonizer (Difix) on PNG files, inside the nre-ga container.
usage (via /tmp/hybrid/runpy): harmonize.py IN.png OUT.png [IN2.png OUT2.png ...] [--color-transfer]
"""
import sys, time
import numpy as np, torch
from PIL import Image
from nre.difix.model import DifixModelFactory
args = [x for x in sy... |
a4ba15b2cdde35a81c6a6522b661224d5ea7bfac6adaa8a82817aa84f8664643 | Python | 1,947 | 48 | # %%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import connectome_tools.process_matrix as pm
import connectome_tools.celltype as ct
import navis
... |
f4d420e5cd65c5e7e66d3715fb4e8f0491598590fa158c761b7c262ab70074b6 | Python | 1,947 | 28 | """Aerial still per map: mapshots.py OUTDIR MAP[:x,y,z,yaw,pitch] ... (Cinematic, sunny afternoon, 1920x1080)."""
import sys, os, queue, time, math, carla
out = sys.argv[1]; os.makedirs(out, exist_ok=True)
c = carla.Client('localhost', 2000); c.set_timeout(600)
for arg in sys.argv[2:]:
name, _, pose = arg.partitio... |
c7118eab7504ef08bb42b2d093137159a667f96251796bcb4ce0d8f775bd2df6 | Python | 1,949 | 48 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
import pymaid
from contools import Celltype, Celltype_Analyzer, Analyze_Cluster
rm = pymaid.CatmaidInstance(url, token, name, password)
# allows text to be editable in ... |
2e31e7a1fe36c1ff9786890b95a8eee5f86963615f03afc40c985188ce3c1b61 | Python | 1,950 | 43 | ###################################################################
####
#### Version: 1.1.7
#### Date: 6/24/2023
#### Description: This file contains global variables used throughout the application.
#### Author: Evan Cobb
####
###################################################################
from PyQt5.QtGui impo... |
a0e634537fabbf299b8793446439caee7202cb79f56338d7145fcdb851f290f7 | Python | 1,950 | 49 | import glob
import re
from multiprocessing import Pool
import argparse
parser = argparse.ArgumentParser(description='Merge matrices by columns (no check is done on rownames, so rows have to be in same order!).')
parser.add_argument('-o','--outfile_prefix', help='Prefix that will be added to the output file name', requ... |
3fd95c3790ad9de0cb94722610f14ceb147e28b04daba09465eb3aabe503dd29 | Python | 1,952 | 61 | import math
import torch
from .core import Distribution
class Normal(Distribution):
logvar_min = -16
logvar_max = 16
def __init__(self, mean, logvar):
super().__init__()
self.mean = mean
self.logvar = torch.clamp(logvar, self.logvar_min, self.logvar_max)
def sample(self, t... |
0517affd5d6626b41226ce74a4231c5b137205c7020a222c7cdc46f98e61538f | Python | 1,953 | 51 | # 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... |
85803c45557ded22c920efa6bab268a183d0f24c38d6f196933a6d9f736587f7 | Python | 1,953 | 52 | import ddmr.utils.constants as C
import re
import os
class ConfigurationFile:
def __init__(self,
file_path: str):
self.__file = file_path
self.__load_configuration()
def __load_configuration(self):
fd = open(self.__file, 'r')
file_lines = fd.readlines()
... |
5ac7ae77ed2e94197e8b994b7ccc9780dd1342b6cd759b886bd1c600cab14421 | Python | 1,954 | 88 | from ..data import load_network_palette
from .utils import bound_texts, multicolor_text
def draw_hypothesis_box(
model,
x,
y,
yskip=0.15,
ax=None,
xpad=0.03,
ypad=0.01,
fontsize="large",
subscript=False,
title=False,
):
network_palette, _ = load_network_palette()
if m... |
d6fd5e59dff22c8a3a52c59082b9e8d6dac6ecf30eae60de74b0ad0dcfc48255 | Python | 1,954 | 65 | #!/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>.
"""Visualize the catalog of vehicles present in CARLA"""
import carla
impor... |
0189bf59325f42ee50c0a0b111aa7a9f365cba3e5c36824783ec3a893e3f4e19 | Python | 1,955 | 79 | from abc import ABC
from typing import Any, Iterator, List, Tuple
import rdflib
from rdflib import URIRef
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.types import CURIE, PRED_CURIE
TRIPLE = Tuple[CURIE, PRED_CURIE, Any]
RDF_TRIPLE = Tuple[URIRef, URIRef, Any]
class Rdf... |
39ed3fc56bc69f09a57d18d6f9aa64f3a322798db028ab175caf4455d8083eb2 | Python | 1,955 | 51 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
7c26c37ec0ff2941f33e3631e17452ff3127e87e2e88b59c0a3312e79ca91cb9 | Python | 1,955 | 73 | # Header variables and parameters.
import os
import numpy as np
from IPython.core.debugger import set_trace
import importlib
import sys
from default_config.masif_opts import masif_opts
"""
masif_site_train.py: Entry function to train MaSIF-site.
Pablo Gainza - LPDI STI EPFL 2019
This file is part of MaSIF.
Released un... |
933e5b2dbeda8cbbcb36e8aea1787ea127422bc3a3666ad93ee4bac2e9d90f02 | Python | 1,958 | 55 | try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
import sys, platform
sys.path.append('python')
extra_compile_args = ['-DHAVE_KALLOC']
include_dirs = ["."]
if platform.machine() in ["aarch64", "arm64"]:
include_dirs.appen... |
fc4369063df3b4f0a4a91553efa303acc9d153dc7cbc974e82d6177c2688e9e8 | Python | 1,959 | 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... |
fcda3dfab2872ee0ce6fa2dcd6638620a71063de44386102d83e46ac8523ad89 | Python | 1,960 | 67 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from PIL import Image
from typing import Any, Callable, Optional, Tuple
import numpy as np
import os
import os.path
import ... |
9f672fd87bae49d510187818abe2432e979374ad3ff3d97d41ccb297e058b741 | Python | 1,961 | 51 | import pandas as pd
import numpy as np
import functions_basic_sak as funsak
import inspect
import os
import pathlib
import import_AIS
import AIS_parameters
from tqdm import tqdm
import AIS_downsample
pd.set_option('display.max_columns', 20, 'display.width', 1500)
fname = os.path.split( inspect.getfile(insp... |
27bc1a36d357e28cb1fe012f3ef569cca8b708e70915e7fb201a5bdd6dc59ba1 | Python | 1,962 | 43 | import argparse
import glob
from pathlib import Path
import shutil
current_file_path = Path(__file__).resolve()
parser = argparse.ArgumentParser(description="Run this set up script to configure the project.")
parser.add_argument("--brains_path", "-b", type=str, default=None, help="Path to the BRAINSTools build direc... |
59ec8c203144c90ccd25f1636d2a5e3d8b2433d3e0bb70bee58be880a4c4b765 | Python | 1,962 | 54 | import torch
import networkx as nx
from torch_geometric.data import Data
from torch_geometric.utils import degree
from torch_geometric.utils.convert import to_networkx
from torch_geometric.utils.num_nodes import maybe_num_nodes
def make_network_stats_feature(edge_index: torch.Tensor, include: list = ['degree'],
... |
9d59d70714086c95b1745b5b31d62d08ef9a11da2adc1f2c22ab122c31c498cc | Python | 1,962 | 69 | # -*- coding: utf-8 -*-
"""
Created on Fri May 14 23:06:21 2021
@author: Sleepymouse
"""
import glob
import numpy as np
import pandas as pd
from scipy.stats import chi2
import sympy
import csv
import matplotlib.pyplot as plt
import sys
#wheel managerから排出されたファイルは.csv形式(名前は.xls)なので、.xlsに変換sにて保存しなおしてから使... |
2c1b8c29fe10d7618c7f810f18e7918a2511ce485f314893b8df5ce2b3de50bd | Python | 1,963 | 62 | #!/usr/bin/env python
# Copyright 2014 Gaurav Kumar. Apache 2.0
# Extracts one best output for a set of files
# The list of files in the conversations for which 1 best output has to be extracted
# words.txt
import os
import sys
scoringFile = "exp/sgmm2x_6a_mmi_b0.2/decode_test_it4/scoring/10.tra"
wordsFile = open... |
6cd8939af8db7b434d403576f5ee5da9ab6658ca2ffbb14a75ca5297e373ca22 | Python | 1,964 | 58 | import math
import torch
from .sampler import Sampler
from torch.distributed import get_world_size, get_rank
class DistributedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`... |
f17a8c265ec70698bab8c540ed02d7a0e26612cea961bcf3925e99877863a49a | Python | 1,964 | 67 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import print_function
from PIL import Image
from typing import Any, Callable, Optional, Tuple
import numpy ... |
14f37d76a3cc056346365ead968b920e6772c3e9f707aeaaf79194db3f0bb41e | Python | 1,965 | 69 | import torch
import random
import numpy as np
from torch.utils.data._utils.collate import default_collate
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataset import Dataset
class IdxDataset(Dataset):
def __init__(self, dataset):
self.dataset = dataset
def __len__(self):
... |
42e10eb59094ee1b8a083fafec159651481b19c581d40eec1d39114315320cd9 | Python | 1,966 | 32 | # This header file imports open3d with the correct version to support version 0.5.0 and 0.9.0
import open3d as o3d
from packaging import version
if version.parse('0.6.0') < version.parse(o3d.__version__):
PointCloud = o3d.geometry.PointCloud
Vector3dVector = o3d.utility.Vector3dVector
Feature = o3d.registra... |
5ffce83b432f3de2f55e448c46dfbcefe07b40c8b8a1d53aaace5f55ace87e24 | Python | 1,966 | 82 | # -*- coding: utf-8 -*-
"""
@author: satohara
"""
import sys
sys.path.append('../')
import numpy as np
import matplotlib.pyplot as plt
from EnumerateLinearModel import EnumLasso
# setting - data
dim = 10
L = 5
num = 100
eps = 0.1
alpha = 0.01
# setting - EnumLasso
rho = np.logspace(-4, 0, 11)
ratio = 3
maxitr = 100... |
8cb1d26cb26092a330d4ec2a4ae24de1bde83aef885ad0730ade7c99a777590c | Python | 1,966 | 49 | from hyperopt import fmin, hp, tpe, Trials, rand
import torch.nn as nn
from train_graph import evaluate
import numpy as np
SEARCH_SPACE = {
'hidden_dim': hp.choice('hidden_dim', [16, 32, 64, 96]),
'hidden_layers': hp.choice('hidden_layers', [1, 2, 3, 4, 5]),
'num_heads': hp.choice('num_heads', [4,... |
01420268a3cdd9caf2a5679d87275cb0e2938503afb8e30ba20d1a4fdabb7415 | Python | 1,967 | 60 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module containing useful functions for computing metrics with PyTorch.
Created on Tue Nov 27 13:57:06 2018
@author: nicolas
"""
import torch
from axoid.utils.metrics import dice_coef, crop_metric
def get_dice_metric(reduction='mean'):
"""
Return a metri... |
bd1be8b7baaa4988e0879deac037854587cc17572875e1c553ebcc7fc1347ed8 | Python | 1,968 | 61 | # Pablo Gainza 2019 - Assign the raw data from Intpred's webserver to each PDB's b factor column.
# Also, verify the data.
import numpy
from Bio.PDB import *
from IPython.core.debugger import set_trace
def parse_intpred_raw(pdbid, filename):
ipfile = open(filename)
lines = ipfile.readlines()
line_ix =... |
e21d002db37a6b5f4663fb69f5561a2dd2d1161c2dcf578be9b872bad52bd0c7 | Python | 1,968 | 54 | import argparse
import os
import re
import sys
import pandas as pd
parser = argparse.ArgumentParser(description="Process datasets from Boix et al.")
parser.add_argument(
"input", type=str, help="input directory path. Should contain bigWig files"
)
parser.add_argument("metadata", type=str, help="Path to metadata t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.