sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fabf9433d42330ba878576b865f581ec41c537ff61dd57387ca1c5c4b19decf3 | Python | 18,237 | 586 | #!/usr/bin/env python
# coding: utf-8
# In[16]:
import numpy as np
import torch
torch.manual_seed(0)
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
import time
import os
from os import path
sys.path.insert(0, '../')
import gc
gc.collect()
# In[17]:
# fi... |
13a32326988d63ad3b3efb82481a89470b42641f45f22ee812cddf6f45a1995a | Python | 18,240 | 551 | """
Classes and function to help with offline analysis of data that was collected using the system.
Author: Tal Eisenberg, 2021
"""
from pathlib import Path
from dataclasses import dataclass
from typing import List
import pandas as pd
from tqdm.auto import tqdm
import re
import os
import moviepy.editor as mpy
import m... |
d35e5db693a69bc2586c924e1b1f4b83b8286eed90b85c9ba7126df174775e07 | Python | 18,240 | 471 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Base classes for developing a keras.Model() Federated Learning model.
You may copy this file as the starting point of your own keras model.
"""
import copy
import os
from warnings import catch_warnings, simplefilter
import numpy as n... |
6533d877844be141960d0b14dd66099bfc4adbd6f13ff4e28ded3fe9a274d1d2 | Python | 18,257 | 360 | r"""
YAML-Based Model Definitions
============================
In this tutorial, you will learn how to use YAML definition files to implement a neurodynamic model with multiple
interconnected neural populations. In this process, the following questions will be answered:
1. What is a YAML template file?
2. How do I us... |
82e2ad6a66978e00c07018efe3e56b556f0a11cefcb7d97ff72c4476ece108bc | Python | 18,265 | 587 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import shutil
import struct
from functools import lru_cache
import numpy as np
import torch
from fairseq.dataclass.constants import DATASET_I... |
5b43a72232ad7fd755868add94ed8a56e0f6459b78cb11629c2454de830bf09b | Python | 18,271 | 520 | """Kalman filter on Lie groups, with two local test system models.
Lead author: Paul Chauchat.
"""
import geomstats.backend as gs
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.matrices import Matrices
from geomstats.geometry.special_euclidean import SpecialEuclidean
class LocalizationLi... |
a88b1b0e4ccbed6bf5984da8b95323e42655eeecf969eea18f383e04b24be6cd | Python | 18,311 | 575 | import ray
import torch
import pprint
import copy
import os
import yaml
import numpy as np
from scipy import stats
import matplotlib
import matplotlib.pyplot as plt
import warnings
import seaborn as sns
import utils as u
from utils import concatenate_dicts, fig_to_pil, report_via_email
import analysis_utils as au
impor... |
a42a8c6144557b090d338854363b387bade6e587535d5dd08b65d4e9fd428a25 | Python | 18,312 | 444 | import torch
import torch.nn.functional as F
import torch.nn as nn
import ISNetLayersZe as ISNetLayers
import ISNetFunctionsZe as ISNetFunctions
import LRPDenseNetZe as LRPDenseNet
import globalsZe as globals
import pytorch_lightning as pl
import warnings
from collections import OrderedDict
import numpy as np
import co... |
001a8a438c026762a39997b7de8cff073fd6e508eeee399667c1896eb0c77c89 | Python | 18,314 | 421 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
31ce30d2e5a30950bd8264c57aa21192295cc69a14d4b857084de8f888d6dc37 | Python | 18,335 | 523 | # Author: Guoqing Bao
# School of Computer Science, The University of Sydney
# Date: 2019-12-12
# GitHub Project Link: https://github.com/guoqingbao/Pathofusion
# Please cite our work if you found it is useful for your research or clinical practice
"""
The helper functions, such as database manipulation, image real-ti... |
83f91c8494474bc8a381df5463292879b1e631f5f3df6cc01c26a1d89917def3 | Python | 18,348 | 433 | import numpy as np
# import keras.backend as K
from keras.models import Model
import keras.layers as KL
from keras.layers import Layer
from keras.layers import Conv3D, Activation, Input, UpSampling3D, concatenate, AveragePooling2D
from keras.layers import LeakyReLU, Reshape, Lambda
from keras.initializers import... |
9535c7a3c133847b818f4abed24673a3f0b927baaf54b12532a79a1dacac071e | Python | 18,366 | 543 | # 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... |
e85e14a80dd7eae44284fac0cf6eb6f08b68cbeb5d0157fd1c7317a541ad47be | Python | 18,372 | 519 | import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import torch
from torch import nn
from typing import Optional
def _reduction(loss: torch.Tensor, reduction: str) -> torch.Tensor:
"""
Reduce loss
Parameters
----------
loss : torch.Tensor, [batch_size, num_clas... |
931d2d816143564c1f2ba4b507c15208d8eeb20555717d29aa478696bec71d85 | Python | 18,381 | 559 | import pytest
import numpy as np
import renderapi
from bigfeta.transform.transform import AlignerTransform
from bigfeta.transform.affine_model import AlignerAffineModel
from bigfeta.transform.similarity_model import AlignerSimilarityModel
from bigfeta.transform.rotation_model import AlignerRotationModel
from bigfeta.... |
60f19cd88c65a544dbceeea6f0eb90c7f573c4b2d6eb8126cefadeb2bbe2dfbb | Python | 18,388 | 538 | """
The Klein Bottle manifold.
Lead author: Juliane Braunsmann
"""
import geomstats.backend as gs
from geomstats.geometry.manifold import Manifold
from geomstats.geometry.riemannian_metric import RiemannianMetric
from geomstats.vectorization import get_batch_shape, repeat_out
class KleinBottle(Manifold):
r"""Cl... |
b7dfb2906ee8f2ea433606a27abdd4a7c39c1de57674edb2f895598b560072ce | Python | 18,426 | 415 | """
Cluster similar waves into modes.
Adapted from [Ruiz-Mejias et al. (2011)](https://doi.org/10.1523/JNEUROSCI.2517-15.2016)
"""
import argparse
import neo
import numpy as np
import pandas as pd
from warnings import warn
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sk... |
53c6a8a54165bf5fe975d30bbe7074477c7ad85a67efa9eb932611c30b865ab2 | Python | 18,437 | 483 |
from __future__ import absolute_import
from .activations import GELU, Snake
from tensorflow import expand_dims, squeeze, pad
from tensorflow.compat.v1 import image
from tensorflow.keras.layers import MaxPooling2D, AveragePooling2D, UpSampling2D, Conv2DTranspose, GlobalAveragePooling2D
from tensorflow.keras.lay... |
cd3792e221c7bc1364b041959d09ada30c0908b8967979b737efd684cfe5625f | Python | 18,442 | 520 |
# 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 t... |
49864fd5243a52150581e6209fcffd83d3c314eb53aa14f76f6583ed8850e035 | Python | 18,447 | 416 | """
Cluster similar waves into modes.
Adapted from [Ruiz-Mejias et al. (2011)](https://doi.org/10.1523/JNEUROSCI.2517-15.2016)
"""
import argparse
from pathlib import Path
import neo
import numpy as np
import pandas as pd
from warnings import warn
from sklearn.preprocessing import StandardScaler
from sklearn.decompos... |
e1f6971bc18e64994ba071cf80d375d61a807ddcf16116bab572cefbe11818fa | Python | 18,448 | 521 | import argparse
import json
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pydfc.data_loader import find_subj_list
from pydfc.ml_utils import load_task_data
from pydfc.task_utils import (
calc_relative_task_on,
calc_rest_duration,
cal... |
53e2a6c141a76a42fb438ae5fa8524be30fc7fa0c672bf1d059afc6cdf1821f5 | Python | 18,451 | 558 | """
Canvas MQTT interface
Author: Tal Eisenberg (2023)
"""
import mqtt
import json
import time
import threading
import asyncio
class Canvas:
"""
Class representing a connection to a Canvas browser app.
"""
def __init__(
self,
canvas_id,
on_connect=None,
on_disconnect=... |
d71a6358d503193d044bc0fedfedbac2dc74749a14a641de9c88c1b58bbbe016 | Python | 18,455 | 416 | """
Cluster similar waves into modes.
Adapted from [Ruiz-Mejias et al. (2011)](https://doi.org/10.1523/JNEUROSCI.2517-15.2016)
"""
import argparse
from pathlib import Path
import neo
import numpy as np
import pandas as pd
from warnings import warn
from sklearn.preprocessing import StandardScaler
from sklearn.decompo... |
2a564217b5aebb21dd45f744e60f3bc7393c5f553e69461874bd2629f0f1f159 | Python | 18,463 | 439 | import os, json, ast, glob, ssl
import torch
import os.path as osp
import numpy as np
import pandas as pd
from tqdm import tqdm
from rdkit import Chem
from itertools import repeat
from six.moves import urllib
from torch_geometric.data import Data, InMemoryDataset, download_url
from .utils import mol2graph
class Mole... |
9d2fb0c0e043d97cb66c3ac6f053211d8065dd5c6177855a85e5847af7d87cfd | Python | 18,467 | 416 |
import gc
import os
import wandb
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from hyper_dti.settings import constants
from hyper_dti.models.deep_pcm import DeepPCM
from hyper_dti.models.hyper_pcm i... |
287f10ea83a0158c785df2ceb6d80dab85414dd982fe07720e2f207279ae2080 | Python | 18,472 | 415 | """
Cluster similar waves into modes.
Adapted from [Ruiz-Mejias et al. (2011)](https://doi.org/10.1523/JNEUROSCI.2517-15.2016)
"""
import argparse
import neo
import numpy as np
import pandas as pd
from warnings import warn
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sk... |
89da7ccd787ceb6b9dff2a1d330a9ccf3d08e9f3731baa270b4c7a10d223813c | Python | 18,494 | 623 | import functools
import importlib
import inspect
import json
import os
import shutil
import tempfile
import types
import warnings
import nbformat
import pytest
from matplotlib import pyplot as plt
from nbconvert.preprocessors import ExecutePreprocessor
import geomstats.backend as gs
from geomstats.exceptions import A... |
b192066fe59294e4cf33956ca05d613e9fba9078b05eba9719eaaca4b0ba56d8 | Python | 18,494 | 576 | # in this script to fellow fairly closely Zou et al
# but the create a equivariant descriptor for each type
# of tree topology from the beggining
# We use a an embedding "across sequences" instead to
# within sequences.
# this is an optimized version of the lstm network
import numpy as np
np.random.seed(1234567)
# ... |
3caee51e7efe2cbe23a36cf6499c0df23160c7b6a886ec20e37c023734f6a554 | Python | 18,502 | 499 | import importlib
import inspect
import logging
from abc import ABC
from enum import Enum
from graphlib import TopologicalSorter
from typing import Optional, List, Any, Dict, Set, Iterable, Union
from typing import Type, TypeVar, cast
from overrides import EnforceOverrides
from overrides import override
from typing_ext... |
a1d7d63ace768c12a1deeae4ec64f105c792d6f360e8ce560b6c4d7daf8771a5 | Python | 18,517 | 517 | """External drives to network."""
# Authors: Mainak Jas <mjas@mgh.harvard.edu>
# Sam Neymotin <samnemo@gmail.com>
# Christopher Bailey <bailey.cj@gmail.com>
import numpy as np
from .params import (
_extract_bias_specs_from_hnn_params,
_extract_drive_specs_from_hnn_params,
)
def _get_targe... |
d71f770c1da0f98cb446bfa5371d0e0cc47c9aa6cf792acf34a14649949f85f1 | Python | 18,538 | 558 | 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):
"""Cla... |
fb6fe4d91cbb45347dd185dba36fcb2f1669d078d8094d843c005144fe071408 | Python | 18,540 | 551 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
64d0e26a7f1c43afdbb639e556268f85274b2523b8df651ab48a20b56ed1618a | Python | 18,559 | 553 | import os
import subprocess
import sys
from pathlib import Path
import ase.io
import numpy as np
import pytest
from ase.atoms import Atoms
from mace.calculators import MACECalculator
from tests.helpers import REPO_ROOT
try:
import cuequivariance as cue # pylint: disable=unused-import
CUET_AVAILABLE = True
... |
82eb09104113c6ac97344863f3eed196324c016b6a6613613fd9326fcb02b903 | Python | 18,585 | 563 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
from collections.a... |
3dd1afe49018bac129b549491101732d7878bbf8198966acaad2f080506a10cd | Python | 18,609 | 425 | import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import sys
import time
import LSM_APSTDP_CONSTRUCTOR_N_MNIST_NOISE as construct
import NALSM_PARALLEL_SAVE as parasaver
import NALSM_SIM_SUPPORT as runSupport
import NALSM_GEN_SUPPORT as sup
... |
12db08ce4a38076c038cc1984795708c4e8175563b24b748305d09d4e08a0631 | Python | 18,612 | 454 | import os
import numpy as np
import nibabel as nib
import polars as pl
import pytest
from nltools.data import BrainData
from nltools.templates import get_brainspace
class TestBrainDataIO:
def test_write_nifti_is_lossless_for_float_data(self, tmp_path):
"""Writing float brain data to NIfTI must not quant... |
639d345939ce8d64d7c21849e13afdb6293a85bf1d5adf4ba82f86279cc82ebd | Python | 18,628 | 376 | import pandas as pd
import numpy as np
from regressionTools import aa_to_idx,aa_to_idx_stop
import regressionTools as rt
from os import listdir
dms_path = '../data/DMS_data/'
def get_x_y_at_3p():
fin = dms_path+'df_mut_all_norm.csv'
df_mut_all = pd.read_csv(fin, index_col = 0)
df_mut_all['muts'] = df_mut_... |
c51c59615f7772e139617902283d9859a41eff7f5e1d43b90696b2019eb289a7 | Python | 18,646 | 612 | """Collections of wrappers around scikit-learn.
Main goal is to make them compatible with geomstats.
Common issues are point shapes (in geomstats, points may
be represented as n-dim arrays)
and backend support.
For maintainability reasons, we wrap a sklearn object only
when it is strictly necessary.
"""
import os
fr... |
d16eb1383a62ac8789c44a7c2fa5eac3ee8dcef1144f1d5bd252d7e494716a75 | Python | 18,661 | 531 | """Expectation maximization algorithm.
Lead authors: Thomas Gerald and Hadi Zaatiti.
"""
import logging
from sklearn.base import BaseEstimator, ClusterMixin
import geomstats.backend as gs
from geomstats.learning._template import TransformerMixin
from geomstats.learning.frechet_mean import FrechetMean, GeneralFreche... |
630106d216662da58404bc614120195ade1f60248ad8dc53d74a863ef2ae4c8e | Python | 18,666 | 363 | import cv2
import math
import numpy as np
import time
from scipy import signal
from scipy import special
import multiprocessing as mp
import pyfftw
import h5py
import os
from scipy.io import loadmat
import sys
from suns.PreProcessing.par1 import fastexp, fastmask, fastlog, \
fastconv, fastquant, fastnormf, fastnor... |
808d2baca2b8008c2450b00285d04ed73a29a52680d389f825db2b94cd507c54 | Python | 18,678 | 435 | from enum import Enum
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import openpyxl
from openpyxl.styles import Font
import sys
import argparse
# --------------------------------------------------------------------------- #
# ID handling
# ----------------------------------------------------... |
5bf3c389dce88968740c792f9f5ccba77ee120f1463582204dad3a1fd8bd25c8 | Python | 18,680 | 549 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
e928e26ffd166c685b95de487f1a9e3532150e071d529ce2c228e49b021a2d15 | Python | 18,682 | 492 | """
features.py
Feature computation module.
Kyuhwa Lee, 2019
Swiss Federal Institute of Technology Lausanne (EPFL)
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 Foundation, either version 3 of the License, ... |
b709fe1129ec6c0a03e45474171d4d5d44bc1695ed2976a3883affcc148083a3 | Python | 18,706 | 494 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network model_templates and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cogn... |
808275aa263e889e6dc3a08987a4b9d42f1354ad9fad55c8d8d56605763aa310 | Python | 18,729 | 501 | # Copyright (c) 2019 PaddlePaddle 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 appli... |
de26adae5f6ac51fcd5554de72bc8e9bea9f257760c69428b0c8d78f3f0709a0 | Python | 18,731 | 563 | import numpy as np
from numpy import sin, pi, arange
import pandas as pd
from nltools.stats import (
one_sample_permutation,
two_sample_permutation,
correlation_permutation,
matrix_permutation,
downsample,
upsample,
winsorize,
align,
transform_pairwise,
_calc_pvalue,
find_spi... |
faf850e637001d815daf76e7a26a5fc24132c5a165bc261d0c712c8b925a3739 | Python | 18,754 | 441 | import jax
import numpy as np
from deeperwin.configuration import E3TransferableAtomicOrbitalsConfig, MLPConfig, E3SymmetricTensorProductMLPConfig, E3OrbitalTransformerConfig
from deeperwin.model.definitions import Embeddings, DiffAndDistances
from deeperwin.model.mlp import MLP, get_rbf_features
import haiku as hk
imp... |
05056c0c5fcda33a69428d9ce7f9adb75086c1e8d3b223d1ccfb87d9dca94834 | Python | 18,793 | 502 | """Batch Simulation."""
# Authors: Abdul Samad Siddiqui <abdulsamadsid1@gmail.com>
# Nick Tolley <nicholas_tolley@brown.edu>
# Ryan Thorpe <ryan_thorpe@brown.edu>
# Mainak Jas <mjas@mgh.harvard.edu>
from itertools import product
from pathlib import Path
import numpy as np
from joblib import... |
b58a63dc0aa35889418e812b85b945466f212deb4eefd0ae5c119013de48131c | Python | 18,827 | 463 | # Copyright (c) 2020 PaddlePaddle 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
#
# Un... |
9776f85be84e6abe4d36709f14d4dad9de266bfca5d647c7192f4ecbaa4b80ea | Python | 18,863 | 484 | import os
import torch
import numpy as np
import pickle
import dynaphos
from dynaphos.cortex_models import get_visual_field_coordinates_probabilistically
from dynaphos.simulator import GaussianSimulator as PhospheneSimulator
from dynaphos.utils import get_data_kwargs
import model
import local_datasets
from torch.uti... |
61ad135ca4197c98a21c2c267d467bf52e68d7e93c39bb9a8f4a7f8d17cbf540 | Python | 18,885 | 502 | """Visualization for Geometric Statistics."""
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # NOQA
import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.geometry.pre_shape import PreShapeSpace
M32 = Matrices(m=3, n=2)
S32 = PreShapeSpace(k_landmark... |
74fa8008e4e058b148701f194cc5181bdeb5321cd7b70f6d2e31f0709009774b | Python | 18,889 | 508 | """Master list of changeable params."""
# Authors: Mainak Jas <mjas@mgh.harvard.edu>
# Sam Neymotin <samnemo@gmail.com>
def get_params_default(nprox=2, ndist=1):
"""Note that nearly all start times are set BEYOND tstop for this file
Most values here are set to whatever default value
inactivates ... |
af171b7a2cb1572bbb9ce44e9fe51d434a874c351722db74ab973e4479061667 | Python | 18,890 | 561 | """
Tests for the Intersubject Correlation (ISC) module.
Test organization:
Phase 1: Leave-One-Out (LOO) Computation
Phase 2: Pairwise Computation
Phase 3: LOO Bootstrap
Phase 4: Pairwise Bootstrap
Phase 5: Main Function
Integration Tests
Testing Strategy & Tolerances:
Worker-count consis... |
83523a726ae382c6a4cd22be6794c46a9a6a3fa943f9fae6ded07e186fe211b1 | Python | 18,899 | 531 | #!/usr/bin/env python
"""Interactive nltools release orchestrator.
The workflow reviews the latest pytest log, bumps the project version, builds
and smoke-tests distributions, and creates a release commit and tag. The
changelog is not part of the release commit: the docs build generates it from
git history, and the re... |
d37240d6d9c76b067b420b0db405ed6dc045a11cdea9b46942b63b5823c683a0 | Python | 18,929 | 570 | import uuid
from random import randint
from typing import cast, List, Any, Dict
import hypothesis
import numpy as np
import pytest
import hypothesis.strategies as st
from hypothesis import given, settings
from chromadb.api import ClientAPI
from chromadb.api.types import Embeddings, Metadatas
from chromadb.config import... |
91db3a174c8ad7963c3822d7872f0fba7bb7a45878a4c9ee4be5b5eeb2cc527f | Python | 18,975 | 599 | import glob
import importlib.util
import os
import shutil
import stat
import warnings
from collections import OrderedDict
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
from model_angelo.mode... |
f75bedd95250f86ba87354d13a9b271c235ff19636912da72dee3ac17335aaab | Python | 18,985 | 535 | #opyright (c) 2022 PaddlePaddle 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... |
c3fb6c63842127f227362e9d6d1a4406a1b3f5afcd1efbd5e37cb19f7ba669e6 | Python | 18,992 | 502 | import os
import numpy as np
from .openfoamutils import polyarea, project, Parser, read_mesh_file
from .mesh_parser import FoamMesh
from .field_parser import (parse_internal_field, parse_boundary_field)
def progress(count, total):
bar_len = 70
filled_len = int(round(bar_len*count/float(total)))
percents ... |
35ea1dce14e76e3412a04556a46bc5a2e93d0ff63cc96270bdaae62bf6b9feb8 | Python | 19,010 | 503 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import inspect
import logging
import os
import re
from argparse import ArgumentError, ArgumentParser, Namespace
from dataclasses im... |
22f9fe5604de5d012676630c623a7f81db82791a1329431937eee6ce7d0757e0 | Python | 19,057 | 559 | #!/usr/bin/env python3
import argparse
import os
import pickle
import matplotlib.pyplot as plt
import numpy as np
import odil
from odil import history, printlog
from odil.runtime import tf
def get_init_u(t, x, mod):
# Gaussian.
def f(z):
return mod.exp(-((z - 0.5) ** 2) * 50)
return f(x) - f(-... |
976385191faee0e5f30025a240879486012d690f8d7dd150a26d13aa146253d9 | Python | 19,076 | 405 | import torch
import torch.nn as nn
import torch.nn.functional as F
import scipy.sparse as sp
import numpy as np
import torch_scatter
from dig.fairgraph.utils.utils import scipysp_to_pytorchsp,accuracy,fair_metric
from torch_geometric.loader import GraphSAINTRandomWalkSampler
from torch_geometric.data import Data
from t... |
5c371a8c0eb2595b3ee2899fe0776927c170e569388457af20011006f9d0dee3 | Python | 19,148 | 572 | import json
import logging
import re
from collections.abc import Callable, Sequence
from dataclasses import asdict, dataclass
from datetime import datetime, timedelta
from functools import wraps
from math import sqrt
from pathlib import Path, PurePosixPath, PureWindowsPath
from shutil import rmtree
from typing import I... |
acd81f0efc0cd1350220cddbbfa0fa73e205187f37a89597a363d77f64bdff73 | Python | 19,167 | 436 | """
stereoseq_crop.py -- spatially crop a SAW 8.2.0 Stereo-seq ``outs/`` bundle.
Driven by make_stereoseq_mini_mouse_eyeball.R, which provisions the python
dependencies (h5py, numpy, tifffile, imagecodecs, zarr, anndata) through
reticulate/uv and then calls ``main()``.
Everything is defined by ONE rectangular window ... |
0c2cdd8e27004da54db66a4325268be4b7e201d7c0e613edf10849c7290930f0 | Python | 19,173 | 547 | import pytest
import scipy
import geomstats.backend as gs
from geomstats.learning.frechet_mean import FrechetMean
from geomstats.test.random import (
EmbeddedSpaceRandomDataGenerator,
HypersphereIntrinsicRandomDataGenerator,
)
from geomstats.test.test_case import TestCase
from geomstats.test.vectorization impo... |
03f543ed1c186b69a53ea27eab8332e7b0f9179407705c57c4f7c866de50b754 | Python | 19,174 | 407 | import inspect
import os
import pickle
import numpy as np
import pandas as pd
from statsmodels.gam.api import GLMGam, BSplines
from .harmonizationApply import applyStandardizationAcrossFeatures
from neuroCombat.neuroCombat import make_design_matrix, find_parametric_adjustments, adjust_data_final, aprior, bprior
import ... |
f6f598a88b5c433df25ab22c45321a5edf985de9db07318859d207416954cbf2 | Python | 19,188 | 509 | """
Created on Sat September 16 21:15:06 2023
Description: Data preprocessing functions for:
Paper url: https://www.biorxiv.org/content/10.1101/2023.09.11.557230v2
@author: Ekaterina Kuzmina, ekaterina.kuzmina@skoltech.ru
@author: Dmitrii Kriukov, dmitrii.kriukov@skoltech.ru
"""
import numpy as np
import h5py
import... |
f0660b99474db90e0c890159197adc6d619c14d76bd22db5b066940cf30679e0 | Python | 19,200 | 545 | """Postprocessors for sample analyzers."""
import numpy as np
import xarray as xr
from scipy.spatial.distance import pdist
from scipy.stats import spearmanr
__all__ = ['power', 'remove_between_assocs_perm',
'weights_pairwise_cossim_stats',
'weights_cv_pairwise_cossim_stats',
'weights... |
7ba6b5593ab10e25a80ce253eab98d3f624f9742ccf110c4896c94825efd5c44 | Python | 19,216 | 428 | import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import sys
import time
import LSM_APSTDP_CONSTRUCTOR_MNIST_NOISE as construct
import NALSM_PARALLEL_SAVE as parasaver
import NALSM_SIM_SUPPORT as runSupport
import NALSM_GEN_SUPPORT as sup
cl... |
017641275515513e0e768d54eaf57b13b4e3a90219eb4a7a09db2bdd5e5187e7 | Python | 19,230 | 555 | import pandas as pd
import numpy as np
from regressionTools import aa_to_idx, aa_to_idx_stop
import regressionTools as rt
from os import listdir
dms_path = "../data/DMS_data/"
def get_x_y_at_3p():
fin = dms_path + "df_mut_all_norm.csv"
df_mut_all = pd.read_csv(fin, index_col=0)
df_mut_all["muts"] = df_mu... |
ddb086f728e2d6f93d2152b8c05861be43d741cd5efed43a5d1f401374b4ec45 | Python | 19,240 | 536 | """Setup of model covariance matrices and generation of data.
"""
import numbers
import warnings
from functools import partial
import numpy as np
import scipy.spatial
from sklearn.utils import check_random_state
from ..util import check_positive_definite, pc_spectrum_decay_constant
from ..model_selection import n_c... |
8e56da0d097d607ef4e9ae5b23b75c2cad41c1551bc422c789ec14bdb071d6a2 | Python | 19,256 | 593 | import argparse
import gcsfs
import nobrainer
import numpy as np
import os
import os.path as op
import pandas as pd
import re
import tensorflow as tf
from glob import glob
def build_multi_input_model(
width=128,
height=128,
depth=128,
n_image_channels=3,
n_qc_metrics=31,
neglect_qc=False,
):
... |
910854d7ac302360110e599d86bfd7d270c956c4317a1bfb755f76e322776f24 | Python | 19,316 | 489 | #!/usr/bin/env python3
# =========================================================================
# Adapted from https://github.com/google-research/nested-transformer.
# which has the following license...
# https://github.com/pytorch/vision/blob/main/LICENSE
#
# BSD 3-Clause License
# Redistribution and use in sour... |
662088a8acd22af98d03d36a6d4b7cf827c262789363f9c18e7ffbed5be9da4f | Python | 19,325 | 507 | from functools import cached_property
import json
from chromadb.api.configuration import (
ConfigurationParameter,
EmbeddingsQueueConfigurationInternal,
)
from chromadb.db.base import SqlDB, ParameterValue, get_sql
from chromadb.errors import BatchSizeExceededError
from chromadb.ingest import (
Producer,
... |
2208ad04b144aeee87d9feabbb5321491e1043c1a690e569d834625bb70de1e7 | Python | 19,337 | 446 | #===========================================================================
# Import, Set up MPI Variables, Load Necessary Files
#===========================================================================
from mpi4py import MPI
import time
tic_0 = time.perf_counter() #script runtime calculation value
import os
from o... |
d3f55a7316cdec9fed3eebc1fa6845722a7c01f96e26d7f036fd20ec1bc3d625 | Python | 19,353 | 517 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
ef188500091a8d17117da3b0aa459c418f25458b165e2e37c4d2f78165aeb996 | Python | 19,367 | 566 | """
Flask REST API routes that can be used for controlling the system. These routes are called by the ui webapp.
Author: Tal Eisenberg, 2021, 2022
"""
import flask
import json
from configure import get_config
from json_convert import json_convert
import overlay
import task
import arena
import experiment
import video_... |
1639785c558a29765cd6a831acd7ee01dc7c31385603978e15f576de141bd360 | Python | 19,385 | 457 | from __future__ import print_function
import os
import ray
import copy
import math
import pprint
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset, Subset
from torchvision imp... |
17973f33532b757687cd7e7ea0b3acc9453ce6f9b52691543e2d1be50d02eb63 | Python | 19,390 | 482 | #!/usr/bin/env python
"""Download and stage browser-sized datasets for the tutorials.
Covers the GLM, MVPA, encoding, and ISC tutorials. The outputs are written below
``scratch/tutorial-data/tutorials`` by default. That directory is intentionally
gitignored: this script is the reproducible source of the staged data, w... |
38a63686b358eed4139edb9bfa301dd249ef775eb40f082e5e4bc1b00ab0a982 | Python | 19,402 | 520 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import math
from argparse import Namespace
from pathlib import Path
import torch
import torch.nn as nn
from fairs... |
2f884a76be961563afbbc7c9cd84c15db1e7a9dc702a8a689b66c75fb985cb03 | Python | 19,406 | 364 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
820ccb4dfaf326cb798b68f04737e27ad1b0a7bad78225e55727f5f6d190c2dd | Python | 19,409 | 566 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Collaborator module."""
import os
import sys
from glob import glob
from logging import getLogger
from os import remove
from os.path import basename, isfile, join, splitext
from pathlib import Path
from shutil import copy, copytree, igno... |
92ec64d83c2602e88a038d3f22dd24696e6f8d655faca31c731e3e6e7ae325e4 | Python | 19,411 | 477 | import warnings
import polars as pl
import pytest
from nltools.data.designmatrix import DesignMatrix
class TestDesignMatrixConcatenation:
"""
Test multi-run concatenation logic - the most complex functionality.
Behavioral contract:
- Horizontal (axis=1): Combine columns from multiple DesignMatrix
... |
b9341ae5f92ce549355aeb70b0cd7551f3d3d2295e61fab71cee41fbc633a46a | Python | 19,429 | 423 | # -*- coding: utf-8 -*-
#
# Класс для работы с файлами TMLDA
# 28/01/2018
import struct
import multiprocessing
class CBinaryDoc(object):
def __init__(self, fname_bin, bwrite):
self._BINFileSign = b'\x54\x4D\x69\x6E\x65\x72\x76\x33'
self._BINFileSign_len = len(self._BINFileSign)
... |
cdd8f33619b5cd7b7ec47df1208cf22a3a9232377900b49559d38febdc88d04f | Python | 19,441 | 543 | # in this script to fellow fairly closely Zou et al
# but the create a equivariant descriptor for each type
# of tree topology from the beggining
# We use a an embedding "across sequences" instead to
# within sequences.
# this is an optimized version of the lstm network
import numpy as np
# import matplotlib.pyplot... |
93cd05168e59231cd091de7fb3d6c73b3c97a6a250b91254fbf0f062ae27f63a | Python | 19,449 | 404 | # Code to run xperiments on Fold and EC datasets in our paper
# "Learning Hierarchical Protein Representations via Complete 3D Graph Networks"
# (https://openreview.net/forum?id=9X-hgLDLYkQ)
##################################### Default hyperparameters for ECdataset #####################################
# device=0
#... |
d857374204f10ffdc471b1cde3b25eb8cfeedf405882551cc905cce2bd88683f | Python | 19,463 | 590 | """
Implementation of functions for loading fmri data.
Created on Jun 29 2023
@author: Mohammad Torabi
"""
import os
from copy import deepcopy
import h5py
import numpy as np
from nilearn import datasets
from nilearn.interfaces.fmriprep import load_confounds, load_confounds_strategy
from nilearn.maskers import NiftiL... |
5c27984ca764edc6b3c588c03b99c58bd251b17eddb006c72f54586c1b3673b0 | Python | 19,467 | 600 | """Stiefel manifold St(n,p).
A set of all orthonormal p-frames in n-dimensional space, where p <= n.
Lead author: Oleg Kachan.
"""
import warnings
import geomstats.backend as gs
import geomstats.errors
from geomstats import algebra_utils
from geomstats.geometry.base import LevelSet
from geomstats.geometry.hermitian... |
2271acad70348e097aede35652465b1653ad95c3acfce6be521ffcae43786bfa | Python | 19,478 | 586 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from brian2 import *
from scipy.spatial import distance as dst
from scipy.spatial.transform import Rotation as R
from tqdm import tqdm
from random import sample as smplf
import os
import time
import sys
from shutil import copyfile
import argparse
import parameters
import... |
4eb82eb52b2c44d4277074e5712c4c9052a8b383a9958f29a11998197a770439 | Python | 19,498 | 541 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""
TorchSim integration test mixin.
This mixin provides tests for torch-sim integration, verifying that NequIPTorchSimCalc
(torch-sim interface) produces identical results to NequIPCalculator (ASE int... |
25164634e9859c174c2a14caea4d5b563684bd6adc1cef01b1de9d740f7ab28c | Python | 19,500 | 579 | """Statistical Manifold of Dirichlet distributions with the Fisher metric.
Lead author: Alice Le Brigant.
"""
import math
import numpy as np
from scipy.optimize import minimize
from scipy.stats import dirichlet
import geomstats.backend as gs
from geomstats.algebra_utils import from_vector_to_diagonal_matrix
from ge... |
1f3bf35e8788ac38b3165ad5d8db1f73b5dd662bcda432b0023e240d2e32c7cc | Python | 19,507 | 451 | #===========================================================================
# Import, Set up MPI Variables, Load Necessary Files
#===========================================================================
from mpi4py import MPI
import time
tic_0 = time.perf_counter() #script runtime calculation value
import os
from o... |
bd9213c624946d6842ec44dff183bd5a18d12366261ec75cd0a27a928ad4906e | Python | 19,520 | 421 | from import_data import import_data
from aux_fun import splitting, remove_SPH
import pandas
import numpy as np
import pickle
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as md
#%% --- Plotting the Firing Power curve (Approach A) ---
def plot_FP_A(patient, approach, datetimes_test... |
371811d57ed8e56cde89539681e66c55dc205148bdd3b0b7dd789fcc15dcca9b | Python | 19,526 | 388 | #This code generates real-time videos depticting the volumetric, time-resolved reconstructed microCT data as an assembly of cross sections through the data. The videos show just tablet voxels, the background is removed.
#This code can serve as a basis for looping through the data and dealing with the differing acquisit... |
df95bd9b2ef453e152dfbed7b08e02e04a6add1e717ebdef4a548f6ea83a4975 | Python | 19,538 | 499 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 15.08.2021
# Author: Moritz Smolka
# Contact: moritz.g.smolka@gmail.com
#
from dataclasses import dataclass
from sniffles import util
TYPES=["INS","DEL","DUP","INV","BND"]
@dataclass
class SVCallBNDIn... |
0bc953d40ce9637f150cd2e2706ed8e93140f6a24056d07d4e4013c789533df2 | Python | 19,552 | 489 | """
Logging of metrics and weights to local disk and web services.
"""
import logging
import time
import os.path
import sys
from abc import ABC, abstractmethod
from typing import List, Dict, Any, Literal, Optional
import jax
import numpy as np
import wandb
from deeperwin.configuration import LoggingConfig, BasicLogg... |
1eabaed7732ac01148c6f0a3fa1b5b87e433b58ce70d25f35c383ef6a852e3c2 | Python | 19,563 | 576 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# "nltools==0.6.0.dev4",
# ]
# ///
# Quickstart — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py.
import marimo
__generated_with = "0.24.0"
app = marimo.App(width="medium")
... |
2372f7daffcd001e0daf19e7f488d7496a080af938c46dbcb7ab8e7d99ce1759 | Python | 19,576 | 481 | import sys
import torch
from torch import nn
from torch_cluster import knn_graph, radius_graph
import torch.nn.functional as F
from torch_scatter import scatter_add, scatter_max
import numpy as np
from sklearn.mixture import GaussianMixture
class GaussianKernel(nn.Module):
def __init__(self, input_dim, num_cent... |
dcb66aba045880dbdfeae261d55081c07d7d9fe218bf7d680a4618a9dabd9313 | Python | 19,586 | 521 | import numpy as np
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
from os import path
import gc
gc.collect()
nameScript = sys.argv[0].split('/')[-1]
# we are going to give all the arguments using a Json file
nameJson = sys.argv[1]
print("===========... |
b6d41d5dce209d7b52bf7fe92ec45cef7dc2182d298b8f9c65005fad55f85c89 | Python | 19,592 | 475 | import os
import re
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
import config
import cv2
import numpy as np
from torch.utils.data import Dataset
from data.segmentation_transforms import SegmentationTransform
from data.utils import ImgAndTargetPlotter, copy_from_storage_if_needed
# f... |
d87dec7637f3ab30c41648b61b310fa6f4926b8dd3d12243eaf303763ca417bf | Python | 19,601 | 501 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
3eb43feb74b2ba66d4670ace68f6657ddce56948b95a6d0591b37a9d01193c54 | Python | 19,612 | 582 | """Stochastic Hodgkin-Huxley sweeps with a settable threshold and adaptation.
The ionic currents and subunit noise follow Alan Leggitt's pylab port of
Goldwyn and Shea-Brown (ModelDB accession 144499). Voltage stays in that
paper's frame, where rest is near 0 mV, until the sweep subtracts a baseline
for SanPy.
``Mode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.