sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e1261333e176cab9c8612ed4d75bbd6231b989925bc993f7b89f3fe27dd8d292 | Python | 6,042 | 159 | """
Ensemble decoding.
Decodes using multiple models simultaneously,
combining their prediction distributions by averaging.
All models in the ensemble must share a target vocabulary.
"""
import torch
import torch.nn as nn
from onmt.decoders.decoder import DecoderState
from onmt.encoders.encoder import EncoderBase
fr... |
d5be2bc51b7ff0c8226fc90b62680f74ab6ddbd385affa8ed9466a1d9f6fe9b7 | Python | 6,046 | 166 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# 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 o... |
0565a6fe575626a10b01115e2b854287dc5d3d1edb0f9d5f2ae931d1e263299e | Python | 6,053 | 189 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
67902d505108590e0aec16a87d8ddb6010b2d6e7e18b1f87ac37d538e4709879 | Python | 6,054 | 173 | # --*-- coding: utf-8 --*--
import multiprocessing
import os
from typing import List
import pandas as pd
from pandas import DataFrame
from rdkit import DataStructs, Chem
from rdkit.Chem import AllChem, rdMolAlign, Mol
from calc_SC_RDKit import calc_SC_RDKit_score
from data_loader import load_data_frame
def calc_2D... |
c0ce9ecd0683357af848b89d350ce3dd6af6a7e22de283a9910d98e8d5e6f915 | Python | 6,062 | 205 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a6de6a72235a4fa0e1ba752b12f7fd4252ff671ae35601d50befae06c58e5b57 | Python | 6,079 | 196 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5a3e9c59eaa94d177ee47c2459f2e80e7e4d68bb648b0111af006457872c4d2b | Python | 6,083 | 134 | #!/usr/bin/env python3
"""
Score the authors and affiliations of the GROBID TEI of the arXiv corpus against its JSON gold.
score_arxiv.py --data data/COMET_arxiv_1091 --output reports/report-COMET_arxiv_1091.md \\
[--json arxiv-eval.json]
The corpus directory holds one directory per article, with the gold... |
698dd3fe48c80c17ace7beb56e15ebfc9d4771b83697fe9f6fd4d5b318041f57 | Python | 6,090 | 159 | """
Fit GPCSD2D to visual area Neuropixels data.
Run after extract_data.py (which gets visual area data from raw data).
"""
# %% imports
import autograd.numpy as np
import pickle
import matplotlib.pyplot as plt
import os
from scipy import signal
import scipy.io
import os.path
root_path = '/'.join(os.path.abspath(__fil... |
9cb1e45b886441cc10ce35fa45577954f17b6d3909a736a4cb0b9a28b48301d8 | Python | 6,090 | 160 | """
Fit GPCSD2D to visual area Neuropixels data.
Run after extract_data.py (which gets visual area data from raw data).
"""
# %% imports
import autograd.numpy as np
import pickle
import matplotlib.pyplot as plt
import os
from scipy import signal
import scipy.io
import os.path
root_path = '/'.join(os.path.abspath(__fil... |
c1a5ff12d870674749def2ac0d7aa7b20490db40f6e10658410c17ca1734692d | Python | 6,092 | 178 | import os, re, time
import glob
from ij import IJ
from ini.trakem2 import ControlWindow, Project
from ini.trakem2.display import Display, Patch, LayerSet
from java.awt import Color
import math
from ij.process import ImageStatistics as IS
from ij import Prefs
from ij import ImagePlus
argv = getArgument()
arg_array =... |
431d4ba8407b13c3ac387e8ed8931f26c354ead71107517d46bdf84f24994739 | Python | 6,105 | 204 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
d746ac24dcc1ec32033c2f253afd4af1108cac86e64306033e7b407833ec0c81 | Python | 6,124 | 226 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
74e22755d9800f360751f70c3cedb1186f59e1c14d8170eab1659aca6ac52df4 | Python | 6,126 | 185 | import os, re, time
import glob
from ini.trakem2 import ControlWindow, Project
from ini.trakem2.display import Display, Patch, LayerSet
from java.awt import Color
from ij import IJ
import math
from ij.process import ImageStatistics as IS
from ij import Prefs
from ij import ImagePlus
argv = getArgument()
arg_array =... |
a90da350ee6d1d3303698ce4958d0f8011f4772eb9dc6227da054557d09b5cd0 | Python | 6,134 | 168 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from importlib import reload
import h5py as h5
from matplotlib import colors
import sys
import matplotlib.patches as patches
direc = sys.argv[0].split('scripts')[0]
where = sys.argv[1]
mode = sys.argv[2]
stim_idx = int(sys.argv[3])
sys.path.append(dir... |
231da2bec6a263496fc2b0134dcc5b1b53cf30bb756188ca464e93f5b2293107 | Python | 6,159 | 182 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
10318abb55bba99266391f698123441b4e18081f4c1188e215fbb7ea54841012 | Python | 6,160 | 159 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
84c6c252e94b171384103c160dacb5c79dae5d3743eea3c4d3b0a935f818a04e | Python | 6,165 | 175 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
2edda8123b89b3f36c4339dc1112019853c26d4472ca19f8c496aa76b5355e1a | Python | 6,166 | 224 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e5e039ad88ca76b5ede23bd71e92e9bd2cddf33c3863fe39653aeac9558e7adf | Python | 6,199 | 169 | #!/usr/bin/python
#
# Batch multifit analysis.
#
# Colenso 05_30_18
import glob
import os, time, datetime
import multiprocessing
import signal
import subprocess
import sys
import threading
from tqdm import tqdm
import shutil
import numpy
import math
from subprocess import *
import datareader
import re
import arra... |
bdda79bfb6616cb3186ed8fc18d3ace99966538b15ffb3411361f5abc6268931 | Python | 6,203 | 197 | from unittest.mock import patch
import napari
import pytest
from cellfinder.napari.detect import detect_widget
from cellfinder.napari.detect.detect_containers import (
ClassificationInputs,
DataInputs,
DetectionInputs,
MiscInputs,
ModelSource,
)
from cellfinder.napari.detect.thread_worker import W... |
dfec88a3dacb0a8b8436c3adedc24b06a4fd6ea13a21d829af9e90b959c752ab | Python | 6,206 | 238 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .nnutils import create_var, index_select_ND
from .chemutils import get_mol
import rdkit.Chem as Chem
ELEM_LIST = [
"H",
"He",
"Li",
"Be",
"B",
"C",
"N",
"O",
"F",
"Ne",
"Na",
"Mg",
"Al",
"Si"... |
73ffe12379265a4cac9bec61f9986673a1aa3a598b85cf4491a083b7b758bad2 | Python | 6,207 | 192 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
27f31665163aa65a290b47a6eff451d0f89ad84c962fe47ef494ba9f1aa03b6b | Python | 6,208 | 192 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e2aa1cdd29ab1a2bfd41136bb9421a2fb1a3db8229f6f22535c0113ca2304ce0 | Python | 6,213 | 197 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
3e4ba336263c2956a75bec275a9d6653afe5ad04ce21472bc08ecd1acc801949 | Python | 6,214 | 141 | #Note: Fiji macro only recognize path name r"X:/XX/XX/XXX/"!!!!!!!!!!!!!!!!!!!!!!!!!
import os
import time
import glob
import sys
import shutil
import datetime
import subprocess
from cproc import *
from reorder import *
from crop_datastack import *
from wga_norm_and_thresh import *
def z_align(exp... |
40ed6f0b9d9c384990f3da379be71caaf552550e57c475e3b52b30b1ada7e5eb | Python | 6,220 | 184 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
863094385aae87468fab30d794d0118676de656f529456ecb0918dceeec1bade | Python | 6,223 | 213 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
ec925d2219b7e8adaf7337de4fc1e606786cc6d4aa212ac32d582599cae967bd | Python | 6,230 | 184 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
f6024f3491473c99f2e7ef85c3ef2e1b194fb675dc347b6a0dd788d901cf9993 | Python | 6,237 | 213 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1c9cc0a38f5fde1748e835347cc69d9c73d4a129eaa0d862dfb644ab7967befc | Python | 6,249 | 185 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code mus... |
d43548ab937264cf434e839dfd5768bd3e423579e48ae342608cafa4c8600c07 | Python | 6,264 | 177 | from gcn.layers import *
from gcn.metrics import *
flags = tf.app.flags
FLAGS = flags.FLAGS
class Model(object):
def __init__(self, **kwargs):
allowed_kwargs = {'name', 'logging'}
for kwarg in kwargs.keys():
assert kwarg in allowed_kwargs, 'Invalid keyword argument: ' + kwarg
... |
0d813b06bd8d4bf02f4340432270a89119708b0b5c047f3be57e8be04cf9c8ed | Python | 6,265 | 153 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9ce9e047e26e71d4ee7f2faf8104954ac1382c3d8e37cf6ed808edcc7821db1b | Python | 6,283 | 181 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9d2d0f5af3012b6d5939b520ee959526a41c1831605ff85291a4265df930df4a | Python | 6,287 | 113 | from typing import Tuple
import h5py
import torch
from Bio import SeqIO
from torch.utils.data import Dataset
import torch.nn.functional as F
from utils.general import LOCALIZATION, AMINO_ACIDS
class EmbeddingsLocalizationDataset(Dataset):
"""
Dataset of protein embeddings and the corresponding subcellular l... |
2e102703665003e67893ab6088fa59b995acef99758347506c204e4ce179a50b | Python | 6,305 | 188 | from tqdm import tqdm
import termcolor
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from deep_phospho.model_utils.utils_functions import Pearson, Delta_t95
def pretrain_eval(model, loss_func, test_dataloader: DataLoader, iteration, device, logger):
mode... |
762cc9c224d6af07ab720ac22ff47b6e70a11323f11c21781b651b625ae27745 | Python | 6,328 | 173 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
f79d31067125726ba0e43e171badffc2a143260bcecbb64ca4c5bb1d0d0744b9 | Python | 6,329 | 192 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
c834012a238df45d7ab0bfef6067105f70d5f2612b0a44c3122052de4d3e4371 | Python | 6,330 | 187 | import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
from sorting_quality import load_quality_measures
group_dict_for_quality = {
'noise': 0,
'MUA': 1,
'good': 2,
'unsorted': 3
}
class Quality(object):
def __init__(self, path):
self.groups, self... |
8af798ac5865a906393a841407e5efd082bbe70a7632b239362e447982f56b50 | Python | 6,338 | 188 | import re
from deep_phospho.proteomics_utils.constants.mass import CompoundMass, Mass
from deep_phospho.proteomics_utils import rapid_kit
def calc_prec_mz(pep: str, charge: int = None, mod=None) -> float:
"""
Example:
pep = 'LGRPSLSSEVGVIICDISNPASLDEMAK'
charge = 3
mod = '15,Carbamidomethyl;26,Ox... |
979a53e60eff0e59ddc867a9561e8a0893012bbc0f4f95f867b1227438f0b0eb | Python | 6,345 | 165 | # --*-- coding: utf-8 --*--
from argparse import ArgumentParser
import deepchem as dc
from numpy import mean
from rdkit import Chem
from tensorflow_core.python.keras import backend
from util import find_best_model_checkpoint
from train import build_model, TASKS
import pandas as pd
import io
import tensorflow as tf
i... |
f6aa09c31b21fa49ee7e9ae6e9ed156e84344993a52cf904a918e61e7f83a190 | Python | 6,360 | 163 | # resnet model
import keras
import numpy as np
import time
from utils.utils import save_logs
from utils.utils import calculate_metrics
from utils.utils import save_test_duration
class Classifier_INCEPTION:
def __init__(self, output_directory, input_shape, nb_classes, verbose=False, build=True, batch_size=64,
... |
4cc1ea439fc38a50419f07f47ddf9638af7dead752cdeccb05089db39f22976a | Python | 6,378 | 189 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
c82da9854e2910621157a135c5490537b4f2a95ec1d8cf7297848ac4d8ec6fe3 | Python | 6,398 | 213 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
469a7a2ffcadae74ec012bd56461d55be456275d1f817bb77c9d59d2d24ad718 | Python | 6,418 | 184 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
6819dc0e81a0d5c54887262a75daeeb0d8b87ab332b99c001e20e29a9471b551 | Python | 6,428 | 155 | import numpy as np
import matplotlib.pyplot as plt
import json
import scipy.io as sio
import os
# Description !!
#
#
#--------------------------- calculating functions ---------------------------#
def calcIRE_Image(frEx,ffW,patchsize):
# reconstruction of the input Image,
# based on the network weights and ... |
5e0ae9f8b4815c035ae08e63e273a0a8af9bcfae93886635f7fd4a34a48892d8 | Python | 6,430 | 181 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
8fe5debb4b4d76c94d29a8b5f1200dd06b9b6f1390824d818804d86e17d573ec | Python | 6,431 | 226 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1df219664aca8e2cbc25269862abe8f348e650fcc7888fe596bffe7ea6411a41 | Python | 6,433 | 228 | import sys
import glob
import os
import numpy as np
import multiprocessing as mp
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from scipy.interpolate import make_interp_spline,BSpline
from scipy.stats import zscore
from scipy.interpolate import UnivariateSpline
from skimage import t... |
5008859136d05b9dd6dffd6bf544c520438b29c52ad6a67398fe694cebe8b71a | Python | 6,433 | 179 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on March 22 2018
@author: kushal
Chatzigeorgiou Group
Sars International Centre for Marine Molecular Biology
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
"""
from __future__ import print_function
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
fr... |
595dd586ac0279bf256aa3e037ffdbaccf0f2d5a3d2699bc7fc17a02bf7d1484 | Python | 6,457 | 142 | import numpy as np
from margrie_libs.margrie_libs.signal_processing.measures import get_sd
from rotation_analysis.analysis.event_detection.event_detection import detect_trace
from rotation_analysis.analysis.event_detection.events import Event
from rotation_analysis.analysis.event_detection.events_collection impor... |
b2c9b53fbf732b4f08be25d00d38e35ab53a9728b5b66b8eb9d6b4027a03d9bd | Python | 6,461 | 185 | """Test the functions in yasa/staging.py."""
import logging
from unittest.mock import MagicMock
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
import scipy.stats as sp_stats
from mne.filter import filter_data
from yasa.hypno import Hypnogram
from yasa.others import sliding_windo... |
64a96812127027f30b77e931a42398c63b8721e8a7a98eb0697f34f2c87c3fb7 | Python | 6,467 | 160 | ######################## DATASET PARAMETERS ###############################
"""
These values are used for training (when building the dataset)
patch_size : (x,y) size of the patches to be extracted (usually square)
step_size : stride of the sliding. If step_size < min(patch_size), then
ther... |
32ff4eddc079af495d5bc4e9fea66a4af3f24eb65ac7d6bdf07206efa6615124 | Python | 6,468 | 216 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5f87bf6095f955b8511edf70898891ff2c8b31392cbcd14fc64312b1fdad4f6c | Python | 6,488 | 181 | import pymmwr as pm
import datetime
import pandas as pd
from zoltpy import util
import requests
import io
'''
Get the epidemiological year, week and date of a given date.
'''
def get_epi_data(date):
# The format
format_str = '%m/%d/%y'
dt = datetime.datetime.strptime(date, format_str).date()
epi ... |
27bae983a6fdcaba352535e2a3edc46d1d9a0aabbcb7707c5212b41c27f9f8c4 | Python | 6,500 | 169 | import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
def parse_index_file(filename):
"""Parse index file."""
index = []
for line in open(filename):
index.append(int(line.strip()))
return index
de... |
5f611b2dd12e59ec115b734aca3b353bc452870d164073e96791dcc8de078001 | Python | 6,532 | 250 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e398c20a588de44c6c074f167a51342b79410e9fd2cce96618c85309a76ead70 | Python | 6,535 | 144 | # Convolution and Fourier operations
import tensorflow as tf
import time
def fft(img):
img = tf.transpose(tf.cast(img, dtype = tf.complex64), perm = [0, 3, 1, 2])
Fimg = tf.signal.fft2d(img)
return Fimg
def ifft(Fimg):
img = tf.cast(tf.abs(tf.signal.ifft2d(Fimg)), dtype=tf.float32)
img = tf.trans... |
4a332d72b3de834db8c010d5a6639e694fc465ec928f697535c4f96ece87e60b | Python | 6,536 | 166 | """
Access to YASA tutorial data
The YASA sample dataset is stored on Zenodo
and can be accessed using the Pooch library.
"""
import time
from pathlib import Path
import pooch
__all__ = [
"fetch_sample",
]
REGISTRY = {
"sample": {
"v1": {
"base_url": "https://zenodo.org/records/1456428... |
fd9f314857fbbc68f9eeea2df28fb3ee184cb0b9f18e05659f48d7857378029d | Python | 6,552 | 164 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a0d6107266f88e7451a0653e0e8d46b2bbc5757fd16fc63323a54406f2515262 | Python | 6,559 | 191 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: https://kazuto1011.github.io
# Date: 07 January 2019
from __future__ import absolute_import, division, print_function
import click
import cv2
import matplotlib
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import... |
85133a4a78baa7aa3f599d594e6b20b5eeb7d0f441bcad4aeb02dcc6e2801cdd | Python | 6,568 | 209 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
b222c4f513b77c831c6985e61c7743a02223cf1314080eb7f6915994e99cca0b | Python | 6,570 | 144 | import argparse
import os
import pickle
import numpy as np
import torch
from inspect import signature
from tqdm import tqdm
from . import graph_algorithms
from .graph_generation import GraphType, generate_graph
class DatasetMultitask:
def __init__(self, n_graphs, N, seed, graph_type, get_nodes_labels, get_gra... |
652200c5c064fb6635a06f061c751ef5203fcfcec3afb3e9f2ebadda74248ca5 | Python | 6,577 | 188 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
06506997758d5abe62885403d1fc54146f2a162f92e067244c7b33e9e2a0d1f0 | Python | 6,580 | 172 | # MIT License
# Copyright (c) 2020 Vijay Prakash Dwivedi, Chaitanya K. Joshi, Thomas Laurent, Yoshua Bengio, Xavier Bresson
import torch
import pickle
import torch.utils.data
import time
import numpy as np
import csv
import dgl
class MoleculeDGL(torch.utils.data.Dataset):
def __init__(self, data_dir, split, num... |
4989b0999ecea11c188f6cb96a0e5227e67b87fbd1d7638d9e525ed1b6b3c9a3 | Python | 6,586 | 189 | from pathlib import Path
from typing import Optional
from magicgui import magicgui
from magicgui.widgets import FunctionGui, PushButton
from napari.qt.threading import thread_worker
from napari.utils.notifications import show_info
from qtpy.QtWidgets import QScrollArea
from cellfinder.core.train.train_yaml import run... |
df867fadbedd7f2994d94be9c8be15cfcf192fc021299c620e87ef9974044445 | Python | 6,600 | 234 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
ec458dd8d7f4fdff7e68246cef4e0265c8a79d6001284c4c3f20c64131150eaa | Python | 6,602 | 172 | import tensorflow as tf
from helper_functions import *
class CNNBlock(tf.keras.Model):
def __init__(self, filters, kernel_size, pool_size):
super(CNNBlock, self).__init__()
self.conv1D_0 = tf.keras.layers.Conv1D(filters, kernel_size, activation="relu", padding="same")
self.conv1D_1... |
0c7253850b94975b3cc715db33131b7d3205a0de5b0a2f4c91d16d7d700e7c74 | Python | 6,607 | 172 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
18f6321c9d7349c41e6b7227f9e09036720694ae1c66c6e100ed1413f541bd56 | Python | 6,615 | 174 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# 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 o... |
ffaaadaa9f249424c691c29600f553731d729279aba4645647fd100c31ca90de | Python | 6,619 | 172 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
286e0d6ce848d9797944092c3eda91767ad354a07871c7086be46fa2e1a4255a | Python | 6,634 | 145 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# 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 o... |
c75e0824b814d4f767c2886ebaa4a1625424b9b740d29c403d1338eab4944a39 | Python | 6,642 | 162 | import math
import os
import struct
from itertools import compress
import numpy as np
from file_handling import binary_classes
from util import detrending
class RecordingIo:
def __init__(self, path, n_chan):
self.path = path
self.root = os.path.split(path)[0]
self.file_n... |
aeeb7f76ce9328205871121f0e08efa250674894fa50f81d3f80f3de6d78c37d | Python | 6,649 | 258 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
258b990ae1727d4a8023492be95f91591188f82d6f879489ec2be461dabc3947 | Python | 6,656 | 192 | _SEED = 0
import os
import random
import sys
import numpy as np
import torch
import torch.nn as nn
from torch.nn import LayerNorm
from torch.utils.data import DataLoader
from tqdm import tqdm
sys.path.insert(-1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from deep_phospho.model_dataset.preprocess_i... |
1d2fc17870576d9ca3d6c509cf90b1cba88ccb0aa685a6e9ebc9e68693197e5a | Python | 6,670 | 136 | #! /bin/env python
#
# Michael Gibson 23 April 2015
# Modified Adrian Foy Sep 2018
import sys, struct
from analyzeMEA.intanutil.qstring import read_qstring
def read_header(fid):
"""Reads the Intan File Format header from the given file."""
# Check 'magic number' at beginning of file to make sure this is an I... |
91b545367977b125bcaefe645f1c868ca862517e45f5802257c95554dd462ea3 | Python | 6,689 | 156 | #!/usr/bin/python
# Preprocesses tokens describing mental functions from the following ontologies:
# (1) Cognitive Atlas (Disorders): http://www.cognitiveatlas.org/
# (2) Mental Disorder Ontology, MFO (Internal): https://github.com/jannahastings/mental-functioning-ontology/tree/master/ontology/internal
# (3) MESH (Ca... |
2ce3ac2d40b31c6a9316cf3d70d4793984535283f03b72bcecd24315d8bdff69 | Python | 6,690 | 204 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
2e69c6a5ecbd373190df83915ddbe2b6b3d4ba95316263e82d7f8168cabc6394 | Python | 6,697 | 169 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# 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 o... |
50e63a293938d6a33e1b1aba3f220d1c90879aa7266d0f9f437afe257d911017 | Python | 6,704 | 175 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9d59e5001d85166528fb6e4f0a274ad2fbb8d0e858c99b022316196ed0fd1b9b | Python | 6,728 | 160 | # Created by woochanghwang at 17/07/2021
# Created by woochanghwang at 17/06/2020
import pandas as pd
import toolbox.data_handler as dh
import itertools
import networkx as nx
import matplotlib.pyplot as plt
from collections import Counter
import seaborn as sns
'''
Calculate all shotest paths between DIP and DEP
get... |
b25977da2ae6fd737b1375a8dae76a88c0fbfd2a60094a5da5d11744a9622a58 | Python | 6,741 | 188 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import copy
import unittest
import glob
import os
import codecs
from collections import Counter
import torchtext
import onmt
import onmt.inputters
import onmt.opts
import preprocess
parser = argparse.ArgumentParser(... |
7557ed4f62792eae12992ec9a7e2d441c3207bb95e112473433ecf77a86e2002 | Python | 6,751 | 172 | #######################################################
### Adopted from Naozumi Hiranuma (hiranumn@uw.edu) ###
#######################################################
import numpy as np
from time import sleep
import sys
import keras.backend as K
from keras.models import Model, Sequential
'''
Integrated gradients a... |
5592fe51e1fac07ae1d0377848887b57069569beaf9ff4552d1063534edad7ad | Python | 6,752 | 145 | import os
import pprint
from argparse import ArgumentParser
from subprocess import check_call
from collections import OrderedDict as ODict
from margrie_libs.utils.folder_operations import folders_starting_with
from calcium_recordings.correct_folders import getDepthDirs, setRecNbs
from calcium_recordings.re... |
c7713bc88f8e663011497f5e24376b38bb56d86984ab296dda7767fe767e8727 | Python | 6,767 | 201 | """ Multi-Head Attention module """
import math
import torch
import torch.nn as nn
# from onmt.utils.misc import aeq
class MultiHeadedAttention(nn.Module):
"""
Multi-Head Attention module from
"Attention is All You Need"
:cite:`DBLP:journals/corr/VaswaniSPUJGKP17`.
Similar to standard `dot` atte... |
a1665874d4afa82462e0055573a2f8651057ac46e4f68c037c9ff72bbfb2f6da | Python | 6,769 | 138 | # Neural feature propagator network
import tensorflow as tf
import tensorflow_addons as tfa
from metasurface.conv import deconvolve_wnr
def conv(filters, size, stride, activation, apply_instnorm=True):
result = tf.keras.Sequential()
result.add(tf.keras.layers.Conv2D(filters, size, stride, padding='same', use_... |
1bc879800659e3bf29f7808967b0331b87108d5bd694f5d8fe99fd6bf6cc3bab | Python | 6,775 | 162 | from os import makedirs
from os.path import join, isdir
import gzip
from biodblinker import GeneNameLinker
from shutil import copy
def export_triplets(triplets, filepath):
""" Export triplets to file
Parameters
----------
triplets : iter
Triplets
filepath : str
File path
"""
... |
9459e90b0d7c46811c6f8894847c9a587760470343a8eeec3125b144e0b11767 | Python | 6,800 | 241 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
4c767488f70381df470857bb35388ad6b50925d9067404bd54a7bc1408e8246e | Python | 6,805 | 177 | import numpy as np
# Paths
path_to_figure = {}
path_to_figure['local'] = ''
path_to_figure['cluster'] = ''
path_to_data = {}
path_to_data['local'] = ''
path_to_data['cluster'] = ''
# Simulation
n_threads = {}
n_threads['local'] = 2
n_threads['cluster'] = 32
print_time = True
# Neuron
neuron_model = 'iaf_psc_e... |
175c21360ede8771c5ca197b47cdd884c2eaf82afe25b201bd2a47c0a57f9ecb | Python | 6,807 | 218 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
949970fd1266f9597c366dd9b1b243cac345628360864672b8a6b3dcbb2d7abd | Python | 6,831 | 197 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9321778c46c89d116a0d72ba49d2a161df317be86db703fb28451af734cf64ab | Python | 6,834 | 172 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import os
import sys
from functools import partial
import xml.etree.ElementTree as ET
import lxml.etree as lxmlET
import yaml
from .advanced_settings_dlg_ui import *
from PyQt5 import QtCor... |
7c02bf5a5501ca017d168648b78723a69720e70c479c843e98741c57bdefdf7f | Python | 6,837 | 229 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
784db7e5bce47cfde9dd64b0bbc7b0a26b8aea22ed2a8d13e7199288cab99129 | Python | 6,852 | 218 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5c4f20fd4617644c81a6aff63549c1574985e358e91e406cfe33c98e7618cdbf | Python | 6,856 | 178 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
4a511994c16069c8573eeaccd39e42ec715eefc69cc50255fc290d2880d88f92 | Python | 6,865 | 203 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
22b06df7d6103db7bfbc622b0cb81dc5715ee6a7608441b28de696e8be8b6876 | Python | 6,887 | 191 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e1ecdf2f0bc5e18ee10ea3f644fdbacc685c715c4aa03f62b4a85d69ee3147cb | Python | 6,900 | 219 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e955c49637c5b0e9621e5d260b304aa1588f0d5b9e79bcc9123c459640c0bd0c | Python | 6,906 | 180 | import math
import os
import h5py
from Bio import SeqIO
from tqdm import tqdm
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
sns.set_theme(style='whitegrid', rc={"xtick.bottom": True}, font_scale=0.9, font='Verdana')
plt.rcParams["figure.figsize"] = (8, 4)
plt.rcParams['... |
64a747c92e9b8694a5f68a83b0a070359dfbc6250b687cca0e29852988fd83a2 | Python | 6,922 | 122 | import logging
import re
import os
import pandas
import numpy
from . import GWAS
from .. import Exceptions
from .. import Constants
from .. import Utilities as BUtilities
def add_gwas_arguments_to_parser(parser):
parser.add_argument("--snp_column", help="Name of -snp column- in GWAS input file", default="SNP")
... |
626f8d05b559ad18fe9d056f0d7a25fbe856aab771c3a7b2757a0836b1854c89 | Python | 6,923 | 177 | import os
import pandas as pd
from deep_phospho.proteomics_utils import modpep_format_trans
from deep_phospho.proteomics_utils.post_analysis import spectronaut as SN
from deep_phospho.proteomics_utils.post_analysis import maxquant as MQ
from deep_phospho.proteomics_utils.modpep_format_trans import unimodpep_to_intseq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.