sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b99a05d69713bfb68b74b7afc146185d320e32365750fc7cb4d3de335ce88be2 | Python | 17,512 | 523 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 21:42:12 2020
This script will add new species to PACIFIC using transfer learning
Notice that at the moment PACIFIC only support 150bp
@author: Pablo Acera
"""
import argparse
parser = argparse.ArgumentParser(description=
... |
6130373d2c470b1605cdb1eb7eabf8760b1d1e5406887420285c1592522081c8 | Python | 17,517 | 402 | """Result persistence (``carla_cosmos.results``) against a fake HTTP server.
The fake serves the four endpoints a download touches (``/v1/status``,
``/v1/jobs/{id}``, ``/v1/jobs/{id}/result`` and ``/v1/jobs/{id}/result/{name}``)
through an ``httpx.MockTransport``, so no server package, no network, no GPU.
"""
from __... |
8a496794d295d73d157aed866d28e0831c046eebd7e71391e5b386963e371f4d | Python | 17,522 | 516 | # -*- coding: utf-8 -*-
import os
import numpy as np
import scipy.misc # save/read image(s)
from . import _logging as logging
from . import prepro
# Uncomment the following line if you got: _tkinter.TclError: no display name and no $DISPLAY environment variable
# import matplotlib
# matplotlib.use('Agg')
__all__ = ... |
ddcf46483b6d9f01769ab12e3807c1e017de4a4f0cc7a8e23e1190b194cceee8 | Python | 17,522 | 420 | #!/usr/bin/env python3
"""
File: cell_fraction_gene_correlations.py
Created: 2020/09/08
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 Fre... |
1983524523205fb2f1254c964f4c809232bea0fdb7488a21a87333b9c0eb1b08 | Python | 17,532 | 454 | # 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... |
3444b4e6c860473c2d8b1031b93a8ce477cd980804a65276a7d2f675199b2d0e | Python | 17,535 | 518 | """
epnev's method is based on code by Eftychios Pnevmatikakis:
https://github.com/epnev/constrained_foopsi_python
which was published under the GPL v2:
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
Foundatio... |
855d2563ed1952f44131c6b12b4051a163bcfeef507ec7a1f2bf0376f5bccdd2 | Python | 17,555 | 552 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from inspect import getfullargspec
import re
from .. import testnd
from .._exceptions import DefinitionError
from .._io.fiff import find_mne_channel_types
from .._utils.parse import find_variables
from .definitions import Definition
from .variable_def import Var... |
e00953ec27a08f7ad77e89b4e3b6355f1c8d5db0d6b5be2f20951a2051ce3478 | Python | 17,561 | 417 | """Reader utils."""
import functools
import gzip
import io
import os
import struct
import typing
import numpy as np
from slideflow.util import log
from slideflow.tfrecord import example_pb2
from slideflow.tfrecord import iterator_utils
class TFRecordIterator:
typename_mapping = {
"byte": "bytes_list",
... |
e79ec58130a5ed1bcfc780ea48745a44de03db6e76565c611dd80542f9644356 | Python | 17,575 | 479 | """
MNE Sample Data: Bilateral Beamformer
=====================================
This tutorial performs an 'OSL-style' source reconstruction of the publicly
available `MNE sample dataset
<https://mne.tools/stable/documentation/datasets.html#sample>`_, going from the
raw sensor recording to parcellated source-space time... |
9ed3da8192aa2a454c330b05e132f754f8e9e375af701a86818e37f037f10dfa | Python | 17,601 | 452 | from threading import active_count
import tensorflow as tf
import numpy as np
import h5py
from scipy import ndimage
import random
from icecream import ic
class PatchHandler3D():
# constructor
def __init__(self, data_dir, patch_size, res_increase, batch_size, mask_threshold=0.6):
self.patch_size = {True... |
d7d1516e9f82b6aae5e1ee0759574116b41031c8b35fa4ea69f85c6154722992 | Python | 17,617 | 454 | ####################################################################################################
# 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 ... |
08ee622520c2484a5b90cd4e436943bd1fbac013d73871f6d0678d617ff3aaf4 | Python | 17,626 | 347 | import torch
from torch.autograd import Variable
from collections import OrderedDict
import numpy as np
import os
from PIL import Image
import util.util as util
from .base_model import BaseModel
from . import networks
class UIModel(BaseModel):
def name(self):
return 'UIModel'
def initialize(self, opt)... |
95a78e98ca2bae00c8a00867c552721b19960ae4fa73abd54ace22c47cc7ca9a | Python | 17,641 | 402 | #!/usr/bin/env python3
"""Import FBX meshes into CARLA on UE 5.8 as spawnable props.
import_prop.py plan <path> [--tag Static] [--scale 1.0]
import_prop.py import <path> [--tag Static] [--scale 1.0] [--size Medium]
import_prop.py verify [--name NAME]
import_prop.py list
import_prop.py rever... |
c86d4be2345d07945f9892fc37bd24756046da9f007f52181f03a542098738c3 | Python | 17,658 | 459 | import os
import math
import time
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging # NOTE: logging is slow!
#
# CM_Tracking_Simple
#
class CM_Tracking_Simple(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https:... |
2120b50ad2bbcc2d4f0f3f12bf2400a815c184f7ffe326261f21edc8bd8408a3 | Python | 17,664 | 460 | import os
import math
import time
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging # NOTE: logging is slow!
#
# CM_Tracking
#
class CM_Tracking(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https://github.com/S... |
8ee6c34425c9b9bc977e38f271612a792f03a0ccd01bceeb7037afe191267f38 | Python | 17,692 | 652 | import sys
import pickle
#import sys
import os
import re
import numpy as np
import random
from PIL import Image
Image.Image.tostring = Image.Image.tobytes
import matplotlib.pyplot as plt
import matplotlib
from skimage import io
from multiprocessing import Pool
import math
import scipy.stats
import time
from matplotlib ... |
abe48ddbfd87b7d10c252b0cea4fe02ebad62693894a53210fdacc0e12c734ee | Python | 17,693 | 476 | import os
from pdb2sql import StructureSimilarity
import numpy as np
import networkx as nx
from collections import OrderedDict
import time
from deeprank_gnn.tools.embedding import manifold_embedding
import community
import markov_clustering as mc
import h5py
class Graph(object):
def __init__(self):
"""Cl... |
f98fbfb82f0a3abccbca5264cfd48d9889751411d3e5111ff54df94a46c38956 | Python | 17,693 | 580 | import argparse
import math
import random
import os
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
from torchvision import transforms, utils
from tqdm import tqdm
from dataset.cub import CUBZeroShot
from dataset.nabirds import NABirds
from dataset.... |
c7d91f1a1bcdd5ef7255f5f39134566044e3425715f57714747d313c4b048940 | Python | 17,700 | 366 | import torch
import torch.nn as nn
from .basic_model import BasicModel
from . import networks
from . import losses
from torch.nn import functional as F
from sklearn import metrics
class VaeAlltaskGNModel(BasicModel):
"""
This class implements the VAE multitasking model with GradNorm (all tasks), using the VAE... |
bee6afd95087b72a1d7ceef497cd08b99031bcdee8de6dc86005f9f8605ff8b4 | Python | 17,707 | 398 | import matplotlib.gridspec as gridspec
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import collections as mc
import numpy as np
from math import log10, floor
from scipy.optimize import curve_fit
from scipy.optimize import minimize, fmin, leastsq
import os
class PlotData(object):
"""
Thi... |
de60c693f40ed9ffa66b51a1668a3acaab149869387129da11af0bbdb91dfd60 | Python | 17,708 | 448 | #!/usr/bin/python
# SSAML
# This code is designed to calculate the number of patients (or events) needed for a clinical
# validation study of a machine learning algorithm. Choose your dataset wisely, because
# inadequate data will give you wrong answers. Use at your own risk.
# Daniel Goldenholz, MD, PhD
# USAGE:
#pow... |
efd2ac88a08489ffbaec72b72811512db1025fecf4b85d5eabad0b741e747119 | Python | 17,708 | 448 | #!/usr/bin/python
# SSAML
# This code is designed to calculate the number of patients (or events) needed for a clinical
# validation study of a machine learning algorithm. Choose your dataset wisely, because
# inadequate data will give you wrong answers. Use at your own risk.
# Daniel Goldenholz, MD, PhD
# USAGE:
#pow... |
b5fe89ef73c5d9f71e10ecdd2746fc9cc2ef1b1a149e9a3375cbbdaa713a0f17 | Python | 17,709 | 448 | #!/usr/bin/python
# SSAML
# This code is designed to calculate the number of patients (or events) needed for a clinical
# validation study of a machine learning algorithm. Choose your dataset wisely, because
# inadequate data will give you wrong answers. Use at your own risk.
# Daniel Goldenholz, MD, PhD
# USAGE:
#pow... |
63231c157122013ff891f007beeda200771c05e5325ad50d43119e9e432e2bed | Python | 17,713 | 430 | """
This module provides the `IntervalsSampler` class and supporting
methods.
"""
import logging
import random
from collections import namedtuple
import numpy as np
from selene_sdk.samplers.samples_batch import SamplesBatch
from ..utils import get_indices_and_probabilities
from .online_sampler import OnlineSampler
l... |
d3c5647dfac2fe4ee84be3bcd5cf64641a6d81e5e720b8b11dd169ea1472fe04 | Python | 17,720 | 442 | # 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... |
6fe3b1a99f3f5e5977c6225c39c26d3dd9d98a8b0b167e97ae5f808aee8be6de | Python | 17,734 | 280 | import os, sys
import shutil
import time
import h5py
import matplotlib.pyplot as plt
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(con... |
40b1c2037695646fc23df0bc54f3238262ee5f107791eafd2007911cd7ef22a0 | Python | 17,736 | 433 | import torch
import torch.nn.functional as F
from typing import Tuple
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_geometric.utils import k_hop_subgraph, to_undirected
from torch_geometric.nn import GCNConv, GINConv
from torch_geometric.data import Data
import numpy as np
from ._decomp_base_... |
2d84277af919c0ff36c8d94d7d6d43316665f7a09bcd37e2bb08c2903e5974b9 | Python | 17,740 | 413 | import numpy as np
import os
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 mode... |
01a9047d526ec1e4a8c42720d07d6f05ae9b1bdd6257e254686ce97d83e366e4 | Python | 17,760 | 488 | # 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... |
87bc3c3ccd761985a2c449e74eceb0b1c68b1523d863bd4d816f83350c5ebcef | Python | 17,780 | 362 | # 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... |
f4047ae2ec94180a2dbd167cfdcba5594e7ccdada6c4e71a80d309c1eb49cdc8 | Python | 17,799 | 484 | # -*- coding: utf-8 -*-
import unetsl.data
import numpy
def upsample(stack, shape):
"""
upsamples the last three dimensions and keeps the other dimensions
unchanged.
"""
scale = [o//i for o,i in zip(shape[-3:], stack.shape[-3:])]
return numpy.kron(stack, numpy.ones(tuple(scale)))
def c... |
8deb39b21ec0bd89718622d03c9569b8acd9523902917d537a8373f7c10dbb62 | Python | 17,800 | 380 | import numpy as np
import matplotlib.pyplot as plt
import os, sys
import pickle
import torch
import seaborn as sns
sns.set_style("darkgrid")
fontsize = 12
def plot_T(NT, DT, *args):
if not isinstance(NT[0], list):
toymodel = args[0]
if not toymodel :
fig = plt.figu... |
6dac58b69b0ef8bcc54ffc2761f2b87fc9a4ae6e814609bb62b1739b11a1969b | Python | 17,825 | 228 | #!/usr/bin/env python3
"""One-command hybrid rendering: CARLA actors composited into a NuRec scene with occlusion from the engine's
own depth, in the recorded camera lens, under the scene's own sun, harmonized.
hybrid_run.py --scene 7c2cf6cd --out /path/to/run [--frames 400] [--harmonizer single|temporal|both|none... |
1bac7a83d2cded5b0c2281d26fce3061dc28aa22a3fcfd9e59d9141f40e81110 | Python | 17,830 | 351 | import datetime
import os, sys
import shutil
import argparse
import subprocess
import logging
import time
import tensorflow as tf
import numpy as np
import nibabel as nib
from scipy.ndimage import gaussian_filter, zoom
from skimage.measure import regionprops
import SimpleITK as sitk
import ddmr.utils.constants as C
... |
3b0863cfd2893202c595569f05c3854a00e0f293d8ebde5f613f8ce47346cc13 | Python | 17,845 | 504 | """
Implementation of normalized cut segmentation methods.
Reference
---------
Jianbo Shi and Jitendra Malik. Normalized Cuts and Image Segmentation.
IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE,
VOL. 22, NO. 8, AUGUST 2000.
"""
from __future__ import division
from builtins import str
fro... |
24196a8354f8419b42b88aa11196894c2e2a2d9ea9190e5508787b287ae093ea | Python | 17,861 | 499 | # 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... |
2edcb94e10f728a4ad3c33db9b94c5113b5dbfdf0df3be94572afc0ced95f5a8 | Python | 17,870 | 473 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
from yacs.config import CfgNode as CN
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# ------------------------------------------------------------... |
5a501c62b76248e1e613c9169f0437265e1bf2d091462d59f8df20a827042011 | Python | 17,871 | 419 | """
Plot main sound localization figures
For each subject, show:
- Bilateral cooling results as:
- Bubble plots of response counts (normalized for total trial count) for each stimulus and response location, for control and bilateral cooling
- Bootstrap scatter plots (markers with mean ± s.d.)... |
b4f890b677277cf60443ac6cc065e79f5449d003eac1886cee0b418513fa8bd6 | Python | 17,871 | 547 | #!/usr/bin/env python3
"""
Module that creates the regressors used in phys2cvr.
Attributes
----------
LGR
Logger
"""
import logging
import os
import numpy as np
from numpy.lib.stride_tricks import sliding_window_view as swv
from phys2cvr.io import export_regressor
from phys2cvr.signal import (
convolve_sign... |
ceb1a0594708791c27d9b202012928defb1ff686c4e0d9340bcb6dbb9682ace8 | Python | 17,872 | 539 | """
This the spike_tools submodule provides functions to analyse the
Brian2 SpikeMonitors and Brian2 StateMonitors. The code provided here is
not optimized for performance and there is no guarantee for correctness.
Relevant book chapters:
- http://neuronaldynamics.epfl.ch/online/Ch19.S2.html#SS1.p6
"""
# This fil... |
1f5194b870d68017285ed72a188084df8822434d4dfb42bdacc89ce8c46f21b3 | Python | 17,875 | 482 | from __future__ import print_function, division
import csv
from dataclasses import replace
import functools
from hmac import trans_36
import json
import os
import random
import warnings
import numpy as np
import torch
from pymatgen.core.structure import Structure
from torch.utils.data import Dataset, DataLoader
from ... |
cf3e54eee470cd0a03226f7f5a2f470ce71ccc8cb61ec45b5ff419b91a769bb5 | Python | 17,905 | 440 | #%%
import os
import sys
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/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
fr... |
e0ad032868d8436112b6a682cadf0b9a98e4f9bde963a429e93a2b2f9e707b29 | Python | 17,910 | 527 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: example.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _refle... |
95b854e9845915e016f436113ca761ae335d935a48d349bf51f3e8d794593a69 | Python | 17,915 | 479 | # Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
import torch
import torch.nn as nn
from functools import partial
from timm.models.vision_transformer import Mlp, PatchEmbed , _cfg
from timm.models.registry import register_model
from timm.models.layers import trunc_normal_, DropPath
__all__ = [
... |
cced5ee0741a24e95d50ab8c756ee0f5f391e31af273a21a41990f3ff7b4d47a | Python | 17,915 | 481 | """
Basic k-nearest neighbours classifier for RACCOON
F. Comitani @2020-2022
"""
import os
import sys
import pickle
import logging
DEBUG_R = 15
import time
import psutil
import random
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import raccoon.interface as interface
import raccoon... |
c3a58433d149de092f8562f5390665d0142c923d8998e245523e80139c6f272f | Python | 17,916 | 409 | ## Load result for sample-reduce experiment
import os
## Maths
import math
import numpy as np
import pandas as pd
import logging
logging.getLogger('tensorflow').disabled = True
logging.getLogger().setLevel(logging.INFO)
## Plots
import matplotlib
# matplotlib.use('Agg') # Use for clusters
import mat... |
827a50ccd4feea55457b8560937873f55d3c646778b678517cedd5c6f562f077 | Python | 17,919 | 360 | from functools import lru_cache
from typing import Tuple, List, Callable
import jax.numpy as jnp
import numpy as np
from .parse import parse_source_port
from .sim import SimGrid
from .typing import Array, Shape, Spacing, Optional, Union, State, Size3, Size, Source
from .utils import pml_sigma, curl_pml_fn, yee_avg, y... |
91649a116a7f63173de0d317ca5fa1b739c37237997a0193794aea96b406e10b | Python | 17,921 | 513 | import logging
import re
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
import sssom_schema as sssom
from kgcl_schema.datamodel import kgcl
from linkml_runtime.dumpers import json_du... |
816ff4e789ba522ac9bf4f6bc27bb7b616a5c6496f69288ce7df93accd06cb32 | Python | 17,933 | 412 | import numpy as np
import os
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.dense_ed import DenseED
import random
import pandas as pd
#import matplotlib.pyplot as plt
im... |
885bccc29fb936e3db43856b92af6895d2cb8352670acc579cc62769d923024d | Python | 17,941 | 563 | """
OBO Format and OBO Graphs compliance tests.
See:
- https://github.com/owlcollab/oboformat/issues/146
- https://github.com/geneontology/obographs/issues/106
Note: some of these tests may migrate from OAK to a more central location.
Currently the tests in this suite do two things:
1. Compile a compliance suite b... |
b6055ec2f4aae4af0528281f83a5464da8392074cc25e7a3fa6328b2dee8da51 | Python | 17,944 | 424 | import torch
import torch.nn.functional as F
# Set warning filter to show each warning only once
import warnings
warnings.filterwarnings("once", category=UserWarning)
from .base_model import BaseModel
from ..layers.channel_mlp import ChannelMLP
from ..layers.embeddings import SinusoidalEmbedding
from ..layers.fno_... |
a9bff46a9949bb86a6a8f24e25875b9c64ab6547cb05365429fb8b26040e3daf | Python | 17,978 | 419 | import numpy as np
import os
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 mode... |
5460466a5f0eb476d6113005982e137be5271c1be8537d5f15ee8a8e0250ddd0 | Python | 17,982 | 498 | """
Written by Nathan Neeteson.
A set of utilities for calculating errors and losses on model outputs.
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def calc_multiclass_dice_coeff(seg1, seg2):
# seg1 and seg2 are pytorch tensors with dimensions: (batch,class,width,heig... |
716490b7ae62f476169d3db8067596deb1ab7ab7727484a5cdece0cd4f2b9774 | Python | 17,987 | 544 | import argparse
import os
import os.path as op
import string
from glob import glob
import nibabel as nib
import numpy as np
import pandas as pd
from nilearn import image, masking
def _get_parser():
parser = argparse.ArgumentParser(description="Run group analysis")
parser.add_argument(
"--dset",
... |
780914db6cfed925675e1dd33fef1ab09f6f620177b668dbfd93d14f1ce647e6 | Python | 17,988 | 497 | # -*- coding: utf-8 -*-
# -*- 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 numpy as np
from sklearn.metrics import accuracy_score, precision_score, recall_score, confusion_matrix
from sklear... |
589591d4b1668518ce6eac71ab0c09898871f63c47466410706e60050620b914 | Python | 18,002 | 443 | # 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... |
5ce57e021f63ee484bf32d0a8945c20527de42ec0845644d6be2d6c125dc990b | Python | 18,010 | 481 | import re
import glob
import itertools
import numpy as np
import pandas as pd
import nibabel as nib
import seaborn as sns
from pathlib import PurePath
import matplotlib.pyplot as plt
from os.path import join as opj
from nilearn.input_data import NiftiMasker
from nilearn import image, plotting, surface
from nilearn.da... |
01df33d04b76084ea5d4fc7e7a2c79c86e93a35fa391ba4355c5b65e6e3f073a | Python | 18,034 | 412 | import numpy as np
import os
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.unet import UnetN2N
import random
import pandas as pd
#import matplotlib.pyplot as plt
import... |
037d811e8908ebdf658a2d585a670885d0bbef914e4f34a411b8d44fa647bac2 | Python | 18,034 | 547 | '''
- Generate triangular lattice
- In rectangular domain, assuming periodic boundary conditions.
Triangular lattice, but rotated by 90 degrees. Because of rectangular domain, it is not trivial to introduce lattice for
any rotation.
'''
import math
import numpy as np
from numpy.linalg import norm
from carpet.various... |
8670d242bbbeefecd6045f964943a137a679a9801a5ca8f4cc4d1afe3c2f23de | Python | 18,037 | 472 | import math
from typing import Callable, Iterable, Optional
import torch
from tensorly import tenalg
from tensorly.decomposition import tucker
from torch import nn
from torch.optim import Optimizer
from torch.utils.checkpoint import checkpoint
from tensorly.tucker_tensor import validate_tucker_rank
class TensorGRaDP... |
bbe564646f246e2812e9963d22bcdb84c4c7c3968481d2b962fcf091d6bf0df9 | Python | 18,053 | 412 | import numpy as np
import os
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.unet import UnetN2Nv2
import random
import pandas as pd
#import matplotlib.pyplot as plt
impo... |
80c34bac50b8cd1e667f73281e45238d2adff3ba65258a56b510f8e854d37634 | Python | 18,072 | 357 | # Auto generated from text_annotator.yaml by pythongen.py version: 0.9.0
# Generation date: 2022-06-08T15:32:53
# Schema: text-annotator
#
# id: https://w3id.org/linkml/text_annotator
# description: A datamodel for representing the results of textual named entity recognition annotation results.
# This draw... |
8a01381123f930c745422fb25a483756c4e951ed124f6c64fd21748a2c636c24 | Python | 18,072 | 499 | # -*- coding: utf-8 -*-
# -*- 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 numpy as np
from sklearn.metrics import accuracy_score, precision_score, recall_score, confusion_matrix
from sklear... |
e50aec8e0427920f72cfca24308330b3f43af36188e2b1bd335cee3339dfd66e | Python | 18,076 | 500 | """ This file contains test cases for datasets.py
As new datasets are added, all that needs to be done is to create a function that
initializes it, like `create_refinebio_labeled_dataset`, and have the function added
to either the labeled_datasets or unlabeled_datasets fixture, depending on which
base class it inherite... |
1fbf7d6d22ed646788251610130606d20e4ceb49f047bf2ed70a53ad35499eac | Python | 18,087 | 485 | import csv
import logging
import re
from collections import defaultdict
from dataclasses import dataclass
from typing import IO, Any, Dict, List, Union
from linkml_runtime import SchemaView
from linkml_runtime.linkml_model import SchemaDefinition
from oaklib import BasicOntologyInterface
from oaklib.datamodels.vocabu... |
aeeec8f9f475ce8b722235e6e74eb721837b5bd322be5d6b182e41f3dafa1cb3 | Python | 18,106 | 507 | import os
from os.path import dirname, realpath, join
import sys
from sys import argv, exit
from pathlib import Path
import nrrd
import pickle
import csv
import nibabel as nib
import numpy as np
import pandas as pd
import cv2
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from .uuuu... |
06b338c3363f1cc4f64b2a8ddbf8e784ca98d4a10c49ef99446da1b1cbff5456 | Python | 18,112 | 447 | import torch
import logging
from torch import nn
from typing import Dict, List, Optional, Callable
logger = logging.getLogger(__name__)
# Set warning filter to show each warning only once
import warnings
warnings.filterwarnings("once", category=UserWarning)
class FieldwiseAggregatorLoss(object):
"""
Aggreg... |
dcfcb7c0969a4e7d6d6ac098053c32a0011c709c0b4dc017463ce67bade23f71 | Python | 18,143 | 596 | #! /usr/bin/python
# -*- coding: utf8 -*-
"""
Experimental Database Management System.
Latest Version
"""
import tensorflow as tf
import tensorlayer as tl
import numpy as np
import time
import math
from lz4.frame import compress, decompress
import uuid
import pymongo
import gridfs
import pickle
from pymongo import M... |
281543e9577ffbfb5b7b87ec9c5d9bdddb1c8c579f4482f5f23b0078b52de18e | Python | 18,150 | 356 |
"""
Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com)
All rights reserved
Permission is granted for anyone to copy, use, or modify this
software for any uncommercial purposes, provided this copyright
notice is retained, and note is made of any changes that have
been made. This softwa... |
30661562b14d9b5cf77b983dd4b22065479d4d327675009bb38a7b05ece72868 | Python | 18,150 | 447 | """
This module provides the `OnlineSampler` class and supporting methods.
Objects of the class `OnlineSampler`, are samplers which load examples
"on the fly" rather than storing them all persistently in memory.
"""
import os
import random
from abc import ABCMeta
from tqdm import tqdm
import numpy as np
from ..targe... |
0637288149bcb8e0d72c5e2fbd910c97a376f4d1d287e112987a1e7411364ce8 | Python | 18,151 | 307 | import logging
import sys
import time
import requests
import os
import urllib.request
import subprocess
import hashlib
import argparse
parser = argparse.ArgumentParser(description='Download a list of samples from ENA')
parser.add_argument('samplesheet', help='ENA sampelsheet containing accession ID, md5sums and downl... |
1fffd918d5f7206f02c2e9dd18bdc330b659d996246d4d05bb410d13de36fa02 | Python | 18,151 | 423 | #%%
# have to run some code in descending_categorization.py and projectome_format.py
# some variables are borrowed from there and weren't added to this very preliminary script
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#... |
3395d56ff96b96496d34ec3bbeef3b4ef5bf49d73c8f9fbd03d6a47ee320c932 | Python | 18,152 | 413 | import numpy as np
import os
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.dncnn import DnCNN
import random
import pandas as pd
#import matplotlib.pyplot as plt
import ... |
ccf9d0848d0e5e775f39ad0787cc5994df7b5564c28a485ff00870a1b5ed4b0f | Python | 18,196 | 413 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Variational Animal Motion Embedding 0.1 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
"""
import... |
c54e6fcb33da5787a0f01216169d3679e84cd1a556ae2a436b20ae3941c4b61d | Python | 18,205 | 569 | import argparse
import pickle
from PIL import Image
from typing import Tuple
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.utils import shuffle
from scipy.stats import multivariate_normal
def resize_images(
filename: str = None, filepath: str = "../datasets/... |
9380623e8af29b9180f28f1a39b9ecc3448af0ccaf38156448fedee872043e0f | Python | 18,215 | 457 | # -*- coding: utf-8 -*-
# -*- 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 numpy as np
from sklearn.metrics import accuracy_score, precision_score, recall_score, confusion_matrix
from sklear... |
7c302a8adc2bc56ca8b752bfe68c960e064b323a3fedc739fef2db5698480fac | Python | 18,217 | 464 | import sys
from typing import List, Optional, Tuple, Union
import __main__ as main
from brian2 import NeuronGroup
from brian2.units import Quantity, mV
from .compartment import Compartment, Dendrite, Soma
class NeuronModel:
"""
Creates a multicompartmental neuron model by connecting individual
compartme... |
3cc09f7dec6e43de90f0f75e39f2f07b45c5aeb798706376bdae1d34afcba9c3 | Python | 18,229 | 471 | import logging
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, Iterator, List, Literal, Optional, Set
import pandas as pd
from pydantic import BaseModel
from sssom_schema import Mapping
from oaklib import BasicOntologyInterface, get_adapter
... |
934d2a1a950e3e8c722938e117777a0f7774a6ff76a436c70db4fe9fa4f5acbe | Python | 18,242 | 422 | import torch
import copy
import random
import networkx as nx
import numpy as np
from torch_geometric.utils import convert
from loader import graph_data_obj_to_nx_simple, nx_to_graph_data_obj_simple
from rdkit import Chem
from rdkit.Chem import AllChem
from loader import mol_to_graph_data_obj_simple, \
graph_data_ob... |
6c3c61f9c366966560526a6e871d66dc4b29d4235f922469b2a6d7a115e928a3 | Python | 18,262 | 439 | import statistics
from abc import ABC
from typing import Dict, Iterable, Iterator, List, Optional, Tuple
import numpy as np
import pandas as pd
from oaklib.datamodels.similarity import (
BestMatch,
TermInfo,
TermPairwiseSimilarity,
TermSetPairwiseSimilarity,
)
from oaklib.datamodels.vocabulary import ... |
f486266ca2ae7b50533a7a8da2f61f7dcbf5fa6abbc6ac64f404ef7ba3363591 | Python | 18,263 | 540 | """
Utility functions for RACCOON
F. Comitani @2018-2022
A. Maheshwari @2019
"""
import os
import sys
import shutil
import warnings
import csv
import pickle
import logging
from scipy.stats import gaussian_kde
from scipy.stats import median_absolute_deviation as mad
from scipy.signal import argrelextrema
from ... |
83b4247477f620918765e8b7f49ce56f7620d3016c3b899882f536a86d211e7e | Python | 18,295 | 433 | import logging
from copy import deepcopy
from dataclasses import dataclass
from typing import Collection, Dict, Iterable, Iterator, List, Optional, Tuple
from oaklib import BasicOntologyInterface
from oaklib.datamodels.taxon_constraints import SubjectTerm, Taxon, TaxonConstraint
from oaklib.datamodels.vocabulary impor... |
28fd50647bf104d28df6b244d38036260b7f918cb99e22971e3f07c9bbe845f8 | Python | 18,298 | 328 | # %%
from pymaid_creds import url, name, password, token
from data_settings import pairs_path, data_date
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
# allows text to be editable in Illustrator
plt.r... |
10e27afff13d75948d00342807006a9df097d1e9c4054e9632954888369c5b6b | Python | 18,303 | 385 | # 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... |
3a0ce945b5628821da0bd7d4cee00e16a4b8519d56d9c434ab5f05cfeeb132b7 | Python | 18,325 | 433 | # Plotting utils
import glob
import math
import os
import random
from copy import copy
from pathlib import Path
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import yaml
from PIL import Image, ImageDraw, ImageFont
from scipy.sign... |
1be2747670121da6faa9f0571767bd82206166410eb941bb92462f9f2c948d6d | Python | 18,334 | 501 | from typing import Tuple
import numpy as np
def _compare_time(f_time, interval):
"""
Compares time with interval less than interval
Args:
f_time ([type]): [description]
interval ([type]): [description]
Returns:
[type]: [description]
"""
if f_time < interval:
... |
5b47b61c963bbb39f0bab5e346da72f40bb8499bef21cf0b1b3f0a595cc6b1db | Python | 18,347 | 399 | import os
import logging
import torch
import pickle
import pandas as pd
import numpy as np
import monai
from monai.transforms import (
LoadNiftid,
Compose,
AsChannelFirstd,
Orientationd,
RandFlipd,
NormalizeIntensityd,
ScaleIntensityd,
Compose,
LoadNiftid,
RandRotate90d,
Resi... |
1b26cd5d20c8681f23ee222bd2b9aab35ce3d030896b5cbdcfb44d09289093ff | Python | 18,355 | 479 | import random
from collections import Counter, deque
import gym
import numpy as np
from gym.spaces import Box, Discrete, Space
from src.landmarks.common import (
extract_state_from_image,
PANDAS_FCSV_KWARGS,
)
from src.landmarks.transforms import LoadCSVd, TransformLandmarksd, ExtractLandmarks2d
from monai.tran... |
50347b3ccb007342e33a8edd19df360c2d555041bf318d746727a521ab64c070 | Python | 18,368 | 432 | from abc import abstractmethod
from typing import Sequence, NamedTuple, Optional, Tuple, Callable, Iterable
import dataclasses
from dataclasses import dataclass
from artemis.general.numpy_helpers import get_rng
from artemis.general.should_be_builtins import izip_equal
import torch
import numpy as np
def rho(x):
r... |
4658e596ee4dc538df086f0aa54cc1636f6f73a55547e495fa14ea467e27cbcc | Python | 18,408 | 606 | import time
import numpy as np
import pandas as pd
import pickle
import more_itertools as mit
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import pandas as pd
from itertools import combinations
from scipy import stats
# from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
... |
f9c70b12fb62dc8cd9dcc38d42644685b0bf49bcfe85e425e8ed1a78d259b712 | Python | 18,411 | 513 | import rdkit
import rdkit.Chem as Chem
from rdkit.Chem import BRICS
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
from collections import defaultdict
from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions
MST_MAX_WEIGHT = 100
MAX_NCAN... |
f19639f9f2dcc700729cd02472b3cf4ac13bffe41db2e7d8faa76bbfcb5504b7 | Python | 18,416 | 433 | __author__ = 'tylin'
__version__ = '2.0'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Pleas... |
6636a7110ab6ed0d0663a0e88b48b6d0109e422b300c673d699d5fd877adfcaa | Python | 18,428 | 469 | import re
import os
import pandas as pd
import numpy as np
from prettytable import PrettyTable
from tqdm import tqdm
def get_char(seq):
"""split string int sequence of chars returned in pandas.Series"""
chars = list(seq)
return pd.Series(chars)
def is_initial_eq_mutated(df):
return 100*(df['wide_initi... |
1a3295ed6274656ba7d02a929a6eb63b501703f7cc0ec588845068f12dd39ec7 | Python | 18,432 | 563 | # Auto generated from taxon_constraints.yaml by pythongen.py version: 0.9.0
# Generation date: 2023-04-09T15:54:03
# Schema: taxon-constraints
#
# id: https://w3id.org/oak/taxon_constraints
# description: A datamodel for representing inferred and asserted taxon constraints.
# license: https://creativecommons.org/public... |
812cf1b7c9c701996064a8772aa73fddf50541222ff5122f255ece0af11a13a0 | Python | 18,441 | 422 | from pathlib import Path
import cv2
import numpy as np
import SimpleITK as sitk
from .strategy_registry import get_strategy
class croppingControllerClass:
"""
This class controls the cropping.
Methods
-------
load_resample_itk(self, filename, is_mask))
sample_size_calculation(self,number_of... |
0c5e5ea7b391191b49299a476d9436620e353f548dd3bb02b555acd487ada479 | Python | 18,443 | 398 | """
4DFlowNet: Super Resolution Network
Author: Derek Long
Date: 03/09/2021
"""
import pickle
import tensorflow as tf
import numpy as np
import datetime
import time
import shutil
import os
from .SR4DFlowNet import SR4DFlowNet
from icecream import ic
from . import utility, h5util, loss_utils
class TrainerSetup:
#... |
57aa3400714070bf9075a31504174cfb0db232056860c7a10fe502db58648760 | Python | 18,454 | 328 | import os
import numpy as np
import random
from sklearn.utils import shuffle
import scipy.io
import matlab.engine
import time
import glob
import argparse
from utils_noisescope import *
import logging
import joblib
random.seed(6666)
eng = matlab.engine.start_matlab()
def extract_fingerpint_via_clustering(all_res_path... |
f7df6b785d13d5e296a023cef247a4aa6d309697537cdf6270b1612656128d75 | Python | 18,454 | 353 | 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 numpy as np
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, TensorBoard, EarlyStopping, R... |
4ea17abc80b94169996812827ad6a9e526ac8b8b0e9db3f0e8bc580d094ce706 | Python | 18,458 | 404 | import torch
import random, math
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from types import MethodType
from typing import Optional, Callable, Union
from functools import partial
from torch_geometric.utils import k_hop_subgraph, to_undirected
from torch_geometric.data import Data
from gr... |
0d8697c529537a1d4b1d27f9f3abda90bf69d434f88affbfdb095da179cc9c2f | Python | 18,465 | 556 | # This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.