sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c50f3facc2a085358c89bbe43bb8118d34d97d88f803206da5ba165d6c384664 | Python | 8,614 | 261 | # -*- coding: utf-8 -*-
#
# optimizer documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 12 01:59:02 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
ac2a764e46fce2dd2701a5ff8ebf1d23e6e690dbde2ee31be2651fd4e5fd4b97 | Python | 8,615 | 263 | import math
import warnings
import torch
import torch.nn as nn
def _fill_truncated_normal_(tensor, mean, std, a, b):
def norm_cdf(x):
return (1. + math.erf(x / math.sqrt(2.))) / 2.
if (mean < a - 2 * std) or (mean > b + 2 * std):
warnings.warn("mean is more than 2 std from [a, b] in nn.init.... |
d11e4ccb47718f45fddd42d131cfe8ee629cc8eb57416cdb6ed126a7096c8ffb | Python | 8,619 | 244 | from copy import deepcopy
import numpy as np
import symengine as se
from jitcdde import y as state_vector
from .....utils.stimulus import Input
class NeuralMass:
"""
Represents a neural population with given parameters and equations, in
particular, the derivatives of the state vector.
"""
name ... |
196c74c59cc36f160c522da4ad56bf6ef55ea8b6a5dd69ecbbad77a8d918eaa3 | Python | 8,622 | 311 | #!/usr/bin/env python
# coding: utf-8
# ## Analysis of drug response binary classification with held-out cancer types
# In[1]:
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import pancancer_evaluation.config as cfg
import pancancer_evaluation.uti... |
99c88a804bc422eca9d1f301a99a7d997dffcb1f6ffe4dae9bf723344e34915f | Python | 8,622 | 193 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
####################################################
#... |
029cc2e841ff94278efd084cbe36a80c9873c1fbbe95567f22799c20c6700f30 | Python | 8,623 | 215 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
31d25383c03a67a1a7c133fde133b7daa45082f56d563837a61cff37e81385aa | Python | 8,624 | 238 | import torch
from torch import nn
from elasticai.creator.nn.integer.batchnorm1d.design import (
BatchNorm1d as BatchNorm1dDesign,
)
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.in... |
a4ffb8076c9c445d98a6df756ab09c7ede7002a2cd0f884298985d0f56105ed0 | Python | 8,625 | 169 | # python imports
import os
import glob
import sys
import random
import numpy as np
import scipy.io as sio
import utils
import subspacemodels
import kernels
import dists
if __name__ == '__main__':
#load data
#training_data=numpy array of size M,N where M is the data dimension an N is the number of samples. ... |
3cb59bb5111738d1e68011e11407a15fa7c901b5aef442c247f7997c08b83210 | Python | 8,627 | 191 |
# coding: utf-8
# In[ ]:
'''
Mayank Oct 10 2016
'''
from __future__ import division
from __future__ import print_function
from builtins import str
from builtins import range
from past.utils import old_div
import tensorflow
vv = [int(v) for v in tensorflow.__version__.split('.')]
if (vv[0]==1 and vv[1]>12) or vv[0]=... |
36862e1f36da8cd1a6f67fc999ae2aebeb34ca38e052be9468e02b05252f08b3 | Python | 8,628 | 234 | """Wheels support."""
import email
import itertools
import functools
import os
import posixpath
import re
import zipfile
import contextlib
from distutils.util import get_platform
import setuptools
from setuptools.extern.packaging.version import Version as parse_version
from setuptools.extern.packaging.tags import sy... |
e639eaa6501b7c4f6a080a0674eadb2ad9cd4b1c44e4ddaeaacb75b3786b238e | Python | 8,634 | 266 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
5d67a23ee86f8315ca3ccd3bccb908e6a1d289bdf7890eff74a20a6f9cc2e6de | Python | 8,636 | 227 | from itertools import chain
import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.por... |
8980b53d939265de521b71dad3d2967e2a4e518015c54af0e73195cd83672867 | Python | 8,636 | 260 | from volume import *
# import copy
from skimage import measure
from collections import defaultdict
#For visualization
from tvtk.api import tvtk
from mayavi import mlab
def marche_cubes( ids , volume):
""" Given a segmentation volume and set of ids,
it first computes a boolean volume, where every voxel
... |
851a20b118b529b6ba721f36f60afdda81e6c7721d1e56ee74fb2d935ac4dfe5 | Python | 8,637 | 204 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
0891c4b9cdfc810917d146b76c1acc348662a049cbb74359ecaf9f1b903bb88c | Python | 8,640 | 207 | import os
import random
import shutil
import unittest
from torcheeg import transforms
from torcheeg.datasets import (AMIGOSDataset, DEAPDataset, DREAMERDataset,
MAHNOBDataset, SEEDDataset, SEEDFeatureDataset,
SEEDIVDataset, SEEDIVFeatureDataset,
... |
a2a97ea74f75c2ae933b010b9c8d96de6ef3e3e7a621950d0a5ee5382cbca76c | Python | 8,640 | 240 | import os
import pandas as pd
SPATIAL_HELP = (
"Directory containing 10x visium spatial data (tissue_hires_image.png, scalefactors_json.json, "
+ "and tissue_positions_list.csv) "
+ "or a directory containing `image.png`, `positions.image.csv` "
+ "with headers barcode, x, and y, and optionally `diame... |
74f62e2d01618e881719198df647974a23e237cc915dd42366173800c5e38313 | Python | 8,641 | 251 | from __future__ import print_function
import collections
from itertools import product
from pddlstream.language.constants import EQ, AND, OR, NOT, CONNECTIVES, QUANTIFIERS, OPERATORS, OBJECTIVES, \
Head, Evaluation, get_prefix, get_args, is_parameter, is_plan, Fact, Not, Equal, Action, StreamAction, \
Functio... |
f8f3d1c9159d148fccc6c0d87bc6be0f77c7dbcadbe7705d302f812f8a1cc69f | Python | 8,642 | 187 | import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import mne
from Functions.f_TRC_Reader import *
from Functions.f_SignalProcFuncLibs import *
from Functions.f_AnalysisFunctions import *
import pandas as pd
str_DataPath = './../RawData/'
str_OutPath = './../Data/EMGFeatures/'
if not ... |
55ce5045cbd4b33ea7472087d200beeca46cba5b2bdc9bed8d3e4e063e051965 | Python | 8,644 | 261 | # -*- coding: utf-8 -*-
#
# Collection of I/O utility functions
#
# Builtin/3rd party package imports
import os
import sys
import shutil
import inspect
import numpy as np
from datetime import datetime
from glob import glob
from collections import OrderedDict
from tqdm import tqdm
if sys.platform == "win32":
# tqd... |
1083fd31c462661426ad16748e21593083e9ab3608aa99f8c86cb09eb4974dbf | Python | 8,645 | 221 | import torch
import torch.nn as nn
class Conv2dWithConstraint(nn.Conv2d):
def __init__(self, *args, weight_norm=True, max_norm=1, **kwargs):
self.max_norm = max_norm
self.weight_norm = weight_norm
super(Conv2dWithConstraint, self).__init__(*args, **kwargs)
def forward(self, x):
... |
e413cf478d76fcad726f5ad4f0852825e512e7a15fec4423e4ce1a7e0335c955 | Python | 8,645 | 183 | # Ultralytics YOLO 🚀, AGPL-3.0 license
from copy import copy
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import torch
import torch.nn.functional as F
from ultralytics.nn.tasks import SegmentationModel
from ultralytics.yolo import v8
from ultralytics.yolo.utils imp... |
4a1fe66667f5d516eac8471e31c2c922588a31b5f849c81606e827042e20d227 | Python | 8,646 | 219 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
9e5ba2c49f869c2f59e3c08d887eba7a9f8514c0cbf9c421b034f66abadefd10 | Python | 8,648 | 299 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
9a87b0330cedc2cfd5545cee7a605c41225eb47ff728679d15cccad425d9c1c9 | Python | 8,649 | 205 | import numpy as np
import networkx as nx
import torch
from torch_geometric.utils import from_networkx
import time
import os
from sklearn.preprocessing import normalize
from cdlib import NodeClustering
from read_string import *
def compute_centrality_measure_features_old( G : nx.Graph, dataset_name : str ):
d... |
6d854ba449470f35c29daafdb9af3bc230f25ee12aae4140bdf1cd93ad5be877 | Python | 8,650 | 242 | import math
from typing import List, Union
import os
import seaborn as sns
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from tqdm import tqdm, trange
from rdkit import Chem
from rdkit.Chem.Draw import Simil... |
1b6cf7ed3bd38f416bc5f774822ba538d6a89b527ecd50a877d346cd98579435 | Python | 8,654 | 290 | import os
import argparse
import numpy as np
import pandas as pd
import torch
from maldi_nn.models import SpeciesClassifier, MaldiTransformer
from maldi_nn.utils.data import SpeciesClfDataModule, MALDITOFDataset
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
from lightning.pytorch.loggers import... |
050ec537568567687c6f3aaba20079e4017bd3bd5ddea0e8bbafe2bb79cd3a12 | Python | 8,655 | 227 | import logging
import numpy as np
from chspy import join
from ...utils.collections import dotdict, flat_dict_to_nested, flatten_nested_dict, star_dotdict
from ..model import Model
from .builder.base.constants import NETWORK_CONNECTIVITY, NETWORK_DELAYS
from .builder.base.network import Network, Node
# default run pa... |
cee71a0a7e62d50b899b6aa617b012a3b4fe2fc8f41a2a2dc903bd61d6bfbac3 | Python | 8,655 | 225 | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
import re
import tempfile
from collections import Counter, defaultdict
from typing import Any, Dict, List, Optional, Union, Iterable
import torch.distributed as dist
from supar.utils.parallel import is_dist, is_master
from supar.utils.vocab import ... |
e229d9596b1f512ab3577f4c701e16b8603bc22226c09204b6c0a5d03f251b2c | Python | 8,655 | 88 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
a0790ff7af90d6cbdb87c758602a84e1be7f9865f896a438eb2f5a567f7529b8 | Python | 8,656 | 190 | import numpy as np
import nibabel as nib
import re
import os
import ants
import argparse
import json
from argparse import ArgumentParser
from pathlib import Path
from sys import argv
from glob import glob
from utils import get_file, align, transform, get_tacs, get_dynamic_parameters
from analysis import variable_def
fr... |
3e3a94d531a61fb107e01c6395d25b42a5683e0e5fbc15f5605f4d3e1a488533 | Python | 8,657 | 228 | ##
# \file admm_solver.py
# \brief Implementation to get an approximate solution of the TVL2-SRR
# problem via the Alternating Direction Method of Multipliers (ADMM)
# method.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date July 2016
#
# Import libraries
import Sim... |
f69873bf0d93274078eaefd7fbaff3e21b8b91d3f536156bc72832b9d986f55d | Python | 8,659 | 240 | #!/usr/bin/env python
#
# Copyright 2009, 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... |
4cbe9965fc5860d7c3b1d9a6cf29e958907c2e200e57941ea117be8ac41471b3 | Python | 8,666 | 286 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# adopted from TF-Modisco
def compute_per_position_ic(ppm, background, pseudocount):
"""Compute information content at each position of ppm.
Arguments:
ppm: should have dimensions of length x alphabet. Entries along the
a... |
73b2be76fe4dc0aaa9448378debdc4313357ccebe429480f503596ddc92fef1a | Python | 8,666 | 285 | import numpy as np
from hippo.models.cscg_tools import extract_AB
from hippo.agents.memory import Memory
from hippo.free_energy.tree import construct_tree
from hippo.free_energy import free_energy
from pymdp.maths import softmax
from gymnasium import spaces
import networkx as nx
from functools import cached_propert... |
f4446009b5244cce82c5b19d8e312cc56c95dd5207b26b4e1eadeb0d6e5920ca | Python | 8,666 | 203 | # trace generated using paraview version 5.5.1
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'EnSight Reader'
heart_remeshed_3D_MAPSensicase = EnSightReader(CaseFileName='heart... |
bd33334ddc120f257c77f75282ab944dd5a0045a00fd6df49dfc44243b2c8514 | Python | 8,670 | 284 | # util.py
import inspect
import warnings
import types
import collections
import itertools
from functools import lru_cache, wraps
from typing import Callable, List, Union, Iterable, TypeVar, cast
_bslash = chr(92)
C = TypeVar("C", bound=Callable)
class __config_flags:
"""Internal class for defining compatibility ... |
167d3c3e5736ae94f4243ae615c5cad4c1d4711c4507f6e67700bfd538a6fd52 | Python | 8,673 | 234 | import sys
import pickle as pkl
import numpy as np
import scipy.sparse as sp
import torch
from sklearn.metrics.pairwise import cosine_similarity as cos
from sklearn.metrics import pairwise_distances as pair
from utils.gcn_utils import normalize
from dataloader import dataloader
def parse_index_file(filename):
"""P... |
8cb13135f3f8fae255a66fef951db641f23442507c08e8bbd31e3df42b21254e | Python | 8,673 | 200 | import logging
import os
from random import Random
import numpy as np
from copy import copy
from typing import Optional, List, Dict, Tuple, Union
from . import *
from ase.io import read
import pytorch_lightning as pl
import torch
from torch.utils.data import DataLoader, BatchSampler, RandomSampler, SequentialSampler
... |
97e3b300ad488b5356bac9b73d8fdcb20d63c22e62d2548e779ac943ec8feae8 | Python | 8,674 | 194 | #!/usr/bin/env python
## updated 1/25/2021
### convert 1000g vcf to plink files
def convert_1kg(i):
print("- Converting 1000g vcf to PLINK files" + " in chr" + str(i))
vcf_list = glob.glob("/data_global/1000g/" + args.build + "/" + args.superpop + "/*.vcf.gz")
chrnum = "chr" + str(i) + ".phase3"
vcf_fi... |
c5d3b14fddd2aa6c4d4aed35a9fbbd9324792456e484aa967e83cde990400ca8 | Python | 8,675 | 179 | # coding=utf-8
# Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. 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/... |
f46228ab793188bcad187bc85ab8e8255137abf6edb44d606f29877f6755b876 | Python | 8,675 | 239 | #! /usr/bin/python3
#
# Copyright (c) 2018 Warren J. Jasper <wjasper@ncsu.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) a... |
137d6ea462c7770de14b34a36c8fe04e130777289148744116fbeb96d0ee6b86 | Python | 8,678 | 234 | # -*- coding: utf-8 -*-
import os
import numpy as np
import tensorflow as tf
import keras
import keras.backend as K
from keras.optimizers import RMSprop, SGD, Adam
from keras.layers import Input, Dense, Activation, Dropout, ZeroPadding2D, \
Reshape, Flatten, Embedding, \
Conv2D, Conv1D,GlobalMaxPooli... |
99771c14c96b68714ca06791a2c7f780da995cf22fea143da57599aa76646880 | Python | 8,681 | 244 | from __future__ import division
import logging
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from IterativeMethod import iterativeTCCT
"""
Created on Mon Oct 29 13:48:02 2018
@author: Hannah Choi
"""
"""
This code finds hierarchy scores of cortical & thalamic areas via iterations... |
943cf66120e806cc7e159f472d5b8fcc029dd3446f47f5e1a585061c1fb44afd | Python | 8,685 | 201 | from typing import Union, Dict, List
import numpy as np
from ..base_transform import EEGTransform
class MeanStdNormalize(EEGTransform):
r'''
Perform z-score normalization on the input data. This class allows the user to define the dimension of normalization and the used statistic.
.. code-block:: pytho... |
a00c9902fe1dbbdd5fbab2638e6c6064324ef64c0ec0f2d8d43ed75f4000a608 | Python | 8,686 | 123 | """CALIBRATION.py 2026-09-25. Pre-registration: 04-NOTES/PREREG-2026-09-25e-CALIBRATION.md (sha e6d5159b...)
Is "undetermined at 95%" (Act 2's cluster test) calibrated against laboratory (bench) transmitter labels?"""
import re, numpy as np, pandas as pd
R = 'D:/eucys'
CLS = ['gaba', 'acetylcholine', 'glutamate', '... |
3f2a9a5ee14878d79fb5a60f22fafbc9c6d5fff98ca4b077934c1c9ceb26167a | Python | 8,691 | 176 | ###############################################################################################
# Emma Bailey, 14/12/2023
# Wrapper script for project to investigate somatosensory pilot ESG data
###############################################################################################
import numpy as np
import os... |
dbfa780f84bb6e5eaaeca99ab7b07969536693736652cbaf481457ef12638f9d | Python | 8,692 | 164 | import numpy as np
import pandas as pd
import json
from collections import OrderedDict
import csv
import os
from scipy.stats import pearsonr, spearmanr
def load_ground_truth(filename):
with open(filename) as f:
reader = csv.reader(f, delimiter="\t")
lines = list(reader)
expressions = [float(lin... |
e0942da2e358a7d4eb732fa79f64a179a3dbc13c0214c69c43f96bb9dc60842a | Python | 8,692 | 157 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import argparse
import os
from datetime import datetime
from utils.logger import setlogger
import logging
from utils.train_utils_combines import train_utils
import torch
import warnings
print(torch.__version__)
warnings.filterwarnings('ignore')
import numpy as np
import random
... |
0992d658f1c43ea81b720821907b7c59d3646e76d4a46385f8940921ce1e3695 | Python | 8,694 | 313 | from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
@dataclass
class NomenclatureConfig:
"""
Configuration describing how raw filenames are interpreted.
MorphoGlia canonical filenames follow:
key-value_key-value_key-value.ext
The research... |
8386caf6e26e5f384df5fadd1cc3344011b31d7534a94104a50c6d9980a1ac41 | Python | 8,694 | 230 | import os
import json
import numpy as np
import h5py
from scipy.linalg import block_diag
from ..constants import bohr2ang, hartree2ev
from .. import config as CFG
from ..utils.misc import atom_number2name
from ..matao.matao import MatAO
from .aodata import AOData
from .struio import from_deeph, sort_atoms, to_poscar
... |
9a27bb326fe8c505db151684088c688bbf546f171bb5a71b3149efa524394638 | Python | 8,694 | 273 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
ae10b5717ada54c4ec6072dad7bb3e3d8bdd3b50ea490eb6b8449a291e5bdc14 | Python | 8,694 | 368 | import numpy as np
from sklearn.metrics import silhouette_score, davies_bouldin_score, adjusted_mutual_info_score, adjusted_rand_score, f1_score, calinski_harabasz_score
from networkx.algorithms import conductance, normalized_cut_size
from networkx.algorithms.community import modularity
import networkx as nx
def inte... |
ecafa5a530afd6583292ca01987e85cf107b6d401b3a006419b7b6aa24ea25ce | Python | 8,697 | 248 | """
Python module for converting molecular structures from biotite into Blender objects.
This module provides functions to:
1. Create 3D models from biotite AtomArray objects (`create_object`)
2. Attach molecular information as attributes to Blender objects (`atom_array_to_named_attributes`)
The created Blender objec... |
978d31437925fbcc547430dd49141f0c45d93db21a3b003f7e3afd7f2bb299ff | Python | 8,699 | 272 | """
New version of run pipeline. Changes:
- Works with the unified csv.
- Can run over subsets of subjects indicated by a txt file
- Can run parallel over subjects, limiting intra subject threading
"""
import os
import pandas as pd
from contextlib import redirect_stdout, redirect_stderr
import subprocess
import shut... |
da7123b70d1bab9b97faee37bde321d781cc63a8934f2b537747b76b978eedbc | Python | 8,699 | 313 | import torch
import torch.nn as nn
##################################################
# Basic Layers
##################################################
def get_norm_layer(norm_type, num_features):
if norm_type == "batch":
norm_layer = nn.BatchNorm2d(
num_features=num_features,
mo... |
8e9c8d11d7850464470a26e79b47fc635fce5f2e831366a24edbd794cbaf6b69 | Python | 8,700 | 256 | import torch
import copy
import abc
import numpy as np
from ..utils import EnvPara
from torch.utils.data import Dataset, Sampler
from ase.neighborlist import neighbor_list
from typing import Optional, List, Iterator, Union
import logging
import numpy as np
log = logging.getLogger(__name__)
__all__ = ["AtomsDataset",... |
c36c86488f8f22af976c2baa8764271feff3e5daad9687660a9bee7994b459b0 | Python | 8,700 | 211 | import os
import torch
import random
import networkx as nx
import pandas as pd
import numpy as np
from torch.utils import data
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
from torch_geometric.data import Batch
from itertools import repeat, product, chain
from collections impor... |
8ea570417929b30aa65106680731a51d7bf958c0dea3dd228f06d1196d07c056 | Python | 8,701 | 243 | """Minimal reader for small-molecule crystallographic ("core CIF") files.
Files from crystallographic databases (ICSD, COD) use the core CIF dictionary:
flat ``_atom_site_fract_*`` tags with a unit cell and symmetry operators,
rather than the mmCIF ``atom_site`` category with Cartesian coordinates that
biotite parses.... |
47ad173143e4f7b443f968aed0215853b7408eecfedf60c1d6f964f4b71e1549 | Python | 8,702 | 239 | # -*- coding: utf-8 -*-
#
# Test Timelockanalysis and latency selection
#
import matplotlib.pyplot as ppl
import numpy as np
import pytest
import dask.distributed as dd
import h5py
# syncopy imports
import syncopy as spy
from syncopy.shared.errors import SPYValueError, SPYTypeError
from syncopy import synthdata
cla... |
6286e800843ca373fd3b9cb711c530483fd3c152deeffcafc94e9a2d75f0e915 | Python | 8,703 | 213 | import platform
import serial
import serial.tools.list_ports
import time
import numpy as np
import threading
from control._def import *
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# temporary
class Microcontroller2():
def __init__(self):
self.serial = None
self... |
d3ea7031dbc82aa501d8739858c0b60e26d70083f8170b501ec044c39d9b6fb1 | Python | 8,704 | 272 | '''
The implementation of ResNets on CIFAR10/100 as described in the original paper[1].
Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
[2] https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py
[3] https://microsoft.... |
7ecf85d0d2cfefc6813cf5c693057deffe514ac61dc9a51354fb77bb928d7bfe | Python | 8,705 | 217 | from typing import Callable, Sequence, Dict, Union
import numpy as np
from ..base_transform import EEGTransform
class Concatenate(EEGTransform):
r'''
Merge the calculation results of multiple transforms, which are used when feature fusion is required.
.. code-block:: python
from torcheeg impor... |
4795fb121ec8582c3df682e284a94108dc105c2d31f8b82d2de3d845d25a1c6b | Python | 8,711 | 236 | # coding=utf-8
# Copyright 2021 The Facebook Inc. and The HuggingFace Inc. team. 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/LI... |
f16e0abd21e0105d9f77129d9fe423dc0cc329904dff5d3724bed2a20818d627 | Python | 8,713 | 216 | import networkx as nx
import numpy as np
from cdlib import NodeClustering
from sklearn.metrics import precision_recall_curve, auc
import json
import torch
import torch.nn.functional as FN
import os
def get_filename_without_extension(file_path):
base_name = os.path.basename(file_path) # Extract the filename f... |
63a7d045b9320424216377e8c69f692d4fa99c81b62c18c08ba3dfb5c60c56a5 | Python | 8,716 | 281 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
e10b8d84a94bb251cd6bfc84307b1221bddb809f12e6461f55a586f9a32dfa85 | Python | 8,716 | 212 | # Plot parameters for best models for S1 Appendix Fig A-C
from os.path import join
from get_paths import *
import pickle
import matplotlib.pyplot as plt
import numpy as np
from colors_paultol import colors
save_flag = 0
## Load data
# Load simulation results
fname_data = "data_unified_model_search_bes... |
47a69170befb3fc50bc0ff97c0186417c8c3a6f36ca10de80310755a1603d9ec | Python | 8,717 | 182 | import copy
from pddlstream.algorithms.common import INIT_EVALUATION
from pddlstream.algorithms.reorder import get_partial_orders, get_stream_plan_components
from pddlstream.algorithms.scheduling.utils import partition_external_plan
from pddlstream.language.constants import get_prefix, is_plan, get_args
from pddlstrea... |
22508f215888312c08a653fe3023543fe3783707fc63ee2d482ea4cafbc58d0d | Python | 8,718 | 254 | #!/usr/bin/env python3
"""
Script to verify that changes are on the correct branch and in appropriate directories.
Branch naming conventions:
- standard_*: Only standard_schema/ can be modified
- score_*, lang_*, slam_*, mouse_*, testlib_*: Only corresponding library_schemas/{name}/ can be modified
- admin_*: Any file... |
38fc9b7d95bd36577bdb18a9a0b1f939bd7eb4fff17dedec18cd56386f495a97 | Python | 8,719 | 265 | from collections.abc import Callable
from typing import cast
from elasticai.creator.experimental.ir.shape_inference.shapes_calculation_functions import (
Padding,
Padding2D,
adaptiveavgpool2d_output_shape,
add_output_shape,
batchnorm1d_output_shape,
batchnorm2d_output_shape,
conv1d_output_s... |
867254c9c02c2489d85560d4423b93e1675c0b6ca8f5b1df1fef7e14b4bca005 | Python | 8,719 | 287 | from compute_opt import*
import nibabel as nib
import os
import nilearn
import nibabel as nib
from nilearn import plotting, image
import numpy as np
import matplotlib.pyplot as plt
from nilearn.masking import compute_brain_mask, apply_mask
def exp_var(S, Sp_vect, LC_pvals, name):
"""
Plot the cumulative expla... |
a761eb5e205467f1ea55c2c6a6d05c5061fa68d24435486f77dc5b840b07a558 | Python | 8,719 | 248 | try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from dreamcoder.utilities import *
from dreamcoder.program import *
from scipy.stats.stats import pearsonr
from matplotlib.ticker import MaxNLocator
import matplo... |
bfa5c16cc41af43eea6df75345f2c0d7e9315c7de718750f1f3f673443b3b044 | Python | 8,722 | 240 | # pylint: disable=too-many-statements, too-many-locals, invalid-name, unbalanced-tuple-unpacking, no-value-for-parameter
"""Script for running experiments: tuning and testing hypertuned models"""
import os
from copy import deepcopy
from omegaconf import OmegaConf, DictConfig
import hydra
import pandas as pd
import nu... |
eb6c4edf0d0d5f9f6a5f6a528464773d7d8f460a3aae32073acc79a149ef4ac7 | Python | 8,722 | 274 | # -*- coding: utf-8 -*-
#
# haussmeister documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 29 08:59:25 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... |
6d811234a52c92fe5de410665f5c0632e94703adc381bdc011642a3d4e9aab8e | Python | 8,724 | 197 | """
Script for comparing statistics from different groups of clouds
Input: - Path to the input SetCloudP pickles
Output: - Plot graphs with the statistical comparison
- Store a CloudComparator object in pickle file
"""
__author__ = 'Antonio Martinez-Sanchez'
##############################... |
e0bd542bd42bdfc28edbc0de35673d19a9d92c98bfdf5dcb43609445715dabbf | Python | 8,725 | 251 | import numpy as np
import os
import pickle
import scipy.sparse as sp
from pathlib import Path
import wget
import pickle
import os
import pandas as pd
import numpy as np
import torch
from scipy.spatial.distance import pdist, squareform
from sklearn.cluster import SpectralClustering
def get_project_root() -> Path:
... |
002514a96919314d8ed699944a97c15777f06f7e89cf34c71ab6ca5f26f97fbe | Python | 8,726 | 236 | """Base Command class, and related routines"""
import functools
import logging
import logging.config
import optparse
import os
import sys
import traceback
from optparse import Values
from typing import Any, Callable, List, Optional, Tuple
from pip._vendor.rich import traceback as rich_traceback
from pip._internal.cl... |
3d2ddc95d4081be2665eccb44998890975abe9ad8ffc8e6702b787bb596c49fb | Python | 8,727 | 216 | # Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux
# 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 b... |
9134c779e2314c7f48983e03652fceafd75aa7c9d5039017b6e02932f42cf78c | Python | 8,727 | 306 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Fit Tensor Factored Regression model
Cross-validation
Created on Thu Dec 13 2019
@author: jmagraner
"""
#%% SLURM custer scheduler specs
# As we are submitting a large number of jobs, add these lines before importing
# anything to enforce SLURM resource allocation,... |
1b76739c2117a0a5f05baf3a3a029c00b107eded6ea7042b3f504ad839cd45d0 | Python | 8,731 | 226 | """Tests for the per-section MI (registration-quality) signal on the batch-2D
tab: the pure MI-compute helper, the relative low-MI ranking rule, and the
end-to-end tab wiring (offscreen Qt)."""
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import math
import numpy as np
import pytest
... |
0b11c348e0adf1a53322e939a0bad1f17af254796c1de8b452e12301b1b71dc7 | Python | 8,733 | 282 | #!/usr/bin/env python
import logging
import numpy as np
from scipy.linalg import eigh, lstsq, solve
from sella import _gpu as _gpu_mod
logger = logging.getLogger(__name__)
from sella._constants import _LSTSQ_RCOND
def symmetrize_Y2(S, Y):
_, nvecs = S.shape
dY = np.zeros_like(Y)
YTS = Y.T @ S
dYT... |
202645fd1bc2c6a46a5b31dfabcd4a60aa749ea9a835d7385c0af77099fa97ed | Python | 8,733 | 192 | import cv2
import math
import numpy as np
import os
import os.path as osp
import random
import time
import torch
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
from basicsr.data.transforms import augment
from basicsr.utils import FileClient, get_root_logger, imfrombytes, img2tensor
... |
1638837b3382237fb65d6def2ceeda236cfcaed3be8c9c3486cf7612fd1cbed9 | Python | 8,734 | 260 | """Widget to show power spectrum.
"""
from logging import getLogger
from numpy import log, ceil, floor, min
from scipy.signal import welch
from PyQt5.QtCore import Qt
from PyQt5.QtGui import (QColor,
QPen,
)
from PyQt5.QtWidgets import (QComboBox,
... |
b41ec3845f05bdf2aa939a30c9bccd5b1f273e76da04c8f39e825d020e344b2f | Python | 8,734 | 238 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
20c5b73fc8be8ae6c611a4c2c8257439a34bf96c2cecbf950c025e3f45898961 | Python | 8,735 | 270 | import sqlite3
import re
import os
import pandas as pd
import logging
# Configure logger
workflow_logger = logging.getLogger('workflow_logger')
def _enable_foreign_keys(conn):
conn.execute("PRAGMA foreign_keys = ON;")
def create_database(database_name, database_sql ,wipe=False):
"""
This function creates... |
6e7f468ba67b0dad75c7d702328baf2cd688ce0a5332aa27b7a79e403d9f9f2f | Python | 8,737 | 307 | #!/usr/bin/env python3
"""
m6a_supervised_cnn_ont.py
Author: Anupama Jha <anupamaj@uw.edu>
This module predicts whether an
adenine is methylated or not. The
model is trained with ONT read sequence,
read quality score and methylation score
from oxford nanopore. The model is a
convolutional neural network.
"""
import t... |
fbb271ac9b414e5f2c0c07fd969d36dff31f4f548e4f6338847a92e62e2ae553 | Python | 8,737 | 245 | #!/usr/bin/env python
# coding: utf-8
# Required Libraries
from autogluon.tabular import TabularPredictor as task
from collections import Counter
from __future__ import absolute_import, division, print_function, unicode_literals
from matplotlib import pyplot as plt
from pandas import read_csv
from PIL import Image
fr... |
9214bb697fac6ff555464335f28b3e399c1b8b83b221237c0eadef35cd4093ac | Python | 8,738 | 207 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
4c6a4c2f51edb1aac0223dd500dfbe5bdf053c9a5a4a82171a1f39db4de40905 | Python | 8,740 | 280 | # sincronico
import sys
import cv2
import time
import os
from typing import Optional
from vimba import *
import threading
ancho = 800
size = 1
FPS = 30
Exp = 10
timestr = ""
changed = False
duracion = 86400
start = 0
def update(x):
global changed
changed = True
return
def setCamera... |
4de54ca52a55a6d54e359f9a3bc7a775c4d5ab0ff540e01ee431cd8d9c763a16 | Python | 8,740 | 239 | import torch
from torch_geometric.nn import MessagePassing
import torch.nn.functional as F
from torch_geometric.nn import global_mean_pool, global_add_pool
from ogb.graphproppred.mol_encoder import AtomEncoder,BondEncoder
from torch_geometric.utils import degree
import math
### GIN convolution along the graph structu... |
e659cb187173cea246a93e40cd4b55c4af57e1f4964c2c27d6496f87784d88e2 | Python | 8,745 | 219 | import numpy as np
from warnings import warn
from tqdm.auto import tqdm
from sklearn.linear_model import LinearRegression, ElasticNet
from sklearn.linear_model import Ridge, RidgeCV
from sklearn.cross_decomposition import PLSRegression
from sklearn.model_selection import KFold, RepeatedKFold
from scipy.stats import p... |
8ebcc3fe6c40e66493504762601ed21e9c65b6384f4986529d24404dbfa08117 | Python | 8,746 | 272 | # Copyright 2016–2021 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# 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-... |
2138f51a6365320a83caa02a8d1b47994373d9c448b57324bb7ce40c8306e603 | Python | 8,747 | 300 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from scipy.signal import resample_poly
from scipy.spatial.distance import euclidean
from fastdtw import fastdtw
from burst_space import BurstSpace
from help_funcs import load_exp_variables
# ----- #
# Hyperparameters.
metric = "ro... |
6f3cbe8d98e6728c9b4c3c87591617f20335d544014807390a8af10b601ec90a | Python | 8,747 | 240 | """"""
import numpy as np
import pandas as pd
import xarray as xr
from msgpack import Unpacker
from pupil_recording_interface import BaseReader
class GazeReader(BaseReader):
""" Reader for gaze data. """
def __init__(self, folder, source="recording"):
""" Constructor.
Parameters
---... |
59a03ae2d9eebddc61392f4d4b7bd355e40951f6736a9e69da5ef90e018661e7 | Python | 8,748 | 154 | import torch
from torch import nn
from torchdrug import core, data
from torchdrug.layers import functional
from torchdrug.core import Registry as R
from cg3_steps.cg3_protein import CG3_PackedProtein
@R.register("layers.CG3_GraphConstruction")
class CG3_GraphConstruction(nn.Module, core.Configurable):
m... |
e57ca083693c1d2ab2412c644599f63bce5428635db7ec25b609e8fcf4881641 | Python | 8,750 | 235 | """Write validated data into sleeplab format.
The data needs to conform to the types specified in
`sleeplab_format.models`.
"""
import json
import logging
import numcodecs
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import zarr
from sleeplab_format.models import *
from sle... |
19a3c8e8d5b79526aea2d28640ab358c5bc4807e508fe214875e2ec515c8db82 | Python | 8,751 | 154 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
d85e85fb12059bda4e841f56c632506726df5b5d0189c4c407b111ee14d603ab | Python | 8,752 | 253 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
e89c329813e65e9c86e0bf4c318d8b59342fb3ea14967a1649ebed96bd8083f8 | Python | 8,754 | 223 | import time
import os
import subprocess
import sys
import re
import argparse
import collections
import gzip
import math
import shutil
import matplotlib.pyplot as plt
import wandb
import numpy as np
import time
import pandas as pd
from datetime import datetime
import random
#import logging
#from silence_tensorflow impo... |
ea749717e8669201b5abfe5ca6056ec8f38ef1a913a440451c2dd4220a9c1f46 | Python | 8,754 | 209 | ''' This file contains some functions for preprocessing the raw data '''
import re
import gzip
import pandas as pd
import numpy as np
from tqdm import tqdm
from joblib import Parallel, delayed
from . import utils
DRACH_PAT = re.compile(r'(?=([ATG][AG]AC[ATC]))')
RRACH_PAT = re.compile(r'(?=([AG][AG]AC[ATC]))')
def ... |
14e7db83a03fddc91741c9651f380044def3513d84c3c5937af5117b27265423 | Python | 8,755 | 235 | """Write validated data into sleeplab format.
The data needs to conform to the types specified in
`sleeplab_format.models`.
"""
import json
import logging
import numcodecs
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import zarr
from sleeplab_format.models import *
from sle... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.