sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8a0b589d0b8cde0902ab5e33cf6b1b9c57f9069c4640d188f9eda530aed0975a | Python | 11,450 | 264 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, in_planes, out_planes, stride=1):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, 3, stride=stride, padding=1, bias=False)
... |
637a467ad9e7792251e832b71ef4355656e60bfa74ca58606cec1c2408582a72 | Python | 11,464 | 294 | import os
import logging
import numpy as np
from datetime import datetime
from glob import glob
from PTQuery import *
from typing import Tuple, List, Iterator
def read_report_csv(report: str) -> pd.DataFrame:
"""
read in a WES report and return a pandas dataframe
"""
if report.endswith(".csv"):
... |
df7bd667dab2409917f8eaa8f24ae81a8a1f1cf0d426e5a097385ba9c5bd0b97 | Python | 11,464 | 260 | """Context Encoding for Semantic Segmentation"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.baselines.segbase import SegBaseModel
__all__ = ['ANN']
class ANN(SegBaseModel):
def __init__(self, classes=2, aux=False, backbone='resnet50', pretrained_base=True):
super(ANN,... |
e4da9c86aa8e007c5ddf57106d60b4a443db7b7320bd8b79b70ce89d14db9c5d | Python | 11,470 | 297 | import logging
import tempfile
import unittest
from pathlib import Path
from kgcl_schema.datamodel import kgcl
from pyhornedowl.model import EquivalentClasses, SubClassOf
from oaklib.datamodels.search import SearchConfiguration, SearchProperty, SearchTermSyntax
from oaklib.datamodels.vocabulary import IS_A, PART_OF
f... |
7ee938b3854382b031b1cf6e9b4cf17614805f793358f7a7746e7f0f78e3353a | Python | 11,474 | 359 | from __future__ import print_function, division
import sys
import os
import torch
import numpy as np
import random
import csv
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
from torch.utils.data.sampler import Sampler
import skimage.io
import skimage.transform
import skimag... |
bce33963d8399672701995734f12fc6c54f4654aebe7ecdd53a1bd8a5d4e8b7b | Python | 11,476 | 289 | #!/usr/bin/env python
# Copyright (c) 2025 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>.
import carla
import numpy as np
import cv2
from pathlib import Path
from age... |
9264306b6f9795c1a658eb5ab7b2bf73b02a8f4ccbd5dfc6715ffd394440d61d | Python | 11,480 | 293 | # -*- coding: utf-8 -*-
from .core import *
from .. import _logging as logging
import tensorflow as tf
__all__ = [
'LocalResponseNormLayer',
'BatchNormLayer',
'InstanceNormLayer',
'LayerNormLayer',
]
class LocalResponseNormLayer(Layer):
"""The :class:`LocalResponseNormLayer` layer is for Local R... |
9bd0a1e2678846c3b55a0065664dd460cdfd56351dbc4c00288ac44ba1d52b5c | Python | 11,487 | 358 | # /// script
# requires-python = ">=3.10"
# dependencies = [
# "requests>=2.28",
# "tqdm>=4.65",
# "python-dotenv>=1.0",
# ]
# ///
"""Upload the MedMNIST-NAS-Bench files to Zenodo via the REST API.
The script creates a draft deposition, uploads all data files, applies the
metadata payload, and prints the draft U... |
f2709cea4af2d246f730185440c658dbb665ed70360be776872f6f3e4c6bd5e8 | Python | 11,487 | 199 | """
DyNeMo: Training
================
This tutorial covers how to train a DyNeMo model. We will use MEG data in this tutorial, however, this can easily be substituted with fMRI data.
"""
#%%
# Getting the Data
# ^^^^^^^^^^^^^^^^
# We will use resting-state MEG data that has already been source reconstructed and prepa... |
34c27253f7bd651fcd3606308f7cf54f960819bc960f2de8835e26674e877c4f | Python | 11,489 | 310 | # 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... |
798b3a0f77a491a82f89d9effeb074f3f58a5caca23a477c133a7a58c679f05a | Python | 11,490 | 345 | #!/usr/bin/env python3
import os
import sys
from os.path import dirname
import re
import math
import argparse
import subprocess as sp
from io import StringIO
from snakemake import io
from snakemake.io import Wildcards
from snakemake.utils import SequenceFormatter
from snakemake.utils import AlwaysQuotedFormatter
from ... |
5f8980222687015628eaf5e4add493ea11f4901527d0d199e59f595d841ca2a3 | Python | 11,500 | 306 | import random
import numpy as np
from deap import base
from deap import creator
from deap import tools
from deap import algorithms
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 accuracy(decision... |
60abbe4117be532ea8684692fc2ddc5c3df8fdf6d18fd062ed3b3fe06f96eb56 | Python | 11,500 | 319 | import pandas as pd
import numpy as np
from rdkit import Chem
from KLdiv import descriptors_generator, ReferenceDistribution, KLdiv
import os
import matplotlib.pyplot as plt
def calc_score_oversample(df, df_t, smoothen=False, oversample=False):
"""Obtain KL divergences and aggregated score"""
divs = []
di... |
7da46fa25d3381f23f5a42ea200188137d5adc2ebc141d08e217852be1a43cf7 | Python | 11,500 | 263 | import math
import shutil
import os.path as osp
import torch
from nvidia.dali.plugin.pytorch import DALIClassificationIterator
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.ops as ops
import nvidia.dali.types as types
# DALI data loader
class HybridTrainPipe(Pipeline):
def __init__(self, batch_size,... |
f04ffb6cd58b624b016ec2aa86d054d97af58b09af867e0eb1b4b7db351e2884 | Python | 11,502 | 274 | import inspect
import pathlib
import pickle
import sys
import os
import numpy as np
import pandas as pd
from shiny import App, render, ui
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
### Handle local imports
### Handle local imports
os.chdir('/var/www/html/semantic-prediction')
sys.path... |
db047067dfb9998dd5376f68d54b93ad2183aca7ee2c4b47358b8c3562337bac | Python | 11,505 | 302 | # 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... |
1a0f132421eb6d81e951b8ab56eff90c0ce4f4305d6a00711769df8b7982ff0a | Python | 11,511 | 522 | # %% [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... |
d40674b22beae4843ab4d2e4f5befd70096385b99e5952deb9119942a200a415 | Python | 11,522 | 268 | #!/usr/bin/env python3
"""Capture a single-camera Cosmos clip from a TM-driven ego vehicle.
Spawns a hero plus background traffic, captures ``--frames`` frames with the
selected rig (RGB, depth, the instance-coloured seg control, the CityScapes
semantic AOV that ``--mask-classes`` needs, and the ClipGT scene package) ... |
d982bc898d4724fd365a7c4bc7e0a8c71a558c39fd673ec86b075b8c187a0cbd | Python | 11,523 | 309 | import sys, os, subprocess, glob
from collections import namedtuple
import argparse
import pandas as pd
"""
Usage: python parser.py -f <fastq_input_sample.tsv> -a <stager_analyses_report.csv> -d <absolute path to create directories> -s [mapped|recal|fastq|decoy_rm] -p <project ID for sequence batch, e.g. ACK23274>
Par... |
ccff42e4d04c45ecbc46514bc5984a60ddc5f9d7176315118674d25891e5fb47 | Python | 11,524 | 297 | import torch
import torch.nn as nn
import math
class FCNN(nn.Module):
def __init__(self, in_features, fc1_out, fc2_out):
super(FCNN, self).__init__()
self.in_features = in_features
self.fc1_out = fc1_out
self.fc2_out = fc2_out
self.fc1 = nn.Sequential(nn.Linear(self.in_... |
3ab549340e3a6abb2b6bcbdc895a4b01af246d4d4ed400ac07a716e06bc1547e | Python | 11,533 | 317 | # 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... |
f421519a36e2c3cfb759aa90e800436a28805096a0bb9684820e4d4aedeb37bd | Python | 11,541 | 250 | import pandas as pd
import geopandas as gpd
import os
import numpy as np
pd.set_option('display.max_columns', 10, 'display.width', 1500)
import re
import xarray
from geocube.api.core import make_geocube
import import_AIS
import tqdm
import functions_basic_sak as funsak
import AIS_infer_mmsi
import AIS_inter... |
53819a1f355a342b067d97991dcc07d95654032f119afec5484fb3594990d3e1 | Python | 11,544 | 326 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import numpy as np
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn import functional as F
... |
51d1601d6e6b997b593a0e0c08f0175bb2aa3206d177779787ac03346af4a167 | Python | 11,546 | 328 | """Test physio_obj.py ."""
import numpy as np
from pytest import raises
from phys2bids import physio_obj as po
# Tests is_valid
def test_is_valid():
test_list = [0, 1, 1, 2, 3, 5, 8, 13]
valid_output = po.is_valid(test_list, list, int)
assert valid_output == test_list
test_array = np.array([0, 1, 1... |
6353ebf1d6dccb4065023371f109f2ca6f7e63a15df4fcd0626301e5aeda9545 | Python | 11,554 | 331 | """
Variational Animal Motion Embedding 0.1 Toolbox
© K. Luxem & J. Kürsch & 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
"""
import os
import cv2 as cv
import numpy a... |
a9c53ce5849bea96350261690de2ca7dcf0b31c5c6908fa5edef0fddf91bc90c | Python | 11,554 | 366 | # 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 a... |
d49d4f5c211247a695e6a5df5d53c0f488004f68da18122415267422b9442795 | Python | 11,555 | 285 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
edf730ed10577bc13b87a9345df383d2ba8a3c085f3a9c8dd19170d64cdbe7a7 | Python | 11,556 | 316 | # 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... |
bf55107d18cf276594b1616d017c26ea42c363159ac10cc213522448f5094136 | Python | 11,557 | 287 | # 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... |
7dbbb6cbdf181b106ee0c68d2d2cf56111cbab5e07cbe790d24d76348f03ef03 | Python | 11,560 | 285 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
0a448e63029ebd9fcf00f7381c240cc1b5dead023901c9b8e41052b4571cdb14 | Python | 11,562 | 336 | """Tests for input object to GIF-like classes.
@author : Emerson
"""
import unittest
import warnings
import numpy as np
import numpy.testing as npt
from grr import ModelStimulus
class TestModelStimulus_Append(unittest.TestCase):
def setUp(self):
self.dt = 0.5
self.modStim = ModelStimulus.Mode... |
1a719b9aa51e176cd8c79d42daffd4dcc510fe8078c521d4f4c167ddeb82a3e7 | Python | 11,566 | 347 | import torch
import torch.nn.functional as F
from torch import nn
from neural_networks.base_models import BaseModel
def quantile_regression_loss(y_hat, y, taus):
"""
Function that computes the quantile regression loss
M: number of appliances
N: number of quantiles
T: sequence lengt... |
740042cc4ab6bf26b8d4579282b4e7c8f233816c23daa0ba3d5a67fa6da0311d | Python | 11,568 | 267 | """Contract validation: every rejection must carry an actionable message."""
import pytest
from carla_cosmos.contracts import (
AV_CAMERAS,
BUILTIN_CONTRACTS,
COSMOS3_NANO,
TRANSFER25,
TRANSFER25_AV,
CameraManifest,
ClipManifest,
ControlInput,
FrameRule,
JobRequest,
RigMani... |
0606bb68c9aea18385459c51f593ecbc0fee6f289d8cbd69d5697c75af04524e | Python | 11,570 | 253 | # Code from E(n) Equivariant Graph Neural Networks
# Victor Garcia Satorras, Emiel Hogeboom, Max Welling
# https://arxiv.org/abs/2102.09844
# https://github.com/vgsatorras/egnn/blob/1a2d515e069272484b4ff51930a3d5df3eeef92b/models/egnn_clean/egnn_clean.py
from torch import nn
import torch
class E_GCL(nn.Module):
"... |
33364e984b71fa5accc23643aa3f3d1a11087c174960bdf3b96ef6fbc815c9ee | Python | 11,575 | 272 | """Occlusion filter: the z-buffer test, and the track surgery that follows from it.
Pure numpy — synthetic depth images and hand-built camera manifests, no CARLA server and no
clip on disk. The camera is the one the exporter writes into ``calibration_estimate``
(f-theta fitted to the pinhole), so these are the same p... |
35ab9f674d94bc5295dac088c5dbc5d7b8977b89b61388b670ad1bd260e36f74 | Python | 11,575 | 306 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module containing useful functions for testing models on data with PyTorch.
Created on Thu Oct 25 16:09:50 2018
@author: nicolas
"""
import numpy as np
import matplotlib.pyplot as plt
import torch, torchvision
from axoid.utils.image import imread_to_float, overlay_... |
b62ea81f133520ceae6508c34510e78927ade9febedcdb244d2e0d84785ae656 | Python | 11,578 | 286 | # 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 SyncSmokeTest
import carla
import time
from queue import Queue, Empty
class TestROS... |
4dc220718e65fdfd00e54240c7307988b5ce2c0ff14efe6705a6ccac414cc686 | Python | 11,579 | 327 | '''
@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 os
import sys
import numpy as np
import pandas as pd
import torch
from torch.utils.data import WeightedRandomSampler, DataLoader, T... |
f755c76269ccc735730146cd715dd1dee72ca0468565e551c4c884c16091e812 | Python | 11,580 | 305 | # coding: utf-8
# ## Imports and helper functions
from IPython.core.debugger import set_trace
import pymesh
import time
import numpy as np
from geometry.compute_polar_coordinates import compute_polar_coordinates
from input_output.save_ply import save_ply
from sklearn import metrics
def read_data_from_surface(ply_fn... |
662c3f1f64e6f1dc77c155471ac877ecac6e089b5e34422b76eff235fec598c4 | Python | 11,586 | 309 | import numpy as np
import os.path as op
import os
import logging
import dipy.tracking.streamlinespeed as dps
from dipy.io.stateful_tractogram import StatefulTractogram, Space
import AFQ.recognition.utils as abu
from AFQ.api.bundle_dict import BundleDict
from AFQ.recognition.criteria import run_bundle_rec_plan
from AF... |
54ba60cfb19bc8a936d49895fdf8c44890249ac2b89c72925a41291cf934e276 | Python | 11,594 | 310 | import struct
import six
import glob
import random
import tensorflow as tf
from pathlib import Path
import os
import collections
import re
# 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 = ' <EI/> '
# T... |
d54beb33218c2be6f68b078b2c1de94911f6e34c6088fa431c68e36485cb664a | Python | 11,595 | 275 | """Persisted paths for the skill library.
A newcomer cannot fill in an `mcp add -e` block: the paths do not exist yet, and
the skill that creates them runs later. So paths are recorded at runtime instead
of at registration, in a file both this server and the skills' `env.sh` read.
Resolution order for every key, high... |
91998d58cc561fdd2690a43033371afde75cb94ad2894ece0e408fe9c9f8981a | Python | 11,600 | 319 | # 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... |
a854e12d14f0e891de7bf2b6b24101bac513aed9524dc72c882b4ccd13d46188 | Python | 11,603 | 307 | import torch
import torch.nn as nn
from torch.nn import functional as F
class LogCoshLoss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, true, pred):
loss = true - pred
return torch.mean(torch.log(torch.cosh(loss + 1e-12)))
class SoftmaxLoss(torch.nn.Modul... |
cb892c9d86e9f06c997cfc40b0732061a9f136d1b6c155a80942c31323bebd6e | Python | 11,603 | 316 | #!/usr/bin/env python3
"""
File: plot_cell_fraction_zscore_cutoff.py
Created: 2022/01/26
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fr... |
627d6e13abd151f1ab06f6930248248f7a1a70ea833b2ae94441398eadb07644 | Python | 11,607 | 334 | """
Executable wrapper script.
Initializes genetic algorithm and defines the fitness function.
"""
import sys
import os
import subprocess
if not sys.version_info[0] == 3:
sys.exit("Script requires Python 3.")
import core.settings as CoreSettings
import core.simulation as Sim
import core.syst... |
8e50b4bd8f4c01f33dbda007e2c810688a557164a2e189430e8fa7c8722c2e8d | Python | 11,619 | 328 | # 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... |
7b6c17ff4e7b59f034774d96789ff9d868ef8d33d85cf5a61ee13ff332ff31be | Python | 11,627 | 218 | import glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import datetime
from scipy.stats import zscore
from scipy.stats import spearmanr, mannwhitneyu, linregress, wilcoxon
from iEEG_STC import utils
import os
colors = sns.color_palette("tab10")
sns.set_style("whitegri... |
ceaa0d5ce6d6ca64b80c73664643a6735a6125451d23d352570a974516f0bca7 | Python | 11,635 | 285 | #!/usr/bin/env python3
"""Summarise, compare and re-measure ScenarioRunner results.
analyze_results.py summary <dir|file...> criteria pass/fail per scenario
analyze_results.py compare <dirA> <dirB> criterion-level diff
analyze_results.py metrics --list bundled example m... |
cfe8ef7a5c6406b4e99314dc9186193da91f9d2f881d8590c96841af2fc5ac15 | Python | 11,635 | 385 | # -*- coding: utf-8 -*-
import skimage, numpy
import imageio
import scipy.ndimage.filters as filters
import collections
import skimage.morphology
import skimage.filters
import re
import io
import unetsl.data
DEFAULT_CUTOFFS = ( 0.5, 0.8, 0.95)
point_kernel = numpy.array(
[
... |
594bdc9c06bf00ebcdce3946431b02eaea5ec495523bddd93b3f92380b99ec89 | Python | 11,638 | 301 | """
HMM: Plotting MEG Networks
==========================
In this tutorial we will plot networks from an HMM trained on source reconstructed MEG data. This tutorial covers:
1. Load multitaper spectra
2. PSDs
3. Power maps
4. Coherence networks
5. Coherence maps
6. Coherence vs Power
"""
#%%
# Download post-hoc spect... |
c915ec8cbf5f5f7168922291620a56429ae60d18f678f47e2ab27ff606c822f5 | Python | 11,651 | 314 | """Validated training orchestration and legacy-model result adaptation."""
from dataclasses import dataclass
from contextlib import contextmanager
import math
import os
import sys
import threading
import typing as tp
import torch
from backend import jobs
from base.backend import GLOBALS
from base.backend import pubs... |
d5ff69f4a622a398c99cf5c99658732145bc92b78c717350104790653f8e254c | Python | 11,652 | 415 | from functools import partial
from typing import List
import numpy as np
from drugex.training.scorers.interfaces import ScoreModifier
class Chained(ScoreModifier):
"""
Calls several modifiers one after the other, for instance:
score = modifier3(modifier2(modifier1(raw_score)))
"""
def __ini... |
4f9a30bd56da90ca04e3850d3251994dacb0081ecfaa38ad8b827a476c3e6c2e | Python | 11,655 | 405 | '''
ANN model trained on the T5 embeddings
'''
# libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import math
import pickle
import tensorflow as tf
from keras.layers import Dense, Dropout, BatchNormalization, Conv1D, Flatten, Input, GaussianNoise, LeakyReLU, Add
from tensorflow.kera... |
f9ca1fd66be10f5fb0f10e0cda1b7c8b70d3afd48043d984eff341275eb2ffb9 | Python | 11,663 | 331 | import logging
from functools import partial
from itertools import cycle
from typing import Iterable, List, Tuple, Union
import anndata
import numpy as np
import torch
from torch import nn
from scvi import _CONSTANTS
from scvi.core._log_likelihood import compute_elbo
from scvi.core.data_loaders import ScviDataLoader
... |
a0f004b07628120f9abc7b0a435d61711e73a5814b195ec67bb25f2fb5e8a64b | Python | 11,666 | 279 | import logging
from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, Iterator, List, Tuple, Union
from urllib.parse import quote
import requests
from oaklib.datamodels.text_annotator import TextAnnotation, TextAnnotationConfiguration
from oaklib.interfaces.basic_ontology_interface import PRE... |
03c4d9204d294f472b8c5b82186a170fe3e85a969b34001a9a0b60290a0b5b04 | Python | 11,668 | 288 | #!/usr/bin/env python3
"""
File: visualise_cell_type_fractions.py
Created: 2020/11/24
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... |
e337d44049ebc5bacbbb6304cb9d09db1b2adda6554437201db2a25837e5bd7c | Python | 11,672 | 440 | # %% [markdown]
# ##
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from src.data import load_metagraph
from src.hierarchy import signal_flow
from src.visualization import adjplot, CLASS_COLOR_DICT
from src.... |
5713364d83041c13bdacdbc04c3bfe1ccc689fbdc8b180ad51110a524fcccc97 | Python | 11,675 | 288 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
658f0b3310d1ab6a3978eec630de0944648764452bd0f3f0ac7286d0e0ca3aea | Python | 11,679 | 289 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
65241585d52dac5128efe1589581d3c42594f39c9317a1175ff890e89d9dfddf | Python | 11,682 | 295 | """
File: deconvolution_zscore_comparison.py
Created: 2020/04/07
Last Changed: 2020/06/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 as published by
the Free Software Fou... |
7e013b99561ec7c7d41e6adda2822723b5563592200287e3283d98a01b760acf | Python | 11,683 | 259 | # -*- coding: utf-8 -*-
# Auxiliary functions to plot data.
# COPYRIGHT: TU Delft, Netherlands. 2021.
# LICENSE: GNU AGPL-3.0
import h5py
import math
import time
import numpy as np
import matplotlib.pyplot as plt
from pymedphys import gamma
def plot_beam(inputs, ground_truth, outputs, gamma_evaluation=False, slices=1... |
1636a9bb3f730a51fe77827f2d1275bcb9d6390915477a095a36825ff3d82e16 | Python | 11,686 | 331 | import os
from os.path import join
import pandas as pd
import numpy as np
from tqdm import tqdm
from joblib import dump, load
def get_vae_lstm_loss(lstm_dataset, vae_model, lstm_model):
reconst_loss = np.zeros(len(lstm_dataset))
for i in tqdm(range(len(lstm_dataset))):
data = lstm_dataset[i]
v... |
79aa895b49e8fb6e9e5575b24b957bc049a1a07354fb434ad7b0ec4effc02477 | Python | 11,688 | 234 | # 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... |
e7bed6b0034abacb1f81bb9382a54052cdfae586fbfc11ab5644dbc522eea3dd | Python | 11,690 | 307 | import numpy as np
from abc import ABC, abstractmethod
from drugex.logs import logger
from drugex.training.interfaces import RewardScheme
from drugex.utils.fingerprints import get_fingerprint
from drugex.utils import get_Pareto_fronts
from rdkit import Chem, DataStructs
class ParetoRewardScheme(RewardScheme, ABC):
... |
815b2777ffacf2db0e90585acdc30fd5c22d5d8a2a5b49984efd8d92c72d1719 | Python | 11,691 | 321 | import os
import threading
import io
import json
import zipfile
import PIL.Image
from backend.app import App
class FakeSettings:
active_models = {'detection': 'fake-detection', 'tracking': 'fake-tracking'}
models = {}
use_gpu = False
exmask_enabled = False
too_many_roots = 100000
def get_se... |
c34267d4b2b0357df411aecf2184eebd8456f831e40f9fecd4dfcfe46946e5eb | Python | 11,699 | 215 | # 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... |
e922e551f9d05973f0e7950eb4aaaa4c01bd3fd8a4345f5fcbb44c6cdca09b9a | Python | 11,703 | 300 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import k_hop_subgraph
device = "cuda" if torch.cuda.is_available() else "cpu"
class _BaseExplainer:
"""
Base Class for Ex... |
284ceb624fd9592f02640c0db34b4ffc44af58fb8e05013b3cd2892d703ac98b | Python | 11,705 | 252 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import connectome_tools.process_matrix as promat
import pymaid
from pymaid_creds import url, name, password, token
rm = pymaid.CatmaidInstance(url, token, name, password)
# allows text to be editable in Illustrator
plt.r... |
480abf2e0e9137c9e713e337e572a0453f64328fa8f2d30c68dd0145f97b00cb | Python | 11,712 | 265 | # 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 a... |
5546b1e7109eda14da95fefec09e5cd36975418a17b9283ab2f049468f7a15b3 | Python | 11,721 | 183 | from skopt.space import Real
#import sys
#sys.path.append('../src/artemis/')
from artemis.experiments.ui import browse_experiments
#from spiking_eqprop.demo_mnist_eqprop import experiment_mnist_eqprop_torch, settings, X_1hid, \
from demo_mnist_eqprop import experiment_mnist_eqprop_torch, settings, X_1hid, \
X_3hid... |
975cd488be03aa7d1b931f708f91fcff969f501ccc1569f07be317c20e8a2090 | Python | 11,728 | 288 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
e95f88ea5eb3408c7e34d9f9ab3aeaecba2d780de9ed70088f9330921b332db6 | Python | 11,733 | 288 | # -*- 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 features_extraction
from torch import LongTensor, FloatTensor
import torch
import pickle
import neural_network_architecture
def testing_ne... |
1f97dd480447b7030788b59f5903701beb03e0c8d154007690d1f33e6debb8c8 | Python | 11,738 | 284 | # 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>.
# Provides map data for users.
import glob
import os
import sys
try:
sys.path.append(glob.glob(... |
2e650c617b6c137574de6ae6c7019c1a299d1de5ed2018fb7dcf38cd66303197 | Python | 11,741 | 258 | #%%
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 math
import matplotlib.pyplot as plt
impo... |
88286fc73c3f58dedd3a0ec96a1504a5c6b38969d04e13cab0c0f2ad33b8c6fd | Python | 11,743 | 308 | #!/usr/bin/env python3
"""
File: plot_decon_eqtl_pvalues.py
Created: 2022/02/15
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 Softwar... |
c9d7f2e18f85a3f0a179ed21facc38a950f21934e0f3fc1676513f957f417044 | Python | 11,745 | 401 | #%%
import datetime
import os
import time
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.plot import crosstabplot, dissimilarity_clustermap, merge_axes
from giskard.utils import get_paired_inds
from graspologic.align import OrthogonalP... |
52a10e7281a464b78a010b4427f2c905f790ccf4d06f272d12430aeef2b6a8df | Python | 11,751 | 247 | #!/usr/bin/env python3
import os
import sys
import errno
import argparse
import re
def parse_args(args=None):
Description = "Reformat nf-core/chipseq samplesheet file and check its contents."
Epilog = "Example usage: python check_samplesheet.py <FILE_IN> <FILE_OUT>"
parser = argparse.ArgumentParser(desc... |
3b1ef471431034c6f4a16ea3c22a6deebdcb990d049e834ff5ec7dd28531ca8d | Python | 11,752 | 328 | import pandas as pd
import numpy as np
import warnings
from typing import Optional
from rl_analysis.util import count_transitions
def get_syllable_and_scalar_rates(
values: pd.DataFrame,
dlight_features: list[str] = [
"signal_reref_dff_norm_rising_range",
"signal_reref_dff_norm_rising_slope",
... |
f595b83c6fec42438db8d6d9a8f6a0f5c2acea2998fde41d87e3bdecc1959727 | Python | 11,770 | 449 | import os
from typing import Optional, Tuple
import numpy as np
from ..base import DatabaseBase, ALL, load_fids, load_mat, drive_mounted
fids = load_fids(os.path.join(os.path.dirname(__file__), 'fids.json'))
########################################################################
class GIGA_BCI(DatabaseBase):
... |
c1632cf9edf29c2c8725d4568cc06775d2d61a2e203cdd3574e469e63d4879a5 | Python | 11,771 | 235 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
from data_settings import data_date, pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
from contools import Celltype, Celltype_Analyzer, P... |
c15fc301c888f831475b1db5f774d2fcd2d23757f9be989964d92b215b9cd3f0 | Python | 11,773 | 284 |
from __future__ import absolute_import
import sys
import numpy as np
import torch
from torch import nn
import os
from collections import OrderedDict
from torch.autograd import Variable
import itertools
from .base_model import BaseModel
from scipy.ndimage import zoom
import fractions
import functools
import skimage.tr... |
261b7176a83c83b38ca3cea7c3dfad3fa10996656a7042e4d325b5430a0a54b8 | Python | 11,775 | 300 | # 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... |
c2cab7755bf468b43bf43879772156a782492cff5eb27f0e7db6423358019868 | Python | 11,777 | 283 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 27 16:37:21 2021
@author: Hiroshi Yokoyama
"""
from IPython import get_ipython
from copy import deepcopy, copy
get_ipython().magic('reset -sf')
#get_ipython().magic('cls')
import os
current_path = os.path.dirname(__file__)
os.chdir(current_path)
... |
9e05b3fcdcc78913a9ebd11869d5991c63585a13055893cf3625b1baa22c1c0f | Python | 11,782 | 305 | import logging
from collections import defaultdict
from copy import deepcopy
from typing import Dict, Iterable, Iterator, List, Optional, Tuple, Union
from sssom_schema import Mapping, MappingCardinalityEnum
import oaklib.datamodels.obograph as og
from oaklib import get_adapter
from oaklib.datamodels.cross_ontology_d... |
ba92a929f7af50ab318c62db31b41b8380d8d184c4b75635c243f8a48aa78405 | Python | 11,784 | 281 | import torch
import torch.nn as nn
import math
import numpy as np
class YOLOLoss(nn.Module):
def __init__(self, anchors, num_classes, input_shape, cuda, anchors_mask = [[6,7,8], [3,4,5], [0,1,2]], label_smoothing = 0):
super(YOLOLoss, self).__init__()
self.anchors = anchors
self.num... |
e6d20b34aacd64a838bd9e799d0ab6cdb9308e68d0927f9e8565775ee32ac518 | Python | 11,789 | 256 | # 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... |
4df2ff7facf9667e939b0fddf9fb87f5a7096463d44fd5c94162ee963abafb59 | Python | 11,794 | 336 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module containing useful functions for processing stacks of images.
Created on Mon Nov 12 09:28:07 2018
@author: nicolas
"""
import warnings
import numpy as np
from skimage import filters, measure
from skimage import morphology as morph
from skimage.morphology import... |
0c17bf514eeee166b97aaa6ac055f54256f19422ce0a37e2f55c20cd60c2996b | Python | 11,795 | 379 | # 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... |
a8c3211966319406c6366422ef5d325a2f455245bef8082558763782155662d0 | Python | 11,798 | 241 | # This file is part of me-features-to-mol-ID-mapping.
#
#
# Copyright © 2021-2022 Blue Brain Project/EPFL
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the APACHE-2 License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANT... |
8e99bcaf27f11ddc8ae4363fecac3e99aee489ccdd248f78cbae1df287f13356 | Python | 11,800 | 327 | """
Refer to https://github.com/rosinality/stylegan2-pytorch/blob/master/inception.py
Refer to https://github.com/mseitzer/pytorch-fid/blob/master/src/pytorch_fid/inception.py
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
try:
from torchvision.models... |
289ba8f57a46a3a9f49e254879a818925e63a8521bb101cb11e2906d86acd009 | Python | 11,805 | 267 | # 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... |
209e5a9c24809e9cb4ec46b3339cdd4e71de403e9ed844683ef5f5eb1ccad051 | Python | 11,815 | 399 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config im... |
0c35faed1ebb07dffdd4dc1c48d9bd6b56eee5eaab9030b04aa4eb3f89f187ba | Python | 11,816 | 385 | '''History for wx GUIs'''
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from logging import getLogger
import os
import wx
from .help import show_help_txt
from .frame import EelbrainFrame
from .utils import Icon
from . import ID
TEST_MODE = False
class CallBackManager:
def __init__(self, keys):
... |
9a307f2657f99e0b43bc39189409d58e00fdf3db18083f182c618f2ded319164 | Python | 11,818 | 290 | import torch
import ipdb
from torch_geometric.utils import k_hop_subgraph
from torch_geometric.data import Data
from graphxai.explainers._base import _BaseExplainer
from graphxai.utils import Explanation, node_mask_from_edge_mask
device = "cuda" if torch.cuda.is_available() else "cpu"
EPS = 1e-15
class GNNExplain... |
ca206e10299cda73ed3fb409f92770054916278cd592b933b9ea02f3ed6085a6 | Python | 11,822 | 359 | from __future__ import print_function, division
import csv
import functools
import json
import os
import random
import ase
from ase.io import read, write
import warnings
import numpy as np
from pymatgen.core.structure import Structure
import glob
from ase.io import read, write
from ase import Atoms,Atom
from pymatgen... |
65c2bb36639fbd777291571cdb958d9aca99a1a91254ae2375b57ac082675816 | Python | 11,825 | 413 | #!/usr/bin/python
#
# Recognizes status dictation or free dictation speech files (select using the
# -l option.
#
# Arguments:
# model-directory
# speech-directory
# output-file
# -a acoustic-model [basename]
# -l language-model [status | free]
# -s language-model-scale
#
# Example:
# rec_hammaspuhe.py /s... |
9877d0df0dfe43ec04c1b0e660e1f54db5553cf87884d5a1e15e815a8f2e6282 | Python | 11,827 | 367 | import copy
import os
import torch
import M2TR.utils.distributed as du
import M2TR.utils.logging as logging
from M2TR.utils.env import pathmgr
logger = logging.get_logger(__name__)
def make_checkpoint_dir(path_to_job):
"""
Creates the checkpoint directory (if not present already).
Args:
path_to... |
b1e8cefcd072e9866f30972be77f36e42ab36301be53bd5f0f2b0c34fddaebf2 | Python | 11,828 | 232 | import os
import shutil
import slideflow as sf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcol
import shapely.geometry as sg
from slideflow.util import log
from slideflow.util.fastim import FastImshow
from matplotlib.widgets import Slider
class HeatmapError(Exception):
pass
cl... |
7f9856ac4502fd62e91cb30fa5943ce9b38fdb3147eacc442835250884b0ecf1 | Python | 11,832 | 287 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.