sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
859c1bb55ab8079065bbac274728cf51cff8f66fb3f38722156b37207834c7c5 | Python | 14,291 | 355 | import os
import ipytree
import ipywidgets as widgets
import numpy as np
from IPython.display import display, Markdown
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
import matplotlib.pyplot as plt
from aggregate_cell_data import get_struct_aggregates, acronyms
from explorer.explorer_utils ... |
f39c21e5ae5ff26b901ab3a8ae4100bb828558cf2e837810aa2194eacfa9dbf2 | Python | 14,294 | 387 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import math
from typing import TYPE_CHECKING
import numpy as np
from onnx.reference.op_run import OpRun
if TYPE_CHECKING:
from collections.abc import Sequence
def get_pad_shape... |
a48a85ccf85424697aa101baed999bbbf1c753ec37713624b13ffc0bc37fd8fe | Python | 14,305 | 436 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
b8b4950ba55d94f0606561194d738ea01dd7b802e76fd01f366ac15ac62bfc47 | Python | 14,306 | 415 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
fd83a37fb0b4d71bc8b2bf8f3638ff2c31aae1ccb6a817ec2215f6b9524ecc48 | Python | 14,310 | 400 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
ddd02dd9feb987160b12f0dcaffa94894b2593b71b4b1d6911a59f88c634df9a | Python | 14,315 | 376 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
5bc4d24af8dc954b93c73191464351ccb3c099c2fc83bb1f8026a957cb96f3b9 | Python | 14,316 | 363 | import time
import numpy as np
import argparse
from copy import deepcopy
from scipy import interpolate
parser = argparse.ArgumentParser('Preprocessing: Generate training/validation/testing features from pdb')
parser.add_argument('--MDfolder', type=str, default="data/pdb/",
help='folder of pdb MD')
... |
7e774b0fcfa19e2d4a296d9cf57d7a8be17bf98f4d6d9de222e38b7bf9dc2d89 | Python | 14,324 | 322 | """
@file: gluon_alpha_zero
Created on 20.09.18
@project: jc39qevo-deep-learning-project
@author: queensgambit
Description of the alpha zero architecture for gluon:
Mastering the game of Go without human knowledge, Silver et al.
'The input features st are processed by a residual tower that consists of a single
convo... |
0957d62d0efa69a58c7a985a1d5d8b092240adde873ff45ac427a8a9823485d7 | Python | 14,344 | 380 | import argparse
import functools
import random
from pathlib import Path
from time import time
from typing import Dict, List, Optional
import numpy as np
import networkx as nx
from joblib import Parallel, delayed
from tqdm.auto import tqdm
import cupy as cp
from gluonts.dataset.arrow import ArrowWriter
from sklearn.gau... |
25b691c7ad48e4d185f48e28602c3f28525cfca40a78a40f2ba1d914fb7ce11f | Python | 14,361 | 345 | import torch
import torch.nn as nn
class Basset(nn.Module):
"""Basset model from Kelley et al., 2016;
see <https://genome.cshlp.org/content/early/2016/05/03/gr.200535.115.abstract>
and <https://github.com/davek44/Basset/blob/master/data/models/pretrained_params.txt>
"""
def __init__(self,... |
be899b831a54298041cc378e47bc9a03bbc4e98d8bdeae7bc0641c408a8b37c6 | Python | 14,368 | 388 | import logging
import numpy as np
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.tf.misc import normc_initializer, get_activation_fn
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.policy.rnn_sequencing import add_time_dimension
... |
e7e917b82c37f518ee8ba29d709b6d6148cec9ddc5d3ce2e1f6b8e855ca518f5 | Python | 14,387 | 552 | #!/usr/bin/env python
#
# Copyright 2009 Neal Norwitz All Rights Reserved.
# Portions Copyright 2009 Google Inc. 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
#
# ... |
0bb64891faec1765f2926ef3213f297bd4f34b09c5bedddcba57ac4e9c9f3843 | Python | 14,391 | 325 | from __future__ import print_function
from freqAnalysisTools import band
import json
import numpy as np
class ParameterSetup(object):
def __init__(self, paramDir='', paramFileName='', outputDir=''):
self.paramSetupType = 'directories'
pathFilePath = open('path.json')
p = json.load(pathFil... |
bec00a8bcae80412a276ce040f11dfefde5b7e6590ea721cd8b17176bd815751 | Python | 14,394 | 340 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from networks.ShakeDrop import ShakeDrop
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kerne... |
8c80267a914611e617f7ede6dd32cf7fbfedcf426c6f7c02131b89d052f37ad6 | Python | 14,396 | 297 | """
@file: rl_loop.py
Created on 12.10.19
@project: crazy_ara
@author: queensgambit
Main reinforcement learning for generating games and train the neural network.
"""
import os
import sys
import logging
import argparse
from rtpt import RTPT
import dataclasses
from multiprocessing import Process, Queue
assert os.getc... |
2cd3445835eb1e645597e272c2df720e3265c5c2184685ff28ddeb8d6e22eadf | Python | 14,405 | 418 | import numpy as np
from scipy import linalg
def sskf(y, a, f, q, r, xs=None, use_lapack=True):
"""Computes steady-state smoothed distribution
y_{i} = fx_{i} + n_{i} n_{i} ~ N(0, r)
x_{i} = ax_{i-1} + u_{i}, u_{i} ~ N(0, q)
Parameters
----------
y: ndarray of shape (n_samples, n_channels)
... |
60ad40ca62f4c563c149f2f2c1b9e543f672cd71584c0eebfb4680813ea86899 | Python | 14,406 | 370 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Carry-all NeighborGraph builder backed by nvalchemiops (GPU cell list).
World-2 counterpart of :mod:`deepmd.pt.utils.nv_nlist`: instead of building the
dense extended quartet, it decodes nvalchemiops' dense
``(total_atoms, max_neighbors)`` neighbor matrix into flat per-f... |
1d4d899b312e7b7bfcc914091b05c97c2ebfeb7d662fce21a52c5d5038b06e59 | Python | 14,411 | 409 | """WEASEL classifier.
Dictionary based classifier based on SFA transform, BOSS and linear regression.
"""
__author__ = ["patrickzib", "ermshaua"]
__all__ = ["WEASEL"]
import math
import numpy as np
from joblib import Parallel, delayed
from scipy.sparse import hstack
from sklearn.linear_model import LogisticRegressi... |
14d0d48136a520ea2962d94045660596dd817270a1135a5c5f549d9bba277f9d | Python | 14,415 | 338 | import logging
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Optional, Union, cast
import torch
from torch.utils.data import Dataset
import flair.data
from flair.data import Corpus, Sentence, Token
from flair.datasets import DataLoader, FlairDatapointDataset
from flair.file_util... |
61bebc2c5d137794c9fb99e220029d22e531d7fb9e51c8b823fa742eee8f533b | Python | 14,422 | 362 | from __future__ import annotations
from collections.abc import Sequence
import importlib
import sys
import warnings
from _pytest.logging import LogCaptureFixture
import numpy as np
import pytest
import torch
import optuna
import optuna._gp.acqf as acqf_module
import optuna._gp.gp as optuna_gp
import optuna._gp.optim... |
769a2f197d19a9cb61e5ba24c59fb187b079b2fc829762e08460b225e1b95993 | Python | 14,425 | 425 | import logging
import warnings
import numpy as np
import matplotlib.pyplot as plt
import torch
import os
import os.path as osp
import pandas as pd
def get_output(encoder, decoder, data, covariance_test=True):
"""
Get output and all internal features from the autoencoder.
"""
latent_features, encoder_n... |
a5ebc81a18c4ae244340f6bd47285a0fc41aeaeabc5bf48b316fbac0dff19320 | Python | 14,430 | 389 | # Copyright 2022 DeepMind Technologies Limited
#
# 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 agr... |
dfc79383ec5eaf962cde3ecd6b8b48921dcaa3ac5c3820298e918dc15f1cf899 | Python | 14,443 | 478 | # augmentation for the Unet structure. Applied in the LM dataset
# check the status of GPU
from tensorflow.python.client import device_lib
local_device_protos = device_lib.list_local_devices()
[print(x) for x in local_device_protos if x.device_type == 'GPU']
DOCUMENT = False
TRAIN = 2 # training epochs num
# neptu... |
e4bdb5d3c65f8dc034b4a55b19a7c66ad70be09d3c582ce41f66ade50f41093a | Python | 14,452 | 412 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
5f7d5ed196226b7b814cc0f071bceed7e560a94a3df6531f2d8f8ba1a6ba201e | Python | 14,461 | 415 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agr... |
1ccffcfe36a9c6fd9711f3efa9023e876855a81b90a1a4197aa3a26fb5bc9574 | Python | 14,463 | 372 | # -*- coding: utf-8 -*-
# from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import argparse
import JH_utile
# import JH_DataAug
import JH_net_par... |
72292292cd67b9d652010f6a7a95eeffde8c265be000e8141225b5bc40699095 | Python | 14,476 | 428 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""PyTorch LMDB dataset — thin wrapper around framework-agnostic LmdbDataReader."""
import functools
import logging
import warnings
from collections.abc import (
Iterator,
)
from typing import (
Any,
)
import torch
from torch.utils.data import (
DataLoader,
... |
d49cfd45fb3998b5f920f67eb4e75234b8b0d50f155b143e77fe2985924e939f | Python | 14,478 | 551 | # tifffile/examples/earthbigdata.py
# Copyright (c) 2021-2022, Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyrig... |
273ae7a01f06d17ba97df3fc9a7c04de81d89878e8d8cce7e3ea579d9d91e8ec | Python | 14,480 | 387 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
91df72ae82caa6763e37a86831582d1cae2955d81e1aa86969de06cb1632e8b5 | Python | 14,484 | 356 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
6185332e737a5c5b2d59fc4e421e8a2fc59ee6a4334ba00ffd889631d02b3b14 | Python | 14,485 | 342 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Interface to ARIMA from statsmodels package."""
__all__ = ["StatsModelsARIMA"]
__author__ = ["arnaujc91"]
from collections.abc import Iterable
import numpy as np
import pandas as pd
from sktime.forecasting.base.ada... |
48334d245f1f653113de9b4e1276a388d10f9a4c7b6d154824e1d41e1e87b269 | Python | 14,490 | 378 | import os
import pandas as pd
import numpy as np
import math
import pickle
from scripts import feature_util
from sklearn.preprocessing import MinMaxScaler
import scipy as sp
from new_version import redistribute_split
from sklearn.model_selection import train_test_split
def char2int(char):
if char == ... |
c281eb2bd02060360a8383cf9b8e9c6588422d01ef4f72eda3a270c2b4bf5f33 | Python | 14,492 | 402 | # Copyright 2022 The TensorFlow Authors. 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 applica... |
374403a0a074fa2e0395ca32885d8bcdc1159b4c2715e4133bdfcda45dca1480 | Python | 14,499 | 453 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
856d1f1814d81b550463aa9f4226d3731467b07b13367276a233295391fd8e58 | Python | 14,511 | 363 | """parse_hoc.py - parse hoc files using regular expressions in Python.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2017-2022 P... |
84c717314166fd902f1f599528425c670bc69eb22fbf56d9198246678bf7b0ce | Python | 14,519 | 312 | """Functions to compute features across 2 dimensional arrays of data."""
import warnings
from copy import deepcopy
from functools import partial
from multiprocessing import Pool, cpu_count
import numpy as np
from bycycle.features import compute_features
from bycycle.burst import detect_bursts_cycles, detect_bursts_a... |
f6aacd1b7a3a9b8769c181d5392b242f841175d8c2994aa7963d744e98810724 | Python | 14,527 | 373 | """Spatiotemporal DBSCAN."""
__author__ = ["eren-ck", "vagechirkov"]
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.spatial.distance import pdist, squareform
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
from sktime.clustering import BaseCluster... |
82fcb0bcb324f206acbe9e6d6dd15b2932dcb126d9cd2fb41fe4841a308978a8 | Python | 14,528 | 384 | # Copyright 2018-2026
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
37ef90b4ea962d62d9de4da0711d75d287e9ad801d8944dda165ad111b7542e6 | Python | 14,529 | 388 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
aeb9e081c1ea7c1927da64a359ab4fe420d19ea8f283e84f9a5bb8a8089af99d | Python | 14,529 | 328 | """Extension template for parameter estimators.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template.
How to use this implementati... |
2f55a2c0935f59c97dd6db3496573b22ceb8b797ea481372d10ebd55a3cecdf2 | Python | 14,530 | 367 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import build_norm_layer
from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner.base_module import BaseModule, ModuleList
from ..bu... |
f6fe63df4a2633fef94c5a7ab24114671c1d5ba9a9d8454fdc5a01068d5c21ad | Python | 14,532 | 342 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from networks.ShakeDrop import ShakeDrop
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kerne... |
eaad58e34675efcbc265f63ae4b4f0ca2a0ee3476019ec55f5e16f8c6cfc467a | Python | 14,547 | 346 | import os
import logging
import numpy as np
import scipy as sp
import scipy.spatial
import pandas as pd
import torch
import numpy.random
from torch.utils.data import Dataset, DataLoader
from atom3d.datasets import LMDBDataset
import atom3d.util.formats as fo
from utils import batch_stack, drop_zeros
class CormorantDa... |
9214e151c84099c1956fb59f4a9f08eec80fd14530a41e4574824d1ede2508b1 | Python | 14,553 | 413 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op_common_pool import CommonPool
class MaxPool(CommonPool):
def _run(
self,
x,
auto_pad=None,
ceil_mode=None,
di... |
a8db2cc39ffa0568c264378e9ce98c86bf4ce85e44a439b55287c1f6bfff3a50 | Python | 14,553 | 408 | '''
not sure what this dois?
.. codeauthor:: Nicholas Browning
'''
from __future__ import division
from __future__ import print_function
from builtins import str
from builtins import range
from past.utils import old_div
import numpy as np
import argparse
import openbabel
import time
import json
import copy
import ... |
b8e66c97b6eaeda01726808fc3a539808093016ec5eeb4c3d77ad572ce774ec5 | Python | 14,564 | 426 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
try:
from ipywidgets import interact, FloatSlider, IntSlider
except ImportError:
def interact(f):
msg = "Interactive palettes require `ipywidgets`, which is not installed."
raise ImportError... |
ae2e2f1c36eb5963250863260b8b8aa0c0d7e81dab6d4557642e081729ee0113 | Python | 14,572 | 395 | import os
import sys
import stat
import shutil
import unittest
import subprocess
from importlib import import_module
import git
import pytest
from pathlib import Path
#from augpathlib import AugmentedPath as Path
from git import Repo as baseRepo
from pyontutils.utils import TermColors as tc
from pyontutils.config impor... |
f1c3e1df563180ca12795a6f7da39a8490094cdc71796571aa7e347c6e2b7983 | Python | 14,575 | 443 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 15:42:10 2018
@author: wanglab
most functions modified from @tpisano's lightsheet repository
"""
import os, h5py, cv2, zipfile, sys, matplotlib.pyplot as plt, numpy as np, pickle, time, pandas as pd, ast
from subprocess import check_output
from... |
e14c6fa9c0241c19a63f0cb6799c29bb9ef973988c61c07e872cc477e004c921 | Python | 14,577 | 395 | import os
import sys
import stat
import shutil
import unittest
import subprocess
from importlib import import_module
import git
import pytest
from pathlib import Path
#from augpathlib import AugmentedPath as Path
from git import Repo as baseRepo
from pyontutils.utils import TermColors as tc
from pyontutils.config impor... |
7d286be78ce801108c9eac1070c64a68a753a38b71628fd1b26909761eaf6ddc | Python | 14,580 | 501 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
6bf12177483e68a1870a72a6ca940a9d0af86d7853d7c8154e0dd9524acc7017 | Python | 14,581 | 461 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 3 17:17:31 2022
@author: sudhanshu
CAPSIF:G dataset utility files
"""
import os
# from PIL import Image
from torch.utils.data import Dataset
import numpy as np
import sys
import torch
from torch.utils.data import DataLoader
from sklearn.metrics i... |
918aeb407a1936cd5eb0a287497e2c7144856de4ce09b45c90af15da0539f3b2 | Python | 14,586 | 380 | from __future__ import division
import os
import numpy as np
import pandas as pd
import pylab as plt
import pyshtools.expand as shtools
import seaborn as sns
from helper_lib import filelib
class Spectrum(object):
"""
Class for storing and handling the SPHARM spectrum of a surface.
"""
def __init__(... |
2bf6d7afafff1d9902c2d3138cec2bec2c0d0073b2205af7b6d69474b5f4da1b | Python | 14,587 | 465 | import numpy as np
import math
from vtk import *
from vtk.util import numpy_support
#################################################################
# Grid related
def createGrid( size, gridSize ):
grid = vtkStructuredGrid()
grid.SetDimensions( (gridSize,gridSize,gridSize) )
points = vtkPoints()
point... |
6a78a13f8dada03ee71eaa598486286d722443c96df53beb40bb217b9b45b90a | Python | 14,588 | 411 | # Copyright 2019-2020 The ASReview Authors. 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 appl... |
1a323654a2afb9c2935d16e3dbca25bf1f107c1ab9157518a280801105610922 | Python | 14,595 | 365 | from collections.abc import Iterable
from pathlib import Path
from typing import Any, Optional, Union
import torch
from torch import nn
from torch.utils.data.dataset import Dataset
from tqdm import tqdm
import flair.embeddings
import flair.nn
from flair.data import Corpus, Dictionary, Sentence, TextPair, _iter_datase... |
693589355e0276a13decab35752ffc586e78565be4550ce2715022c8eb261dbc | Python | 14,600 | 314 | # -*- coding: utf-8 -*-
import os
import h5py
import numpy as np
from scipy.linalg import LinAlgError
from scipy.stats import gaussian_kde
import matplotlib.pylab as plt
class Qc2p():
"""QC class for 2p movies
Objects contain methods to generate QC metrics from physio movies
data should be contained in ... |
930a50c9772ebe57fa76dadca578ea43b66579f6c135fa57986b06b3c1bc487a | Python | 14,610 | 370 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks.registry import DROPOUT_LAYERS
from mmcv.cnn.bricks.transformer import build_dropout
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner.base_module import BaseModule... |
9de60828742f8c6d6aad99ac3bf8d9b5006c494ae98fbd914c6ac24604dc9385 | Python | 14,611 | 307 | """
2. Cycle-by-cycle algorithm
===========================
Demonstration of the cycle-by-cycle approach.
In the last tutorial notebook, I described the conventional approach for analyzing time-varying
properties of neural oscillations, and in this notebook, we will go over our alternative approach.
The fundamental g... |
1d1903df65f23988bce6a0e1ceec67bb8510bb7f45121143264afa815aabd6fd | Python | 14,615 | 392 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Graph-native isolated references must not allocate a dense sel-sized list."""
import dataclasses
from unittest import (
mock,
)
import numpy as np
import pytest
from deepmd.dpmodel.atomic_model import (
DPAtomicModel,
)
from deepmd.dpmodel.descriptor.dpa1 impor... |
749da3ccc610c002fe972d7f886664e01b01b7d7b733cc5277915e4436071375 | Python | 14,619 | 452 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 la... |
ce0d675ce5bbcf2250504610c0b7b25e1ab7c0f5fc867cc7f5dda4d34b227eb0 | Python | 14,641 | 506 | # -*- coding: utf-8 -*-
import os
import time
import numpy as np
from Bio.PDB.Polypeptide import index_to_one
import pandas as pd
import sys
sys.path.append("..")
from settings import config1
def aa_1_letter_code():
seq=''
for i in range(20):
seq = seq+ index_to_one(i)
return seq
class pdb_funct... |
cefcaf3aeb99bd482a7f66b10c71c333346a8f134bb6a9448f44d16d0334459a | Python | 14,643 | 322 | """
This plots figure 6g of the paper.
This is the psychometric fit of the behaviour output of the trained model after inactivating visual neurons
Internal notes:
This is from notebook 21.25-drift-model-change-decision-threshold
Note that it currently requires xarray == 0.16.2
TODO: there are some pickle files that s... |
8c4406c1d4d14111e051e0a0cd07386154118a313abfa8eb7c65c4448ac4439e | Python | 14,646 | 422 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
833d0c05cf0c62659e93541277aa6b1f81c57271ecbfaf8c1e3a973c4b8159cd | Python | 14,673 | 516 | from typing import Tuple, Union
import torch
import numpy as np
from scipy import stats
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
NUM_BINS = 81 # Number of bins for all histograms
PLOT_FONT_SIZE = 12
def get_magnitude(p, gpu=True):
"""Get the momentum magnitude |p| of the 4-vector.
... |
8302d3a245754f0e2bd2052289e82aee37c24a2f8ac0b84ddcc688f9eb95fd35 | Python | 14,675 | 443 | """
Save AN data from a model file run to an NWB formatted file
-----------------------------------------------------------
In this script, we read a file generated by model_run with the "--saveall" flag
set so that all section voltages (as taken from the middle of the section) are
stored in the file. The first set of ... |
0aced1035b094e99c54731a26ca06abd5d66a4f5974eb39a1bbbd41d0e88de69 | Python | 14,677 | 342 |
#!/usr/bin/python
"""
Test the basic membrane physiology of cell types.
Basic Usage: python test_cells.py celltype species [--cc | --vc]
This script generates a cell of the specified type and species, then tests the
cell with a series of current/voltage pulses to produce I/V, F/I, and spike
latency analyses.
"""... |
058b5dc43ab8586ed560fe447875ec59b2ab00a882afc58a0b7a7a3fbc48c0a6 | Python | 14,694 | 336 | """
This scripts generates figure 3f : Auditory stimulus decoding
Internal notes:
top panel is from : figure-4-paper-w-pip (note to use the newest decoding result!)
bottom panel is from: figure-4-paper-w-pip-reviewer-updates-checkpoint-2021-11-30
"""
import pandas as pd
import pickle as pkl
import numpy as np
import o... |
9fb43fbd58ee19a58717cc58e83a5234741b73b4192232c7b407f6d0b45507b2 | Python | 14,697 | 320 | from src.utilities.DDE_Solver import ddeinttf
from src.solvers.neuralDistDDE_train_HOTs import ncm_arguments, create_batch, create_interpolator, create_dirac_interpolator, add_interpolator, create_validation_set, RunningAverageMeter, history, grad_train_var
import quadpy
import time
import timeit
import sys
import os... |
aa880af5b558011f11dece240e2a632e6451748c347a22c31fd48a556b30f058 | Python | 14,698 | 420 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
bdb61b2ee71ed268174803dae7dd758e64429f7d922c98b3587fa47f667bd467 | Python | 14,722 | 401 | """Pipeline for time series detectors."""
from sktime.base import _HeterogenousMetaEstimator
from sktime.detection.base import BaseDetector
from sktime.registry import scitype
class DetectorPipeline(_HeterogenousMetaEstimator, BaseDetector):
"""Pipeline for time series anomaly, changepoint detection, segmentatio... |
a11f360ec48047297f3cd9d1a0be7825ae8e4a00e412f0ff6f9781cdf6d98d7e | Python | 14,724 | 409 | import numpy as np
import tensorflow as tf
PRECISION = 'float32'
EPS = 1E-8
#
# Description:
#Support function for training QSMnet and DIAM-CNN
#
# Copyright @ Yanqiu Feng
# Laboratory for Medical Imaging and Diagnostic Technology
# Southern Medical University
# email: foree@163.com
#
# Data I/O
def load_nii(filename... |
3266097ed693516eda9002ad0fdba0cf734cdec7e5c45adde12e2bbf21aa68f6 | Python | 14,726 | 329 | """Extension template for forecasting metrics (non-hierarchical).
Purpose of this implementation template:
Quick implementation of new estimators following the template.
This is not a concrete class or Base class to import!
Use this as a starting template to build on.
How to use:
- Copy the templa... |
3f5143c14d2f1fea3dfdc88cbd4f419f4f9a1c9a8127376bf3b65dfe75e5e493 | Python | 14,731 | 459 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def compute_loop_outputs(x, seq, trip_count):
fo... |
1833ed72da07f988c422353bb5b074846843c7029640654adbf82221f6bda2e3 | Python | 14,732 | 309 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 6 13:07:15 2018
@author: wanglab
"""
import os, sys, numpy as np
import tifffile
import matplotlib as mpl
from tools.imageprocessing.orientation import fix_orientation
from tools.registration.transform import count_structure_lister, transformed_pn... |
8ee811787ed879c60c570ecc6960cce08eda70eb18897dd7fa44d3c6d9288b48 | Python | 14,739 | 288 | """
Upgrade of RISE architecture using mixed depthwise convolutions, preactivation residuals and dropout
proposed by Johannes Czech:
Influenced by the following papers:
* MixConv: Mixed Depthwise Convolutional Kernels, Mingxing Tan, Quoc V. Le, https://arxiv.org/abs/1907.09595
* ProxylessNas: Direct Neural Ar... |
9b82ea6e735ae4e95fdbc84fcb56cc8c01349147ee64d7c848d5b771e439024e | Python | 14,746 | 384 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Compact, lazy batch-progress restoration for directory and HDF5 sources."""
import copy
import json
from unittest.mock import (
patch,
)
import h5py
import numpy as np
import pytest
from deepmd.utils import random as dp_random
from deepmd.utils.data import (
De... |
8a44496245b82905eda200f5bc284a5d80aae31a60409b5411d626b369121482 | Python | 14,754 | 547 | # tifffile/examples/earthbigdata.py
# Copyright (c) 2021-2026, Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyrig... |
92d5082fc1f1a2c6934799634e5e720e822f04856556405fd70864ff29244e9c | Python | 14,762 | 219 | import requests
import json
#from sent_bert_emb_viz_util import get_char_offset
def get_json_google_healthcare_api(doc, gcloud_access_token):
# remove single quote significant
doc = doc.replace('\'','')
headers = {
'Authorization': 'Bearer %s' % gcloud_access_token,
'Content-... |
077cde612e820e0ab7f15da0749760b29571ca7ed5b0045cb1f1abfd945cfbb9 | Python | 14,788 | 436 | import torch
import numpy as np
from scipy.special import factorial
import itertools
import logging
logger = logging.getLogger(__name__)
class CGDict:
"""
A dictionary of Clebsch-Gordan (CG) coefficients to be used in CG operations.
The CG coefficients
.. math::
\langle \ell_1, m_1, \ell_2... |
e3909da72dcf0da298b2035ff21a4b479ab92c01c2f4ca9f7c05b1ffce3d2cfb | Python | 14,790 | 438 | import torch
import numpy as np
from scipy.special import factorial
import itertools
import logging
logger = logging.getLogger(__name__)
class CGDict:
"""
A dictionary of Clebsch-Gordan (CG) coefficients to be used in CG operations.
The CG coefficients
.. math::
\langle \ell_1, m_1, \ell_2... |
e5fa06701045785a4be82282e954d5338ba4b2fda38f8e01f6524c16aa4be1f2 | Python | 14,796 | 354 | # Copyright 2018-2026
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
bbaa027bd774f71e316d60217e944f70e6b2ea7e43c7468419f4433bcad0b745 | Python | 14,849 | 288 | import itertools
import math
import numpy as np
import pandas as pd
import scipy.stats
import statsmodels.stats.multitest
from figures.figure1 import find_leaves
from figures.util import experiments, mcc, get_subplots, produce_figure, plot_grid, plot_annotations, plot_scatter, \
to_col_name
def generate_qval_da... |
31baa10f3c42a0c8c7f410116631b8f1f57ec83ac7e1c7675fe55e9ef5bfcf67 | Python | 14,856 | 408 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for Facebook prophet to be used in sktime framework."""
__author__ = ["mloning", "aiwalter", "fkiraly"]
__all__ = ["_ProphetAdapter"]
import os
import pandas as pd
from sktime.forecasting.base im... |
7787c677f81a7d9b0458d32edfabb1b2f2cba04d19ab5636332724d0b35070a5 | Python | 14,860 | 362 | #!/usr/bin/env python3
""" Converts owl or ttl or raw rdflib graph into a pandas DataFrame. Saved in .pickle format.
Usage:
allen_cell_types [options]
Options:
-h --help Display this help message
-v --version Current version of file
-r --refresh Update l... |
8d5d5c033252250a3f293514f6ffb59f31c7d6738bd75311969ad8a1b3d3f7e3 | Python | 14,870 | 504 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
e4798ac05d09d996be5da3f89cc3d712336e277d48bd44e6128f3a59316058b0 | Python | 14,872 | 441 | import os
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
import seas
from seas.filemanager import experiment_sorter
from seas.experiment import Experiment
# testing section:
if __name__ == '__main__':
import argparse
ap = argparse.ArgumentPar... |
8c023c51c402d8de5128885d51fe494b1a45cb61428d97a582bee122890132f3 | Python | 14,880 | 402 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
3a4d76bb3853986db96e5e44cf8b56f32d982af2e261a906b973e6e1995ee63d | Python | 14,894 | 410 | #!/usr/bin/env python
#
# Copyright 2020 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
f824285fc3a19e653f0ec81416754319304b10c554bb4ca065230cbdf8ca8d99 | Python | 14,894 | 356 | """GRU with fully convolutional network (GRU-FCN) classifier in PyTorch."""
__authors__ = ["NellyElsayed", "fnhirwa"]
__all__ = ["GRUFCNNClassifier"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.gru import... |
3f4e292b456925c6cf167f169815efdc9240bd24ded52094af769d4802315204 | Python | 14,904 | 446 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def get_roi_align_input_values():
X = np.array(
[
[
... |
5e34dc1a45426232fea6c6d77878c848a08b1ffdf0d6833842a5a9a2796e1869 | Python | 14,926 | 398 | from __future__ import annotations
from collections.abc import Iterable
import numpy as np
import torch
def cartesian_to_EtaPhiPtE(p4: np.ndarray | torch.Tensor) -> np.ndarray | torch.Tensor:
r"""
Transform 4-momenta from Cartesian coordinates to polar coordinates for massless particles.
Args:
... |
9793aa56aab7499df1efea689753f05fa027bddcae7e3554617b46af7c16063d | Python | 14,946 | 353 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
e643aee5e01ec2b892cbe1773dd24e94474bd832aff5315a972aa56b0660325c | Python | 14,948 | 314 | #!/usr/bin/env python
############################################################################
# Copyright (c) 2015-2019 Saint Petersburg State University
# Copyright (c) 2011-2015 Saint Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
###########################################... |
4e25de6527425ffb1e79d7130b4e10096b497438276f34a704aa190781ab9101 | Python | 14,951 | 439 | import colorsys
import numpy as np
import matplotlib as mpl
import pytest
import numpy.testing as npt
from seaborn import palettes, utils, rcmod
from seaborn.external import husl
from seaborn._compat import get_colormap
from seaborn.colors import xkcd_rgb, crayons
class TestColorPalettes:
def test_current_pale... |
71d6823f4fce866dec32387212c8d657e09893e08b1b81a6077b9e08d16a807e | Python | 14,962 | 295 | # Copyright 2019 Martin Haesemeyer. All rights reserved.
#
# Licensed under the MIT license
"""
Class wrapper of caiman motion correction and unit extraction
"""
import numpy as np
from tifffile import imsave, imread
from os import path, makedirs, remove
import caiman as cm
from caiman.motion_correction import Moti... |
53141bc22decc54e1c66b826f3cca2870fa3eecfb5f5fbdfa15eae399039e7a0 | Python | 14,965 | 440 | from __future__ import print_function
# -*- coding: utf-8 -*-
# ELEKTRONN - Neural Network Toolkit
#
# Copyright (c) 2014 - now
# Max-Planck-Institute for Medical Research, Heidelberg, Germany
# Authors: Marius Killinger, Gregor Urban
import time
import matplotlib.pyplot as plt
import numpy as np
# try:
# from .... |
6fe54c89b338bb111c76a2d3ea835544480764729d0ef59586c67cb6ef2555f5 | Python | 14,971 | 404 | import logging
import numpy as np
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.tf.misc import normc_initializer, get_activation_fn
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.policy.rnn_sequencing import add_time_dimension
... |
de86df461ecfcdf8a5cfba2f8b17f39497e2ce039503f4cbac815500eaa107e9 | Python | 14,973 | 454 | import logging
import os
from glob import glob
from os import path
import h5py
import numpy as np
import pandas as pd
import yaml
from lfads_tf2.tuples import SamplingOutput
logger = logging.getLogger(__name__)
def load_data(data_dir, prefix="", signal="data", merge_tv=False, with_filenames=False):
"""Loads the... |
2ef586af7b977cb3398e9846ff2c15890fda397260bd4261f31cfdbeae819633 | Python | 14,981 | 356 | """
This scripts generates figure 3e : Visual stimulus decoding
Internal notes:
top panel is from : figure-4-paper-w-pip (note to use the newest decoding result!)
bottom panel is from: figure-4-paper-w-pip-reviewer-updates-checkpoint-2021-11-30
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os... |
8e03002a6c6f73d8ca30eb493cafcc0907c04c798a666601da1b87dc9aa4d39a | Python | 14,984 | 235 | #!/bin/python3
# Author: Thomas Rolland jerikoo75@gmail.com
# Date: 03/30/2022
import pandas as pd
from random import sample
from numpy import mean, sqrt, log10
from plotnine import *
from sklearn.preprocessing import StandardScaler
import scipy.stats as st
import statsmodels.stats as sm
#============================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.