sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ec09b8cc149e93c7bca36465bac7a31a7be7324042e52e5efef4bab9d329ef61 | Python | 5,554 | 170 | from dataclasses import dataclass
from typing import Any
import yaml
from oaklib import BasicOntologyInterface
from oaklib.datamodels.vocabulary import (
CONTRIBUTOR,
CREATOR,
DESCRIPTION,
RDFS_COMMENT,
RDFS_LABEL,
RDFS_SEE_ALSO,
SKOS_DEFINITION_CURIE,
TITLE,
)
from oaklib.io.streaming... |
466d01c8d37e50ccc3b3d14cfe7996b77b99b0bee73554964de0046da3b12f0d | Python | 5,555 | 179 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import List
from tmkit.visualize.func.Coloring import Coloring as func_coloring
from tmkit.visualize.isite.ProtocolDeepTMInter i... |
7e9b96c49dd604438fbe430ddee7b2573926ae344a5de1610f0c6d665c2616be | Python | 5,555 | 145 | """
File: saver.py
Created: 2020/06/09
Last Changed: 2020/06/11
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... |
6b00f55a8ef4c5d4e1fadc2c24fd4b2bc58241aef6270fac1bb0d3a52bf76d19 | Python | 5,557 | 154 | # This script is part of navis (http://www.github.com/navis-org/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... |
eea42abbb01fa138f8411ca2c7636194f500449dd9afb5edc1da1449f1760096 | Python | 5,558 | 137 | """Paper Figure 5: reversal-learning across four models on the larval MB connectome.
Layout (2 x 2):
A — RPE slow symmetric reversal (single trace)
B — AIF cannot reverse (Beta-Bernoulli evidence locks in)
C — Dual-Valence fast reversal via parallel opposing memories
D — POM mechanis... |
77d41689c69c720e34c1fb5b82cb4d571aec05fcf9fa006331ada5bc6058b22f | Python | 5,559 | 157 | import bisect
import math
from collections import defaultdict
from unittest.mock import MagicMock
import numpy as np
import pytest
from mmdet.datasets import (DATASETS, ClassBalancedDataset, ConcatDataset,
CustomDataset, RepeatDataset)
@pytest.mark.parametrize('dataset',
... |
92ef86386102ecfa6297d9fd7f39d68c38008841b3105316c597520bd457abc4 | Python | 5,560 | 176 | # -*- coding: utf-8 -*-
"""
Created on Fri May 14 23:06:21 2021
@author: Sleepymouse
"""
import glob
import numpy as np
import pandas as pd
from scipy.stats import chi2
import sympy
import csv
import matplotlib.pyplot as plt
import sys
#wheel managerから排出されたファイルは.csv形式(名前は.xls)なので、.xlsに変換sにて保存しなおしてから使用すること
#mac
#path... |
a3d4fadb4f7af30cee9939202f998adca0b67605d812062ad1a53e321ca46639 | Python | 5,565 | 159 | """
Class for creating and managing BIDS directory tree and essential files
MIT License
Copyright (c) 2017-2021 Mike Tyszka
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, i... |
cb44608fe23340c57edd1bc773bf9bdca2731ac1986beaf5c6580c2d56ca48ed | Python | 5,565 | 140 | # basic imports
import os
import numpy as np
import pickle
import pyqtgraph as qg
# framework imports
from cobel.agents.sfma import SFMAAgent
from cobel.interfaces.gridworld import InterfaceGridworld
from cobel.analysis.rl_monitoring.rl_performance_monitors import EscapeLatencyMonitor
from cobel.misc.gridworld_tools im... |
0ac2863ef57344f695aa05b3d7e797f8f0d3c52bc88f40ac66217bb007cc775a | Python | 5,574 | 187 | # %% [markdown]
# ##
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from src.data import load_metagraph
from src.hierarchy import signal_flow
from src.visualization import adjplot, CLASS_COLOR_DICT, set_them... |
4e6a01130b07edfd71d0db0c543d067b96653b1139ab56c0837d672111d7aa97 | Python | 5,574 | 145 | # Copyright 2023 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... |
78b4caf0b18009173dddb26de8c51363fd329f9961e56ee3bc301af4725ef8da | Python | 5,574 | 146 | # This script trains SMAP-SMOS NN
# input files: smap_smos_overlap_3dm_seas_c_no_std.pkl, smos_3dm_seas_c_no_std.pkl
# output files: saved NN NNsmapsmos_ver1.h5, NNsmossmap_overlap_output_ver1.pkl, NNsmossmap_smos_output_ver1.pkl, overlap_full_with_NNoutput.pkl
import sklearn as skl
from sklearn import preprocessing
... |
51a7a5a623a675f5c41cef002a8d7e63fa8e8377283ff834fceca1d065dbae16 | Python | 5,576 | 141 | import logging
import math
from abc import ABC
from typing import Dict, List, Iterable, Tuple, Iterator
import networkx as nx
from oaklib.datamodels.similarity import TermPairwiseSimilarity
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.interfaces.obograph_interface import Ob... |
e9f2eb71ca02479fd96ee6f7d33cd5593f2bdfb0c67c4fa4f093ab63eba61c91 | Python | 5,576 | 153 | """Writer utils."""
import io
import struct
import typing
import numpy as np
try:
import crc32c
except ImportError:
crc32c = None
from slideflow.tfrecord import example_pb2
class TFRecordWriter:
"""Opens a TFRecord file for writing.
Params:
-------
data_path: str
Path to the tfreco... |
d2b986279200d16ffd93068094b2df74a4b60042e3a4dbc0aeea9d73a3abc040 | Python | 5,577 | 172 | # -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import inspect... |
e92a78a069d9177a33884c39dd407c370e24b52265218af6ddd87814ee129e4b | Python | 5,578 | 181 | import atexit
import logging
import sys
from copy import copy
from dataclasses import dataclass, field
from typing import Any, ClassVar, Dict, Iterable, List, Mapping, Optional, Type, Union
from linkml_runtime import SchemaView
from linkml_runtime.dumpers import json_dumper
from linkml_runtime.utils.yamlutils import Y... |
131de1957a10348477adcedee4d290864bb7908e12d3427b8632b10370951ed3 | Python | 5,579 | 138 | import torch
import cv2
import time
import os
import os.path as osp
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
from argparse import ArgumentParser
from collections import OrderedDict
from IOUEval import iouEval
from PIL import Image
import loadData as ld
from models import Mi... |
0d2a1fc7773468132d50f79e60a9096f28c9620b17c6258cae6dec37c775db72 | Python | 5,586 | 147 | import logging
import unittest
import yaml
from linkml_runtime.dumpers import yaml_dumper
from oaklib.implementations.aggregator.aggregator_implementation import AggregatorImplementation
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.resource import OntologyResource
fr... |
b683f41ecb75fd3268974a877326c3d4d39ff07f01650136431a4319d96f226d | Python | 5,587 | 187 | # 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 hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warrant... |
d3844e9b958659f9e7017440e1e33ede5385e0e248ba67ec6801472df18a88a9 | Python | 5,589 | 142 | import torch
from typing import Optional, Callable
from torch_geometric.utils import k_hop_subgraph
from torch_geometric.data import Data
from graphxai.explainers._base import _BaseExplainer
from graphxai.utils import Explanation
class GradExplainer(_BaseExplainer):
"""
Vanilla Gradient Explanation for GNNs... |
d752cc8c5354b6cdb698183e8e03f2f2fc781be5ad61d5b612c6847a0aede1fd | Python | 5,592 | 158 | import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
import tensorflow.keras.layers as layers
import tensorflow_addons as tfa
import sklearn
import pandas as pd
from utils.model_utils import add_layer
class Trainer:
"""
Custom Trainer class for sequential window data
Setup... |
6f2982b29ab1232abd9e1e48ff76039cbb3242d034e2349eca7d96ea382ab2ab | Python | 5,594 | 187 | import json as js
import os
import os.path as op
import subprocess
import numpy as np
import pandas as pd
def run_command(command, env=None):
"""Run a given shell command with certain environment variables set."""
# https://github.com/NBCLab/power-replication/blob/master/processing/processing_utils.py
me... |
07671017ad4cf31c8402cafaafd7ad6f3e3a6272d9fe98ca8266ef9c8eaffe51 | Python | 5,596 | 130 | import numpy as np
import pandas as pd
import scipy.stats as stats
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import os
def line(x, a, b):
return a * x + b
def median_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.median(a), stat... |
d64f4cf9efcb47bd9eadc99f046a8156e4224760c879e5462d22c4179b9ba407 | Python | 5,600 | 146 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import dni
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIS... |
0f262274824ee66dc96e5440fd9def6b2e3c93feb68532828a03edee3c77e101 | Python | 5,602 | 213 | '''
Written by Nathan Neeteson.
A set of utilities for visualizing images with masks overlaid in various ways.
'''
import numpy as np
import matplotlib.pyplot as plt
def plot_image_with_mask_overlay(img,cort_mask,trab_mask,back_mask,figsize=(10,6)):
fig = plt.figure(figsize=figsize)
mask_min = (img.shape[0]... |
c502c676e2e42e461333fd76c327d6becf3e8e2c7cf447fbd6dd9e2019361121 | Python | 5,602 | 157 | import collections
import os
def read_header(file_path):
"""Returns a dict of all header items for an EEG data file.
Args:
file_path (str): full file path to an EEG data file
"""
#use the files extension to dispatch to reader
if file_path.endswith('edf'):
return EDF... |
bbc83a883a9eec8a75518e124be09aeddb3f9a226940c3dc8872a0a41c13d85a | Python | 5,603 | 160 | import numpy as np
import torch
import torch.nn as nn
from typing import Optional
from sklearn.linear_model import LassoLars
from torch_geometric.utils import k_hop_subgraph
from graphxai.explainers._base import _BaseExplainer
from graphxai.utils import Explanation
class GraphLIME(_BaseExplainer):
"""
Graph... |
c4e75dec729dc16cdad164ad6598843c7ff2f2fb938b85c557a7d79de203344a | Python | 5,603 | 162 | import tqdm
from transformers import AutoModel
from torch import nn, optim
import csv
import pandas as pd
from collections import OrderedDict
import json
import copy
import numpy as np
import random
import torch
from transformers import AutoTokenizer, AutoModelForMaskedLM, BertForSequenceClassification
from torch.nn.ut... |
f36ae626a337f014ddf25585a10b08f1eb972948d35628dbeb5ecfb0e7e041a6 | Python | 5,604 | 129 | #!/usr/bin/env python3
"""
File: merge_mr_and_decon_results.py
Created: 2020/11/26
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 Soft... |
73146b553a63c6c496fb964cc7ae8fb958dc53c6a862838fd91264c75f14e888 | Python | 5,606 | 124 | from lab.nilm_experiments import *
from constants.constants import *
from constants.enumerates import *
experiment_parameters = {
EPOCHS: 0,
ITERATIONS: 10,
INFERENCE_CPU: False,
SAMPLE_PERIOD: 6,
BATCH_SIZE: 1024,
ITERABLE_DATASET: False,
PREPROCESSING_METHOD: SupportedPreprocessingMethods... |
5deaafefa67c357b320dba7d858aa80426121b877870111ec48a4ed1b1501968 | Python | 5,608 | 155 | import os
import sys
import pickle
import numpy as np
import pandas as pd
import matplotlib
matplotlib.rc('pdf', fonttype=42)
matplotlib.rc('font', **{'size': 14})
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('ticks')
def showSummary(rwd,bias,covp,numLIST,oldALL,survivalTF):
if survivalTF=... |
68d3bbcfe7f6c42fafedd571242197aa46e73a8824670bae9612e0bac41f22d7 | Python | 5,612 | 145 | #!/usr/bin/env python
#######################################################################
#######################################################################
## Created on February 22nd 2019 to check nf-core/atacseq design file
#######################################################################
###########... |
7c4e832ef5619adca93f90bbb544a19b4935288aab6868d2bed9be7ff10b3949 | Python | 5,614 | 177 | import math
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import Parameter
from .config import device, num_classes
def create_model(opt):
#from .pix2pixHD_model import Pix2PixHDModel, InferenceModel
from .fs_model import fsModel
model = fsModel()
model.initialize(opt... |
01a0e9e0ceb645a52d3e077eb1cc7bbcc35e06388a91da0a1b498357d2151a7b | Python | 5,615 | 121 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import time
class Matcher(object):
"""
This class assigns to each predicted "element" (e.g., a box) a ground-truth
element. Each predicted element will have exactly zero or one matches; each
ground-truth element may be... |
b1fdbe81b12ead253946f462b70d7e6ea73f6f39c2e41f972fe145eb26aedc28 | Python | 5,616 | 132 | # %%
# identify clusters with higher than 2*std mean axonic IO or dendritic OI
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
from data_settings import data_date, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, ... |
b3a72077b76d8a48465b40d2a9e82cef31264a2348f3c5d2fa61b6caab81d677 | Python | 5,618 | 149 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import datetime
import logging
import time
import torch
import torch.distributed as dist
from apex import amp
from maskrcnn_benchmark.utils.comm import get_world_size
from maskrcnn_benchmark.utils.metric_logger import MetricLogger
def reduce_lo... |
b8391b663dbe8f4c35f89bf75bc0c4cf9f0a44485d4bbf8a8ccebfe009c0d795 | Python | 5,618 | 147 | #!/usr/bin/env python3
# Copyright 2019 JSALT (Author: Latané Bullock)
# Apache 2.0
# This script is modified from VB_resegmentation.py. It uses the speaker attribution
# (q) matrix from VB resegmentation and an overlap hypothesis RTTM to assign
# speakers to overlapped frames.
import numpy as np
import argparse
de... |
369a0d89de139f7fb886a98e9a90c6b73bf4ac2e9ba35a9108511a280b97e164 | Python | 5,619 | 135 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import networkx as nx
from pymaid_creds import url, name, password, token
import pymaid
from contools import Celltype, Celltype_Analyzer, Promat
from data_settings import data_date
rm = pymaid.CatmaidInstance(url, token,... |
79dcc44c72e1f30c2493ff3781847eae69681b74919fb63597f8e5a8d5a34eef | Python | 5,619 | 247 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Info dictionary
Main entries
------------
meas
Measurement:
B
Magnetic field strength (MEG).
V
Voltage (EEG).
p
Probability (statistics).
r, t, f
Statistic (correlation, t- and f- values).
contours
De... |
fecc7f0e02fc40e65d468f0db61924b0b37ca3963e746be329b7949722efdcd6 | Python | 5,626 | 117 | # pylint: disable=invalid-name,protected-access
import copy
from typing import Dict, Union, Any, Set
from allennlp.common import Params
from allennlp.common.testing import ModelTestCase
import sys
import os
from pathlib import Path
from allennlp.data import DatasetReader, DataIterator
from numpy.testing import asse... |
0cdbca9adbd5e32cfc0cef77b3ec6a892305a1ab0469d7c835e2073778eac253 | Python | 5,631 | 158 | import copy
import torch
import torch.nn as nn
from mmcv.runner import OptimizerHook
from ..utils.dist_utils import allreduce_grads
from .utils import cast_tensor_type
class Fp16OptimizerHook(OptimizerHook):
"""FP16 optimizer hook.
The steps of fp16 optimizer is as follows.
1. Scale the loss value.
... |
b1ca12d1d7af0dc6e8daf34d61559ecc739e9aa197b0211c3f062ba309baac13 | Python | 5,631 | 164 | import pickle
import torch
import numpy as np
import torch.nn as nn
import pdb
import torch
import numpy as np
import torch.nn as nn
from torchvision import transforms
from torch.utils.data import DataLoader, Sampler, WeightedRandomSampler, RandomSampler, SequentialSampler, sampler
import torch.optim as optim
import p... |
abee3a70fd5c1b618ef2ae85f953c12f59d7fe0e1b2d266f6b361039c96b1139 | Python | 5,633 | 152 | import operator
import six
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .layer_factory import conv_bn_relu, conv3x3, OPS, AGG_OPS
from ..rl.genotypes import OP_NAMES, AGG_NAMES
from maskrcnn_benchmark.utils.comm import get_rank
from maskrcnn_benchmark.modeling.backbone.fpn import... |
30f4e678cb830facefe12117976c52b46aa08a91065b18fbd56aa485c9fc2446 | Python | 5,634 | 155 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch import nn
from torch.nn import functional as F
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.modeling.backbone import resnet
from maskrcnn_benchmark.modeling.poolers import Pooler
from maskrcnn_be... |
bc71d9233f8ee2d0ff5fdc9881c18566e6dc7ad98ab2b8703bca17f0a67db9fb | Python | 5,637 | 171 | # Built-in
import os
import pickle
import shutil
import zlib
from pathlib import Path
import brian2 as b2
import brian2.units as b2u
import numpy as np
import pytest
from scipy.stats import wasserstein_distance
# Local
from cxsystem2.core import cxsystem as cx
cwd = os.getcwd()
path = Path(os.getcwd())
anatomy_and_s... |
595fd2ba1dffa4cfd352f90067537e1a4ce2a6066436a11b315901068855c57a | Python | 5,639 | 182 | #!/home/shawarma/venv/bin/python3
# -*- coding: utf-8 -*-
#
# slideflow documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 14 19:42:39 2019.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present... |
7786b1b288a5513d171af3a1ae8ae5903f054079a6579421e3271489d60edbdc | Python | 5,640 | 150 | import numpy as np
import cv2
import torch
from torch.autograd import Variable
from torch.utils import data
from utils.img_utils import pad_image_to_shape, normalize
from utils.pyt_utils import load_model
def whole_eval(val_func, class_num, img, img_means, img_std, scale_array,
output_size, is_flip, d... |
7e6650ba5a4e06c30cf11dfca03bd77b422cd4247cd31c3e9a306d46fde642b9 | Python | 5,643 | 135 | from dash_extensions.enrich import Serverside, Output, Input, State, callback, clientside_callback, ctx
from dash.exceptions import PreventUpdate
import numpy as np
import RV.constants as c
from RV.callbacks.utils.visualization_utils import get_y_axis_ticks
def register_offset_callbacks():
# Update offset using... |
2cfb7d3b619834109bda53c100211b55f823e8955d92c7cb93e899dc1d08ed1b | Python | 5,644 | 142 | import importlib
import logging
import pkgutil
from dataclasses import dataclass
from pathlib import Path
from typing import Type, Union, Optional
from oaklib.implementations.bioportal.agroportal_implementation import AgroportalImplementation
from oaklib.implementations.bioportal.bioportal_implementation import Biopor... |
ee123ae0458fbe463000d5962a5b804d9e91b25d3fda8500eeaa6ddf6b5c932a | Python | 5,644 | 126 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
fa9d4ad56205d0505ef4ec03af3bf90f6b57f43cbbc62fbec8a15cf6009fbdb9 | Python | 5,644 | 188 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from synaptic_metrics import synaptic_metrics
from cell_models import CCKCell
from opt import myinit, mystyle
import pickle, os
# Make plots nicer!
plt.style.use("tableau-colorb... |
089aa7a03cef18a2c81337c14d1b07cb68e4834f1159da2325e893aaef536557 | Python | 5,645 | 150 | # 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... |
448e3826b1e709d5323cb041adbfdea33e347664d4d66a0f8d42ea15fcb245b3 | Python | 5,645 | 162 | """
'Basic' branch stats computation
Here, a branch refers to a connected component of a skeleton that possesses
the same compartment label. This means that branches can also refer to the
soma.
This script computes a data frame with an ID, volume, and surface area
measurement for each branch. The branch ID is the min... |
d4e67f1548c579eb2849d4bee73ecc92d51945c941c319d63dc171fa0178bab7 | Python | 5,646 | 147 | """
Handles writing the ref and alt predictions
"""
import os
from .handler import PredictionsHandler
from .write_predictions_handler import WritePredictionsHandler
class WriteRefAltHandler(PredictionsHandler):
"""
Used during variant effect prediction. This handler records the
predicted values for the r... |
f951c4a2fdf8c99379b2081a442a3b8569dbb51545cbadf0d638cb7d8880da59 | Python | 5,647 | 176 | import os
import numpy as np
import pandas as pd
## Plots
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import seaborn as sns
datadir = "vcf/MTvcf"
vcffiles = os.listdir(datadir)
vcffiles = [f for f in vcffiles if '.vcf' in f]
tasks = [f.split(".vcf")[0] ... |
ce73b3cd27386705df3aa382f67c3db992840b0ad0bd9f121fef09d824b2a492 | Python | 5,650 | 143 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
d0adf68dabd16e94603ff3e87f049ea375255416b434a40b7a2700e015c2632c | Python | 5,650 | 146 | # 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... |
9d5602f448b39bc586a955a289bd1f46a9864841c954ac978f3cb2f49e2f7cd2 | Python | 5,652 | 196 | #%%
import os
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
import pymaid
from graspologic.utils import binarize, remove_loops
from src.data import load_metagraph
from src.graph import MetaGraph
from src.io import savefig
from src.pymaid import star... |
9b0a856ca237f6580385a88c14e669f7115c7d90028e697a4ca3a83b53ea589e | Python | 5,653 | 157 | # Time-stamp: <2024-10-02 16:48:17 Tao Liu>
"""Description: Filter duplicate reads depending on sequencing depth.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
# ------------------------------------
#... |
fc484fbed747b2f21f390ea6d45ba54c3767a871f4da3696f4928e412bb87031 | Python | 5,653 | 166 | import random, sys
from networkx.classes.function import to_undirected
import networkx as nx
import torch
import matplotlib.pyplot as plt
from torch_geometric.utils import to_networkx
from graphxai.explainers import CAM, GradCAM
#from graphxai.explainers.utils.visualizations import visualize_subgraph_explanation
from... |
c2e85438e0058408771c05685187a8a77012d8a9d16e3d7bae1b120c3b2fe14e | Python | 5,655 | 112 | """Number of UKBB variables
"""
from collections import OrderedDict
observations = OrderedDict([
('31-0.0', 'Gender'),
('21003-2.0', ' Age when attended assessment centre'),
('34-0.0', 'Year of birth'),
('52-0.0', 'Month of birth'),
('21000-2.0', 'Ethnic background'),
('21022-0.0', 'Age at recr... |
2358555259f716395d108965328729e9105429afa42598a08979854a5f55160b | Python | 5,658 | 148 | import torch
import torch.nn as nn
from mmdet.core import bbox2result
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
@DETECTORS.register_module()
class SingleStageDetector(BaseDetector):
"""Base class for single-stage detectors.
Single-stage detectors ... |
7be56f32776b3f0e80ac0f55e079c67a737d4f37b2d62115b358f89cd36b0f43 | Python | 5,659 | 158 | """
Snippet to load all artifacts of training state as Modules
without constraining to use inside a default Trainer
"""
from typing import Union
from pathlib import Path
import torch
from torch import nn
import torch.distributed as dist
from neuralop.mpu.comm import get_local_rank
def load_training_state(
save_d... |
40c8e7b51c93bd92bf66e8b2635b02379250432c0ffcbac20b87de03d545b31d | Python | 5,660 | 166 | from matplotlib import pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.utils import resample
from bayesian_bootstrap import (
mean,
var,
bayesian_bootstrap,
bayesian_bootstrap_regression,
BayesianBootstrapBagging,
highest_density_interval,
c... |
45de553eba3e4cdb7b4511e4766fc64ea5b0e6ee50df4a21bbd1c3642fa30da5 | Python | 5,662 | 145 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import torch.nn.functional as F
from torch import nn
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from .loss import make_rpn_loss_evaluator
from .anchor_generator import m... |
2b7d631261c8c900b4937c9c6879123008668d547b25d187f264c521538885f3 | Python | 5,663 | 163 | import warnings
import matplotlib.pyplot as plt
import mmcv
import torch
from mmcv.ops import RoIAlign, RoIPool
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.core import get_classes
from mmdet.datasets.pipelines import Compose
from mmdet.models import build_detector
d... |
44c3bcacf029566eaaf5c2caa1c258ee684457b437251193fae65b7b2d01fa9b | Python | 5,668 | 153 | import argparse
import os
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet.apis import multi_gpu_test, single_gpu_test... |
a524655474de969305ed93f02dfb94eb8d833961dee4d07f7e0a482cc5d52055 | Python | 5,668 | 124 | import mmcv
def wider_face_classes():
return ['face']
def voc_classes():
return [
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'
]
... |
f39da26d6c143c3bbee14d92337fc39375c77386f216eec13e42a0d8c6c5c419 | Python | 5,669 | 194 | import pytest
import torch
try:
import torch_harmonics
except ModuleNotFoundError:
pytest.skip(
"Skipping because torch_harmonics is not installed", allow_module_level=True
)
from ..local_no_block import LocalNOBlocks
@pytest.mark.parametrize("n_dim", [1, 2, 3])
def test_LocalNOBlock_resolution_... |
46b3db05d3e26dba2c2a9500630790ca9544fe2e26e8bbb8502a15712bb0a3c1 | Python | 5,670 | 147 | # -*- coding: utf-8 -*-
from .core import *
from .. import _logging as logging
import tensorflow as tf
__all__ = [
'ConcatLayer',
'ElementwiseLayer',
]
class ConcatLayer(Layer):
"""A layer that concats multiple tensors according to given axis..
Parameters
----------
layers : list of :class:... |
245d322c2255b53c1cf9c44d549f7be4749317d8483b9716d4fb1894cd12a14e | Python | 5,672 | 113 | from __future__ import print_function, absolute_import
import os
import torchvision.transforms as transforms
from dataloader import h36m_dataset as h36m
from dataloader import mouse_dataset as mouse
from dataloader import custom_dataset
from dataloader import data_utils
def load_dataloader(args):
normalize = ... |
f0f9e879a58ef1e5b54aa692c8f8a4214a6afff0b07b0c4c3d2c25f8bf7d7a3d | Python | 5,672 | 141 |
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
from chemprop.args import TrainArgs, PredictArgs
from chemprop.train import cross_validate, run_training, make_predictions
from chemproppred.utils import plot_hexbin
from chemproppred.make_balanced_train impo... |
b04671ad2e6101f3448851100acfc4dc79945ae244a55a9b5a9ae3b0d84c2117 | Python | 5,675 | 149 | # Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
d333355222d6361390c29653ce8b02f2cf4cf16bfc8fb2e665764ea6357a8e46 | Python | 5,676 | 158 | import sys
import os
"""
Expected format for the input file:
#Id #Real value #Guessed value #Anything #Weight for class 1 #Weight for class 0
0 1 0 0.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000042 0.000042
"""
ID_ROW=0
REAL_ROW=1
GUESS_ROW=2
W1_ROW = 5
W0_ROW = 6
def main():
path = sys.argv[1]
f... |
4d873aa74f009f87566cf90dc7af13fe5f2065b65d5e3898774fbf463eaeb5a3 | Python | 5,678 | 219 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Implementation of nipype interfaces for QUIT relaxometry utilities
Requires that the QUIT tools are in your your system path
"""
from os import path, getcwd
from nipype.interfaces.base import TraitedSpec, DynamicTraitedSpec, File, traits
from .. import base as QI
#... |
4de94dfdc374583db9560e12c8d64dd85fe9666ede62efd085169c2a9b5a4d40 | Python | 5,679 | 227 | #!/usr/bin/env python3
"""
Signal analysis module for phys2cvr.
Attributes
----------
LGR :
Logger
"""
import logging
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as spint
import scipy.stats as sct
from scipy.signal import butter, filtfilt
from phys2cvr.i... |
5b7a3af6372d589045914db6e0975fe85aa21349102fdddb3be6abd43dd5756c | Python | 5,679 | 144 | # 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... |
e6d42546d9fb4b26d8dab61a921172b8c37217c5cc21306024af6ecf4c4ad89d | Python | 5,681 | 146 | import numpy as np
import os
import h5py
import random
import fft_downsampling as fft
import scipy.ndimage as ndimage
from h5functions import save_to_h5
def choose_venc_type():
'''
Give a 68% that data will have a same venc on all 3 velocity components.
'''
my_list = ['same'] * 68 + ['diff'] * 32
... |
abe41362f03aeda51cdceee9283306edcbef4e0549c994c028bcdc27fdff3e6b | Python | 5,682 | 177 | import h5py
import numpy as np
import os.path
from PIL import Image
from glob import glob
from skimage.transform import resize
raw_data_path = None
HDF5_data_path = './data/HDF5/'
def get_raw_data_path(dataset):
if 'DRIVE' in dataset:
raw_training_x_path = f'./data/{dataset}/training/images/*.tif'
... |
dc9a1d7d66a4aff72f02e558760ab9647fa685eab82e12dd8dab01801ab53ea2 | Python | 5,682 | 203 | import queue
class StatTree(object):
def __init__(self, root_node):
assert isinstance(root_node, StatNode)
self.root_node = root_node
def get_same_level_max_node_depth(self, query_node):
if query_node.name == self.root_node.name:
return 0
same_level_depth = max([c... |
0c0fe317fcccbdaab46a5087065f8b6a0a8a642d3a677e4e2149961ca5f45005 | Python | 5,686 | 158 | from __future__ import annotations
import os
import logging
from typing import TYPE_CHECKING, Callable, List, Union
from palm_tools.analysis.analysis_classes import AnalysisStep
from palm_tools.analysis.analysis_tools.mds_prob import MDS_prob, MDS_prob_bootstrap
from .mmd_analysis import MMDInterUnitAnalysis
import num... |
98b1a192c836d9c3f658ad0758e98d72e01912f1ca2e122d88097f15f3450e76 | Python | 5,686 | 151 | """
Copyright (c) 2019, National Institute of Informatics
All rights reserved.
Author: Huy H. Nguyen
-----------------------------------------------------
Script for making FaceForensics Face2Face dataset
"""
import argparse
import cv2
import numpy as np
import os
import sys
parser = argparse.ArgumentParser()
parser.... |
0cff0cf735dbc5574998716f8cb0cc75b371e91667a1108c8234d4cd32a7b1ad | Python | 5,688 | 166 | """Hyperboloid manifold."""
import torch
from manifolds.base import Manifold
from utils.math_utils import arcosh, cosh, sinh
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class Hyperboloid(Manifold):
"""
Hyperboloid manifold class.
We use the following convention: -x0^2 ... |
26dcdbd5c8fe03b5385591746a7f19cf17a28ef18c416c037aa3eedecaebe8d5 | Python | 5,690 | 167 | # 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... |
307b4fd8b36bd5e0271ffaaad2e7d2f656097241f220b6a859be9ab1d08e779c | Python | 5,692 | 167 | import inspect
import warnings
from functools import partial
from .misc import is_str
class Registry:
"""A registry to map strings to classes.
Args:
name (str): Registry name.
"""
def __init__(self, name):
self._name = name
self._module_dict = dict()
def __len__(self):
... |
1df29a38d04baae573b4e33a53991915c026a4f1fc87b8e1496905737b5b8a54 | Python | 5,693 | 166 | import os
import sys
from csv import reader
import pytest
import yaml
from phys2bids import bids
from phys2bids.bids import UNIT_ALIASES
def test_bidsify_units():
# Add a dictionary of test possibilities
unit_tests = {
# test unit with standard prefix
"centik": "cK",
"CENTIk": "cK",
... |
ed993a27a676abc302dab0e46719581228fa54475bcc07a3949834433b3b02c6 | Python | 5,693 | 136 | import multiprocessing
from dash_extensions.enrich import Output, Input, State, callback
from dash.exceptions import PreventUpdate
import plotly.graph_objects as go
import numpy as np
import RV.constants as c
from RV.callbacks.utils.power_spectrum_utils import get_power_spectrum_plot
def register_power_spectrum_c... |
f63d3071efede415ce6e61238cad4f6cf94c6e5a30886df1bb58572fe44174fd | Python | 5,693 | 182 | from math import log
import os
import json
class Judger:
# Initialize Judger, with the path of accusation list and law articles list
def __init__(self, accusation_path, law_path):
self.accu_dic = {}
f = open(accusation_path, "r")
self.task1_cnt = 0
for line in f:
s... |
e485079cb5ada0dc0fbb6bffd5487139fa7a647598b2a06f9485fff8fad377f5 | Python | 5,694 | 139 | import os
from os.path import join
import collections
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer, MissingIndicator
from sklearn.pipeline import make_union, Pipeline
from... |
aabffabab86d5493bebb6b6cffaa008735054e435ea1678c0ac270c369518dba | Python | 5,695 | 173 | import xml.etree.ElementTree as ET
import re
from bs4 import BeautifulSoup
import sys
import glob
import json
from collections import defaultdict
import random
import pickle
import gzip
import os
import tqdm
from joblib import Parallel, delayed
import multiprocessing
import spacy
random.seed(10)
SENTENCE_START = '<S>'... |
25051aec98c6f5e01230e2a1b2e3a802d213e4f0deec584f03494efccdd46799 | Python | 5,699 | 123 | import argparse, sys
import collections
import torch
import numpy as np
import data_loader.data_loaders as module_data
# import data_loader.tumorgenerator_dataloader as module_data # change when load new data
import model.loss as module_loss
import model.metric as module_metric
import model.model as module_arch # chan... |
3f7011978f32305a82d28d3e5e014cac76c4ce7bc7b86f59181e6f24f60ca9d1 | Python | 5,699 | 167 | # 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... |
674f909beef1ef68c0b268014a726b301cb623b7a6ac7d17392a8a5e0a5bacbf | Python | 5,699 | 158 | import math
import torch
import torch.nn.functional as F
from torch import nn
from .inference import make_retinanet_postprocessor
from .loss import make_retinanet_loss_evaluator
from ..anchor_generator import make_anchor_generator_retinanet
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_ben... |
4fe8d03340c1cc495a32c94bf6535400309960baba945caac4ebffa59c61238c | Python | 5,701 | 155 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 22:46:57 2019
@author: Sleepymouse
"""
import glob
import numpy as np
import pandas as pd
import openpyxl
import pylab
from scipy.optimize import curve_fit
jet_lag = 20
a = 11 #初めの11行
b = jet_lag * 24 * 60 #recoveryの行数
gain = [] #計算したgainの入れ物
wb = openpyxl.Workbook... |
ba46165f9981feb42dcf0428bd315cb3d4b9aac15c7c17cf854f7da5e7b3e63a | Python | 5,702 | 153 | """
Create
"""
import os,gc
import numpy as np
import pandas as pd
import tensorflow as tf
from siVAE.data import data_handler as dh
from siVAE.model import VAE
def calculate_prediction_accuracy(similarity_matrix, data_handler, model_kwargs={}, split_index_list=None, num_neighbors=20, logdir=""):
... |
d4a136497d147ecd70b95dc30078d4e6aa73c0424d50772c16609675ae697b3d | Python | 5,702 | 160 | """ script to calculate rouge scores on individual predictions
example command:
python scripts/calc_rouge.py \
predictions.txt \
gold/test-multitarget.jsonl \
--output results.csv --workers 30
"""
from argparse import ArgumentParser
import json
import tempfile
from files2rouge import files2rouge
import os
from tqdm.... |
1b04e0c92f86905da3d2c87aa7b61056d3ee0cea2e38716bf249092afe825b53 | Python | 5,704 | 134 | """Test cases for the downloads module."""
import shutil
import subprocess
from logging import Logger
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock
import pytest
from pytest_mock.plugin import MockerFixture # type: ignore
from fi_parliament_tools.downloads import DownloadPipe... |
71de8f8397341afd1ece0254a42e12fd942af2fdd25492e91f500fa567d32847 | Python | 5,705 | 136 | ### reference code from https://github.com/quark0/darts/tree/master/cnn --- Differentiable Architecture Search
import torch
import torch.nn as nn
from .conv_ws import ConvAWS2d
from .registry import CONV_LAYERS
import torch.nn.functional as F
#from torch.autograd import Variable
class Identity(nn.Module):
d... |
8305d33cf0d29a67e1816d4ef74af3855296c781c3ac5445e9a21e57c5f68cd4 | Python | 5,705 | 114 | # This scripts takes all outputs together and prepares for aanlysis and in-situ data comparison
# input files: data_unc_in_2010-2020.pkl, stuct_unc_in_2010-2020.pkl, data_unc_in_2002-2010.pkl, stuct_unc_in_2002-2010.pkl
# output files: data_unc_2002-2010_AUG22 - for map and for time series, for 2002-2010 and 2010-202... |
9338ff2b5374342ca3fe532e3989ad03f3319031082e759b633e3481f60079ac | Python | 5,705 | 137 | import os
from os.path import join
import collections
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer, MissingIndicator
from sklearn.pipeline import make_union, Pipeline
from sklearn.ensemble import RandomF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.