sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
161b20598ea46588c0b29301619953b09452f5e93dfcc555e3833ee1e8167a89 | Python | 25,245 | 509 | import time
import json
import os
import json
import joblib
from io import BytesIO
import base64
import boto3
import math
import io
import cv2
import numpy as np
# Grab environment variables
TEST_ID = os.environ['TEST_ID']
DETECTION_ENDPOINT_NAME = os.environ['DETECTION_ENDPOINT_NAME']
CLASSIFICATION_ENDPOINT_NAME = ... |
0714143deea32d340da653b4657aecdbaf0597a2cfc989c594957581414ed52a | Python | 25,251 | 631 | import math
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (Conv2d, build_activation_layer, build_norm_layer,
constant_init, normal_init, trunc_normal_init,build_conv_layer,)
from mmcv.cnn.bricks.drop import build_dropout... |
d43eb86cfa978e4cca3869602aa3d0fdb5a65ff9c7a73b2b3dec498a6890516c | Python | 25,255 | 509 |
import os
import cv2 as cv
import ardent
import numpy as np
#from torch import uint8
from GuiFunctions import save_to_saved_data_pickle
import Switches_Static as st_switches
import Switches_Dynamic as dy_switches
import time
import Path_Finder
ACC_DF = st_switches.ACC_DF #Accelarating factor for ard... |
6c76146f9e3672b08cac9536841d68e4e4ef8a17e4c7ceef00c177d54cfacb9b | Python | 25,261 | 652 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 1 08:49:57 2017
"""
import os, subprocess, gzip, logging, sys
import matplotlib as mpl
mpl.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib.backends.backend_pdf import PdfPages
import numpy as np
import... |
78bb78ed25fbe01c3d4ebabfadc294e1c56f5a2ef8b6ec12de84b7ce908dbdf9 | Python | 25,297 | 510 | import time
import json
import os
import json
import joblib
from io import BytesIO
import base64
import boto3
import math
import io
import cv2
import numpy as np
# Grab environment variables
TEST_ID = os.environ['TEST_ID']
DETECTION_ENDPOINT_NAME = os.environ['DETECTION_ENDPOINT_NAME']
CLASSIFICATION_ENDPOINT_NAME = ... |
007b94afd68d533a4c8506dc5a642180887cbf0fa318ead3d1aa2342ffa891ad | Python | 25,348 | 763 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
86eb91d638d33af8ab8f44760f6e4d8e366a7a2a5e67c43da83376d2b8396e46 | Python | 25,357 | 540 | """
This script generates figure S6e from the paper :
This is the projection of left/right choices for each stimulus condition
Internal notes:
This is from run_dPCA.py
"""
import pdb
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as ... |
b6866a121990290337aa257afb52e42770e76c50c2362bc7ece47d43bfe2213b | Python | 25,370 | 566 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 25 17:01:35 2023
@author: zhihuang
"""
import os
opj = os.path.join
import pandas as pd
import numpy as np
import argparse
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import copy
from scipy.stats import ... |
16345963a05667e7ec23a3c8ecf788beb450308eb1c6f3efec4f3b897fae665c | Python | 25,383 | 798 | import re
import numpy as np
import pandas as pd
import matplotlib as mpl
import pytest
from numpy.testing import assert_array_equal
from pandas.testing import assert_series_equal
from seaborn._core.plot import Plot
from seaborn._core.scales import (
Nominal,
Continuous,
Boolean,
Temporal,
Pseudo... |
de7ea497c8eeac83637201c831221a0928dc4975acb85b255ea4084f63805146 | Python | 25,385 | 714 | """Tests for DummyPretrainedAnomalies, the dummy detector with pretrain strategies."""
__author__ = ["yash-sangwan"]
from copy import deepcopy
import numpy as np
import pandas as pd
import pytest
from sktime.detection.dummy import DummyPretrainedAnomalies
from sktime.tests.test_switch import run_test_module_changed... |
8cee8dda624399a2f61a81787bae1cb5817b034a6f1ff3af654de063d4ac536e | Python | 25,387 | 757 | """Interface for the momentfm deep learning time series classifier."""
from copy import deepcopy
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.classification.base import BaseClassifier
from sktime.split import temporal_train_test_split
from sktime.utils.dependencies im... |
412fdccd0f752a9e3c6e8629af5181de88395ed14ce6f952420924c8ba761837 | Python | 25,435 | 537 | import unittest
from onmt.translate.beam_search import BeamSearch, GNMTGlobalScorer
from copy import deepcopy
import torch
class GlobalScorerStub(object):
alpha = 0
beta = 0
def __init__(self):
self.length_penalty = lambda x, alpha: 1.
self.cov_penalty = lambda cov, beta: torch.zeros(
... |
6fa6d7c44fbae6a89723a2837f89ffb95b7acb1663b8d974fa75f0832492af81 | Python | 25,437 | 678 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Analytical pair potentials for Zone bridging, defined once for every backend.
Lives in the atomic-model package: the atomic layer owns per-atom energy
assembly, where the analytical term is injected on the graph route.
"""
import functools
import json
from pathlib impor... |
01e69def4cf3660f725d4961ef4943bda085b27b5cab140428645ddd42e3816c | Python | 25,441 | 655 | # Copyright 2018-2026
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICE... |
b0ee09470059c6c95f73eee4d7314da3f261af2461bbf7d14c1c657883bde8ac | Python | 25,441 | 755 | from __future__ import annotations
from sys import maxsize
from typing import TYPE_CHECKING, Any, Literal, TypedDict
from .adapters import (
BitIntegerAdapter,
ConstAdapter,
CStringAdapter,
FlagsAdapter,
IndexingAdapter,
LengthValueAdapter,
MappingAdapter,
PaddedStringAdapter,
Padd... |
51a6c30d5b718a386d9bd74bae492434294ebaeda87bf71c6c945c8bfe748e1b | Python | 25,492 | 572 | #import context
import pymtrf
from .simulate_test_data import build_test_data
import os
import numpy as np
from scipy.io import loadmat
t_precision = 10
def test_lag_gen_shape_neg_lags():
fake_data = np.random.rand(20, 2)
lags = pymtrf.lag_builder(-2, 0)
shape = pymtrf.lag_gen(fake_data, lags).shape
... |
87cd45a1980ddb8b1220b230d1032211428290477f0466585a81e1e50c944c4e | Python | 25,503 | 623 | #-------------------------------------------------------------------------------
# elftools: elf/structs.py
#
# Encapsulation of Construct structs for parsing an ELF file, adjusted for
# correct endianness and word-size.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------... |
595914f411fc6c61f271e60a51d0edef6c64a9ffc4d06b9ec22a7a23294d9ab4 | Python | 25,517 | 582 | import os
from copy import deepcopy
from pathlib import Path
from typing import Sequence, List
import nibabel as nib
import numpy as np
import joblib
import umap
import matplotlib as mpl
from matplotlib import pyplot as plt
from numpy.linalg import svd
from scipy.ndimage import gaussian_filter
from scipy.stats import ... |
7a15bcbb488d82a918b20562ba093206d6c22a52cf9b6cbf19ae8ae0da7251e6 | Python | 25,528 | 458 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Measure a set of contours in terms of shape and image intensity.
... |
36ab7283d577db7ecb9a85ede34e3a6247aca9037594fc6116b0686dd2f061f5 | Python | 25,540 | 633 | # Copyright contributors to the TSFM project
#
"""PatchTST-FM model implementation"""
import math
from dataclasses import dataclass
from typing import Any, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from transformers.modeling_utils import PreT... |
6db36c0ac96743ce2219ce831cc83b4e65fdff242c1bceeaf1670330be28f84e | Python | 25,541 | 669 | #!/usr/bin/env python3
'''
Adapted from __author__ = 'Mykhaylo Shumko' : __init__, waveletTransform, plotPower, lagNAutoCorr
All other functions written by Brian Mullen.
To find the global wavelet spectrum run these two scripts:
wave = waveletAnalysis(data) #create object & runs wavelet transform
wave.globalWa... |
ec7da83ef51d2e17499de8a6a747cfe58f1ab73c3b943f1d3f0d89d22fe7d36d | Python | 25,580 | 837 | '''
MoleculeInfo.py
Contains helper functions for finding + identifying certain atoms in proteins.
.. codeauthor:: Nicholas Browning
'''
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import str
from builtins import range
from past.utils imp... |
7b5f879b9a5c8290d9cf79555bba731371110c6f9ad5073375ed6833abf9042d | Python | 25,582 | 647 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
017250163f3fcc4c0f6f41c2fe06fdd19599d7876f953e96f39de92e323650fc | Python | 25,730 | 651 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
194b3947720186f4e46ef527c1fb8cc009a702f028e8c9f6066bc21ab3850a09 | Python | 25,792 | 642 | from __future__ import annotations
from abc import ABC
from abc import abstractmethod
import math
from typing import cast
from typing import TYPE_CHECKING
import numpy as np
from optuna._gp.gp import ConditionalGPRegressor
from optuna._gp.gp import ListConditionalGPRegressor
from optuna._gp.qmc import sample_from_no... |
11d0d7fa9c1379f38cdc231ac5d69315015abfc05bad9a801c5fe2a34c0f5c66 | Python | 25,836 | 471 | #PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
import sys, os, datetime
import json
import torch
import random
import glob
from tqdm.notebook import tqdm
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
from datasets import DatasetDict, Dataset, loa... |
cc2d6901e6134d2f3838ce1a7421b997f6945c6cddaa141c4e2311fbfca7c46e | Python | 25,863 | 607 | """Functions for sampling points from an SWC reconstruction of a neuron."""
import math
from typing import Callable, Union
import numpy as np
from pathos.pools import ProcessPool
import numpy.typing as npt
from scipy.spatial.distance import euclidean, pdist
from tqdm import tqdm
from .swc import (
Neur... |
9b5b60275d5e65e2de169dc72052051b60a1144d454d71c0a4e2fa294b802960 | Python | 25,866 | 575 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 18 13:13:33 2017
@author: tpisano
"""
import os, sys, copy, shutil, numpy as np, scipy, cv2, time, SimpleITK as sitk, multiprocessing as mp
import tifffile
from tools.utils.io import makedir, save_kwargs, listall, load_kwargs, load_dictionary
from ... |
03d7cc3b6101b3e51191756dcb8dc13d341d0b6aecd493bebac8d3c1f4bcdd7f | Python | 25,890 | 791 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
DeNS-specific SeZM modules.
This module provides the force embedding together with the
parallel SeZM `dens` fitting branches:
1. An energy head operating on the scalar descriptor.
2. A clean-force head operating on the final equivariant latent.
3. A denoising head oper... |
1d27f3e87f3a58ec956d97cc2575a7113c5c9dc65b1bb9ce506da29a81c8f5bb | Python | 25,901 | 607 | """Composable time series forest."""
__author__ = ["mloning", "AyushmaanSeth"]
__all__ = ["ComposableTimeSeriesForestClassifier"]
import numbers
import numpy as np
from joblib import Parallel, delayed
from sklearn.ensemble._base import _partition_estimators
from sklearn.ensemble._forest import (
_generate_unsamp... |
dc8b272b113b94ea390a48bcaa4d32a7e346dde0ab451bef3f6512ad49df7675 | Python | 26,022 | 642 | """Implementations of classical fictitious play.
See https://en.wikipedia.org/wiki/Fictitious_play.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import itertools
from keras.models import Sequential
from keras.layers import Dense
import ker... |
5293acb1b82bdcbb2d2c9ba8611c7dbcbc825369aca9c932aeb28f391646f74d | Python | 26,029 | 502 | #!/usr/bin/env python
# coding: utf-8
# In[110]:
import pandas as pd
import matplotlib.pyplot as plt
import cv2 as cv
import numpy as np
from dataclasses import dataclass
import os
import random
# from numba import njit, jit
import shutil
from sklearn.utils import shuffle
from sklearn.metrics import precision_score... |
40cd172693063cebaba31eca9a610f04c9db89a8190f3a7324a5cae95049547c | Python | 26,032 | 782 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import argparse
import csv
import json
import shutil
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import UTC, date, datetime, timedelta
fro... |
acd1b4d50eb2195a06453d988ea982611735b7e4bc6fd89b8e1320f470db0f14 | Python | 26,066 | 705 | # coding=utf-8
# 2020.12 added (1) low rank DAG generations;
# (2) quad functons for causal functions;
# (3) event-type data
# 2021.08 deleted (1) condition: sem_type == 'poisson'
# Huawei Technologies Co., Ltd.
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
... |
86231a1d9546469b99aa4af4992230e8dd15f11d10c60d4a0f6ea0306aa05bda | Python | 26,096 | 798 | import pytest
from unittest.mock import patch
import pandas as pd
import numpy as np
import scanpy as sc
from anndata import AnnData
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.markers import MarkerStyle
from matplotlib.lines import Line2D
from palantir.plot import (
density_2d,
plot_mole... |
afff69cabb59fc9d7a99e6cfe231c03ec975393137852e48f78075830f3f4fbe | Python | 26,105 | 654 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 14:20:44 2019
@author: Tiger
"""
import numpy as np
#from PIL import Image
from os import listdir
from os.path import isfile, join
from skimage import measure
from natsort import natsort_keygen, ns
import os
import pickle
import scipy.io as sio
import math
#import zip... |
aafd1331eff8bad30b33e124e8f60dd7984378f821bc95308762d62fb7de4b7d | Python | 26,107 | 799 | from __future__ import print_function, division
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch
class conv_block(nn.Module):
"""
Convolution Block
"""
def __init__(self, in_ch, out_ch):
super(conv_block, self).__init__()
... |
0cc15f27448ed7bc6c6b2c0a7a2d0d6eb63697917ad906588b94fc32e3d1b033 | Python | 26,118 | 467 | """
Connections are the mechanisms for data transmission between neurons. They can either define an individual conductance-
based synapse, or a pattern of synapses which is tiled between two populations.
"""
import sys
import numpy as np
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
38070ae6ee3b19d7fe1ed968da58ef36d72fdee9c5e42ec35044dc8e7b122f29 | Python | 26,132 | 669 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Utilities for the array API."""
import math
from typing import (
Any,
)
import array_api_compat
import numpy as np
from packaging.version import (
Version,
)
from deepmd.dpmodel.common import (
to_numpy_array,
)
# Type alias for array_api compatible arrays... |
dcfaa61230aabe4778ec9fc81e0446ce085ffcf6d15381588b16276ef032f8cb | Python | 26,135 | 733 | #!/usr/bin/env python
import argparse
from functools import partial
import gzip
from multiprocessing import Pool, cpu_count
import numpy as np
import os
import pandas as pd
from pybedtools import BedTool
import re
import sparse
import subprocess as sp
from __init__ import ENCODE, ParseUtils
usage_msg = """
usage: %s... |
93ac12676613b46cb229cabe29df787ec082966debf47440f903561eb38e3e1e | Python | 26,162 | 527 | """
Comparison of parameters extracted from MINE and spike triggered analysis
"""
import model
import numpy as np
import matplotlib.pyplot as pl
import utilities
import seaborn as sns
from taylorDecomp import d2ca_dr2
import matplotlib as mpl
import os
from sklearn.linear_model import Ridge, LinearRegression
from typi... |
a7b3c34ae26f47402443c622a7fd0d5b0e86342dd2f683ed24aa2680faf16ff2 | Python | 26,310 | 552 | """
@file: trainer_agent_mxnet.py
Created on 18.05.19
@project: CrazyAra
@author: queensgambit
Definition of the main training loop done in mxnet.
"""
import datetime
import logging
import random
import mxnet as mx
from time import time
import numpy as np
try:
from mxboard import SummaryWriter
except Exception:
... |
e427acf6632b750ad179c5c4aae6ec41db2c6a914d5a366110e7822be1f8fdeb | Python | 26,347 | 603 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# scripts/dwarfdump.py
#
# A clone of 'llvm-dwarfdump' in Python, based on the pyelftools library
# Roughly corresponding to v15
#
# Sources under https://github.com/llvm/llvm-project/tree/main/llvm/tools/llvm-dwarfdu... |
d770c421e2bc11f40fe16603e2d4050f270a9ac081a975868e6f0f9117030594 | Python | 26,362 | 761 | """
Common utilities
"""
from collections.abc import Iterable, Sequence
import logging
import sys
import traceback
from multiprocessing import cpu_count
from pathlib import Path
import networkx as nx
import nibabel
import numpy as np
from graynet import config_graynet as cfg, freesurfer
def as_path(path_like):
... |
12e0e8d265707ac9742419984ad452fce6e34febb81147f3c123b5f81f67d425 | Python | 26,438 | 482 | """ Dataloader for all datasets. """
import os,json,pdb,argparse
import os.path as osp
import numpy as np
import pandas as pd
from PIL import Image
import torch
from torch.utils.data import Dataset
from torchvision import transforms
import torch.nn.functional as F
from .augmentation_pool import RandAugmentMC,RandAugmen... |
cf4560c3e26e28adf0af483c89bbefb313b02db44a28923dae8f0aff167cac83 | Python | 26,443 | 710 | import contextlib
import gzip
import importlib
import json
import io
import logging
import msgpack
import os
from pathlib import Path
import pickle as pkl
import tqdm
import urllib.request
import subprocess
import Bio.PDB
import lmdb
import numpy as np
import pandas as pd
from torch.utils.data import Dataset, Iterable... |
489ef4fb202e82b135629e5ce5584c902d66c20a86c72d2493b27ded9d17ff15 | Python | 26,447 | 736 | """ Shuffled autocorrelation function
Based on Louage et al., 2004. X is an array of N responses x length(t) points in
time. The times are in msec. Since the number of spikes in X may vary from trial
to trial, X is assumed to be a cell array of spike times. The autocorrelation is
calculated for every event in X that i... |
a0dfa38646a2b40cbf789d1c4ca2cd16a3ed6d405bb55a39b6cec2d7562fa6a1 | Python | 26,450 | 789 | """
Provides analysis and display for several formats of model_run results
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2020- P... |
b5df0b5533d132c7cca448cc96c33a46e77cd13c042ee2a9b12053a09fdcea3b | Python | 26,455 | 794 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""SeZM GLU energy fitting networks."""
from __future__ import (
annotations,
)
import math
from typing import (
Any,
ClassVar,
)
import torch
from deepmd.dpmodel.utils.seed import (
child_seed,
)
from deepmd.pt.model.network.mlp import (
GLULayer,
... |
ddb452502e439f54177dd3ece77da22c959ad7dbb222d8705f3b62299f0d6571 | Python | 26,514 | 731 | import os
import re
import numpy as np
from datetime import datetime
from sklearn.decomposition import FastICA
from scipy import linalg
from timeit import default_timer as timer
from typing import Tuple
from seas.waveletAnalysis import waveletAnalysis
from seas.signalanalysis import butterworth, sort_noise, lag_n_auto... |
e88db4f4409b1c7aec22b3ca58b277c74caf63667168b3b3b53812c937891d27 | Python | 26,579 | 243 |
# Indices to select for each sequence depending on the split to remove take-off and landing parts
SEQUENCES_FRAMES = {'indoor_flying': {'split1': {'indoor_flying1': (139, 1201), # 1 (140, 1200) VALIDATION, TEST
'indoor_flying2': (159, 1581), # 1 (160, 1580) TRAIN
... |
0f677ed6d5460bcead4884a4545415583cc18612b0a96a0bad3a9695c1149374 | Python | 26,630 | 613 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
b83d9f84a52182e3fad036d5e25c37849b0b890d0d7358ada855a7b1254b477e | Python | 26,646 | 739 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Compact canonical deployment path for compressed DPA4C."""
from __future__ import (
annotations,
)
from typing import (
TYPE_CHECKING,
Any,
)
import torch
from deepmd.pt_expt.kernels.utils import (
backend_device_type,
operator_available,
)
if TYP... |
bd394f6ac27c930ce451927b5791e52d16356c915513d23cf6185464f15ce709 | Python | 26,654 | 700 | import math
from abc import ABC, abstractmethod
from copy import deepcopy
from random import Random
import numpy as np
from typing import Any, List, Tuple, Dict, Set, Generator, Iterable
import ipywidgets as widgets
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from matplotlib import pyplot as... |
93de87088f84fec741fa57a23fc36c0589229f5934e669efb85b6fd7c4e2448f | Python | 26,686 | 525 | import argparse
import ast
import bz2
import functools
import math
import operator as op
import os
import pickle
import socket
import time
import urllib.error
from itertools import groupby
import cv2
import numpy as np
import pandas
import scipy.ndimage as ndi
import simplejson
from allensdk.api.queries.mouse_connecti... |
564aa4fe0bd1a0745daf9f7271e30117a5c026dc478c406a1b2a982c8d95486a | Python | 26,696 | 666 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 21 18:47:02 2021
Noise simulations and plotting
@author: robert.mok
"""
import os
import sys
import numpy as np
import torch
import matplotlib.pyplot as plt
import itertools as it
import time
sys.path.append('/Users/robert.mok/Documents/GitHub/mu... |
f20f2c92a5195fb12d7f0cb4c6fd596a08fc0e781d5157ac152ca7274bd963e6 | Python | 26,709 | 468 | # -*- encoding: utf-8 -*-
from ._db import add_table_data
# sgc old weights:
# bushy tstellate dstellate octopus pyramidal tuberculoventral
# weight 0.027 [12] 0.006 [12] 0.00064 [12] 0.0011 [12] 0.0023 [12] 0.0029 [12]
# tau1 ... |
22852ee4d84612407b5777ff77b9466eca6c20047b589d05236d532dbb5ffa23 | Python | 26,776 | 599 | """This module contains functions used for the whole workflow of the project, from
data preparation to model training and evaluation."""
from itertools import product
import math
from subprocess import Popen, PIPE
from copy import copy, deepcopy
from sklearn.preprocessing import OneHotEncoder
from torch_geometric.loa... |
cf931498df9485139fb5319e18e14d8d50cd27a18d0effc73abcfa0d8552f7b9 | Python | 26,779 | 693 | # SPDX-License-Identifier: LGPL-3.0-or-later
from collections.abc import (
Callable,
)
from typing import (
Any,
)
import paddle
from deepmd.dpmodel import (
ModelOutputDef,
)
from deepmd.dpmodel.output_def import (
FittingOutputDef,
OutputVariableCategory,
OutputVariableOperation,
check_o... |
f3f24126485c633d8fc3edbdf19e79483c291fbc5ca8ef9fe6039df428ce5b73 | Python | 26,879 | 725 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Spin-enabled SeZM energy model."""
import functools
from collections.abc import (
Callable,
)
from copy import (
deepcopy,
)
from typing import (
Any,
)
import torch
from deepmd.dpmodel import (
ModelOutputDef,
)
from deepmd.pt.model.atomic_model.sezm_a... |
9f0c9891040bb505fa06e2fd27b0370b7891738dea8357d49cfa63457961f367 | Python | 26,914 | 413 | # process the MIMIC-III NOTEEVENTS with SemEHR outputs and link to ORDO, ICD9 for coding comparison, also generate samples for validation
# input: some settings, NOTEEVENTS.csv, SemEHR processed MIMIC-III clinical notes
# output: (i) dataframe (.pik) and (ii) excel sheet containing UMLS, ORDO, ICD9 codes identified f... |
1606a1c05e609508f8c62bbe2fdc6436c50b167a238048239bac4820f708ca95 | Python | 26,935 | 646 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Parity tests for the Uni-Mol v1 port.
Every expected value in ``unimol_v1_golden.npz`` was produced by running
upstream Uni-Mol (commit 90f52c4) unmodified on CPU, over molecules 0 to 3 of
the example data shipped with that repository, at seed 1 and epoch 1. The
generato... |
ab8153509e78aa8059719f5e03ee625e55af0f612c2dea0d99b4628b5803eb6f | Python | 27,016 | 612 | import numpy as np
import pandas as pd
import argparse
import os
import re
import random
import textdistance
import multiprocessing
from rdkit import Chem
from tqdm import tqdm
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
def smi_tokenizer(smi):
pattern = "(\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|... |
edc6653e4f0b672dd7a38c2b33f82a18ffdbba246f6fc4ea1d1a9f6a53a3c318 | Python | 27,028 | 668 | # author: proloy Das <proloy@umd.edu>
# author: Behrad Soleimani <behrad@umd.edu>
import itertools
from multiprocessing import cpu_count, current_process
import copy
import logging
import numpy as np
import pickle
import warnings
from functools import reduce
from joblib import Parallel, delayed
from matplotlib import... |
5dfb6b6f0e8cd2ec8ee819adf0cb065b20106137da4567fef61254218e6af000 | Python | 27,038 | 700 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Shared model-factory dispatch for dpmodel-driven backends."""
import copy
from collections.abc import (
Callable,
Mapping,
)
from typing import (
Any,
)
from deepmd.utils.bridging import (
resolve_bridging_window,
route_canonical_learned_options,
)
f... |
b913cef3c2af83ee15dde80549592966d444d436272b75b25f5e24dcf053f279 | Python | 27,050 | 611 | from pathlib import Path
import os
from statistics import mean
import matplotlib.pyplot as plt
from random import randint
import pickle
from akkadian.build_data import build_signs_and_transcriptions, break_into_sentences
from akkadian.data import from_key_to_text_and_line_numbers
from akkadian.parse_xml import parse_xm... |
0dd9b622b1cb4013748d3cf2bd1edb4fe5b9da393c73e2cfdd3dc4addc6cf507 | Python | 27,070 | 516 | # Copyright (c) 2019. Martin Haesemeyer. All rights reserved.
#
# Licensced under the MIT license. See LICENSE
"""
Class wrapper of experiments with support of serialization to/from HDF5 files
"""
import warnings
import h5py
import numpy as np
from datetime import datetime
from os import path
import json
from typin... |
f2843a40d064d148bec1d5089b0ce46688c36b4e896f57d2d1023ef496a553b1 | Python | 27,075 | 666 | import re
from collections import defaultdict
from urllib.parse import quote as url_quote
import rdflib
from pyontutils.sheets import Sheet
from pyontutils.namespaces import ilxtr, TEMP, rdfs, skos, owl, interlex_namespace, npokb
from neurondm.core import Config, NeuronEBM, Phenotype, EntailedPhenotype, NegPhenotype, L... |
120befa0ef96bbaed6e0c4eb859679646a0aeba4c1e73c000daf709548ea3952 | Python | 27,094 | 710 | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import abc
from typing import TYPE_CHECKING, Any, Self
import numpy as np
import onnx
if TYPE_CHECKING:
from collections.abc import Sequence
class RuntimeTypeError(RuntimeError):
"""Raised when a type of a variable is unexpected.""... |
a370eed088d1480801176cde8d6721ed137f5dbdcf811aaf69ba3ee70cd40738 | Python | 27,100 | 777 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you ... |
37e164ad44f729a8170c9b969ef799f5b132a75e6bddcc6e2be50c5785013740 | Python | 27,113 | 709 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
Edge cache construction utilities for DPA4/SeZM.
This module defines the shared procedures that assemble per-edge geometry,
radial features, rotation blocks, and normalization terms used by the SeZM
descriptor.
This module is the dpmodel (array-API) port of
``deepmd.pt... |
80f5b9eb490813aa4d90ccd9c8c33d72f4ecf5a0e5d1b87ead739b795f2d2ebb | Python | 27,116 | 621 | """
@file: fileio.py
Created on 01.04.2021
@project: CrazyAra
@author: queensgambit, maxalexger
Contains the main class to handle files and directories during Reinforcement Learning.
Additionally, a function to compress zarr datasets is provided.
"""
import os
import shutil
import glob
import zarr
import time
import l... |
11265c983077d9a38fa33bebcd1cb46c3b406a385b79f44a12f29dad6f4a8811 | Python | 27,167 | 751 | from __future__ import print_function
import re
import os
import sys
import tempfile
import subprocess
import contextlib
import multiprocessing.pool
import dxpy
@contextlib.contextmanager
def set_env(**environ):
"""
Context manager generator to temporarily set the subprocess environment variables.
Args:... |
454f01abb23e35eb948dbcdbd6e2a745b87559316602df9e63fd6b5538a0da1d | Python | 27,169 | 751 | from __future__ import print_function
import re
import os
import sys
import tempfile
import subprocess
import contextlib
import multiprocessing.pool
import dxpy
@contextlib.contextmanager
def set_env(**environ):
"""
Context manager generator to temporarily set the subprocess environment variables.
Args:... |
dd359b49ac94ce448b97d196ab1bc847abf99f285cdb385c01c3ec4485fb13c3 | Python | 27,176 | 723 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base classes for probability distribution objects."""
__author__ = ["fkiraly"]
__all__ = ["BaseDistribution"]
from warnings import warn
import numpy as np
import pandas as pd
from skbase.utils.dependencies import _check_estimator_deps
from ... |
0892ed3a0e9c4b83d44548f8f61a1ef838d20cc6ad3e63f7d9d0b614ef856389 | Python | 27,182 | 453 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 16 18:37:06 2016
@author: wanglab
"""
from tools.utils.io import listdirfull
from tools.analysis.network_analysis import make_structure_objects, variable_count
from tools.utils import find_all_brains
import numpy as np, os, cPickle as pickle, multiprocessing as mp, pandas... |
4c4736bbe22593c7ca5b610080dc0ca3325aa659be7c28ae1e9d32537d478c03 | Python | 27,187 | 673 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""nvalchemi-toolkit wrapper for the SeZM / DPA-4 PyTorch energy model.
:class:`DPA4Wrapper` adapts a trained DeePMD-kit SeZM / DPA-4 model to the
``nvalchemi-toolkit`` model interface (:class:`~nvalchemi.models.base.BaseModelMixin`)
so it can be driven by any ``nvalchemi``... |
9de396c418b6c7f5d476fd78b29990f1a2d2ba31f09fc081ae1300ba5ba85d73 | Python | 27,188 | 688 | """ Optimizers class """
import torch
import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
import operator
import functools
from copy import copy
from math import sqrt
import types
import importlib
from onmt.utils.misc import fn_args
def build_torch_optimizer(model, opt):
"""Builds the PyTorch o... |
95df4b27490014ebec8445cac807985b4a5503f9c4943f0e212934af948cb660 | Python | 27,195 | 622 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Unit tests for the pair-clearance frame filter."""
import unittest
import numpy as np
from deepmd.dpmodel.utils.dist_check import (
compute_min_pair_margin_batch,
compute_min_pair_margin_single,
pair_half_thresholds,
select_frames,
)
from deepmd.utils.m... |
a3d0ed14188e9d55c74cbe32407fed38c9c46735ab5fc09c29b67cd6977a0c09 | Python | 27,253 | 574 | from __future__ import print_function
from neuron import h
from ..util import nstomho
from ..util import Params
import numpy as np
from .cell import Cell
from .. import data
"""
Original hoc code from RMmodel.hoc
// including the "Octopus" cell:
proc set_Type2o() {
gbar_na = nstomho(1000)
gbar_kht = nstomho(150... |
b6ae2463c8bc9deb79d426fa0a8149c7620d4d9f863a3242f8f3b0ca4bc32564 | Python | 27,350 | 643 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 16:12:07 2021
@author: robert.mok
"""
import torch
import torch.nn as nn
import torch.optim as optim
import warnings
class MultiUnitClusterNBanks(nn.Module):
def __init__(self, n_units, n_dims, n_banks, attn_type, k, params=None,
... |
589a055b6a5b33b6c11a5a229a509e8aefec1d02467885b91f94c3904e845912 | Python | 27,394 | 737 | import sys
import numpy as np
import os
import networkx as nx
import pyvista
class VtkNetwork:
def __init__(self, pt_file=None, root_loc=None, vsize=22.6):
self.pt_file = pt_file
self.root_loc = root_loc
self.vsize = vsize
def build(self):
mesh = pyvista.read(self.... |
c47ba3487541cd2573ff6001bd4332034074bc0618067f7fb11db26651999636 | Python | 27,505 | 589 | import contextlib
import os
import pickle
import sys
import time
from collections import Counter
from pathlib import Path
from typing import Dict, List, Optional, Union
import joblib
import numpy as np
import pandas as pd
import rdkit.Chem as Chem
import rdkit.Chem.AllChem as AllChem
from joblib import Parallel, delay... |
d82f357c9de78c2b7c597c87db097782f69d9d518e861e33784c90335894617b | Python | 27,527 | 687 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from collections.abc import (
Callable,
)
from typing import (
Any,
)
import numpy as np
import torch
from deepmd.dpmodel.utils.env_mat_stat import (
EnvMatStatSe,
)
from deepmd.pt.model.descriptor.base_descriptor import (
BaseDescriptor,
)
f... |
fdf6176686dd3dad0b40f8900543e29e65435d76743bde65ac8f7687aaf7db8d | Python | 27,581 | 808 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Arps Decline Curve Analysis (DCA) forecasters.
Implements exponential, hyperbolic, and harmonic decline curve models following the
Arps (1945) methodology. Probabilistic forecasts are produced via Monte Carlo sampling
from the multivariate norm... |
805d8a23fb4d1aaf570d2697b23199318cfed519ab5d7afbb3975d84ec76a5b1 | Python | 27,621 | 675 | from itertools import product
from multiprocessing import shared_memory, current_process
import matplotlib.pyplot as plt
import numpy as np
import os
import re
import warnings
from joblib import Parallel, delayed
from sklearn import preprocessing
from sklearn.model_selection import TimeSeriesSplit
from mne.utils impo... |
f3ed05c08d2b9320d15ca08012a2d8cc5b305ac8049c3bfe62ba381bf5dc699b | Python | 27,630 | 757 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
from onnx import (
AttributeProto,
GraphProto,
ModelProto,
TensorProto,
checker,
helper,
utils,
)
if TYPE_CHECKING:
from collections.ab... |
f017e210d97832d8da5665387053b9b478be42fb39058ef3cd152201b902c727 | Python | 27,674 | 558 | # Standard
from os.path import isdir, join
from os import mkdir, listdir
# Seeds
from os import environ
from random import sample, seed as rseed
# Array manipulations
import numpy as np
import pandas as pd
# Plotting
import matplotlib.pyplot as plt
import seaborn as sns
# Metrics
from seaborn impor... |
1adcd8f3dfd29be87621f6cc55a276954c2e0cc5801e5138a8d40024b701e89d | Python | 27,706 | 572 | """
This scripts makes figure S7m in the paper.
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kernel_regression
import src.models.psth_regression as psth_regression
import src.visualization.vizregression as vizregression
import src.visualization.vizmo... |
dfed3f139d3c733d402a5bf6faf0065cc04c0f4825cab9ce4070af3ee02a7595 | Python | 27,706 | 572 | """
This scripts makes figure S7k in the paper.
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kernel_regression
import src.models.psth_regression as psth_regression
import src.visualization.vizregression as vizregression
import src.visualization.vizmo... |
e42320c6ac629c4fbc254d52cea6e5fc312eb099daf08f5362c0452c10fee013 | Python | 27,706 | 572 | """
This scripts makes figure S7o in the paper.
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kernel_regression
import src.models.psth_regression as psth_regression
import src.visualization.vizregression as vizregression
import src.visualization.vizmo... |
87c3efa25bbeacd7210b3bee0a49f178cf5b866e84e23c799715b5cfcec33914 | Python | 27,707 | 572 | """
This scripts makes figure S7q in the paper.
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kernel_regression
import src.models.psth_regression as psth_regression
import src.visualization.vizregression as vizregression
import src.visualization.vizmo... |
4f2dae8e7a25c5b62318d3d9793937b2545c69ac5ebcbd7710d912d8b00122f0 | Python | 27,724 | 932 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
ca3d4d3ab22b606bb1ca68cbafa02cc46b17ee6676e8231b1d9f9480b1931fd5 | Python | 27,767 | 645 | #-------------------------------------------------------------------------------
# elftools: dwarf/structs.py
#
# Encapsulation of Construct structs for parsing DWARF, adjusted for correct
# endianness and word-size.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-----------------------------... |
3910cdf4d04ae2e4308d7458886337338df6eddf33697e2c949769add7021331 | Python | 27,772 | 738 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""PyTorch-exportable execution backend for DPA4C.
``deepmd.dpmodel.descriptor.dpa4c`` defines the graph algorithm and tensor
contracts. This module implements its performance-critical primitives with
native PyTorch operations, promotes DPA4C trainable arrays to parameters,... |
0bc5e766b050e39ef42627e829f3ef60f276e20e91f2177ca092b3c492d50e96 | Python | 27,780 | 657 | from pathlib import Path
import numpy as np
import pytest
import pyxdf.pyxdf
from pyxdf import load_xdf, match_streaminfos, resolve_streams
# requires git clone https://github.com/xdf-modules/example-files.git into the root
# pyxdf folder
path = Path("example-files")
files = {
key: path / value
for key, valu... |
07132d3f2232b8f077d7d1f5857dbaade3345933b5139bcaa7b64fe1a57c612c | Python | 27,819 | 735 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from collections.abc import (
Callable,
)
from typing import (
NoReturn,
Optional,
)
import paddle
from deepmd.dpmodel.atomic_model import (
make_base_atomic_model,
)
from deepmd.dpmodel.output_def import (
FittingOutputDef,
OutputVa... |
cab93d9ae34752c498b58aec98244d513e262dca2dec8dbfe23d1d6b0687cfe4 | Python | 27,851 | 718 | """Orthofinder-result importer with synteny-aware multi-copy disambiguation.
This module turns a full Orthofinder run directory into an odp-style
`.rbh` table without requiring the user to pre-filter to single-copy
orthogroups. Multi-copy orthogroups, which would normally be discarded
by a naive `fgrep -f Orthogroups_... |
b2ce7d6de0be9dbffcdeeb9b9db662ab6df84fe5c06dd0c781d4c7304f75ab5e | Python | 27,852 | 574 | """
This scripts makes figure S7i in the paper.
"""
"""
This script produces figure S7H (the right part) of the paper.
This is the mean value of the auditory kernel as a function of ML and AP position
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kern... |
bf5be2aa5f9bf629cc579b7f0d6a6f22cbb941ae14110658b6b0a89074932b16 | Python | 27,852 | 574 | """
This scripts makes figure S7i in the paper.
"""
"""
This script produces figure S7H (the right part) of the paper.
This is the mean value of the auditory kernel as a function of ML and AP position
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kern... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.