sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d0dd8875b4a81723d43869375fc838fed1058990c24eb7e4cd4386c33534c8bd
Python
13,810
314
#!/usr/bin/env python3 """Install / switch / verify a CARLA Leaderboard stack at a chosen version. Subcommands detect which leaderboard, scenario_runner and CARLA are present (read-only) plan print the exact commands for a target version (read-only) install clone or switch both repos, then p...
12327a33b694dad250440910aa8b7a2027560dc0b9593d0549b3d87cd1192e2d
Python
13,813
385
#!/usr/bin/python """PyMOL plugin that provides show_contacts command and GUI for highlighting good and bad polar contacts. Factored out of clustermols by Matthew Baumgartner. The advantage of this package is it requires many fewer dependencies. """ import os import sys from pymol import cmd DEBUG = 1 def show_c...
42258e18cef5fb033e63f6e1a06c2897432c095a7177606ac6bb1119f5f2c856
Python
13,813
329
# -*- coding: utf-8 -*- # File : batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import collections import torch import tor...
9fede157785de280f7df31cccd0b6d38a7e8d1ed378462a0905a974dfe33942c
Python
13,825
425
"""Data-specific colormaps""" from itertools import cycle import logging from math import ceil from numbers import Real # colormath starts out at 0; needs to be set before init logger = logging.getLogger('colormath.color_conversions') if logger.level == 0: # otherwise it was probably set by user (DEBUG=10) logger...
df1e2e976dd89ffd66fbc9422cbfe3c92cac9ae29f24e6959ab383e41035cb3b
Python
13,830
409
import tensorflow as tf from typing import List, Tuple, Union from .affine_transformation import AffineTransform PI = 3.14159265359 #------------------------------------------------------------------------- class DiffAug(tf.keras.layers.Layer): """ DiffAug class for differentiable augmentation Paper: h...
814a0d1a91d557445e4cf4318a1ffe605279dc19e09ba809a1552b0d28e9a92e
Python
13,843
329
import time import os from sklearn import metrics import numpy as np from IPython.core.debugger import set_trace from sklearn.metrics import accuracy_score, roc_auc_score # Apply mask to input_feat def mask_input_feat(input_feat, mask): mymask = np.where(np.array(mask) == 0.0)[0] return np.delete(input_feat, m...
74adc6ed4773a7aa6857f2213396fb9b48b154e001006a31fed26c5221b1d5b5
Python
13,850
363
# 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...
566d0b04f6fe3e0a572a190da6d3812bc34ef3dc7e21380406f5a6b5d1b1a20f
Python
13,855
390
import nibabel as nib import os import os.path as op from time import time import numpy as np import pandas as pd import logging import pimms from AFQ.tasks.decorators import as_file from AFQ.tasks.utils import get_fname, with_name, str_to_desc from AFQ.recognition.recognize import recognize from AFQ.utils.path impor...
e9488bcfe54199ef0b654495f9cee5e781bbde7485ea978d5a7cf4542b538af4
Python
13,863
309
# 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...
58d19e86e3ac11999beab66bb493e578325ee7e0d62df140ab615e17a7e701b9
Python
13,865
241
## aen_attack.py -- attack a network optimizing elastic-net distance with an en decision rule ## when autoencoder loss is applied ## ## Copyright (C) 2018, IBM Corp ## Chun-Chen Tu <timtu@umich.edu> ## PaiShun Ting <paishun@umich.edu> ## ...
55814f79082ea81bebd86c20f96598d9d815fb64604fe51cf227e828ebb10e41
Python
13,888
397
#!/usr/bin/env python """ mask.py -- apply binary masks to an SPT movie """ import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.path import Path from scipy import interpolate from scipy.spatial import distance_matrix from tqdm import tqdm class MaskInterp...
7c14f4fd534ddd9199e8e12d4207a948c3aa1ca20046cde7ac7b89bc7aef7062
Python
13,893
401
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 3 13:23:59 2021 @author: th """ import torch from torch.nn import ReLU, Linear, Softmax, SmoothL1Loss, Tanh, LeakyReLU from torch_geometric.nn import GCNConv, global_max_pool, global_mean_pool, SGConv, SAGEConv, GATConv, FastRGCNConv, GraphConv i...
0b0d7adc406d8defc40132cbb1880ad8cc5301228bafdc4d27eebabe1208b186
Python
13,896
362
"""Test mne interaction""" import os import numpy as np from numpy.testing import assert_array_equal, assert_allclose import mne from nibabel.freesurfer import read_annot import pytest from eelbrain import ( datasets, load, testnd, Dataset, Factor, concatenate, labels_from_clusters, morph_source_space, se...
0674554a1412109618a241a4fdd70090367a6bb9bde7a41316635e6b3979620b
Python
13,897
367
"""Label segments with language and speaker by matching original transcript to CTM.""" from __future__ import annotations # for difflib.SequenceMatcher type annotation import difflib from collections import deque from collections import namedtuple from itertools import islice from typing import Any from typing import...
aee01f2f6fcd775e68994ee6583e468623c9845071b9072eafd4526140ce5bdf
Python
13,904
430
import torch from torchvision import transforms import cv2 import numpy as np import types from numpy import random def intersect(box_a, box_b): max_xy = np.minimum(box_a[:, 2:], box_b[2:]) min_xy = np.maximum(box_a[:, :2], box_b[:2]) inter = np.clip((max_xy - min_xy), a_min=0, a_max=np.inf) return in...
cc99b4a0c7bbab0ed20405dcc24f5c090b04a16af00a0b1af80a8a90e39ec0cd
Python
13,905
368
#!/usr/bin/env python3 """ File: correlate_ct_fractions_to_pcs.py Created: 2021/02/02 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 S...
9d1c8bc7bc3f1f6c36f26b53d68290bc1b2419800816efb75f10e2d24b071055
Python
13,926
433
#%% Imports and file loading from pathlib import Path import glob import json from os import listdir from operator import itemgetter import pandas as pd import networkx as nx import numpy as np from graspy.plot import gridplot from src.data import load_networkx # File locations base_path = Path("./maggot_models/data/...
e68d4dfad6a3458cdb601fcf6ac395bc37e247551e4d69bd8a2a598f3e39ebaa
Python
13,934
430
#!/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>. """ Tester for vehicle physics utility for CARLA Uses: Basics scenearios ...
199a1c55dd7e7e619586a8351312e92b208d7bbdb3e72f3afe1f9c2efcd7a795
Python
13,937
295
# 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>. """Smoke tests for the carla.Road / carla.LaneSection / carla.Lane API. These cover the load-bearin...
5956158461773610ab5e01ff682591af4aab494c8c7d82c92e44f296f6cb2b45
Python
13,938
433
#%% Imports and file loading from pathlib import Path import glob import json from os import listdir from operator import itemgetter import pandas as pd import networkx as nx import numpy as np from graspy.plot import gridplot from src.data import load_networkx # File locations base_path = Path("./maggot_models/data/...
d46ba7e9fc7b596e5e7878f4ee07b53f5883877a603c40e0d348a597bb5c87aa
Python
13,939
441
import logging from abc import ABC from dataclasses import dataclass, field from typing import Dict, List, Iterable, Tuple, Optional, Any, Iterator from oaklib.interfaces.ontology_interface import OntologyInterface from oaklib.types import CURIE, URI, PRED_CURIE, SUBSET_CURIE from oaklib.datamodels.vocabulary import I...
aa3c50238c17810557704e5ca8f68b0674b9ba7e4795dc1919533224d8b7b012
Python
13,941
378
# 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>. from . import SmokeTest import carla import time import numpy as np import filecmp import shutil im...
3d81bdc38babfe9599dfcc87b19862bc0d0b4f00deedf96814a03f915b2b2336
Python
13,942
506
#%% Imports and file loading import glob import json import pprint import sys from operator import itemgetter from os import listdir from pathlib import Path import networkx as nx import numpy as np import pandas as pd import pymaid from graspy.plot import gridplot from src.data import load_networkx from src.pymaid i...
bd3092688929d30a5bd42a98d89bdb032f9a8631a4a77617815c88b91549ff67
Python
13,946
319
# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
e70e62731be6870a4d572be10676d4e30c63f0598d4aa13baed34017147c7b81
Python
13,948
352
# Copyright (c) # Copyright (c) 2018-2020 CVC. # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module contains a local planner to perform low-level waypoint following based on PID controllers. """ from enum import IntEnum from collections...
2808735b961a618b538d62c373a742cabdb49b8c0b24c0847eb366d816620c42
Python
13,960
325
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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 applicab...
1c44941d96cf6b15df75e548ea205fa7a9722c579fd4062984ee6df83f64f80e
Python
13,963
302
"""Occlusion-aware obstacle visibility: a z-buffer test against the captured depth AOVs. Why --- NVIDIA's RDS-HQ obstacle tracks come from lidar auto-labelling, so a car parked behind a building simply has no label, while a car half-hidden behind another car usually still has one. The exporter's ground truth is the s...
43d10a94f73b9df1b8b124bcf5d395ecbb669cd18cb37a5270798b301a710f5e
Python
13,980
353
from math import sqrt from zlib import crc32 import tarfile import urllib import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import category_encoders as ce from sklearn.model_selection import StratifiedShuffleSplit from sklearn.ensemble import RandomForestClassifier from sklearn...
844019d4471310cb9aaee03388b579bef284df4fafda05c22e98d734ed335542
Python
13,990
325
#!/usr/bin/env python3 """Install / switch / verify a ScenarioRunner checkout for the CARLA in use. Subcommands detect what CARLA and what scenario_runner are present (read-only) plan recommend a branch and print the exact commands (read-only) install clone or checkout the branch, then pip install r...
7659d0e33840d2a7f17aa61375874773f92e36a735b17d8b0878abf56004e80b
Python
13,995
316
# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
a8e3b299836234250e82371a2d2984a8af6bffc969d3a3acd46eccbae8db6586
Python
14,000
304
import numpy as np #import matplotlib #import matplotlib.pyplot as plt #import seaborn as sns import networkx as nx import pandas as pd import random import string import scipy.stats import network_prop import sys #import visJS2jupyter.visJS_module #import visJS2jupyter.visualizations # for parallel processing #from j...
0f13fb99a32bb5f69782e8b91564841735dbf4fcf8fbcf215d29a93e2823362c
Python
14,007
336
#!/usr/bin/env python # Copyright 2020 Ivan Medennikov, Maxim Korenevsky (STC-innovations Ltd) # Apache 2.0. """This script prepares overlapped 4-speaker dense targets for TS-VAD training using segments and VAD alignment of kinect and worn utterances (VAD alignment from worn utterances is more reliable than ...
9d1e5ee07cf1dcea4bcfb6728507200888cafd87a1afff6fff8ea70becffe2de
Python
14,010
266
#!/usr/bin/env python3.9 # -*- coding: utf-8 -*- """ Created on Mon Jan 25 10:03:59 2021 @author: paulmueller Takes a configuration file as first argument and datafiles as the others to calculate autocorrelation functions and crosscorrelation functions from the data. Then calculates lrtc and lrsc measures from these. "...
fcbaad786dfe67ed5ac08f32dfad1426acfefc6d7d4676136dbe58f9dac9ab1a
Python
14,026
392
import torch import torch.nn as nn import torch.nn.functional as F __all__ = ["ESPNet_Encoder", "ESPNet"] class ESPNet(nn.Module): ''' This class defines the ESPNet network ''' def __init__(self, classes=2, aux=True, p=2, q=8, encoderFile=None): ''' :param classes: number of classes...
37f3cfaf7962f560164a0861aa3e4dde8cc8480d3838fc2e7006d6f0d40295a7
Python
14,027
489
""" interfaces Created by: Martin Sicho On: 01.06.22, 11:29 """ from abc import ABC, abstractmethod from copy import deepcopy import torch from torch import nn from drugex import DEFAULT_GPUS, DEFAULT_DEVICE from drugex.utils import gpu_non_dominated_sort, cpu_non_dominated_sort class ModelEvaluator(ABC): """ ...
edbee30f1442623e2012cf75a56299644ebb6e417796abd32d05e7010a69a911
Python
14,028
358
# -*- coding: utf-8 -*- import logging from os.path import isfile, join from os import listdir import numpy as np import pandas as pd import datetime as dt from skimage.util import view_as_windows from PIL import Image import itertools as it import matplotlib.pyplot as plt import matplotlib.cm as cm from math import c...
ffd0974d171e3ad001fd3e6960fa2b5e0e5b5e397c4606d4f30f43d3c3232866
Python
14,034
329
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass from pymaid_creds import url, name, password, token import pymaid import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # allows text...
bd093c3cf734b615610d802ed4571cb0ccb0da10cdc060777b676d5bb21322fd
Python
14,036
304
import numpy as np import torch import os from torch.autograd import Variable from util.image_pool import ImagePool from .base_model import BaseModel from . import networks class Pix2PixHDModel(BaseModel): def name(self): return 'Pix2PixHDModel' def init_loss_filter(self, use_gan_feat_loss, use_vg...
b6408c73e1b7342e2bfdd7ce35dbdc769ff50946f76729b3220a70270ad902ab
Python
14,037
648
# %% [markdown] # # THE MIND OF A MAGGOT # %% [markdown] # ## Imports import os import time import warnings import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from anytree import LevelOr...
c5f29894cfcefb9071ac215545d00639020a717d018cba146c403553edaf62f2
Python
14,039
362
import logging from abc import ABC from typing import Collection, Dict, Iterable, List, Optional, Union from deprecation import deprecated from sssom_schema import Mapping from oaklib.datamodels.mapping_cluster_datamodel import MappingCluster from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterfa...
8e721decdddb3622ca29d95f858f316c3623d518c84853b42db07860ef30ec69
Python
14,046
308
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass import pymaid as pymaid from pyma...
77629a31094eb06454f44a62764f92cf4c52643c1523e240fe55bf2ce18c7935
Python
14,055
396
import logging import tempfile import os import torch from collections import OrderedDict from tqdm import tqdm from maskrcnn_benchmark.modeling.roi_heads.mask_head.inference import Masker from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou ...
0b82b0165d39ad27cfb7fbf0478b5ced78dab5911c8e70a8f6357e494263135a
Python
14,057
351
import os import nibabel as nib import numpy as np from bruker2nifti._utils import ( bruker_read_files, eliminate_consecutive_duplicates, data_corrector, compute_affine_from_visu_pars, compute_resolution_from_visu_pars, ) def get_list_scans(start_path, print_structure=True): """ Given a p...
6d322739876aa0f56ab685b3ccad54794c4d0757eee3d4831dd0363cf42f0501
Python
14,058
465
import math import torch from torch import autograd from torch.nn import functional as F import numpy as np from model.stylegan2_pytorch.distributed import reduce_sum from model.stylegan2_pytorch.op import upfirdn2d class AdaptiveAugment: def __init__(self, ada_aug_target, ada_aug_len, update_every,...
2726cbb06dc760cbb81f385cf2228fca286506484c368ff49ebf2fa8e668953b
Python
14,066
508
#%% import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from sklearn.cluster import AgglomerativeClustering, KMeans from sklearn.metrics import pairwise_distances from graspy.embed import AdjacencySpectralEmbed from graspy.models import DCSBMEstimator, ...
329900799cd37acbd12377ddb0da21231bcc1f820b11447c4f9f9121b1822908
Python
14,066
319
# Copyright 2020-21 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...
ba7a012208dc730f050508173ca19982cb52a848aead4702faa5fc9b798da28b
Python
14,073
371
import os import numpy as np from deepsleep.sleep_stage import print_n_samples_each_class from deepsleep.utils import get_balance_class_oversample import re class NonSeqDataLoader(object): def __init__(self, data_dir, n_folds, fold_idx): self.data_dir = data_dir self.n_folds = n_...
01003815dce83679e614be50bc964b327ee3f1c0d5c16ce81ae533f86eff5802
Python
14,082
400
import numpy as np import torch import argparse from typing import Dict class Optimiser: """custom optimiser for SGD + Hebbian training updates""" def __init__(self, args: argparse.Namespace): """Constructor for optimiser Args: args (argparse.Namespace): training params specifie...
70139c67e5a118699053af806ee590562ebfb134dd4ae0ea7a316e918201fed1
Python
14,083
338
#!/usr/bin/env python3 """ File: add_ie_results_to_mr_table.py Created: 2021/02/026 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 Sof...
b4e754625dacb073d6d55e2b956c627fe96d0cb970f585792e139b8a74e14c33
Python
14,094
271
#!/usr/bin/env python3 """Condition Cosmos on a NuRec scene: by the world map, by the neural RGB, or by both. A NuRec artifact is twenty seconds of real driving reconstructed as a Gaussian splat. This demo turns one into a Cosmos clip package and submits it three different ways: ``--mode wm`` **The world model o...
f48947483bc7c6d0b3d31afa00add4c51838c544dcdb543010c99f643375f203
Python
14,094
438
import math import torch import torch.nn as nn from mmdet.core import bbox_overlaps from ..builder import LOSSES from .utils import weighted_loss @weighted_loss def iou_loss(pred, target, eps=1e-6): """IoU loss. Computing the IoU loss between a set of predicted bboxes and target bboxes. The loss is cal...
2185eda6e792aebd3c1e904dbb2d7b030364ab89feb03e52664cd0caba648910
Python
14,108
397
import os.path as osp import mmcv import numpy as np import pycocotools.mask as maskUtils from mmdet.core import BitmapMasks, PolygonMasks from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile(object): """Load an image from file. Required keys are "img_prefix" and "img_info" ...
d4ab09552508b1ee0f7cfc5c4dc856570665bb847b395a8653544862f23743f8
Python
14,110
335
# 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...
579378f2de10178dca5ffdfa1a40b7c9e2a61bc1703033ddb89f689120b14c0e
Python
14,116
310
""" this code establishes the real-time port b/t FDTD and Python to enable state and reward passes for optimization of photonic crystals by RL. NOEL, Renjie Li, June 2021 """ import numpy as np import random import gym import sys import os sys.path.append("C:\\Program Files\\Lumerical\\v202\\api\\python\\...
0fcb97b0cb3294a5df97bb59d3374fced4ae21ffbc934e25d2110022405e3c72
Python
14,118
379
#!/usr/bin/env python """This is a function that would convert trajectories from the old format "blockXXX.dat" + "SMCXXX.dat" to the new HDF5-based format. This glbal docstring has FAQ, general motivation, and examples. To figure out how to use the function, either browse to the function below and read the click decor...
95106e387d5b4b43ee9c6a9236550eb27c0b849743a3edacef6b796d63f5e6f8
Python
14,120
390
# SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: MIT """ NUREC Scenario Management Module This module provides classes and functions for loading and managing NUREC scenarios from USDZ files. It handles the extraction and processing of trajectory data,...
61e6b14035be336f91073156f02a7c47548ca36cbb2e96bd6eef3e084178c347
Python
14,125
426
import sys import os import re import re import csv import json from collections import OrderedDict import confusion_matrix def read_csv(path): cases = [] headers = [] with open(path, 'rb') as csvfile: reader = csv.reader(csvfile, delimiter=',', quotechar='"') for i, row in enumerate(reader...
58874463389f256bfd15bc826ae573d06b72f9cf7dc97e9d1efddb64a8e1fade
Python
14,131
246
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass from pymaid_creds import url, nam...
6a4228d002dbcc8614d817f966de4fa48fda6b99437178d8f826873625ca13d0
Python
14,140
336
import math import copy import torch import networkx as nx from functools import partial from collections import Counter from torch_geometric.data import Batch, Data from torch_geometric.utils import to_networkx from typing import Callable from torch_geometric.utils.num_nodes import maybe_num_nodes from .shapley import...
18100f6d271ac24270b8a7c29efe95c6663ff4c90e4a12b5c59926e1b28b100d
Python
14,141
376
#!/usr/bin/env python3 """Light/weather suite: L6 L7 L8 L9 L10, W2 W3, PW1 PW2. Run against a live CARLA UE5 server on Town10HD_Opt. Each test prints PASS/FAIL; exit code = number of failures. L10 reloads the world — always last. """ import argparse import time import numpy as np from PIL import Image import carla O...
b5e66b3bcc23ff6fb342302a474ce6f9ae7cb8be624c735456e818fb51ab98f2
Python
14,141
470
import torch import numpy as np import pickle from scipy.ndimage import gaussian_filter1d import math as mh from util.datasets import LabelFunction from util.datasets.mouse_v1.preprocess import * FRAME_WIDTH_TOP = 1024 FRAME_HEIGHT_TOP = 570 # Our dataset has 21 frames. # TODO: Make this more flexible. MIDDLE_INDEX...
5b76c0d48cde37cfdfcab76766e96115f402056e2765d94c3f7d5674aaf7f2db
Python
14,155
422
import nibabel as nib import numpy as np import logging from time import time import os.path as op from AFQ.definitions.utils import Definition, find_file from dipy.align import syn_registration, affine_registration import AFQ.registration as reg from AFQ.utils.path import write_json from AFQ.tasks.utils import get_fn...
ae4c4672e4c4df878d7598851899572201b325ba9457e9206f694ec489bd1209
Python
14,157
352
import os import time import logging # Tensorflow import tensorflow as tf import tensorflow_probability as tfp from .util import scope_name def layer(h, dim = None, fun = None, name = 'dense', l2_scale = 1e-50, l1_scale = 1e-50, drop = None, batch_norm = None, custom = False, W = None, b = None...
c5698fcc0621dd9e0e7dbac863f8cede362ee45508e909d25a99ed7ea3065c5e
Python
14,158
318
""" File: create_matrices.py Created: 2020/10/08 Last Changed: 2020/10/13 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either ...
4bfc2e48906505c9c7350af0064b55219c1e0a00ef9a252f30cdff8f8c0a3cec
Python
14,161
405
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 neighbors(W, i): n = [] for k, e in enumerate(W[i]): if e > 0: for j in range(len(W)): if j != k and W[j]...
c43303786f4fd40ff5bf271e5d0a6d586b41fd4fae568b2163a2bcc4701e9d97
Python
14,177
303
import numpy as np import tensorflow as tf from random import shuffle import os import glob from scipy import spatial from default_config.masif_opts import masif_opts params = masif_opts["ligand"] ligands = ["ADP", "COA", "FAD", "HEM", "NAD", "NAP", "SAM"] # List all structures that have been preprocessed precomputed_...
8a0e1d929c4446cc346bf1845856c32c5e2a0a906279ea08b459ab66f096edd3
Python
14,199
523
# %% [markdown] # ## import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspy.match import GraphMatch from graspy.utils import pass_to_ranks from src.data import load_metagraph from src.io import savecsv, savefig from src.utils import ...
fe435fa9f9e6951a4d6b2a2d4afc54a2803a3b21e625c7814c353d06abee7552
Python
14,204
409
from __future__ import annotations import fnmatch import logging import os.path import re import time from datetime import datetime, timedelta from pathlib import Path from appdirs import user_config_dir from click import ParamType from pystow.utils import base_from_gzip_name, name_from_url from oaklib.datamodels.vo...
49e9c6b209bdb0fc27df712e65f97cd57b431d041e0b960caca8415db9394570
Python
14,208
323
# @author: Miroslav Kuchta # This is taken from FEniCS_ii to keep the code base free of many depen- # dencies from src.fem.utils.make_mesh_cpp import make_mesh from collections import defaultdict from itertools import chain, permutations import dolfin as df import numpy as np import operator from IPython import embed ...
e7059f9c13810469cd0b903be80adfbda7d99d1cba63017e57a86939d8bb5d6f
Python
14,209
386
""" Utility functions for working with dcm2niix output in the work/ folder MIT License Copyright (c) 2017-2022 Mike Tyszka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, incl...
5d838603f5b932d41372d1b0828a63a5ce9250026aee379c101e1a2e46d00654
Python
14,210
523
# %% [markdown] # ## The goal of this notebook: # investigate regularization approaches, for now, just on the full graph # these include # - truncate high degree # - truncate low degree # - plus c # - levina paper on row normalization # - others? # %% [markdown] # ## import os import time import wa...
bf11778554f0fc736d04f2fad0dbd750e8f45e6836ac100ece705d9be7a4fb21
Python
14,211
407
# 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...
9c66801eeb2735ec90eff6e71997e7b08dd83ef10e60a4cb79606c9f09bc5736
Python
14,213
281
# Auto generated from lexical_index.yaml by pythongen.py version: 0.9.0 # Generation date: 2022-04-11T17:33:31 # Schema: lexical-index # # id: https://w3id.org/linkml/lexical_index # description: A datamodel for representing a lexical index of an ontology. A lexical index is keyed by optionally # normalize...
b45426453401a176e6bcd93f369999807abb1c54d046dff680f7bc0fe07f8873
Python
14,215
346
from typing import List, Union, Tuple import numpy as np from rdkit import Chem import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.batchnorm import _BatchNorm from .mpn import MPN from chemprop.args import TrainArgs from chemprop.features import BatchMolGraph from chemprop.nn_util...
c11c9bd902ff2f7523eb70c4fb404e38db127d44a09fdf5731a5c7ee4f25fc82
Python
14,221
357
from os.path import dirname, exists, join, relpath import torch from mmcv.runner import build_optimizer from mmdet.core import BitmapMasks, PolygonMasks def _get_config_directory(): """Find the predefined detector config directory.""" try: # Assume we are running in the source mmdetection repo ...
cc4ed2730af87e9cdd638e9e1d8edfa10c20f1f76a90ebba6d43d30fa1e1579d
Python
14,223
399
#!/usr/bin/env python # coding: utf-8 import sys import time import sklearn.metrics from geometry.open3d_import import * import numpy as np import os from alignment_utils_masif_search import compute_nn_score, rand_rotation_matrix, \ get_center_and_random_rotate, get_patch_geo, multidock, test_alignments, \ ...
a58c96836eb612b4f7264832d11e81d4ba173dd48b2b28ed5604e26db3e3e2a6
Python
14,241
333
# Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/cityscapes.py # noqa # and https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/evaluation/evalInstanceLevelSemanticLabeling.py # noqa import glob import os import os.path as osp import tempfile i...
e82e981e498b8f0f81aeceeb8fc38f587482a64c3dee1534e3a652133be22ca5
Python
14,241
341
#!/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>. """CARLA client script: spawns a checkerboard/ChArUco calibration target and ...
8da76d9ea59e1516f1ca23349d3b502b981b4d529c73c84a2b6cd48a13e7c38a
Python
14,246
322
import tempfile import torch import torch.nn as nn from drugex import DEFAULT_GPUS, DEFAULT_DEVICE from drugex.data.fragments import GraphFragmentEncoder, FragmentCorpusEncoder from drugex.data.processing import Standardization from drugex.data.datasets import GraphFragDataSet from drugex.logs import logger from drug...
2bff5f6ab17ef2b7869190640d2f8f27aeebd8c29c6c941c7fdc1a6df2ba319c
Python
14,250
247
# Auto generated from cross_ontology_diff.yaml by pythongen.py version: 0.9.0 # Generation date: 2022-05-29T22:40:51 # Schema: cross-ontology-diff # # id: https://w3id.org/linkml/cross_ontology_diff # description: A datamodel for representing the results of relational diffs across a pair of ontologies connected # ...
52f3c069f95662a2be61b23a95952de9071a221ce4e819d977a3eadd4160e038
Python
14,256
416
import pdb import torch import torch.nn as nn import math import torch.utils.model_zoo as model_zoo torch.backends.cudnn.benchmark = True BatchNorm = nn.BatchNorm2d # __all__ = ['DRN', 'drn26', 'drn42', 'drn58'] webroot = 'https://tigress-web.princeton.edu/~fy/drn/models/' model_urls = { 'resnet50': 'https:/...
7ac6b0a936296cc4a531da5d18689e3619523aad242ab05b2868a05003413a2f
Python
14,265
349
import sys sys.path.insert(0, '.') import loadData as ld import os import os.path as osp import torch import numpy as np import torch.backends.cudnn as cudnn import transforms as myTransforms import dataset as myDataLoader import time from argparse import ArgumentParser from IOUEval import iouEval import torch.optim.lr...
c74d7f635a81720b56ccc4541d439f40bdbde9135a3cd60e09ff1af9a25ad36d
Python
14,268
328
#!/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>. """World-space straight-line test: a real straight edge, imaged through a dis...
24c448b5b1119d8f3e6c36b7740861722637f43f9187c3f2a3016acfcad39c5a
Python
14,270
319
# basic imports import os import pickle import numpy as np import matplotlib.pyplot as plt def count_pairs(replays: list) -> (list, list, list): ''' This function counts the number of forward, reverse and unordered replay pairs. Parameters ---------- replays : A list...
d8a094300fa2bc8469976ce735192fe518d94323fc564874339fe7a2e6f2ec19
Python
14,270
398
#!/usr/bin/python # System imports import sys, os, re, math import subprocess import argparse import numpy as np import seaborn as sns import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.font_manager from matplotlib.ticker import PercentFormatter from matplotlib.ticker import Format...
7671e08b7c1d4f119ddae3d3f0f9e2af0e384d356e6fb427e36e745aba7d73f7
Python
14,274
389
import os import numpy as np import shutil import torch from time import time import networkx as nx from pdb2sql import interface from .tools import BioWrappers, PSSM, BSA from .Graph import Graph class ResidueGraph(Graph): def __init__(self, pdb=None, pssm=None, contact_distance=8.5, internal...
17e07b2dc432ffddfc729e90488f85432a611fcb80224428e042eec2720e0c54
Python
14,292
375
import torch from torch_geometric.nn import MessagePassing from torch_geometric.utils import add_self_loops, degree, softmax from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set import torch.nn.functional as F from torch_scatter import scatter_add from torch_geomet...
2c3a37f02ba70519a0ad9f90ebee6524b8f6a92f6c5564ab6c9e91e51e02458a
Python
14,297
345
""" This module provides the RandomPositionsSampler class. TODO: Currently, only works with sequences from `selene_sdk.sequences.Genome`. We would like to generalize this to `selene_sdk.sequences.Sequence` if possible. """ from collections import namedtuple import logging import random import numpy as np from selen...
e9a460d19bb8a937027a9a10c36af3cc9dcd6909093894a61df6ec28d66e3d99
Python
14,301
339
import math import torch import functools import torch.nn as nn from torch.nn.modules.utils import _triple import config as c cuda = True if torch.cuda.is_available() else False Tensor = torch.cuda.FloatTensor if cuda else torch.FloatTensor class Discriminator(nn.Module): def __init__(self, input_nc=2, dropou...
9c4b471aabcfc958c3cc670d2a8cc845369a6ba3c03e2994ee1d95a8a97b8f7b
Python
14,304
312
# 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 in...
d9a58360e2d9240858a622af038d25a94f25185de3e5ff1d155d572ccf01818a
Python
14,322
404
from collections import defaultdict import pytorch_lightning as pl from pytorch_lightning.metrics.regression import MeanAbsoluteError as MAE from pytorch_lightning.metrics.regression import MeanSquaredError as MSE from pytorch_lightning.metrics import F1 from pytorch_lightning.metrics import ExplainedVariance as EV imp...
0cd89a6af36fcc982f7721b6e9798197b50b36d8ca9f7afc134afd270fd7cf23
Python
14,329
380
# 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...
a2580b02c4b0ceeba9a46e8eacf43c15a2ca5e18b5aea3f2a896c388e38d6468
Python
14,337
345
# Author: Yoshimasa Kubo # Date: 2020/03/09 # Updated: 2020/05/07 # Dataset: MNIST # Purpose: Demonstration of network with predictive learning rule import numpy as np from keras.datasets import mnist import torch import os from sklearn.preprocessing import OneHotEncoder from sklearn import utils ...
aefd267e65ecb5367a0468f7b82e94320b6dc84646bd56d6e103fb9e9807c84a
Python
14,341
376
from functools import reduce from rl_analysis.util import rle, count_transitions from typing import Sequence, Optional import pandas as pd import numpy as np def normalize_df( *args, time_bins=[(0, 30)], eps=0, # this is only added for division baseline_smoothing=None, outer_loop_key="target_syll...
afd47ee14521a4180b19f608c294585402b77b7bce84b0f139ca8901733f66dc
Python
14,343
329
#!/usr/bin/env python3 """Spawn and attach sensors to a CARLA actor, and destroy them. Commands: types list sensor blueprints spawn --type camera.rgb [--attach-to hero | --parent-id N] [--x 1.5 --y 0 --z 2.4 --pitch 0 --yaw 0 --roll 0] [--attachment Rigid|Sp...
8eaf28f4224bb2bcdffadbc0a06a3a81e5b74536bfa239054a0427bc974225f9
Python
14,345
386
import pickle from multiprocessing import Pool import numpy as np import pytest import polychrom import polychrom.polymer_analyses as polymer_analyses import polychrom.starting_conformations def test_calculate_contacts(): """Test basic contact calculation""" # Create a simple test case with known contacts ...
0dbe46c62b99fb199cfc631db8d3f4012f6bd14c5aae15abdd8622c2c9394617
Python
14,354
383
#!/usr/bin/env python # coding: utf-8 # In[1]: ##################### IMPORTS ####################### import os import sys from keras.models import model_from_json from matplotlib import pyplot as plt import numpy as np from keras.callbacks import ModelCheckpoint from rdkit.Chem.Draw import IPythonConsole import os,...
1fe5b0a935888694e4972416e1cfb3c6ab527bf987013baeaab95698095a27ff
Python
14,356
391
import glob import json import math import re import shutil import subprocess import sys from os import remove from os.path import isfile, join, split import pytest from phys2bids._version import get_versions from phys2bids.phys2bids import phys2bids def check_string(str_container, str_to_find, str_expected, is_num...
6a13da0b0c78842a19ca2345f185b578edb1987a735b18575e696ea06bc07338
Python
14,365
354
import sys sys.path.insert(0, '.') import loadData as ld import os import os.path as osp import torch import numpy as np from torch.autograd import Variable import torch.backends.cudnn as cudnn import transforms as myTransforms import dataset as myDataLoader import time from argparse import ArgumentParser from IOUEval ...
21619a0a130f4aa8bd13258220b5e14e6581e2a33e2a0aac055798b8cceebfb9
Python
14,366
356
#!/usr/bin/env python3.9 # -*- coding: utf-8 -*- import numpy as np from iEEG_STC import utils import pandas as pd import glob import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import seaborn as sns from scipy.stats import spearmanr from scipy.optimize import curve_fit from matplotlib.ticker imp...