sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d783d07494d94ba8091cd6a2bfce4371190509c738c17e19fd7f170eea697292 | Python | 11,844 | 443 | # %% [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.... |
975929189cb3962b5742e8fae10d77e837f4681ad00c3f05fcce15aba176410d | Python | 11,857 | 235 | # 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... |
46c6201602b4425fa50df718e343231d9a16d1501e0388f938c4cd863fad0768 | Python | 11,862 | 303 | import flask
import requests
import ast
import logging
from flask import request
from flask_restx import Resource
from bds_api.restplus import api
from bds_api.endpoints.search_config import search_config, autocomplete_config
from bds_api.exception.api_exception import BDSApiException
from bds_api.endpoints.parser impo... |
81baa7dfd2eb0139d24cb6a9d4335d6aeaf4dcd61a59904e7d3df5745671e3a4 | Python | 11,865 | 339 | """
Fucntions for visualization
- Line styles: for better plots
- Create a figure
- Plot nodes (oscillators, possibly with phases), edges, nodes numbers
- phase_plot: plot a function of phi1,phi2, e.g. friction function
- Stability plots
"""
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import m... |
e4ccad1fe2a504e06536dd2a28e92a8bed5b2384f1bbf7c4e430c995e1002b62 | Python | 11,865 | 290 | """
DIR=$(ls -d /home/satsingh/plume/plumezoo/latest/fly/memory/*VRNN*/ | head -n 1)
echo $DIR
python -u postEvalCli.py --model_dir $DIR --viz_episodes 2
# Batch
MODELDIRS=$(ls -d /home/satsingh/plume/plumezoo/latest/fly/memory/*VRNN*seed3199993/)
MODELDIRS=$(ls -d /home/satsingh/plume/plumezoo/latest/fly/memory/*VR... |
83accda5893b0bfebca59c78a60f8972510fcbc7e753b5c94da0d556391700f4 | Python | 11,866 | 347 | from collections import OrderedDict
import os
import torch
import torch.nn as nn
from torch.utils.checkpoint import checkpoint, checkpoint_sequential
from src.attention_module import TransformerBlock
from src.enformer_utils import (
Residual,
SoftmaxPooling1d,
TargetLengthCrop1d,
exponential_linspace_... |
849af8a0de9e2cf26d6b59f59a60d9cdb0fe757e7ff534901b6daf4bb558facb | Python | 11,869 | 293 | #!/usr/bin/env python3
"""
File: plot_cell_fraction_per_cohort.py
Created: 2021/02/06
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 ... |
f87cd96e5615e45fe1bde0550d2522bc333e37527a4f9aaad9cbcfe3331edd0b | Python | 11,883 | 387 | """
Training OTNO on a Car CFD Dataset
==========================================
We load a pre-generated optimal transport (OT) dataset from car CFD data and train an OTNO model on it.
This tutorial demonstrates how to:
1. Load and preprocess optimal transport data for car CFD simulations
2. Create and configure an... |
62b1c4b6637b031d37b225c9b0b01ebbe957616b96a3f732e0650ac753a1130e | Python | 11,888 | 474 | # %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import time
import warnings
from itertools import chain
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... |
25db765ba181154703272491c3e8277aa5bb97fe4875dcd0330e033f165f857d | Python | 11,889 | 312 | # Copyright 2021 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... |
2e8641d0dd997ce64ff3b7bd7418091b4d293d8499bc57f647fed66662579691 | Python | 11,890 | 323 | import random, itertools, tqdm
import numpy as np
import networkx as nx
from functools import partial
from typing import Optional, Callable, Union
from .shapes import house
from graphxai.utils import khop_subgraph_nx
import matplotlib.pyplot as plt
from graphxai.gnn_models.node_classification.testing import *
def inc... |
2ca39415145d27c397580de36ab446e1733141f7c4244eb994163579992181d7 | Python | 11,893 | 347 | ####################################################################################################
# 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 ... |
10733bb8e54d463781ef59e282cf9a67714416734897403e9a4448f3e9173b43 | Python | 11,902 | 326 | #!/usr/bin/env python3
# mv2results.py
# original script by Dennis Kao at https://github.com/dennis-kao/SampleProcessingScripts/blob/master/mv2results.py
# Description: Moves sample files produced from cre/crg/crt-bcbio pipeline to HPF storage
# Usage: mv2results.py -src=/path/to/bcbio/proj/1475N
# Args:
# src - dir... |
5cb991e5685c70e56b18ccab3498d8341b093b0da9adc7c33664d682320355c8 | Python | 11,903 | 310 | import os
import shutil
import os.path as path
from collections import OrderedDict as odict
from PIL import Image, ImageTk
import random
import numpy as np
import tkinter as t
import tkinter.filedialog as fd
att_dict = {'5_o_Clock_Shadow': 0, 'Arched_Eyebrows': 1, 'Attractive': 2,
'Bags_Under_Eyes': ... |
b433b14ac7422f2c0135b60424080255319052b50beb850ca528c02aabb4578c | Python | 11,906 | 327 | import pandas as pd
import torch
from torch import nn
from torch import optim
from tqdm.auto import tqdm
from drugex import DEFAULT_DEVICE, DEFAULT_GPUS
from drugex.training.generators.interfaces import Generator
class SequenceRNN(Generator):
"""
Sequence RNN model for molecule generation.
"""
def _... |
239a86f70612f5fce90427b6ca1299607b190abe4c35e2bd1f75c82818de753f | Python | 11,911 | 330 | """
Adapter for NCATS Biomedical Translator endpoints (experimental).
Provides wrappers for
- Node Normalization
- Name Resolution
Examples:
Name resolution:
.. code-block:: bash
runoak -i translator: info "citrate"
CHEBI:16947 ! citrate(3-)
CHEBI:31602 ! FENTANYL CITRATE
CHEBI... |
ac9bade2ab21109c1df187c901c38d11790ab3f97c77d73fa28247389b3181ba | Python | 11,911 | 319 | # 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... |
ac3fb638bbed33532c0066d4e69823e1999788bf732d92f495b07ca25796da95 | Python | 11,917 | 378 | """Tests the Assigner objects.
CommandLine:
pytest tests/test_assigner.py
xdoctest tests/test_assigner.py zero
"""
import torch
from mmdet.core.bbox.assigners import (ApproxMaxIoUAssigner,
CenterRegionAssigner, MaxIoUAssigner,
Point... |
bf92c7fb0bf6c102a1c50d1c9cf94fe84ca647c588dfda04fa1c80e956787020 | Python | 11,921 | 247 | import pandas as pd
import datetime
from scipy import sparse
import scipy.io
from scipy.stats import zscore, wilcoxon, spearmanr
from sklearn.preprocessing import binarize, normalize
from sklearn import metrics
from itertools import cycle
from sklearn.metrics import roc_auc_score
import os
import pickle
import seaborn ... |
7924ed9fec735badf14cb05673631181a86db76dba7890625c3907296501c2c1 | Python | 11,923 | 452 | """
Plotting tools for publication graphics using matplotlib / seaborn
ecosystem and metric units (centimeters)
TO DO
- ADD plotting of cortical temperature distributions for control and cooled
Created:
2021-07-21: Stephen Town
"""
from collections.abc import Iterable
import colorsys
import os, sys
import ... |
9b5b4a947ab37e37be7026cf9b7ce0bea6497349d1eb1335e6e148fe447f050c | Python | 11,925 | 284 | #!/usr/bin/env python3
"""Regenerate the static demo.
The demo is a copy of the platform's own frontend serving one frozen competition. This
script produces the two generated pieces:
* js/demo-data.js — the canned replies the demo shim serves in place of the Flask
endpoints, including the competition's leaderbo... |
edf458ae36a2807fd987cb0f3d28c8167f3973e3654923ebdc4c6522497a139a | Python | 11,926 | 343 | import torch
import torch.nn as nn
import pickle
class Shufflenet(nn.Module):
def __init__(self, inp, oup, mid_channels, *, ksize, stride):
super(Shufflenet, self).__init__()
self.stride = stride
assert stride in [1, 2]
assert ksize in [3, 5, 7]
self.base_mid_channel = mi... |
f864f0ef8c4d9a66081644acc1d51dab37da47c0f08986a8ee3a7f7427aeaf9d | Python | 11,932 | 288 | import tqdm
import ipdb
import argparse, sys; sys.path.append('/home/owq978/GraphXAI/formal')
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.performance.load_... |
0d25bd78eeca190bcedfdd78876a2aed357f36973fb6103c5ccb385829f1a59c | Python | 11,935 | 296 | # motifAnalysis.py
# 12/30/14
# Motif_analysis.ipynb, in script form
import sys, os, re, cmath, math, glob, subprocess, csv, matplotlib, argparse
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import pandas as pd
plt.style.use('ggplot')
matplotlib.rcParams['sa... |
06657135c57c16ebbe5f12bbdac935b5d1c150d8d038bfcaaa6f42968e7735be | Python | 11,940 | 266 | #!/usr/bin/env python3
"""
@ Lina Teichmann
INPUTS:
call from command line with following inputs:
-bids_dir
OUTPUTS:
Plots for head motion data.
If it doesn't exist, the script makes a figures folder in the BIDS derivatives folder
NOTES:
This script is using the pyctf too... |
d9b8b7bd15a4ddf951cdd402ca7a7cee3f89d4890087d137bd26272220249709 | Python | 11,943 | 260 | #!/usr/bin/env python3
"""
File: print_mr_and_decon_table.py
Created: 2021/02/16
Last Changed: 2022/02/24
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 ... |
9a84cf5f497c07950ee9b1491d6f0e7fc6f87199980a6c33a90f331cc64c0ff3 | Python | 11,946 | 305 | import argparse
import os
import time
from collections import OrderedDict
from copy import deepcopy
import medmnist
import numpy as np
import PIL
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import torchvision.transforms as transforms
from medmnist import... |
b376a22241988d86022b7804a48b5e61285e3d6bf06fb5e5fe246d8c9133a6a9 | Python | 11,948 | 255 | import argparse
import gzip
parser = argparse.ArgumentParser(description='Compare eQTLgen to MetaBrain')
parser.add_argument('eQTL_file',
help='File with eQTL data')
parser.add_argument('gwas_file',
help='File with gwas data')
parser.add_argument('gwas_annotation_file',
... |
9320cf502f84bc30e680c400c05f9d5f26d980e04cadd18aa532e6399bda9865 | Python | 11,951 | 235 | # 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... |
3144aacc3f0f12f28113354056ded409a3a9094a71d8802a14e1e4a5e7e6731e | Python | 11,955 | 319 | # 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... |
a705f4898bdd0d95b854f4ee112b86f9b327c0c64ca51f099c645a92b45348b7 | Python | 11,968 | 332 | # This script is part of pymaid (http://www.github.com/schlegelp/navis).
# but has been adapted from vispy (http://www.vispy.org)
import collections
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from vispy.visuals import MeshVisual
from vispy.color import ColorArray... |
ea2fe5aaa92f0ded1187f3734dd1a6b937fc593d961b7c1de71b4466b6ea6d78 | Python | 11,983 | 291 | from curses import A_CHARTEXT
import os
import re
import time
from matplotlib.pyplot import delaxes
import numpy as np
import pickle
import glob
import random
import matplotlib.pyplot as plt
from spatial_test import load_data
# audio
import librosa
import librosa.display
import sklearn
import torch
fr... |
1f408679a876bcc143fc37f60a4251a13a7c7fcc81765b04bdcd03dc113e0c46 | Python | 11,984 | 272 | ## Import packages required to run program
from PyQt5 import QtWidgets, QtCore
from buildv3 import Ui_MainWindow
import sys
import nidaqmx
import numpy as np
from nidaqmx.constants import TerminalConfiguration
from nidaqmx.constants import VoltageUnits
from time import sleep
from matplotlib.widgets import SpanSelecto... |
b840c04f0cebd894111d5b0e5cd1e914a9ecec8f488e789867bda6efd732a683 | Python | 11,988 | 287 | # SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: MIT
"""
Utility Functions Module
This module provides utility functions for coordinate transformations and conversions
between different representation formats used in NUREC and CARLA integration.
Key ... |
d02a5d23fc1fb574e950d864e3f45851720f0a4ff5e7b1afb9b6c8d7df1982b8 | Python | 11,993 | 330 | # 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... |
f96c3df7dedaf45a9c19b032e953e4094b666ff08b36ce76efada17af45e358a | Python | 11,993 | 291 | # Copyright 2022-2023 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
fb55dc12443fd622a2aed4dfeb20b9cd9b68c241b0dc494cec6588b56fd4dfe4 | Python | 11,994 | 288 | import unittest
import json
from flask import Flask, Blueprint
from bds_api.restplus import api
from bds_api.app import app
from bds_api.endpoints.search_service import ns as api_namespace
from bds_api.endpoints.search_config import search_config
app = Flask(__name__)
# config should be same with app.py
blueprint = B... |
991a69cb3caeedaf1aaf79bf54acac1c34831c9d435b1bdfc99b4d8f93df4a3d | Python | 11,995 | 237 | # 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... |
9b0cc4162bb03c40b0c956c89806c9db56325254d30f99c9c74a2442a570152a | Python | 11,995 | 263 | """Live check of the path-traced distance AOV (sensor.camera.rt_lens_distance).
The sensor renders through the same lens as sensor.camera.rt_lens but outputs, per pixel, the
Euclidean distance from the camera origin to the primary hit along that pixel's lens ray -- a
real path-tracer AOV (FPostProcessSettings::PathTra... |
cf10a8fb65f102828a3452d09ae0da22c8e1ca6a503d8bc759add295c5ad5781 | Python | 11,996 | 442 | import numpy as np
from tqdm import tqdm
from numpy import exp
from scipy.optimize import fsolve
def vtrap(x,y):
return np.where(np.abs(x/y)<1e-6, y*(1-x/y/2), x/(exp(x/y)-1))
class OLM_Single:
"""Single Compartment OLM Cell Model
Derived from reduced single compartment OLM model written in NEURON"""
... |
15066e98b4e10b88f72c697fbd8c53f72397ee74a849356b9a627fac30e2f5ca | Python | 11,998 | 352 | import os
import re
import functools
import fnmatch
import numpy as np
#from keras import utils as kutil
def find_recursive(root_dir, ext='.jpg'):
files = []
for root, dirnames, filenames in os.walk(root_dir):
for filename in fnmatch.filter(filenames, '*' + ext):
files.append(os.path.join(r... |
74682e41367403a6bd447cc62bd37ca37227319c5bc77047988be6682b58e7c3 | Python | 12,005 | 275 | # 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... |
a17488632b9b81a4c231fff020561dfcc892f853a3b54265acf725124b0f20d6 | Python | 12,006 | 287 | import torch
from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
from ..builder import HEADS, build_head, build_roi_extractor
from .base_roi_head import BaseRoIHead
from .test_mixins import BBoxTestMixin, MaskTestMixin
@HEADS.register_module()
class StandardRoIHead(BaseRoIHead, BBoxTestMixin,... |
a99369cdbe6c699c7221f448141ef3ea88acab1ac9b7ec9f948397ea3ce5c37a | Python | 12,015 | 325 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy import optimize
import pandas as pd
from scipy.stats import binom, poisson
def cdf(x, func, max, step, *fargs):
"""calculate cdf for function. extra arguments (after x) for func in should be given in fargs
func is the abitra... |
0564f1d6d2de46ea0b8fd98c16faadda44c6ffacf0197288f130a2364b1dfe46 | Python | 12,019 | 360 | import argparse
import math
import os
import os.path as op
import sys
from glob import glob
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
import pandas as pd
import seaborn as sns
from ddmra import analysis, plot_analysis, run_analyses, utils
from scipy.stats import ks_2samp, normaltest
from... |
b7d807c30b6064fa5509ba243bcac4f657a4f03ca47409a4dbdfd023285ff4a9 | Python | 12,019 | 309 | import argparse
import os
import time
from collections import OrderedDict
from copy import deepcopy
import medmnist
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import torchvision.transforms as transforms
from acsconv.converters import A... |
85a045e500a495ae82977d2ed6deacaaf88e43e60db215c048264907a3316ead | Python | 12,028 | 289 | import itertools
import logging
import unittest
from unittest import mock
from linkml_runtime.dumpers import yaml_dumper
from oaklib.implementations.ontoportal.bioportal_implementation import (
BioPortalImplementation,
)
from oaklib.utilities.apikey_manager import get_apikey_value
from tests import CELLULAR_COMPO... |
f6e402f3a0aa76e7caafbb30e11facebaa80ac93f9260de2f17639d08f0deddc | Python | 12,028 | 296 | # cython: language_level=3
# Time-stamp: <2025-07-24 15:46:59 Tao Liu>
"""Module description:
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
# ------------------------------------
# python modules
# ---... |
4be83aac269a0f47d22d0e38e28a02c0409ef05897e7f3f384be43f55095d3b6 | Python | 12,033 | 364 | from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from ..builder import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tensor`.
Supported types are: :class:`numpy.ndarray`, :class:`torch.T... |
42846090f6cd02f35f781b4882168b71dcaf816eda4d80a5429b7ac6172b85be | Python | 12,049 | 282 | """
====================
How pyAFQ uses BIDS
====================
The pyAFQ API relies heavily on the
`Brain Imaging Data Standard (BIDS) <https://bids-specification.readthedocs.io/en/stable/>`_,
a widely used standard for organizing and describing neuroimaging data. This
means that the software assumes that its input... |
7eccbbf66083a4b87ba8b07aae4857408133e7414f3ace58ecbe200254a06229 | Python | 12,051 | 325 | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future... |
27d751c5fc409d7a41f3328533017c3ba22a1b7c4653b189a8a316ea94f71d1d | Python | 12,052 | 432 | from pathlib import Path
from typing import Any
import numpy as np
import pytest
from ppqm import chembridge, constants, gamess, tasks
from ppqm.gamess import COLUMN_THERMO, GAMESS_CMD, GamessCalculator
from ppqm.utils.shell import which
if which(GAMESS_CMD) is None:
pytest.skip("Could not find GAMESS executable... |
912ec5659364d0ad06bfe558e4c3e541f01a24c0e5907341a84d2728b02a8bdf | Python | 12,054 | 308 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_upsample_layer
from mmcv.ops import Conv2d
from mmcv.ops.carafe import CARAFEPack
from torch.nn.modules.utils import _pair
from mmdet.core import auto_fp16, force_fp32, mask_target
from mmdet.mo... |
1953f3c382c820c743f6b9ad085d08512077b79ee5dec5a3b1765cebfd2960fc | Python | 12,057 | 275 | # 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... |
3e5d544ca29a02ecef26dcdbec9258520409e105284191377d89ff93c0bd7f76 | Python | 12,062 | 286 | import warnings
import numpy as np
import pandas as pd
from skimage.restoration import denoise_wavelet
def apply_rolling_window(mainchunk: np.array, meterchunk: np.array, window_size: int):
if not window_size:
raise Warning('Window size is not defined.')
indexer = np.arange(window_size)[None, :] + np... |
ff4b305add540935fb4e7e385511dd25f0d0e0180256cc3c8f82ddfcc4652557 | Python | 12,067 | 303 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.autograd.function import once_differentiable
from mas... |
5cacafad809fe77d2618da899bd6eced3c375936467d7905e907f00f32a10e14 | Python | 12,068 | 258 | # basic imports
import numpy as np
# framework imports
from cobel.memory_modules.memory_utils.metrics import DR
class SFMAMemory():
def __init__(self, interface_OAI, number_of_actions: int, gamma: float = 0.99, decay_inhibition: float = 0.9, decay_strength: float = 1., learning_rate: float = 0.9):
... |
2ca8e80a213f956cf76da6733f16eb2a8287310d27bd802ebef7458c6467435a | Python | 12,069 | 299 | ####################################################################################################
# Copyright (c) 2016 - 2021, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
9f0df82c0add5a4ed78ed67901a9da3e67f87fb7fee67cbf65e54e17f1d1c558 | Python | 12,071 | 269 | #!/usr/bin/env python3
"""Load, reload, and reshape CARLA maps through the Python API, then verify.
One entry point for every map-loading operation this skill covers:
list get_available_maps
load --map Town03 load_world (settings reset to default)
load --map ... |
a61ddc1ed48dee5356155ae3c3e999c1f9e20b9f2dc6246243e34c9fde4734ea | Python | 12,074 | 264 | # SRC: https://github.com/alexandrosstergiou/keras-DepthwiseConv3D
'''
This is a modification of the SeparableConv3D code in Keras,
to perform just the Depthwise Convolution (1st step) of the
Depthwise Separable Convolution layer.
'''
from __future__ import absolute_import
from tensorflow.keras import backend as K
fr... |
22d8c8ac38b9c335fdf9ebc65372e52b9c060828acbac3194d47b05329f96616 | Python | 12,076 | 240 | import os.path
from datasets import load_file
from datasets import get_survival_y_true
from datasets.basic_dataset import BasicDataset
from util import preprocess
import numpy as np
import pandas as pd
import torch
class ABDataset(BasicDataset):
"""
A dataset class for multi-omics dataset.
For gene expres... |
53e06a8abaf76115857e340a3366f66af7b708fa02e0cd9d46af6e516aaef063 | Python | 12,076 | 322 | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from src.utils.metric import Convo
import random
SEED = 42
random.seed(SEED)
torch.manual_seed(SEED)
torch.backends.cudnn.deterministic = True
class Encoder(nn.Module):
def __init__(self, input_dim, hid_dim, n_layers, n_heads, pf_dim, ... |
41b1679caebce93b6ea36b013fff18a43830841bbba87814fbdc9681c2863cc9 | Python | 12,077 | 426 | # %% [markdown]
# ##
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from scipy.integrate import tplquad
from scipy.stats import gaussian_kde
import pymaid
from src.data import load... |
454c460d846786ecacb718f935f5360980f38c4301ba8f606e3eedf01015fb8e | Python | 12,080 | 376 | import math
import torch
from torch import nn
import neuralop.mpu.comm as comm
from neuralop.mpu.mappings import (
gather_from_model_parallel_region,
scatter_to_model_parallel_region,
)
class MultigridPatching2D(nn.Module):
"""
MultigridPatching2D wraps a model in multi-grid domain decomposition and... |
7efb4ead477aa259bf470b691823619fe1c996a24e92fc3013d075772f0f40d9 | Python | 12,096 | 380 | """Metrics for evaluating model performance."""
import numpy as np
from scipy.linalg import eigvalsh
from sklearn.metrics import confusion_matrix as sklearn_confusion_matrix
from osl_dynamics.utils.progress import progress
def alpha_correlation(alpha_1: np.ndarray, alpha_2: np.ndarray) -> np.ndarray:
"""Calcula... |
dad313da67717d67360d936bc10f0b7f58a14126114e9124ef67fc8f1fa93dce | Python | 12,101 | 369 | """
Set of standardized tests for RACCOON
F. Comitani @2020-2022
"""
import os,sys
import traceback
import shutil
from pathlib import Path
import json
import argparse
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.datasets import make_blobs
from clustering import *
fro... |
a00775acd489e4521be9d3dbc4be181444c32141f90490edefadf88c0b0945ca | Python | 12,104 | 277 | # YOLOv5 YOLO-specific modules
import argparse
import logging
import sys
from copy import deepcopy
sys.path.append('./') # to run '$ python *.py' files in subdirectories
logger = logging.getLogger(__name__)
from models.common import *
from models.experimental import *
from utils.autoanchor import check_anchor_order... |
3cda4249636b92266050479a80dc112d3fb58c9eb5b660b8c3a562794a2d52ee | Python | 12,105 | 292 | """
OboGraph to FHIR Converter
Resources
- Updates issue: https://github.com/INCATools/ontology-access-kit/issues/369
- Conversion examples: https://drive.google.com/drive/folders/1lwGQ63_fedfWlGlRemq8OeZhZsvIXN01
"""
import logging
from dataclasses import dataclass
from typing import Any, Dict, List, Tuple, Union
i... |
903dbbabe0983878082a1767c276bdfd569385254ba8a9e944e41d7c5d37ec47 | Python | 12,105 | 349 | import torch
from torch import nn
class MaskGenerator():
def __init__(self):
pass
@classmethod
def create_content_mask(clss, x_mask_shape, x_len):
"""
Args:
x_mask_shape: tuple, (bsize, max_seqlen)
x_len: tensor, (bsize,), length of each sequence
"""
... |
a5ed293eebca5c77d603dd39e150eb58adb8a7cd9a9f069dba27c78725833fcb | Python | 12,118 | 292 | """
File: inter_eqtl_effect_deconvolution.py
Created: 2020/03/17
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... |
af7b9bbd3f80501a7f4daf7c92f7da7c1fe7cbbeb86de9c7f61e7af02a7e8f94 | Python | 12,118 | 304 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 21:42:12 2020
Calculate: accuracy, recall, precision, FPR, TPR
Accuracy = correctly classified / total
recall = true positives / (true positives + false negative) says about the sensitivity
precision = true positives / (true positives + false po... |
532d927572c50729ef1b58f5e2bbcc9037d19e2e7a89d86f4dbae3948e1695c4 | Python | 12,122 | 391 | # Copyright 2024 Chen Liang
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
6175df1f29c1e652f859f62511401d32ad731ea6d8770c3bbb6464dbe0fa506c | Python | 12,122 | 284 | from asyncio.windows_events import NULL
import os
from datetime import date
from pydicom import dcmread
from pydicom.dataset import Dataset
from pynetdicom import (AE, evt, debug_logger,
StoragePresentationContexts)
# Uncomment to see additional output from DICOM operations
#debug_logger()
#SC... |
dc8d803167c3e64cef054413446f52f918c3d06f7832bd4661adc6af712629eb | Python | 12,123 | 295 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 Abigail See
# Modifications Copyright 2018 Arman Cohan
#
# 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 Licens... |
f28ea33d61469acb03a39216500c2c097b8758a2024c37fd71d3f606c0d5cc1a | Python | 12,123 | 327 | # 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... |
187b112e9df3c74b4d759ddaf400846b3b74513b3467f0f6275873ba4e2b8a24 | Python | 12,137 | 258 | import numpy as np
import pandas as pd
import argparse, sys, json, random
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, GAE, VGAE
from torch.optim.lr_scheduler import ReduceLROnPlateau, StepLR
import matplotlib.pyplot as plt
from utils import *
from sklearn.... |
d424f2cbbf9726ab319cd77c6fce99c08a6fe1e0bdef9e35991d12347b31ea26 | Python | 12,139 | 228 | import numpy as np
from scipy.ndimage import filters, measurements, interpolation
from math import pi
def imresize(im, scale_factor=None, output_shape=None, kernel=None, antialiasing=True, kernel_shift_flag=False):
# First standardize values and fill missing arguments (if needed) by deriving scale from output sha... |
1917747ba1cd73fc6db49f948d28f670c18eebd38713213e6a41793933c7f709 | Python | 12,144 | 344 | #!/usr/bin/env python
# isoform_fraction.py
# calculate the percent of genes with a "minor" isoform above a specified fraction or range of fractions
# SNF 2017
import sys, os, argparse, csv, random, re
from SNFUtils import * # prompt, safe_open_file, stdout_from_command
from collections import defaultdict, namedtup... |
9de73b3448c15d42d343300dbd9ebd22d073061469081f38a7f750718d3839ef | Python | 12,146 | 280 | 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)
self.bn = ... |
123c6c48a06408a641413708d1adf5226dde898312bb5504887623b58a660636 | Python | 12,153 | 249 | #%%
from pymaid_creds import url, name, password, token
from data_settings import pairs_path, data_date_A1_brain
import pymaid
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from datetime import date
from contools import Promat, Celltype, Celltype_Analyzer
# allows text t... |
bfc0aec9f6c7e67f6bcfaf2e20b4f933a717f42ecf9430156def98f055c158b4 | Python | 12,154 | 365 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
50fac9bbc4290da60c7fb86df1fa2f1061a244022567b3cd0f91043c23fd1a3e | Python | 12,168 | 266 | """
-------------------------------------------
Author: Brin Rosenthal
Date: 7/3/19
-------------------------------------------
"""
# common packages, most likely already installed
import scipy
import math
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
i... |
736e917a2a37d5df163f9823b9e138461dcb5fc84c284126754dffc3bc84d5b3 | Python | 12,169 | 309 | """Dataset schema loader for CROPro.
A dataset schema is a TOML file that describes the folder layout and file naming
conventions of a prostate MRI dataset in one place. All CROPro pipelines
(resample, crop, normalize) can load a schema via the ``--schema`` flag so users
do not need to repeat the same paths and suffi... |
a06d39504a335083fdfdba78245c75a5e4c4cbb7785e3559ee0cddd9ff3fb25d | Python | 12,169 | 304 | #!/usr/bin/env python
import torch
from torch.optim import Adam
from drugex import utils, DEFAULT_DEVICE, DEFAULT_GPUS
from torch.utils.data import DataLoader
from tqdm.auto import tqdm
from drugex.logs import logger
from drugex.training.explorers.interfaces import FragExplorer
from drugex.training.generators.utils i... |
946ff85658d0091943a29f354146672989bf42f7905ccc8a46c6b82ccf047007 | Python | 12,171 | 429 | """
Utility functions for handling creation, writing, reading and parsing of BIDS files
MIT License
Copyright (c) 2017-2021 Mike Tyszka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without re... |
f276efaa24dea98222f60284f979c53cf8e9e5f917808546dcf7a845716e213b | Python | 12,195 | 245 | import carla
import numpy as np
from . import SmokeTest
WGS84 = carla.GeoEllipsoid(a=6378137.0, f_inv=298.257223563)
SPHERE = carla.GeoEllipsoid(a=6378137.0, f_inv=float("inf"))
TM = carla.GeoProjectionTM(
lat_0=0.0, lon_0=3.0, k=0.9996, x_0=500000.0, y_0=0.0, ellps=WGS84)
UTMNORTH = carla.GeoProjectionUTM(zone=... |
7695564ba5bb11a9fee80b429932976d9ed53626aac710c05fe1a8146cdbe372 | Python | 12,200 | 381 | from __future__ import print_function, division
import os
import torch
import numpy as np
import pandas as pd
import math
import re
import pdb
import pickle
from scipy import stats
from torch.utils.data import Dataset
import h5py
import slideflow as sf
from slideflow.clam.utils import generate_split, nth
class ClamE... |
93ae73e7a331305a76e980f259fa23d7930b6c86a859048136c22969c458e288 | Python | 12,202 | 341 | """
Unit tests for the RandomManager singleton in cxsystem2.core.
"""
# Built-in
import threading
from unittest import mock
# Third-party
import pytest
from numpy.random import Generator, SeedSequence, default_rng
# Local
from cxsystem2.core.workspace_manager import RandomManager
def _reset_singleton() -> None:
... |
2372cd2b46183a0a479cf2774b1c2651233ca9feb6dd3411f410521b8f0ca138 | Python | 12,203 | 241 | # basic imports
import numpy as np
import pickle
import matplotlib.pyplot as plt
# sklearn for linear regression
from sklearn.linear_model import LinearRegression
def retrieve_replays(gammas: list, decays: list, height: int, width: int, occupancy: str, mode: str) -> dict:
'''
This function retrieves the repla... |
6ecf4dd76746cb4b4fd980d3516bbf574c20fa8b1e5b0f292adf8f899a162e72 | Python | 12,207 | 265 | import glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import spearmanr, linregress, wilcoxon, combine_pvalues
from matplotlib.patches import Rectangle
from iEEG_STC import utils
import os
sns.set_palette("tab10")
sns.set_style("whitegrid")
font = {'f... |
b2d8538d2dd8d368de70f7515dabc143f7be0707dc918f929e5aafc6ca48793e | Python | 12,208 | 279 | # 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... |
c3b1d64f7a8f2eecf51c054f7e55a1cabf76efb6a4df6f0f49aeb1e1de8282fc | Python | 12,219 | 489 | # %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import time
import warnings
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import networkx as nx
import numpy as np
import pandas as pd... |
2d5a7385b3ec87be9f72aa94d2e61e771097a3243af7d5b811c0ad4193e9a64c | Python | 12,222 | 357 | """
This module contains the EphysProperties class which is used for calculating
various important ephys properties for a single compartment. It
also contains utility functions to get and update the default ephys
parameters.
Classes:
EphysProperties: A class for calculating various important ephys
... |
ffb2406878d26fbc2962273557eebfd71838e33331b6b82b130dc300235df5fb | Python | 12,228 | 241 | import os, sys
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
# import tensorflow as tf
# tf.enable_eager_execution()
# import neurite.py.utils as neurite_utils
from skimage.morphology imp... |
c781989576b95dd3baf6cd6a1ca6ed157eebd60dfa07577e18f94eb28e33720b | Python | 12,229 | 475 | import logging
import os
from collections import ChainMap
from collections.abc import Generator
from pathlib import Path
from typing import Any
import numpy as np
from ppqm import chembridge, constants
from ppqm.calculator import BaseCalculator
from ppqm.chembridge import Mol
from ppqm.utils import linesio, shell
# ... |
d91bf452e9d2954e244a9485567fc4cd8775b5513b873283301c6098a941c80d | Python | 12,229 | 313 | """SQLite-backed job and blob records under ``<state>/cosmos.sqlite``.
Files live next to it: blobs in ``blobs/<aa>/<sha256>``, job inputs and
results in ``jobs/<job_id>/{inputs,result}``. The store is synchronous and
guarded by one lock; every call is a handful of row operations, which is fine
for the request rates ... |
ef44aadcb2f64188a4385155744a9151ff3a82de332e82e6a0d546041a1b3907 | Python | 12,229 | 348 | import abc
import copy
from random import sample
from time import time
import numpy as np
from numpy.linalg import *
import matplotlib.pyplot as plt
from .Filter import Filter
from .Filter_Rect import Filter_Rect_LinSpaced, Filter_Rect_LogSpaced_AEC
class AEC:
"""
Abstract class defining providing an inter... |
5f0753f0d67196593d3bc5c710acc43f16e1036d5695d55b16d8a0117c168a85 | Python | 12,230 | 340 | #! /usr/bin/python
# -*- coding: utf8 -*-
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# import matplotlib.pyplot as plt
import numpy as np
import os
## Save images
import scipy.misc
def save_images(images, size, image_path):
"""Save mutiple images into one single image.
Paramete... |
6b28c69d4c1e12a634dcbc9b38b572fcb0e715cb70f498e17c73adac22f93213 | Python | 12,231 | 310 | # SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: MIT
"""
Coordinate-convention tests for the NuRec <-> CARLA transforms in utils.py.
These pin the conversions to CARLA's *documented engine convention*, not to
whatever the installed wheel's ``Transform... |
8a63bb6c51be31c8dd07cbb9f8ae09954701bc975ed77a7643c71d74165c877c | Python | 12,235 | 369 | from collections import defaultdict
import itertools
import pytorch_lightning as pl
from torchmetrics import MeanAbsoluteError as MAE
from torchmetrics.classification.f_beta import F1Score as F1
import torch.nn as nn
import torch
from functools import partial
from ..layers.diverse import MLP, AlphaPredictor
from ..laye... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.