sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c65bb2d1184ac37d5653c8298c2248da523c8253dc15b31a8a8c6f6c776ff57d | Python | 1,746 | 71 | """
Auxiliary classes for RACCOON
F. Comitani @2022
"""
from math import sqrt
class IdentityProjection:
""" To be used when the target space dimensionality corresponds to the input space
and the dimensionality reduction step should be skipped. """
def __init__(self, **kwargs):
""" Initia... |
4ebbeb2f07676ff42844f0d3fced213ff53cfa08b500be76229dcce1b96a93a6 | Python | 1,747 | 48 | import pandas as pd
def get_paired_inds(meta, check_in=True, pair_key="pair", pair_id_key="pair_id"):
pair_meta = meta.copy()
pair_meta["_inds"] = range(len(pair_meta))
# remove any center neurons
pair_meta = pair_meta[pair_meta["hemisphere"].isin(["L", "R"])]
# remove any neurons for which the ... |
a341f0ca376fea14c70bcc7fa818ba0483fc517b35741eebb9864685ee8e7f80 | Python | 1,747 | 42 | from setuptools import setup, find_namespace_packages
import os.path as op
import os
def package_tree(pkgroot):
"""Get the submodule list."""
# Adapted from VisPy/MNE-Python
path = op.dirname(__file__)
subdirs = [op.relpath(i[0], path).replace(op.sep, '.')
for i in os.walk(op.join(path, ... |
0f4c1706e432394b38624f6766db8e338d0489b757977bbf91eb96773409da5d | Python | 1,748 | 57 | from typing import Optional, Tuple
import norse.torch as snn
import torch
from norse.torch.functional.lif import LIFParameters, LIFState
from norse.torch.module.exp_filter import ExpFilter
from cgtasknet.net.save_states import save_states
default_tau_filter_inv = 223.1435511314
class SNNLif(torch.nn.Module):
r... |
e62be1a951714cd45b028f0c42a2c5f8ca58bde0764ab22a55d427b7c592ffc7 | Python | 1,748 | 47 | import os, shutil
import unittest
import numpy.testing as nptest
import mesh
import FBEM
import simulation.parallel_with_threads as pwt
rtol = 10 ** - 8
atol = 10 ** - 8
def run_simulation(folder, size):
sphere = mesh.sphere_create('sphere', radius=size, velocity=(1, 0, 0), grid=3)
FBEM.run(sphere, folder)
... |
03498feb3efa13835015ceed0665a136227c7f47a1aeea50db2629be7f9c7be9 | Python | 1,749 | 51 | # @author: Miroslav Kuchta
from src.fem.utils.embedded_mesh import EmbeddedMesh
from src.fem.utils.petsc_matrix import transpose_matrix
from src.fem.utils.trace_restriction import trace_matrix
from src.fem.utils.subdomain_restriction import restriction_matrix
from functools import reduce
def preduce(comm, op, iterab... |
b5b6cdc25463bf6bb7394640614a5a082f577860611dfe3e8257e70117e867ce | Python | 1,749 | 51 | from collections import defaultdict
import numpy as np
from tqdm.notebook import tqdm
import torch
def get_predictions_of_dl(model, dl, latent_samples=0):
outputs = defaultdict(lambda: [])
info = defaultdict(lambda: [])
if latent_samples > 0:
latent = []
if len(dl) > 300:
wrapper = tq... |
c60ef0698afe8d9843abff3e98de2b2a021b1f41191fe6c8778d2f443d97c16b | Python | 1,749 | 55 | import numpy as np
import nibabel as nib
import dipy.core.gradients as dpg
def prepare_data(data_files, bval_files, bvec_files, mask=None,
b0_threshold=50):
"""
Parameters
----------
data_files : str or list
Files containing DWI data. If this is a str, that's the full path to ... |
2f8344f9dcef1c8d1ff9fa492093064f5340f2a5e9e7fdf71a2f3f92d0616e14 | Python | 1,754 | 57 | """
Description:
This script is used to create the file `TF_intervals.txt` from the file
`sorted_deepsea_data.bed` that was created by running
`process_chromatin_profiles.py`. `TF_intervals.txt` is used as input
to a `selene_sdk.samplers.IntervalsSampler` and contains only the
regions in `sorted_dee... |
d563a2ef3848c3de9f438eafb47038268a26dfbaa1108a16b4bf993034e9bdfc | Python | 1,754 | 40 | import argparse
import requests
parser = argparse.ArgumentParser(description='Compare LD between metabrain and eqtlgen')
parser.add_argument('topSNPs', help='File with the top SNPs for metaBrain and eqtlGen (gene in column 1, rs1 in column 2, rs2 in column3)')
parser.add_argument('ldlink_token', help='Token for API ac... |
54f38de687a62e44355fd27c370562f39b558b70a04bff87c5c3febc9b8cc53c | Python | 1,755 | 47 | # 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... |
5900d6b95980f3a1890644a38e499cad8b7d2c350e130da265cbf8af1ea9f49f | Python | 1,755 | 60 | import unittest
from kgcl_schema.datamodel.kgcl import Change
from kgcl_schema.grammar.render_operations import render
from linkml_runtime.dumpers import yaml_dumper
from oaklib.utilities.kgcl_utilities import (
parse_kgcl_files,
substitute_curies_for_labels,
substitute_labels_for_curies,
write_kgcl,
... |
c05e1d35a3659e9973fe810f1e1cd4e4c2aca2bb6f2697c7f4a435286f311b44 | Python | 1,755 | 52 | # Cylindrical and axisym operators
# @author: Miroslav Kuchta
# NOTE: axis ordering e_z, e_r, e_theta is assumed
import dolfin as df
def Grad(u):
'''Gradient in cylinderical (z, r, theta) coords'''
z, r, th = df.SpatialCoordinate(u.ufl_domain().ufl_cargo())
# Scalar
if u.ufl_shape == ():
ret... |
e0702353c470e06451544e2be5b671fe81d6bdb1c90f1d8d9dfc064559d0ccab | Python | 1,758 | 20 | import sys
sys.path.insert(0, '.')
from svgkit import Svg, C, render_png
# Server-side sensor pipeline: sensor actor in the Carla plugin -> serializer (LibCarla server) -> stream -> client -> Python.
W, H = 1260, 330
s = Svg(W, H)
s.text(W / 2, 40, "Communication pipeline of a server-side sensor", size=24, weight="bold... |
e5b3cdc81790b895633249817444be349df900004839c0c59edc4147e8b6c94e | Python | 1,759 | 45 | import pandas as pd
import statistics as stats
import sys
import tabix
# usage: intron_coverage.py <gene_name> <mosdepth_per-base_cov> <gene_regions.bed>
# where mosdepth_per-base_cov is the per-base coverage bed file (eg sample.per-base.bed.gz) output by mosdepth when '-n' argument is excluded
# gene_regions.bed is ... |
6815544d539ec1a99b1846e8cfd9b1e6407d605597c82598856f59a9f0c343b3 | Python | 1,760 | 53 | """
Written by Nathan Neeteson
A class to encapsulate the logic for calculation of learning rate and momentum
using linear interpolation.
"""
import numpy as np
# it is useful to encapsulate the logic this way because in the future we may
# want to use some other method for scheduling learning rate and momentum
# an... |
6d8c9e9344fa8ecbb6cdc444fa81886971ec86f1b9934335b5cf7b5d1dbbc796 | Python | 1,760 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 3 09:53:01 2022
@author: spiros
"""
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from opt import mystyle
# Make plots nicer!
plt.style.use("tableau-colorblind10")
plt.rcParams.update(mystyle())
dirname... |
4664a1097811f30c982ab844c32caa14f5b558b9301511dac4314d6110ebecbc | Python | 1,761 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 3 09:53:01 2022
@author: spiros
"""
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from opt import mystyle
# Make plots nicer!
plt.style.use("seaborn-colorblind")
plt.rcParams.update(mystyle())
dirname =... |
9ec860aa9dbff831857dc00f250e06448953c0f2cc40367ebf2531971fab4a45 | Python | 1,761 | 59 | from .diverse import *
from torch_geometric.nn import MessagePassing
from torch_sparse import matmul
class MinimalJumpsConv(MessagePassing):
def __init__(
self,
out_channels,
x_dim,
dropout=0.0,
aggr="mean",
moments=[1],
f_inner_width=[128, 64],
**kw... |
3963e9cbfb8ec8cc26f11802eb0ea46e25d01bd3b53f5a8d89eae9aa8e30e85f | Python | 1,762 | 47 | # 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 a... |
726586d295775df73bfea6f8d7eb4b15ab7c8c857fbbee0a9d0ab5c7e274fabf | Python | 1,762 | 55 | from typing import Any, List, Optional, Dict
from zencfg import ConfigBase
from .distributed import DistributedConfig
from .models import ModelConfig, GINO_Poisson2d
from .opt import OptimizationConfig, PatchingConfig
from .wandb import WandbConfig
class MGNOPoissonOptConfig(OptimizationConfig):
n_epochs: int = ... |
082fcde4bfe2374a42bbea1d0127f2201d4c84f69b79b1a70499fd21b1c22801 | Python | 1,765 | 52 | # Hard-coded for convert metadata into phoneme
import tqdm
from g2p_en import G2p
from argparse import ArgumentParser
def write_metadata(metadata, out_file):
with open(out_file, 'w', encoding='utf-8') as f:
for m in metadata:
if m is None:
continue
f.wr... |
f083f0641028d8ca376164ce89fcc5b70b5875e4787e6ae3b46ef413745417c7 | Python | 1,765 | 61 | import cProfile
from optparse import OptionParser
import pstats
import mne
from eelbrain import *
import eelbrain
mne.set_log_level('warning')
eelbrain._stats.testnd.multiprocessing = False
# option parser
parser = OptionParser()
parser.add_option("-m", "--make", dest="make", metavar="KIND",
help=... |
16957d18f127373426ee67e45e3ac0121d322b318e7bc93fdafe5c88f90e80c4 | Python | 1,766 | 52 | import torch
import torch.nn.functional as F
from torch_geometric.nn import global_mean_pool
from torch_geometric.nn import GINConv
class GIN_2layer(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels):
super(GIN_2layer, self).__init__()
self.mlp1 = torch.nn.Linear(in_ch... |
a0448e0268937266d8cb68c92e8817505b88db0c4e85c20d135b3430070a7be1 | Python | 1,766 | 49 | from typing import List
import torch
from tqdm import tqdm
from chemprop.data import MoleculeDataLoader, MoleculeDataset, StandardScaler
from chemprop.models import MoleculeModel
def predict(model: MoleculeModel,
data_loader: MoleculeDataLoader,
disable_progress_bar: bool = False,
... |
be5869f9edb5fb27b43288a9a051306804fcc660b3819b181de752dd5f7f0b66 | Python | 1,766 | 68 | """Snakemake wrapper for bwa sampe."""
__author__ = "Julian de Ruiter"
__copyright__ = "Copyright 2017, Julian de Ruiter"
__email__ = "julianderuiter@gmail.com"
__license__ = "MIT"
from os import path
from snakemake.shell import shell
# Check inputs.
if not len(snakemake.input.sai) == 2:
raise ValueError("inp... |
9f8e2ea534263ed71535fc6aa75963ea89016a85accff847d30bf5c6b99729fe | Python | 1,768 | 43 | # 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... |
efbdaaa4a5422c9d1f58c0a7be44ea394c1235fcc1e41d02787af1461b36a6a6 | Python | 1,768 | 49 | import importlib
import re
from typing import Optional, Type, Union
from oaklib.datamodels.obograph import GraphDocument
from oaklib.implementations.obograph.obograph_implementation import (
OboGraphImplementation,
)
from oaklib.interfaces import OboGraphInterface
from oaklib.interfaces.dumper_interface import Dum... |
246a41cc3c6f8254ab473687daf27994860f135091f5d85bdeeeaa6d501378a5 | Python | 1,770 | 63 | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
version = open("raccoon/_version.py").readlines()[-1].split()[-1].strip("\"'")
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
... |
5284495a2c67e5f47d40c03f11915e95b57fba50b428f2abe12d8d32e0197a14 | Python | 1,770 | 56 | """Library entry points for CROPro."""
from __future__ import annotations
import random
from typing import Any
import numpy as np
from .config import CropConfig
class CROPro:
"""Run CROPro cropping from Python code.
Parameters may be provided either as a :class:`CropConfig` or as keyword
arguments ma... |
9bbbbbd40db96827f51bd248f2d0584055d3f404c0199c8434e04a9aafa3d84a | Python | 1,770 | 51 | from Bio.PDB import *
from default_config.chemistry import radii, polarHydrogens
"""
xyzrn.py: Read a pdb file and output it is in xyzrn for use in MSMS
Pablo Gainza - LPDI STI EPFL 2019
This file is part of MaSIF.
Released under an Apache License 2.0
"""
def output_pdb_as_xyzrn(pdbfilename, xyzrnfilename):
"""
... |
fe71e00af2305a9481070848b51562ebd8851499e3a18b579565e0799a78c260 | Python | 1,770 | 42 | # Parse GTEx cram files to make molgenis-compute samplesheet
import os.path
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for GTEx.')
parser.add_argument('samplesheet', help='Enter delimited file with List of GTEx cramfiles')
parser.add_argument('fastq_dir', help='pat... |
4a8de45f1b768697111972d6cd592561fd4723ed5174f6351bf7bdd5aed0f5d2 | Python | 1,771 | 53 | import numpy as np
from numpy.linalg import norm
import pymesh
"""
fixmesh.py: Regularize a protein surface mesh.
- based on code from the PyMESH documentation.
"""
def fix_mesh(mesh, resolution, detail="normal"):
bbox_min, bbox_max = mesh.bbox;
diag_len = norm(bbox_max - bbox_min);
if detail == "norma... |
900d9a8e39ac8019f6cbb272b72405c1d9d4cc923ef8aa4f5e2098b90f6e0505 | Python | 1,771 | 44 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
aad18b1b1e222ee773c9ce16fc7edd7736d063466b14a8fc0e10fbeb8a48d30a | Python | 1,771 | 65 | """
Hierarchical tree functions for RACCOON
F. Comitani @2020-2022
"""
import os
from anytree import Node
from anytree.importer import JsonImporter, DictImporter
from anytree.exporter import JsonExporter
def build_tree(table, out_path=None):
""" Set up a anytree object with useful information on
the h... |
1a75d44912fd1142acaca9386a7b07a1093a377f63a15c1dd6906c8f118a661a | Python | 1,772 | 57 | import torch
import os
import shutil
def save_checkpoint(state, is_best, checkpoint='checkpoint', filename='checkpoint.pth.tar'):
filepath = os.path.join(checkpoint, filename)
torch.save(state, filepath)
if is_best:
shutil.copyfile(filepath, os.path.join(checkpoint, 'model_best.pth.tar'))
class A... |
58578c5b42ef02144021052207d0031e540267d8fa7e53593635eed3ff3f3a13 | Python | 1,772 | 46 | import logging
import unittest
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.implementations.sqldb.sql_implementation import SqlImplementation
from oaklib.resource import OntologyResource
from oaklib.datamodels.vocabulary import IS_A, PART_OF
from oaklib.utilities.sub... |
c262e2eb1477ee4e90f13700e0e6a3a78f84583b6a51d34f2a41213d04826dba | Python | 1,772 | 60 | import os
from unittest import TestCase
import pandas as pd
from drugex.molecules.mol import DrExMol
from drugex.molecules.suppliers import ListSupplier
from drugex.parallel.evaluator import ParallelSupplierEvaluator
class TestFileParsers(TestCase):
@staticmethod
def getTestFile(name):
return f'{os... |
6ca4ddc04332cf1286463f9f2161a2d2f705409ef3d49dfdb8307ad57c1883a5 | Python | 1,773 | 38 | import torch
from torch.autograd import Function
from .._ext import roi_pooling
import pdb
class RoIPoolFunction(Function):
def __init__(ctx, pooled_height, pooled_width, spatial_scale):
ctx.pooled_width = pooled_width
ctx.pooled_height = pooled_height
ctx.spatial_scale = spatial_scale
... |
fe8c6772e9bfd54321f51f96b989c0604fd00954e937b9ccf2df9f072c9f7ae4 | Python | 1,773 | 47 | """
© 2022, ETH Zurich
"""
import os
import pandas as pd
import xgboost as xgb
from rescoss_logp_ml.data_handling.data_handling import load_dataset
from rescoss_logp_ml.utils import SEED, get_output_dir
from sklearn.metrics import mean_absolute_error, mean_squared_error
class XGBModel(xgb.XGBRegressor):
def __... |
26d14091d4aaef68a794dea25653bd3d88514d351899c9208d05914ff043a9b3 | Python | 1,775 | 49 | # 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... |
b1506d3bafb90be7fdb45fa9134cc0a22dac8357e840e52a15dbf936c7655c49 | Python | 1,775 | 60 | import ipywidgets # type: ignore[import-untyped]
import nglview # type: ignore[import-untyped]
import pandas as pd # type: ignore[import-untyped]
from IPython.display import display
from ipywidgets import Layout, interact
from rdkit.Chem import rdMolAlign # type: ignore[import-untyped]
from ppqm import chembridge
... |
71af880cf34b8f10c4b746ff43de75a0bea680096130001eec2fc2bc1d74dd96 | Python | 1,776 | 60 | """Snakemake wrapper for fastqc."""
__author__ = "Julian de Ruiter"
__copyright__ = "Copyright 2017, Julian de Ruiter"
__email__ = "julianderuiter@gmail.com"
__license__ = "MIT"
from os import path
from tempfile import TemporaryDirectory
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=False,... |
84332053b266bd938acf3a8a7980b7cbe56c74854ba0ffdd2b81c912b29130c1 | Python | 1,776 | 50 | #!/usr/bin/env python
import numpy as np
from tifffile import imsave
from csbdeep.utils import normalize
from stardist.models import StarDist3D
import argparse, sys, z5py
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='')
parser.add_argument('-i','--input', type=str, help = "z5 input... |
787cad5242afb4ebac91b1cf75be851f72af079c3a30446644adccbb1ad4a273 | Python | 1,777 | 54 | from rfpimp import *
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
df_orig = pd.read_csv("/Users/parrt/github/random-forest-importances/notebooks/data/rent.csv")
df = df_orig.copy()
# attentuate affect of outliers in price
df['price'] = np... |
8da6f198b22b9f698cd0f99c5d09eeaca58ec48804c09576dae50fa33bdac228 | Python | 1,779 | 88 | #!/usr/bin/env python3
import os
import sys
import pandas as pd
from json import load
infolder = sys.argv[1]
cwd = os.getcwd()
os.chdir(infolder)
with open('ica_decomposition.json', 'r') as f:
comp = load(f)
del(comp['Method'])
# Prepare list of components for projections
acc = ''
rej = ''
ign = ''
for n, ... |
6257a5a254bb348132afd8a7616f2fa7efd95f9f16ed91e9eb81f31e3e60995b | Python | 1,780 | 50 | #Copyright (C) 2019 Soeren Lukassen
#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 License, or
#(at your option) any later version.
#This program is distributed in the h... |
8188ea14cbc82c5bdd910b7d7ec2f16c388d38d910821414cf0a210936b475b8 | Python | 1,781 | 35 | # Copyright 2023 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... |
c72a052c8a2e1734653986aa4c018013d2db7a5062b357ed33996dd3ed9383f9 | Python | 1,781 | 51 | from drugex.molecules.converters.default import SmilesToDrEx
from drugex.molecules.interfaces import BaseMolSupplier
class StandardizedSupplier(BaseMolSupplier):
"""
Supplies standardized molecules from the input molecules. It requires a standardizer.
"""
def __init__(self, mols, standardizer):
... |
ccb07614a1fc0d9e0c303f3d174cb40231eda0bfe03859be391f0bec2efd7c6b | Python | 1,781 | 69 | from playhouse.db_url import connect
from sshtunnel import SSHTunnelForwarder
from tables import *
from config import Config
class NMLDB(object):
def __init__(self):
self.config = Config()
self.server = None
self.db = None
def connect(self):
if self.db is not None:
... |
82cee363bd5272c02f0f9a2c7e360b305e5a68811d021e7b625511ba40e057e2 | Python | 1,783 | 53 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
8f11dd47a85a8cf1fe8945c6a9b3870f791c1575f7c6eb4f59547126b69883a8 | Python | 1,783 | 53 | # 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... |
d3546cccff2cf210cbd0078474f212e77ead14dcaf1ce0ae3b13b6eef5640c74 | Python | 1,784 | 34 | """
Module to add high-level semantic return types for obstacle and traffic light detection results via named tuples.
The code is compatible with Python 2.7, <3.6 and >=3.6. The later uses the typed version of named tuples.
"""
import sys
if sys.version_info < (3, 6):
from collections import namedtuple
Obsta... |
755ab86d16e760a64f61f3d7382cbb98e4ddafb5c83371103d4f15bdd7ecda6c | Python | 1,785 | 52 | import numpy as np
import h5py
from h5functions import save_to_h5
import os
if __name__ == "__main__":
output_name = "data/trainG6HR.h5"
# output_name = "data/geometry_2/trainG3HR.h5"
u = np.zeros((72, 392, 52, 52))
v = np.zeros((72, 392, 52, 52))
w = np.zeros((72, 392, 52, 52))
dx_... |
a6d47180a6fe1eff730297f02e34b0a6ca91d758aeabb5b1e584be2666830fc2 | Python | 1,785 | 50 | import numpy as np
import pandas as pd
from scipy import stats
CONFIDENCE = 0.05 # stat confidence at 95 %
new_results = '../results_new_model.csv'
old_results = '../results_old_model.csv'
# Stats
print('Stats...')
df_new = pd.read_csv(new_results, delimiter=';')
df_old = pd.read_csv(old_results, delimiter=';')
... |
008785acb6a274e6af42cf65f04966e8cfad38184b48f8969bf9109eba5a714b | Python | 1,789 | 76 | from enum import Enum
class DataTypes(Enum):
INT = 'int'
INT64 = 'int64'
FLOAT = 'float'
FLOAT64 = 'float64'
OBJECT = 'object'
class StatMeasures(Enum):
MEAN = 'mean'
MEDIAN = 'median'
STANDARD_DEVIATION = 'std'
MINIMUM = 'min'
MAXIMUM = 'max'
PERCENTILE_25TH = '25th_perc... |
2c4f6dca0ee571595f1d5daf2a80f6273de28f4be37719daf582fb190fe9c668 | Python | 1,789 | 62 | """
Put documentation here
"""
__version__ = '0.1.0'
# -----------------------------------------------------------------------------------------------------------
# Analysis configuration - most of this below can be deleted
ferrets = [
dict(
fNum=1311,
rxnTime=True,
method='cool', ... |
a8d01776211d33a05be3b5766e3a1e86bf7702d2b5e64081ff7fe30c0036f215 | Python | 1,789 | 46 | # loop through all subdirs to find all fastq files
import os.path
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for BrianGVEx.')
parser.add_argument('samplesheet', help='UCLA_ASD samplesheet from synapse')
parser.add_argument('cram_dir', help='path to cram file dir fo... |
a986bba12443a499a22fb022e1505217e07364f85d69889481ac5702d0669835 | Python | 1,789 | 48 | import os
if os.getcwd().endswith("UnitTests"):
os.chdir("..")
import unittest
from Classes.QueryParser import QueryParser
from Classes.RelationshipIdentifier import RelationshipIdentifier
class RelationshipIdentifierTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.Identifier = R... |
ff469bf63b158635a54832c9ae2d6970d362a072b787299ad080a317d7337ee7 | Python | 1,790 | 64 | #%%
import pymaid
import pandas as pd
import numpy as np
from src.pymaid import start_instance
start_instance()
def get_indicator_from_annotation(annot_name, filt=None):
ids = pymaid.get_skids_by_annotation(annot_name.replace("*", "\*"))
if filt is not None:
name = filt(annot_name)
else:
... |
57a56c278315af6ed0ff2b56512b30a661e22450f677775b2ebf49bf4462b68b | Python | 1,791 | 62 | from abc import ABC
from typing import Dict, List, Tuple, Any, Iterator
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
import rdflib
from oaklib.types import CURIE, PRED_CURIE
from rdflib import URIRef
TRIPLE = Tuple[CURIE, PRED_CURIE, Any]
RDF_TRIPLE = Tuple[URIRef, URIRef, Any]
class... |
b1d3aca4b0a5b8baae5404f22424ea78937328334d66bfc6344abae3410c0855 | Python | 1,792 | 52 | """Tests for the loss and metrics functions."""
import unittest
import numpy as np
from scipy.stats import pearsonr
from model import pearson_tf, pearson_loss, pearson_metric
class PearsonTest(unittest.TestCase):
"""Test whether the pearson loss/metrics work."""
def setUp(self) -> None: # noqa: D102
... |
d12be8658e01e07edf0935db2acff3d035f3bc3ef9944ed7e26ecc6e3f0e3453 | Python | 1,792 | 75 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import click
import unetsl.comparisons
from matplotlib import pyplot
import numpy
def printRawValues(raw_values, output):
N = 1000
nms = [vdict[pt] for vdict in raw_values for pt in vdict]
mn = min(nms)
mx = max(nms)
y = numpy.zeros((N, ), dtype="flo... |
1fca890eb585017035ca56dbb3c4dc7f2cb0502df6e2056c8ab4fd9976caf504 | Python | 1,795 | 54 | import os
from selene_sdk.sequences.genome import Genome
from src.samplers.dnase_file_sampler import DNaseFileSampler
TEST_REFERENCE_SEQUENCE_FILE = "data/test_data/mini_male.hg19.fasta"
# Contains 11 intervals
TEST_BED_FILE = "data/test_data/samples_for_tests.bed"
class TestDNaseFileSampler:
def setup_method... |
c00f8ce2ddf51585acbfbcf2251b7afbdcbb3535b05683e43e69012162cd4129 | Python | 1,796 | 57 | #!/usr/bin/env python
# -*- coding: latin-1 -*-
#
# Copyright 2016-2019 Blaise Frederick
#
# 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/LICEN... |
e778ac2c4f4cb472c01609973f0465781a2c34e262d6ac90bf080c6a0d47e4dd | Python | 1,796 | 50 | '''
Compares the quality of different models for deciliated fits.
'''
import pandas as pd
from scipy.stats import wilcoxon
from file_management.configuration import *
from os.path import join
table_folder = join(join(config['root'],'Deciliated'), 'tables')
models = ['deciliated_bell', 'deciliated_bell_p2', 'deciliate... |
2a4867d0201ba60c2de85011ab71763bb047afe8961d241810d5e7257ae009e4 | Python | 1,797 | 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... |
830fbfacfaf5eff13f1f5a8eec1c0bc051802fd228c8f929f3d030121fb87b68 | Python | 1,797 | 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... |
13853bb4f95884ed4e93f7b066c623bb0eb6bef85b948a8cf043242c501cfbb4 | Python | 1,798 | 48 | from typing import List
import torch
from tqdm import tqdm
from chemprop.data import MoleculeDataLoader, MoleculeDataset, StandardScaler
from chemprop.models import MoleculeModel
def predict(model: MoleculeModel,
data_loader: MoleculeDataLoader,
disable_progress_bar: bool = False,
... |
1f8c705a632a6e86a3d5e85bd83572f03be769738ca408f34ecc250fa0e7dce7 | Python | 1,799 | 44 | # 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... |
99d5252a63947c916d804120b0809a06abd08cc0fdbc4c9dde602edcec13f022 | Python | 1,799 | 58 | """
Utility functions for working with vtk
NOTE: Not created by Nathan Neeteson.
This is an existing module that is part of Steve Boyd's Bonelab repo. It is
only here so that this repo is not dependent on the bonelab repo. In the future
it will be removed and the bonelab repo will again be a dependency.
"""
import nump... |
e2fb17ac80ea00d7a50f0fc2baffcd8f12d6e9b012aa4c2e5337279c42e434eb | Python | 1,800 | 41 | # 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... |
2dd1d7915a0ac862cf7e63dc33e76f2adaa51802d66feb3b840782f5c1609af1 | Python | 1,801 | 61 | import numpy as np
import pytest
from typing import Callable, Tuple
from multi_phase.utils.losses import focused_mae, FocusedMetric
#-------------------------------------------------------------------------
@pytest.fixture
def create_test_tensor() -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
""" Create test te... |
d8a18ea29df54ca25dcfa6d56a051f8016927bac7148262e0c7f8b9b9d0ff77b | Python | 1,801 | 55 | #!/usr/bin/env python3
"""
BASED ON CODE FOUND HERE https://github.com/ellisdg/3DUnetCNN/tree/master/unet3d
"""
import sys
import pathlib
import shutil
import unetsl.config
import unetsl.cli_interface
import unetsl.model
import unetsl.data
import click
@click.command()
@click.option("-c", "--config-file", type=cli... |
59a172343f2b7c75bf039e4d31d3a2166b079ca3139e39924f3ebd157910b77a | Python | 1,804 | 49 | from dataclasses import dataclass
from typing import Optional
from oaklib.datamodels.obograph import Graph
from oaklib.transformers.graph_transformer import GraphTransformer
@dataclass
class NodeFilterTransformer(GraphTransformer):
"""
An ontology graph transformer that filters nodes
"""
filter_func... |
e7eea136b30228f724691178410fb471fdc5cceb92360ee7fcdbbebe6d488c63 | Python | 1,805 | 42 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
0da1b9543afcd2f551b3d6a3d6416d76ccbdf08d41c11b348ed9fe21eb150574 | Python | 1,806 | 48 | # 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... |
7038abf2c5dc5120e41703e75949aa8a94c84c7f5cb62c4fa0e5c34991e0368b | Python | 1,806 | 57 | import json
from dataclasses import dataclass, field
from typing import Any, Type, Union
from linkml_runtime import CurieNamespace
from linkml_runtime.dumpers import json_dumper
from linkml_runtime.utils.yamlutils import YAMLRoot
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.io.stream... |
f7662f346d84c2d2f53df87c9222a81100dfc64f3bccb82a6e01e472e8dc4ffc | Python | 1,807 | 45 | from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import networkx as nx
import community as community_louvain
from brainNetwork.util.path import get_local_datadir, get_fig_dir
csv_dir = Path(get_local_datadir(),'connectivity_rinse.csv')
connec... |
0fb1c3d7834d215cae0075cff3fd7e15ea0f8aa3d5e3d194ed1f3839cd1c70e5 | Python | 1,808 | 52 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
e1f67686566a2a1b32096a69ab1df926225b4cfffb8982bdcd33dc3be43d2ed4 | Python | 1,808 | 48 | # 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... |
1418e0916ede2a554742e89d13f46d6ecebbba46070eb338c3789836762f7c16 | Python | 1,809 | 63 | import os.path
from scipy.optimize import fsolve
import math
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import utils_Florian as utils
def equations(p, t_peak, t_half):
x, y = p
return (0.5 * (math.exp(-x * t_peak) - math.exp(-y * t_peak)) - (math.exp(-x * t_half) - math.exp... |
68ef8344d5cc7e0f04434aa45269df841a4fb2dd1022b5818ac99caa32d35a73 | Python | 1,809 | 41 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
def flatten_fully_connected(inputs,
num_outputs,
activation_fn=tf.nn.relu,
... |
dcde5305b77f8fbc59d495acd5445ab9c109617f1eb4f2e60b9367017283c9db | Python | 1,809 | 56 | import math
import numpy as np
import pandas as pd
import csv
import pkg_resources
import os
####################
# INDEXERS/MAPPERS
####################
# Assigning numbers to 3 letter amino acids.
residues= ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU',\
'GLY', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE'... |
ff9132221cad2953a290eb25d280e4bc29b32ec97a5a0be1725310e3181caa40 | Python | 1,810 | 56 | # -*- coding: utf-8 -*-
from .core import *
from .. import _logging as logging
__all__ = [
'ROIPoolingLayer',
]
class ROIPoolingLayer(Layer):
"""
The region of interest pooling layer.
Parameters
-----------
layer : :class:`Layer`
The previous layer.
rois : tuple of int
R... |
401bbb2c40e88888a168c1ae248d401ee84aa2b3099a1af6d32cce892b77f87e | Python | 1,811 | 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... |
58a08ebd6d7c5c8663d67e1ae91bde9b7f98d6b2132030f2be1b59857f07d303 | Python | 1,811 | 62 | import os
import numpy as np
from matplotlib import pyplot as plt
tasks = [
"RomoTask1",
"RomoTask2",
"DMTask1",
"DMTask2",
"CtxDMTask1",
"CtxDMTask2",
"GoTask1",
"GoTask2",
"GoRtTask1",
"GoRtTask2",
"GoDlTask1",
"GoDlTask2",
]
go_task_list_values = np.linspace(0, 1, 8... |
7ef550ea139565e2426e85973df57218251d4e31ad962cbe9ec4df247946f974 | Python | 1,811 | 62 | import os
import numpy as np
from matplotlib import pyplot as plt
tasks = [
"RomoTask1",
"RomoTask2",
"DMTask1",
"DMTask2",
"CtxDMTask1",
"CtxDMTask2",
"GoTask1",
"GoTask2",
"GoRtTask1",
"GoRtTask2",
"GoDlTask1",
"GoDlTask2",
]
go_task_list_values = np.linspace(0, 1, 8... |
064fe1a35031d33bb933eb37249cb73526c6a9351da867f6c5ef8951daa417a1 | Python | 1,812 | 60 | from dataclasses import dataclass
from typing import List, Set, Union, Dict, Tuple, Iterable
@dataclass
class ListPair:
set1_id: str = None
set2_id: str = None
list1: List = None
list2: List = None
list1_len: int = None
list2_len: int = None
intersection_len: int = None
union_len: int ... |
73f018d6495d9976049ab684654aa68a6c30d216c3ac19e0053481ca98240f7f | Python | 1,812 | 55 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
fa50b7fc875bd39e53f8f76ad82fa2657046ffec361372d6e43ff7af8f07eee4 | Python | 1,812 | 32 | # 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... |
629aeea892fce1a1cd496b5fc9ff3d3c48f39b3f2d9456a76f095a51bf185fd8 | Python | 1,815 | 58 | '''
Observed relation between backward swimming duration and reorientation angle
'''
from pylab import *
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from scipy.stats import linregress
import scipy.stats as st
duration, angle = loadtxt('DurationBS_CumulatedRotAngle_Phi0_202... |
92f24ab1e92cea080ec73a3512544e075018797b3d1a666cf424270e1e8ef562 | Python | 1,815 | 49 | # 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... |
cc1c38bec8568e9dde74c36988f56b3e5aa99d6f8c90f16fb901339722954db6 | Python | 1,816 | 50 | dataset_type = 'CocoDataset'
data_root = './data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
# dict(type='Resize', img_scale=(1333, 800), keep_ratio=T... |
381e495acd0894e30b615a3fc900c693ded23651ec3d9f93331e37423a3ffb54 | Python | 1,817 | 71 | import pickle
from copy import deepcopy
import numpy as np
import grr.GIF_network as gfn
from lib import generate_models_argparser, load_generate_models_opts
# Parse commandline arguments and externally-configured options.
args = generate_models_argparser.parse_args()
opts = load_generate_models_opts(
args.opts... |
48806197d3f501c1a5aca56115c941870cec7dec353a7d4350cc8efcdb3cec86 | Python | 1,817 | 52 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from bisect import bisect_right
import torch
# FIXME ideally this would be achieved with a CombinedLRScheduler,
# separating MultiStepLR with WarmupLR
# but the current LRScheduler design doesn't allow it
class WarmupMultiStepLR(torch.optim.lr_s... |
e4c12a3297d9823abcf5eb032dc1254dcecb273bb0a6d66ad6facf3590f4930e | Python | 1,817 | 42 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
dc47b108542145e534210d16d6fd8659485ae7c46992938d1d644fd84366448a | Python | 1,821 | 58 | 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-visualizations',
version='0.6',
packages=['gcpds.visualizations'],... |
d864a3efb0d2560ee09d0748539b512232a455c57b2a23cfea0ff0cfcb5da62b | Python | 1,823 | 77 | """Train an HMM on time-delay embedded/PCA data.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 1_train_hmm.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
import pickle
from glob import glob
from osl_dynamics.data... |
76a8d57627bd3be76b3351750f64312f77c08c53f269b6db2e801e0fe6895f16 | Python | 1,824 | 48 | # 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.