sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
06b866816089a1c69b51a97d0209e0239fbc8069ca87aa963e585c10b41a8f72 | Python | 1,970 | 78 | '''
Image of an avoiding reaction, with various stimulation intensities
'''
from brian2 import *
from behavior import *
import imageio
from plotting import cell_mask, cell_indices, plot_cell
import matplotlib.pyplot as plt
width,height = 2,2
t1 = 500*ms
x0, y0 = 500, 800 # in um
all_I0 = array([0.3,.5,5])*nA
C = par... |
0757a295ca610f52b3a8890815abe4ed6a461daa379e79dfb4884954b1324f78 | Python | 1,971 | 68 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2017-11-19
from __future__ import absolute_import, print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import _ConvBnReLU, _ResLayer, _Stem
class _ASPP... |
4b20678c3c0bc8f7062ef9ae23e082288b57fce39471a554dbde3a4ecf64e628 | Python | 1,971 | 52 | from __future__ import print_function
import numpy as np
import tensorflow as tf
from roi_pooling.roi_pooling_ops import roi_pooling
# input feature map going into the RoI pooling
input_value = [[[[1], [2], [4], [4]], [[3], [4], [1], [2]], [[6], [2], [1], [7.0]], [[1], [3], [2], [8]]]]
input_value = np.asarray(input... |
88e70ded5724dc3d5376e21d690bd4ccbe7746640a31911f6b554298450fe52a | Python | 1,972 | 65 | import os
import sys
import core.system as System
import getopt
from core.system import mprint
##############
## Settings ##
##############
# Input #
filepath_checkpoint = None
# Output #
write_stdout_stderr_to_file = True
filename_output_stdout_stderr = "stdout_stderr.log"
output_dir ... |
88fa2fbb20b13a2c031160363cfc24fe8ad0c0cf14945154f7ec1d597ebe642b | Python | 1,972 | 61 | # 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 random
import unittest
import carla
class TestSyncMode(unittest.TestCase):
def test_sync... |
91dd8f6abd9d9a0e303f060baed707d8f4b94f0c1aef6585936e26e66dcdb73d | Python | 1,972 | 51 |
# 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 CMC_HBCC.')
parser.add_argument('samplesheet', help='CMC_HBCC samplesheet from synapse')
parser.add_argument('bam_dir',... |
61d559936118588005ec8398e3c873b4579836fe5c8abb49b6eacfed7e31d770 | Python | 1,973 | 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... |
30d4349246584c34b40bd4e16a511bb9096f54af96ce47b277c1d7f2a1b51ae5 | Python | 1,975 | 44 | from spike2calcium_sigmoid_ALS_SD import *
import os, sys
import warnings
warnings.filterwarnings('ignore')
from glob import glob
# get cell list information
# flist = sorted(glob('GCaMP8_exported_ROIs_s2f_full/dff_v00/*.npz'))
# new fit based on the clean-up data
flist = sorted(glob('GCaMP8_exported_ROIs_s2f_full/dff... |
c697eddeaef028e68e803fff58ad7ddec718aa7f058d2941a03381997682a376 | Python | 1,975 | 57 | import time
import torch
import pandas as pd
import networkx as nx
from graphxai.datasets.shape_graph import ShapeGGen
# Script counts the number of houses in the graph by using a subgraph isomorphism counter
# Search parameters:
prob_connection_search = [0.01, 0.02, 0.025, 0.03, 0.04, 0.05, 0.1, 0.15, 0.5, 0.75, 1... |
e614f91556880cb3b59b381ed851ce3189f03ec5055c7d5a376b25a7814783b0 | Python | 1,975 | 58 | #
# 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 in writing, software
# distributed under t... |
c0ce1fa74442d67b4ddab96e783b211da293a26e23170d252691617ae6cd69ab | Python | 1,977 | 51 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# less required by applicable law or agreed to i... |
2efd24b5cb51d213d03299812c25d0d45020e2606d6bef3d93cded2986ee7b42 | Python | 1,978 | 52 | # 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... |
5d886808337a8ac672ee1d438feb185332a6f7a0c9d8a6679e577daa411fcd38 | Python | 1,979 | 60 | import os
from dataclasses import dataclass
from pathlib import Path
from typing import List
from sssom.parsers import parse_sssom_table, to_mapping_set_document
from sssom_schema import Mapping
from oaklib import conf as conf_package
from oaklib.datamodels.vocabulary import HAS_DEFINITION_CURIE, IS_A, LABEL_PREDICAT... |
a85d7692c33be0a89dc03ff11174d7e689125abfdfedee98c5397c4d91bf0df6 | Python | 1,979 | 67 | import matplotlib as mpl; mpl.use('Agg')
from matplotlib import pyplot as plt
import pandas as pd
experiments = {'learn':200,
'reversal':500,
'reversal_prat':500,
'punish':500,
'punish_prat':500,
'devalue':200}
output = {}
numSims =100
for k... |
c09557ee8f833a71f22ae1be4558978ee30b51b152e6fba56c0e8347af3718a4 | Python | 1,980 | 62 | # Copyright (c) Open-MMLab. All rights reserved.
import logging
import torch.nn as nn
from ..runner import load_checkpoint
class AlexNet(nn.Module):
"""AlexNet backbone.
Args:
num_classes (int): number of classes for classification.
"""
def __init__(self, num_classes=-1):
super(Ale... |
dd316dd2bebd6090e2a16a6548a68b91e491731102d58e8fbd253f3352f3aec9 | Python | 1,980 | 66 | '''
@author: Mahbub Ul Alam (mahbub@dsv.su.se)
@version: 1.0+
@copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se)
@license : MIT License
'''
import logging
from typing import List, Union
import torch
class OptRepo:
"""Collects and provides information about the subclasses of torch.optim.Optimizer.
""... |
ca1f3cfc1a5ca4c43869b556e0f45c1d6767d9ae21cd8a01668cf966afd921ca | Python | 1,981 | 54 | #!/usr/bin/env python
import os
from setuptools import (find_packages, setup)
here = os.path.abspath(os.path.dirname(__file__))
# To update the package version number, edit DeepRank-GNN/__version__.py
version = {}
with open(os.path.join(here, 'deeprank_gnn', '__version__.py')) as f:
exec(f.read(), version)
wit... |
a86d8f049a4b85e425c8d8e000fab77b828febf01b297ae60f2e449ed8c06e40 | Python | 1,982 | 63 | import rouge
import argparse
import json
from tqdm import tqdm
def build_batches(datapath):
batches = []
with open(datapath) as f:
lines = f.readlines()
lines = map(lambda x: json.loads(x.strip()), lines)
for _j in lines:
candidates, references, paper_ids = [], [], []
... |
d71cbe4e1804e061e8775f62584ba0b842c75264d49bed88a8e9cb04d9e91751 | Python | 1,982 | 52 | import torch
from torch.autograd import Function
from torch.autograd import Variable
class EBLinear(Function):
# Note that both forward and backward are @staticmethods
@staticmethod
# bias is an optional argument
def forward(ctx, input, weight, bias=None):
ctx.save_for_backward(input, weight, b... |
3bfc88b50af211c2b1db4f227905f643c0abc3778551e5cab86c9e828e90efc6 | Python | 1,983 | 69 | from typing import List, Optional, Tuple, Union
import norse.torch as snn
import torch
from norse.torch.functional.lif_adex import LIFAdExParameters, LIFAdExState
from norse.torch.module.exp_filter import ExpFilter
from cgtasknet.net.save_states import save_states
default_tau_filter_inv = 223.1435511314
class SNNl... |
1c30003b0142078a80f0ed6cc52c4bfe6d7bf11398b082726806f2fff53f20be | Python | 1,984 | 65 | from abc import ABC
from dataclasses import dataclass
from typing import Dict, List, Tuple, Iterator
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface, RELATIONSHIP_MAP, RELATIONSHIP
from oaklib.types import CURIE, LABEL, URI, PRED_CURIE
@dataclass
class SubsetStrategy:
pass
class S... |
c58ca66e6ad13228602634685ed3e20c2a23f034636715d2ee8559494e8d7b3f | Python | 1,985 | 58 | import torch
class LagrangianOptimization:
min_alpha = None
max_alpha = None
original_optimizer = None
batch_size_multiplier = None
update_counter = 0
def __init__(self, original_optimizer, init_alpha=0.55, min_alpha=-2, max_alpha=30, alpha_optimizer_lr=1e-2, batch_size_multiplier=None):
... |
e1810e2704e27dc48f97b8d06e7ccba59b3d74b8474db68dffd3cfef1d065fca | Python | 1,986 | 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... |
40085e260118acc963b10cb0e147e5391b74b951958a25505f768d1118fb8706 | Python | 1,988 | 68 | from drugex.logs import logger
from drugex.training.monitors import FileMonitor
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, rdMolDra... |
eb16bbcbcee2aa361be25b334f791c8d1d7555ddad6ca2c876eeb0061a5a9dbf | Python | 1,988 | 50 | # 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... |
59eec8cb916eea11e09c73895cb4498378a557f9391ead4795acba01c8a3f01c | Python | 1,989 | 64 | """ Full assembly of the parts to form the complete network """
""" Ref: milesial/Pytorch-UNet"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import layers
class UNet(nn.Module):
def __init__(self, input_channels):
super(UNet, self).__init__()
# assert input_channels
... |
ce4fc1069a6cdd21f8c823c091ea579b5a3b303e8baa13059853e1cfe6597885 | Python | 1,990 | 63 | import os, random
from graphxai.utils import Explanation
import torch
from graphxai.datasets.real_world.extract_google_datasets import load_graphs
from graphxai.datasets import GraphDataset
ATOM_TYPES = [
'C', 'N', 'O', 'S', 'F', 'P', 'Cl', 'Br', 'Na', 'Ca', 'I', 'B', 'H', '*'
]
# fc_data_dir = os.path.join(os... |
112fd44b69f561528fe2971d7a108b16df5ae89a7f412b9395996426fb3f7fb3 | Python | 1,992 | 50 | # 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... |
2e8a4c0e2a3029ebe822b249ebfced0346fc964803177dde7c83abed626aa959 | Python | 1,992 | 67 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, ... |
43f314b11dad54d924bfc2bdeef8cc8a88588003e72c7e474dcb6e8028a5ef2e | Python | 1,992 | 62 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register rpn heads
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling.rpn.rpn import build_rpn # NoQA
from maskrcnn_benchmark.mode... |
44362045fcc601832b98d3029314633cc590fcca8e7320b0b4d7fbf7c1844749 | Python | 1,992 | 65 | import numpy as np
import pytest
from cropro.cropping.normalizers import (
GaussianNormalizer,
NormalizationContext,
Normalizer,
available_normalizers,
get_normalizer,
register_normalizer,
)
def _context() -> NormalizationContext:
return NormalizationContext(
source_path=None, min... |
5d7fd4fb30c92bd9a5c9d768e1f7bd9f52197b567616fb4c96869a7740d44634 | Python | 1,993 | 67 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, ... |
9d134bd6aa5aa4b6e75ed089eda816ecec5bf6b6fd75757e11f3f0d2c0599239 | Python | 1,993 | 55 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
def to_range(images, min_value=0.0, max_value=1.0, dtype=None):
"""Transform images from [-1.0, 1.0] to [min_value, max_value] of dtype."""
assert np.min(images) >= -1.0 - 1e-5 and ... |
55d857ca8f5b0df81f1a53ba07336ee8b3b775bf409cd581876fa520baa7f032 | Python | 1,994 | 92 | import gzip
import sys
## converts chr:pos to rsids
infile = sys.argv[1] # SNPs.txt.gz containing chr:pos as ids
infile2 = sys.argv[2] # SNPMappings.txt.gz with appropriate rsids
outfile = sys.argv[3] # output file prefix
print("reading "+infile)
fh = gzip.open(infile,'rt')
idset = set()
# read snp ids
lins = ... |
6b90d52874412d1740608025d6223428968ad97d1f5f10b57058507b7860fa32 | Python | 1,994 | 54 | # Weighted versions of Crossentropy and Accuracy metrics from eliadi:
# https://github.com/keras-team/keras/issues/2115#issuecomment-530762739
import tensorflow.keras.backend as K
from tensorflow.keras.losses import CategoricalCrossentropy
from tensorflow.keras.metrics import CategoricalAccuracy
class WeightedCatego... |
d9b9f1c3715a74f4d7b9cc11f4791c6dda1d9308d31be1a7ce515af8892c550f | Python | 1,994 | 38 | # 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... |
eb46811a63b8abc045752288a3e83a6eb1d70ee356801df51dd0e4531fdf0549 | Python | 1,995 | 63 | """Phase 1 regression tests for the Bennett RPE baseline.
Pin down the acquisition behaviour so any future refactor surfaces a regression.
"""
import numpy as np
from mb_dual_dan.connectome import extract_mb, load_winding
from mb_dual_dan.models.rpe_baseline import BennettRPE
from mb_dual_dan.tasks.conditioning impo... |
f1da2adf8c26512d7bb53df2f67b59622d96d86868c5934c50aa6896549cfc02 | Python | 1,996 | 74 | """
interfaces
Created by: Martin Sicho
On: 29.05.22, 18:09
"""
import multiprocessing
from abc import ABC, abstractmethod
class ParallelException(Exception):
pass
class ResultCollector(ABC):
@abstractmethod
def __call__(self, result):
pass
class ListCollector(ResultCollector, ABC):
@abs... |
201f6daac19a07c1baf3e2c51d10aec898601b34d051079d96c2d78e924d79af | Python | 1,997 | 49 | '''
Analysis of noise in ciliated cells, 4 mM KCl
The script examines portions of signals before stimulus start (300 ms), where the stimulus is a positive pulse
(to avoid prolonged hyperpolarizations after a negative pulse).
The model is: V_measured = V_cell + noise
where the noise is independent between the two elec... |
6ef0e9988c36276d111db62517df89c56096058bc97499d8bc356231333889a1 | Python | 1,997 | 55 | import connectome_tools.process_matrix as promat
import pandas as pd
import glob as gl
# load whole brain connectivity matrix
matrix = pd.read_csv('data/Gadn-pair-sorted.csv', header=0, index_col=0)
# import pair list CSV, manually generated
pairs = pd.read_csv('data/bp-pairs-2020-01-28.csv', header = 0)
# identify ... |
d64ed5c9725d56ec30c77b7b12ffc0ddb9d3ef983612daab254df91a73a33894 | Python | 1,997 | 70 | __author__ = "Johannes Köster, Julian de Ruiter"
__copyright__ = "Copyright 2016, Johannes Köster and Julian de Ruiter"
__email__ = "koester@jimmy.harvard.edu, julianderuiter@gmail.com"
__license__ = "MIT"
from os import path
from snakemake.shell import shell
# Extract arguments.
extra = snakemake.params.get("extr... |
300b3ee62f06b36851e472092ee93d2e8f83b39911343fd442931223d762fbd6 | Python | 1,998 | 58 | import os
import scipy.signal
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
class LossHistory():
def __init__(self, log_dir):
import datetime
curr_time = datetime.datetime.now()
time_str = datetime.datetime.strftime(curr_time,'%Y_%m_%d_%H_%M_%S')
sel... |
470601f8b893c343ef435248ef58eed9517a962ad517e6230cdaa3b2c87e5986 | Python | 1,998 | 71 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unetsl.data
import sys
import skimage.transform as transform
import math, numpy
from matplotlib import pyplot
def getCropStride(stride, angle):
"""
Gets the stride required for the corresponding rotation angle.
"""
new_stride = [int(s) for s ... |
ae248b15355eaca21fc74d912d27fcd9140272b83008600d178c027c821b0d01 | Python | 1,998 | 42 | BUNDLE_RECO_2_AFQ = \
{
"AF_L": "Left Arcuate", "AF_R": "Right Arcuate",
"UF_L": "Left Uncinate", "UF_R": "Right Uncinate",
"IFOF_L": "Left Inferior Fronto-occipital",
"IFOF_R": "Right Inferior Fronto-occipital",
"CST_L": "Left Corticospinal", "CST_R": "Right Corticospinal",
... |
3dd3a1b42fea6a7a254475aa5d322cae643a6991f65d9c63f025ade0d9ff7ce1 | Python | 1,999 | 46 | import unittest
from linkml_runtime.utils.introspection import package_schemaview
from oaklib.datamodels import search_datamodel
from oaklib.datamodels.search import create_search_configuration
from oaklib.datamodels.search_datamodel import SearchProperty, SearchTermSyntax
TEST_PROPS = [SearchProperty.LABEL, SearchP... |
cac655c48188e62a18584d2fea7128f9ecc9a15654e023527b3ca037c1b08e66 | Python | 1,999 | 55 | """
Tests fallback neighbor search on a small 2d grid
that was calculated manually
"""
import numpy as np
import torch
import pytest
from ..neighbor_search import native_neighbor_search
# Manually-calculated CSR list of neighbors
# in a 5x5 grid on [0,1] X [0,1] for radius=0.3
indices = [0, 1, 5, 0, 1, 2, 6, 1, 2, ... |
f295f79e9ac7a45057d8d82e947eab9c2d29e1a0ca063468be81eee3bce63c0c | Python | 1,999 | 47 | # 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... |
cb1572a8e0a7f084900163a4c7ceb1e1eb5429d5f8477a19d38b0731b4735879 | Python | 2,000 | 59 | import os, re
from snakemake.shell import shell
import tempfile
__author__ = "Ryan Dale"
__copyright__ = "Copyright 2016, Ryan Dale"
__email__ = "dalerr@niddk.nih.gov"
__license__ = "MIT"
_config = snakemake.params["fastq_screen_config"]
subset = snakemake.params.get("subset", 100000)
aligner = snakemake.params.get("... |
123e9e722f38d6adaaca2c65eccebf40384d083a4a1c19bbc0db4a9f70378979 | Python | 2,002 | 67 | #!/usr/bin/env python
import os
import sys
from pathlib import Path
asr_result = sys.argv[1]
mt_dir = sys.argv[2]
file = sys.argv[3]
output_dir = sys.argv[4]
def get_asr_dict(file):
asr_dict = dict()
with open(file, 'r') as f:
for line in f.readlines():
line_split = line.split()
... |
adab682eefa7545adaf18afd20372090f4be4fd1c0cd95ca32fe14b8412b6e08 | Python | 2,004 | 54 | import json
import operator
from typing import Tuple
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.service.predictors.predictor import Predictor
from scicite.data import read_jurgens_jsonline
from scicite.helper import JsonFloatEncoder
from... |
c2feaa33ed81690d00795dd283a4898cd90e0831973cc4a5820070270c9afe2b | Python | 2,005 | 74 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import unetsl.cli_interface
from unetsl.cli_interface import getFilePrompt
import unetsl.model
import unetsl.data
import keras
from matplotlib import pyplot
import numpy
import pathlib
import sys
def main(args=None):
print("usage: show_image ... |
481aacaa7696b3b5eb8a89a027c18ccb7c441401689f2a8ee24761d3d753c71f | Python | 2,006 | 57 | # 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... |
8671b8861be61080b119bc921dd36f045522b05570ad18e3f8d6836c8a8f8baa | Python | 2,006 | 50 | import gseapy as gp
import urllib
import requests
def load_geneset(name: str,
link: str = None,
download: bool = True):
"""
Input:
name: str, if downloading using defaut links ('scsig','Hallmark','KEGG')
link: str, either url for downloading gmt or dir to gmt
... |
914f84ec5fe5dc518c1dec6586bdffe35099388ac8caceab07760156fe555f67 | Python | 2,006 | 62 | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='gcpds-databases',
version='0.2',
packages=['gcpds.databases'],
autho... |
92df4e3d118c9aac0b7525ce353d3320a6f816f2bf7c31f060d4163e2472262a | Python | 2,006 | 73 | 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_rdpg
from src.utils import... |
c038e2ba7b8659929d4ee7d4a1aabf50dca53af2d4b1d2be03fe0f0ea59f444f | Python | 2,006 | 82 | import pickle
import argparse
import numpy as np
from ezephys import stimtools as st
# PARSE COMMANDLINE ARGUMENTS
parser = argparse.ArgumentParser()
parser.add_argument(
'output',
help='Path to save output. '
'Pickled dict with ser_input and gaba_input as attributes.',
)
parser.add_argument('--dt', ty... |
ce91c85d7d240dae24105e8ad16e33cfeb238e9e3a92b0b7c0e6918f6d2c9378 | Python | 2,006 | 73 | """
This module provides the `FileSampler` base class, which defines the
interface for classes that draw samples from a particular file type.
We recognize that there is confusion regarding the different samplers
Selene implements and will resolve this issue soon.
"""
from abc import ABCMeta
from abc import abstractmet... |
f9b5044d3f598061f0c4cea19c529b8b73e0f63b3b2a4c40a5201bb3eb78c34a | Python | 2,006 | 51 | import torch
from torch.autograd import Function
from .._ext import roi_align
# TODO use save_for_backward instead
class RoIAlignFunction(Function):
def __init__(self, aligned_height, aligned_width, spatial_scale):
self.aligned_width = int(aligned_width)
self.aligned_height = int(aligned_height)
... |
90892fff569e0335e15fdc9b180c8b393fc9ffa6f543de2977b796827773c669 | Python | 2,007 | 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... |
a9b0e9621ee202dcee3cd07bd50fad89d5a7810e09f146d935b284f28b89d481 | Python | 2,007 | 57 | from configparser import ConfigParser
import numpy as np
from sklearn.metrics import accuracy_score
def split_prediction(y_pred, y_true, obj_proj):
"""Compare class predictions for images corresponding to different objects
"""
total_num = y_pred.shape[0]
num_obj = total_num // obj_proj
assert total... |
99dab140bd1aae111932bdffd0746225d496d973ec50453d2a897b89a4336622 | Python | 2,008 | 66 | # -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
First Version: Created on 2020-05-13 (@author: Ge-Peng Ji)
"""
import os
import torch
from torch.utils.data import Dataset
import cv2
from Code.utils.on... |
ab7cbd9a296ae9deb112fdef88c45d40488684fee4ccd56f5b16db7995b632e2 | Python | 2,008 | 49 | import numpy as np
import matplotlib.pyplot as plt
x, y = np.loadtxt('TSSA_tristable_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('TSSA_tris... |
e3edfddd0f28778ef9f608b4c0e0483878c625b50850688792fd7a01c56d161c | Python | 2,011 | 64 | import threading
from backend import training
from backend import training_jobs
class Settings:
models = {}
def options():
return {'training_type': 'detection', 'epochs': 2, 'lr': 0.001}
def test_training_job_reports_progress_and_completion():
def train(_images, _targets, _options, _settings, callbac... |
7618dc24ed1a7db8229d911d468c7cbc13c4a3d4b07d50d58598a12f10bfa175 | Python | 2,012 | 69 | from typing import Any, List, Optional, Dict
from zencfg import ConfigBase
from .distributed import DistributedConfig
from .models import ModelConfig, FNO_Medium2d
from .opt import OptimizationConfig, PatchingConfig
from .wandb import WandbConfig
class SolutionModelOptConfig(OptimizationConfig):
n_epochs: int = ... |
895b999f486210d6ded46fe4b4004dca0fc8f9613b1d421111d8ce1c0358fe82 | Python | 2,012 | 72 | import math
import torch
import numpy as np
def log_mean_exp(x, dim=1, keepdim=True):
m = torch.max(x, dim=dim, keepdim=keepdim)[0]
rslt = m + torch.log(torch.mean(torch.exp(x - m), dim=dim, keepdim=keepdim))
return rslt
def nll_bernoulli(theta, x):
nll = - torch.sum(x * torch.log(theta) + (1 - x) *... |
0d2b3449b47d2ee446590392659b8da90545803564ba0ab87cdba80a24c84f15 | Python | 2,014 | 55 | import os
import shutil
import torch
import math
from torch_fidelity import calculate_metrics
from torchvision.utils import save_image
from tqdm import tqdm
import copy
import argparse
import shutil
import curriculums
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('generat... |
454d238c10db3d3b1ac3415f037eef62722ecbbe2ccfebb288a146604a55bc4a | Python | 2,014 | 69 | import torch
from PIL import Image
import json
from torch.utils.data import DataLoader, Dataset
import os
import pandas as pd
import numpy as np
import cv2
image_folder=r'/all_image_path'
all_file=os.listdir(path)
class tcgaataset_byol(Dataset):
def __init__(self,
df,
transform=No... |
3a0a50471cfac0fca95de4cf08fb403225c679b0bf366d6c914fac6e99381228 | Python | 2,015 | 64 | import os.path as osp
import subprocess
import sys
from collections import defaultdict
import cv2
import mmcv
import torch
import torchvision
import mmdet
def collect_env():
"""Collect the information of the running environments."""
env_info = {}
env_info['sys.platform'] = sys.platform
env_info['Pyt... |
e191069fcda879a422367b939b208f3aade1346d19604875f672745f1b0db7fd | Python | 2,016 | 72 | # 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... |
06c8c8cfcb05a3d2d4325870d77dced4323e5ced63e42f2f0499497e8f687b48 | Python | 2,017 | 75 | import random
import torch
import numpy as np
import matplotlib.pyplot as plt
from graphxai.explainers import GNN_LRP
from graphxai.explainers.utils.visualizations import visualize_subgraph_explanation
from graphxai.gnn_models.node_classification import BA_Houses, GCN, train, test
from old.new_BAshapes import ShapeGGe... |
797a1a3ef1f8b8570b99f52204951b6e550d1b13828470b994926ff7c4ef904d | Python | 2,017 | 56 | # 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... |
0432848eba02f895950a5307c51febe3ba762c5d7b508802460fdf891f5ac9b7 | Python | 2,018 | 43 | ##########################################################
## ccAF: calculatingErrors_Whitfield.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
20b9504efd36795ae5d3a0c80ebb2a6084c795efc857a4275eccd0816d1103d9 | Python | 2,018 | 64 | import sys
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import Module
from maskrcnn_benchmark.utils.module_flops_comp import MODULE_FLOPS_COMP
class Complexity(object):
__all_modules__ = (nn.Conv2d,)
"""docstring for Complexity"""
def __init__(self, mode='flops', module_flop... |
3412b3e2387835039f41b381a4b8278d4712c93cc7b0529ed2441d9c094b13b5 | Python | 2,018 | 51 | from functions import *
import braket.circuits
from qiskit import *
from datetime import datetime
import boto3
from braket.aws import AwsDevice
from braket.devices import LocalSimulator
from braket.circuits import Circuit
from functions import ionqDict2qiskitNotation
import re #regex for parsing circuit to ionq
#
#NOT... |
7f9f6ca1aae93ab5bd0bea5e2c9e044645ce052d1f40b3f148110721123e4968 | Python | 2,018 | 62 | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ impor... |
d2e05cd08ca0f7abebdda87eddc581a4a463152d2010504894510321d30b5930 | Python | 2,018 | 62 | # 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_psiver_raw(pdbid, filename):
pvfile = open(filename)
lines = pvfile.readlines()
line_ix = ... |
313335b21272752083c4b5172e7a8dfcaed0e43ebc2eee8543c6d828606d0ea8 | Python | 2,019 | 89 | #!/usr/bin/python -i
#
# Loads an acoustic model and a lexicon, and enters Python
# interactive mode, so that you can debug the lex prefix
# tree using Toolbox::print_tp_lex_node(node_id).
#
# Arguments:
# model-directory
# speech-directory
# output-file
# -a acoustic-model [basename]
# -l language-model [sta... |
15e08b2874a847b933a745b2a9535037cb91ea3693f078983df0c5eb1f96ad81 | Python | 2,020 | 33 | __author__ = 'jieqing jiao'
__contact__ = 'jieqing.jiao@gmail.com'
import numpy as np
import nibabel as nib
import os
from niftypad.tac import Ref
from niftypad.image_process.parametric_image import image_to_suvr_with_reference_tac
# dt
dt = np.array([[0, 5, 10, 15, 20, 25, 30, 40, 50, 60, 120, 180, 240, 300, 450, 60... |
b867bd07a95e15cbdd04d561003a1a81e19c31ca8f8e0c2465aa8919a7d43c81 | Python | 2,020 | 42 | # 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... |
c9b87fc6544a77dbc5a76b3658ba97884d17878f3cf98e6f16d11fa7325d8244 | Python | 2,020 | 74 | """
File: group.py
Created: 2020/03/19
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Lic... |
9e15cf56d4741a6c0764195e77676bacb32e1cd9339dcdc885cb07edd61a6645 | Python | 2,021 | 63 | import argparse
from tqdm import tqdm
import numpy as np
import pandas as pd
from lib import skel, compartment, u
def main(cellidfilename, outputfilename, branchtype="full"):
ids = u.readids(cellidfilename)
celldfs = list()
for i in tqdm(ids):
celldfs.append(branchsegstats(i, branchtype))
... |
3bba97d66755b3495ed723c354bac235e3659a96895f1609a9867c63d10e319e | Python | 2,022 | 77 | from ..burgers import Burgers1dTimeDataset
from ..darcy import DarcyDataset
from ..navier_stokes import NavierStokesDataset
from pathlib import Path
import os
import shutil
import pytest
test_data_dir = Path("./dataset_test")
@pytest.mark.parametrize("resolution", [16])
def test_DarcyDatasetDownload(resolution):
... |
57c0f9d679c7f9c37904b426a9219cfb413ffa022a52b656913de1a685f825aa | Python | 2,022 | 48 | # basic imports
import numpy as np
import pickle
import matplotlib.pyplot as plt
def plot(data: dict, file_name: str):
'''
This function plots the learning performance of agents trained with SFMA and random replay.
Parameters
----------
data : Dictionary conta... |
c1017e02687417df76f25f9e0c7799a021448de81da86aa8bd95e9ad66687561 | Python | 2,022 | 71 | # Importing bunch of libraries
import os
import random
import time
import cv2
import numpy as np
import torch
from skimage.io import imread, imshow
from skimage.transform import resize
from model import UNet
# Specify Image Dimensions
IMG_WIDTH = 128
IMG_HEIGHT = 128
IMG_CHANNELS = 3
seed = 42
random.seed = seed
de... |
42b852379c2a71b61547cd3f4602bea605d5e29f5bd112309766ec91229ca8ae | Python | 2,023 | 64 | import torch
from .conv_ws import ConvAWS2d
from .registry import CONV_LAYERS
import torch.nn.functional as F
@CONV_LAYERS.register_module('MDConv')
class MDconv(ConvAWS2d):
def __init__(self,
in_channels,
out_channels,
kernel_size,
stride=1,
... |
abcb579708c6647f5013938ee78ffb70fa2d9c0012d2b5290ce61bbf4e798ec8 | Python | 2,025 | 54 | # Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# 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, c... |
ba95428d0d31b54bd0296de93c8f698c49fceeb1626ba3e3ecca6fabe22ac28f | Python | 2,025 | 84 | # -*- 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 = np.logspace(-3, 0, 11)
# setting - EnumLasso
rho = 0.01
ratio = 3
maxitr = 100... |
346d18d03f9683d3bd166d308253e6dc62ac5e4f32be99505a8eca85d1f70573 | Python | 2,026 | 63 | # TODO(julia): remove this file
import torch
import roboscientist.equation.operators as rs_operators
from scipy.optimize import minimize
import numpy as np
def _loss(constants, X, y, equation):
y_hat = equation.func(X, constants)
loss = (np.real((y_hat - y) ** 2)).mean()
return np.abs(loss)
def optimi... |
ee547e1b3282ecd37c58d041403eb94dfd1648c3fc482618afc0a79a8c90b7c4 | Python | 2,026 | 57 | #%%
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
# allows text to be editable in Illustrator
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
# font settings
plt.rcParams['font.size'] = 5
plt.rcParams['font.family'] = 'arial'
# data collected from Be... |
bb15624ccf86df839a577ed0674df145dbef096e004ecda1b4de5c45634a60c2 | Python | 2,028 | 76 | import os
from Cython.Distutils import build_ext
import numpy as np
from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), "README.md"),
encoding='utf-8') as readme:
long_description = readme.read()
genome_mo... |
4ca851716d81c4e1d32ed5dd7b98320219385402c6d20eef6b3bbea26c02e328 | Python | 2,029 | 63 | import os
import pandas as pd
from chemproppred.utils import *
def make_screening_data(data_folder, df=None, data_path=None, name=None):
# read in screening data
if not os.path.exists(data_folder):
os.makedirs(data_folder)
if data_path:
df = pd.read_csv(data_path)
df["monomer"] = df[... |
ff7cbcc5fcb31d3d5a1bfc1412ff7d502bb66b4354291b3ed2bbd65d88d15035 | Python | 2,029 | 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 agreed to... |
6357b0c598542098fcb12721f5b24e6b573472f2653c3d79b613b515e6ac8bbd | Python | 2,030 | 48 | from spike2calcium 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.unique(cell_info)... |
c86d83385bf56e48f52b067042289fa509257afcb7775e6358806150be040736 | Python | 2,031 | 67 | # 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... |
001c8aad82fdfc3ed40388cca66df88eaae6b8ec2fc35e60a61490f58507d90d | Python | 2,033 | 59 | # 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... |
09ac8d1c5c9c17dbbce1982341e3b86d3082a8c766eb68a351e4447c14ccb91d | Python | 2,033 | 84 | """
Must do:
source activate DLC-CPU first!!!!
"""
print('\n FigS1-1 executing ... \n')
import sys
import os
import deeplabcut
# import utils.general_utils as general_utils
root=os.path.abspath("../../")+'/'
print(root)
NAS_Dir=root
NAS_AN_Proj_Dir=root+'Ascending_neuron_screen_analysis_pipeline/'
AN_Proj_Dir = ... |
702418f1d8347406cf803e13e297c905bea20b36fcd130c5e7fb1b7fc0111975 | Python | 2,033 | 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... |
92d2ddae45a0089b932d75e673a1a46be671a56cf573f7d156d81a237895462b | Python | 2,034 | 52 | from utils.decomposition import LDADecomposition
from utils.decomposition import ParafacDecomposition
from utils.decomposition import GloVeDecomposition
from utils.decomposition import TransformerDecomposition
from utils.ArticlesProvider import ArticlesProvider
from utils import Config
from utils.postprocessing import ... |
d82a50116c733f9aad0f15c87fe32b79571b51699a1485bc9192e1a6e3d6e816 | Python | 2,034 | 41 | import pandas as pd
import numpy as np
import AIS_parameters
# import ship_pairing_analysis
import PIL
import tqdm
import functions_basic_sak as fun_sak
import os
##
jpg_lookup = fun_sak.file_lookup(endswith='.jpg')
##
df = pd.read_feather( AIS_parameters.files['ship_truth_data_original'])
##
tf = df.l... |
ddc41acc194d41267e8627f3117fb1efb35b12f69d9264bf8941325a8c44ddf0 | Python | 2,034 | 62 | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import zarr
import numpy as np
import pandas as pd
from glob import glob
from skimage.measure import regionprops
from skimage.io import imread
from os.path import abspath, dirname
if __name__ == "__main__":
label_path = sys.argv[1]
puncta_path = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.