sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e6fe4857866d55ca4ac87cbbcc86c193b8ef25fd3dc856502bafaaadfab896cc | Python | 9,803 | 240 | import json
import math
import numpy as np
import random
import torch
import torch.nn.functional as F
import torch.utils.data as data
import torch_cluster
import torch_geometric
import tqdm
def _normalize(tensor, dim=-1):
"""
Normalizes a `torch.Tensor` along dimension `dim` without `nan`s.
"""
retur... |
5706390ed0ac2ac765816a26b966955462cb1a6c612f7e008e0b65dbbb3017a5 | Python | 9,821 | 257 | # Multiple runs of the model as described in NetworkModel.py
# Makes multiple networks with different random number realisations
# Saves the spike times of the simulations in ".mat" files to be analyzed in MATLAB
# Written by Nina Doorn
# last edit: 26-07-2022
# n.doorn-1@utwente.nl
# IMPORT LIBRARIES
from brian2 imp... |
dcaf84748f7ddd1e6864bff206670ad00e1601e2b8b4faa7def6659b3c951584 | Python | 9,827 | 225 | import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import tqdm
from scipy.stats import norm
from lib.layers.GRU_cell_variational import *
from lib.layers.Dense_Variational_Reparam import *
tfd = tfp.distributions
def random_gaussian_initializer(shape, dtype):
if shape[0] == 2:
... |
1921182a3093092b2a427290d534fbc974ce65d9f394429a041437317b738394 | Python | 9,829 | 228 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
d6b42ec329ac3688c7b3a87a52679e34a4a44fe5cbfd33281641cdb73e264d6f | Python | 9,840 | 292 | import os
import h5py
import tempfile
import shutil
import numpy
from nose.tools import ok_, eq_
from pdb2sql import pdb2sql
from deeprank.features.atomic_contacts import (__compute_feature__, CHARGE_FEATURE_NAME,
COULOMB_FEATURE_NAME, VANDERWAALS_FEATURE_NAME)
from deep... |
31f82fff6c3a61cbc957085b723b526c3c3809c75dc912658d41d28a43d80bbd | Python | 9,841 | 165 | # TODO SEP 08 version
import argparse
import os
from util import util
import torch
import models
import data
import datetime
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options... |
40f9f1dbb08c1f71655d4e34f07bdb84866621fe30412deaaee31565e71ec593 | Python | 9,842 | 242 | import os.path as osp
import sys
import numpy as np
import os.path as osp
import sys
import time
import matplotlib.pyplot as plt
import scipy
import nibabel as nib
from scipy.ndimage import gaussian_filter
from scipy.interpolate import griddata
sys.path.append('..')
from functions.def_ROIs_EarlyVisualAreas import ro... |
f0b42c77e2ff362c51c470d85859d6b91cfa2cbd8b64fc359baa1a64e8902f1d | Python | 9,846 | 259 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
9c54c126236031b42066d72917089b2a9441f4fb0cf35a3abb9dd07f045a7d0b | Python | 9,859 | 279 | """
Performs cross-validation.
@author: JingyiGF
"""
from .toolkits import *
from .family import *
from .metrics import *
from .solver import *
class CrossValidation(object):
def __init__(self, family='bernoulli', kappa=2., theta=1., tik_tau=None, group=None,
nfold=10, fold_method='sublock', n_r... |
18b1e9cc814089e4f95907be568334ee5b5550888e7a7dc94a98fd59e55be3e5 | Python | 9,863 | 377 | import glob
import os.path
import numpy.testing
import pytest
import skimage
import skimage.measure
import skimage.morphology
import cellprofiler_core.image
import cellprofiler.modules.savecroppedobjects
import cellprofiler_core.object
import cellprofiler_core.preferences
import cellprofiler_core.setting
instance = ... |
62028e69fe0faf84bb5c6f916dc38dcdc61982e49e2d0101cef76008dc9a6269 | Python | 9,869 | 251 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NiMARE documentation build configuration file, created by
# sphinx-quickstart
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All conf... |
9c5b5463a7bae66c2d5e6deaa78d6da22be4dc980016c4e9fa3e9be4acdd6058 | Python | 9,884 | 251 | import wx
import wx.lib
import wx.lib.colourselect
from ..constants.workspace_view import C_CHOOSER
from ..constants.workspace_view import C_COLOR
from ..constants.workspace_view import C_SHOW
class WorkspaceViewMeasurementRow:
"""Container for measurement controls"""
def __init__(self, panel, grid_sizer, r... |
1ddea2392b39bae5831dc16e07f0d4e55c9bc8cf64b543beac3f31bfcb49a7da | Python | 9,902 | 279 | # -*- coding: utf-8 -*-
"""
pysteps.motion.lucaskanade
==========================
The Lucas-Kanade (LK) local feature tracking module.
This module implements the interface to the local `Lucas-Kanade`_ routine
available in OpenCV_.
For its dense method, it additionally interpolates the sparse vectors over a
regular g... |
d3a4dce39699c5e4ab73c8837c8cd97eb85815f3e42fae21f3415b54bc5383f9 | Python | 9,922 | 345 |
from __future__ import division
from brian import *
from numpy.fft import rfft,irfft
from scipy.special import erf
from pathlib import Path
from collections import Counter
import matplotlib.pyplot as plt
from circ_stats import *
import random
import os
fig_size = zeros(2,)
fig_size[0] = 12
fig_size[1] = 9
plt.rcPara... |
470d085df6f6afbdae878d5b62ce115d2844cc3d55acbfbbb979803475cd2dbb | Python | 9,924 | 264 | from functools import partial
from typing import Any, cast, Dict, List, Optional, Union
import torch
import torch.nn as nn
from torch import Tensor
import torch.nn.functional as F
CFGS = {
"A": [64, "M", 128, "M", 256, 256, "M", 512, 512, "M", 512, 512, "M"],
"vgg13": [64, 64, "M", 128, 128, "M", 256, 256, "M... |
597a275bcddca3d0f9665ac64b5d273c5e41151aab4f7b8fc9f147053931cc20 | Python | 9,924 | 282 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 14:55:23 2017
@author: Nikolai M Chapochnikov
"""
# timing stuff
# start_time = timeit.default_timer()
# do something
# elapsed = timeit.default_timer() - start_time
# print(elapsed)
# %%
# ###################################################... |
e0c1cb001dedc0dade3d11c26feb00722cbf30cf30823c1e63194c434004c0c6 | Python | 9,924 | 344 |
from __future__ import division
from brian import *
from numpy.fft import rfft,irfft
from scipy.special import erf
from pathlib import Path
from collections import Counter
import matplotlib.pyplot as plt
from circ_stats import *
import random
import os
fig_size = zeros(2,)
fig_size[0] = 12
fig_size[1] = 9
plt.rcParam... |
1af196f0b73f11507a8500178f5efbe7d1d671ef65fb80d9276274cc049c38e8 | Python | 9,928 | 244 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
f667ee8e687779d0b3b14234b182460a1a24467300d5db41da056a08b5885495 | Python | 9,929 | 324 | import os
import numpy as np
import torch
import torch.nn as nn
# if args.adjoint:
from torchdiffeq import odeint_adjoint as odeint
# else:
# from torchdiffeq import odeint
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_siz... |
7bd1a1c6279ee2cdbe9910bafd5699265655a70823e8e49e7609891bda1558a3 | Python | 9,944 | 244 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
328b7577f9f93b079b48c44104553214e2e56e368ac39b733a225c06b92d14c7 | Python | 9,945 | 225 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
440f0b7ab3af07abdd0905a8dcf3fca87b39f25c0d751ce81f005a890b9b4dd5 | Python | 9,947 | 244 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
ea30af27cc9a5615fa742da2dc5cd10d8dd6bd2102ba6f83bf08b6f33f5dcb9f | Python | 9,948 | 252 | import numpy as np
from PIL import Image
import os
import io
import json
import glob
import h5py
from torchmeta.utils.data import Dataset, ClassDataset, CombinationMetaDataset
from torchvision.datasets.utils import download_file_from_google_drive
from torchmeta.datasets.utils import get_asset
class DoubleMNIST(Combi... |
0f1a7e0b38df199f1b6816dd1826348b49b036732eed71bbc4db6baf126586d1 | Python | 9,953 | 275 | import numpy as np
from scipy import ndimage
from .dataset import Datasets, Dataset
# CONSTANT WHERE TO FIND THE DATA
from config import VESSEL_DIR
import SimpleITK as sitk
import os
import pandas as pd
import os
from .dataset import Datasets, Dataset, GraphDataset
import torch
from torch_geometric.data import (Datase... |
2e7dced87df52b2dba713d614f5cb7642c0a3c828fecc0ef932467439cf6a108 | Python | 9,959 | 252 | import numpy as np
from PIL import Image
import os
import io
import json
import glob
import h5py
from torchmeta.utils.data import Dataset, ClassDataset, CombinationMetaDataset
from torchvision.datasets.utils import download_file_from_google_drive
from torchmeta.datasets.utils import get_asset
class TripleMNIST(Combi... |
0ae729a388690e6ba6bc65e9095eeeb52c03409698c08e076c02801ac863c255 | Python | 9,960 | 319 | """Regenerate regression fixtures by running PTSA's load-bearing
operations against deterministic seeded inputs.
Run this with the *current release-candidate* ptsa we want to lock
in as the regression baseline. As of 3.0.6 this is the local conda
build in `build/conda/linux-64/ptsa-3.0.6-py311_0.conda`. Use the
pixi e... |
f27547916bcc8f2166f3f90d711030473ab5d369aa79b67c9949621a0f97c740 | Python | 9,975 | 257 | import numpy as np
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.maskimage
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
MASKING_IMAGE_NAME = "maskingimage"
MASKED_IMAGE_NAME = "maskedimage"
IMAGE_NAME = "image"... |
7634acf8c4c8a3b897bbe700c4c10054e64cdc883bae8c5b7f672436bc3a6e09 | Python | 9,976 | 245 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
cc1ab8373e69fdf52e81fcc29560b5f225d602e794da6de1e17f6d37e24d1162 | Python | 9,981 | 238 | import time
import scipy.io as scio
import torch
from braincog.base.node.node import *
from braincog.base.brainarea.BrainArea import *
import pandas as pd
import matplotlib.pyplot as plt
device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")
class brain_region(BrainArea):
def __init__(self, name,... |
7045fc26699c661501fb109bcd7cb0bca917b97da6c0e8a955418c0f431acbc5 | Python | 9,985 | 244 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
28c4b41172ba80c2623cfbd24f44fa9586b67d71ded5c05b4f53214039db7d3d | Python | 9,986 | 301 | from __future__ import annotations
import hashlib
import json
from collections.abc import Iterator, Mapping
from contextlib import contextmanager, suppress
from pathlib import Path
from typing import Any
import pytest
from conftest import CONFORMANCE_ARTIFACTS_BY_SHA256, CORPUS, LIBSVM_OPTIONS, OPTIONS
from hypothesi... |
b09bf832e079bea830bf65da178818152d4363ff27d5e6164a606fb20598ab56 | Python | 9,986 | 212 | """Dataset-level classification evaluation shared by training and validation."""
import logging
from collections import OrderedDict
from typing import Optional
import torch
import torch.distributed as dist
import torch.nn as nn
_logger = logging.getLogger(__name__)
def evaluation_sample_limit(loader) -> Optional[in... |
3fd4ff58f29d2bcf9b0b6927e87b1a8d57aa60c73c19b4996740905b35dc0230 | Python | 9,991 | 312 | import numpy as np
import matplotlib.pyplot as plt
import h5py
from scipy.cluster.hierarchy import dendrogram, linkage, fcluster
from scipy.stats import spearmanr
from bob_stim import get_stim #, get_model_features, compute_similarity_matrices
from keras.applications.vgg16 import VGG16
from keras.applications.vgg16... |
483b1083e76b6e0368eaa1ea54042c4397ffa11f093810b5ff21ae853724924f | Python | 9,994 | 223 |
from pathlib import Path
import json
import torch
import torch.nn.functional as F
import pytorch_lightning as pl
from torchvision.utils import save_image
from pytorch_lightning.utilities.cloud_io import load as pl_load
from pytorch_lightning.utilities.migration import pl_legacy_patch
from pytorch_msssim import ssim
f... |
5b6e372e8ee66b084c907c847cbd5b2c6e19fac5b610c11f8018a9ed50a09636 | Python | 9,999 | 262 | import torch
from torch.utils.data import DataLoader
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbacks import TQDMProgressBar
from ray import tune
from ray.tune.integration.pyto... |
f4519b813214e887ab595002766eaa69df08ff9587e543eeac871faabe1b1810 | Python | 10,002 | 229 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 14:32:32 2018
@author: saskiad
with paw_plot code from davidf and savefid code from dougo
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatch
from matplotlib.collections import PatchCollection
import matplo... |
308a0601495ed11998bd490ad80b005c4342c8955682c29c6a9d2c0d9c73b2db | Python | 10,009 | 262 | from typing import Literal
import numpy as np
import scipy.stats as sciStat
from SALib.sample import sobol
from SALib.util import _check_groups, compute_groups_matrix, scale_samples
def OAT_sampling_radial_SobolSequence(problem, rN, shift: int = 4, method: Literal['radial', 'trajectory'] = 'radial', base2: bool = Tr... |
7dccce846987ce7d5784d2b9b0c9e07c45ffc9d090c82ebde77668aecbea1120 | Python | 10,015 | 336 | import itertools
import json
import os
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Any, List, Optional, Tuple
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.ranking import run_ranking_categorical, run_rank... |
da38d90feec9e62051eceeb1585b8c1251a9e41e54810aa22f1f6157a54a0369 | Python | 10,022 | 304 | import numpy
import numpy.testing
import pytest
import scipy.ndimage
from skimage.feature import peak_local_max
import cellprofiler.modules.findmaxima
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace... |
1dc2c0a7ab2fc5048ed73d7da79eb7bd6e548e8c0a7bc73dd7b37890b207fad0 | Python | 10,028 | 267 | import copy
import json
import os
import warnings
from typing import Any
import pandas as pd
from ptsa.data.common import pathlib
from six import string_types
__all__ = [
'JsonIndexReader',
]
class JsonIndexReader(object):
"""
Reads from one of the top level indexing files (r1.json, ltp.json)
Allow... |
a2f12d954680c44eedbd9a764b0b282338e019494c69dfb841edaa7ba661c1bc | Python | 10,038 | 322 | # -*- coding: utf-8 -*-
#
# comparison_schemes.py
#
"""
Features extraction script.
"""
__author__ = "Ahmed Albuni, Ngoc Huynh"
__email__ = "ahmed.albuni@gmail.com, ngoc.huynh.bao@nmbu.no"
import argparse
import logging
from csv import DictWriter
from os import listdir
from os.path import isfile, join
import numpy... |
057b37286891479f09ff7199d978e7ef6474f2de75dd25e93598159171024c54 | Python | 10,050 | 268 | import cv2
import torch
import numpy as np
import torchvision.utils
import torch.nn.functional as F
import matplotlib.pyplot as plt
import itertools
def createRGBGrid(tensor_list, nrow):
"""Creates a grid of rgb values based on the tensor stored in tensor_list"""
vis_tensor_list = []
for tensor in tensor_... |
eb43b687cc839d42e575e6bc356b8470d032f703e51424c0e443d70faf6be39a | Python | 10,055 | 287 | """Training module for SVAE model
Author: Hikari Sorensen - Vector Engineering Team (hsorense@broadinstitute.org)
Notes:
"""
import os, re
import numpy as np
import pandas as pd
import tensorflow as tf
from datetime import datetime
from pathlib import Path
from svae.predict import predict
from utils.loss import los... |
8b1e0fddae9af6e188b88a63587fd3a3a7a3fe11c24549a6fd6c424262626df4 | Python | 10,065 | 246 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 7 22:08:15 2018
@author: saskiad
"""
import numpy as np
import pandas as pd
import os, h5py
import scipy.stats as st
import core
def do_sweep_mean(x):
return x[28:35].mean()
def do_sweep_mean_shifted(x):
return x[30:40].mean()
# class event_analysis(object):
... |
f592e83ce0383fdf4206fd8245b31156979beadc8c33213cfe01f9586aff6981 | Python | 10,072 | 198 | """test_rules - test the CPA rules parser
"""
import unittest
from io import StringIO
import numpy as np
import pytest
import cellprofiler_core.measurement
from cellprofiler.utilities.rules import Rule, Rules, scores_from_measurements
OBJECT_NAME = "MyObject"
M_FEATURES = ["Measurement%d" % i for i in range(1, 11)]... |
e3f7705d46f19f96f86b5ad2cd6529a80a0170322419455872d0aefc1c3c2267 | Python | 10,078 | 291 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for standardize.py"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import logging
from molvs.standardize import standardize_smiles
logging.basicConfig(level=logging.DEBUG)
def test_aromaticity()... |
6f70d05475dd8f60e58d4e4b7cad1c561f5f27ef8a54c38486506f36761ecb57 | Python | 10,079 | 223 |
#!/usr/bin/env python
import PyDSTool
import numpy as np
import pickle
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter,ScalarFormatter
import matplotlib as mpl
from matplotlib.lines import Line2D
'''
Impact of having a different ratio of ANTs/ATP synthases. This script generates Figur... |
2367ad1dedf7518e0569ead52bdb2d0ab1b6a095f1e7808d9810f14b041f0cad | Python | 10,088 | 263 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 13 13:45:49 2021
@author: andrey
"""
import itertools
import numpy as np
from megsimutils.utils import spherepts_golden, pol2xyz
from megsimutils.arrays import SensorArray
MAX_OFFSETS = 10 # integer, maximum number of different offsets to try w... |
ae019fbe014c519835849add291adcc1d2ef2006a21b10f5925d04454f191623 | Python | 10,101 | 306 | # -*- coding: utf-8 -*-
#
# Neuronaldynamics Exercises documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 18 11:18:44 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autoge... |
81ea267ca6219b017fc20cecf95c37b97f6987f1c54ca812d9d2142f2d1f66a9 | Python | 10,103 | 347 | import numpy
from cellprofiler_library.functions.image_processing import crop_image_similarly as _crop_image_similarly
class Image:
"""
image - a Numpy array
mask - a binary image indicating the points of interest in the image. The
mask is the same size as the child image.
crop_mask - the binar... |
db98f1092b1cbb04e715b68d07f6d71a13f82ada21a72241ca2723607df1cfa3 | Python | 10,117 | 247 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
0add17c897f4d1cafa5a377f5657ab71e798a3c7de979136c5509e5bc2b3e381 | Python | 10,119 | 264 | from __future__ import absolute_import
import numpy as np
import unittest
import centriole.lapjv as LAPJV
from centriole.filter import permutations
class TestLAPJVPYX(unittest.TestCase):
def test_01_01_reduction_transfer(self):
"""Test the reduction transfer implementation"""
cases = [
... |
4c72002d2235e7f210fccecf7e866f63835164eb2732a596466d6d54f6c58ffd | Python | 10,125 | 240 | import numpy as np
import os.path as ospath
import os
import h5py
import time
from pathlib import Path
import torch as tc
from torch.utils.data import TensorDataset, DataLoader
def save_data(hp_dict, base_points, neck_points, nose_points):
from scipy.io import savemat
db = {'base_points': base_points,
... |
4eaee8352e7fa46c0e9be443c4dcd418cb0d84eb1f8dedd1a08ebe4a83f461ab | Python | 10,133 | 247 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
0d01ed6435c2d8beaa3d06904e91733eb3c83804abab068c8bead3d160e3dcea | Python | 10,142 | 226 | import os
import numpy as np
import pandas as pd
import tqdm.auto as tqdm
import scipy.stats
import tensorflow as tf
import sklearn.linear_model
from sklearn.preprocessing import QuantileTransformer
from .architecture import neurite_classifier
from .data import enforce_4D, pattern_png_loader, convert_to_sobel
LABEL_... |
44d5b78af2b642f2f6954aef39dd78dd4490615b6b2ccb4f998efe3cd0a7f257 | Python | 10,146 | 274 | #!/usr/bin/env python3
"""
Contains the QC settings dictionary for all cifti_vis scripts, as well as
a class to make access to settings easy to read.
"""
import os
import sys
import logging
from abc import ABCMeta, abstractmethod
from PIL import Image
import yaml
import ciftify.config as config
from ciftify.utils imp... |
2a6eb1bb4ae63e99c6368a799cda50850c0f5b4b4997d439b375b55e7f086327 | Python | 10,149 | 258 | """Tests for nidm_queryai helpers that don't require an AI/API call."""
from __future__ import annotations
from pathlib import Path
from click.testing import CliRunner
from rdflib import Graph
from nidm.experiment.tools import nidm_queryai as _qai
from nidm.experiment.tools.nidm_queryai import (
_build_determinist... |
24d9c63a5e543ca7272666550a9a6498144437103877342d152dc19d70600528 | Python | 10,157 | 249 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
f981fa402d33a0ffa901d63d97fd7fd9bcc38552cdbe84f4128785fac8e5e746 | Python | 10,163 | 285 | import re
from cellprofiler_core.setting import _setting
from cellprofiler_core.setting._validation_error import ValidationError
from ._compound_filter_predicate import CompoundFilterPredicate
from ._filter_predicate import FilterPredicate
from ._regexp_filter_predicate import RegexpFilterPredicate
AND_PREDICATE = Co... |
245cf475e6f3dbd187eaae2e87877598af9ec0f6fdeee9b2c8274c4703d68fe9 | Python | 10,165 | 317 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
be348ee04435afdb9dc23dea413e60f12d801a420e9e26b1b2f5e8b6d8c44469 | Python | 10,165 | 248 | """ A dataset reader that reads tarfile based datasets
This reader can extract image samples from:
* a single tar of image files
* a folder of multiple tarfiles containing imagefiles
* a tar of tars containing image files
Labels are based on the combined folder and/or tar name structure.
Hacked together by / Copyrig... |
775d337016a1f1efd6124670de33fb2c644755dbdcd96d29c19149f088f8829c | Python | 10,166 | 290 | import numpy as np
import pandas as pd
from deeprank.learn import rankingMetrics
def cal_hitrate_successrate(df):
"""calculate the hit rate and success_rate of the different train/valid/test
sets with HS (haddock scores)
The hit rate is defined as:
the percentage of positive decoys that are inclu... |
a79d3dd1b088b2d8a1c296a6af34c06d8da21e812cddc05001ad44387fdfb9ce | Python | 10,166 | 247 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
e4d2aecd4718aadbc8d7998016f8276df9b1e821f172f2c3c12678ce833ca7ac | Python | 10,166 | 219 | import argparse
import json
import os
import csv
import gudhi
import gudhi.wasserstein
import numpy as np
from sklearn.manifold import MDS
from utils import get_dataset, timer, generate_random_initial_dataset, \
write_csv, generate_random_data
from barcodes_calculation import get_0_dim_barcodes
def get_mds(dissim... |
16bcc71d5da3e5370b555b3397ff15d8a813c304fcf81d09c5bc8ff24efb18de | Python | 10,168 | 276 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
6db101e51337251ef27aa70cb1d1ccc148d6ef246c47887c59fb9954967e7ca9 | Python | 10,168 | 226 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
ae1dc1a225b1df489957c3ffa96af32506501d95a2744fdf6e401631db391aee | Python | 10,168 | 276 | import os.path as osp
import sys, os
# sys.path.insert(0, '..')
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
from skimage.measure import regionprops
from skimage.future import graph
from skimage.segmentation import slic, quickshift
#####
# aux libs
from skimage import color
from iterto... |
20156c2d8a38cb6f06e8b79d6cb3d85b288052268bc43e305990f81190b60fa2 | Python | 10,174 | 251 | from typing import List, Tuple
import pandas as pd
from sklearn.model_selection import KFold, StratifiedKFold
from . import parseTrainingCSV, populate_header_in_parameters
def split_data(
full_dataset: pd.DataFrame, parameters: dict
) -> List[Tuple[Tuple[int, int], pd.DataFrame, pd.DataFrame, pd.DataFrame]]:
... |
5fdedaaf984b46a993bef1c0a44493c1bbe1ecfb3e833a584219e823f02e8cc9 | Python | 10,191 | 228 |
"""
evaluate simple transferabl attacks in the single-model transfer setting.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models, transforms
from PIL import Image
from tqdm import tqdm_notebook
import numpy as np
import scipy.stats as st
from utils... |
b91e6aec319c114c2a220e48e527a57da7895531ed034e3e2c4c4ce41f90b0b3 | Python | 10,192 | 196 | #! /usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys, os, glob, gzip, time
from functools import partial
from importlib import import_module
## Math
import numpy as np
import scipy as sp
## tensorflow imports
import tensorflow.... |
484320ed67c3243a98686c60a234c9c0cee4dbd199871c1b6d08d6cadd0ec45f | Python | 10,194 | 189 | """
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Filtlong
This module contains some tests for Filtlong. To run them, execute `python3 -m unittest` from the
root Filtlong directory.
This file is part of Filtlong. Filtlong is free software: you can redistribute it and/or modify
it under the ter... |
186440b8b5554bfac8456d411f9d31404e41e1af0dd58dab96f409076dc63b44 | Python | 10,200 | 243 | # -*- coding: utf-8 -*-
"""
pysteps.io.interface
====================
Interface for the io module.
.. currentmodule:: pysteps.io.interface
.. autosummary::
:toctree: ../generated/
get_method
"""
from importlib.metadata import entry_points
from pysteps.decorators import postprocess_import
from pysteps.io i... |
900baaa216ff2d3058db7ef28f390f1803aa459a6ae1b6fb923e00db0ff473b2 | Python | 10,205 | 322 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
05d0def82be9ddb9266f0ab232db9448f097cab33bdbc5c63c414c83f480d012 | Python | 10,219 | 222 | #!/usr/bin/env python3
# Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera
#
# 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
... |
375726abb4d3bae8e5fa365bcbe123bd08bb63d5b459c494cae7336ea107e540 | Python | 10,220 | 263 | # Modified version:Vajira Thambawita
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Transpose1dLayer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1):
super(Transpose1dLayer, self... |
f1cdb0effaa11dcaa14e7d7be3a8fedb0248508249a7259531133cb05561575d | Python | 10,221 | 334 | import numpy
import cellprofiler_core.constants.measurement
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.module
import cellprofiler_core.module.image_segmentation._image_segmentation
import cellprofiler_core.object
import cellprofiler_core.workspace
class TestImageSegm... |
f9a8ffb1a50018b13ba9da3a440f201194ae2bb9854cb4443a2c27754a9b8959 | Python | 10,234 | 328 | """
Created in 2021
@author: Nikolai M Chapochnikov
this generates several results that are then plotted in the paper:
the files in dataset1 and dataset2 (related to changing rho and K
to see the effect of the correlation of W) and dataset3 (use for figure 6)
"""
# %%
import itertools
import numpy as np
import pan... |
85bc58c905b30b0c163b925e59c047034aa82f63ac82aebb746b56b632c91ccc | Python | 10,239 | 224 | import csv
class Reaction:
def __init__(self):
self.conditions = {}
def addReagent(self, var, value):
self.conditions[var] = value
def printConditions(self):
print(self.conditions)
def getVariables(self):
return self.conditions.keys()
class Plate:
def __init__(... |
eff259ae77941d66d64275819aadc7d7338b2398837ced384d824d5eee31780a | Python | 10,242 | 277 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
befabbb79ea61377bcda04c1dc1d8e1e4a87a3c1399afc73d3d219b533ac753e | Python | 10,243 | 264 | from __future__ import annotations
import time
from typing import Iterable, Optional, Union
import numpy as np
import numpy.typing as npt
import traits.api
from ptsa.data.timeseries import TimeSeries
from ptsa.data.filters import BaseFilter
from ptsa.extensions import morlet
class MorletWaveletFilter(BaseFilter):
... |
80df460b3703a3d5e826542c0201b1a8b31529ba6fe7a307c393884dd420486e | Python | 10,247 | 247 | import os
import numpy as np
import scipy.stats
import pandas as pd
import matplotlib.pyplot as plt
#############################################################
code_directory = '/home/joshs/GitHub/neuropixels_platform_paper'
###################################################
dataDir = os.path.join(code_d... |
9b129500ea354bb5c0c19f715efd0e40e42779aaddfc70f86b01c9417a5e89d7 | Python | 10,250 | 250 | import sys
import matplotlib.pyplot as plt
import numpy as np
import datetime
from tqdm import tqdm
from dragen.utilities.InputInfo import RveInfo
from dragen.utilities.Helpers import HelperFunctions
class Tesselation3D(HelperFunctions):
def __init__(self, grains_df):
super().__init__()
self.gr... |
06ac4ca44d59e71e4f25959921e91675e722b479b829c7504e400f268419c05a | Python | 10,277 | 266 | import tensorflow as tf
from tensorflow.keras.layers import Conv2D, BatchNormalization, Dense, MaxPool2D, Dropout, Flatten, concatenate, Add
from abc import ABC, abstractmethod
class SubnetABC(ABC, tf.keras.Model):
@abstractmethod
def build_graph(self, input_shape):
raise NotImplementedError("Subclas... |
f67e332b2ddbf9bb24e96e972b0fbe66a33b2fcc2dd9a636df0d4ae901e3de66 | Python | 10,278 | 271 | # -*- coding: utf-8 -*-
r"""
pysteps.timeseries.correlation
==============================
Methods for computing spatial and temporal correlation of time series of
two-dimensional fields.
.. autosummary::
:toctree: ../generated/
temporal_autocorrelation
temporal_autocorrelation_multivariate
"""
import n... |
82f34004193dfdef441f7da5de4e8d5ad78e5954d6b1e485c2b02e2c7b74be86 | Python | 10,289 | 223 | #!/usr/bin/env python3
# Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera
#
# 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
... |
bb80f45bfb3122fbed6d723fba802ba4c6ebf7020aa3f5ce3ce08b1cda843749 | Python | 10,301 | 299 | # -*- coding: utf-8 -*-
"""
pysteps.utils.conversion
========================
Methods for converting physical units.
.. autosummary::
:toctree: ../generated/
to_rainrate
to_raindepth
to_reflectivity
"""
import warnings
from . import transformation
# TODO: This should not be done. ... |
5ba161ffc3ff8e861aa3257ef52c969b30aaa7e76f545874c4ccca085aa7b56c | Python | 10,302 | 251 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
13a7a924f5fa5ad69f4a5e4dd36d3fecc983f5a959da25dbd486ad0588c4c6c3 | Python | 10,308 | 249 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
c20e6bc30a18af13d27a8307522edf7c5fe741a20f410573e928270d0fdf585c | Python | 10,313 | 290 | from enum import Enum as PyEnum
from traitlets import Float, Integer, default
from traitlets.config import Bool, Enum, List
from traitlets.config.loader import ConfigError
from mrHARDI.base.application import (DictInstantiatingInstance,
mrHARDIConfigurable,
... |
9bf24a1b09a3ea9e024ea59c83e37ce5472157dd9b81996684011df3faeaacde | Python | 10,314 | 263 | import wx
import wx.lib.rcsizer
from ._module_view import ModuleView
from ..utilities.module_view import edit_control_name
class JoinerController:
"""The JoinerController managers a joiner setting"""
#
# It's important that DISPLAY_NONE be an illegal name for metadata
# so that it can be recognized ... |
8251b54b49bf3bc9f55fd3af1f0816b60494ec429f5c97133bffd0db12768c36 | Python | 10,316 | 263 | import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.run import new_way, old_way
from . import CliCase, run_test_case, TmpDire, TmpFile, TmpNoEx
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check if this function is called
# with ... |
13d62ac41c6ba9e652ff7b067c25e850a5b9bbffbe409dee56533a44f8080636 | Python | 10,325 | 250 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
8fbffd34b163c7932efbc9b334c5841a7bf8462e9a4f7b34f24b049a3655f878 | Python | 10,325 | 337 |
from __future__ import division
from brian import *
from numpy.fft import rfft,irfft
from scipy.special import erf
from pathlib import Path
from collections import Counter
import matplotlib.pyplot as plt
from circ_stats import *
import random
import os
# function for circular boundary conditions
# return the normal... |
0ea224da279f93a9bb3467aee6b1b8b4b0995cb9a8ecef92952174d8ddba1670 | Python | 10,326 | 371 | #!/usr/bin/env python3
import os
import sys
from itertools import combinations, product
import identification as ide
import numpy as np
import pandas as pd
import pkg_resources
from etspredict.pipelines.ioutils import IOManager
from etspredict.prepare_data import prepare_connectomes as pc
def load_subject_list(dat... |
43da8724cdb256b37bdb8fde771fd05cb06956a8a74c3d29398aac23eb8a05bd | Python | 10,328 | 265 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
c28880520d72bf7e43efd1e7936eee540c3f8cb0cc828d240f079e8d1ea0b125 | Python | 10,328 | 250 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
721f84ba13a202d2fd81d27ef7892e75a2125f246de6ecbc5d7f12d5c9e9b730 | Python | 10,332 | 250 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
bd40dd3e304828ae26aa7def74fa26ff7a88a60e8144a0f19a779aaf87bdb558 | Python | 10,335 | 274 | from rdkit.Chem import AllChem
import pandas as pd
import sys
from module.pair_generation_top import Generator
from module.pair_generation_all import Generator as Generator_all
from module.paired_dataset import Dataset
from torch.utils.data import DataLoader
from rdkit import DataStructs
from rdkit import Chem
import... |
8eea04c13c0a13a98af06052f9d6c9b799c492ca70de92622376b6cf4282f473 | Python | 10,338 | 192 | #### Master Script 04b: Compile predictions of dynamic all-predictor-based models ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Compile and save validation and testing set predictions across partitions
# III. Determine top-performin... |
ca56265f2d263a23adea7b61518693186f087c26414ea5d59d4e523ec8084b65 | Python | 10,343 | 299 | import torch
from torch import nn
import cv2
import multiprocessing
import numpy as np
import glob
import os
from scipy import linalg
import warnings
from torch.optim import Adam
from torch.utils.data import DataLoader
from torchvision import transforms
import json
# Torchgan Imports
import torchgan
from torchgan.mode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.