sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4aa5fd2d062787a7a787cf19c98c2cc5e3c70343a6b8e9c3b9e8b86bcc319c7c
Python
4,581
135
import torch import pytest from ..fourier_continuation import FCLegendre, FCGram @pytest.mark.parametrize("FC_class", [FCLegendre, FCGram]) @pytest.mark.parametrize("dim", [1, 2, 3]) @pytest.mark.parametrize("d", [3, 4]) def test_fourier_continuation(FC_class, dim: int, d: int): if dim == 1: batch_size = ...
34d16163a40ac0a2d351e37b24ccb0c7706e51867baa0e60b33181ab15be7a17
Python
4,584
126
# 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...
4dcf027d8a6a000ed0b56b00fb51038ff1704cbf18051bf4ed5dd2a8385f5c9a
Python
4,584
168
# SCSCSCSCSCSCSCSCSCSC # CSB Lab | Indian Institute of Science, Bengaluru # Chinmay K Haritas # Toggle Triad ODE # %% print("\nSpatial GRNs - Toggle Triad in 2D \n") print("ODE Solver") # Import Block import helpers from tt_vars import * from helpers import hill, p_i np, pd, plt, tqdm, time, njit, prange, animator,...
f4cf3b84613d92cdf86ad8338bb9304eb4a3fc970e1972d62b166782c6dd1791
Python
4,586
143
from src.landmarks.transforms import * from pathlib import Path import itk import sys from monai.transforms import Compose from src.landmarks.inference import inference_on_one from subprocess import run itk.MultiThreaderBase.SetGlobalDefaultNumberOfThreads(1) def sub_ses_from_filename(filename): fname = str(Path...
ede7c12f7653f1094366911bae70f7b502286270e2f9cbedba3906eb39b4008e
Python
4,588
150
import pickle import sys from typing import List import os from cached_property import cached_property import numpy as np from skimage import io, measure from lib import colocalisation class File: """Base file class to handle images""" def __init__( self, image: np.ndarray, name: st...
fb07c07d656806e26c994ebe5450b0f516f86f2921384b469a16695fd7a98e84
Python
4,588
113
#################################################################################################### # 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 ...
6f56d8f1a160efba3834df282800a0e4bc81bbe7bc1d3856e72019545902d4de
Python
4,592
128
# 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...
3711bc74cbfe0acb8625fe5f71b8a95255551364d7032965ce52a011c0e18f21
Python
4,593
128
# 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...
52a45a43f57cb5a3c6285418c4c133c56cab34e0e67d0b483b8b1ae5cebea84c
Python
4,595
128
# 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...
dcd6c050d7099081a87b7ed74408e2d8f21cb49f7217a447de49820920a97425
Python
4,595
123
import os from os.path import join import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import ShuffleSplit, GridSearchCV from sklearn.metrics import (mean_absolute_error, mean_squared_error, ...
e6d898ea52c48c5874dd46d7fc9b288c2d1e922779909eb5434acf01b9b45ced
Python
4,595
128
# 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...
4bc075bf63957a5ddfea11e9d60ed8ff5ff9be16544afa710998971908135de0
Python
4,596
129
# 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...
5a99a1bd0103eda7522ea4894dbd7762c935686fe1119b9aac15773f91f3612a
Python
4,597
98
#from utils import accuracy from utils import Config import numpy as np from pygcn.utils import accuracy, encode_onehot, normalize, sparse_mx_to_torch_sparse_tensor from pyagnn.agnn.model import AGNN from pygcn.models import GCN import torch.nn.functional as F import torch.optim as optim import scipy.sparse as sp impor...
d55f73948bb15d01bac915dfff022c03e89648bd70f726642910a62088948793
Python
4,599
142
import torch import pytest from tensorly import tenalg tenalg.set_backend("einsum") # Parameterize use of torch_scatter if it is built try: from torch_scatter import segment_csr use_torch_scatter = [True, False] except: use_torch_scatter = [False] from ..gino import GINO # Fixed variables in_channels =...
8096b83b7a1027937dd20df9d2fcfdc6b86f4c1dca1556b49ad71068d5ed2e33
Python
4,600
102
# Utility scripts used by sleep, spectrum & spindle import pandas as pd import numpy as np import copy import datetime from scipy.interpolate import interp1d from scripting.spectrum.metrics import freq_index from scripting.spectrum.dataset import extract def spindle_to_pinnacle(spath, pinpath, between=None, fmt='%m/%...
6bd3d15571a09f58dab7dab0afb7758d988c787a644ee425eb94e5120c53b4b2
Python
4,603
123
#!/usr/bin/python import os import sys import copy cmdl_parse = copy.copy(sys.argv) import matplotlib matplotlib.use('Agg') from argparse import ArgumentParser from os import path, environ import importlib try: from modules.parameters import ParameterSpace from modules import io except ImportError as e: ...
157a08bffdf662606b5e1a40adfa8809517e1f668bcf7507693e50895019bd77
Python
4,605
138
__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, Union import time import numpy as np from tmkit.seqnetrr.net.Reader import Reader as prrcreader from tmkit....
830d003bf504b630e38b21b556a9828454ed55668517ba29756a032764cb3ca4
Python
4,607
119
from torch import nn from torch.nn import functional as F import torch.nn.utils.spectral_norm as spectral_norm import numpy as np import random import torch class GANLoss(nn.Module): def __init__(self, gan_mode='hinge', target_real_label=1.0, target_fake_label=0.0, tensor=torch.FloatTensor): ...
0fb5e1a9458b893524385c38d94cb5bd9ee7a5d616880483ad61d5563ebed323
Python
4,609
108
import os import sys import warnings from types import ModuleType from typing import Optional, Tuple import numpy as np from ..base import DatabaseBase, ALL, load_fids ######################################################################## class Database(DatabaseBase): """""" fids = load_fids(os.path.join(...
1aebc3b39cb1eabf2405e1155e68b2d614c27210804b55b1979d85f9ec375e9a
Python
4,609
201
# Using Skorch import torch import skorch import numpy as np import pandas as pd import matplotlib.pyplot as plt from torch import optim from torch.utils.data import DataLoader # Basic Functions we use in Skorch from skorch import NeuralNet from skorch.callbacks import EpochTimer from skorch.callbacks import PrintLog...
1ebce255d9237b46178cb928efe108fbe69825cbfbb06996c5805ee84d451359
Python
4,610
103
__author__ = 'tsungyi' import cocoapi.PythonAPI.pycocotools._mask as _mask # Interface for manipulating masks stored in RLE format. # # RLE is a simple yet efficient format for storing binary masks. RLE # first divides a vector (or vectorized image) into a series of piecewise # constant regions and then for each piec...
fc77ed338774628a474face3ee2e6e58d17ce2813252b8f89de642eb6ac2afbf
Python
4,614
123
import os import pyBigWig from src.dataset import EncodeDataset TEST_DATA_PATH = "data/test_data/" class TestEncodeDataset: def setup_method(self, test_method): # read test intervals sampling_intervals_path = os.path.join(TEST_DATA_PATH, "target_intervals.bed") intervals = [] wi...
c198a12eeb61c9c11ab4004d60e0242baeeff8491a6df013847480ff465ee7e7
Python
4,615
179
# %% [markdown] # ## import os import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib.patches import Circle from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d.art3d import Poly3DCollection from sci...
13c0bf7bb760ec149eb966cfaf74e5b267b752d2df76b0823c0d65729cdb98c4
Python
4,617
120
"""Blender-backed replacement for CARLA's FBX2OBJ (see references/maps.md). Reproduces Util/DockerUtils/fbx/src/FBX2OBJ.cpp without the Autodesk SDK: * SetMaterials() assigns ONE material per mesh node by substring on the node name, first match wins; unmatched nodes fall back to "block". The names are the c...
d62b52715bb35438b7383fff3c6394e22b6c599184842f281c59fb103aa78644
Python
4,617
129
# 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...
dfcfcb70dc323c518985e0890beb423a132b7305b9ee39416c2f4dc017ff9bf7
Python
4,617
129
# 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...
a924440e60e091e84a30ed8be3b9b8a11368052dc87d85105847b72049118f82
Python
4,619
131
# 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 ...
c5b18ee1c5513fe953959f167c2f0b752f62250483caea2984452caf96f75888
Python
4,624
130
# 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...
5337d6a6e4fa0bb5e149aebfa7093c1e74107cc2de15c6179bc30b6aeeec5537
Python
4,625
135
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unetsl.cli_interface import unetsl.model import unetsl.data import sys import pathlib import re import numpy import keras import random def debugLog(message): with open("debug-log.txt", 'a') as f: f.write(message) def createFlattenedM...
3d5266a74c3a1dcbd9928aec35ba2cca5425ff6d5346652a0346373838c8a425
Python
4,626
120
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from scipy.special import gamma class StaticFilter(nn.Module): def __init__(self, channels, kernel_size, out_dim): super().__init__() assert kernel_size % 2 == 1, \ 'kernel size of StaticF...
d84051df2aeb1ccf544e0dcb377ce984429863234a15b43ca591a925df53bd2e
Python
4,626
131
# 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 ...
3e853822940dd271ea70a76c653ccbb72b45e911e83bc4d6d56f76af75d8370d
Python
4,627
100
""" 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...
6db99280ed7098402403c8ccf779f49923a4486ab99806c878ab63d3615cc55a
Python
4,627
152
############################################################################### # Author: Bernard Hernandez # Filename: # Date: # Description: # ############################################################################### # Generic import uuid import json # Specific from pathlib import Path from datetime import ...
13a705d06a2fac909d279f93ceb073b70986152075848785b60fad6f7b814f11
Python
4,629
130
# 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...
031cc3b4a5b7f6967dec916b907d2ed4098c77b7877d8f04f16e37377d085fe1
Python
4,630
117
#!/usr/bin/env python3 """Verify an imported map on a RUNNING CARLA server (uncooked -game -nullrhi is enough — a map needs no rendering to load and drive). Boot the server directly on the imported base level, e.g.: bash ../run-carla-server/scripts/run_server.sh /Game/<pkg>/Maps/<Name>/<Name> 2000 & then: pyth...
0e8937e5e6bf393a282546ef413c2d91e4720143c7d05f53f7f66350d438a9ff
Python
4,630
102
import os import numpy as np import mindspore as ms import mindspore.nn as nn from src.callback import EvalCallBack from src.resnet import conv_variance_scaling_initializer def filter_checkpoint_parameter_by_list(origin_dict, param_filter, cfg): """remove useless parameters according to filter_list""" for key...
a8d620f52f1b3173d1456376e297aece6defa0217340db90b7f04b88cb7f8b2d
Python
4,630
155
#!/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 logging import socket import sys from datetime import datetime import torch import time import wandb from lstm import RNN_LS...
6dcab7f82379eb02587ffe10118e6a24dcce4ca62e3cd5b0b7105a41cb0e9ca2
Python
4,632
73
from pathlib import Path from matplotlib import pyplot as plt from metrics import calculate_lateral_errors, read_frames_driving def draw_error_plot(ax, model_frames, expert_frames, title=None): lat_errors = calculate_lateral_errors(model_frames, expert_frames, only_autonomous=True) autonomous_df = model_fr...
4d45d0557231ffb8d1c9952bb62e1c0f0621f6cbd7e0b43e2659ea2298a57abf
Python
4,633
124
import torch from torch import nn from ..utils import constant_init, kaiming_init from .registry import PLUGIN_LAYERS def last_zero_init(m): if isinstance(m, nn.Sequential): constant_init(m[-1], val=0) else: constant_init(m, val=0) @PLUGIN_LAYERS.register_module() class ContextBlock(nn.Modu...
8a038410c795aff1f667135257444af4cfa96c7f0b8df1f9cd9a612ca125b97e
Python
4,634
130
import torch from .builder import IOU_CALCULATORS @IOU_CALCULATORS.register_module() class BboxOverlaps2D(object): """2D IoU Calculator.""" def __call__(self, bboxes1, bboxes2, mode='iou', is_aligned=False): """Calculate IoU between 2D bboxes. Args: bboxes1 (Tensor): bboxes have...
0be2d2268f48623c7e7c6b78529293b7b133b1851948c5ebd576575b76a39272
Python
4,635
136
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
6dfbae1e9548323d95d17fc393bcb1c00555df9998c2e7de67f53054142fd226
Python
4,635
125
from .skeleton_data import * def TrajData( raw_positions, time, graph_info={}, traj_info={}, original_positions=None ) -> SkeletonTrajData: assert raw_positions is not None, "raw_positions is None" if graph_info["data_type"] == "invariant": return InvariantTrajData( raw_positions, ...
8f00b5f7dcfab135affb2df0a0344b63aa7ff39804fc31273e09d366d9c02d2c
Python
4,637
126
# 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(DR): P = [] for e, exp in enumerate(DR): a = int(e/25) s = e % 25 x = int(s/5) ...
b07698ae3e26d3a3b53c030c0b2ccc70fe3a20391106c0fea54ff179a2d9cefc
Python
4,637
162
#%% [markdown] ## gzipping a connectome # > A (perhaps silly) experiment running gzip on some connectome edgelists # # - toc: false # - badges: false # - categories: [pedigo, graspologic] # - hide: false # - search_exclude: false #%% import gzip import os import matplotlib.pyplot as plt import networkx as nx import nu...
3d3a2d3395659a28451203a34fc17bf8ea2bf1cfcd4a00f3ebd3154c396c82ba
Python
4,638
118
# basic imports import os import pickle import numpy as np # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld def single_run(world: dict, trials: int = 20, batch_size: int = 20, number_of_replays: float = 20) -> (list, np.ndarray): ''' This me...
f023191b0295e46a49f40902bf6badea1caf292895798adefce5f13c5d829d9b
Python
4,639
141
import torch from torch.nn import Parameter import torch.nn.functional as F import torch.nn as nn from torch_scatter import scatter_mean from torch_scatter import scatter_sum from torch_geometric.utils import remove_self_loops, add_self_loops, softmax # torch_geometric import from torch_geometric.nn.inits import uni...
8a71808252bd8ebdee0c28fcdcaa3e56e5b80365b34a4fa8c6d65ddb0d92ef83
Python
4,640
137
"""Base model class.""" import numpy as np from sklearn.metrics import roc_auc_score, average_precision_score import torch import torch.nn as nn import torch.nn.functional as F from layers.layers import FermiDiracDecoder import layers.hyp_layers as hyp_layers import manifolds import models.encoders as encoders from m...
e4133d687a308c1e048ddf36370955cf2fb84680be0858dbf7ed95c309850507
Python
4,641
128
# 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...
48aff4918ed6e972a7ec1bf0fd305cc2bfe761699ceb64f4e03a2cc9f0470a58
Python
4,642
138
# 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...
7ccb1a77dcd9fb8655aaecc9a882e3386fb8d47393e1b6488c226ec7bf80e2fc
Python
4,643
137
# 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...
01cb798c246a811ca2573fd4668badc071ececabbf1b6c8368cc93c3dff36b00
Python
4,644
147
#!/usr/bin/env python3 """ Example usage of scHumanNet Python package. This script demonstrates how to use the scHumanNet Python package for cell-type-specific network analysis. """ import pandas as pd import numpy as np from schumannet import ( sort_add_lls, get_centrality, combine_perc_rank, find_al...
661d2d05b378d65787a8e251bd2f128203173ec9b0e8f1cd21bfeda7f210f68a
Python
4,644
148
import os import time import logging ## Plots import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import Ellipse import seaborn as sns import pandas as pd import numpy as np from sklearn.mixture import GaussianMixture # from scipy.misc import logsumexp ...
195e146dadc192351211b34ae75b3690a07b4c6fe0ba848babf2862ab0285e61
Python
4,645
118
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import OrderedDict import os from tempfile import TemporaryDirectory import unittest import torch from torch import nn from maskrcnn_benchmark.utils.model_serialization import load_state_dict from maskrcnn_benchmark.utils.checkpo...
2ee0bf2dc460052ac390e745284715f7ce4258b2774c1da81e25b2257b7c078e
Python
4,646
130
# 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...
82ad95335c22559c7d208e63966b49365cb8fb294248075890ac494938207d54
Python
4,646
115
import os import sys import json import shutil import datetime from xml.dom.minidom import ReadOnlySequentialNamedNodeMap def cleanup(day): infofile = "setup_information.json" f = open(infofile) info = json.load(f) f.close() save_dicoms = False if info['save_dicom_data_switch'] == "True": ...
d963a6de13335b189a97d37cc022ad9ca6cf0306058abd70d0040cf3401d3736
Python
4,646
120
#################################################################################################### # 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 ...
7f6c54d69e4743184a2f43cdd1366faaec0a10535666ee6bcaffc883453d3b8a
Python
4,647
126
# 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...
81cb48cd612dc133a3b1b3f5676936f06b76f55b4f3b89c247e5304a75571e43
Python
4,648
136
""" python centerline_cli.py --dataset constantx5b5 for DATASET in constantx5b5 switch45x5b5 noisy3x5b5; do python centerline_cli.py --dataset $DATASET & done """ import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import sim_utils import argparse import pandas as pd import config impo...
bbd026b7571fae14b2bdaaa3772fa43626039f8ac3b6bb807e4445c6af3a1baf
Python
4,650
116
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
59f471d5592a1071965e7d324739512d891b764fbd29b5a3d391af88284bf422
Python
4,652
185
import os from collections.abc import Generator from pathlib import Path def readlines_reverse(filename: Path) -> Generator[str, None, None]: """Read file, line by line, backwards""" with open(filename) as qfile: qfile.seek(0, os.SEEK_END) position = qfile.tell() line = "" whil...
db370b2f1fa36cf38899cc246e7ee43857cc676137e176cbe5f878d8cbd4f887
Python
4,653
137
#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 ...
40fb3f67da203fec4f6efa21dabf3ea8ef663642b1c7f4cdf2993b46c576b688
Python
4,654
137
#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 ...
365ae50dac1b494bdee3320a6fc749e32d6936efc74da7952fbab52aa603d3a1
Python
4,655
97
"""Shared plumbing for the ``api_*.py`` demos (Python API, no CLI subprocess). Every demo connects the same way the CLI does — ``--endpoint``/``--token``, else ``COSMOS_URL`` / ``COSMOS_TOKEN`` — fails fast with an actionable message when the node is unreachable or the backend is not loaded, and stores whatever comes ...
7817042aaceb33a629c4e76cafe280ab5153cf638bffab5161409b850f32cf7d
Python
4,657
108
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 shutil import copy2 import os from datetime import datetime import dd...
b907b50fd281563476a23b357eb7c601c6bf27829da88f403241175e9a9725b7
Python
4,657
128
from time import time import tensorflow as tf import numpy as np from globals import TARGET_ERROR, MARGIN """ Ported from Icarte's formulation from https://bitbucket.org/RToroIcarte/bnn/ Modified to allow for any integer precision, i.e. 1 (binary) or 3,7,15 etc """ class GD_NN: def __init__(self, data, N, architectur...
f44be993bbfa357ce3be073447986be08122955f16d84fe668b88691bec86b04
Python
4,657
138
# 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...
3266ad6814095cf50fa15d917cea8916c2b64009edbab9d913336a41f54a7777
Python
4,659
129
from __future__ import annotations from visualization_utils import ImageType, generate_aim_spec, align_aims, read_image_to_numpy from bonelab.util.aim_calibration_header import get_aim_density_equation from bonelab.util.vtk_util import vtkImageData_to_numpy from vtkbone import vtkboneAIMReader from enum import Enum i...
f9485e22d8c22207bdce356a078ae4f66252efe82b8e4815e762bfefa2a8f255
Python
4,659
169
# model settings type = 'Retinanet' model = dict( type='NASRetinaNet', pretrained=dict( use_load=True, load_path='./seed_mbv2.pt', seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2 ), backbone=dict( type='RetinaNetBackbone', search_params=dict( ...
3f554b4345fa472234c4923ad0ded0e89dabbe8944da199584648699d20c96e1
Python
4,660
117
from typing import List, Tuple, Dict, Iterable from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.interfaces import OntologyInterface, BasicOntologyInterface from oaklib.interfaces.obograph_interface import OboGraphInterface from oaklib.types import SUBSET_CURIE, PRED_CURIE, CURIE from oaklib.utilities...
7f3b81d9055237126de59c232acf0da3080c1fd36b2b14099ef794a2668ddd89
Python
4,660
126
import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d from pathlib import Path class MaterialHandler(object): '''Class providing material properties. :param energy_bins: Number of energy bins (step of 1 kV) used for polychromatic simulation :type config: :class:`int...
b1a17bf32b407db5d4a8a893725834e01f2e3f7a5ff40a4041f96b3e67a57bf8
Python
4,660
116
import numpy as np import pandas as pd import matplotlib.pyplot as plt import sys as sys from mpl_toolkits.mplot3d import axes3d from scipy.spatial import distance import matplotlib.cm as cm import seaborn as sns from sklearn.preprocessing import OrdinalEncoder # check distances between points to detect overlaps def ...
3156636b5ec254fbae6edde04c80fe1d9f2834537b5086ad0712afa2f5ec5584
Python
4,661
130
# 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...
4b6fbcbfd973a4f816782f82e106bdccb30529101047403d6d5c5c7ebff61475
Python
4,662
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...
75ebfd89d0905c2c6ef38a06860db22ee12b923b35af5d39922b5c35f3ff595a
Python
4,663
123
# 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...
e1179e507c5eedf03e9a36ec485c4ebe0dd252a566c3e9c888354b47f0fec058
Python
4,664
179
#!/usr/bin/env python3 """Tests for io.""" import os import sys import nibabel as nib import numpy as np import peakdet as pk import pymatreader import pytest from scipy.io import savemat from phys2cvr import io # ## Unit tests def test_load_nifti_get_mask(nifti_data, nifti_mask): # Test loading a nifti file ...
51708a448d6769a86ec64e9ab5e37107b08ea9656b65ac3c8885732fce056062
Python
4,665
190
import os import numpy as np from zipfile import ZipFile from PyQt5 import QtCore, QtGui COLORMAPS_PATH = 'Content/colormaps.zip' def interp_values(values, stops, n_colors=256): """ Linear interpolation of a given vector of values, taken at given stop points in [0, 1] """ ip_vals = np.zeros(n_color...
59fcbaad5bf04f7e440fd2a4f724d9d4cc2849c83571420428cebf267f6a5d20
Python
4,665
130
# 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...
4bb8ea2ad09a24e1df8f5c744e84b9c4853309d18d996becbaab429a430a097e
Python
4,667
143
""" This program is for tracking zebra fish around in a tank.""" """IMPORTS""" import numpy as np import cv2 from skimage import feature import time import matplotlib.animation as am from matplotlib import pyplot import csv import configparser """GLOBALS unfortunatly the trajectory must be global due to the way t...
8bbbb55b5e5d01e896ee29b045548c880385ac475a9d61cc3ef63aa7b15d70cd
Python
4,667
131
# 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...
7a9a361eec37844db0afdacfb8f3c45ceca5a38b58f9dd41a7031c3248fa6f80
Python
4,669
136
# 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...
beb4e72e1496bbb27f7f7490b08f10e607896bd9a4cd4391e26371be3601d565
Python
4,669
122
#!/usr/bin/env python3 # # Copyright (c) 2018 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 # to u...
131120aeffb2dd56122993fc5273114c39e7823f7d359cf79434e5fd2984882b
Python
4,671
136
import os import numpy as np import argparse import glob import math import ntpath import shutil import urllib # import urllib2 from datetime import datetime import warnings warnings.filterwarnings("ignore") import pandas as pd from mne.io import concatenate_raws, read_raw_edf import dhedfreader ...
e28e429027e3b4dedbf67c32f8a08fff8c664e829909603e3e94793a59a61dfe
Python
4,673
124
import numpy as np import torch from base import BaseTrainer from utils import inf_loop, MetricTracker import torch.nn as nn selected_d = {"outs": [], "trg": []} class Trainer(BaseTrainer): """ Trainer class """ def __init__(self, model, criterion, metric_ftns, optimizer, config, data_loader, fold_id, ...
e46fa2fb35ace3b55e82afd2890d75d4f01c975c8d4efc18046f41d91e5f30f3
Python
4,673
133
""" This code is modified from networkx. """ import torch import random import numpy as np import networkx as nx device = "cuda" if torch.cuda.is_available() else "cpu" def swap(G, subset: list = None, nswap: int = 1, max_tries: int = 100, seed: int = None): """Swap two edges in the subgraph while keepin...
11ea8e05889c404c52b11216ad9b0eee769e77430abebf94bb9ccd7ec493d714
Python
4,674
136
import numpy as np import torch import torch.nn as nn def _compute_fans(shape): """Computes the number of input and output units for a weight shape. Args: shape: Integer shape tuple . Returns: A tuple of scalars `(fan_in, fan_out)`. """ if len(shape) < 1: # Just to avoid errors fo...
e69aec65dff3e1c70bba3b3d9f10dd7e62769ae0f487204781e639786b431244
Python
4,677
151
#! /usr/bin/env python # Copyright 2016 Vimal Manohar # Apache 2.0. """Prepare NA News Text Corpus (LDC95T21) or NA New Text Supplement Corpus (LDC98T30).""" from __future__ import print_function import argparse import gzip import logging import re import subprocess import sys from bs4 import BeautifulSoup sys....
50bf63b6bbf1a0064441d1c07de266706d16c3d752ee5149440fd1fabef7a354
Python
4,679
122
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ############################################################# # File: fs_model_fix_idnorm_donggp_saveoptim copy.py # Created Date: Wednesday January 12th 2022 # Author: Chen Xuanhong # Email: chenxuanhongzju@outlook.com # Last Modified: Saturday, 13th May 2023 9:56:35 am #...
e8a5a609f1b77158796f97c368656a2914e8d6898c1982461d78c794f3f2ec9b
Python
4,679
118
"""On-disk clip layout. :: <clip_dir>/ manifest.json ClipManifest (contracts.py) rgb_<camera>.mp4 H.264 crf 14 depth_<camera>.mp4 seg_<camera>.mp4 H.264 4:4:4 lossless-mode controls edge_<camera>.mp4 optional sema...
1a84c94e7e196ed5786d476eab5446f3c768dd22a4701221fbf803857b2e97ef
Python
4,683
99
# 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...
47727c2af9bee6c65c5f3d225e93b5e929139152de9284ca61cf124d960c7adc
Python
4,683
135
''' @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 torch from transformers import AutoTokenizer, AutoModel, AutoConfig import pandas as pd import pickle import sys device = torch.device("cuda:0" if torch.cuda.is_av...
c71cb849eb00645ba0d8f9d5b5663c99882d7bdd32b8a31f10d2e89d9a48643b
Python
4,683
133
from typing import List, Union from torch import nn from torch.nn import functional as F from neuralop.utils import validate_scaling_factor class DomainPadding(nn.Module): """Applies domain padding scaled automatically to the input's resolution. Parameters ---------- domain_padding : float or list ...
d330cd6899796524b04aff4b82805a9fa7dd49a3e96ff6a8ccf6ba357eca16d7
Python
4,684
147
import pandas as pd import numpy as np from tqdm.auto import tqdm from typing import Optional, Union, Callable def renormalize_df( df: pd.DataFrame, normalize_keys: list[str], norm_range: tuple[float, float] = (-10, +10), recenter_range: Optional[tuple[float, float]] = None, ) -> pd.DataFrame: _id...
f52ae991ac7b6987ea38228be11e37da942d22d807ac31532695788d738c8060
Python
4,687
116
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 nibabel as nib import re import medpy.metric as medpy_metrics import pandas as pd import numpy as np from tqdm import ...
ab8a6dcc0dee72d306aedbaaf0bee317a9e43c50389c5a6fb0c5169699a9bda8
Python
4,688
121
# 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...
75f1ec09cd45049a1b6865205e63a6311b7ed028e58cf9504dd2764aa4b77ba1
Python
4,689
134
""" Static: Power Analysis ====================== In this tutorial we will perform static power analysis on source space MEG data. This tutorial covers: 1. Getting the data 2. Calculating power from spectra """ #%% # Getting the data # ^^^^^^^^^^^^^^^^ # We will use resting-state MEG data that has already been sourc...
c9e5edc7c933eb8474d770794ca2e0d23b2301e75136a8599d15dbe3d7cbf663
Python
4,691
153
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,...
649e0531a2a54f2c26995e39a461d036d478ba46695437ab86d8ca1541947d75
Python
4,692
128
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import numpy as np from numpy.testing import assert_array_equal import pytest from eelbrain.testing import assert_dataobj_equal from eelbrain import Categorial, Factor, NDVar, Scalar, UTS, Var, datasets, table, combine def test_cast_to_ndvar(): "Test table...
6f45e762c38d73167f3d539eb88503b07d4186b67a468b9c47cd26a9a3241b80
Python
4,692
133
################################################################### #### #### Version: 1.1.7 #### Date: 6/24/2023 #### Description: This files contains functions for logging, error handling, pickling, and other global functions. #### Author: Evan Cobb #### ###############################################################...
fd768bec40220e9d3b6564d482bde7d8d1c5035c94f120df635e0e9a8d80b835
Python
4,692
117
#!/usr/bin/env python3 """Check inward lean on a dedicated CARLA server (replaces its current map). Example: python test_two_wheeler_lean.py --port 4654 --output lean.json Works with a -nullrhi server. Tests all seven legacy two-wheelers on a flat, wide OpenDRIVE road, so road banking and collisions cannot mimic body ...
63e3526739d6796e23a87499216d7e0c4832cf28a9428cbdda659ccf99d5925f
Python
4,693
63
import sys sys.path.insert(0, '.') from svgkit import Svg, C, render_png W, H = 1260, 900 s = Svg(W, H) s.text(W / 2, 44, "Recorder .log file layout", size=26, weight="bold", anchor="middle") s.text(W / 2, 72, "Every frame repeats the same packet sequence; a packet with no records still has its header", size=14....