sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c4054cc1d3c9e2c7c24e35dab0c4184659d0730aaa26c36d959a8dcd7bbaaa14 | Python | 3,446 | 104 | #!/usr/bin/env python
"""
measureGain.py -- measure camera gain and BG with a simple
linear gain model
"""
# Numeric
import numpy as np
# Fit gain model with LS
from scipy.optimize import curve_fit
# Image file reader
from .read import ImageReader
# Plotting utilities
from .plot import plot_pixel_mean_variance
... |
bd4f50b92f9fd3d9bfd870097cb1d2705fe47d652446ccbd3aa03297004ded04 | Python | 3,448 | 78 | #! /usr/bin/env python3
"""Python API, Transfer 2.5 on a clip that is already on disk.
python api_transfer25_basic.py --clip ./clips/carla_town10_1700000000 \\
--prompt "the same street at night, wet asphalt" [--results ./cosmos-results]
Sends the clip's own depth and segmentation control videos and asks ... |
d2ac896ee7465c2ec5250256d86641a477b932dd40a02fcfc9526bcc1883c8a9 | Python | 3,448 | 85 | import os
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import networkx as nx
from brainNetwork.util.path import get_local_datadir, get_fig_dir
from brainNetwork.util import connectome, util
# Paths
csv_dir = Path(get_local_datadir(), 'connectiv... |
129bf53dbd849665afaeada8dfeaf05d4bc115a3e7c3e7c9b3bf14b59f50f6e2 | Python | 3,450 | 99 | # %%
#
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
import connectome_tools.cluster_analysis as clust
import connectome_tools.celltype as ct
import connectome_tools.process_graph as p... |
b5ba247a52c721b14c1b0b29497bb1ef7a154277e4854a0fc4059fc26812e731 | Python | 3,450 | 123 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
"""
3Augment implementation
Data-augmentation (DA) based on dino DA (https://github.com/facebookresearch/dino)
and timm DA(https://github.com/rwightman/pytorch-image-models)
"""
import torch
from torchvision import transforms
from timm.data.t... |
322898f923ed89c068e85fb494d12ded579312ee5c0376f270a8bffdbec4b91d | Python | 3,451 | 97 | '''
Author: Naiyuan liu
Github: https://github.com/NNNNAI
Date: 2021-11-23 17:03:58
LastEditors: Naiyuan liu
LastEditTime: 2021-11-24 16:46:04
Description:
'''
from __future__ import division
import collections
import numpy as np
import glob
import os
import os.path as osp
import cv2
from insightface.model_zoo import ... |
48f6754341c87f32e25a9505c79f46b4de66664aa618661917c5620859867815 | Python | 3,451 | 132 | #%%
from operator import itemgetter
from pathlib import Path
from warnings import filterwarnings
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
from sklearn.cluster import AgglomerativeClustering
from tqdm import tqdm
from graspy.cluster import GaussianCluster
from graspy... |
eccfd53bbb9975364ce5972674985953ee08f1748f8c31731e4404c8d3d3a958 | Python | 3,451 | 94 | #!/usr/bin/env python
# Copyright 2017 Johns Hopkins University (author: Daniel Povey)
# 2017 Yiwen Shao
# 2017 Hossein Hadian
# Apache 2.0
""" This script converts a Kaldi-format text matrix into a bitmap image.
It reads the matrix from its stdin and writes the .bmp image to its
stdout.
... |
431966d73376f78cce7796d26bfaa3636ddd4b8abc6c8804a7d5d70826f45efa | Python | 3,452 | 98 | import numpy as np
import scipy.sparse as sp
import torch
from utils import embedding_matrix_2_kNN
def encode_onehot(labels):
classes = set(labels)
classes_dict = {c: np.identity(len(classes))[i, :] for i, c in
enumerate(classes)}
labels_onehot = np.array(list(map(classes_dict.get, la... |
8471dcfa42ec5414ea5d5dadab8358b46bf64b84af72c7919f3ee91f8eeb9bfb | Python | 3,452 | 75 | import unittest
from typing import Dict, List, Tuple
from sssom import Mapping
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.implementations.sparql.sparql_implementation import SparqlImplementation
from oaklib.resource import OntologyResource
from oaklib.types import... |
cbb50dce9b570a5fda3493633dd63170bb82ef605b6823b173346b810a1d4c3c | Python | 3,453 | 117 | # coding=utf-8
# Copyright (c) 2021, NVIDIA CORPORATION. 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 re... |
f1e85065dd511c37082e958e978cfb3a1ee07ef2ecd8b67b086b4d93192e472b | Python | 3,454 | 109 | """
Copyright Dejan Kostyszyn 2019
"""
import torch, utils
import torch.nn as nn
class UNet(nn.Module):
def __init__(self, D_in, D_out, num_classes, opt):
super(UNet, self).__init__()
self.opt = opt
self.maxpool = nn.MaxPool3d(kernel_size=2, stride=2)
self.enc1 = Encoder(2, 32, 64... |
4357bc08a0eed4329687f6a5a38e8c4649ae4bf36264724823d11021692246ff | Python | 3,455 | 146 | #!/usr/bin/env python
# coding: utf-8
'''
@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 struct
import pickle
def client_send_msg(sock, msg):
# prefix each message with a 4-byte length in network byte order
... |
1aa66c431ea0671f68c76fef844b259590eab8df16040e4b7d064aee7bf28394 | Python | 3,456 | 61 | import math, sys
sys.path.insert(0, '.')
from svgkit import Svg, C, render_png
W, H = 1200, 730
s = Svg(W, H)
s.text(W / 2, 44, "CARLA frame vs ROS 2 / REP-103 (FLU) frame", size=26, weight="bold", anchor="middle")
s.text(W / 2, 74, "Top view of a vehicle: the nose points up the page, +z points out of the page towards ... |
91eabd2847854b36f4c4140683e8605c9c13ed208ea2f557fdcc543c919e5a9a | Python | 3,456 | 114 | import numpy as np
import matplotlib.pyplot as plt
import time
from helper import *
from ALsim import ALsim
import sim
import sys
import os
from ALsimParameters import std_paras
import random
"""
Run and experiment to investigate the effect of decreasing response with higher concentration.
Generate different versions... |
11caeba57af4adfde248184d52d616c270ae1c14101c7954477bec9aebb21720 | Python | 3,458 | 102 | """Valence assignments for larval Drosophila MB cells.
Sources:
Saumweber et al. 2018, Nat Commun (per-DAN optogenetic valence)
Eichler et al. 2017, Nature (L1 connectome + compartment naming)
Weiglein et al. 2024, eLife 91387 (4 DL1 DANs = aversive taste punishment)
Hu et al. 2... |
1a20f677461b61b2a5a38681797492bd79be50645ad7988c2c24b490bc0523e8 | Python | 3,458 | 92 | import functools
import itertools
import logging
import pickle
import numpy as np
from lib import ColocalisedFile, colocalisation
logger = logging.getLogger(__name__)
class ColocalisationResult:
"""The colocalisations for one image stack. Contains a list of all colocalisation
possibilities for every subset... |
77aeeb785561440cc3dc59e36c92e1455db3746c1b5b1dbfad5c931ee38d7525 | Python | 3,459 | 87 | # 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... |
e4bd1ba110ee16610be7f69aa716ccffc52b4b3776363ced41a44cd03a63ba49 | Python | 3,460 | 72 | # 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... |
528957ebba6fddad8db3d53f253b22838d5dc5f5b0413acdb515cd3943619db2 | Python | 3,462 | 97 | # all_test_to_all_train.sh: Evaluate Geometric Invariant Fingerprint descriptors
# (descriptors by Yin. et al. PNAS 2019) for comparison to MaSIF. The input used is the training data.
# Pablo Gainza - LPDI STI EPFL 2019
# Released under an Apache License 2.0
import os
import numpy as np
import sys
import importlib
i... |
596bbafe768dc0a971200cb8039f1b00e47cc253ce394d376258330684f1c315 | Python | 3,462 | 91 | # 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... |
12ec6af7a1b1fd6179f13c1f7e1d88ab82fda573358853f47e705575cc674056 | Python | 3,463 | 58 | """Rename the car-paint material slot of vehicle meshes to `Bodywork_Mat`.
BaseVehiclePawn.ApplyColor paints the material slot named `Bodywork_Mat` (hard-coded) with a dynamic instance of the
M_CarPaintMaster child it finds there. Several UE5 vehicle meshes (Lincoln MKZ, Mini Cooper, Dodge Charger) import
their paint ... |
e9dcbc3486be41f2d28fa06fe1bee44d4498f8d4f098ec64cf352467bc7d03ac | Python | 3,463 | 93 | import torch
from .vae_basic_model import VaeBasicModel
from . import networks
from . import losses
from torch.nn import functional as F
class VaeClassifierModel(VaeBasicModel):
"""
This class implements the VAE classifier model, using the VAE framework with the classification downstream task.
"""
@s... |
c1fd60672db464226a7d0d2fe3012c15adbc5f6338a590eaf76d0d48bb9a04f8 | Python | 3,464 | 80 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import OrderedDict
import logging
import torch
from maskrcnn_benchmark.utils.imports import import_file
def align_and_update_state_dicts(model_state_dict, loaded_state_dict):
"""
Strategy: suppose that the models that w... |
8e6f940d20b64d98b39e853bd55a4727e1e99244da8e187916bc46e42825a2cd | Python | 3,465 | 118 | import bisect
import warnings
from torch._utils import _accumulate
from torch import randperm
class Dataset(object):
"""An abstract class representing a Dataset.
All other datasets should subclass it. All subclasses should override
``__len__``, that provides the size of the dataset, and ``__getitem__``,... |
dc759790d14222f32443188bcb4741179e7cd6dba43329476ce1e15dee94ea09 | Python | 3,465 | 97 | # coding=utf-8
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law ... |
805536008bc731c0d86a21094e8f1f0d510640962b42f9663c7902eae773c3cb | Python | 3,466 | 110 | """
Title
-----
Networks of compartmental neurons
Description
-----------
In this example we show:
- How to create a recurrent network of compartmental neurons.
- How active dendrites can alter network responses.
"""
import brian2 as b
from brian2.units import Hz, ms, mV, nS, pF
from dendrify import Dendrite, Neuro... |
b682db4bcaea10efbf358e9ce6e5cccecdf9b581862422781db7a45a5ce92ec9 | Python | 3,469 | 82 | """
Read LRSTC files and plot for each patient a within correlation scatter plot
Make Linear regression on these and aggregate to one patient wide plot
"""
import glob
import pandas as pd
from matplotlib.ticker import FormatStrFormatter
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import sea... |
86810c94adb7d1502fcbc6de301ac14514e748638679cb92f7f21f11752c8158 | Python | 3,471 | 90 | import numpy as np
import torch
import random
import os
import argparse
from pathlib import Path
from tqdm import tqdm
from torch.utils.data import DataLoader
import aug_accuracy as util
from aug_accuracy import InputError
def test(config, data_folder, epoch_file, data_type, nn_type):
test_root = config[data_type... |
0f44e28dac30b0ad83dd4b4856004d9e5130abf6a5459f7fbcccc17dbeb29596 | Python | 3,472 | 68 | # Copyright 2020-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 agre... |
45798f57648b3fc9b3345feac1f3f7b82a919c2d9fc15872802658f65630c21f | Python | 3,472 | 97 | import numpy as np
import pandas as pd
from importlib import reload
from os import rmdir, remove, listdir
from os.path import exists, isfile
import persistent_homology_SEDT as pers_hom
reload(pers_hom)
# TEST - peristent_homology_sublevel_cubic
######################################################
test_image = np.ar... |
e3bed20a1150dfe9c879bab7568aed2c40f7f40b65be2505f4e11ef935b9fba8 | Python | 3,473 | 108 | import numpy as np
import PIL.Image
import zipfile, os, io
def evaluate_single_file(predictionfile:str, annotationfile:str) -> dict:
ypred = load_segmentationfile(predictionfile)
ytrue = load_segmentationfile(annotationfile)
result = {
'IoU' : IoU(ytrue, ypred),
'error_map... |
24d9210340fd5043ea7fa81b12e7d3c67be6f9897e1ec888eb51b3215c6b4d5b | Python | 3,474 | 87 | # 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... |
b404755f1c68ce4c606f07f99f14eff82807bab33dbc21a5b1992814fa2307ac | Python | 3,475 | 125 | """
.. _diffusion_advection_fd_vis :
A simple finite-difference solver for the diffusion-advection equation
======================================================================
An intro to our loss module's finite difference utility demonstrating
its use to create a simple numerical solver for the diffusion-advectio... |
5d2c4debcd77f2840ffc88b27db1ec019941194cfffdfdf4bc4aa03f1cafa133 | Python | 3,476 | 90 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
4d57d4668e288ab3f1875d591c9ca97bbd4ac3ae22c51a99001cc6b4224ffb4f | Python | 3,477 | 69 | # pylint: disable=no-self-use,invalid-name
from allennlp.common.testing import AllenNlpTestCase
from allennlp.common.util import ensure_list
import sys
from pathlib import Path
sys.path.append(str(Path('.').absolute()))
from scicite.dataset_readers.citation_data_reader_aclarc import AclarcDatasetReader
from scicite.... |
f8d1c5d716860a0f84303f643e574bf309e17e499570f05ba6b4b1931ccfc47f | Python | 3,477 | 121 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import random
import torch
import torchvision
from torchvision.transforms import functional as F
class Compose(object):
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, image, target):
for ... |
5110b2a7f51513a49ccc5a0f686f41c591868fdabaa9273a2ba441d6d92d34fd | Python | 3,478 | 99 | ## setup_mnist.py -- mnist data and model loading code
##
## Copyright (C) 2016, Nicholas Carlini <nicholas@carlini.com>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
import tensorflow as tf
import numpy as np
import os
import pickle
impo... |
d57d0d1962244bb0f3631865b8142b83371db3c5a61b8a256d246f6267944340 | Python | 3,481 | 88 | # -*- coding: utf-8 -*-
from .core import *
from .. import _logging as logging
import tensorflow as tf
__all__ = [
'MultiplexerLayer',
]
class MultiplexerLayer(Layer):
"""
The :class:`MultiplexerLayer` selects inputs to be forwarded to output.
see `tutorial_mnist_multiplexer.py`.
Parameters
... |
dcd7e50c09d390abd792930bc1216ed3cf5bac5b072e380d05d4b006e33ff1dc | Python | 3,482 | 91 | class DynamicPlume():
def __init__(self,
sim_dt=0.01,
birth_rate=1.0,
env_dt=0.04,
birthx=1.0, # per-episode puff birth rate sparsity minimum
birthx_max=1.0, # overall odor puff birth rate sparsity max
qvar=1.0, # Variance of init. location; higher = more off-plume ini... |
0d58f8289010a9c498faa9232d39b9d78cd542d00e195630d7050511bbd6aa82 | Python | 3,484 | 102 | # 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... |
5fbf836ee0085be05af32230a817cfe1f456dcdf5f05ea9afbf3e520c13ecdfc | Python | 3,484 | 107 | """
This file contains specific functions for computing losses on the RetinaNet
file
"""
import torch
from torch.nn import functional as F
from ..utils import concat_box_prediction_layers
from maskrcnn_benchmark.layers import smooth_l1_loss
from maskrcnn_benchmark.layers import SigmoidFocalLoss
from maskrcnn_benchma... |
ce1d5cbb62e2250c050909566c9b5e3921070ac380802d17381174175904c7c6 | Python | 3,484 | 88 | import torch
from tqdm import tqdm
from utils.utils import get_lr
def fit_one_epoch(model_train, model, yolo_loss, loss_history, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, Epoch, cuda):
loss = 0
val_loss = 0
model_train.train()
print('Start Train')
with tqdm(tot... |
a2de2b2cc19ff3f8d150ff5302eb980d6e03c59186f7b92320fac775aadba83a | Python | 3,485 | 87 | import logging
from dataclasses import dataclass
from typing import Any, Iterable
from oaklib.converters.obo_graph_to_obo_format_converter import (
OboGraphToOboFormatConverter,
)
from oaklib.datamodels.obograph import (
DisjointClassExpressionsAxiom,
Graph,
GraphDocument,
LogicalDefinitionAxiom,
)... |
4f20c9ac9c82f9a112f749c498011fb1f7d837c6f68c7c25197591f42978d3e5 | Python | 3,488 | 121 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import datasets, plot, testnd, Factor, concatenate, set_tmin
from eelbrain._wxgui.testing import hide_plots
@hide_plots
def test_uts_stat():
"test plot.UTSStat plotting function"
ds = datasets.get_uts()
p = plot.UTSStat('uts', ds=ds)
... |
65661b0a5a13cabf0a5fe5178965bec3aaba43f089109df62dd025aec51dde58 | Python | 3,488 | 90 | # Copyright (c) Open-MMLab. All rights reserved.
import os
from ..dist_utils import master_only
from .hook import HOOKS, Hook
@HOOKS.register_module()
class CheckpointHook(Hook):
"""Save checkpoints periodically.
Args:
interval (int): The saving period. If ``by_epoch=True``, interval
ind... |
539eff724022c79dc9f7ab472c81c50be88875a1c3dbf2ca4eec0958e34f6bdd | Python | 3,489 | 113 | #
# calculation of synthetic accessibility score as described in:
#
# Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions
# Peter Ertl and Ansgar Schuffenhauer
# Journal of Cheminformatics 1:8 (2009)
# http://www.jcheminf.com/content/1/1/8
#
# seve... |
e1506a06bda86ebf6953a96e030e5ef25d13630c04ccaf8fde154cd381cdb140 | Python | 3,489 | 72 | """
Separated testing for OmiEmbed
"""
import time
from util import util
from params.test_params import TestParams
from datasets import create_single_dataloader
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
# Get testing parameter
param = TestParams().parse()... |
6bf991ae9fd811587f065728760350decbea7d222ff1b7151759977cd42bf0b8 | Python | 3,490 | 87 | from mmdet.core import eval_map, eval_recalls
from .builder import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module()
class VOCDataset(XMLDataset):
CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car',
'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse',
... |
00e51d964ae893253f784899d802177818de6238ac385e63d900c50b208fb054 | Python | 3,492 | 85 | """Phase 3b: discover MB compartments from the bipartite MBIN <-> MBON KC overlap.
Each larval MB compartment is a (DAN, MBON, KC-pool) triplet (Eichler 2017,
Saumweber 2018) — a DAN that modulates plasticity at the KC->MBON synapses
sharing the DAN's KC contact zone. So compartments appear in the wiring as
high-Jacca... |
3518e6bbdd7ff66d23149a75c31a21d691ad1ffe83fc340f7184aa2edf3f6c86 | Python | 3,492 | 121 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For predicting a time series of 3d stacks that are stored in different files.
"""
import unetsl.cli_interface
import unetsl.model
import unetsl.data
import sys
import numpy
import re
def predictImage(img_stack, model, cutoff=0.001, stride=None):
# c, t, z, y... |
12c12bcd27e70f2a0905bfff09e8050bdca709ef837d4ad90cb345fbe3bf759f | Python | 3,493 | 113 | __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
import pandas as pd
from tmkit.util.Reader import Reader as greader
from tmkit.util.Writer import Writer
class Re... |
4b161ad96b894420bbb6acd48b734f21fd6b97ff2e942de846a79418286f9ecc | Python | 3,493 | 112 | import numpy as np
import networkx as nx
import cloudvolume as cv
import json
from meshparty import skeleton_io
"""
Skeleton handling
Label conventions:
{1: 'axon',
2: 'basal dendrite',
3: 'apical dendrite',
4: 'ambiguous dendrite',
5: 'ambiguous',
0: 'soma'}
"""
SMOOTHED_SKELDIR = "data/smoothed_skeletons_v185... |
80f1a6a3a34cbeebf79193d48bdf5f47104ad847e7a8ddb1d081e2c28957033a | Python | 3,494 | 103 | # Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang)
# Apache 2.0
# This script trains models to convert GOP-based feature into human
# expert scores.
# 1c is as 1b, but use SVR instead of random forest regression.
# Comparing with 1b, the f1-score of the class 0 is much improved.
# MSE: 0.16
# Corr: 0.45
#
# ... |
3f68ac8ee7040ff2aeb8c22d3623bc129228499d39bb461fad3b8809bc80650e | Python | 3,495 | 91 | import csv
import json
import logging
import re
from pathlib import Path
from tqdm import tqdm
from transformers import AutoTokenizer
def read_labels(labels_path, test=False):
labels = {}
labels_start = 2 if test else 4
with open(Path(labels_path), encoding="utf-8") as f:
labels_reader = csv.read... |
4fd404ec1516f253f8c6acebd0c60f0bf8ad876f795006acefa1b633d5072a3d | Python | 3,495 | 95 | # 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... |
6ef3295286a03848489b5cb76e7f24c38f4fa704018ddb46ef63d5ac8f35fdce | Python | 3,495 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 10 16:01:45 2022
@author: spiros
"""
from neuron import h
def myinit(vinit=-65, temp=34, cao=2, cai=5e-5, dt=0.025,
enable=True, modify=False):
"""
Initialize function.
Parameters
----------
vinit: float, optional
... |
7c1590ae148c15c874732bc819ed61520d8ca423fd7a1899fecaeb6ade87497f | Python | 3,495 | 92 | '''
Calculates the density of particles in a movie.
After background subtraction and filtering to enhance particles, the maximum intensity is calculated in each window of size 50 um.
The proportion of windows with intensity > 20% of unfiltered max background intensity is reported.
'''
import os
import numpy as np
from ... |
4d4b413d11bcdd86e05767a2a8aff9e5751307024209bf09b9d9ddb264169e86 | Python | 3,496 | 39 | from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self):
BaseOptions.initialize(self)
# for displays
self.parser.add_argument('--display_freq', type=int, default=99, help='frequency of showing training results on screen')
self.parser.add_argument(... |
4ed63702c2461c46be83ccc891531d2015f9ee7ffa3db4f5976ae4394ca46c0f | Python | 3,496 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 10 16:01:45 2022
@author: spiros
"""
from neuron import h
def myinit(vinit=-65, temp=34, cao=2, cai=5e-5, dt=0.025,
enable=True, modify=False):
"""
Initialize function.
Parameters
----------
vinit: float, optional
... |
c0fa3990bcd770312975bfeb3495e87e93242826b21f1c5b7f3ea474d300f96d | Python | 3,497 | 85 | import random
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.utilities import rank_zero_only
from utils.plotting import plot_alignments, plot_spectrograms, plot_conversions, plot_residual
class TacotronLogger(TensorBoardLogger):
def __init__(self, save_dir, name='default', version=... |
cee6ab75da06b330289b2d01ccb4f028307084fb8ad862386c762736d38fd492 | Python | 3,497 | 110 | import pytest
import pandas as pd
import os
from mismatch import AssignGroup
from mismatch.TNMismatchClustering import TNMismatchClustering
def test_imports():
"""Test that key modules can be imported."""
assert AssignGroup is not None
assert TNMismatchClustering is not None
def test_assign_group_functi... |
e808a22465bd51e0660c49984c96eeb59b63c20ce64500ecd46628f8846a32e4 | Python | 3,497 | 105 | """
This file runs SVM cross validation on searchlight data..
Example run:
python food_label_R2_improvement.py -s 1 -v voxel_path.npy -t stim_id_path.npy -o output.npy
-s : subject
-v : path to searchlight voxels
-t : path to list of stimulus coco ids in the order of voxel_path.npy
-o : desired output path
"""
imp... |
926c336dd0cf95c9f6878faadb8b876d9c89a021e8ae73dfbb1afbfa4e388532 | Python | 3,498 | 87 | from mmdet.core import eval_map, eval_recalls
from .builder import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module()
class VOCDataset(XMLDataset):
CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car',
'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse',
... |
93aa2c5e2a7546cdb8ef9697ee543461a06ec9cbd784122c1eca3f8aeb5ba803 | Python | 3,498 | 91 | from Brain_study.data_generator import BatchGenerator
import ddmr.utils.constants as C
from tqdm import tqdm
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.callbacks import TensorBoard
import os
import voxelmorph as vxm
from ddmr.utils.acummulated_optimizer import AdamAccumulated
from ddmr... |
bb3bd83faa5ccc05cf0a9b91c820adbc769536e7910ccec5806f30e41fd2ed3b | Python | 3,498 | 82 | import tensorflow as tf
import numpy.matlib
import os
import numpy as np
from IPython.core.debugger import set_trace
from scipy.spatial import cKDTree
from sklearn.metrics import roc_auc_score
from tensorflow import keras
import time
#import pandas as pd
import pickle
import sys
"""
score_nn.py: Class to score protei... |
2ab7887e6de89cae06816fc760e80a08ab6f9ecffde6cc7b23fcd45eda5366b9 | Python | 3,499 | 94 | # 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... |
bcdb1efc5f09ebe25e6735e0548cf190632cfeb3aa06771b5074bb280a159d93 | Python | 3,499 | 117 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.models import SBMEstimator, DCSBMEstimator
from src.data import load_left, load_right
from graspy.utils import binarize,... |
fedbd46ce366b5a7a4c3215ec8b40df9ba6c74b45114ae9857b1ac655c0d5a7a | Python | 3,500 | 187 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
"""
jupyter-nbconvert log2episodes.ipynb --to python
python -u log2episodes.py
"""
# In[2]:
from __future__ import division
import os
import glob
import pickle
from natsort import natsorted
import argparse
import os
import sys
import numpy as np
import tqdm
import ... |
0550a384f5fc9ece9e6b287629d08a9227ef9cb534277b938ef762bc9253ed9a | Python | 3,501 | 102 | #!/usr/bin/python
import sys
import copy
cmdl_parse = copy.copy(sys.argv)
import matplotlib
matplotlib.use('Agg')
from argparse import ArgumentParser
from os import path
import importlib
from modules.parameters import ParameterSpace
version = "0.1"
def run_experiment(params_file_full_path, computation_function="noi... |
540f4397d7382a2ddb927040e12bded720d7d91635370d02cf53c21e22f4d578 | Python | 3,501 | 101 | # Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang)
# Apache 2.0
# This script trains a random forest regression model to convert GOP-based
# feature into human expert scores.
# 1b is as 1a, but use fake negative examples instead of over sampling.
# MSE: 0.13
# Corr: 0.44
#
# precision recall... |
bc54cf7a914e1dbb41d23a4c09427157546ab0999b2e82d003d2e4e3450f6504 | Python | 3,501 | 94 | # 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... |
c5e9904e1ebaadf1ec6dfb3ad1e8213546787e83444b0afe5f4dce9598e28c0c | Python | 3,501 | 85 | # Copyright (c) Open-MMLab. All rights reserved.
import torch
from torch.nn.parallel.distributed import (DistributedDataParallel,
_find_tensors)
from mmcv.utils import TORCH_VERSION
from .scatter_gather import scatter_kwargs
class MMDistributedDataParallel(DistributedDataPa... |
8903ad3197afb577d96df223e20acc898c539c3fc0d752b25abfd984e2e250a8 | Python | 3,502 | 89 | # 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... |
8dffa727b496b27358bb1b2f07f44429ce49427ea98d7967e20ceecda9d38360 | Python | 3,502 | 99 | # coding=utf-8
# 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 ... |
96d6f7ad20dc2d7cde8d37d00c7b201bcd26e9f3c7044916f12e2cbb032696e9 | Python | 3,503 | 87 | # 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... |
cd0b932b2e83565be6f4ac4b8e79b6f668a7a8cbbdfbd569f46ecfd0d2b015a2 | Python | 3,504 | 103 | import torch
import random
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from torch_geometric.data import Data
class BA_Houses:
def __init__(self, n, m, seed=None):
self.n = n
self.m = m
self.in_house = set()
self.seed = seed
def get_data(self, num... |
ced5bf62d83f634c1c7f2e0c8d4aa82f036803e4bf4d70ac8bbcc36d71b7de5b | Python | 3,505 | 93 | # 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... |
0cb75ec5616297421e772ba90630a09f83c9118cd2d7766c5d9d90bcf27724cb | Python | 3,510 | 134 | import pytest
from cropro import CropConfig
from cropro.cli import parse_args
def test_default_config_is_importable_without_imaging_dependencies():
config = CropConfig(orig_img_path_t2w="t2w.mha", seg_img_path="gland.nii.gz")
assert config.crop_method == "center"
def test_cli_parses_booleans_and_crop_metho... |
b310d578dfb6c2ab473c6f02f03a76ad41bbdbfc9b859a2227b902b797177f0b | Python | 3,510 | 91 | import numpy as np
import cv2
from PIL import Image
import pickle
import os.path as osp
class LoadData(object):
def __init__(self, data_dir, classes, normVal=1.10):
self.data_dir = data_dir
self.classes = classes
self.classWeights = np.ones(self.classes, dtype=np.float32)
self.norm... |
def645f9787ac2a0f69b8f59e3c5725db9ef621d45c4c6be925e52ca2b889dcd | Python | 3,510 | 129 | import logging
import uuid
from labelbox import (
OntologyBuilder,
LabelingFrontend,
Dataset,
Project,
MALPredictionImport
)
from labelbox.data.annotation_types import (
ObjectAnnotation,
Point,
LabelList,
Label,
ImageData,
)
from labelbox.data.serialization import NDJsonConvert... |
a1fb9e943bd8fc63b7f173248a773ea14c8ec219a34ef680fcd0bc2850a277a4 | Python | 3,514 | 95 | # 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... |
a7d362c5e9aed686aa2870e585a5e5dac8db3ebc14f0aa2a66f01c8001e03bc4 | Python | 3,514 | 114 | from typing import List
import logging
import numpy as np
import pandas as pd
from spotipy.utils import points_matching
from types import SimpleNamespace
from cenfind.core.data import Field
from cenfind.core.structures import Centriole, Nucleus
logger = logging.getLogger(__name__)
def evaluate(
field: Fie... |
314d5a391b438801ed7c5519db9907c5cb997fd9e347e51c8c979e4f84f44a3b | Python | 3,515 | 90 | # 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... |
938d9b345663f361f681c2f83bbd2ebe281ae9dd054e2ea5f77cd0b7e3c6c2fe | Python | 3,515 | 87 | #!/usr/bin/env python3
"""Emit Autoware's map_projector_info.yaml.
Default is ``projector_type: Local`` -- the correct choice for CARLA towns,
whose lanelet2 nodes carry metric local_x/local_y coordinates rather than a
real geodetic reference. MGRS / LocalCartesianUTM options are exposed for
future digital-twin maps t... |
b8f1bf85c5d64ddeedba55a5234f4e726efaf11ed8ad533502ef13839f9a0519 | Python | 3,515 | 90 | # 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... |
ced941a4f728233a6f8317ae9ddc8d4591501684fac5094184607db6b7e7daa2 | Python | 3,515 | 93 | #!/usr/bin/env python3
"""
Script to download a compressed tar archive, verify its checksum, and unpack
its contents without the top-level folder of the archive into the given folder.
Used for the MathJax files that are needed by the HTML version of the manual.
"""
import hashlib
import os
import shutil
import sys
im... |
d875013e18d83c25f6185804e913efba9226dbd50c4cc368f78935cfe19baf0f | Python | 3,515 | 113 | # 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... |
6e77f2a00ab930c6b904e62d58cac77161f78683b001d2ad6656cee551f4ebdc | Python | 3,517 | 86 | # 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... |
31887f3beb634267b3a98241f72bd258625feeaeadcaf3dac4c8442130cc2e10 | Python | 3,518 | 89 | """Plain-Python geometry and control helpers for the NuRec hybrid Scenic behaviours (nurec_lib.scenic imports them; classes
cannot live in a .scenic file, where every class is a Scenic object class).
Frames: Scenic heading 0 = +y, counter-clockwise positive; CARLA steer +1 = full right lock.
"""
import math
from shape... |
3f666f487f1460e9b62a4dab7848bd8cbcc470a0d01a2472d402693a59ed1873 | Python | 3,519 | 100 | '''
Author: Naiyuan liu
Github: https://github.com/NNNNAI
Date: 2021-11-23 17:03:58
LastEditors: Naiyuan liu
LastEditTime: 2021-11-24 16:45:41
Description:
'''
from __future__ import division
import collections
import numpy as np
import glob
import os
import os.path as osp
import cv2
from insightface.model_zoo import ... |
525afb410e1f2e528ffb6185d46e3c4db93a0763f6fc5558d6af5cd8342e1a82 | Python | 3,519 | 91 | import sys
import os.path
import glob
import os
import glob
import re
batch_size = 25
samples_per_individual = {}
study_individuals = {}
assay_and_library_type = {}
with open(sys.argv[1]) as input_file:
header = input_file.readline()
for line in input_file:
line = line.strip().split('\t')
assa... |
fa346815a5d2f922860e16f9bd46cf60334d2c3ee8e986fbdb5653376f63c562 | Python | 3,521 | 91 | import os
import random
import xml.etree.ElementTree as ET
from utils.utils import get_classes
annotation_mode = 0
classes_path = 'model_data/my_classes.txt'
trainval_percent = 0.9
train_percent = 0.9
VOCdevkit_path = 'VOCdevkit'
VOCdevkit_sets = [('2007', 'train'), ('2007', 'val')]
classes... |
7cf6f99bd6de6e9712cb705c786095644b83d5e6687ecb9b89e13d7290317d42 | Python | 3,523 | 99 | #!/usr/bin/env python
# Copyright 2019 Zili Huang
# Apache 2.0
# This script loads diagonal UBM and ivector extractor from text file.
import os
import numpy as np
def load_dubm(dubm_text):
assert os.path.exists(dubm_text)
para_dict = {}
state = 0
data_array = []
with open(dubm_text, 'r') as f... |
e54cc235c3743995614047f034b1bb50328996085156ad2e3f397cb32bc3a1bf | Python | 3,523 | 109 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
helper class that supports empty tensors on some nn functions.
Ideally, add support directly in PyTorch to empty tensors in
those functions.
This can be removed once https://github.com/pytorch/pytorch/issues/12013
is implemented
"""
import m... |
f82fd240e830a7a15c2914240319c2913a73ccf117d13ed4ff6be7d4bcf936b9 | Python | 3,524 | 115 | # 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... |
e4a02f6087cdcba83d5c44476fc59edd668b514f12649d416bcbb9439093470d | Python | 3,525 | 75 | __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 import basis
from niftypad.image_process.parametric_image import image_to_parametric
from niftypad.models import get_model_inputs
# dt
dt = np.array([[0, 5,... |
fabd6c83d3908db19ed14188cb13f2a191128efcb1cb14932314398d2fcd40b9 | Python | 3,527 | 114 | """
An example model that has double the number of convolutional layers
that DeepSEA (Zhou & Troyanskaya, 2015) has. Otherwise, the architecture
is identical to DeepSEA.
When making a model architecture file of your own, please review this
file in its entirety. In addition to the model class, Selene expects
that `crit... |
d8c5c1468c59a5c493ee2b2142ea140d624a306bb687644a290bd8cfd3d35dca | Python | 3,528 | 99 | # 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... |
dc9ceddbf08813be23ab141feee877caa8f459923d80f678e7106fc07ea15a74 | Python | 3,529 | 98 | from typing import Literal
import importlib
import torch
from torch import einsum
def segment_csr(
src: torch.Tensor,
indptr: torch.Tensor,
reduction: Literal["mean", "sum"],
use_scatter=True,
):
"""segment_csr reduces all entries of a CSR-formatted
matrix by summing or averaging over neighbo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.