sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
aaa03ffee3f04c670f6447201d93f2ef594e92c96ee3bcb9b68129245be79af1
Python
7,198
192
"""Convert an Alpamayo path into CARLA throttle, brake, and steering.""" from __future__ import annotations from dataclasses import dataclass import numpy as np @dataclass(frozen=True) class ControlCommand: throttle: float brake: float steer: float target_speed_mps: float target_index: int ...
cb49f907679685584c5194bc606e39e91d4148b9b5e9fd95bef42745e1fa73c9
Python
7,198
209
"""Implementation of the Fisher kernel for prediction studies. See the :doc:`HMM description </models/hmm>` for further details. See Also -------- `Example script <https://github.com/OHBA-analysis/osl-dynamics/blob/main\ /examples/simulation/hmm_hmm-mvn_fisher-kernel.py>`_ applying the Fisher kernel to simulated HMM ...
e241efbe470f91a41006363efff1bd9004b5aadc679dc88d019f18d4691d8c6a
Python
7,200
185
# 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...
24999a8fdf61bd5bea7f0fbd949ef9bcb6ce2f187aa052be0f50df4fc0039726
Python
7,206
156
# 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...
6c0de52905fd14d10595971dbba9c807506f50535284ae409aac2ae52a0e73a0
Python
7,206
157
# 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...
6b2f2d73fbb7f89792917ee59efd81cb66f7af3291bb231a98ae75100819f518
Python
7,208
219
import os import subprocess from io import StringIO import numpy as np import pandas as pd from scipy.spatial import distance_matrix def parse_pdbfile(pdbfile): file = open(pdbfile, "r") lines = file.readlines() file.close() lines = [l for l in lines if l.startswith("ATOM")] output = {} for ...
d002a29cc9e5a23d576c1794a96e3310697a792bcf59cdb2094cf538751115f0
Python
7,214
177
""" The featurizers of raw text, i.e., either of Bag-Of-Words or transformer-based Language Models. The BOW-based object (BagOfWordsBasic) should first fit to the training set (vocabulary, tokens dictionary, random-projections matrix) and be saved as a pickled object. There you have the choice for """ import torch imp...
7d65366845e00f185c3f722a8d977aac8d996fe27c99a99296404367ce1fcb75
Python
7,215
243
""" Training script for FNOGNO on Car CFD dataset. This script trains a Fourier Neural Operator with Graph Neural Operator (FNOGNO) on computational fluid dynamics data for car pressure prediction. The model learns to predict pressure fields from geometric inputs. """ import torch import wandb import sys from neuralo...
cfa9a0cfbf4da702dcbf7f8dc98b0beef9a537e8e43122d23af9e45becd2396c
Python
7,218
160
import os import re import pickle import subprocess import numpy as np from scipy.special import softmax from scipy.spatial.distance import pdist, squareform from data.process_label import generate_lddt_score, parse_pdbfile, get_coords_ca def process_alphafold_model(input_model_path, alphafold_prediction_path, lddt...
9e870753d1c86b2f7f4257ba9a98d0f55308ec1ccb9ab281a5de42e907b51ecb
Python
7,220
249
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" import numpy as np import pandas as pd from tmkit.db.Reader import Reader as ppireader from tmkit.structure.PDB import PDB as spdb from tmki...
247db0a7ae01baec3e90c676daa692917988bc75d3a3a4c93ad0f4e7ad6e5016
Python
7,225
187
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Hang Zhang ## ECE Department, Rutgers University ## Email: zhang.hang@rutgers.edu ## Copyright (c) 2017 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the root directory of this sou...
ce1c4b68f6d32908667a8de793aae74e8e595fde64484d7d1a8dfc7dfd33ff09
Python
7,225
177
# 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...
e84676d89d96bc0ff661189cb587df1a6add4b851f3cc4c6b13159817df46727
Python
7,226
176
import astra import numpy as np import math as m import matplotlib.pyplot as plt import imageio from pathlib import Path from scipy import ndimage import flexdata class Projector(object): '''Class performing forward projection and generation of data :param obj: instance of Object Creator providing object'...
f432fbe0969baa42c78848a3f57e11ddca0d19309a04b10b37769214a7c60df8
Python
7,226
166
import torch import numpy as np from torch.nn import functional as F from .resnet import * # Implementation of DeepAccNet class DeepAccNet(torch.nn.Module): # Parameter initialization def __init__(self, onebody_size = 70, twobody_size = 33, protein_size...
e78ebbaf1b0d914dae32ad7b461715c91fab25644e939567984a8f0aaeb08d87
Python
7,230
159
#!/usr/bin/env python3 # -*- coding: utf-8 -* """Trimming gait data to specified length. """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd import os import glob plt.style.use('ggplot') plt.rcParams["axes.labelsize"] = 10 plt.rcParams["axes.titlesize"] = 14 def main()...
0d622a9236841755b66ffadc1d6e74fd39627d7a21a598c6821a3986dce1a94e
Python
7,235
177
# SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: MIT """ Pygame Display Module This module provides a threaded Pygame display for showing camera images from CARLA. It runs in a separate thread to avoid blocking the main application thread and provides...
5b2ecf89efc947fe83b176b95bac303f217fbef3e21a01ba32851a20b74c7189
Python
7,235
197
""" Written by Nathan Neeteson. A set of utilities for morphometry on an image and/or binary mask. """ import numpy as np from scipy import ndimage as ndi from skimage.morphology import skeletonize_3d def crop_image_to_values(image): # this function uses the nonzeros ndarray method to identify the indices # o...
7bfc477408b434fb3b631d71fe49d8995a900d7d3698cf08cd78ca12dd0a0441
Python
7,237
179
import pandas as pd from tqdm import tqdm import numpy as np from scipy.sparse import coo_matrix import os from torch_geometric.data import Data import torch from rdkit import Chem from rdkit.Chem import AllChem from .atom_features import get_available_features_generators, atom_features_union import n...
a654011b1c44eb366cf34888f627ba789829f2804df815ceeaf450cc844b826c
Python
7,237
200
""" DeepCT architecture without Sigmoid layer for multiple cell type per position computation at once with quantitative features (TODO: Add our names). """ import os import numpy as np import torch import torch.nn as nn from torch import mean from torch.nn import MSELoss from torch.utils.tensorboard import SummaryWri...
9046984966f4acabab4a2636d200356468f2aa5118c7afe9321cf23f95862d68
Python
7,238
177
""" This file contains specific functions for computing losses on the RetinaNet file """ import torch from torch.nn import functional as F from maskrcnn_benchmark.layers import smooth_l1_loss from maskrcnn_benchmark.layers import SigmoidFocalLoss from maskrcnn_benchmark.modeling.matcher import Matcher from maskrcnn_...
cfbdd0e17439ae56bac726e1349813e54b393a7dcab11b40e96326441f21863d
Python
7,238
201
# 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...
3dd047d1dda753fcfaca6db9130ca3f1acee8358eb6d4de55037ed80d91ac9ca
Python
7,240
201
''' This file might work differently in the future! Don't reuse it ''' import scipy as sp import mesh import myOS import FMM.inputDat as inputDat base_folder = 'expected_new' # Flagellum def write_flag(): folder_expected = base_folder + '/flagellum' s = sp.linspace(0, 2, 10) radius = 0.1 azimuth_...
7a7f6220f162c72b99f74e35ed5ec344db61331c2844b7db3275f57a54641cd2
Python
7,243
209
""" This module provides the EvaluateModel class. """ import logging import os import warnings import numpy as np import torch import torch.nn as nn from selene_sdk.sequences import Genome from selene_sdk.utils import ( PerformanceMetrics, initialize_logger, load_model_from_state_dict, ) from sklearn.metri...
fcdeb7fb7f2bf3f9434c8012a12540ef595225d23687e83a7992bcf0d5237dfd
Python
7,243
186
# %% 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#, data_date_projectome import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) from contools import Celltyp...
624252e6ee45d7263b71b42fbf2fdf5eda29a7cbcac54a911aa77c2c2236b187
Python
7,245
218
# 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 F401 isort:s...
c8a5c4f182cdcad07462f51075db20ed0622666a31f51bddb79f08fb773c24c4
Python
7,247
193
# 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...
28a0408045e39cd8fdc83b7352934cd540d2c4065c3cc2862b481a845d14371c
Python
7,254
141
#!/usr/bin/env python3 """ File: gtex_cellmap_expression.py Created: 2020/06/16 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 Softwa...
6541a2c10609fc198087db52e7d5869bec78f5d3f2b16995df58cc9661d25eb1
Python
7,256
210
"""This script normalizes the data from recount3""" import argparse from typing import Dict import numpy as np import tqdm import utils def parse_gene_lengths(file_path: str) -> Dict[str, int]: """Parses a tsv file containing genes and their length Arguments --------- file_path - The path to the f...
3d21bfb7714a0cb728848dd9cadd6457b65942e9cbebf4d35da891a071d33f52
Python
7,258
216
# 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...
7cf1adcbaa501daf01f63b963c55cc9066f0eaf45365961714403ade17aa721d
Python
7,259
159
import logging from collections import Iterator, defaultdict from typing import Dict, List, Tuple import networkx as nx from oaklib.datamodels.vocabulary import IS_A from oaklib.interfaces import MappingProviderInterface, RelationGraphInterface from oaklib.interfaces.obograph_interface import OboGraphInterface from oa...
ae9018e6e22a37ec47613f2f7611c7b9d4f4ae17464ccf70549ed794883f154b
Python
7,261
216
from __future__ import annotations from math import pi from typing import List, Optional, Tuple, Union from brian2.units import Quantity class EphysProperties(object): """ A class for calculating various important electrophysiological properties for a single compartment. Note ---- An EphysP...
151ad536101fa50cb2434e02a7e4146588ff6d3e9fc8313786209f84a163673a
Python
7,274
213
import math import torch from torch import nn import torch.nn.functional as F from neural_networks.base_models import BaseModel CUT_OFF = {'dish washer': 2500, 'fridge': 300, 'kettle': 2000, 'microwave': 3000, 'washing machine': 2500} MIN_OFF_DUR = {'dish washer': 1800, ...
0e1bbbdbe90faacf21a9b98181d3703f77d98db34460702894710d962422f0b2
Python
7,275
168
# 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...
52868ae678ddf3536361982faf0d47017a061829fb8138bc0cf71deb17c14906
Python
7,275
184
__author__ = 'duarte' import sys from preset import * import numpy as np """ spike_pattern_input - main spike_input stimulus processing """ run = 'local' data_label = 'example4_spike_pattern_input' # #####################################################################################################################...
ec935d6ef35d516fbb90a1b2ed1c4e850b8023ef686d2b55a1ec1ac0046b7d68
Python
7,275
257
import os import sys import numpy as np import pyqtgraph as pg from PyQt5.QtCore import * from pyqtgraph.Qt import QtGui, QtCore class MovablePoints(pg.GraphItem): mouseHovered = pyqtSignal(object) mouseDragged = pyqtSignal(object) mouseClicked = pyqtSignal(object) def __init__(self): self.dr...
fbd6f0ae747cec7484e1b2d1a46984abe209f3740ffd9d17b5618c07a978126b
Python
7,275
183
""" File: SVD_wrapper.py Created: 2020-04-29 Last Changed: 2020-04-29 Author(s): H.H.Wiersma Code to create distribution plot and a mask image used in the research plan Copyright (C) 2019 H.H.Wiersma This program is free software: you can redistribute it and/or modify it under the terms of the GNU Gen...
95df87d4029d81fdf86a8e3df1a8f7c41f8d0148f425fbeab3cc61310d4c1505
Python
7,278
246
from abc import ABC, abstractmethod from random import SystemRandom from typing import Any, Iterable, List, NamedTuple, Optional, Tuple, Type, Union import numpy as np hard_random = SystemRandom() modes = ("random", "value") def _generate_random_intervals( dt: float, average: float, left_shift: float, right_sh...
951c73ceb4eb36b538f609e6ada0fbc53c2f2de134f9107b98afdfb431a5b37a
Python
7,279
244
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 11 10:34:36 2022 @author: alexandra """ import pandas as pd import matplotlib.pyplot as plt import scipy as sp import numpy as np import os import shutil from scipy.signal import savgol_filter from os import path import csv from scipy import specia...
97bd558fd04054ab47adde6d081ebf1ced82871ad800c16d61f0dde814699dda
Python
7,281
173
#!/usr/bin/env python3 """List the scenarios a scenario_runner checkout can actually run. Parses srunner/examples/*.xml directly, which is what `scenario_runner.py --list` reads — but without importing carla or building a client, so it answers with no server running and no PythonAPI on the path. list_scenarios.py...
fccebd3b412482e3351dee6f25b28f87d67fe6a8ab3af09e899c94e568797fff
Python
7,285
154
# 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...
0c8fe311e1e984de52e4d878dc4ecb03371839f9b2fdaaf3b2ac22e63629e195
Python
7,286
179
# SPDX-FileCopyrightText: © 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: MIT """ Projection and Coordinate Transformation Functions Module This module provides functions for coordinate system transformations between different reference frames used in geospatial and mapp...
3983a3039ab09ea8b0e626dc56c2ff8e7d0f540c1c5b5df8ba38f923c94043c8
Python
7,287
169
# 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...
f64cc17601416120b6c88f625da197c3325a7388bc370f557f8dbd3a9432c2cc
Python
7,289
216
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module with functions used for selecting subsets of similar frames to use for finetuning. Created on Thu Jun 6 11:04:39 2019 @author: nicolas """ import warnings import numpy as np from skimage import filters, measure, morphology from sklearn.cluster import OPTICS...
1b37459ef88254a8e7a0c666dd06f33d17346c89247d44381e8b82cab19396eb
Python
7,290
207
import pytest from cropro import CropConfig BASE_REQUIRED = { "orig_img_path_t2w": "t2w.mha", "seg_img_path": "gland.nii.gz", } def test_bp_mri_requires_adc_and_hbv(): with pytest.raises(ValueError, match="orig_img_path_adc is required for bpMRI"): CropConfig(sequence_type="bpMRI", **BASE_REQUIR...
3b2ebabbd594bdc1b1a3eed5e51dd6053ec4913d5fd6c90847f9846d505dfa56
Python
7,290
172
#!/usr/bin/env python """ Script to build a "binary wheel" for the 'pip' Python package manager for the LAMMPS python module which includes the shared library file. After a successful build the script attempts to install the wheel into a system specific site-packages folder or - failing that - into the corresponding u...
ff590dd0f1827939b910ff64a4d4a110b58a7c7288e4c0d7ff5a17c1cd3fc5d5
Python
7,291
219
""" Based on ExpResNet architecture (see https://www.biorxiv.org/content/10.1101/2020.06.21.163956v1.full.pdf) A residual architecture with a skip connection for cell type embeddings. The forward method accepts the cell type embeddings to use during training, as well as cell targets which select the cell types (and h...
bdce15f8a00abcfe905edda4cbbaf3d403bf074423c570eb98ca82ed3052b43a
Python
7,296
178
import csv import os import pandas as pd import tqdm from sklearn.model_selection import train_test_split import numpy as np import typing import abc import random from dataprocessing.filters import feature_filter import math import pickle T = typing.TypeVar("T") class BaseModel(typing.Generic[T]): def __init__...
a1f7d81ea49c1dfe6eb27e99925cedd57bbd36b094f5967abf8bd7c9f5f7bd70
Python
7,301
189
""" tests Created by: Martin Sicho On: 18.05.22, 11:49 """ import tempfile from unittest import TestCase import pandas as pd from drugex.data.corpus.corpus import SequenceCorpus from drugex.data.corpus.vocabulary import VocSmiles, VocGraph from drugex.data.fragments import FragmentPairsEncodedSupplier, SequenceFragm...
0e1b113ff1634680056ec8d2307eb4eeb355f62b4abee6ab3fdfdd60cac5478a
Python
7,303
254
from typing import NamedTuple, Optional, Tuple, Union import numpy as np from cgtasknet.tasks.reduce.dm import DMTaskParameters from cgtasknet.tasks.reduce.reduce_task import ( _generate_random_intervals, ReduceTaskCognitive, ) class CtxDMTaskParameters(NamedTuple): dm: DMTaskParameters = DMTaskParamete...
62c0611e9b6bb9c7dcf7c9ce0e1ace45808d7986440059275bc538a2c4bc66d2
Python
7,303
217
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init import numpy as np from unet import * from utils import * def weight_init(m): if isinstance(m, nn.Conv3d) or isinstance(m, nn.Conv2d): torch.nn.init.kaiming_normal_(m.weight.data) if m.bias is not None: m.bias.data.fill_(...
68a547a70a3f6def5d5626ec22613c732b78f753456ccfd028937c54b2b84b60
Python
7,303
104
import argparse import os from util import util import torch class BaseOptions(): def __init__(self): self.parser = argparse.ArgumentParser() self.initialized = False def initialize(self): # experiment specifics self.parser.add_argument('--name', type=str, default='people', hel...
07bc9babf1a760445dfc2eed91c318e5f2a25cac174a6761fccf56f18b9e8f31
Python
7,304
238
# 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...
8a7ea5f8abcefa78b330ee8e2831861c461ea12e1cfa1bc7151411ebf37d3bb7
Python
7,305
140
__author__ = 'duarte' from modules.parameters import ParameterSet, 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.analysis import single_...
052cbfe2f837980b543ad4f34063183e95d9f8ce23e99da3f4f19aaec79e6211
Python
7,306
185
import numpy as np import torch import torch.nn.functional as F from torch import nn from torch.nn import Linear, Conv2d, BatchNorm2d, PReLU, Sequential, Module from models.encoders.helpers import get_blocks, Flatten, bottleneck_IR, bottleneck_IR_SE from models.stylegan2.model import EqualLinear class GradualStyleBl...
5d4a2afcbc5c543531053179d1764b5e134f1593fce6b8979f15af5019780f6c
Python
7,308
148
""" Modules that handle computation of fitness. This file can contain multiple modules. """ import os import numpy as np import core.settings as CoreSettings import core.system as System import core.gromacs as Gromacs import core.gromacs_commands import user.usersettings as UserSettings def module_c...
aac23d65e204ebeae174e6b2a435895501cb07f5cb39893cbede44e2d4180980
Python
7,316
247
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
604e4f1a2e640c995a311929e0b3d0878bdabfc7a90cc02de8a372be48149ae7
Python
7,318
243
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import List, Tuple, Dict from tmkit.id.Fasta import Fasta as idfasta from tmkit.id.PDB import PDB as idpdb from tmkit.topology.p...
122fbe64829b100ba06dcce61309239f7958bfc90d3421968896ba8db8a5199a
Python
7,320
186
#!/usr/bin/env python import random import torch from torch.optim import Adam from drugex import utils, DEFAULT_DEVICE, DEFAULT_GPUS from torch.utils.data import DataLoader, TensorDataset from tqdm.auto import tqdm from drugex.logs import logger from drugex.training.explorers.interfaces import FragExplorer from druge...
1a4ab03a696c3bc560b16862cbb164f951fae41e6f5a61e32c00b548e21722a6
Python
7,326
172
#Copyright (C) 2019 Soeren Lukassen #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 the License, or #(at your option) any later version. #This program is distributed in the h...
5633eb46ab3c496a74e6c79e6203c580e8ce1cfcb1802413e5c02680f4e49bae
Python
7,329
232
# -*- coding: utf-8 -*- """Data generation and anomaly generation.""" import collections import itertools import random import matplotlib.pyplot as plt import numpy as np import pandas as pd from gstools import SRF, Gaussian __author__ = ["KatieBuc"] def pivot_dataframe(df): df = df.pivot(index="t", columns="i...
f6409b08842d4d42ca936d2ad8c40dfdf6639d0f4bb85b9405b0a1b03e730d26
Python
7,329
202
""" 2021/11/30 Plot comparisons of LE_dim """ import os import numpy as np import pandas as pd from sklearn.decomposition import PCA import umap import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import StratifiedKFold from siVAE import uti...
a25af46e4e3b60be3ef5829bd08e53bad6f8f0d23addbb8899d8561f5cb0bf11
Python
7,334
238
from typing import NamedTuple, Optional, Tuple import numpy as np from cgtasknet.tasks.reduce.reduce_task import ( _generate_random_intervals, ReduceTaskCognitive, ReduceTaskParameters, ) class RomoTaskParameters(NamedTuple): dt: float = ReduceTaskParameters().dt trial_time: float = 0.25 ans...
be2b6f96f86c2018221b69534d3f1f873a8290c79f821822e4fc288aefa82d29
Python
7,335
197
import numpy as np import torch from ..builder import BBOX_CODERS from .base_bbox_coder import BaseBBoxCoder @BBOX_CODERS.register_module() class DeltaXYWHBBoxCoder(BaseBBoxCoder): """Delta XYWH BBox coder. Following the practice in `R-CNN <https://arxiv.org/abs/1311.2524>`_, this coder encodes bbox (x1...
6460ca3d28f9f18cb85af5dadbb3c0081dd3c18edf02c11e949bb2bfa2033c6b
Python
7,337
141
import plyfile import argparse import torch import numpy as np import skimage.measure import scipy import mrcfile import os N_CHANNELS = 22 def create_samples(N=256, voxel_origin=[0, 0, 0], cube_length=2.0): # NOTE: the voxel_origin is actually the (bottom, left, down) corner, not the middle voxel_origin = ...
0bfd86b3de034abc80444863ce488ae2a0ae3e62fbfd45e06b2d38b0010aab2f
Python
7,338
191
# 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...
b41b780eaf4f67c5566929a4373fef60b8fab547115228e03033778f469487c7
Python
7,342
148
import argparse from pathlib import Path import torch from torch.utils.data import DataLoader from torchvision import transforms from dataloading.nvidia import NvidiaDataset, Normalize, NvidiaCropWide from dataloading.ouster import OusterCrop, OusterNormalize, OusterDataset from metrics.metrics import calculate_open_...
7dcbc6cd72c9b9227ecd9f9ece16bdc25dfcf512e7ba80da2cd3dd010c901f5f
Python
7,343
219
import torch.nn as nn import torch.utils.model_zoo as model_zoo __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7e...
9592da11c8bf6070742cf9719417318932f000f1b7b2cc57ff65696517c2974a
Python
7,345
173
""" ========================================== Using cloudknot to run pyAFQ on AWS batch: ========================================== One of the purposes of ``pyAFQ`` is to analyze large-scale openly-available datasets, such as those in the `Human Connectome Project <https://www.humanconnectome.org/>`_. To analyze thes...
1bf19b168a21d66c721aadc08c1f1e3380a247cd50a544ae707038839317a197
Python
7,346
227
import sys import itertools import collections from debarcer.utilities import edit_distance """ Adapted from https://github.com/CGATOxford/UMI-tools/blob/master/umi_tools/network.py (Retrieved March 21, 2018) """ sys.setrecursionlimit(10000) def breadth_first_search(node, adj_list): searched = set() queue...
d75e96b8812813d2e4843f2dac355c8d4b5327075bf6ea211437642eb3312f95
Python
7,346
203
from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['deform_roi_pool_forward', 'deform_roi_pool_backward']) class DeformRoIPoolFunction(...
e336036cd132f31a8a9eb53bbce1643cba96326474bb1d8a4f4a7102031b023a
Python
7,346
223
import multiprocessing as mp from functools import partial import numpy as np import elephant.statistics as spkstat from tqdm import tqdm from pathos.multiprocessing import ProcessingPool as Pool from elephant.kernels import GaussianKernel from neo.core import SpikeTrain from quantities import ms from sklearn.base im...
8c9974b62f4e51fcd183212102422232402c2e158fd39616697259da6b695b39
Python
7,351
187
import numpy as np import torch import torch.nn as nn from mmcv.cnn import kaiming_init, normal_init from mmcv.ops import Conv2d, Linear, MaxPool2d from torch.nn.modules.utils import _pair from mmdet.core import force_fp32 from mmdet.models.builder import HEADS, build_loss @HEADS.register_module() class MaskIoUHead(...
bf064ba6db2ca659e5263edb04ced001b2dfaf5eba52a588f944d6ac5c67d251
Python
7,354
300
# %% [markdown] # ## import os import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import scipy import seaborn as sns from graspy.match import GraphMatch from graspy.plot import heatmap from graspy.simulations import sbm from src.data import load_metagraph from src.graph import pre...
04bd08e740aa82d735f1d8450a2bebcf21243f3dfcca06c41604960691e50dee
Python
7,356
205
# 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...
9197585bdc2362b005a75bf9959cee336482a5579662a7889aab0b9ed43def60
Python
7,356
155
import torch import sys, os, json import warnings warnings.filterwarnings("ignore") import nltk nltk.download('punkt') sys.path.append("..") from torch_geometric.utils import to_dense_adj device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class Cache_GNN_Embeds(): def __init__(self, confi...
4d90019bf839ca1860a363a18548ab60170db788c24035208bf705615d5e965a
Python
7,363
197
import numpy as np import torch from ..builder import BBOX_CODERS from .base_bbox_coder import BaseBBoxCoder @BBOX_CODERS.register_module() class DeltaXYWHBBoxCoder(BaseBBoxCoder): """Delta XYWH BBox coder. Following the practice in `R-CNN <https://arxiv.org/abs/1311.2524>`_, this coder encodes bbox (x1...
6f68a7cc16849d2b1e23ff1141a9919b33d4b5c00e09d7f05d118ee52646ea2c
Python
7,363
191
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass #%% import sys sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/") import pandas as pd import numpy as np import connectome_tools.process_matrix as promat...
bc9130cf5ec3b9917f2d2a79c61c1079136ad7f9193a842b8bb8774bddeb88fd
Python
7,363
280
"""Train DyNeMo on Nottingham movie data. """ print("Setting up") import pickle import numpy as np import os.path as op from os import makedirs from osl_dynamics import analysis, data, inference from osl_dynamics.models.dynemo import Config, Model from osl_dynamics.utils import plotting #%% Settings # GPU settings ...
c8d276f637c8cb116a9d93da45c48234fb873b3bc4a69b39caa136d410fe7c6b
Python
7,363
197
# 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...
798f8e1f898b2cbac3b7d6dfb07293f103e4a646bf2fe58b5c435308216d2fb5
Python
7,364
225
import git import logging import os from bisect import bisect from datetime import datetime from logging import config from typing import Dict class LevelFilter(logging.Filter): """ LoggingFilter used to filter one or more specific log levels messages """ def __init__(self, level): self.__l...
76268505b7a3b1d1132484ea3521f0b95c2708d85ea4129be6727ab266e10771
Python
7,369
240
import matplotlib.pyplot as plt import numpy as np import pandas as pd import math import random import copy from keras.datasets import mnist,cifar10 from globals import EPSILON def get_unique_examples(train_x, train_y, N): # When working with minimal data, get as representative examples as possible ex_per_class =...
4954b66425b2c5d06503e28011c8711dd08821000fbf0e3c6b6f5cefaaaaf4e9
Python
7,375
201
#!/usr/bin/env python3 # encoding: utf-8 # @Time : 2018/6/17 上午12:43 # @Author : yuchangqian # @Contact : changqian_yu@163.com # @File : seg_oprs.py from collections import OrderedDict import numpy as np import torch import torch.nn as nn class ConvBnRelu(nn.Module): def __init__(self, in_planes, out_plan...
501bbe8ab43d968827f9c90f25d0be10616dd430d6ad07d331bb7592bee10163
Python
7,376
171
# -*- 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 neural_network_architecture import features_extraction import torch.nn as nn import torch from torch import LongTensor, FloatTensor import ...
8e997507c1307ce8fab00948cf1586db561ff3063dfd5f3eb98e615d357b08da
Python
7,376
213
#%% import sys sys.path.append('/Users/mwinding/repos/maggot_models') from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd # allows text to be editable in ...
0e21847086ca2db1ef489f9411f596840776a5b1e28842ddfe5a53d985b690b1
Python
7,379
173
import csv import gzip import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile try: from gilda.grounder import Grounder from gilda.term import Term have_gilda = True except ImportError: have_gilda = False from oaklib.datamodels.text_annotator import T...
9ec25d711e32df58f226ec687f5f376525fa21d12e5435214a660b400dbf39ab
Python
7,379
135
# 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...
61c0854f1c848dfb20a52a833ae195d142701a707d8e1dbd365e08aa0b5697c7
Python
7,383
157
# 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...
1496d6c73bd9cbe1e0c7a6a1fddacab5bf881314249eac66c938f8354f4dcb40
Python
7,386
228
import os import sys import torch import torch.nn as nn import math from lib.nn import SynchronizedBatchNorm2d try: from urllib import urlretrieve except ImportError: from urllib.request import urlretrieve __all__ = ['ResNet', 'resnet18', 'resnet50', 'resnet101'] # resnet101 is coming soon! model_urls = { ...
8f1082abc5d39c78d5f45c8ad86cbd739370c893cf3ad2922e334a17a9cc6007
Python
7,387
158
# This script is used to calculate STRUCTURAL uncertainty for the smos-smap NN, and the corresponding mean ans std, as well as some other auxiliary data such as correlations, rmse, sliced and grouped data for plots # input files: NNsmossmap_smos_output_ver1.pkl to ver7.pkl, # NNsmossmap_overlap_output_ver1.pkl to ver7...
f9aac4dd464fd1defefa5ad6437934fc7fc57a96fc1b9b2b21e2d56c9900be86
Python
7,390
219
# 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...
05e7b4d63520ef3e4d1411f1fba492da2c06f3700fc6012f04291a3a26e5c66a
Python
7,394
152
""" ============================================= BabyAFQ : tractometry for infant dMRI data ============================================= The following is an example of tractometry for infant bundles. This example and resulting pyAFQ support for pediatric bundles was inspired by and largely due to the work of Grothee...
a0d79a467e8380bab92a8386d9db695f015a3667e67afb646d6c98d9bfe6d10c
Python
7,394
193
# 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...
0d8a789c41434f844a3c835caeb47289c8bb842102c407a3304493138bf2057c
Python
7,395
173
# -*- 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 neural_network_architecture import features_extraction import torch.nn as nn import torch from torch import LongTensor, FloatTensor import ...
34cbe5b741fb5449315c229486f8b52bac8aab6e381c4b37458544e08764e43a
Python
7,398
247
import torch import torch.nn as nn import torch.nn.functional as F from utils.function import FakeQuantize from math import e, pow # 计算S和零点 def calc_ScaleZeroPoint(min_val, max_val, num_bits=8): n = num_bits - 1 qmin = - 2 ** n qmax = 2. ** n - 1. # S=(rmax-rmin)/(qmax-qmin) sca...
0f2e20d7f05bd4c64e6335e3e1fac8f74ad8fc4091b5bf74efe3bbd6dfb1673e
Python
7,400
266
# 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...
1509735f9840b81acef4b48b87069bdb671d162856805d862b83f58b7110290a
Python
7,400
174
r""" Polymer simulations with CorrelatedNoiseIntegrator -------------------------------------------------- This is a sample python script to run a polychrom simulation with the `CorrelatedNoiseIntegrator' custom integrator in polychrom.contrib.integrators. This integrator is used to simulate a polymer where the Browni...
65f87cdc4f4a27b0c76de86655205b352d1a0e2c3d1633910183f54b1b6729e0
Python
7,406
191
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import bisect import copy import logging import torch.utils.data from maskrcnn_benchmark.utils.comm import get_world_size from maskrcnn_benchmark.utils.imports import import_file from . import datasets as D from . import samplers from .collate_b...
adcc281e4da91a14e9c0b38d7b7ed1522079be08aece748c5da5f6ed4112f679
Python
7,407
255
from __future__ import division from builtins import next from builtins import range from past.utils import old_div import os import itertools as it import errno from distutils.version import LooseVersion import numpy as np try: from bottleneck import nanmax except ImportError: from numpy import nanmax try: ...
3f28f3fb787422f101a5d921ef9b768228d78539091243bab6e3e370a238f54e
Python
7,409
192
""" File: inter_eqtl_celltype_details.py Created: 2020/05/20 Last Changed: 2020/06/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 Foundat...
65e7421f1776217cfa0668dd11fedc45f8b3ac7862ae8a738baab547f4db1eee
Python
7,414
189
# 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...