sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1c7f54def972b624215434e77ce4ded1d945d341f9434487405edabfd2e00504
Python
3,190
93
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
2fbc5f13471d146cdfe94680fb0525361607a6329a7c375b8901dca889b1702c
Python
3,190
76
#!/usr/bin/python3 """ @author: Eduardo Romero """ import cgi import cgitb import os import subprocess UNZIP_DIR = "/opt/bitnami/apache2/cgi-bin/" cgitb.enable() print("Content-Type: text/html") print() form = cgi.FieldStorage() state = str(form.getvalue("state")) state = state.replace("@","DAB") unzipDirectory = UN...
0fc517d89538dd9ec0886523cc7eec78b1d9e7c5890e68c474815e2f3b61c30b
Python
3,191
86
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass # %% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pymaid as pymaid seg_index = pd.read_csv('da_investigation/csv/segregationinde...
03cfdfe269ae148524fe9c5c7592ad492faea2a656786731d51aa0325bdd7d34
Python
3,192
78
# 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...
2171f2f0c4cf66b499184a6583fb4f2aace6573419acf80d551a4228bfe6c795
Python
3,192
95
import sys import os import re from collections import OrderedDict import confusion_matrix def main(): path = sys.argv[1] files = os.listdir(path) files = [os.path.join(path,f) for f in files if f.endswith('.txt')] res = [] for file in files: confusion_matrix.main(file) file_name =...
66fcb7b27609f454fe187fb92c286ab06ff2d096dabdd843bdbbaeffbe555fc5
Python
3,193
83
from dash import html from dash_extensions.enrich import Output, Input, State, callback from dash.exceptions import PreventUpdate from RV.callbacks.utils.stats_utils import get_annotation_stats, get_bad_channel_info def register_stats_callbacks(): @callback( Output({'type': 'modal', 'modal': 'RV-stats'},...
15eb6dcc40e625e67d7a7da2e75e862043876c88cefe7bcb8bd1d691997e45f9
Python
3,195
89
''' Figure 8. Polar histogram of PIV angles for forward and backward swimming. ''' from scipy.stats import circmean from brian2 import * from os.path import join from fitting import * import os from fitting import * from file_management import * width, height = 2, 2 # Load PIV data filenames = [f.path for f in os.sca...
3de39dfa24c79e91343caeeb16036bf45e36e21d6a0096129507f550f9c5936b
Python
3,195
77
#!/usr/bin/env python3 # encoding: utf-8 # @Time : 2018/9/28 下午12:13 # @Author : yuchangqian # @Contact : changqian_yu@163.com # @File : init_func.py.py import torch import torch.nn as nn def __init_weight(feature, conv_init, norm_layer, bn_eps, bn_momentum, **kwargs): for name, m in feat...
4a0bbcd0d8b7d0636ae73190a08a131b83c50af9f26cd6732650a9d65a951a05
Python
3,195
66
import numpy as np import h5py import PatchData as pd def load_data(input_filepath): with h5py.File(input_filepath, mode = 'r' ) as hdf5: data_nr = np.min([len(hdf5.get(i)) for i in ["u", "v", "w"]]) print(hdf5['w']) indexes = np.arange(data_nr) print("Dataset: {} rows".format(len(indexes))...
fe0602eac7d37ab319a5eef0b4a6302569a8cea887ac2587592f6e32e146f3d5
Python
3,196
83
""" Written by Nathan Neeteson Utilities for quantitatively comparing predicted and reference segmentations. Loosely adapted from: https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/34_Segmentation_Evaluation.ipynb """ import SimpleITK as sitk import numpy as np def binarize_numpy_ar...
5fa1f8f926884a72315968ebd6a34bb3706c4446f8f11cfb5a13a2ea23f48761
Python
3,197
77
# 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...
728f6f0ff53bbf34b39065453616985b9c6932cafb7c6a59a66edb8f9c7e53de
Python
3,201
72
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing PYCHARM_EXEC = os.getenv('PYCHARM_EXEC') == 'True' import numpy as np import tensorflow as tf from tensorflow.keras.callbacks i...
8631f3237f0ab32e198294d0e2bffafcd2bf122b15089f9840cf825b32ce543f
Python
3,201
102
import numpy as np import torch import torch.nn.functional as F from timm.utils import accuracy import M2TR.utils.checkpoint as cu import M2TR.utils.distributed as du import M2TR.utils.logging as logging from M2TR.utils.build_helper import ( build_dataloader, build_dataset, build_loss_fun, build_model,...
875437863720482a28563566cfd12f57eb09971819ecba3e92d2eb917569cf9b
Python
3,201
108
''' Simulates 100 trajectories on a torus with a central attractive stimulus. Produces a movie and saves trajectories to file, with physiology data for 10 cells. ''' from brian2 import * from behavior import * import imageio from plotting import cell_mask, cell_indices C = paramecium_constants()['C'] N = 100 duration ...
f26bd5db1188650a5744b839721bbc803003fef5cb146540aa93cd758d925e2d
Python
3,201
76
from collections import defaultdict from itertools import product import os import numpy as np import pandas as pd from sklearn.datasets import make_classification # creates the output directory simulation_data_dir = 'datasets' if not os.path.exists(simulation_data_dir): os.mkdir(simulation_data_dir) random_seeds...
d70e82864404fb0dedd920f4a886a645c73e8cb3f5244cddb00a63539235c54c
Python
3,202
61
#!/usr/bin/env python ################################################# ## PTDNN - Python Toolkit for Deep Neural Network ## Author: Yajie Miao ################################################# import os import sys from utils.learn_rates import LearningRateExpDecay class BnfExpConfig(object): def __init__(self...
03132384d6ba42405459089e2b4b60b7794d368f298460921ddcdcd838d0881b
Python
3,204
79
# 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...
4d963dd99aa346f9ca02152da1cd0eb1cfe770109bbc99b54f96f5be120bd7bb
Python
3,205
91
#!/usr/bin/env python3 # # Copyright (c) 2018-2019 Institute for Basic Science # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
99a5ec928df29d9e7de807e9ec30a624951c1be6d90edabda734005f1462503e
Python
3,205
93
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 18:07:49 2018 @author: asanofuyuki .png Normalized_by_each_mouse_max/ 1 min bin 出来上がったデータを.xlsで再保存して、doubleplotを描く。 データは9:00(ZT0)スタート、9:00(ZT0)終了でエクスポートすること。 (最終日の8:59までのデータがある。) """ import glob import numpy as np import pandas as pd import ma...
a7146799ba680aeefc08bc36ef000aa08855e8466fc51e3542726de2314d3d99
Python
3,205
105
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Dict, List, Tuple import numpy as np from tmkit.util.Reader import Reader as tmkreader class Mapping: def tofas( ...
0b36021719d9dd3623985f434825ba4849f90a0437b716e7aee97a16d5e2f054
Python
3,206
111
from future import standard_library standard_library.install_aliases() # Unit tests for sima/motion/_hmm.py # Tests follow conventions for NumPy/SciPy avialble at # https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt # use assert_() and related functions over the built in assert to ensure tests # run properly...
2b2b41d1834b186839ef2da201da4ba2339f613c98f37bbbd7e5ec489b1acf9f
Python
3,206
87
import GPUtil import glob import os from utils import prepare_result_dir import config from time import sleep import sys import run_ZSSR_single_input """ Code based on ZSSR provided by Assaf Shocher https://github.com/assafshocher/ZSSR """ def main(conf_name, gpu, config_dir): # Initialize configs and prepare re...
6d61ab2e7a857e749f30cf42904dae0280890a1ab5b4cbcae77e8693fba90efd
Python
3,206
106
import torch import torch.nn as nn import torch.nn.functional as F from slideflow.clam.utils import initialize_weights import numpy as np class MIL_fc(nn.Module): def __init__(self, gate = True, size_arg = "small", dropout = False, n_classes = 2, top_k=1): super(MIL_fc, self).__init__() assert n_classes == 2 ...
a62dcfe82555ae4e39b2001b8d9c54a71b84842004d9b58685d975835bba810a
Python
3,206
79
__author__ = 'jieqing jiao' __contact__ = 'jieqing.jiao@gmail.com' import os import nibabel as nib import numpy as np from niftypad import basis from niftypad.image_process.parametric_image import image_to_parametric from niftypad.models import get_model_inputs from niftypad.tac import Ref # dt dt = np.array([[ ...
2a4aee66310bfb3d7efdf27b79c215fdb2b10f7c15f532fcd39f6f7789ee9da9
Python
3,210
104
import os import sys import time import subprocess LOG_FILE = "validation.log" ONLY_ANALYSIS = False NESTED_CROSS_VALIDATION = False ''' Instances and seeds used for the article 'Binary Classification On Hypergraphs' ''' INSTANCES = [ #('adult', 1509029032), # 0.8206451 1506844911), # 0.8217306 #('audiology'...
3489d97f97181531ae1fbd41b42cc27e588c87e27ebb844e9a94d18a01eb74b7
Python
3,210
99
# 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...
d70627e7eccd32211c325d96594a9d26f2e5a1e07dadc706de0ae4e6173a1b9e
Python
3,210
96
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 18:07:49 2018 @author: asanofuyuki .tiff Normalized_by_each_mouse_max/ 1 min bin 出来上がったデータを.xlsで再保存して、doubleplotを描く。 データは9:00(ZT0)スタート、9:00(ZT0)終了でエクスポートすること。 (最終日の8:59までのデータがある。) """ import glob import numpy as np import pandas as pd import ...
9f0e7b7dda8e564f2f3b7a054184bafbb0d4763b2957334406ce08552f9d393e
Python
3,211
87
import GPUtil import glob import os from src.utils import prepare_result_dir import config from time import sleep import sys import run_ZSSR_single_input """ Code based on ZSSR provided by Assaf Shocher https://github.com/assafshocher/ZSSR """ def main(conf_name, gpu, config_dir): # Initialize configs and prepa...
7d0ae5c412d4ebf15f3614d3a069abbb0cce7a802815ffe03c0645e89b3d883a
Python
3,213
100
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 16 08:44:29 2021. @author: spiros """ import numpy as np from scipy import signal from scipy.ndimage import gaussian_filter1d def synaptic_metrics(voltage, time, onset=700): """ . Parameters ---------- voltage : np.ndarray ...
62f0ebd92db96d67d42be9f32555b030ccb8e7713a0eeed18d2410e4485f092f
Python
3,214
98
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import unittest import copy import torch # import modules to to register predictors from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA from maskrcnn_benchmark.modeling.roi_heads.roi_heads import build_roi_heads # NoQA from mask...
6e1f1d07479ce42ea0b1867880c9cff426f5181f59b9bbe05629a3cff6fe7a7f
Python
3,214
96
""" Parse PubMed efetch XML into plain records. Replaces the PubmedArticle facade previously provided by the unmaintained ``eutils`` package. """ import logging import re from dataclasses import dataclass, field from typing import List, Optional from xml.etree.ElementTree import Element # noqa S405 __all__ = [ ...
36b88429ffece9992acd546921b13c9b9fa0ec4fa0bac8b29f86549188a9ef44
Python
3,216
89
# import threading import torch import torch.multiprocessing as mp from torch.cuda._utils import _get_device_index def get_a_var(obj): if isinstance(obj, torch.Tensor): return obj if isinstance(obj, list) or isinstance(obj, tuple): for result in map(get_a_var, obj): if isinstance(...
514a774e0633c5b09fe4bb8711ec81dca7943712df8693a04a443e8a6cbc1f3c
Python
3,216
50
import pandas as pd import numpy as np import argparse import sys from cmseq import __version__ from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from .cmseq import CMSEQ_DEFAULTS from .cmseq import BamFile def consensus_from_file(): parser = argparse.ArgumentParser(description="outp...
a25191de94f666036d61517b532bad710b229f286b0ebb72cd5b6aa033c6d1a6
Python
3,219
79
# 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...
cafc4b1e9538f3670301d8e8853cb4e59cbf2a20d78714236da73582a60c4979
Python
3,219
100
#import jax #jax.config.update('jax_platform_name', 'cpu') import corticostriatal as cs import time import sys from jax import vmap from jax import numpy as jnp from jax.ops import index,index_update from jax.random import split,PRNGKey,uniform from functools import partial import numpy as np arg_dict = { 'learn':...
5a847e68bef8e2f99751fe47896ac124121d523c0d852e2e164431dd71f89b1f
Python
3,220
87
#!/usr/bin/env python3 # Copyright 2020 Prisyach Tatyana (STC-innovations Ltd) # Apache 2.0. import json import argparse import sys import re def get_args(): parser = argparse.ArgumentParser( """This script creates chime6.json from ts-vad segments for dev and eval in the format required by pb_chime5 ...
98cb6052da9c944c36dae59e3161f4829ff14ada900b73c5a4e719e1b40a896f
Python
3,220
72
# 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...
247b97ade013b8d4ffea90ddfd243780bf075ed350dcefd5c6cc43e5b72a5699
Python
3,222
95
''' Search for fixed points in vicinity of a plane wave. args: k1, k2 - wave numbers ===Optimization method discussion=== Use now - `lm` with non-zero starting phase; If it fails - switch to other methods `hybr` - NOT OK: strange jump and breaks my solve_cycle 'lm' - OK if start with non-zero mean phase 'broyden1' ...
3a66ccef02138eb81862fc8a2bd13a6dc33562eb981cc9f9f9eef7204171dee5
Python
3,222
83
from mmcv.cnn.bricks import build_plugin_layer from mmdet.core import force_fp32 from mmdet.models.builder import ROI_EXTRACTORS from .base_roi_extractor import BaseRoIExtractor @ROI_EXTRACTORS.register_module() class GenericRoIExtractor(BaseRoIExtractor): """Extract RoI features from all level feature maps leve...
8206be2e51f3b103dde6eb6925dd5a5dc3ed8d100f0c4e0cf1794850d9aa0492
Python
3,222
101
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 16 08:44:29 2021. @author: spiros """ import numpy as np from scipy import signal from scipy.ndimage import gaussian_filter1d def synaptic_metrics(voltage, time, onset=700): """ . Parameters ---------- voltage : np.ndarray ...
de1313afa093cdedf159ab8b97bad573d96b7ba15ac2a30b2481f543e4510f8e
Python
3,222
84
import logging from abc import ABC from typing import Any, Dict from linkml_runtime.dumpers import json_dumper from oaklib.converters.obo_graph_to_cx_converter import OboGraphToCXConverter from oaklib.converters.obo_graph_to_fhir_converter import OboGraphToFHIRConverter from oaklib.converters.obo_graph_to_obo_format_...
f64d9538edca06044c1650e36274f54a33fef4fcb4fa6fe9b550f5b1acf95b22
Python
3,226
102
""" Kuramoto-type model. v1 supports - Sinusoidal coupling - Cosine + sine coupling - Define an arbitrary coupling function - NOT accelerated with numba """ import numpy as np import math def define_sine_coupling(sin_str): ''' :sin_str: coefficient in front of sine, units of [rad/s] In case of t...
1e7efb427ca541509af00a664d088cbc8ecef573c9d74e84bd4c248dc55cdda7
Python
3,227
88
# 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...
6a9af5a1e7575f164b0134449d3a1745ceee45b0c89f83ba4f6bfed8e7dcc879
Python
3,227
92
from rdkit import Chem from drugex.logs import logger from drugex.molecules.converters.interfaces import MolConverter class dummyMolsFromFragments(MolConverter): """ A converter to create dummy molecules from fragments. """ @staticmethod def addCCToFragments(frag): """ Add CC to ...
9260c83f6b440fcdaabe30e4eacc07e2bd832e950e214d9e9f3c6d6c95f74144
Python
3,228
86
from app_scripts import * from scipy.optimize import curve_fit import streamlit as st import numpy as np import pandas as pd ## Page setup st.set_option('deprecation.showfileUploaderEncoding', False) st.sidebar.subheader('Data:') st.sidebar.markdown("Drag and drop HEKA .asc export files. Keep table display at 'None' w...
2bd798abc6df0aae4a13757c30406e018805bc6b194bfc583585197d4ae627c3
Python
3,229
107
''' Figure 7. Zoom on action potential. Ionic current in the example, based on passive subtraction. Estimation of calcium accumulation. ''' from brian2 import * from brian2.units.constants import faraday_constant as F import yaml from file_management import * from pylab import * import matplotlib.font_manager as fm imp...
c67b73b98fbb3ac8f3b13cfb24cb0e9730c36c54bf5fc9567440836bf2c3a7a4
Python
3,230
91
import torch.nn as nn from mmcv.cnn import ConvModule, constant_init, xavier_init from mmdet.core import auto_fp16 from mmdet.models.builder import HEADS from .fcn_mask_head import FCNMaskHead @HEADS.register_module() class CoarseMaskHead(FCNMaskHead): """Coarse mask head used in PointRend. Compared with st...
6b45ac429aa3001cdade2d55425abbc86820f3fe04af69bb081c8ebbee254952
Python
3,232
110
#!/usr/bin/env python # Read a MatchAnnot output file, output entries for selected gene9s) # only. Optionally reverse the order of exon match lines. import os import sys import optparse import re from tt_log import logger VERSION = '20150331.01' REGEX_EXONS = re.compile ('(\s*\S+)') def main (): logger.debug...
87087f71a4f629bb113f15298090e131233adbbad21b677b834d4d407283f2f0
Python
3,234
160
# 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...
1d33987190788c4bf94be5ec09dc25833d83a0909f9f258c5f9a9298f78a5b2a
Python
3,235
102
import argparse import pandas import os import numpy as np import matplotlib.pyplot as plt import functools from collections import Counter import math import random def accuracy(decision_vector): ok = len([s[2] for s in decision_vector if confusion_matrix_label(s) in ['TP', 'TN']]) return float(ok) / len(dec...
f5d97bafca2457aa1717cc29348ea0164488efb0c0017dab7e52b4216d4311aa
Python
3,236
106
import time import cv2 import numpy as np from PIL import Image from yolo import YOLO if __name__ == "__main__": yolo = YOLO() mode = "predict" video_path = 0 video_save_path = "video_out/" video_fps = 25.0 test_interval = 100 dir_origin_path = "img/" dir_save_path ...
4eef10ed614286f72eb06a84c17d9e4c2d6143cfc89bd441b34fec82784732f5
Python
3,237
113
import numpy as np from scipy.stats import chi2_contingency, fisher_exact, boschloo_exact from statsmodels.stats.contingency_tables import mcnemar from statsmodels.stats.proportion import test_proportions_2indep from .fisher_exact_nonunity import fisher_exact_nonunity def binom_2samp(x1, n1, x2, n2, null_ratio=1.0, ...
672e3567b6f19ba06983d48e8008676a2d798753377be7d35a5774980f694f97
Python
3,238
91
#!/usr/bin/env python3 """Unit tests for pcd_io: write a binary PCD, read it back with the tiny parser, and check voxel downsampling. Runs with plain python (numpy only): python3 PythonAPI/examples/av_stacks/autoware/map_tools/tests/test_pcd_io.py """ import os import sys import tempfile import numpy as np sys....
4cdae2bcc23043c527c0351e94e38701651683d74af7d5de781aa43951775e53
Python
3,239
93
import sys sys.path.insert(0, '.') import argparse import torch import os from utils.simplesum import simplesum from utils.complexsum import complexsum from utils.valsum import valsum from utils.runtime import runtime ###### add your model ###### from models import MiniSeg_K2 as net #from models import UNet as net #fr...
6d202a560c30ea85f8e100e93ac71bbced2084bff4dcbc33326a74bd4a4ba716
Python
3,239
70
# 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...
bdcdf00ed10bb085b6ad8268fa71d3bc06be488d80eb5b9c2d0aa50d4fd4bc89
Python
3,239
83
# 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...
4693c83f4948a912eaf25b766123e825f5b40bb367f4f686a7b37914ca1a5495
Python
3,240
83
import os import sys from datetime import datetime from scipy import spatial import math import textwrap def tprint(str): print('[{0}] {1}'.format(datetime.now().strftime('%d.%m|%H:%M:%S'), str)) sys.stdout.flush() return def cosine_similarity(u, v): cosine_distance = spatial.distance.cosine(u, v) ...
6b97856be009f5ecf1a0b344e7930c93b6d0d4f19cc457507749ea3aea7eaf7b
Python
3,240
99
''' Check mesh constraints ''' import unittest import numpy.testing as nptest import numpy as np import scipy.linalg as lin import mesh from angle_area import is_angle_satisfied, is_area_satisfied rtol = 10 ** - 8 atol = 10 ** - 8 class TestCircleRefinement(unittest.TestCase): def test_mesh(self): cen...
08eb1da3af86445808385038603628a0e1c2466acd7237f7b6871d345553789b
Python
3,241
101
import logging from abc import ABC from dataclasses import dataclass from typing import Iterator, List from oaklib.datamodels.obograph import Graph from oaklib.interfaces import OboGraphInterface from oaklib.interfaces.basic_ontology_interface import ( RELATIONSHIP, BasicOntologyInterface, ) from oaklib.types ...
ad21e4964d514d828deea7ff8868dc812f9daba2a3d65c3697f7db016545c237
Python
3,241
102
import matplotlib as mpl; mpl.use('Agg') from matplotlib import pyplot as plt import numpy as np import pandas as pd import sys #gp0_devalue_sim11_.npy def evidence(h,q,ylast): n = ( (1-h) * np.exp(ylast) + h ) d = ( h * np.exp(ylast) + (1-h) ) y = np.log( q ) + np.log( n / d ) return y def get_ctx( ...
83fe3b24d885d7c0bc12e2e2af56b52d281ccfb91654e6294ccf307e32486738
Python
3,242
108
#!/usr/bin/env python3 class BoxerDataSource: """ This will use the normal indexed data source with a backing volume """ def __init__(self, image, labels, input_shape): """ Args: image: an image with channels (n, c, z, y, x) n & z can be swapp...
b359e8f9fb281f94130080b8a47a308c589f2ea995639e8c467738fff8d562b0
Python
3,242
82
from typing import Dict import argparse import logging import os from allennlp import __version__ from allennlp.commands.configure import Configure from allennlp.commands.elmo import Elmo from allennlp.commands.evaluate import Evaluate from allennlp.commands.fine_tune import FineTune from allennlp.commands.make_vocab ...
405c524740bccdb12730a1019e49bd81e21e5dbf0132991dd1708e64e37ca7d5
Python
3,244
107
# Copyright 2021 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
58ba211b1dc8a5fd42e727ad12e6f23f15fb2f909937eec4fb0961ea6589d407
Python
3,245
99
import logging import unittest from linkml_runtime.dumpers import yaml_dumper from oaklib.datamodels.search import SearchConfiguration from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.implementations.wikidata.wikidata_implementation import ( WikidataImplementation, ) WD_PECTORAL_FIN_MORPHOGENES...
0d157e17501bb02ca7ce76b01f9800736a0d4ba7fdc2d803c54fffc32e65cbff
Python
3,248
93
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
7d64f2b4eee1365a5b08f004003d0741b4be2089261c66c3db7003a73841698f
Python
3,248
130
"""Example script for running DyNeMo on simulated HMM-MVN data. This script should take less than a couple minutes to run and achieve a dice coefficient of ~0.99. """ import os import pickle import numpy as np from osl_dynamics.simulation import HMM_MVN from osl_dynamics.data import Data from osl_dynamics.models.dyn...
ab4e7e51a6313e54bb3f218e19dd4e313b95c263eca11a6c90a0d549de51882e
Python
3,248
113
from __future__ import print_function # -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- import numpy as n...
c0deb0dedd166c7d73cbd67f1e599d9b1b4bc9c66ad37d56a8973923068197d6
Python
3,252
113
""" Assembling data associating mitochondria to skeleton nodes """ import sys sys.path.append('.') import numpy as np import pandas as pd from scipy.sparse import csgraph import h5py from lib import skel, compartment, u def main(mito_filename, id_filename, output_filename, refine=False, no_diam=False): ...
46eaef05a2c608d87bbbf0e3ab491639f4149d63f0a80aeb9010e616f447ab62
Python
3,253
97
import torch from ..codano import CODANO import pytest @pytest.mark.parametrize("hidden_variable_codimension", [1, 2]) @pytest.mark.parametrize("lifting_channels", [2, None]) @pytest.mark.parametrize("use_positional_encoding", [True, False]) @pytest.mark.parametrize("n_variables", [3, 4]) @pytest.mark.parametrize("po...
4d4c1b34ef70f1fa8faf7a30abfb4b0f97c3613d4249b605fc0f3b04e24a11aa
Python
3,253
77
""" Localization - Analysis By Ferret Flattens data across vowel identity Input ----- Data comes from the analysis directory; i.e. some preprocessing has already been done to remove correction trials and equate sound durations (F1311) We also define the variables that we want to: - Maintain (and thus plot) - e.g...
effcae519d54ab658d76aaaeb7750bdd27b8500b72963cb9c230ec024ec9587b
Python
3,253
103
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Reuires https://github.com/maenu/scholar.py """ from argparse import ArgumentParser from pathlib import Path from string import ascii_lowercase import re from pybtex.database import BibliographyData, parse_bytes, parse_file from scholar.scholar import Schola...
4febc99e7d829be05c4f1135cf9f4d6ee93955282b5419d6e25e7c216e60cb3d
Python
3,256
78
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to generate the synthetic dataset for the training. See synthetic_generation.ipynb for more details. Created on Thu Nov 22 10:01:56 2018 @author: nicolas """ import os, sys, time import warnings import numpy as np from skimage import io # Add parent folder ...
5668c3e24f642b9224b3c6c0b97f2c06b4f5820497c634c3f084f660eca56298
Python
3,256
84
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing import argparse from configparser import ConfigParser from datetime import datetime import ddmr.utils.constants as C TRAIN_DAT...
1fbd50cb03da1bac1ca6788090fc9acf595dcb01544ed1758f4940678e9a9cf8
Python
3,260
100
import os import shutil import zipfile import numpy as np import pytest from backend.pipeline import PipelineManager from backend import root_tracking from backend import tracking_matcher from backend.settings import Settings from base.backend.app import get_cache_path, setup_cache import torch @pytest.fixture(scop...
25ab9562bffbd50ba881fec27150743971f02954dfe1e693d4b7d4d93b07c0b5
Python
3,260
113
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from os.path import join import mne from numpy.testing import assert_array_equal from eelbrain import gui, load, set_log_level from eelbrain.testing import TempDir, gui_test from eelbrain._wxgui.select_epochs import Document, Model @gui_test def test_select_e...
ad7d4ce5a74edb101ffded8e1028f697fef5270f2f37f3ce909b20321afd7e9c
Python
3,260
89
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
65fcdd519fdff47f493d660fbc8458cb882032afd959eed67ee53bc0fd19f75f
Python
3,261
136
# %% [markdown] # ## from src.hierarchy import signal_flow from src.data import load_metagraph from src.visualization import matrixplot from src.visualization import CLASS_COLOR_DICT from src.io import savefig import os from src.graph import preprocess import numpy as np import pandas as pd import matplotlib.pyplot as...
252236cfd51db8ed71de48f953c8c41b4bc1ebecdb56e3f4f60198e5199afc2b
Python
3,262
102
""" This module provides the DNaseFileSampler class. """ import numpy as np from selene_sdk.samplers.file_samplers import FileSampler from selene_sdk.samplers.samples_batch import SamplesBatch from tqdm import trange class DNaseFileSampler(FileSampler): """ A sampler for which the dataset is loaded directly f...
30b835fd1e12fe99c4686be99b214e0d279cbb359783a62b62abaeefff626a79
Python
3,262
92
#!/usr/bin/env python3 # Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import json import argparse import logging import sys def hms_to_seconds(hms): hour = hms.split(':')[0] minute = hms.split(':')[1] second = hms.split(':')[2].spl...
e081af285d5a3e1455a60aa83e3fe251f352cfd97cd212dd8069208cbcdd7005
Python
3,262
92
import logging from abc import ABC from dataclasses import dataclass, field from typing import List, Optional from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface from oaklib.utilities.basic_utils import pairs_as_dict, triples_as_dict from oaklib.utilities.iterator_utils import chunk from oakl...
0ad9b1bbeb441bbf806721e6e052a1947489357f09ae96a18eeb5cd28abaad71
Python
3,263
89
"""Mock worker: returns the input RGB (or a control) after a delay, with progress. Serves any backend id it is told to. Useful for API development, the test suite and ``scripts/smoke_test.sh`` on machines without GPUs. Behaviour knobs: ``--delay`` seconds per job (default 3), ``--steps`` progress events, ``--fail`` ...
8b9c013c347abce9a069d83d243d76459d213f3cbb71f963330e702826903920
Python
3,263
79
# basic imports import os import pickle import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection def generate_polygons_replay(replay: list, dims: tuple) -> np.ndarray: P = [] for e, exp in enumerate(replay): a = exp['a...
f7e61212873d6b040dc59c31131a4da50417e7d1392ea7783d9f36e12e101556
Python
3,266
90
''' Fig. 8 Anterior vs. posterior reversal time. ''' from brian2 import * import yaml from file_management import * from pylab import * import matplotlib.font_manager as fm import os from os.path import join from fitting import * from plotting import * from scipy.stats import circmean, linregress from scipy.stats impor...
0278c1437f2272b49c5b3522dfafbf9d0d737dd17d5a904614707021b750f3bd
Python
3,267
64
import torch import torch.nn as nn class ViscosityNet(nn.Module): def __init__(self, num_channels=2): super(ViscosityNet, self).__init__() nfilt = num_channels ks = 3 dilation = 1 if num_channels == 2: self.convnet = nn.Sequential(nn.Conv3d(num_channels, nfilt,...
9668f0371ceabb869baa4d8ff8de947a87bf605263160213203ae38eea2e8dda
Python
3,267
111
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Simulate EEG data""" import numpy as np import scipy.signal import scipy.spatial from .._data_obj import Dataset, Factor, Var, NDVar, Sensor, UTS from .._ndvar import gaussian, powerlaw_noise from .. import _info def _topo(sensor, center, falloff=1): i ...
05867ffca9c82d04cb73632b66a8f87e61c66278a50f48d1466d1324f401e451
Python
3,268
111
# 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...
140c4b2d2a0d7f9ba65ca7f0daf666aaef589c5d617d264074bf4d1e84322976
Python
3,268
96
"""Decoders Matter for Semantic Segmentation""" import torch import torch.nn as nn import torch.nn.functional as F from models.baselines.segbase import SegBaseModel __all__ = ['DUNet'] # The model may be wrong because lots of details missing in paper. class DUNet(SegBaseModel): def __init__(self, classes=2, aux...
2338c80dfbdea91cb27f0919dadf81db0b755c8fb6f3b90b7850ab34427f00cc
Python
3,269
76
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .box_head.box_head import build_roi_box_head from .mask_head.mask_head import build_roi_mask_head from .keypoint_head.keypoint_head import build_roi_keypoint_head class CombinedROIHeads(torch.nn.ModuleDict): """ Combine...
4da52f49d49d9c0d7e1bf2524102a1ecf2b51c3ba7d58066c00ebcf7dfa44f58
Python
3,269
87
""" Copyright Dejan Kostyszyn 2019 This method computes the standard deviation and mean of the complete dataset. This is then used for normalizing the data for preprocessing. mean = x.sum() / N, where N = x.size std = sqrt(mean(|x - x.mean()|**2)) """ import ReadData as rd import numpy as np import torch, nrrd, time...
e5cd9ffb2346a6291ff99ac60acfe723aa85288468c6ecdfb9932190b2a68b41
Python
3,269
99
import torch.nn as nn import torch import numpy as np def compute_flops(module, inp, out): if isinstance(module, nn.Conv2d): return compute_Conv2d_flops(module, inp, out), 'Conv2d' elif isinstance(module, nn.BatchNorm2d): return compute_BatchNorm2d_flops(module, inp, out), 'BatchNorm2d' el...
f0d38699590b4ceaeeca8a860a4f26a4ef106a6a2a7dcb41bdf63da9596647fd
Python
3,269
96
import preprocess as ppc import epoch as epo import cleaning as cln import evoked as erp import stats as st import plotting as pl import mne import sys import datetime import os import fnmatch ########### Setup for logging ################ protocol = 'WORDS' if protocol == 'WORDS': import config_W...
02f5399df8fb7eb599140a7af97a115e048c135c1c7d7bd835e1679b8864a158
Python
3,270
92
from h5functions import save_to_h5 import re class DicomData: def __init__(self): self.sequenceNames = [] self.spacing = [] self._phaseImages = [] self._magImages = [] # vel and mag Components self.u = None self.v = None self.w = None self....
874928c8181cab0a345162f722e75b17a8709c606dd75f1d152d197fc7ce2f90
Python
3,270
87
# 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...
aaa7af7ad6f1762c7927e2e5181fada4e092b99e19871c18c8c72391c271754e
Python
3,270
98
# 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...
e0ced79e011c18799e99379314873ac68f72667f5cd03d2fbc68482fb4b59e7e
Python
3,270
68
import json from typing import Tuple from overrides import overrides from allennlp.common.util import JsonDict from allennlp.data import Instance from allennlp.service.predictors.predictor import Predictor from scicite.data import Citation, read_s2_jsonline from scicite.helper import JsonFloatEncoder from scicite.co...
bef96479efd35e1194577d395112f56fb8aee8ca5860c3416460862672a0e95c
Python
3,271
101
import numpy as np import torch class Normalizer(object): """Normalize a Tensor and restore it later. """ def __init__(self, tensor): """tensor is taken as a sample to calculate the mean and std""" self.mean = torch.mean(tensor) self.std = torch.std(tensor) def norm(self, tensor):...
5e75ebf95b9b73c6fd6f1d40b95619cf52a75d3fe72a58ab41448ece9458a10b
Python
3,273
91
import numpy as np from mip.mip_nn import MIP_NN from globals import BIN, CONT, TARGET_ERROR, MARGIN, EPSILON class SAT_MARGIN(MIP_NN): def __init__(self, data, architecture, bound, reg, fair): MIP_NN.__init__(self, data, architecture, bound, reg, fair) # Cutoff set so as not too optimize fully. self.c...
1715ffeaf6e05fe4b16f6feef0c69214265b4d868e9d3d9c7a3926e29f2bfad1
Python
3,274
109
""" This module provides functionality for streaming data from iniVation USB DVS cameras into GeNN models using libcaer on Linux and Mac. To use this functionality, please install libcaer using the instructions at https://gitlab.com/inivation/dv/libcaer to install libcaer before installing GeNN. Instantiation...
4c4e2b6f2c167ff5073664ed5e8c3d91b669f7dd79678dd597d412dc51cae68f
Python
3,274
80
import torch.nn as nn import torch import torch.nn.functional as F class ASPP_Sep(nn.Module): def __init__(self, dim_in, dim_out, BatchNorm=None, rate=1): super(ASPP_Sep, self).__init__() self.branch1 = nn.Sequential( nn.Conv2d(dim_in, dim_out, 1, 1, padding=0, dilat...
ba31a941a8a94fd31386e75f4f4e3a94b06c6a13c91c867cf1902a279ffefb91
Python
3,275
122
""" from https://github.com/keithito/tacotron """ ''' Cleaners are transformations that run over the input text at both training and eval time. Cleaners can be selected by passing a comma-delimited list of cleaner names as the "cleaners" hyperparameter. Some cleaners are English-specific. You'll typically want to use...