sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4e026519b31b1b61a0033a5b05b80da191d882bff30bee973c6ba6d7e6f6596b | Python | 2,409 | 85 | # 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 a... |
f34ae61ccfb04d793e12b48853d6b2141647ee2e83b928c37248a6949ab5aa02 | Python | 2,410 | 73 | import torch.nn as nn
from M2TR.models.modules.conv_block import Deconv
class Classifier2D(nn.Module):
def __init__(
self,
dim_in,
num_classes,
dropout_rate=0.0,
act_func="softmax",
):
"""
Perform linear projection and activation as head for tranformers... |
b4670d334e57b8d09d40daef228e889dc68027b15b288d2090a697cf7339aabb | Python | 2,411 | 101 | 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... |
17db7e2c0868961d2110990f100584eca1c0b2c82310496e7d04b61492bafcae | Python | 2,412 | 75 | import pickle
import numpy as np
from charpragcap.rsa.cataRSA import CataRSA
from charpragcap.rsa.cataRSA_working_beam import CataRSA as CataRSA_working_beam
from charpragcap.utils.config import *
from charpragcap.utils.image_and_text_utils import char_to_index,vectorize_caption,get_rep_from_img_id,split_dataset
from c... |
2b85300452392dfaf0c608c8bd05fff3567c90ad1a70712ac92ddd3bcfc7b719 | Python | 2,412 | 73 | import math
import torch
from torch.nn import Linear, LayerNorm
from torch.nn import Parameter
from torch.nn import init
class MultipleInputsLayernormLinear(torch.nn.Module):
"""
Properly applies layernorm to a list of inputs, allowing for separate rescaling of potentially unnormalized components.
This ... |
368a07430f2f6822bd59be25e454b595b1bb0964767225e513ae4993e5f1f861 | Python | 2,412 | 61 | import torch
import torch.nn as nn
import torch.nn.functional as F
def flatten(input):
return input.view(input.size(0), -1)
class discriminative_network(nn.Module):
def __init__(self):
super(discriminative_network, self).__init__()
# conv > relu > conv > BN > relu > conv > BN > relu > conv > B... |
e8aca5367d1651bacc6dc01b4fbf45caf47d673a9cb6ad3bc1e164400d6c3c26 | Python | 2,412 | 54 | # 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... |
bdb2f900248e08f935dabc9cd2dc53afbb54c92f6955046873c8234a3888bf82 | Python | 2,413 | 86 | '''
Figure 6
Activation and time constant curve of IKir
'''
import pandas as pd
from pylab import *
#from statsmodels.graphics.functional import fboxplot
import matplotlib.pyplot as plt
from file_management import *
from os.path import join
width, height = 2, 3
table = pd.read_csv(join(config['root'], 'Deciliated', '... |
6e99ce979acc1e1e93d525578ab2f2cc5de29628249d74aef7318e0e5e7d640f | Python | 2,414 | 69 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import torch
from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask
class TestSegmentationMask(unittest.TestCase):
def __init__(self, method_name='runTest'):
super(TestSegmentationMask, self).__in... |
d90c37543537c7c7dc205d4cfddd193edc0794f279ecffb501336d89bab488b7 | Python | 2,415 | 76 | import torch
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from graphxai.datasets import ShapeGGen, load_ShapeGGen(
from test_homophily import homophily_test
my_data_root = '/Users/owenqueen/Desktop/HMS_research/graphxai_project/GraphXAI/data/ShapeGGen/new_unzipped'
if __name__ == '__main_... |
7d3ed69e6dd3f19fb9c3a7628562128fc5c3aeac30566cbec23e2336ae4c4604 | Python | 2,417 | 74 | import os
from drugex import VERSION
from drugex.logs import logger
def getVocPaths(data_path, voc_files, mol_type):
"""
Get paths to vocabulary files. If none are found, use internal defaults.
Parameters
----------
data_path : str
Path to data directory.
voc_files : list
... |
8431ec00f5ef381f55c9b1e12b2956f581c7442a1385e9205915f20c1c88975a | Python | 2,417 | 79 | import sys
import numpy as np
import torch
from torch_geometric.datasets import TUDataset
from torch_geometric.data import DataLoader, Data
from torch_geometric.nn import global_mean_pool, GCNConv
import torch.nn.functional as F
#from explainers.guidedbp import GuidedBP
from graphxai.gnn_models.graph_classification i... |
b7d43bd0b520dcc614f52f5d9459ffdc80989cefd02cd9eeb978d53f4c7cac82 | Python | 2,418 | 34 | #!/usr/bin/env python3
"""Image checks for Docs/: broken image refs, images without a caption, files nothing references.
python3 check_images.py [--root CARLA_ROOT] [--no-unreferenced]
A caption is the line `<div class="img-caption">...</div>` right under the image.
Generated pages (python_api, bp_library, catalo... |
704f775cdbf6d07c1da2ac302c61d55fe77fedbea47fe505c61a0ac36c003510 | Python | 2,420 | 94 | # This script is part of navis (http://www.github.com/schlegelp/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# 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... |
d973e1029d6dc3d70303b111b4c2007caa8219d861569da45194177cb2e61161 | Python | 2,422 | 50 | """Unreal Python commandlet regression for rain blendable lifecycle.
Run: UnrealEditor-Cmd <project> -run=pythonscript -script=<this file>
-nullrhi -unattended -nosound
"""
import unreal
def main():
actors = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
weather_class = unreal.EditorAssetLibra... |
b3126fcbc291395e782f292896ee2188e96c50e68bff939746881be5041ece0d | Python | 2,423 | 65 | # 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... |
a49d837f01530227976b2c2744ca5c1e2633e0d4f9fac9a44962b4c10726d85c | Python | 2,424 | 76 | import click
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler, RobustScaler
MAD_SCORE = 0
REPEATED = False
total_sample_count = 0
def modified_zscore(data, file, MAD, consistency_correction=1.4826):
median = np.median(data)
dev_from_med = np.array(data) - me... |
a8e9957ebbe2896a63af22edf0e3ba7720442a22a0d7af2c201409cfbd56c5ff | Python | 2,425 | 85 | 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
from graspy.utils import binarize, symmetrize
from src... |
c218f3b4e8bbce278a0accd7b721f7d3c9d16c882c9e98b9db290efb7b7c1c62 | Python | 2,426 | 81 | import matplotlib as mpl
import seaborn as sns
preset_themes = {}
preset_themes["light_edge"] = {
"axes.spines.right": False,
"axes.spines.top": False,
"axes.spines.left": True,
"axes.spines.bottom": True,
"axes.edgecolor": "lightgrey",
"ytick.color": "grey",
"xtick.color": "grey",
"ax... |
1004d690ff1bed4ab7f9f5f14e7816f9e6cde5b57091cce6688b47e5dbfeb99e | Python | 2,427 | 84 | 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
from graspy.utils import binarize, symmetrize
from src... |
9f0591a77be1ab2d89f5b8b3b7e059bb749087e80828ae9c613c142fa99f608c | Python | 2,427 | 102 | 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... |
ffb657e254ecc069f107d9372b330f89a3bb22f97cc4c22f8686d6546c1928c1 | Python | 2,427 | 86 | """cxsystem2 -- a cortex simulation software
Usage:
cxsystem2 (-h | --help)
cxsystem2 -a ANATOMY_FILE -p PHYSIOLOGY_FILE
cxsystem2 (-v | --version)
A cortex simulation framework called `CxSystem`.
Arguments:
PORT port number on which the BUI server runs
Options:
... |
f1e3a1b0d80a45fe14b7e9044ad43c981df018af8aa218a49bd9f809d38cecf6 | Python | 2,428 | 75 | #!/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
def findTranscription(timeDetail):
file1 = open('exp/tri5a/decode_callhome_dev/scori... |
b31e90d5fbdb40bbc2a29ec1b6941dee79ade0226f7db1b3049f44bd36663d6e | Python | 2,429 | 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... |
78ce7bf2087003bb253738767cc3df32fbda0bd6c08bfed11212ab50122ddc18 | Python | 2,430 | 64 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import partial
import tensorflow as tf
def tensors_filter(tensors,
includes='',
includes_combine_type='or',
excludes=[],
... |
869eb4b20dadcb74e76e4988ea78be78afe6b4476deb305bee5290c5698776b4 | Python | 2,430 | 116 | # %% [markdown]
# #
from src.pymaid import start_instance
from src.data import load_metagraph
import pymaid
from src.io import savecsv, savefig, saveskels
import os
FNAME = os.path.basename(__file__)[:-3]
print(FNAME)
def stashfig(name, **kws):
savefig(name, foldername=FNAME, save_on=True, **kws)
VERSION = "2... |
15b4e75c244a3ab9b0cf7ede967c26ddf53daaf640633e5863fddfa79e632fb6 | Python | 2,431 | 70 | import json
import sys
import numpy as np
import n5_metadata_utils as n5mu
from os.path import abspath
from os import makedirs
def write_coords_file(path, offset, extent, index):
with open(path, 'w') as f:
print(*offset, file=f)
print(*extent, file=f)
print(*index, file=f)
if __name__ ==... |
179599240d02025ed9b4ad1ed8179d7f66138bed19a988009a3e8eec022a0883 | Python | 2,432 | 72 | import numpy as np
import cupy
import matplotlib.pyplot as plt
import imageio
from pathlib import Path
import cupyx.scipy.ndimage
import scipy.ndimage
import skimage.measure
import skimage.morphology
from voltools import transform
from tqdm import tqdm
import time
from flexsim import utils
class ObjectCreator(object)... |
a8d13b09060b6626440041f569d4c45218ef648e7c7565d2799d025ba85e2d1e | Python | 2,432 | 68 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from contools import Celltype, Celltype_Analyzer, Promat, Prograph
from pymaid_creds import url, name, password, token
from data_settings import data_date, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token,... |
89b6e95f2b7e83627536b70cf2df42048bc7b28a0e6b7c8a61231c4b621a1b63 | Python | 2,434 | 79 | #!/usr/bin/env python
import os
import matplotlib.image as mpimg
import cv2
import numpy as np
import torch
N_IMAGES = 202599
IMG_SIZE = 256
IMG_PATH = 'images_%i_%i.pth' % (IMG_SIZE, IMG_SIZE)
ATTR_PATH = 'attributes.pth'
def preprocess_images():
if os.path.isfile(IMG_PATH):
print("%s exists, nothing ... |
d318623f6ec81f6ce9ce9be499c6520b00e332bc7d33c4fe4999a9e79d7e4df0 | Python | 2,434 | 71 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
3bf2e31e6b9785f5f5d94355eaf502187f24c68f8c8f221603125b14f29c82a6 | Python | 2,435 | 52 | # 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... |
3686f575b47193044f39926850bec0db4839a8ad833b70e13a9a07bec188a21d | Python | 2,436 | 73 | # Copyright 2021 Google Research. All Rights Reserved.
#
# 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... |
841dcb700ab04414e2080985cf24bc99be4885e267ae7e50a28384b757682f2f | Python | 2,436 | 56 | import os
import argparse
import torch
from bunch import Bunch
from ruamel.yaml import safe_load
from torch.utils.data import DataLoader
import models
from dataset import vessel_dataset
from tester import Tester
from utils import losses
from utils.helpers import get_instance
def main(data_path, weight_path, dataset, ... |
9e541026964496d0f67b4a11c8f92a22fc07f363027e0f24c132596210a0d317 | Python | 2,436 | 91 | from cgtasknet.tasks.reduce import (
RomoTask,
RomoTaskParameters,
RomoTaskRandomMod,
RomoTaskRandomModParameters,
)
def test_romo_task_size():
assert RomoTask().feature_and_act_size == (2, 3)
def test_romo_task_run_one_data_set():
RomoTask().one_dataset()
def test_romo_task_run_some_datas... |
cdce7085448803c11e475c2fb2f996cfaf5434e6ca68c0870e55393a216a2068 | Python | 2,436 | 66 | import numpy as np
from mip.mip_nn import MIP_NN
from globals import EPSILON, BIN
class MIN_W(MIP_NN):
def __init__(self, data, architecture, bound, reg, fair):
MIP_NN.__init__(self, data, architecture, bound, reg, fair)
self.add_abs_params()
self.add_output_constraints()
self.calc_objective()
s... |
d77afaa7660d1ad20e5cfda624ac082828f7371d70d3761eba24eba6c1581c29 | Python | 2,436 | 61 | # 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... |
8b18494103af1e8860c1872ca5a1fdaaf787344a9eb0dae902e8e7534ce6e1a1 | Python | 2,437 | 93 | import json
import logging
from pathlib import Path
from typing import List
import numpy as np
import pandas as pd
import tifffile as tif
from cenfind.core.structures import Centriole, Nucleus
logger = logging.getLogger(__name__)
def save_assigned(dst: Path, assigned: np.ndarray) -> None:
"""
Saves the assi... |
114aa0a5171a3483a86e3e309683f90f89afe33bfbc5af18c06ccc9e97b95d7b | Python | 2,438 | 69 | import datetime
import gzip
import glob
import argparse
import datetime
from multiprocessing import Pool
parser = argparse.ArgumentParser(description='Merge multiple FeatureCount matrices')
parser.add_argument('input_dir')
parser.add_argument('output_dir')
args = parser.parse_args()
def merge_files(type):
print... |
11c92a01cba29578c0c9277ea41da3c64af078fb9f6c2d77fd3af28e77a4f8d5 | Python | 2,439 | 84 | 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
from graspy.utils import binarize, symmetrize
from src... |
d49d0806525cd940839b016fd7a09dc30838e9f1b2068302ab00d7c7f85680e2 | Python | 2,439 | 67 | import os
import ipdb
import glob
import numpy as np
import pandas as pd
import seaborn as sea
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 27})
plt.rc('font', family='sans-serif')
plt.rcParams["axes.grid"] = False
plt.rc('font', family='sans-serif')
def set_box_color(bp, color):
plt.setp(bp... |
42800d63526e63f3e17e6e6f3355a943b68ee9e5d258a0184bc03d2c60df26dd | Python | 2,440 | 100 | # ty: ignore[unresolved-attribute]
"""Collection of common cheminfo tasks"""
import rdkit.Chem as Chem # type: ignore[import-untyped]
import rdkit.Chem.AllChem as AllChem # type: ignore[import-untyped]
import rdkit.Chem.rdMolDescriptors as rdMolDescriptors # type: ignore[import-untyped]
from rdkit.Chem import rdDis... |
b94ae147ecb3a1a169ec2ee955f09f7fdce7500caa7d4ae752d7346e5324ebd8 | Python | 2,440 | 65 | from dataclasses import dataclass
from typing import Union, Any
from linkml_runtime.utils.yamlutils import YAMLRoot
from oaklib import BasicOntologyInterface
from oaklib.datamodels.vocabulary import IS_A, SYNONYM_PRED_TO_SCOPE_MAP
from oaklib.interfaces.metadata_interface import MetadataInterface
from oaklib.interface... |
db06637722d7a8a89e9fe346f3de00dfaf8ddb90d740deabb2faf0131544eda4 | Python | 2,440 | 69 | import numpy as np
from scripting.spectrum.io.annotations import pinnacle
def from_csv(path, span, fs, value, *annotations, reader=pinnacle, **kwargs):
"""Creates a boolean masking array from an annotation in a csv at path.
If annotations at path do not contain annotation the returned mask is
~value at al... |
7e620521326c1f6810f4e26d8914408ecc83180cc75741195c60c0caddde6c0e | Python | 2,441 | 84 | import numpy as np
import cv2
def align_with_five_points(src_points, size=224):
REFERENCE_FACIAL_POINTS = [
[30.29459953, 51.69630051],
[65.53179932, 51.50139999],
[48.02519989, 71.73660278],
[33.54930115, 92.3655014],
[62.72990036, 92.20410156]
]
REFERENCE_FA... |
fdcbaaa0e5ceafbb6add60b804396fb9b5f2922f251f5d8ab2a128da723c68f6 | Python | 2,442 | 44 | import sys
sys.path.insert(0, '.')
from svgkit import Svg, C, render_png
W, H = 1260, 470
s = Svg(W, H)
s.text(W / 2, 44, "How CARLA content changes reach users", size=26, weight="bold", anchor="middle")
s.text(W / 2, 72, "carla-content (Bitbucket, Git LFS), branch ue58-dev-carla next to the code branch ue58-dev",
... |
1217dc241a2d12d2cc2c982a3565ecd9661d00346731cf4ab16016f9be9a3b56 | Python | 2,443 | 58 | import numpy as np
import pandas as pd
from scipy import stats
DATASETS = {'herff_2014_nb': ['1-back', '2-back', '3-back'],
'shin_2018_nb': ['0-back', '2-back', '3-back']}
CONFIDENCE = 0.05 # stat confidence at 95 %
new_results = '../new_results.csv'
old_results = '../old_results.csv'
models = ['LDA', ... |
b953794a5d106f6f7ed51d408dabe1adf411f039cbf38632c4ac4a173fbd12e9 | Python | 2,443 | 76 | """
Title
-----
NMDA synapses
Description
-----------
NMDA receptors, like AMPA receptors, are ionotropic glutamate receptors. They
are responsible for excitatory synaptic transmission and have slower kinetics
than AMPA receptors. NMDA receptors are voltage-dependent and require the
postsynaptic membrane to be depolar... |
00453dd21bf016bdea59367a8af7ebc297f25fd788cc3d820be3c7887fa17e6e | Python | 2,444 | 69 | # Copyright 2020 Google Research. All Rights Reserved.
#
# 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... |
0ee369e330ae58041c7ad16e5896c8328d91e07385b9c221e7db3a1d166093a0 | Python | 2,444 | 70 | from datetime import datetime
import wget
from time import strftime
import os
from pathlib import Path
import gzip
import argparse
parser = argparse.ArgumentParser(description='Make REACTOME matrix.')
parser.add_argument('ordered_gene_list',
help='List with ordered gene IDs')
args = parser.parse_ar... |
abb5dc21bb8cec223d1c398ec12af48ee832113df151d74a0d3909740b5ebe2f | Python | 2,444 | 84 | import logging
import sys
import warnings
from dataclasses import asdict
import chika
from imblearn.metrics import geometric_mean_score
from spikebench import load_allen, load_fcx1, load_temporal, load_retina
from spikebench.helpers import set_random_seed, simple_undersampling
from sklearn.ensemble import RandomForest... |
bb1bf103eeeba96310c924de4e30f7575cce3ddbe5c00a409c0f3c92026facd0 | Python | 2,444 | 57 | #!/usr/bin/env python
# Copyright 2014 Johns Hopkins University (Authors: Vijayaditya Peddinti). Apache 2.0.
# script to read rir files from air database
import sys, numpy as np, argparse, scipy.signal as signal, os.path, glob, scipy.io, scipy.io.wavfile
def read_raw(input_filename, precision = np.float32):
# ass... |
1004687da03249b089978c98197abb293dd0622372ab4a063a21d0ccf5602033 | Python | 2,445 | 104 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import seaborn as sns
from joblib import Parallel, delayed
from scipy.optimize import curve_fit
from graspy.match import GraphMatch
from graspy.plot import heatmap
fr... |
584970f7d40b20a38ea9ccaab44e8085cb63ff58d11c20028d5994ae677879c1 | Python | 2,445 | 95 | #!/usr/bin/env python
# Copyright 2020 Johns Hopkins University (Author: Bar Ben-Yair)
# Apache 2.0
# Works with both python2 and python3
# This script assumes that WPE (nara_wpe) is installed locally using miniconda.
# ../../../tools/extras/install_miniconda.sh and ../../../tools/extras/install_wpe.sh
# needs to be ru... |
4e3e5c71e2169ec1e612a2b797bfb539fdf9cd3f39bb44e6bf4ced613d879ae5 | Python | 2,446 | 74 | import json
import sys
from dataclasses import dataclass
from typing import Dict, Union
from ndex2 import NiceCXNetwork
from oaklib.converters.data_model_converter import DataModelConverter
from oaklib.datamodels.obograph import Graph, GraphDocument
from oaklib.types import CURIE
@dataclass
class OboGraphToCXConver... |
6550127b11381bde125bf38ea554a6558a946b8e0c39ffc96e7d1d8b17336fac | Python | 2,446 | 71 |
import sys
import numpy as np
import scipy.stats as stats
import nibabel as nib
dict_subcort = {
"Left-Cerebellum": "Left-Cerebellum-Cortex", "Right-Cerebellum": "Right-Cerebellum-Cortex",
"Left-Thalamus": "Left-Thalamus-Proper", "Right-Thalamus": "Right-Thalamus-Proper",
"Left-Accumbens": "Left-Accumbe... |
66c50d29ec8d25272e7c846fefecaa44d6ab054649bcd9547342c95c39a8c769 | Python | 2,447 | 73 | # 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 a... |
ae1839051a8e0a5a7e0c0ee613c180ec838462254fd680cbaf0b564a66841720 | Python | 2,447 | 69 | import torch
import torch.nn as nn
from monai.networks.blocks import ResidualUnit
from collections import OrderedDict
# simple 5-layer 3D CNN with skip connection
class Resnet3D(nn.Module):
'''
Layer 1: conv
Layer 2,3: 1 residual block
Layer 4,5: 1 residual block
Layer 6: fc layer
Args:
... |
efad2f62d04494b98c65963e5ce6b5a42f708006db01872c856dd145a7a6b282 | Python | 2,447 | 78 | import os
import numpy as np
from PIL import Image
import streamlit as st
import torch
import clip
from utils.inverter import StyleGANInverter
from utils.visualizer import resize_image
st.title("Text-Guided Editing of Images")
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
mode = st.selectbox('M... |
1f4e5ccaeb954136ffcc775e0b7c8a2cf6f78948953fda433462d9fde04cebc8 | Python | 2,448 | 55 | import re
import torch
import logging
from tools.utils import load_checkpoint
def remap_for_paramadapt(load_path, model_dict, seed_num_layers=[]):
seed_dict = load_checkpoint(load_path, map_location='cpu')
logging.info('Remapping for parameter adaptation starts!')
# remapping on the depth level
depth... |
7470f1942693288fa80bc7794cffcd6c209b9e2e2f7a9f9f127051470b769216 | Python | 2,448 | 69 | #!/usr/bin/env python3
"""
File: visualiser.py
Created: 2020/03/13
Last Changed: 2020/06/05
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... |
2f4ac04b66aa23ccc260f48b45da00c46312738be968b29502b426871d15b02c | Python | 2,449 | 62 | # 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... |
efce95e73e7f53a5860e6c46362e468eb3f36bc81a55262e88289ca1cb706be7 | Python | 2,450 | 79 | # 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... |
3e54aeb0551fd7777bb8d7810abde4cabaf5d0d27f3b052cc81bf3fe87991a89 | Python | 2,451 | 86 | """Nottingham MEGUK: Source reconstruction."""
from glob import glob
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
from osl_dynamics.meeg import parallel, parcellation, rhino, source_recon, Session
# ----------------------------------------------------------------------------
rawdir = Path("data/... |
0468ab4cacf3fa6e2ab1d5391728cae9da3a9737555c0955ee8110d239a6a0c2 | Python | 2,453 | 81 | # 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... |
314c3f41f086e24f1dfbd5257a986053e7291454fe1a73b0b36769367a6564e3 | Python | 2,453 | 74 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
3ce8e4c5fedc6e88743c5ae83d53615e743a9fc99738c8d9cc9fc10e71cb473b | Python | 2,453 | 68 | import os
import ipdb
import glob
import numpy as np
import pandas as pd
import seaborn as sea
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 27})
plt.rc('font', family='sans-serif')
plt.rcParams["axes.grid"] = False
plt.rc('font', family='sans-serif')
def set_box_color(bp, color):
plt.setp(bp... |
8ed827139d83f4a9f5a4e93228b5711a153f5809042f8dc9f1754385bbdd8a72 | Python | 2,453 | 63 | #!/usr/bin/env python3
# Copyright 2020 Yuri Khokhlov, Ivan Medennikov (STC-innovations Ltd)
# Apache 2.0.
"""This script transforms phone-indices in alignment to 0(silence phones), 1(speech phones), 2(spn phones)"""
import os
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.Arg... |
63d3d9a174e9e256eb643232fa0fe093af3003b3b5fca3b61e17ff71c32fb4c5 | Python | 2,455 | 74 | import argparse
from tqdm import tqdm
import descarteslabs as dl
from descarteslabs.catalog import Image, properties
from scripts import candidate_detect
DL_SYSTEM_PARAMS = {
'image': ('us.gcr.io/dl-ci-cd/images/tasks/public/' +
'py3.8:v2020.09.22-5-ga6b4e5fa'),
'cpus': 1,
'maximum_concurr... |
c30e8cf35868cb045a6caacc7d20b922f6cbb1e22ec3b999b3d76a21c947dafa | Python | 2,455 | 63 | ####################################################################################################
# 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 ... |
3aedf2a89cd351bbac9bdacaf7aef61fee4067ab4380a482c6f009ae50e2ca8c | Python | 2,456 | 61 | import tqdm
import ipdb
import os, argparse, sys
import random as rand
import torch
import sys; sys.path.append('/home/owq978/GraphXAI/formal')
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.pe... |
c8ed3811968021e9f540c77e0f67e6b0c2676192cab96194631a4b2e162b373d | Python | 2,458 | 97 | #%%
import os
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from umap import UMAP
from src.io import savefig
FNAME = os.path.basename(__file__)[:-3]
print(FNAME)
def stashfig(name, **kws):
savefig(name, foldername=FNAME, save_on=True, **kw... |
24e3271c5a27eb03b32b3a966b1480ccd06cbcd28ba9aba21b2b19004af1f871 | Python | 2,459 | 76 | import nltk
import pickle
import argparse
from collections import Counter
from pycocotools.coco import COCO
class Vocabulary(object):
"""Simple vocabulary wrapper."""
def __init__(self):
self.word2idx = {}
self.idx2word = {}
self.idx = 0
def add_word(self, word):
if not wo... |
7e907b2f23750f6d29110d152abb8c2f322ac4d02888db23bfe3786d57948c6d | Python | 2,459 | 71 | 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.01
atom_fea_len = 64
n_conv = 3
h_fea_len = 128
n_h = 1
descriptor = Voronoi(max_num_nbr=12,
... |
eb0c3af0b48ad456e5c580d5c6168ac5c856cda040262296e3b32b96e7e5fb1e | Python | 2,459 | 71 | 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.01
atom_fea_len = 64
n_conv = 3
h_fea_len = 128
n_h = 1
descriptor = Voronoi(max_num_nbr=12,
... |
0834e13ae74a291be223d9ddcd50602326de810c6800aafed98bff74dc9a9210 | Python | 2,461 | 54 | """
Report results of bootstrap hypothesis testing that cooling impairs vowel discrimiantion
Motivation:
------------
Bootstrap data contains the number of correct trials for each stimulus condition (noise|clean) and treatment condition (e.g. cooled|control).
We want to know if cooling signficantly impairs performan... |
215cafbcd6db8c16d0311aea648446bfc3a8ebb73114a848d86db21124694d0e | Python | 2,462 | 88 | """Euclidean layers."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
def get_dim_act(args):
"""
Helper function to get dimension and activation at every layer.
:param args:
:return:
... |
c1f99419511ac1846c619678abaa2561829223cd53ccb93ca5371b272377ced8 | Python | 2,462 | 65 | # MIT License
# Copyright (c) 2020 Khaled Zaouk
# 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, p... |
ef47cc63a5315d92f44dacd6fd1474e49a1656ad312c6cd9965a993715675f9a | Python | 2,462 | 71 | from ..utils import ext_loader
ext_module = ext_loader.load_ext('_ext', ['bbox_overlaps'])
def bbox_overlaps(bboxes1, bboxes2, mode='iou', aligned=False, offset=0):
"""Calculate overlap between two set of bboxes.
If ``aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxe... |
f843e3d3a7f557daa2bdbb3d959a04b50b97201fbd1faad550144aafdfd8f02d | Python | 2,462 | 81 | import argparse
from pathlib import Path
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from dataloading.ouster import OusterNormalize, OusterCrop, OusterDataset
from metrics.metrics import calculate_open_loop_metrics
from pilotnet import PilotNet
from trainer import PilotNetT... |
4876780496b5fd5190277fb3e3b4477469dfc97dacb7f798d779337de3e48d8b | Python | 2,463 | 59 | # Copyright 2021-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... |
18f0e5261bd51395ca8e7599769cbabe1d7adc722b0a0d7b2b90800633f143ac | Python | 2,464 | 41 | """
This file contains a function that can be called to perform ship pairing in a Spark cluster within AWS EMR.
"""
import pandas as pd
from dark_ships.AIS_processing.spark_basic_functions import extract_koalas_df_from_s3, extract_pandas_df_from_s3
from dark_ships.AIS_processing.spark_infer_mmsi import koalas_in... |
6c5a7affe86088fe21288ad8b13f0dc5c92f10fd8ca8ed95f0a7341b0e40f5cd | Python | 2,466 | 74 | #-----------------------------------------------------------------------------
# Copyright (c) 2022--, Bojing Jia.
#
# Distributed under the terms of the GPLv3 license.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------------------------... |
c74963ca5b8ff4ab2186790bc305a42ff4fc0aebad6ffe2344a1569d82fc0171 | Python | 2,466 | 71 | 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.01
atom_fea_len = 64
n_conv = 3
h_fea_len = 128
n_h = 1
descriptor = Voronoi(max_num_nbr=12,
... |
d4913d8c2d2be33395c3c337a1b00396e956eec4f1235472054dc62f21f12664 | Python | 2,466 | 71 | # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import tensorflow as tf
import numpy as np
import scipy.misc
try:
from StringIO import StringIO # Python 2.7
except ImportError:
from io import BytesIO # Python 3.x
class Logger(object):
def __init__(self... |
fdaf75bf81403e39a997ef2ca6e24d209f6ee96524f7245bd2fc470c489335e7 | Python | 2,466 | 71 | 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.01
atom_fea_len = 64
n_conv = 3
h_fea_len = 128
n_h = 1
descriptor = Voronoi(max_num_nbr=12,
... |
360a968be0156e2efa6e6fed9a50ef3a7c11c5e12525aecb6653c9658dfac7db | Python | 2,467 | 71 | # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import tensorflow as tf
import numpy as np
import scipy.misc
try:
from StringIO import StringIO # Python 2.7
except ImportError:
from io import BytesIO # Python 3.x
class Logger(object):
def __init__(self... |
cb23ab37cf1ab33b8666d5e1c53464c5a27ab6ab138ae92dc13af885f3be326b | Python | 2,467 | 63 | # 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... |
ec246711b4d3845c8311dcdf0a7344f029080f779e005e975505d8020dfe272e | Python | 2,467 | 100 | import re
import numpy as np
import pandas as pd
from scipy.spatial import KDTree # aliasing this
import matplotlib.pyplot as plt
POS_REGEXP = re.compile(r"\[([0-9]*) +([0-9]*) +([0-9]*)\]")
def extract_centroids(df):
# old df format
# return np.array(list(zip(df.centroid_x, df.centroid_y, df.centroid_z))... |
156c01d14b8aa9ba2a39b43abe4b3fff72b7c225f04aac0d9143ea4329113f1a | Python | 2,468 | 78 | #!/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... |
8df279285183dc99481a2f78e7fdf35c070e1f1db637c414d01159f3c01b816a | Python | 2,470 | 72 | # this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed
from setuptools import setup
from setuptools.dist import Distribution
from sys import version_info
import os,time
versionfile = os.environ.get("LAMMPS_VERSION_FILE")
if not versionfile:
# allows installing an... |
94d37dfd1d91466a75a9617c19b86b37d41cd744ad82acdffe4cf16729bffb50 | Python | 2,470 | 117 | from numba import njit
import numpy as np
@njit
def embed_vector(vec, embed_dim, lag=1, slide=1):
"""
delay embedding a vector or 1d array.
Parameters
----------
vec: list or 1d array
input vector
embed_dim: int
delay embedding dimension
lag: int
delay time
sli... |
ee6408432aa895a2865741ee157fa8c5ba06289493f79f493f3546f107622372 | Python | 2,470 | 66 | import numpy as np
import torch
import random
import os
import argparse
from pathlib import Path
from tqdm import tqdm
from torch.utils.data import DataLoader
import aug_accuracy as util
from aug_accuracy import InputError
def test(config, data_folder, epoch, data_type, nn_type):
test_root = config[data_type]['te... |
d1a58469362d45b3b923700f7af307ffa4719538bb59653555d935a89babfce8 | Python | 2,473 | 60 | ####################################################################################################
# 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 ... |
584e48168fe5109586e9e37bf005730442679b7d347cb7eac22e4d2887b60071 | Python | 2,474 | 77 | import nltk
import pickle
import argparse
from collections import Counter
from pycocotools.coco import COCO
class Vocabulary(object):
"""Simple vocabulary wrapper."""
def __init__(self):
self.word2idx = {}
self.idx2word = {}
self.idx = 0
def add_word(self, word):
if not wo... |
85af6629c6980ed493367450aa01c748dfe248cbff6e7bce6f1988d0f67e2add | Python | 2,474 | 74 | # 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.add_argument('samplesheet', help='BrianGVEx samplesheet from synapse')
parser.add_argument('fastq_di... |
8b1aebe61d4a8c96f354f8f698345d315c78d49ea8c7348032436cad29af2df0 | Python | 2,474 | 62 | # 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... |
dd6cfbf85dd04ad603f8e87b52f5f27b2c840baec9196184c4bca231f42cdd84 | Python | 2,476 | 78 | import torch.nn as nn
from mmcv.cnn import constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from mmdet.core import auto_fp16
from mmdet.models.backbones import ResNet
from mmdet.models.builder import SHARED_HEADS
from mmdet.models.utils import ResLayer as _ResLayer
from mmdet.utils import get_root_l... |
aa51dff2ba1f8f4e64965cb8ee0e21a70a3f42987f9ff4c482fe4f43707bf0c2 | Python | 2,477 | 71 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
18bfc0788e1fe1c2deeac64a788aa63f0008aa6186cdf27947203a977599e84e | Python | 2,478 | 68 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.