sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a3e1ed5656bc80fe98de7fc8a82ee2501c3f1bb55a20b6d02b3fb02df3308517 | Python | 6,660 | 174 | #!/usr/bin/env python3
"""Read and set a running CARLA server's weather, then verify.
Commands:
show print the current WeatherParameters
list-presets list CARLA's built-in named presets
preset ClearSunset apply a named preset exactly
set --base HardRai... |
c454ca4bfebb46620499a88154b4df53b364812d762beef63ce93414d3596474 | Python | 6,661 | 203 | # 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... |
a077e50b2e18113017d47b45173ebf14bb0c173caae69ff568d39a128127501d | Python | 6,662 | 217 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from collections import namedtuple
import numpy as... |
b10cbf4123aa1c3169f9df47870d750997c79ce09e06c7dca346bd03b4e3f2de | Python | 6,664 | 175 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.struc... |
f9fd95693f3b3cae182442264f99e57cdfd3a50884dd713889dce36932aa67e4 | Python | 6,666 | 165 | #!/usr/bin/env python3
# Copyright 2020 Yuri Khokhlov, Ivan Medennikov (STC-innovations Ltd)
# Apache 2.0.
"""This script converts TS-VAD output probabilities to a NIST RTTM file.
The segments file format is:
<segment-id> <recording-id> <start-time> <end-time>
The labels file format is:
<segment-id> <speaker-id>
... |
1942991dd8345a386dc713fe26f08d5b5310af8958c6d5be48d4fa2ae76c165e | Python | 6,668 | 236 | # %% [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... |
b5049c07a87ad4d4d90431a50b5284da590e3ff53ae9c34e71507cc86ea95c0f | Python | 6,668 | 235 | #%%
import datetime
import os
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.match import GraphMatch
from src.data import join_node_meta, load_maggot_graph
from src.io import savefig
from src.visualization import adjplot, set_theme
from tqdm im... |
690cdeceab98266a17ebc45c129f69dbd161ff5991f110131a7576b1b02cbc34 | Python | 6,669 | 120 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 09:28:25 2021
@author: paulmueller
Needs AFNI installed
"""
import numpy as np
import subprocess as sp
# Definitions of the regions also found in Murray et al., 2014
# using the Glasser et al., 2016 atlas and its literals in AFNI which must be ... |
4917cade119a7f0cf0315bc0dd6c820ed11411ec99f25ab213b7709f9df19390 | Python | 6,670 | 161 | # Will check the channel folder ChartJS files for common problems
#
# Usage:
# validateChartJS.py "path/to/NeuroMLmodels" to validate_relationships all models
# OR
# validateChartJS.py "path/to/NMLCH....XXX" to validate_relationships a single model
import numpy as np
from matplotlib import pyplot as plt
import c... |
7715ffe3207d2609ec62bcb1079a82416e029c84c2a71ac8275b7f6efec62232 | Python | 6,675 | 166 | # 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... |
bc2656ad599d8f4ad143c4994dd629f84de606b4b3cfbf387ccc9f17ad288c64 | Python | 6,675 | 244 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from tmkit.retrieve.MSA import MSA as remsa
def run_hhblits(
hhblits_fp: str,
send2cloud: bool,
cloud_cmd: str,
fasta_fpn: ... |
cafa74acf058d2d623c05f77002c810213436935e541776573f95438eafeb43c | Python | 6,675 | 194 | import math
import torch
import torch.nn.functional as F
from torch import nn
from .inference import make_retinanet_postprocessor
from .loss import make_retinanet_loss_evaluator
from maskrcnn_benchmark.layers import Scale
class DenseBoxHead(torch.nn.Module):
def __init__(self, cfg):
"""
Argumen... |
19cb3536f6e695652c339dc87c1e95742850ce8cf69bf2c70315f6c98006a4df | Python | 6,676 | 120 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, InputNoise
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list
from modules.visuali... |
70927df43e5a3b393e976e70ac07938160eec25f124151ac1c949d69bf28c0ed | Python | 6,677 | 172 | #!/usr/bin/env python
# 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 appli... |
685402231c4486ae13d0b4bec638cfff2b0e22e531ccb416b9a7413d4549c69c | Python | 6,679 | 149 | import sys, os, json
import warnings
warnings.filterwarnings("ignore")
import torch
import nltk
nltk.download('punkt')
sys.path.append("..")
from models.model import Document_Classifier
from models.transformer_model import *
from utils.utils import *
from utils.data_utils_gnn import *
from utils.data_utils_txt import... |
5a9dd7ef95ae03865e7e596bdc876fb553b2cb1700539350dcf5b95847c56e0e | Python | 6,684 | 237 | """
Plotting tools for publication graphics using matplotlib
"""
from dataclasses import dataclass
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from lib import units, fonts
def match_axes_limits(axs:list, dim:str, min_to_zero:bool=False) -> None:
"""
Force multiple axes to ... |
ed233cf0de73e5eca3ad3f17d6815ebeb795a12a1e8d3e12558575927f042e26 | Python | 6,685 | 225 | """
Training script for Burgers equation using standard neural operator training.
This script trains a neural operator on the 1D time-dependent Burgers equation
using the standard training approach with weighted loss functions and optional
multi-grid patching for improved performance on high-resolution data.
"""
impo... |
f1469ee9355e281e5f4bd319cc991566732762624ffd50183aab7beacdfacf5e | Python | 6,689 | 165 | import logging
import sys
import warnings
from dataclasses import asdict
from functools import partial
import chika
import numpy as np
import pandas as pd
from imblearn.metrics import geometric_mean_score
from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifier
from sklearn.linear_model import Logisti... |
54d95f8d91f2f07ed7229d8760861ac963fa8c051dc75b0db0e0492771483d5a | Python | 6,692 | 169 | #!/usr/bin/env python3
"""e2e_drive_keeper.py -- instrumentation + wedge recovery for the VAD e2e demo.
Started by run_carla_autoware.sh in --mode e2e (under CARLA_PY). A non-ticking
CARLA client that:
1. attaches a `sensor.other.collision` to the ego and logs every contact
(the only ground truth for "clean dr... |
1f38a9a7a6237e7fdb4c91ab656dd776306032efc7896668a0ae0019b08ffc1b | Python | 6,693 | 153 | """
Preparing M/EEG Data
====================
In this tutorial we will go through common ways to prepare M/EEG data. This tutorial covers:
1. Downloading example data
2. Time-Delay Embedding (and Principal Component Analysis)
3. Amplitude Envelope
4. Saving and Loading Prepared Data
"""
#%%
# Download the dataset
# ... |
828ff99ce167fde33caaefea7dc5f816ab051b94c8251432e23f4581f0d4c194 | Python | 6,693 | 244 | import pandas as pd
import pickle as pickle
import sys
import os
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from skimage import io
import utils.list_inputFiles as list_inputFiles
import utils.general_utils as general_utils
import utils.list_behavior as ... |
f65a332c051ed8de2cdafe91df1ea31ba2cf06e280aeb9def24c90112c72d2e7 | Python | 6,694 | 185 | """
TT100K Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
Modified to TT100K by: Kang Seok Hoon
"""
from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as dat... |
4f2cdafc60d1adb150e6185dd39a8a83e906298487ab9672845949d1d00d7090 | Python | 6,695 | 172 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import torch.nn.functional as F
from torch import nn
from maskrcnn_benchmark.structures.bounding_box import BoxList
from maskrcnn_benchmark.structures.boxlist_ops import boxlist_nms
from maskrcnn_benchmark.structures.boxlist_ops impor... |
ddfa63583b95f8705031cc7788f1d1e2dcd40e5891c2544e20707ac2c6533400 | Python | 6,695 | 180 | """
This file is called by routine which creates mesh from nested dictionaries (convert.py).
"""
import numpy as np
from scipy import spatial as scipy3D
import mesh.orient as orient
def preparePlane(p0=(-1, -1, -1),
p1=(1, 1, 1),
p2=(0, 0, 1),
width=1,
... |
9aa23cbfed4bbb5a56f7f2757690cae06c0e13876662f7bc384505df4c2d7104 | Python | 6,698 | 145 | # 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... |
d60f457467469498ebd69f39b6a6ae90f6958ea0fb90af8675b2bfe705bada76 | Python | 6,698 | 209 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import numpy as np
import torch
from torch import nn
from maskrcnn_benchmark.layers.misc import interpolate
from maskrcnn_benchmark.structures.bounding_box import BoxList
# TODO check if want to return a single BoxList or a composite
# object
cl... |
2431e87698fd27c39122f414f1f72d142d3eca3f0e435d5d3f7fccebbfe225f0 | Python | 6,699 | 162 | """
File: create_correction_matrix.py
Created: 2020/10/15
Last Changed: 2022/01/19
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation... |
c80e63760c59b703e127dc5099d16e84c8b58737c69fae4833fdd01a645e3331 | Python | 6,699 | 223 | """
StyleMapGAN
Copyright (c) 2021-present NAVER Corp.
This work is licensed under the Creative Commons Attribution-NonCommercial
4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
Creative Commons, PO Box 1866, Mountain View, CA 94042, U... |
934021e4a85f4fbe0bea9095de79ee10ae9d7e27a43319eaa998162714bdf3c2 | Python | 6,701 | 188 | import os.path
from typing import Literal
import pandas as pd
import torch
from drugex.logs import logger
from drugex.training.interfaces import TrainingMonitor, Model
class NullMonitor(TrainingMonitor):
def getSaveModelOption(self) -> Literal['best', 'all', 'improvement']:
pass
def saveModel(self... |
0a08d4f577400389053fe0779c76d06c9aa5eb84e04d9bc10c4e20ebfd1d2f15 | Python | 6,702 | 178 | from collections import defaultdict
import numpy as np
import pandas as pd
from sklearn.metrics import auc, recall_score, roc_auc_score, roc_curve
from sklearn.utils import resample
from tabulate import tabulate
from tqdm import tqdm
target_fpr = 0.2
white = "White"
asian = "Asian"
black = "Black"
male = "Male"
fem... |
18cee94dba538212270a8d9a4d0108345cf807153b6a974a694e68578fb3fc0f | Python | 6,702 | 169 | """
==========================
How to use Free water DTI
==========================
The free-water DTI model [1, 2]_ fits a two compartment model to dMRI data
with more than one non-zero shell. One compartment is a spherical compartment
with the diffusivity of water, which accounts for free water in the tissue.
The ot... |
3a7ddc8bf3c570f2948018ebea0ae803a26ad93ba946565b997af2e308638a5c | Python | 6,702 | 202 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"Internet communication utilities"
from distutils.version import LooseVersion
from email.mime.text import MIMEText
import keyring
import smtplib
import socket
import sys
import traceback
import xmlrpc.client
from .system import user_activity
from . import ui
N... |
24f9709a81280e34e11d579599b4fef2d1fa6e0d66c087826cead747480135bf | Python | 6,704 | 183 | #!/usr/bin/env python3
"""
File: prepare_eqtl_file.py
Created: 2021/12/07
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foun... |
221756706c52be8efe5b0938261263e7b7fd37c7ecdc8ae1f66bf7fba0368433 | Python | 6,706 | 174 | import numpy as np
from scipy.stats import linregress, kurtosis, skew
def process_epochs(mne_epochs, tmin=0, tmax=None, tslide=None, sort=False,
reject_criteria=None):
"""
Perform processing on epochs including baseline cropping, bad epoch
removal, label extraction and unit conversion... |
9ac31dc5c548fe3d23f4a06a4ecfceeef98fc7059ee8fa79a6cd23340c277477 | Python | 6,706 | 184 | import numpy as np
import logging
from scipy.stats import zscore
import dipy.tracking.streamline as dts
from dipy.io.stateful_tractogram import StatefulTractogram, Space
import AFQ.recognition.utils as abu
from AFQ._fixes import gaussian_weights
logger = logging.getLogger('AFQ')
def clean_by_orientation(streamli... |
78634c8d0b69edfa0986c1e19c5d8718d21842ae0fdab02064f3244cb24a33d3 | Python | 6,713 | 208 | import unittest
import numpy.testing as npt
import numpy as np
import Tools
# SPECIFY TESTS
class Test_check_dict_fields(unittest.TestCase):
"""Test behaviour of `check_dict_fields` function."""
def test_non_recursive(self):
"""`check_dict_fields` behaviour for shallow dicts."""
template ... |
4a6a04e41733a7595f5c65a75b90b7e0b2d1f95d800862c66ade5c467d4acb41 | Python | 6,717 | 202 | from functools import partial
from typing import List
import numpy as np
from drugex.training.interfaces import ScoreModifier
class Chained(ScoreModifier):
"""
Calls several modifiers one after the other, for instance:
score = modifier3(modifier2(modifier1(raw_score)))
"""
def __init__(self... |
5cefd55adb5d9791999d49de8608ea7e7a868b557acfdda7a591eb8fe200c7f7 | Python | 6,717 | 177 | """Local-service path and upload validation primitives."""
import hashlib
import ntpath
import os
import typing as tp
import unicodedata
import warnings
import PIL.Image
SUPPORTED_IMAGE_EXTENSIONS = {'.jpg', '.jpeg', '.png', '.tif', '.tiff'}
SUPPORTED_IMAGE_FORMATS = {'JPEG', 'PNG', 'TIFF'}
ASSET_SCHEMA_VERSION = '... |
7100f00a3192654cdc5fca26cd3344e51bbb9a079f6b7c2efe04b603c3f514db | Python | 6,719 | 183 | # DEFINITION:
# Reads Igor's (Wavemetric) binary wave format, .ibw, files.
#
# ALGORITHM:
# Parsing proper to version 2, 3, or version 5 (see Technical notes TN003.ifn:
# http://mirror.optus.net.au/pub/wavemetrics/IgorPro/Technical_Notes/) and data
# type 2 or 4 (non complex, single or double precision vector, real val... |
7a1b9f1e4a1a0e42c4806d92eba157ed0cedc39c19aa0cf83c34f8a60ae89fc3 | Python | 6,719 | 189 | # Copyright 2023 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
da2d0bde24ef5f003d6f15772e8683cdd092970b2e00b97222bf37056cf461d3 | Python | 6,720 | 161 | from mmdet.core import bbox2roi
from ..builder import HEADS
from ..losses.pisa_loss import carl_loss, isr_p
from .standard_roi_head import StandardRoIHead
@HEADS.register_module()
class PISARoIHead(StandardRoIHead):
r"""The RoI head for `Prime Sample Attention in Object Detection
<https://arxiv.org/abs/1904.0... |
ae9dfd82bb9a0d9a21874775c7acf6391db1b13133b743f7d0ce6d6f2632913c | Python | 6,722 | 177 | import unittest
from oaklib.datamodels.lexical_index import (
LexicalTransformation,
LexicalTransformationPipeline,
TransformationType,
)
from oaklib.datamodels.synonymizer_datamodel import Synonymizer
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.implemen... |
4f27f05bbe9f5d3cdc9edb282020ae732acac21aff42e93a03ba63c9542cda1b | Python | 6,723 | 196 | '''
- Define `Triangulation` object
- Initial contribution by Gary Klindt
'''
from numpy import dot, cross, concatenate, zeros, sum
from functools import reduce
class State(object):
def __init__(self, **kwargs):
self.translation = kwargs['translation']
self.rotation = kwargs['rotation']
se... |
8cd2e94a33d6e9af0ecaa9617662abbbf499e2802d0f19891c1515e27b91ad41 | Python | 6,724 | 169 | import tqdm
import ipdb
import argparse, sys
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.gnn_models.node_classification.testing import GIN_3layer_basic
def get... |
7b6699bd349b94b0bcf3142612d61739c2d432e10d93082444a96706bd2013a9 | Python | 6,725 | 240 | import numpy as np
######################## FACADES
# number_object = {
# 0: 'background',###############
# 1: 'facade',
# 2: 'ledge',
# 3: 'molding',
# 4: 'pillar',
# 5: 'deco', ###############
# 6: 'corn... |
c46de3a4561a8013b08834d988ae77b5b2ca5d670b74f95870fbb56d971298fd | Python | 6,725 | 164 | # 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... |
5cbd2473bfb802ecb34fd54b3516f01feaa011480571278e7e31953467462a5b | Python | 6,734 | 177 | import sys
import time
import logging
import argparse
def parse_info(seq):
info = {'SVTYPE': '', 'SVLEN': 0, 'END': 0} # 先考虑SVLEN,再考虑END
for i in seq.split(';'): # SVTYPE=INV;END=139008588;SUPPORT=13;STD_SPAN=4.4;STD_POS=1.5
if i.split('=')[0] in ['SVLEN', 'END']:
try:
... |
d4808bae923a1f0649a36fcdfaa232acabeb9144b697977361f328e5d1dcf7ab | Python | 6,735 | 173 | from analysis import *
from algorithms import *
from datasets import *
import rpy2.robjects as ro
import rpy2.robjects.numpy2ri
def chl_genes_vectoir(adata,genes_path):
'''
Create diurnal cycle related genes vector for ccRemover
:param adata: Scanpy annData
:param genes_path: path for gen... |
72e02cb678cb025fc8af6528fd854efc1b7c7631983a2d386b6f69b842884e08 | Python | 6,736 | 161 | """
===========================================================
How to add new bundles into pyAFQ(Optic Radiations Example)
===========================================================
pyAFQ is designed to be customizable and extensible. This example shows how you
can customize it to define a new bundle based on a defi... |
1e00b05705d00304c3c3e148f1209c43b943a211c2354a3666513ca98400fe9b | Python | 6,737 | 164 | ####################################################################################################
# Copyright (c) 2018 - 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 ... |
b40ee896c23a86bc7cf0d003322970a9f427a9ec604b264a90b1fcddf6ff0fe9 | Python | 6,737 | 195 | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2018/8/2 下午3:23
# @Author : yuchangqian
# @Contact : changqian_yu@163.com
# @File : engine.py
import os
import os.path as osp
import time
import argparse
import torch
import torch.distributed as dist
from .logger import get_logger
from .version import __versio... |
d8998bcd4e5dcef661f09f20c085994d44c2202a2ecf20e32b33c2a7a5ec1ec0 | Python | 6,737 | 188 | import random, sys
from networkx.classes.function import to_undirected
import networkx as nx
import ipdb
import torch
import numpy as np
import matplotlib.pyplot as plt
from torch_geometric.utils import to_networkx
from graphxai.explainers import CAM, GradCAM
#from graphxai.explainers.utils.visualizations import visu... |
cc0f950286bba61dbfbff8a205bc9d2862cf9990101f16a9a0c4660236e91a38 | Python | 6,738 | 168 | #! /usr/bin/env python
"""
This file provides a demonstration of how to use the SIMA package.
In order to run this file, you will need to download the file
http://www.losonczylab.org/workflow_data.zip and extract it in your
current working directory.
"""
from __future__ import print_function
from builtins import inpu... |
9e39d13dee68f4404c027f5ade695bd71350404e42cdcafcbd326fedbbb54f5d | Python | 6,739 | 148 | """ Data reader for AllenNLP """
from typing import Dict, List
import json
import jsonlines
import logging
import torch
from allennlp.data import Field
from overrides import overrides
from allennlp.common import Params
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers.dataset_read... |
4a1c30385978fd749c54c14057d05a9c90a57a10da73be10f9b99644ec71c144 | Python | 6,740 | 174 | #!/usr/bin/env python
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Allows controlling a vehicle with a keyboard. For a simpler and more
# docu... |
841f5c087bfd3aa13afbe886040774551e7f94d7b51cf5435072e6a2e58752e6 | Python | 6,740 | 211 | """Logging utilities."""
import importlib.abc
import logging
import os
import sys
from contextlib import contextmanager
from typing import Union
_logger = logging.getLogger("osl-dynamics")
class _Formatter(logging.Formatter):
"""Formats messages as :code:`[HH:MM:SS] message`.
Warnings and errors are prefix... |
ced667e7dc39e1747211ba858226af3d160c7a19535303940264531578426b5d | Python | 6,740 | 240 | # %%
import os
from pathlib import Path
import colorcet as cc
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymaid
import seaborn as sns
from matplotlib.collections import LineCollection
from matplotlib.lines import Line2D
from sklearn.decomposition import PCA
from umap import UMAP
fro... |
e191f730f4b3ca2df3fa05a67cdfcf001bc37890549668484747797bdcb24fd1 | Python | 6,742 | 188 | import os.path as osp
import pickle
import shutil
import tempfile
import time
import mmcv
import torch
import torch.distributed as dist
from mmcv.runner import get_dist_info
from mmdet.core import encode_mask_results, tensor2imgs
def single_gpu_test(model,
data_loader,
show=F... |
f4ff3457760bb3f97ea11f5ee255ea5b87a8d7b064578cc10ad0185938998fc8 | Python | 6,743 | 171 | #!/usr/bin/env python3
"""spawn_vad_rig.py -- attach the six VAD cameras to the ego vehicle.
Attaches the nuScenes-style six-camera rig required by Autoware's VAD
end-to-end planner (autoware_universe e2e/autoware_tensorrt_vad) to the ego
vehicle (role_name 'hero' or 'ego', normally spawned by
PythonAPI/examples/autow... |
2281891d9d60f1a5b3e523a81d4e70328e57077e3f6f2a41f2f6c8520dd0315c | Python | 6,744 | 235 | #%% Imports and file loading
from pathlib import Path
import pandas as pd
import networkx as nx
import numpy as np
from graspy.plot import gridplot, heatmap
from src.data import load_networkx
from operator import itemgetter
from src.utils import savefig
import matplotlib.pyplot as plt
save_figures = False
data_path ... |
b7dd6c8a7c5dd9489c993e61a139fb51de77ad3b6bfcab342dfcfb991211bd6d | Python | 6,744 | 188 | import torch
import torch.nn.functional as F
from typing import Tuple
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import k_hop_subgraph
from torch_geometric.data import Data
from graphxai.utils import Explanation
from ._decomp_base_old import _BaseDecomposition
def clip_hook(grad):
# ... |
37b1af58c36871009bdba22a1e7f56c16e637aa68e8d0ba072c30d7785050b22 | Python | 6,746 | 158 | import os
import sys
from bruker2nifti._metadata import BrukerMetadata
from bruker2nifti._utils import bruker_read_files
if sys.version_info >= (3, 3):
import unittest.mock as mock
else:
import mock as mock
here = os.path.abspath(os.path.dirname(__file__))
root_dir = os.path.dirname(here)
banana_data = os.p... |
643e4746759ea6c7720db0cd995a4a07534dcc43cab06b4605f997cdd18f0075 | Python | 6,748 | 111 | # Form implementation generated from reading ui file 'picachooser_imonlyTemplate.ui'
#
# Created by: PyQt6 UI code generator 6.6.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWi... |
2bb060693a295fa886acb91f403b78c1883305626d1eddd28fc131cadeb67d5b | Python | 6,749 | 206 | # 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... |
82aec8add002a7ebe09a90e8af37a8885327f0798091f8e761ad6d623bbbd103 | Python | 6,751 | 172 | """
File: cmd_line_arguments.py
Created: 2020/03/13
Last Changed: 2020/06/05
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eit... |
459c86da0de7478990b1ddb21aa7bcc937ee3aadbd217678d3d9144fea471ab3 | Python | 6,757 | 174 | import gurobipy as gp
from gurobipy import GRB
import numpy as np
from helper.misc import infer_and_accuracy, inference
from helper.fairness import demographic_parity
from globals import INT, BIN, CONT, LOG, DO_CUTOFF, GUROBI_ENV
vtypes = {
INT: GRB.INTEGER,
BIN: GRB.BINARY,
CONT: GRB.CONTINUOUS
}
def get_gurob... |
67ac01a7fd903815696330be3e8117bf910692028e538d89f644407968b9ea2e | Python | 6,758 | 166 | import tensorlayer as tl
import numpy as np
import os
from utils import *
import PIL.Image as pilImg
class Dataset:
def __init__(self, train_hr3d_path, train_lf2d_path, n_slices, n_num, lf2d_base_size, normalize_mode='max', shuffle=True, multi_scale=False):
'''
Params:
n_slices : ... |
c66e8a1dffd2a86e5045540eaf3aec318b1d286f32ab9f90349e7cce66326116 | Python | 6,758 | 167 | # Copyright 2021-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... |
df30bc42902c7672d0e2bc8889ae22af3ca90300e77965768676fda834d5b0fb | Python | 6,760 | 172 | import torch
from torch_geometric.utils import k_hop_subgraph
from torch_geometric.data import Data
from typing import Optional, Callable
from graphxai.explainers._base import _BaseExplainer
from graphxai.utils import Explanation
device = "cuda" if torch.cuda.is_available() else "cpu"
class IntegratedGradExplainer(... |
ee251333e2b4966329f5ef283b6d53ccece26c70581d4b99992dd263f136b013 | Python | 6,760 | 154 | # 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... |
1877b5d968b5720165e982d7c9dd71547cac6b43c72438310dc0a31628a05b50 | Python | 6,762 | 188 | """
File: create_reg_matrix.py
Created: 2020/03/16
Last Changed: 2020/03/19
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eithe... |
af8e7533cd106901b5b64367ecff4e05dac810a0e64182e3f524d9cac16e4fbe | Python | 6,766 | 172 | #!/usr/bin/env python3
"""e2e_state_publishers.launch.py -- ground-truth localization glue for VAD.
Launched by run_carla_autoware.sh in --mode e2e (ros2 launch <this file>).
VAD (autoware_universe e2e/autoware_tensorrt_vad) does not run the normal
Autoware localization stack; it needs /localization/kinematic_state a... |
937b9b3d03f627a1e2db31931260cb19a90ec245f55ed82802ea362158110fba | Python | 6,768 | 146 | """``carla-cosmos-server`` / ``python -m carla_cosmos_server``: the container entry point.
1. read settings, create ``/state``;
2. load/bootstrap tokens (prints the initial token once);
3. pick the runtime profile (auto from ``nvidia-smi`` + ``--mode`` or ``--profile``);
4. start one worker process per profile entry i... |
9f43d87f24932fe88218175941d6e4151fb633ecc6b7809efebb2d7ea04c4993 | Python | 6,771 | 155 | # 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... |
b407364f974231995d9c04a6dfde24f4e26c3dfc89e1d50c1890b9b38d2df76d | Python | 6,771 | 189 | import os.path as osp
import pickle
import shutil
import tempfile
import time
import mmcv
import torch
import torch.distributed as dist
from mmcv.runner import get_dist_info
from mmdet.core import encode_mask_results, tensor2imgs
def single_gpu_test(model,
data_loader,
show=F... |
f407531dc00a177327be5c1b70c9dfb18f65a650036fbc08c060bbb323408041 | Python | 6,771 | 183 | #
# 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 use, copy, modify, merge... |
39c1f5fb45dd09b0e5c05e3c167be24aff898cbb3bfd383fd9117293de99708c | Python | 6,773 | 170 | """Multi-take slicer for phys2bids package."""
import logging
from copy import deepcopy
import numpy as np
LGR = logging.getLogger(__name__)
def find_takes(phys_in, ntp_list, tr_list, thr=None, padding=9):
"""
Find takes slicing index.
Returns dictionary key for each take in BlueprintInput object base... |
2f2b2fa405314ea8f4843468201bf4e33c98197e417d1f47439f56a5a59f50a7 | Python | 6,776 | 116 | import tensorflow as tf
from Utilities import S, A, outer_product
THIRD = 1 / 3
KC = 1389.35457644382
# G Tensors as defined in 'A New Relatively Simple Approach to Multipole Interactions in
# Either Spherical Harmonics or Cartesians, Suitable for Implementation into Ewald Sums '
# by Burnham et al
# https://www.md... |
5b8e49ee322b17f5bfcc2b90f7bae3961b20d9e7b3b74c1ff761853a59ba84b2 | Python | 6,778 | 183 | #!/usr/bin/env python3
"""Drive a camera along the NUREC ego trajectory over the xodr-generated map
and save a screenshot every N seconds of trajectory time.
No nurec rendering involved: we only need the rig trajectory (from the .usdz)
and the OpenDRIVE file. Output: numbered PNGs (chase view; optional top-down)
plus ... |
54e91e3271e6f2cc1dac5ad53c404e514a2c1d5a6032c0da26f3e6b020a8bd87 | Python | 6,780 | 165 | # python 3.7
"""Contains the VGG16 model for perceptual feature extraction."""
import os
from collections import OrderedDict
import numpy as np
import torch
import torch.nn as nn
from . import model_settings
__all__ = ['VGG16', 'PerceptualModel']
_WEIGHT_PATH = os.path.join(model_settings.MODEL_DIR, 'vgg16.pth')
... |
0391d06fac03eb61434616022bb7478c4fa0757da522b8d1a276f273d4cba850 | Python | 6,787 | 132 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'picachooser_imonlyTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 ... |
a9a9770c590b715f1ef15e2ecf7c953b1b2e0c20b0d6fc2bb2bd2d3c38a5aa31 | Python | 6,788 | 182 | '''
PIV analysis
(Particle Image Velocimetry)
Calculates PIV vector fields from images.
Data are saved as .txt.gz files.
If the piv folder exists, skips.
Uses openpiv 0.21.2 (doesn't seem to be working with the newest version!)
!!! Note: in openpiv 0.21.2, y is flipped (y[::-1]), in later versions it's not...
TODO:... |
c257c38dc68c5c6ee1329be7678971f77713f5bc13d3931077ac1c894d597275 | Python | 6,793 | 195 | #!/usr/bin/env python3
"""
File: find_top_interacting_covariate.py
Created: 2020/10/26
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free... |
b90e7f25f341635db1d28b618082f8f2cdbde9c35287c87207675d585562487b | Python | 6,806 | 183 | import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
import torch
def parse_index_file(filename):
"""Parse index file."""
index = []
for line in open(filename):
index.append(int(line.strip()))
retu... |
e1e473cb05e5b245ddaddd1718efe0a7421770919da11c5473e5cc412569a43c | Python | 6,808 | 163 | '''
Updated version:
Now use tangent and normal vectors in input
Use them when building the mesh, respecting flagellum material frame
'''
import numpy as np
from scipy.linalg import norm
import mesh.rotate as rotate
def circleVectors2(center, normal, tangent, nTheta, radius, offset_angle=0):
"""
Don't shift... |
9ec7f3f431b2e1ad73967c4bd41ec24a78048f5b86f35203a54c0d7318d2f220 | Python | 6,809 | 242 | """utils to handle and analyse simulation results"""
import logging
import pandas as pd
import numpy as np
import json
import h5py
from tctx.util import networks
def _load_hdf5_df(*args, **kwargs) -> pd.DataFrame:
"""just so I can suppress pycharm's linting specifically for loading DataFrames from HDF5"""
... |
90278c74b0a0ae3a4f8dd075cb433c2ee166355611058aff717b1f8964fd9bee | Python | 6,810 | 161 | # 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... |
97cfc28982e41f674b73be059bef8ef0e9edf05174317fd1bd09c73b425b2bbc | Python | 6,816 | 138 | '''
adding neighbor features to time-resampled AIS dataframe (universal clock)
this builds on functions_basic_sak.df_time_resample
and GriSPy
'''
import os.path
import numpy as np
import functions_basic_sak as funsak
import pandas as pd
from tqdm import tqdm
import AIS_parameters
import inspect
import pathl... |
6b6f3deebc8c874ba3895f7856eba7b09f79a9f1626d803b4e6df3bc6c34b2c5 | Python | 6,817 | 135 | import pandas as pd
import numpy as np
'''
Descirption
study: N400
Protocol: Delirium
Resp.: F Perrin
Lead.: F Ferre
Code: L Heine - A Corneyllie
this file gives general settings for the study 'N400'
'''
################################### Subjects ############################... |
f208f2d21bc1f05accf81f13a2f24129e3310d07dac039669a58c76d6969d194 | Python | 6,817 | 175 | """Implementation of optimization based attack,
CW Attack for point perturbation.
Based on CVPR'19: Generating 3D Adversarial Point Clouds.
"""
import pdb
import time
import torch
import torch.optim as optim
import numpy as np
class CWPerturb:
"""Class for CW attack.
"""
def __init__(self, model, ad... |
0ba742f3ef122fb7e282255c51197a8783c9ae2d27c99c09086b286d9e3585ae | Python | 6,822 | 162 | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmdet.core import auto_fp16
from ..builder import NECKS
from .fpn import FPN
from .CapNet import CapsNet
@NECKS.register_module()
class CAPS_PAFPN(FPN):
"""Path Aggregation Network for Instance Segmentation.
This is a... |
4a9ad5c26ae7e1343ef4919f84ff8753879d704fa706c9102210c33a3b84642f | Python | 6,823 | 218 | '''
Reader for EDF+ files.
TODO:
- add support for log-transformed channels:
http://www.edfplus.info/specs/edffloat.html and test with
data generated with
http://www.edfplus.info/downloads/software/NeuroLoopGain.zip.
- check annotations with Schalk's Physiobank data.
Copyright (c) 2012 Boris Reuderink.
'''
... |
3988692eae3f8cab0baa21b38288ebacb167f52ec10baea7f23200c3f10ece77 | Python | 6,831 | 157 | import torch
import torch.nn as nn
import torch.nn.functional as F
from models.baselines.segbase import SegBaseModel
__all__ = ['GFF']
# The model may be wrong because lots of details missing in paper.
class GFF(SegBaseModel):
def __init__(self, classes=2, aux=True, backbone='resnet50', pretrained_base=True):
... |
72a81ce2fb836e381d0cf39852c7c52b39b88281cba7fcdc694fd3874c51e15b | Python | 6,831 | 187 | import torch
import torch.nn as nn
import torch.nn.functional as F
from models.baselines.resnet import resnet18
__all__ = ['BiSeNet']
class BiSeNet(nn.Module):
def __init__(self, classes=2, aux=False, backbone='resnet18', jpu=False, pretrained_base=False):
super(BiSeNet, self).__init__()
self.au... |
93383bce7e823eda1f764751934feafccbfa0e63c350ecf35a0cfe5d8fcc2969 | Python | 6,833 | 175 | #!/usr/bin/env python3
"""
File: combine_star_output.py
Created: 2021/12/01
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Fo... |
cdebcf4d49098c2580778725edeeb6621c27e49bbc6408e576a72ee68ffaf3e0 | Python | 6,833 | 198 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
r"""
Basic training script for PyTorch
"""
# Set up custom environment before nearly anything else is imported
# NOTE: this should be the first import (no not reorder)
from maskrcnn_benchmark.utils.env import setup_environment # noqa ... |
2a3ebc0f5fbc6c0fd3fafb82a4e5a5add18b36ef240e88d1e8fbca468ed80a58 | Python | 6,835 | 232 | #!/usr/bin/env python
# coding: utf-8
# General Imports
import os
import pandas as pd
import numpy as np
from rdkit import Chem
import time
import sys
from pathlib import Path
SELFIES_coder_path = Path("../SELFIES_coder")
sys.path.append(SELFIES_coder_path.as_posix())
import SELFIES_coder as SELFIES_CODER
import selfi... |
b16f91cad55745bb6d0b6ff1b3d3b2b5b5ef57e5748468ca1dbf29af578b11d1 | Python | 6,836 | 180 | import numpy as np
import statsmodels
import scipy
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from statsmodels.stats.multitest import fdrcorrection
from scipy import stats
import pandas as pd
import argparse
import os
# increase length of string in pandas
pd.options.display.max_colwidth = 100
def pos... |
e390e0e77428aa00c0de7a904dff3645ad73b091c459f9170dc48efb26802944 | Python | 6,836 | 155 | # %%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
from data_settings import data_date, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
from contools import Celltype, Celltype_Analyzer, P... |
4ed543e634bc05ce1ffe1c8a41a1a3a34b5925d29b66ed2ed660c7dc4c5cdbaa | Python | 6,840 | 217 | """
This module provides utility functions that are not tied to specific
classes or concepts, but still perform specific and important roles
across many of the packages modules.
"""
from collections import OrderedDict
import logging
import sys
import numpy as np
from .multi_model_wrapper import MultiModelWrapper
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.