sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5a8417edbc850ce20f605ee20523dcc0b6a37418ee5036c11eb27f81d4a6cfce | Python | 2,747 | 92 | """OpenEye ROCS
Example toml config
[component.rocssimilarity]
[[component.rocssimilarity.endpoint]]
name = "s58 rocs sq"
weight = 1
params.color_weight = 0.5
params.shape_weight = 0.5
params.similarity_measure = "Tanimoto"
params.max_stereocenters = 4
params.ewindow = 10
params.maxconfs = 200
params.rocs_input = ""
""... |
e9270d4b8895dcdc3bb13b8d95c0f407e074d97eb7dc99cdd086f7a1eaa6d1ca | Python | 2,748 | 68 | """
Plot an example signal trace before and after application of some processing steps.
"""
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
import os
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
CLI = argparse.ArgumentParser()
CLI.add_argument("--original... |
483e7f86251cae595ec9adcf61777a43788893a028428c3c996d4ef24a8fc2da | Python | 2,749 | 89 | from .basevtkhandler import BaseVTKHandler
class VTKHandler(BaseVTKHandler):
"""
Handler for .VTK files.
"""
from vtk import vtkPolyData, vtkUnstructuredGrid
from vtk import vtkPolyDataReader, vtkPolyDataWriter
from vtk import vtkUnstructuredGridReader, vtkUnstructuredGridWriter
from vtk i... |
8d6a1386594e6ef614198d326c1948212b19188b4e30d63c8a3144e48cfa0071 | Python | 2,749 | 43 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
076fe18f9f033f4f5c5f21c1a0d9ca90d51897b75c604e158222a9def85eba09 | Python | 2,751 | 78 | """Snapshot SanPy-owned state without mutating a bAnalysis instance."""
from __future__ import annotations
import copy
import uuid
from typing import Any
import numpy as np
import pandas as pd
import sanpy
from sanpy.bAnalysisResults import get_analysis_result_definitions
from sanpy.bDetection import DetectionParam... |
31f2b932797574148ed7db2ade766e150ebfb79b7664fc0a35ce078e1d4e1c82 | Python | 2,751 | 71 | #!/usr/bin/env python
"""
Script to reuse pre-trained base model with pre-trained PhisNet model for fine-tuning experiments.
It currently allows only geometries and molecules from the database (see folder: datasets/db/geomtries.json).
To use a new molecule, you have two options:
1. Add a geometry to the database and u... |
5cb3bff52a21c53820d8ee18770f6456c19f97282199ee4386aa2523724803c7 | Python | 2,751 | 91 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import random
import cairosvg
import scipy.stats as stats
from IPython.core.display import display, HTML
import markdown2
def awesome_settings():
# awesome plot options
sns.set_style("white")
sns.... |
30485fda6a04ee5dd0d26f364ee9fa318eb86378320d7d406809073b314dc8b2 | Python | 2,754 | 96 | """Export an existing SanPy analysis folder to SanPy Zarr."""
from __future__ import annotations
import argparse
from pathlib import Path
import sanpy
from sanpy.io.zarr_export.exporter import export_collection
def export_folder(
source_folder: Path,
destination: Path,
*,
table_format: str = "both"... |
8102b343156e9aed553f0a0659fb0408313f77a469b508cbc3a1d49d5cc12baf | Python | 2,755 | 124 | """Decorator to handle vectorization."""
import functools
import geomstats.backend as gs
from geomstats.metric_geometry.point_set import PointBatch
def broadcast_lists(*lists):
"""Broadcast lists.
Similar behavior as ``gs.broadcast_arrays``, but for lists.
Parameters
----------
*lists : list
... |
2dcfecd6eb738cd134924e27ede9cd46cb3c8b226bb947a2f538a4f99e6fb077 | Python | 2,762 | 108 | #!/usr/bin/env python
# coding: utf-8
import matplotlib.pyplot as plt
from glob import glob
import numpy as np
import nibabel as nib
import os
import pandas as pd
import scipy.linalg as la
from budapestcode.utils import clean_data
# Process is
# 1. Load runs
# 2. Clean up signal
# 3. zscore runs
# 4. stack
# 5. comp... |
3ea9678138008fd1eab97f752f18a0ed483a266f25d631cb33a4f3e9ba203911 | Python | 2,762 | 60 | '''
Module handling the creation of a layer for the projection of a tensorial
object (case 1D it corresponds to nn.Linear.
'''
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from smithers.ml.utils_rednet import tensor_reverse
class tensor_product_layer(nn.Module):
"""
Class that ... |
42ab8b7fecf4cb20ff2ac125d463389504d7c70299450af08d27cab5beac1d63 | Python | 2,762 | 93 | import torch
import torch.nn as nn
class ST_Net_Exp(nn.Module):
def __init__(self, input_dim, output_dim, hid_dim=64, num_layers=2, bias=True):
super(ST_Net_Exp, self).__init__()
self.num_layers = num_layers # unused
self.input_dim = input_dim
self.hid_dim = hid_dim
self.o... |
19ef6f5002477b6416b259a72aac4cc42c28dc8182021aac1abf6a83ba4754c2 | Python | 2,766 | 98 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import functools
from typing import Callable
from openfl.experimental.workflow.utilities import RedirectStdStreamContext
def aggregator(f: Callable = None) -> Callable:
"""Placement decorator that designates that the task will run at... |
255f1443b28e7f12f4fd4feeb7b3b7bcf63f5c312632f5d688baaaff0476912d | Python | 2,766 | 99 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 15:25:17 2018
@author: ngritti
"""
from csbdeep.data import RawData, create_patches
from csbdeep.utils import axes_dict
from csbdeep.models import CARE, Config
from csbdeep.io import load_training_data
import time, os, glob
import numpy as np
#... |
2bd405d65fddb0375c7f146c93f7df66fdbcb60343b7ef3dee88879eed398e08 | Python | 2,766 | 98 | # 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... |
6238b288b88cfd2d4e32468d6edfca1c2d5b7c18a9bdccfe1c57db5f4af3411a | Python | 2,767 | 79 | import math
import torch
from torch import nn
import os
import subprocess
import time
from collections import defaultdict, deque
import datetime
import pickle
from packaging import version
from typing import Optional, List
import torch.distributed as dist
from torch import Tensor
# needed due to empty te... |
83b333f6cde9a236da6a339f0b43d79ea2242230ca8e36a2ed4e60bcde87e5fa | Python | 2,767 | 82 | import geomstats.backend as gs
from geomstats.test.data import TestData
from .complex_matrices import ComplexMatricesMetricTestData
from .complex_riemannian_metric import ComplexRiemannianMetricTestData
from .pullback_metric import PullbackDiffeoMetricTestData
class HPDMatrices2TestData(TestData):
def belongs_te... |
a25b58b9275409552ffd42e0c1363e3f033891d03e0412eca408d90e0b71f239 | Python | 2,767 | 120 | # import jax.numpy as np
import numpy as np
# Coefficients for collision integral Omega(1, 1)
# for Mie-6 potential
a_11 = np.zeros([6, 4])
a_11[0, 0] = 0.
a_11[0, 1] = -0.145269e1
a_11[0, 2] = 0.294682e2
a_11[0, 3] = 0.242508e1
a_11[1, 0] = 0.107782e-1
a_11[1, 1] = 0.587725
a_11[1, 2] = -0.180714e3
a_11[1, 3] = 0.... |
63af7188938d87596b839bfb96f7b24c9f287c455e1e5f5134807ade1173a50f | Python | 2,774 | 90 | import pytest
import torch
import numpy as np
from reinvent.runmodes.RL.memories.inception import Inception
SMILIES = (
"CCN(CC(=O)Nc1ccc(S(N)(=O)=O)cc1)CC(=O)Nc1ccccc1OC",
"CC(c1nnnn1C)N(C)C1CCN(CCn2cccn2)CC1",
"Nc1nc(NCCN2CCC(CO)CC2)cc(C2CC(N)C2)n1",
"CCc1nc(CN2CCN(Cc3ccc4c(c3)OCO4)C(=O)C2)n[nH]1",... |
9815a469f32b4301eca8a2f1bc6607ef42b311dc20c5b2f9e059e522a03a7151 | Python | 2,774 | 71 | from nltools.data import Design_Matrix
from nltools.file_reader import onsets_to_dm
from nltools.utils import get_resource_path
import numpy as np
import pandas as pd
import os
def test_onsets_to_dm():
fpath = os.path.join(get_resource_path(), "onsets_example.txt")
data = pd.read_csv(os.path.join(get_resource... |
dbb2b6c2dbd00b9383ed5613ca6a52738cc98ff05550322060631fe919d27f56 | Python | 2,774 | 84 | # 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... |
c1aee3f82245b2fa7cde891a43050182f6092ab58871502a2b718bfc76d793e6 | Python | 2,776 | 69 | """
Plot an example signal trace before and after application of some processing steps.
"""
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
import os
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
from utils.parse import none_or_float
CLI = argparse.Argumen... |
838ab10a7a847adc2c1a069caecd088d62bf92922235271ef82f788c78b55744 | Python | 2,778 | 98 | from .complex_manifold import ComplexManifoldTestData
from .manifold import ManifoldTestData
from .mixins import ProjectionMixinsTestData
class _VectorSpaceMixinsTestData(ProjectionMixinsTestData):
def random_point_is_tangent_test_data(self):
return self.generate_random_data()
def to_tangent_is_proje... |
a0de0c6af2d7f4f5ab129f1231ff223c6dce262c0724d0f3dfe98216e1ce53f6 | Python | 2,779 | 108 | import json
from pathlib import Path
import click
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
@click.command()
@click.option(
"-m",
"--method",
"methods",
multiple=True,
required=True,
type=click.Tuple([str, click.Path(exists=True, readabl... |
4276a3ca7c001a3c93310afb3505c9b087da0924745ce7554470182e69c36c17 | Python | 2,780 | 97 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 15:25:17 2018
@author: ngritti
"""
from csbdeep.data import RawData, create_patches
from csbdeep.utils import axes_dict
from csbdeep.models import CARE, Config
from csbdeep.io import load_training_data
import time, os, glob
import numpy as np
#... |
87c072ccc41c3853245076fd2dca1bd0cc8077b672a197d4ce2f8d56706f8402 | Python | 2,780 | 88 | """Visualize convergence of the BCH formula approximation on so(n).
Visualize the first, second and third order approximation of the Baker Campbell
Hausdorff formula on so(n). To this end, sample 2 random elements a,b of so(n)
and compute both the BCH approximations of different orders as well as
log(exp(a)exp(b)) and... |
f75bf44f9f0a2850ef7335824b43f4d276c426896bae5110251dfa2c50078287 | Python | 2,780 | 84 | from PymoNNto import *
import time
from globparams import *
settings = {'dtype': float32, 'synapse_mode': SxD}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector('bool')
neurons.spikesOld = neurons.vector('bool')
neurons.voltag... |
a97f86d017f0c83e7ea9b34d6a056478ed2e9b5b6c1589c1f3fa61f6ea954b60 | Python | 2,782 | 81 | # 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... |
f57d324818c9599e0118b3e6309b5e29ec1a82f7544ecc518ddb26bc6860dac4 | Python | 2,782 | 70 | from PymoNNto.NetworkCore.Behavior import *
from PymoNNto.NetworkCore.Synapse_Group import *
class Partition(Behavior):
visualization_module_inputs = ['s.src.x', 's.src.y', 's.src.z', 's.dst.x', 's.dst.y', 's.dst.z']
visualization_module_outputs = ['s.network.SynapseGroups']
initialize_on_init = True
... |
a59dbda2590c698fb8ee25cfdc76b8a1aabbef42ff180835ffc337cd81e24542 | Python | 2,783 | 73 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import numpy as np
import torch
from .. import AtomicDataDict
from ..dict import from_dict
from .base_datasets import AtomicDataset
from typing import Union, Dict, List, Callable
class NPZDataset(At... |
3c7294780da42016d9576ebb593d7e1a9fc14a788d687354fec54a433cbe71a0 | Python | 2,785 | 63 | """From https://github.com/ashleve/lightning-hydra-template"""
import os
import logging
from typing import Mapping, Optional
from lightning_utilities.core.rank_zero import rank_prefixed_message, rank_zero_only
class RankedLogger(logging.LoggerAdapter):
"""A multi-GPU-friendly python command line logger."""
... |
92dbd558da2ea9092b1a54627e80c97a828cdb93f1184ad621afcd02c7ecb853 | Python | 2,786 | 79 | # 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
import math
import torch.nn as nn
import torch.nn.functional as F
impo... |
1204dde11c6b5b9c2ac899d73b34e96ecade5fb2fe4f0dddb4fa27938aec85e0 | Python | 2,788 | 69 | from typing import List
from rdkit.Chem.Crippen import MolLogP
from rdkit.Chem.Descriptors import MolWt
from rdkit.Chem.Lipinski import (
RingCount,
NumRotatableBonds,
NumHAcceptors,
NumHDonors,
HeavyAtomCount,
)
from rdkit.Chem.rdchem import Mol
from reinvent.chemistry import tokens
from reinvent... |
762624ae5e516f023cb3f81aac3c79dc1d65a869dc6e2ae9759f4f7e18ec5a32 | Python | 2,790 | 75 | # Copyright 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import logging
from tests.end_to_end.utils.tr_common_fixtures import (
fx_federation_tr,
fx_federation_tr_dws,
)
from tests.end_to_end.utils import federation_helper as fed_helper
log = logging.getLogger(__name__)
@... |
1c66ee535251c182d383fc009e02dabc239f1f2992c60bb815d73fd7c7fbeaf1 | Python | 2,792 | 92 | # -*- 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... |
f979ce116ac8fde8325d063fac898d41366ee80f9ca4c7c3fc44c274eb5a5b81 | Python | 2,792 | 70 |
from sparse_ct.tool import plot_grid
from sparse_ct.data import image_to_sparse_sinogram, ellipses_to_sparse_sinogram
from sparse_ct.reconstructor_2d import (
IRadonReconstructor,
SartReconstructor,
SartTVReconstructor,
Sar... |
c64478eac869d8d4021cd5c593bbfd73c6ec716e91cdc69f49c7f34d776aa0a0 | Python | 2,793 | 80 | """Load an example ABF recording, detect spikes, and plot the results."""
from pathlib import Path
import matplotlib.pyplot as plt
import sanpy
from sanpy.analysisPlot import bAnalysisPlot
def analyze_folder():
detection_parameters = sanpy.bDetection().getDetectionDict("Fast Neuron")
folder_path = '/User... |
4c304f97a1a49dac829cd3e6682d011d14aeb24c087b3ad2c97ab573104ddd88 | Python | 2,799 | 97 | import numpy as np
import pandas as pd
import nibabel as nib
import os
import sys
volume_per_roi_desired = int(sys.argv[1])
participants = pd.read_csv(
os.path.join("/workspaces", "bha2", "data", "participants.tsv"), sep="\t"
)
brain_lobules = [
"Frontal",
"Parietal",
"Occipital",
"Temporal",
"... |
5a27c883e3ccfac59b45e44c77c91475375328a97f0ccf86e830c2f1b0b6d2f1 | Python | 2,799 | 112 |
import numpy as np
from scipy.signal import find_peaks
from sleepy.processing.valley import Valley
class Signal:
def __init__(self, data, samplingRate):
self.data = data
self.samplingRate = samplingRate
@property
def zeroCrossings(self):
try:
return ... |
642d48cea8dffa46d4bff7a4295481cf21f055860e881dae3697eb66402ac9d8 | Python | 2,800 | 81 | import bz2
from importlib.machinery import SourceFileLoader
import os
import sys
import pkg_resources
from setuptools import setup, find_packages
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
model_capacities = ['tiny', 'small', 'medium', 'large', 'full']
weig... |
898169521101b4e611de2fda85f49cc3cbcb791804089f223b987ac0fb5a0d82 | Python | 2,800 | 87 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: main
# CreatedDate: 2019-06-14 19:20:26 +0900
# LastModified: 2019-10-05 16:42:26 +0900
#
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
from barplot_annotate_brackets import barplot... |
5b724f56ddd21b17c3cf8948611f52d29910aaa3fb24bd75cb441bf0ff3f9d4d | Python | 2,802 | 77 | """
Implementation of a network using an Encoder-Decoder architecture.
"""
import torch.nn as tnn
from torch import Tensor
from reinvent.models.linkinvent.networks.decoder import Decoder
from reinvent.models.linkinvent.networks.encoder import Encoder
class EncoderDecoder(tnn.Module):
"""
An encoder-decoder ... |
9d04a1462c206b1cb3dac58cc4154677e5d23c9b5471a89684f90920f1d94dd2 | Python | 2,802 | 81 | import yaml
import os
import collections
from utils import logger
from utils.ddp_utils import is_master
from utils.download_utils import get_local_path
try:
# Workaround for DeprecationWarning when importing Collections
collections_abc = collections.abc
except AttributeError:
collections_abc = collections... |
0f12c2eded3ce55adca123e137b326398452a4d33c9dea83b4bd7de7f9fea6b2 | Python | 2,803 | 61 | import numpy as np
import torch
from torch.utils.data import DataLoader
from metric import *
from models import *
from data import *
import argparse
import sys
import os
from evaluate import Tester
smile_ids = {'qm8':0, 'qm9':0, 'lipo':0, 'freesolv':0, 'delaney':0, 'pcba':129, 'muv':18, 'hiv':0,
'bace':0, 'bbbp':... |
6af4dd53e5a80078e0845f331441ac8f0aca3f2f2612557f4f73f8d4343e88eb | Python | 2,803 | 72 | from typing import Any, Callable, Sequence
from jax import numpy as jnp
from flax import linen as nn
from .flax_utils import linear_activation
from .jax_utils import val_and_jacrev, val_and_jacfwd
from jax import vmap
from .HelmholtzModel import helper_get_alpha
Dtype = Any
class TransportModelResidual_PVT_Tinv(nn.Mo... |
3142b3317e62b91211ee13f812c93c9cc78a7ac563c256f2b78860615192f46f | Python | 2,804 | 78 | try:
import accimage
except ImportError:
accimage = None
from PIL import Image
class SmallScale(object):
"""Resize the input PIL Image to the given size.
Args:
size (sequence or int): Desired output size. If size is a sequence like
(h, w), output size will be matched to this. If si... |
65ff161958c5985946c3fcfa8b5ee83f3b79f9a3084f8fb50a62d8d00f789022 | Python | 2,804 | 70 | """
Plot an example signal trace before and after application of some processing steps.
"""
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
from pathlib import Path
import os
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
from utils.parse import none_or_floa... |
bb569e8055583c626b181ec7d68cd0d68ab24e434b94fcfede615feb14cffa29 | Python | 2,804 | 88 | #!/usr/bin/env python3
import PyCmdMessenger
import time, string, sys, struct, random
BAUD_RATE = 115200
TYPE_LIST = ["kBool",
"kInt16",
"kChar",
"kString",
"kString2",]
class ArdCom2(object):
COMMANDS = [["kAcknowledge","s"],
["kError","s"],
... |
4eb44374f50394f6b1341f1931b0568da8a412b6cf1bde6f38d400372b971467 | Python | 2,805 | 77 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 15:26:57 2020
@author: lenovo
4650"""
import requests
from lxml import etree
import csv
url="http://huanglab.phys.hust.edu.cn/pepbdb/browse.php"
pep_ids=[]
for i in range(1,266):
surl=url+"?pagenum="+str(i)
html=requests.get(surl).text
selecto... |
aee6ba30dfbaef558b085a5351dcf5cf55ad8ef1736b26b7b5cc793e937341d3 | Python | 2,805 | 82 | from src.connectivity_functions import *
from src.io_functions import load_data
import os
import sys
import json
import nibabel as nib
project_path = sys.argv[1]
conn_size = int(sys.argv[2])
# Checking if fcm and scm are stored in tmp folder
if os.path.exists(os.path.join(project_path, "tmp", "n" + str(conn_size) + "... |
ea571ae52c19fa5312c2eca3cbfdb59222d07a06d72d3444dfc5600f5f31674f | Python | 2,807 | 83 | # 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
#
# Unl... |
36d61cb3c4f195e8c1a698a982a5bd1b4bf1d1a3db63257a7e757df5e92bfeb0 | Python | 2,808 | 67 | import numpy as np
from sleeprnn.data import utils
def transform_predicted_proba_to_adjusted_proba(
predicted_proba, optimal_threshold, eps=1e-8
):
"""
Adjusts probability vector so that
adjusted_proba > 0.5 is equivalent to predicted_proba > optimal_threshold
:param predicted_proba: vector of pr... |
57f2a49b87c3de1a61ce849dba22317e3460da80cf59ec4efefa18ef7091c53a | Python | 2,810 | 98 |
'''
Example showing basic hardware-timed (clocked or "real time") analog output
pinidaqmxegs.ao.HardwareBasic
Purpose
Generates a class that can be used interactively set the voltage of an AO line.
If instantiated at the Python command prompt, the user can interact with the object.
If... |
90ae5f13a13d3927a0b794b6684ae0bb475b6868404d3859d0f0a6cab3cdfd2d | Python | 2,812 | 42 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
3683cc3c4d81ec351a45bdf0a23c4b2baddbecaa8368e178ab69ec62dfda5ad2 | Python | 2,813 | 82 | # Copyright (C) 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
from glob import glob
import numpy as np
from sklearn.model_selection import train_test_split
from openfl.federated import KerasDataLoader
class KerasHippmapp3rsy... |
e86592853768c4d30226623a072fbf42fe7ce67f2a8d9d1e3da3c62206b030a5 | Python | 2,814 | 80 | import unittest
from rdkit import Chem
from reinvent.chemistry import conversions
from tests.chemistry.fixtures.test_data import (
INVALID,
ASPIRIN2,
METHYL_3_O_TOLYL_PROPYL_AMINE,
METHYL_3_O_TOLYL_PROPYL_AMINE2,
CELECOXIB2,
ASPIRIN_INCHI_KEY,
CELECOXIB_INCHI_KEY,
)
class Test_general_che... |
6555f3c6f1a048889c2cb5ec407163a137dd1da41dee3cb264b8380702c5c052 | Python | 2,815 | 75 | """Tests for the magnetic data augmentation used to train non-SOC models.
--data_aug_magmom is not a regularizer here: it is how a spin-orbit-coupled
architecture is taught the non-SOC symmetry. It rotates the magnetic moments
while leaving the positions alone, so over training the model sees every
orientation of the ... |
6f8bc2d71d366cea6f60420312ddcb58fc9ed72f5aa46e6e6f5a2f6659aeaa54 | Python | 2,815 | 78 | import sys
import pandas as pd
import timeit
import numpy as np
import torch
import matplotlib.pyplot as plt
import seaborn as sns
import tqdm
from dynaphos.simulator import GaussianSimulator
from dynaphos.utils import load_params, load_coordinates_from_yaml, Map, \
get_data_kwargs
from dynaphos.cortex_models imp... |
83986acf02160f2b57924b29d0a7167488731671cca0a097debb7a263b952e1d | Python | 2,815 | 87 | import torch
import torch.nn as nn
import torch.nn.functional as F
import pyro
from .GCN import GCN_Body
class aug_module(torch.nn.Module):
def __init__(self, features, n_hidden=64, temperature=1) -> None:
super(aug_module,self).__init__()
self.g_encoder = GCN_Body(in_feats = features.shape[1], n... |
94deff54d5fb4f661d44ad03b713fb02a1f834648b8eb974bfd409d322d54e0d | Python | 2,815 | 88 | """
Module for .VTU files
.VTU files are VTK files with XML syntax containing vtkUnstructuredGrid.
Further information related with the file format available at url:
https://www.vtk.org/VTK/img/file-formats.pdf
"""
from .basevtkhandler import BaseVTKHandler
class VTUHandler(BaseVTKHandler):
"""
... |
9a3e5fc57c77eafcc64669c29704ae9c9d3b3a6f46dcf9212517b91c666a6018 | Python | 2,816 | 102 | import os
import argparse
import logging
import numpy as np
# use this format to tell the parsers
# where to insert certain parts of the script
# ${imports}
import glob
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def parse_args():
# Argument Parser
parser = ... |
f24639188a71887cf367a531adc6ea8d1c8e538efa63a7043fbc31621173b1c2 | Python | 2,819 | 87 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: main
# CreatedDate: 2019-06-14 19:20:26 +0900
# LastModified: 2019-10-05 16:42:26 +0900
#
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
from barplot_annotate_brackets import barplot... |
5059ab6a501e65b456a12146b8eaa609cc2f09b6d5be8c84eb1dc48a9c5a4287 | Python | 2,821 | 66 | """Selected assessments recompute one stage without invoking the full assembly line."""
from pathlib import Path
import polars as pl
import pytest
from typer.testing import CliRunner
from vdjdb.cli import app
from vdjdb.emit.vdjdb3 import read_table
runner = CliRunner()
def observations():
return pl.DataFrame(... |
544b1387ba8b03b048f8d1e648e51436cdc8f1841387d11512bd31637db14ef3 | Python | 2,821 | 44 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
344fac83b412604327b9b4a37af8936c38ea3860a8d443f67ebf7f57e71a99c1 | Python | 2,823 | 70 | """
Plot an example signal trace before and after application of some processing steps.
"""
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
from pathlib import Path
import os
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
from utils.parse import none_or_floa... |
5d734c6263253ab1e1f81d3646effe0a5a5ab6d2fd81c2c207ed6c399aebbeb5 | Python | 2,829 | 83 | import json
from datetime import datetime
from channels.generic.websocket import AsyncWebsocketConsumer, AsyncJsonWebsocketConsumer
class CurtainConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.session_id = self.scope['url_route']['kwargs']['session_id']
self.personal_id = self.sco... |
45571d06ad18a41ebc972082ae823fd753267ac44ca299d63e6f306c430b60be | Python | 2,830 | 105 |
from skimage.color import gray2rgb
from sparse_ct.tool import plot_grid
from sparse_ct.data import image_to_sparse_sinogram
from sparse_ct.reconstructor_2d import (
IRadonReconstructor,
SartReconstructor,
SartTVReconstructor,
... |
e329b87b7ec1217ae073aedcfc0dda1dd3d75a86dd4b818307ae0b540c168445 | Python | 2,832 | 114 | import time
from typing import Optional
import sys
import os
text_colors = {
"logs": "\033[34m", # 033 is the escape code and 34 is the color code
"info": "\033[32m",
"warning": "\033[33m",
"debug": "\033[93m",
"error": "\033[31m",
"bold": "\033[1m",
"end_color": "\033[0m",
"light_red"... |
060200128c0365e638a5250372d5000c381dac356bf40b0bda39f987821e8e93 | Python | 2,833 | 72 | from .affine_model import AlignerAffineModel
from .polynomial_model import AlignerPolynomial2DTransform
from .rotation_model import AlignerRotationModel
from .similarity_model import AlignerSimilarityModel
from .thinplatespline_model import AlignerThinPlateSplineTransform
from .translation_model import AlignerTranslati... |
598fc0eb317cabc31f5bd04218b616af35e726ab932bf46f399554351f5c4a4a | Python | 2,835 | 72 | # 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... |
687d47771d9c4409383abe65ca3b1ecbc76d42ede973aaf9ae60d451aea6dd37 | Python | 2,836 | 73 | """
Plots excerpts of the input data with its corresponding metadata.
"""
import numpy as np
import argparse
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
from utils.parse import parse_plot_channels, ... |
a783af743a7cf6b9c33e3f95be7136444713e10dbe33c25e95122c62036337fc | Python | 2,838 | 83 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sqlite3
import time
import logging
import tests.end_to_end.utils.exceptions as ex
# Database schema:
# Table: key_value_store
# Columns: key, value
# Table: next_round_tensors
# Columns: id, tensor_name, origin, round, rep... |
cfa5371d1982278d675de8b9953581771b904648aedba6b7db44f209eca98bbf | Python | 2,839 | 90 | from .manifold import ManifoldTestData
from .mixins import GroupExpMixinsTestData
class _LieGroupMixinsTestData(GroupExpMixinsTestData):
def compose_vec_test_data(self):
return self.generate_vec_data()
def inverse_vec_test_data(self):
return self.generate_vec_data()
def compose_with_inve... |
ba3677aad3d6c9ef64405814090186c27a16b7d7d90dbc61c922a0f6b8c0e82c | Python | 2,840 | 44 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
ae6d640d87460669119d110ec456de0fc142c3277c3357561113a71e50fe6dab | Python | 2,841 | 90 | # import pdb
import pandas as pd
def supp2emptytimestamp(input_filepath, output_filepath=None, mode='zero', logging=False):
'''
input_filepath: pd.DataFrame or str [path] (xxx.csv)
output_filepath: None (return pd.DataFrame) or str [path] (/write/to/your/path/xxx.csv)
mode: str ["zero", "prev_frame"]... |
1e33389c5b906744443b058348f467307285afc3a4a6461ba5a7c27bfd6ef400 | Python | 2,842 | 96 |
import numpy as np
import pdb
from matplotlib.ticker import FuncFormatter
import time
class Timeline:
def __init__(self, axis, settings):
self.axis = self.customizeAxis(axis)
self.settings = settings
def plot(self, points, currentPoint, currentInterval):
"""Plots a t... |
a5e65094b7c6cbf11e9172d4b7d755212c0763c83d894cde09a1f552723a9a50 | Python | 2,844 | 62 | import os
import sys
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import Parameter
from .opt import args
from .AE import AE
from .GAE import IGAE
class Pre_model(nn.Module):
def __init__(self, ae_n_enc_1, ae_n_enc_2, ae_n_enc_3, ae_n_dec_1, ae_n_dec_2, ae_n_d... |
b62ee8b743d3f29225b6534ea902de8df2c55eeeee1cc814b487f995354b25c9 | Python | 2,845 | 88 | import numpy as np
import pandas as pd
from numpy.testing import assert_raises
from gemmr.data.preprocessing import *
from gemmr.data.preprocessing import prepare_confounders, preproc_sm, \
preproc_fc, _check_features, _smith_feature_names
def _mk_fc():
np.random.seed(0)
X = np.random.normal(size=(33, 8... |
6a614f62514d20890f5717e6069f2f8da17b205a6824bd07857c048c174dfc59 | Python | 2,847 | 87 | ################################################################################
# Import, Set up MPI Variables, Load Necessary Files
################################################################################
from __future__ import division
import os
from os.path import join
import sys
import matplotlib
import ma... |
fe27a581a9f591cba425a602b08708ccce8bd61490f0b997a23809e82167b3d0 | Python | 2,848 | 82 | from collections.abc import Sequence
import numpy as np
from qtpy.QtCore import QPoint, Signal # type: ignore[reportPrivateImportUsage]
from qtpy.QtGui import QColor
from qtpy.QtWidgets import QWidget
from idtrackerai.base.animals_detection import process_frame
from idtrackerai.GUI_tools import CanvasPainter
class... |
e254e9b8b551592d4fde3c5d1c9ab18bf662752de617cb3b62212f41305ed407 | Python | 2,850 | 78 | """
--------------------------------------------------------------------------------
Date: 11/10/2021
@author: Nikolaos Vardalakis
--------------------------------------------------------------------------------
Implementation Notes
--------------------------------------------------------------------------------
... |
cd7786dd30325ec0a80f435bf56af021f4023bc823bff9449323a02a020ae853 | Python | 2,851 | 88 | # 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
#
# Un... |
6d448154ad6d50b5ea10ee3aaa538602be851643bdecbe1c5d23f225f1bebe15 | Python | 2,852 | 65 | import json
data = {}
data['ngpu'] = 1
data['lr'] = 0.001
data['batchSize'] = 128
data['modelRoot'] = 'best_models'
data['dataRoot'] = "../../data/new-lba/"
data['labelFile'] = "labels113683228-0.1-10.0-0.01.in"
data['matFile'] = "sequences113683228-0.1-10.0-0.01.in"
data['nTrainSamples'] = 99500
data['nTestSamples']... |
453ae6711c5ee0af03cdff866ca4828f74596e20b5fdc955b302e3f91934d968 | Python | 2,854 | 107 | """Discrete-path related machinery."""
import geomstats.backend as gs
from geomstats.numerics.finite_differences import forward_difference
from geomstats.numerics.interpolation import UniformUnitIntervalLinearInterpolator
class UniformlySampledPathEnergy:
"""Riemannian path energy of a uniformly-sampled path.
... |
d2467c4c551ca9d42f09d629c19f17386f05f942475b620ce357ed96e6bbbebe | Python | 2,855 | 92 | """Run an external scoring subprocess
Run external process: provide specific command line parameters when needed
pass on the SMILES as a series of strings at the end.
"""
from __future__ import annotations
__all__ = ["DockStream"]
import os
import logging
import copy
from typing import List, Optional
import numpy... |
02a0bfb2a8e87843b2f50551bd1958d3913588891a780cbf0dcd4e859aaf7d87 | Python | 2,856 | 85 | """
source:
https://github.com/open-neuromorphic/open-neuromorphic.github.io/tree/main/content/english/blog/spiking-neural-network-framework-benchmarking
"""
import torch
import numpy as np
from utils import benchmark_framework, allplatformscallable
def ship():
from SHIP import network, inputN,wireS,l... |
567d844aa9a7859e00b79219b1fb4d1413b93e27029f11dd0a640d785e108d3a | Python | 2,856 | 68 |
from sparse_ct.tool import plot_grid
from sparse_ct.data import image_to_sparse_sinogram, ellipses_to_sparse_sinogram
from sparse_ct.reconstructor_2d import (
IRadonReconstructor,
SartReconstructor,
SartTVReconstructor,
Sar... |
7979a73857095dcc47ace125f83dea32cca36edcad8ea776933ee649d757b5d2 | Python | 2,856 | 44 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
75c87e9329c2e83289d2b782515dcd2685a9adb5634c57a816951ef20c2a6161 | Python | 2,859 | 88 | import numpy as np
import scipy
import scipy.io
import scipy.linalg
import seaborn as sns
import math
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import pandas as pd
import torch
import os
def create_synthData(N=400, outDir='./', device='cpu'):
'''
creating Main p... |
11afad3ddf1724a7618a06399fff8eed998e0dc7149859bc413ba25bdf4c2a45 | Python | 2,860 | 45 | import datasets
import tabular_experiment
import experiment
img_basepath = 'saved-data/plots/'
chess_experiment = tabular_experiment.TabularExperiment(datasets.TabularDataset.CHESS)
# chess_experiment.train_models(10,50,1000)
chess_experiment.load_models(10)
chess_experiment.run_experiment(experiment_type=experiment.... |
cc1ad856f2d8574c1db79a6858ed8521f15b819d64504a76ab21d8aa0aa504c0 | Python | 2,860 | 84 | #!/usr/bin/env python
import json
import sys
import nibabel as nib
import numpy as np
def get_phase_encode_txt(
bzero_nii: str,
json_file: str,
phenc_txt: str,
smk_config: dict,
) -> None:
# Load relevant data
with open(json_file) as json_fname:
json_dwi = json.load(json_fname)
bz... |
ffdddee5acb02be9ef4ec1aaa353e60c87240b8703e7b1c055cd12e0c104e432 | Python | 2,860 | 98 | import random
import pytest
from geomstats.geometry.general_linear import GeneralLinear, SquareMatrices
from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.geometry.general_linear import GeneralLinearTestCase
from geomstats.test_cases.geometry.lie_algebra import MatrixLieAlgebraTe... |
d671a2f0c6b1618343bb7e7ce6315ac11c8e3f0074f6bbc12b711a9486a39cb0 | Python | 2,862 | 101 | import torch
class linear_gcca():
def __init__(self, number_views=3):
self.U = [None for _ in range(number_views)]
self.m = [None for _ in range(number_views)]
def fit(self, H_list, outdim_size):
r = 1e-4
eps = 1e-8
top_k = outdim_size
AT_list = []
... |
fcbed759ae74c7b613a051e87f4f945fb3b61e10108ca9f3d7f954de46199241 | Python | 2,862 | 87 | """Example script to make a parity plot from the results of using `nequip.train.callbacks.TestTimeXYZFileWriter`.
Thanks to Hongyu Yu for useful input: https://github.com/mir-group/nequip/discussions/223#discussioncomment-4923323
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
import ase.io
... |
d8b4bcc153d895023208cafb7e00a7aca7deccc9001b9e34812a1468f37f6f77 | Python | 2,865 | 90 | """nltools.algorithms — the functional core of nltools.
Every user-facing statistical function and algorithm is importable flat from
here (`from nltools.algorithms import fdr, zscore, isc`), organized into
focused submodules underneath:
- **corrections**: multiple-comparison corrections (FDR, Holm-Bonferroni, thresho... |
56f7d3d22ace7039ce6f3dee926ae9e38155021c921a329a13137bbca29d2adc | Python | 2,866 | 88 | # Copyright (C) 2024 Intel Corporation
# Licensed subject to the terms of the separately executed evaluation license agreement between
# Intel Corporation and you.
import os
import modin.pandas as pd
from openfl.federated import XGBoostDataLoader
class HiggsDataLoader(XGBoostDataLoader):
"""
DataLoader for... |
efad2511187e09c48f7988ea9887d93b7efc091c4b4f5bd729be8fbe7fa496f1 | Python | 2,867 | 90 | import os
import ast
import numpy as np
import pandas as pd
import torch
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset
class RealFlashPatterns(Dataset):
def __init__(self, data_root, num_species, augmentations, n_classes, data_path):
super().__init__()
self._dat... |
a80457b71f43fe29c7e0124f29778d8a7803a78bac8bf3a7f86e744b8f0464d3 | Python | 2,868 | 107 | """ This module contains linear backward model"""
import tensorflow as tf
from task2_regression.models.vlaai import pearson_tf, pearson_tf_non_averaged
@tf.function
def pearson_loss_cut(y_true, y_pred, axis=1):
"""Pearson loss function.
Parameters
----------
y_true: tf.Tensor
True values. Sh... |
24231db41eed59e8fc78c26e758613520291f2a0d1d41b63b67a46d996743de4 | Python | 2,869 | 71 | """Tests for Adjacency I/O: write, read, graph conversion."""
import os
from pathlib import Path
import numpy as np
import networkx as nx
from nltools.data import Adjacency
class TestAdjacencyIO:
def test_write_multiple(self, sim_adjacency_multiple, tmpdir):
"""Multiple adjacency matrices round-trip th... |
5bc22606c18ab52570d9c194d82559c1faaaf9c1fca1294cc2111b338ae64213 | Python | 2,873 | 77 | """
Detect trigger times (i.e., state transition / local wavefronts onsets)
by applying a threshold to each channel signal.
"""
import neo
import numpy as np
import argparse
from utils.io_utils import load_neo, write_neo
from utils.neo_utils import remove_annotations
CLI = argparse.ArgumentParser()
CLI.add_argument(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.