sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
82354af7ea9cc1df0f665e79c18ea8aa62826e4c76ec5a4728fbd75f6421ce77 | Python | 13,246 | 337 | import torch
from torch import nn
def sinc_expansion(edge_dist: torch.Tensor, edge_size: int, cutoff: float):
"""
calculate sinc radial basis function:
sin(n *pi*d/d_cut)/d
"""
n = torch.arange(edge_size, device=edge_dist.device) + 1
return torch.sin(edge_dist.unsqueeze(-1) * n * torch.pi ... |
bec44a17bd4681ef9c1f56725c19711de69a0782dcb80d2246a13e8c88ac4f98 | Python | 13,246 | 351 | # -*- coding: utf-8 -*-
"""
@author: Satoshi Hara
(Class)
> AlternateLasso(maxitr=1000, tol=1e-4, rho=0.1, verbose=False, save='') # for linear regression
> AlternateLogisticLasso(maxitr=1000, tol=1e-4, rho=0.1, verbose=False, save='') # for linear binary classification
maxitr : maximum number of iterations f... |
6b3f2206a88489fda37a740dcb242d20d633a4540cc689f196b4e2386d0be1e4 | Python | 13,247 | 394 | import sys
import argparse
import numpy as np
import os
import pickle
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from scipy.spatial.distance import pdist, squareform
from model.Model_amp import *
from model.Model_acp import *
from math import pi
import pandas as pd
def load_amp(dir):
amps = []
labels = []
w... |
ed5fe67d191440ae86f33adcc21b9f34e73dfc8d06ba3e39a83920ee7a9f47ac | Python | 13,253 | 310 | import json
import logging
import unittest
import re
import yaml
from oaklib.cli import search, main
from oaklib.datamodels.vocabulary import IN_TAXON
from tests import OUTPUT_DIR, INPUT_DIR, NUCLEUS, NUCLEAR_ENVELOPE, ATOM, INTERNEURON, BACTERIA, EUKARYOTA, VACUOLE, \
CELLULAR_COMPONENT, HUMAN, MAMMALIA, SHAPE, ... |
83384eaf8b88871467959b98fbe14c5fb5d70577d8d977d5ac95483fb050ec6c | Python | 13,267 | 314 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Variational Animal Motion Embedding 1.0-alpha Toolbox
© K. Luxem & P. Bauer, Department of Cellular Neuroscience
Leibniz Institute for Neurobiology, Magdeburg, Germany
https://github.com/LINCellularNeuroscience/VAME
Licensed under GNU General Public License v3.0
"""
... |
79077ebfbd78f4cc64ab5339d692eb2d180960d56c07fda533dd0e365a19b193 | Python | 13,288 | 385 | # Auto generated from class_enrichment.yaml by pythongen.py version: 0.0.1
# Generation date: 2024-03-12T19:30:38
# Schema: class-enrichment
#
# id: https://w3id.org/oak/class-enrichment
# description: A datamodel for representing the results of class enrichment on gene sets
# license: https://creativecommons.org/publi... |
950e8accb62151c69588325c8c8b4d28bb26ba494b2242204a56a40bc9b1aa61 | Python | 13,292 | 331 | from abc import ABC, abstractmethod
from copy import deepcopy
import torch
import time
from tqdm import tqdm
from torch import nn
from drugex import utils, DEFAULT_DEVICE, DEFAULT_GPUS
from drugex.logs import logger
from .attention import DecoderAttn
from drugex.training.interfaces import Generator
from drugex.train... |
21a91a9339d24935de615293f65a8ece6e88e524d9881d750b72f8371e117744 | Python | 13,293 | 317 | import numpy as np
from scipy import signal
from itertools import zip_longest, product
from scripting.spectrum.io import paths, dialogs, persist
from scripting.spectrum import filters, masking
from scripting.spectrum.io.eeg import EEG
from scripting.spectrum.io.annotations import pinnacle
def welch(arr, fs, axis, npe... |
ed9abdbf3b532a2aef8550d0243b12d316e6a9fc73b3ca5bd90bb17051818d24 | Python | 13,313 | 303 | #!/usr/bin/env python3
"""Read, explain and rescore a CARLA Leaderboard results.json.
read_results.py RESULTS.json per-route table + global record
read_results.py RESULTS.json --route 3 one route in full
read_results.py RESULTS.json --as 2.1 recompute the scores under 2.1 rules... |
7c28f60a929b2403b79f6ec80b4ba4980d45e5e989a2438e31f6d05f4b3d3868 | Python | 13,315 | 302 | # 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... |
99dd9679eed2e7a6674cb7be65b1ec94ba5208dc01ce54feacdbf105cda1c923 | Python | 13,315 | 343 | from abc import ABCMeta, abstractmethod
from collections import OrderedDict
import mmcv
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
from mmcv.utils import print_log
from mmdet.core import auto_fp16
from mmdet.utils import get_root_logger
class BaseDetector(nn.Module, metac... |
30c593458edeb107b4eac404cb16c1400d4ce7f1f61ed56a02eaac505852ef1b | Python | 13,318 | 331 | import logging
from abc import ABC
from dataclasses import dataclass, field
from pathlib import Path
from typing import Iterator, List, Optional, Union
import click
from linkml_runtime.dumpers import json_dumper
from linkml_runtime.linkml_model import EnumDefinition, PermissibleValue
from linkml_runtime.linkml_model.m... |
44fdf5ada251a9fb8e57ab2b267fb52d037406e5b452f064d8e16e822d46eb4e | Python | 13,320 | 400 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import copy
from copy import deepcopy
########################################################################################
class SELayer(nn.Module):
def __init__(self, channel, reduction=16):
super(SELayer, self).__init__... |
95e5cd8c94ba819971bf8b20869c8030391a243e030519f68eb9c24b8f7d1e6b | Python | 13,325 | 380 | """
Module for handling plot data storage in a single parquet file.
This replaces the individual plot parquet files with a single file that contains data from all plots.
It also stores all report metadata (modules, data sources, configs) to make reports fully reproducible.
"""
import json
import logging
import os
from... |
e8b9f7400018033f9da080035409cec41b698b0088736482415713c75cb3eee0 | Python | 13,328 | 390 | """
RACCOON (Resolution-Adaptive for Coarse-to-fine Clustering OptimizatiON)
F. Comitani @2018-2022
A. Maheshwari @2019
"""
import os
import sys
import uuid
import logging
DEBUG_R = 15
import time
import psutil
import warnings
import csv
from raccoon._version import __version__
from raccoon.clustering import... |
817ec196141189ea4515dae15c18d45950d461c9d1a236b0621fbbcc184d0571 | Python | 13,331 | 319 | """
vocabulary
Created by: Martin Sicho
On: 26.04.22, 13:16
"""
import re
import numpy as np
import pandas as pd
import torch
from rdkit import Chem
from drugex.data.corpus.interfaces import SequenceVocabulary, Vocabulary
from drugex.molecules.converters.standardizers import CleanSMILES
class VocSmiles(SequenceVoc... |
d254a172335d45cb53fbb2a15d3d222fff15640ad8441a735e6dde7ada9dbf25 | Python | 13,333 | 393 | # Requriments - transformers, tokenizers
# Right now, the Smiles Tokenizer uses an exiesting vocab file from rxnfp that is fairly comprehensive and from the USPTO dataset.
# The vocab may be expanded in the near future
import collections
import os
import re
import pkg_resources
from typing import List
from transformer... |
08944106686cf922451ba18afbc297bde7e8705d7be867878fa009e821ee9bbd | Python | 13,337 | 246 | import logging
import unittest
from typing import List
from linkml_runtime.dumpers import yaml_dumper
from oaklib.datamodels.taxon_constraints import SubjectTerm, Taxon, TaxonConstraint
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.resource import OntologyResource
fro... |
e0bf6da3fb98843648bbdde432f1b015d4afc0b5fb79ebc9af8ef2ed06db7977 | Python | 13,339 | 288 | #Authors : Maria-Anna Trapotsi, Layla Hosseini-Gerami and Lewis Mervin
#Emails : mat64@cam.ac.uk and lh605@cam.ac.uk
#Supervisor : Dr. A. Bender
#All rights reserved 2021
#Protein Target Prediction Tool trained on SARs from PubChem (Mined April 2021) and ChEMBL28
#Molecular Descriptors : 2048bit Morgan Binary Fingerpr... |
58c9775ff16d528ff85bcac35fbd0b9a524af4f3e9aead0a8555043f6cc9f225 | Python | 13,345 | 392 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
import pandas as pd
import numpy as np
import torchvision
import torchvision.transforms as T
from torchvision import models
import pytorch_lightning as pl
from pytorch_lightning.loggers import ... |
87c656a3330cd82adcb534b3537399b4d8ba208c98acd1e368cf1a22dadfacf5 | Python | 13,351 | 358 | import sys
import time
import random
import itertools
import numpy as np
import scipy.spatial as sp
import matplotlib.pyplot as plt
sys.path.append('../generation')
from voronoiUtilities import *
class Voronoi:
def __init__(self, Nx, Ny, shape, notchWidth, lamda, hexSpacing, hexZ, seed=1):
"""
Nx,... |
f5a3957e0b3505837824538a4666f258e0a2d9d269c023a39a6b610d9c4a5b44 | Python | 13,351 | 392 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
import pandas as pd
import numpy as np
import torchvision
import torchvision.transforms as T
from torchvision import models
import pytorch_lightning as pl
from pytorch_lightning.loggers import ... |
2a0622988ebb64060d3d9583d71748b4235af06ead4381b9eee4c3eb264b26ae | Python | 13,357 | 379 |
#!/usr/bin/env python
# coding: utf-8
'''
@author: Mahbub Ul Alam (mahbub@dsv.su.se)
@version: 1.0+
@copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se)
@license : MIT License
'''
import argparse
import logging
import socket
import torch
from threading import Thread
from threading import Lock
import time
impor... |
1e68c26f22c5c8e73c85c5b511bb1f18d643be52a7c91d79b828c0df1b432433 | Python | 13,358 | 364 | # @author: Miroslav Kuchta
import src.fem.cylindrical as cyl
from dolfin import *
from functools import reduce
import itertools
import operator
import sympy as sp
import ulfy # https://github.com/MiroK/ulfy
# Problem
#
# -div(sigma(u, p)) = f with sigma(u, p) = mu*grad(u) - p*I
# -div(u) = 0 in Omega
#
# with foll... |
b5a1b5c505e429b21558eaf6b93255f1b79b61c98c56f78c36e096a881901028 | Python | 13,358 | 337 | #!/usr/bin/env python3
"""
File: compare_bulk_and_sn_zscores.py
Created: 2020/11/04
Last Changed: 2020/12/16
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
t... |
3444c3efb57adb2fc449018fbf290eed05745231457c7c04def5d19811b5ca9e | Python | 13,359 | 362 | import pandas as pd
from drugex.data.corpus.vocabulary import VocSmiles, VocGraph
from drugex.logs import logger
from drugex.data.interfaces import DataSplitter, FragmentPairEncoder
from drugex.molecules.converters.interfaces import ConversionException
from drugex.molecules.interfaces import MolSupplier
from drugex.pa... |
e950cb939b70f465410505c4b493cf8cc0774a378ea105d7c17e580dced7b2f8 | Python | 13,359 | 337 | #!/usr/bin/env python3
"""
File: compare_bulk_and_sn_zscores.py
Created: 2020/11/04
Last Changed: 2022/02/10
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
t... |
8e11895e3f38386ce5d4f4c1c1eaa3c281bfc0db85b8d29c6f64d864b90df686 | Python | 13,363 | 366 | # 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... |
218f97b7852698cbea0f10a38637b52b09efbf14e42b0b1b2f2749cee2448292 | Python | 13,370 | 358 | import logging
from typing import Optional, Sequence, Union
import numpy as np
import pandas as pd
from anndata import AnnData
from pandas.api.types import CategoricalDtype
from scvi import _CONSTANTS
from scvi._compat import Literal
from scvi.data._anndata import _make_obs_column_categorical
from scvi.core.data_loa... |
e0bcef999ede95682f5d0618398a8eae2fa69ab655cda2719178cce69618318a | Python | 13,373 | 330 | import os
import numpy as np
import sys
import time
import torch
import torch.nn.functional as F
from torchvision import transforms
from torch.optim.lr_scheduler import ReduceLROnPlateau
import torch.nn.init as init
from model.generative_network import Generator
from torch.autograd.variable import Variable
from model.... |
cedfd614a3e968065584216830dc32957185a2208995f76cd12b3044c90175f4 | Python | 13,375 | 335 | from logging import Logger
import os
from typing import Dict, List
import numpy as np
import pandas as pd
from tensorboardX import SummaryWriter
import torch
from tqdm import trange
from torch.optim.lr_scheduler import ExponentialLR
from .evaluate import evaluate, evaluate_predictions
from .predict import predict
fro... |
1520c9d27e8787198caf0f7bc9d32a78544c4befe9dbc0aefe4c133ea9434786 | Python | 13,380 | 328 | import logging
from abc import ABC
from typing import Any, Dict, Iterable, List, Optional, Union
from linkml_runtime.dumpers import json_dumper
from oaklib.datamodels.ontology_metadata import DefinitionConstraintComponent
from oaklib.datamodels.synonymizer_datamodel import RuleSet
from oaklib.datamodels.validation_da... |
58f8b6e700f5921a48cd45344a4141d05b9935f40d03e72435b126581f965f5e | Python | 13,383 | 338 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Test MneExperiment using mne-python sample data"""
from pathlib import Path
from os.path import join, exists
import pytest
import shutil
from warnings import catch_warnings, filterwarnings
import numpy as np
from numpy.testing import assert_almost_equal, asse... |
90a447defdc55c3a160c968bdefc3e79423675d4548cb47bec77ff1bf61214aa | Python | 13,387 | 430 | import warnings
import numpy as np
from numpy import pi, sin, cos
import mne
from mne._fiff.pick import _pick_data_channels, pick_info
from mne.channels.layout import _pair_grad_sensors, _find_topomap_coords, _merge_ch_data
from mne.viz.topomap import _check_extrapolate, _make_head_outlines, _setup_interp
from mne.vi... |
ba9c6c8b597dc30fa0464dc05c89b8cfa5905065c0a824354c1ce9981fa2e5fc | Python | 13,387 | 311 | """
File: combiner.py
Created: 2020/10/15
Last Changed: 2020/10/28
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 versio... |
1713db14f126757cc6c1c739fd6867af4a2df17b6adc993ca11dd12ff4c067a8 | Python | 13,389 | 311 | """
File: combiner.py
Created: 2020/10/15
Last Changed: 2022/02/10
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 versio... |
f082a30e439c08998386250477fe1d6865e96f3a4f313d4dc183f3fa373fa01c | Python | 13,391 | 354 | import cv2
import numpy as np
import cigar
import sys
def deal_sup(sup_info, min_mapq):
# [[chr20,167320,+,2436S1758M55I,60,167], [chr20,166350,-,1810S970M40I1429S,60,106]]
new_sup = []
for info in sup_info:
info = info.split(',')
if int(info[4]) >= min_mapq:
cigar_li... |
3d15abdf0db1765db04e49aeba8047ab5d53d0895299ec3029cbe703bd159399 | Python | 13,395 | 359 | import numpy as np
# Visualization
from matplotlib import pyplot as plt
# Builtins
from pathlib import Path
import pdb
class ConnectionTranslator:
"""
Translate connection weights from one format to another.
Attributes
----------
_properties_list : list, optional. If empty, takes all properties... |
69ef32d2f77cdc6b0fddf859a73d663b09f345767d2b90581afdcf93884ee2ec | Python | 13,397 | 271 | import datetime
import itertools
import numpy as np
import pandas as pd
import tqdm
import os
import inspect
import AIS_parameters_sak
import AIS_parameters
import import_AIS
fname = os.path.split( inspect.getfile(inspect.currentframe()) )[1]
from scipy.interpolate import interp1d as interp1d
period_mse... |
1878fb1e65bde8cb0ff25cae4194d333e1892e01b3b91a49979ef7428884a97d | Python | 13,398 | 349 | # SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: MIT
"""
Simple Trajectory Follower using BasicAgent's PID Controller
This provides maximum control for following NUREC trajectories that may deviate
from lanes, with timing-based speed control.
"""
im... |
5a3851b9f305fd5063f87dfa96fc5cc39ab5dd8704591e380f86c3815b260560 | Python | 13,404 | 302 | # 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... |
daffb65ad92b64def492b41159eb5854cea36ad55c92fc87de2b48b17f55a368 | Python | 13,408 | 460 | # %% [markdown]
# ##
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import Node, NodeMixin, Walker
from graspy.embed import OmnibusEmbed, selectSVD
from graspy.models import DCSBMEstimato... |
237c0b0ea2c7e7a43b5e534b73063e1f7618ffad906d9a82a0166bd044859f8a | Python | 13,414 | 331 | # 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... |
e477489df9ee40631622011f9541a09398fc27f67e6aa28934f0f81e7587ab5c | Python | 13,429 | 280 | '''Submodule that includes base classes to be extended by framework-specific implementations.'''
import json
import os
import csv
import numpy as np
from slideflow.util import log
from slideflow.slide import StainNormalizer
class FeatureError(Exception):
pass
class _ModelParams:
"""Build a set of hyperparame... |
a7028e5ddf1e74bb74b04e362ebe02c26a1cea4c64636603fd7b247538003273 | Python | 13,434 | 338 | """
A set of functions for needed for running training in various settings
"""
import logging
import os
import shutil
import numpy as np
import pandas as pd
from utime.utils.scriptutils import get_all_dataset_hparams, get_splits_from_all_datasets
from utime.sequences import MultiSequence, ValidationMultiSequence, get_... |
98402f67062ff7899e98a13c9c4667a5304d7f793821a1a99d9628fb34dc4ac4 | Python | 13,435 | 227 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
b1c9c0662ccdf61a46657ec09da76df02a1a5dd1f296ed29c1df9686757e9928 | Python | 13,437 | 341 | #!/usr/bin/env python3
"""
File: cell_fractions_vs_psychencode.py
Created: 2021/10/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 ... |
f597f18d58187b65e93204cafb71a578f962a7eb9a63e3dedb4c66e30bf80961 | Python | 13,451 | 234 | #!/usr/bin/env python3
"""
File: decon_eqtl_replication_select_and_harmonize.py
Created: 2021/06/23
Last Changed: 2021/08/03
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 a... |
8b431398b157e07b81e5bfb930be57183bd0e2cd76ce3ff1be2056a5f622f595 | Python | 13,462 | 411 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# picachooser documentation build configuration file, copied from
# capcalc 8/21/2025
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
54b090b9ec3fd5e0fb37515d83f34f0cf30c2aeeb2666f44c6066b52931acee5 | Python | 13,505 | 364 | ####################################################################################################
# Copyright (c) 2019 - 2023, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis>
#
# This program is free ... |
0a1c8d433fe097bca1c64c08b821fa99e83921b15fd2c5bc487033fb93a9c244 | Python | 13,506 | 427 | from pathlib import Path
import pytest
from conftest import RESOURCES
from rdkit import Chem # type: ignore[import-untyped]
from ppqm import chembridge, tasks, xtb
from ppqm.utils.shell import which
if not which(xtb.XTB_CMD):
pytest.skip("Could not find xTB executable", allow_module_level=True)
TEST_ENERGIES ... |
d4aa31f037a8e04352f77d29e0a2fcb7d039a5e90beba4f8d9860b8fb17efea7 | Python | 13,513 | 254 | import collections
import pandas as pd
import inspect
import re
import os
import numpy as np
import itertools
import tqdm
import AIS_interp
import functions_basic_sak as funsak
from sklearn.cluster import DBSCAN
from scipy.interpolate import interp1d
import AIS_infer_mmsi
import AIS_parameters
import ma... |
f0f46c2fd5ac9dbfde3a3cfc0f4ff4c4c19fa6e2501a4a591fe3a4036d9bd1c6 | Python | 13,514 | 284 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
337ec6ae4796760edb8f6475feac630dba9b7c8fd4a63eb0ef1f13720a46d43f | Python | 13,534 | 297 | """
Dense Convolutional Encoder-Decoder Networks
Reference:
https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py
"""
import torch
import torch.nn as nn
class _DenseLayer(nn.Sequential):
"""One dense layer within dense block, with bottleneck design.
Args:
in_features (in... |
f9084d40e0163756ee6f18c2929fb91692b7725727c2a51e265d7efbb9bf1132 | Python | 13,534 | 297 | """
Dense Convolutional Encoder-Decoder Networks
Reference:
https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py
"""
import torch
import torch.nn as nn
class _DenseLayer(nn.Sequential):
"""One dense layer within dense block, with bottleneck design.
Args:
in_features (in... |
f13b8261f32f89fcacb0affedc7bcd43a7471cc0ebfc2f3f22c9117f344964b6 | Python | 13,540 | 300 | """
Differentiable volumetric implementation used by pi-GAN generator.
"""
import time
from functools import partial
import math
import numpy as np
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
import random
from .math_utils_torch import *
def fancy_integration(rgb_sigma, z_vals, dev... |
a055103bc025c8363fa7b7527d6e2d40ad4c5c1229ce9b257c320d499427d4fd | Python | 13,556 | 343 | # 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... |
81791f5e294501bbc4b9915ea283ca795f9ef13cd5f3fa59dca4ab74838ca384 | Python | 13,561 | 299 | import torch
from torch import Tensor
from functools import partial
import torch.nn.functional as F
from typing import Callable, Optional, Tuple
from torch_geometric.utils import k_hop_subgraph
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_geometric.nn import MessagePassing
from torch_geometric... |
a8b61713dab6517c5cb914f26b88fdb3c7abf3f2488ef0d4d6fc080309ba589c | Python | 13,567 | 385 | import nibabel as nib
import os.path as op
from time import time
import logging
from tqdm import tqdm
import numpy as np
import tempfile
import math
from PIL import Image, ImageDraw, ImageFont
from AFQ.definitions.mapping import SlrMap
from AFQ.api.utils import (
check_attribute, AFQclass_doc,
export_all_help... |
aa12094c88aef77815fad5e6a51c36fe5bf8d3fccf5543bcecdc8363a5cc4ae2 | Python | 13,572 | 483 | import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
import weave
###########################################################
# Check integrity of objects.
###########################################################
def check_dict_fields(x, template, raise_erro... |
349042c4a0a90265afda79610a08252b88743ae048148bf5c0a0a12e749047fb | Python | 13,574 | 462 | from pathlib import Path
import pytest
from conftest import RESOURCES
from rdkit import Chem # type: ignore[import-untyped]
from ppqm import chembridge, orca, tasks
from ppqm.orca import ORCA_CMD, OrcaCalculator
from ppqm.utils.shell import which
if not which(ORCA_CMD):
pytest.skip("Could not find orca executab... |
809d7b11ee3f14f52b9c862087693c9f5be6a7d5b1a72a5b10f96e8a9db615ca | Python | 13,585 | 390 | """
Code to build spatially-dependent network.
There's two sides to it:
- Use correct density of different cell types and place them in space
- Connect them according to spatially-dependent radial connectivity profiles
For the connectivity part we need to evaluate all-to-all-distances which is O(n... |
71281e0eca6abb44f8fd4664dd21abcf5d05df14a15d712c872ee1df2e30cabb | Python | 13,588 | 339 | import numpy as np
import torch
import torch.nn.functional as F
from ..builder import BBOX_CODERS
from ..transforms import bbox_rescale
from .base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class BucketingBBoxCoder(BaseBBoxCoder):
"""Bucketing BBox Coder for Side-Aware Bounday Localization (S... |
65b94fa0724847330f85d35cae1ea6c2d08f21a725e2073ca7dda8a6734d5f1a | Python | 13,597 | 288 | import os
import time
import logging
import tensorflow as tf
from .model.VAE import VAE
from .model import siVAE
from .model.analysis import run_FI
from .model.output.output_handler import output_handler
from . import FeatureImportance as FI
import time
import numpy as np
def run_VAE(graph_args_s... |
750d6a4a91702e57f054fba62211ba403b1261e1f2165a7dcc8f175e064e11ca | Python | 13,599 | 285 | """Camera rigs: definitions, YAML presets and mounting on a CARLA ego vehicle.
A :class:`Camera` is defined the NVIDIA way: an FLU pose relative to the
vehicle's rear-axle-on-ground point. :meth:`Rig.mount_on` turns that into CARLA
attach transforms for a concrete ego vehicle and reports the *actual* poses
(which the... |
e83a1112788864e979c2c77b31cd35846085c311621ae9479d3a44579aaa4d91 | Python | 13,608 | 231 | import h5py
import ants
import numpy as np
import nibabel as nb
import os, sys
from tqdm import tqdm
import re
import time
import pandas as pd
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
... |
e16eca74bcfacfaf6b869e2e915e06110dadebbe900cfb1daca011fc1d088278 | Python | 13,609 | 248 | from jax.config import config
import numpy as np
import pytest
from simphox.fdfd import FDFD
from simphox.typing import Size, Size3, Optional, List, Union
np.random.seed(0)
config.update("jax_enable_x64", True)
# config.update('jax_platform_name', 'cpu')
EPS_3_3_2 = 1 + np.random.rand(3, 3, 2).astype(np.complex128... |
f50b5fa65126d276374362001ad7812d1609da13c8930e2a6eca25c2001fbdbe | Python | 13,609 | 344 | #!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 8 14:01:37 2021
Content
1. Functions to evaluate network adjecency matrices
2. Build weight/adjecency matrices
3. Run model simulations (Meisel 2020, Shew et al. 2009, Kinouchi et al. 2006
@author: Paul Müller
"""
from numba import jit, prange... |
7a3a65c5180e2b2db6001dc7e1d7d12c70e7c568bc14431e032a17ddaff04703 | Python | 13,619 | 334 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from mmdet.core import (auto_fp16, build_bbox_coder, force_fp32, multi_apply,
multiclass_nms)
from mmdet.models.builder import HEADS, build_loss
from mmdet.models.losses import accuracy
... |
50c89e52b5cb6e9938380f1f176a573ea3f41389e7d3d9ea27ce7707549cc272 | Python | 13,625 | 319 | """Control-video conversions (pure functions) and ffmpeg encoders.
Depth
CARLA encodes depth in 24 bits over BGRA: ``d_m = 1000 * (R + 256 G + 65536 B) / (2^24 - 1)``.
Cosmos depth branches were trained on Depth-Anything output, i.e. *relative
inverse depth* normalised per clip to [0, 255] with **near = br... |
58153dca682a9be8c3d1681158d0065b7f7f42d4c81ed0da90921709c2d9c2b3 | Python | 13,627 | 390 | from neuron import h
import numpy as np
import pandas as pd
import sys
from cell_models import PyramidalCell
from synaptic_metrics import synaptic_metrics
from opt import myinit
import pickle, os
# If we had not included gui in the list of things to import
h.load_file("stdrun.hoc")
# Console argument -- number of re... |
7e845ef50c7f63ac0b3a9a6294ded59cc800f0304a00137e09680bf1cfd5dcfb | Python | 13,631 | 345 | import colorsys
import os
import sys
import numpy as np
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from .movable_points import TriangulationPoints
class ClickableImage(pg.ImageItem):
class SignalProxy(QObject):
... |
16709cb8d48cb4b99659b7ec6ae1c15c23ec4b1cbc0cdb420f9ac5893e89e520 | Python | 13,637 | 367 | import pickle, random
import torch
from copy import deepcopy
from typing import Tuple
import numpy as np
from torch_geometric.utils.convert import to_networkx
from graphxai.utils import Explanation
from torch_geometric.data import Dataset, data
from torch_geometric.loader import DataLoader
#from torch.utils.data.data... |
eeb9119916e7e19e04250cd8ee988fb22cc8d6d38c0ea7f66124456dfb9bf22a | Python | 13,645 | 334 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import auto_fp16, force_fp32
from torch.nn.modules.utils import _pair
from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
from mmdet.models.builder import HEADS, build_loss
from mmdet.models.losses import accuracy
@H... |
3cbdd1073963300cbf7efd44ff48f24fd206de0ea1f8f42d06782a1188321060 | Python | 13,646 | 429 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
I/O objects for phys2bids.
"""
import numpy as np
def is_valid(var, var_type, list_type=None):
"""
Checks that the var is of a certain type.
If type is list and list_type is specified,
checks that the list contains list_type.
Input
-----
... |
92cacab7794c5dfb35efb139f8881881a1a2410b055de218b476439534019415 | Python | 13,647 | 476 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import seaborn as sns
from joblib import Parallel, delayed
from scipy.optimize import curve_fit
from graspy.match import GraphMatch
from graspy.plot import heatmap
fr... |
1e1541f1a7f7e21cab27868c2cfa26fdfb3cd3f618312a9d3fabfef1cca792e8 | Python | 13,658 | 377 | import struct
import six
import glob
import random
import tensorflow as tf
from pathlib import Path
import os
import collections
import re
import pathlib
# To represent list of sections as string and retrieve it back
SECTION_SEPARATOR = ' <SCTN/> '
# to represent separator as string, end of item (ei)
LIST_SEPARATOR =... |
d93d554f1764cea0f4988d81c97aec74ebedca1aff87c8c3ef489cb01fc45ce3 | Python | 13,661 | 311 | #!/usr/bin/env python3
"""Explore a CARLA map's road network: topology, junctions, waypoints, navigation.
Commands:
summary a rundown of the whole map (stats + prose)
topology [--draw] [--life 120] list / draw the road topology (segments)
junctions [--arms N] [--draw] ... |
991ac9fd9990f5ec6c24e4618b1b9e78d22889957ee5a1cb690ce5e229a179a8 | Python | 13,669 | 345 | import os
import torch
import numpy as np
from abc import ABC, abstractmethod
from . import networks
from collections import OrderedDict
class BasicModel(ABC):
"""
This class is an abstract base class for models.
To create a subclass, you need to implement the following five functions:
-- <__init_... |
9789582bc2248282ee041eaf41d662aaa71034072ed5f898fe46db9a7588261c | Python | 13,670 | 366 | #!/usr/bin/env python3
# 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>.
"""
Standalone numerical cross-check of the FLensModelDescriptor forward/inver... |
189906e5e41b3866a97e1de64f92a8f0c3d2240fae8e5c8f8f92d1c6de1a8973 | Python | 13,683 | 424 | '''3rd version of NN/FDTD alternating approach, incorporating the FDTD env instead of vanilla carpole.
This version uses PPO, and future versions will switch to rainbow DQN. April 12nd 2022
Authors: Renjie Li, Ceyao Zhang @CUHKSZ '''
import argparse
from email import policy
import string
import gym
import gym
... |
2ff5959265fc8af9fd46b5cb47c4dd0c060429abe74fdfbb9c9c651462d892da | Python | 13,693 | 321 | # 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... |
277e2861867c38fb1f192116df6332bd7151f235ece5035745a79bd89654c79a | Python | 13,695 | 276 | #!/usr/bin/env python3
# -*- coding: utf-8 -*
"""Postprocessing and analysis of data collected from the placement study
"""
from functools import reduce
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score, mean_squared_error
import matplotlib.pyplot as plt
import pandas as pd
impor... |
343823eb17bf892a998cc9c5c502eee9d35f04706919aeedd030894dcd833fa5 | Python | 13,700 | 380 | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __... |
6317d9a8047de3d8fcb2855c8a8225fe563a23ff2a553aea82b8646a26e2b9a7 | Python | 13,704 | 304 | # 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... |
24c70023d6e374e3f495c6ac50ee2a54847b69f8a3efea3d971d20a60e242481 | Python | 13,708 | 326 | #!/usr/bin/env python3
"""
Summarize the experiments needed to aquire the data for the plots in the paper.
Run this script providing both the --grid_search and --genetic_algorithm flag
to record all data used in the paper.
The data used in the paper was recorded on hxcube9fpga0chip59 using the
calibration:
/wang/d... |
f1301c5f66a7e759ad62f7fe382df113f3172aa566c060c061be74a1dbbf69f3 | Python | 13,721 | 385 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 16:35:51 2019
@author: smithm3
"""
import click
import unetsl.cerberus as cerberus
import unetsl.cerberus.cerberus_config as cerberus_config
import unetsl.cli_interface as client
#the new multi-gpu support
import tensorflow.distribute as tfd
Mir... |
06cffbfc3c1956ae53333afb22b571e134bc794a8a3f9c33e802f1017ddda13a | Python | 13,724 | 399 | # @author: Miroslav Kuchta
import src.fem.cylindrical as cyl
from dolfin import *
from functools import reduce
import numpy as np
import itertools
import operator
import sympy as sp
import ulfy # https://github.com/MiroK/ulfy
# Problem
#
# - d c / dt + v.grad(c) - kappa*Delta(c) = f
#
# with following bcs:
# 1) con... |
b5d8672f33894c174f3d64eb6dea5d9552b33278c690522fc36897cbe2f48cb4 | Python | 13,726 | 390 | from neuron import h
import numpy as np
import pandas as pd
import sys
from cell_models import PyramidalCell
from synaptic_metrics import synaptic_metrics
from opt import myinit
import pickle, os
# If we had not included gui in the list of things to import
h.load_file("stdrun.hoc")
# Console argument -- number of re... |
d9725f75cd7a4d0ba0930e72e0199113fb625650109e4d140b909dc5cc25b1e3 | Python | 13,726 | 327 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import json, os, time
import tensorflow as tf
from tensorflow.python.training import session_run_hook
__all__ = ['TaskSpecDef', 'TaskSpec', 'DistributedSession', 'StopAtTimeHook', 'LoadCheckpoint']
class TaskSpecDef(object):
"""Specification for a distributed task.
... |
b6a5e028df2d2e32c850e09242ee1ec3c31c4dcfa1f1cde938330330ebc0d407 | Python | 13,727 | 322 | # %%
from pymaid_creds import url, name, password, token
from data_settings import data_date, data_date_A1_brain, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import navis
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from contools impo... |
1bf51f7a8c0d1b0f750619e559d77746002c16dc20365a685a4cedc69e9fbd96 | Python | 13,736 | 324 | # 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... |
19778eb0ba8693390245f0011c9bc1ca1e5e585fe3c3d15b548524b8dd7cea6d | Python | 13,747 | 319 | from torch.utils.data import Dataset
import numpy as np
import torch
import mne
from scipy.stats import zscore
from collections import Counter
import h5py
from os.path import exists
import pickle
from time import perf_counter
from gssc.utils import *
class SeqDataSet(Dataset):
"""
This organises multiple datas... |
c4c49c950360f0ba5fa180473093d1db7daacfcf48a7527154154e64d9cfcccd | Python | 13,757 | 337 | """HMM-Dirichlet for compositional mode time courses.
The sequence length is measured in hidden-state windows. Data contains raw
samples. The emission uses the mean per-sample log-density.
"""
import os
from dataclasses import dataclass
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
... |
482107b5bfafa58a00fc8a1d8a5310a75396c426a0da79430d1cb0bdce24fe19 | Python | 13,760 | 315 | import os
import json
import time
import argparse
import pandas as pd
from drugex.logs.utils import enable_file_logger, backUpFiles
from drugex.molecules.converters.fragmenters import Fragmenter, FragmenterWithSelectedFragment
from drugex.molecules.converters.dummy_molecules import dummyMolsFromFragments
from druge... |
0996ff663785f0cc4b83f4007bec6750f91a4c7d85647a1df5ca0e89a75d95d3 | Python | 13,767 | 330 | #!/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>.
"""Example script to generate traffic in the simulation"""
import time
impo... |
040683ce722c9ba4cd5050d4990a342c99e7284e742156986922b6d958a7e37f | Python | 13,776 | 255 | # 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... |
0c74f1c367086c06835b44a8da978a05b49ebb698ff3b9b2beb1920ceb24db3a | Python | 13,782 | 408 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 18 22:18:08 2021
@author: Fuyuki Asano
"""
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import sys
import os
from scipy import signal
import csv
import cv2
import tifffile
import statistics
import ... |
9034a798dc3152af95624933152185ce72aab3dfcefb4f1132561e5b3f1fff62 | Python | 13,784 | 478 | """Helper functions for manipulating `NumPy \
<https://numpy.org/doc/stable/user/index.html>`_ arrays.
"""
from typing import Callable, List, Optional, Tuple, Union
import numpy as np
try:
from numpy.lib.array_utils import normalize_axis_tuple
except ImportError:
# NumPy < 2.0
from numpy.core.numeric im... |
976af07237f0d9c56e92e424296ee8bb7843eb51df4fc68d74f11d7d40403c42 | Python | 13,802 | 311 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.