sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
98760f6d6d2324e4bf525af46741ae122b578ec31eb5a27b713ed05aafad9116
Python
8,389
242
# Note! This file is aimed specifically at pandas.io.formats.printing utility # functions, not the general printing of pandas objects. from collections.abc import Mapping import string import numpy as np import pytest import pandas._config.config as cf import pandas as pd from pandas.io.formats import printing @p...
46d62f9e7def8590852dbe48558de28bdf1dfee3c51258539d1009828d6aa1e1
Python
8,392
267
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
0baa4a387edd71fa655cb6996d8c605878a1b532dbb4d7f7c7bc949d3b5c7948
Python
8,394
180
from unittest import TestCase, mock import numpy as np import pandas as pd import dynast.utils as utils from tests import mixins class TestUtils(mixins.TestMixin, TestCase): def test_get_STAR_binary_path(self): self.assertTrue(utils.get_STAR_binary_path().endswith('STAR')) def test_get_STAR_versio...
229f1b0ad38e36fefb59032aa05be7dc3909eac4e132fc3f78bcae003a65c622
Python
8,400
193
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 28 14:07:17 2019 @author: vman """ import mne import numpy as np import multiprocessing num_cores = multiprocessing.cpu_count() from scipy.stats import entropy from matplotlib import pyplot as plt class Preprocess(object): def __init_...
9ae5d6386bcf9d684955105ec4198f60920d4f74356f8389c0aa3dc2dfce59f4
Python
8,401
252
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from argparse import ArgumentParser from DL_reconstruction import SSIMLoss import torch from data import transforms from models import VarNe...
6ebaa8b2a10acb816a5c93cc062cbe3c3a6fd08bf1708dda703234577de94482
Python
8,407
191
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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...
03ff1f25d3b539b9d4c1262d3167bf3add12e23ba5a93702ef708aa229c58a31
Python
8,413
243
import multiprocessing import re from collections import Counter from functools import partial from typing import Dict, List, Optional, Set, Tuple import pysam from .. import utils from ..logging import logger COVERAGE_PARSER = re.compile( r'''^ (?P<contig>[^,]*), (?P<genome_i>[^,]*), (?P<coverage>[^...
d6ca5447b429e996528a28f28f92652cb2bc9ba530baf7f4b8440e6053b93d3e
Python
8,418
242
''' update_dynamodb_published_skeletons.py Update a janelia-neuronbridge-skeletons DynamoDB table. ''' import argparse import json import os import sys from types import SimpleNamespace import boto3 import colorlog import inquirer from pymongo import MongoClient import requests from tqdm import tqdm # pylint: dis...
54a6a6e6c9120e9a4da100f2ae2bde129df9ba3d61101802b2a9fdfc0c3ac492
Python
8,421
246
# Copyright 2018-2022 Xanadu Quantum Technologies Inc. # 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...
b6658aa46889e74376871af1c0946fee66bf0f0471bc4ca6966d627b987ae2d8
Python
8,421
231
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
c7e926a5c499aaa03102d60c601d13a43a971cb84936bb7290e3bb1b661154b5
Python
8,421
218
"""Session 28 — god-class drain: unsupervised verbs. ``UnsupervisedExperiment.create_model`` and ``assign_model`` no longer delegate to ``self._legacy.<verb>`` for clustering + anomaly. They run the registry's sklearn / pyod estimator directly on ``self._legacy.X_transformed`` and return real sklearn Pipelines. This ...
98ea67469533fd8a12ab674490a79ceb286230e606553576ff6678d51016221a
Python
8,426
258
import os import numpy as np import scipy as sp import plotly.graph_objects as go import streamlit as st import pandas as pd from math import floor from sonpy import lib as sonp import io from scipy.signal import find_peaks @st.cache def filename_list(sidebar_path): smr_files = [] for file in os.listdir(s...
b04e75e967c16be3ae8113dc77c4854a5151f3f0557741b29fca93d61126617e
Python
8,426
190
import os import torch.nn as nn import pytorch_lightning as pl from transformers import LongformerModel, AdamW, get_linear_schedule_with_warmup from torchmetrics import Accuracy import torch from evaluators.calculate_metrics import calculate_metrics class Longformer(pl.LightningModule): # Set up the classifier ...
1cfa7934f6e73c153b7ecdf073631b0f1896aaea5293814ec8e590ff3fdf08d0
Python
8,427
304
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import math from typing import Any, List import torch from torch import distributed as dist """ Functions to support graph parallel training...
2a39f6a672a44d49018674e2e46e2586a8ca5316453592db44231984da72627d
Python
8,429
221
import pprint import torch import numpy as np import time import yacs.config from torch.utils.data import DataLoader from torchvision import transforms from typing import Union import VINNA.utils.logging as logging_u from VINNA.models.networks import build_model from VINNA.data_processing.augmentation.augmentation imp...
4653845f7f53936cc25c4b1777a3c561a042165f563ec9d60a7d037c83051c8f
Python
8,429
332
from __future__ import annotations from collections.abc import ( Callable, Hashable, Iterable, MutableMapping, Sequence, ) from typing import ( TYPE_CHECKING, Any, Literal, TypeGuard, TypeVar, overload, ) from pandas.compat._optional import import_optional_dependency from ...
8525f5e3234c0d9dfe0438be3f9f78bbac9519e65d33f84a92d66f0d8830c5ff
Python
8,431
272
import numpy as np import pytest from pandas.errors import SpecificationError import pandas as pd import pandas._testing as tm from pandas.tests.apply.common import frame_transform_kernels from pandas.tests.frame.common import zip_frames def unpack_obj(obj, klass, axis): """ Helper to ensure we have the rig...
af42afff82cabee5bf55e3835199624c84ed6f3828a692245ff2284de506fb87
Python
8,432
220
# # File to train networks built from the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # from argparse import ArgumentParser import logging import os import sys import ...
a80b5fbee2c34e761bb5c3ce13b13c419819dd71349f69a2afedd32972a8d131
Python
8,435
268
# Copyright 2025 Xanadu Quantum Technologies Inc. # 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 agre...
69a3776f2e3b0eafa6714fe2d9fa5569f0f4d2deac360a2c9b4ba584c23d7b49
Python
8,436
253
""" Created on Aug 6, 2022. data_provider_UKA.py @author: Soroosh Tayebi Arasteh <soroosh.arasteh@rwth-aachen.de> https://github.com/tayebiarasteh/ """ import os import torch import pandas as pd import numpy as np from torch.utils.data import Dataset from torchvision import transforms import cv2 from config.serde i...
58a59e16ba8a53fb22e7c3a4a110ab12998561e66e69e92d3217cef208cc6ce1
Python
8,444
198
# Copyright 2015 Google, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
e89393551dce704fc5be2d5607a46951e497d62e4de07e66bddd3616b4676da8
Python
8,445
221
""" ========================================================================= Compute SESAME inverse solution on simulated data in the frequency domain ========================================================================= In the present example we shall devise a synthetic scenario in which two dipolar sources are ...
7efaaa63dd2d8078b890598a32bbaa44c7cb6b67e6e0e7022986ba633d9854df
Python
8,446
267
# -*- coding: utf-8 -*- # # atropos documentation build configuration file, created by # sphinx-quickstart on Fri Sep 12 09:11:16 2014. # # 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...
95c8b1f1af20fd0ae179bc18481e33211838cc18cdb80c80f0150bf830684abb
Python
8,449
263
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_group_shift_with_null_key(): # This test is designed to replicate the segfault in issue #13813. n_rows = 1200 # Generate a moderately large dataframe with occasional missing # values in column `B`, and then gr...
93356c552980a7145677fc23c307cf5da9de5c863dcbec8bc9c2384a42bae608
Python
8,450
238
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
9220be89ad9f2ae7eca681f8412e42e4ef5d8910948c3fb6e611cf3d71a7cf4c
Python
8,451
253
# Copyright 2018-2023 Xanadu Quantum Technologies Inc. # 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...
db32bf09eb87f2fab8efb1d63130f113e2cf02e3ac87078dcc9a28b6cea9b7c0
Python
8,457
218
import numpy as np import matplotlib.pyplot as plt from matplotlib import colors import matplotlib.cm as cm from neuron import h def rotate(x,z,theta): x2 = x * np.cos(theta) + z * np.sin(theta) z2 = z * np.cos(theta) - x * np.sin(theta) return [x2, z2] def plot_syns(data, model, plotInh=False, iB=[]):...
16e82ceb99ec20f6efd2008a63eaef133b9c2e6301fd7481f8bf4231c3f86afa
Python
8,458
255
# Copyright 2018-2025 Xanadu Quantum Technologies Inc. # 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...
42e26222f3c25e5e4165b7bc00aecf4b2bea03c94911ef1695f426b69da1885a
Python
8,459
188
import torch import torch.nn as nn import torch.nn.functional as F import math from torch.autograd import Variable from torch.nn import Sequential as Seq, Linear torch.set_default_dtype(torch.float64) class SiLU(nn.Module): # from https://pytorch.org/docs/stable/_modules/torch/nn/modules/activation.html#SiLU...
51d82319f43e8d3822b756ed94137fb6c89c6452ece643ccf565983d926e502b
Python
8,459
183
"""Test the video reader factory (backend resolution + construction dispatch).""" import sys from unittest.mock import MagicMock, patch import pandas as pd import pytest from lightning_pose.data.video.factory import build_video_reader def _fake_dali_module(prepare_dali: MagicMock) -> MagicMock: """A stand-in fo...
84411c3a5793a5c9009ac343975bab6632acd3b47c2f0093e1e28608e4b9fa2c
Python
8,460
242
# Copyright 2026 Xanadu Quantum Technologies Inc. # 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 agre...
c9d5e0ac276bd9341ef44d2befe7a7e45f78d6af363a78c58703b6535ad04af6
Python
8,464
142
import pytest from pgen import utils import io import tempfile ####### Fixtures ####### @pytest.fixture(scope="function") def a2m_file(): f = io.StringIO( """ >seq_1 mdgtrtsldieeysdtevqknqvlTLEEWQDKWVNGKTAFHQEQGHQLLKKHLDTflKGKSGLRVFFPLCGKAVEMKWFADRGHSVVGVEISELGIQEFFTEQNLSYSeep* >seq_2 ........................TLEEW...
0e8523b24ae5fa7d9f444fe37407ba5093456df52e1da010fdc76babe510b0a6
Python
8,474
312
""" Abstract base class for regression models in the PCNToolkit. This module provides the base class for all regression models, defining the common interface and shared functionality that all regression implementations must follow. Notes ----- All regression model implementations should inherit from this base class a...
ad8629efc894c79965a5740bf0b52d2d22e631b275d0dd6d50b3ea4cc0a8eb6c
Python
8,474
231
#python buildDundeeTokFixns.py origFile eyeFile eventFile import sys import re textfileix = 1 textfixfileix = 2 eventfileix = 3 ######################### # # Load Text File # ######################### #NB: startofsentence and endofsentence measures aren't accurate here, so we shouldn't include them here corpus = [...
477f10426902f1463b89604ef2a9e41284e9cb07c2b5fea16cbdcf8da6c1a8bd
Python
8,476
229
"""Multiple comparisons correction methods.""" import inspect import logging from abc import ABCMeta, abstractmethod, abstractproperty import numpy as np import statsmodels.stats.multitest as mc from .results import MetaResult from .transforms import p_to_z LGR = logging.getLogger(__name__) class Corrector(metacla...
a7b45825aba9afe2c174f12084b38ce9712f334a7799ad651c847f9686df2c63
Python
8,480
227
# Copyright 2018-2025 Xanadu Quantum Technologies Inc. # 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...
19e135df3edc2568350f7d040ff237f05d7f393333f108eb8bb4e13d37aeb4e5
Python
8,481
214
# Copyright 2019 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 # # http://w...
d74b869cfe8b07f4dfc38c5fb37c146ebad2c4433d838e426e0f53e7bbbfcb9b
Python
8,481
252
""" CNN-based discriminator models for pg-gan. Author: Sara Mathieson, Zhanpeng Wang, Jiaping Wang Date: 2/4/21 """ # python imports import tensorflow as tf from tensorflow.keras.layers import Dense, Flatten, Conv1D, Conv2D, \ MaxPooling2D, AveragePooling1D, Dropout, Concatenate from tensorflow.keras import Model...
369de5a6fba71b25741faa12b7541f0d963eb7e424f455daf7ff7e63de43a961
Python
8,482
270
import os import csv import re import argparse def file_delim(file_path): """ Determine the delimiter based on the file extension. Parameters: file_path (str): The path to the file. Returns: str: The delimiter to use (either '\t' for TSV or ',' for CSV). """ file_ext = os.path.splite...
ad4aff39619418276d66092e20e7ddcff7464502f68e6079e2ab50a8337bcf97
Python
8,483
205
#!/usr/bin/env python # coding: utf-8 ### Author: federica.magnabosco@mrc-cbu.cam.ac.uk ### Fit decoding model SDvsSD individual ROIs and save accuracy # Import some relevant packages. import numpy as np import pandas as pd import pickle import random from itertools import combinations from sklearn.pipeline import ...
7885ddda4e0e1e8aee223866a456db1572037737ec3ad6d7095114b7102d1624
Python
8,484
266
"""Session 33 — Notebook runtime hardening. Smoke tests for: - ``LocalManager``: start / is_alive / stop on the dev-stub backend. (Docker backend tests require a daemon and are skipped in CI; see ``test_docker_manager_*`` below.) - ``GET /notebooks/{id}/content`` returns the default starter when no bytes are pe...
110a4c249dc8d57301c59947389451c3499507c14db56f70fbe5194c52b20996
Python
8,487
217
################################################################################################################## # Obtained from https://github.com/vgsatorras/egnn/blob/main/models/egnn_clean/egnn_clean.py # Credit: 'E(n) Equivariant Graph Neural Networks' by Victor Garcia Satorras, Emiel Hogeboom, Max Welling # ...
3d99c5986b46b3ca4cab3ec935d24417ff29e4a762ee7c090b51a80afef90cd7
Python
8,487
259
""" @author: mkowalska """ import os from os.path import expanduser import numpy as np from numpy.linalg import LinAlgError import matplotlib.pyplot as plt from figure_properties import * import matplotlib.gridspec as gridspec import datetime import time from kcsd import KCSD1D import targeted_basis as tb __abs_file_...
6faa70e0e6788dc350c9bdf1ab2937a076bb67c170da437aa5105ec23a2d1fa9
Python
8,487
276
# -*- coding: utf-8 -*- import os from itertools import product from os.path import join import numpy as np import pytest from emcee import EnsembleSampler, State, backends from emcee.backends.hdf import does_hdf5_support_longdouble try: import h5py except ImportError: h5py = None __all__ = ["test_backend"...
4f0edcc5cdb8adc116e28511fb3df1ec28cee3e28f027ab771815cce85ca01e4
Python
8,489
190
import torch import torch.nn as nn from collections import OrderedDict import dgl from dgl.nn.functional import edge_softmax class MLP(nn.Module): def __init__(self, inp_dim, hidden_dim, num_layers,batch_norm=True, dropout=0.): super(MLP, self).__init__() layer_list = OrderedDict() in_dim =...
243c456a5f5cb3877717f4ed9803a40aded24e7a293da07bbe3f2bf23f026b00
Python
8,490
214
"""Internal, invocation-owned peak-caller scheduling and pool lifetime. No scoring types are imported here. The caller passes typed worker adapters and the pool initializer; only children bind a caller in that initializer. Each PeakExecution owns a workload snapshot and an immutable ExecutionPolicy, but never retains ...
c052bf881e2cff786452b8b609ba0bc7e9f79a40b7568586b72ed2de6011a59b
Python
8,492
216
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
533d928f578e21d2ad0b58ab7767303a7321b4f2769c7d331376cae695af6a6c
Python
8,493
229
import torch from torch import nn import torch.nn.functional as F from common import device norm_dict = dict(instance=nn.LazyInstanceNorm1d, batch=nn.LazyBatchNorm1d) ONEBYONECHANNELS = 4 class AlexNetBasicBlock(nn.Module): def __init__(self, in_channels, out_channels, kern_size=3, dropRate=0.0...
491b91249ae7cb6c83775e2311194ae9b10f0376c1d710578caf688673f6a2ba
Python
8,494
214
# MIT License # # Copyright (c) 2024 EPFL Biorobotics Laboratory (BioRob). # # 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 # ...
b2bd213027ec52728ab3c27a6bcee7fc3c1e03893d588f71122ef8db4caf84a1
Python
8,494
242
"""Sample / bundled CSV datasets. The PyCaret repo ships a catalog of small public datasets under ``<repo>/datasets/`` with an ``index.csv`` describing each one. They're the same files the 3.x ``get_data(name)`` helper has always served. This module exposes: - ``GET /sample-datasets`` — list of bundled samples with ...
448be19d0d476219840a824c5919fc89902ae741adcee7643006665ef2c54619
Python
8,496
256
import sys sys.path.append('/gscratch/stf/mpun/software/PyRosetta4.Release.python38.linux.release-317/') import pyrosetta from pyrosetta.rosetta import core, protocols, numeric, basic, utility from protein_holography.coordinates.get_structural_info import get_padded_structural_info as c_struct from protein_holography.c...
6be7931826c9e2514ea150dfdc10553e0dae1aea71238cd16454a6a7f62d61ad
Python
8,497
253
""" @author: mkowalska """ from builtins import range import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy.interpolate import griddata from matplotlib import gridspec from kcsd import csd_profile as CSD from kcsd import ValidateKCSD2D from figure_properties import * def set_axis(...
2dc0889991e240bd5ad62bf9c7b0fac084e236bea25031a04b10d72890b0d5df
Python
8,501
271
""" Tests of the groupby API, including internal consistency and with other pandas objects. Tests in this file should only check the existence, names, and arguments of groupby methods. It should not test the results of any groupby operation. """ import inspect import pytest import pandas as pd from pandas.core.grou...
ed91d87618d43a44d840517d65d090f8c4128e0894b129c7270e1d8bd9c5ea68
Python
8,503
256
# Copyright 2026 Xanadu Quantum Technologies Inc. # 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 agre...
3f477864c9c7e8362230fcabf54dae0d4f8bf782676157cff0c62e635f4f8fe8
Python
8,509
271
import numpy as np import matplotlib.pyplot as plt # increase the figure size plt.rcParams["figure.figsize"] = [12, 10] # remove the top and right spines from plot in the global plt setting plt.rcParams["axes.spines.top"] = False plt.rcParams["axes.spines.right"] = False # change the linewidth of the axes and spines ...
8ae049e8c8c55ac0f781623753b5b062a914873190229173bdc9b6d5fa83c4a9
Python
8,514
215
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
e3d12c4e73ffcc82a49ce187ee727ca1670af58537a6bdc40033dcfaaf6de816
Python
8,514
176
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Nov 20 00:42:56 2019 @author: Mehmood Ali Khan """ import time from DataPreprocessing import DataPreprocessing from DataReader import DataReader from LSTMModel import LSTMModel if __name__=='__main__': objReader = DataReader() ...
30f6832c1a3c3f9fb11f4c751412a45942aa386c35c03b5a5563e1d5f006a1da
Python
8,518
210
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import wormdatamodel as wormdm import wormbrain as wormb import pumpprobe as pp import mistofrutta as mf import sys import os import subprocess # Parse inputs and make destination folder folder=sys.argv[1] if folder[-1]!="/":fo...
9b4e54a77118dae8a4e48210330926b0a5c41aa12475bb6901f9cca8e5cf7d0d
Python
8,518
171
"""Build Healthspan Proteomic Score from the pinned original Kuo lab R release. Run ``uv run python clocks/build_hps.py`` from the repository root. Fitted numerical parameters are extracted directly from the author release; neither Biolearn nor MethylCYPHER is used as a source. """ import argparse import hashlib impo...
87a70ee1029fb2ea657b992cda9a5a7470074b3662e701a28e01760530f3c48f
Python
8,519
317
# -*- coding: utf-8 -*- """ Code to train an RNN on audiovisual action recognition using the feature embeddings of the AVMIT dataset. """ import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import datetime import tensorflow as tf from pathlib import Path import pandas as pd import yaml from functools import partial i...
04d28ec1fd26061f18b191d1cae002a9e8c6ea38a962226e35220567b0007f7f
Python
8,522
269
###################### ### Import Library ### ###################### # my library from molgraph.molgraph import * from molgraph.utilsonehot import * from molgraph.utilsmol import * from molgraph.utilsgraph import * # standard import os as os import copy as copy import random as random # plotting import matplotlib.pypl...
77b5bcfdeacd03c4afe307c6a05b7941cb1c4aa720f903bfa24f57e7c0966c28
Python
8,524
324
import numpy as np import pytest import umap.distances as dist def numerical_gradient(f, x, eps=1e-6, forward_only=False): """ Finite-difference gradient of scalar function f at x. Parameters ---------- f : callable Scalar function f(x). x : ndarray Point at which to evaluate...
3da7063ba9a86ad14c3266a40c5639bdaf8524368256c52d7bcf8a9261a6ae29
Python
8,526
265
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ from io import StringIO import numpy as np import pytest import pandas as pd import pandas._testing as tm xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail") skip_pyarrow = pytest.mar...
2813e38b4a7e0590299a1d460e327fcf15b07ad942f8dd298913506b1eb2ceb4
Python
8,528
219
"""Session 44 — phase 5c (cont.): drain ``TimeSeriesExperiment.finalize_model``. Phases 5b/5c (s40-s43) drained ``create_model``, ``predict_model``, ``compare_models``, and ``tune_model``. This session drains the fifth TS verb. ``exp.finalize_model(forecaster)`` no longer touches ``self._legacy.finalize_model`` — refi...
0af51cd1896142a83a89fd696744c6f7d5af90dce38f6eff3260a6d8aa383414
Python
8,529
189
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
57c8d2713d27199bdcc14b205be4ae50067d272dc7eb1667b29b547b1fb0b5f9
Python
8,530
202
import pandas as pd from rdkit import Chem def check_if_identical(tree_df,query_smi,weight,supporting_compounds): """ function that checks if an identical substr is already in tree_df, only the one with higher summed weight is kept input: original tree_df, query_smi (str), weight(float): summed...
6b066ce797252fb5c021cef36c107be54b11fc381a3dcb8c7109beb833ec32a4
Python
8,531
338
# -*- coding: utf-8 -*- """ Created on Sun May 1 17:33:44 2022 @author: jeanbaptiste """ import os import json import pycromanager_tessie as pmt from pycromanager_tessie.acquisitions import experiment # Start platform: platform = pmt.microscope.platform.Platform(load_synchronizer=True) # Set LED ring platform.neop...
07390fa03e78c46d5fd9f639a6040e03fa18d2345cfc2894dd6dd64e0b8877ef
Python
8,533
261
import torch, os from kilosort import preprocessing dev = torch.device('cuda:0') import numpy as np from torch.fft import fft, ifft, fftshift from scipy.interpolate import interp1d from tqdm import trange def get_drift_matrix(ops, dshift): """ for a given dshift drift, computes the linear drift matrix for interpol...
85ebea1779d39c08aa6decdabc2dc68e61ca3a6f54442948cdc971147878efa7
Python
8,533
223
# # File to train networks built from the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # from argparse import ArgumentParser import logging import os import sys import ...
9ed0515c3284e8731bf4716e0481edf459e09f69f7fbdba052be228a47042b10
Python
8,535
334
# import os import numpy as np from typing import Tuple from tifffile import imread, imwrite import imageio.v3 as iio from scipy.signal import fftconvolve def read_tiff(path: str) -> np.ndarray: """read a .tiff image into a numpy array Args: path (str): path to the image Returns: np.nda...
f5a43780a9b5e7fc6c11f9f37885826bc24bb0a79b4e14b06f3ff96672f663e3
Python
8,537
213
# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # 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...
bc18c031bd9b88629d7ad9e182abe9f193b11f99d8c768923fdfbf27b338fcea
Python
8,540
296
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
db163fd268ee8ccdcc5c967223a6fb87e6016ca845cf38866e5ea0cf7235b3dd
Python
8,540
216
import sys, configparser, torch, re, os from collections import Counter import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def prepare_data(): data = [line.strip() for line in sys.stdin] ...
f3c9b06ce9487c5c23d24dbd43768de5e6289284df5ca5a1da1e76aca058cf64
Python
8,545
233
# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # 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...
f3414acc2242325e092eb2aebdede66c40d6dae0e5a9cc9ec29b71326035ca6e
Python
8,553
223
from wordfreq import ( word_frequency, available_languages, cB_to_freq, top_n_list, random_words, random_ascii_words, tokenize, lossy_tokenize ) import pytest def test_freq_examples(): # Stopwords are most common in the correct language assert word_frequency('the', 'en') > word_frequency('de', 'en') ...
d0389b0ca4b8b96c7c1ee172f96373df7b00433ce0a5960e453db9c7c6fda7ea
Python
8,556
223
import kCSD2D_reconstruction_from_npx as npx import matplotlib.pyplot as plt import matplotlib.cm as cm import scipy import numpy as np from numpy.linalg import LinAlgError from scipy.signal import filtfilt, butter def set_axis(ax, x, y, letter=None): ax.text( x, y, letter, fontsiz...
9c49d63bad93dd602dca90b72162f9dbcb1a5f8c951430008b2e0ea278a66096
Python
8,559
243
import numpy as np import pytest from pandas._libs import index as libindex import pandas as pd import pandas._testing as tm class TestIntervalIndex: @pytest.fixture def series_with_interval_index(self): return pd.Series(np.arange(5), pd.IntervalIndex.from_breaks(np.arange(6))) def test_getitem...
caff0824e597686597518b24adbbf9c5d2f910e31fdaf332f37e67b7c91eab1a
Python
8,559
196
"""Public benchmark CLI gates, using the same compiled build as pytest. The end-to-end case takes ~10 s and <200 MiB on macOS. Fixtures are tiny; the full 64 MiB log-cache probe deliberately exercises the production cap. """ import json import os from pathlib import Path import subprocess import sys from types import...
f71aa2cf2a566172baa10a958040feeca530611ec2844c062ef33d6caa0c103f
Python
8,559
275
""" Module providing entry points for fitting and predicting with normative models from the command line. """ import argparse import cloudpickle as pickle # noqa: F401 import numpy as np from pcntoolkit.dataio import fileio from pcntoolkit.dataio.norm_data import NormData from pcntoolkit.normative_model import Norm...
b4e2ecb7e68d05f048c4a2508a7da711518057657da5391b778f73f9a5cbd18e
Python
8,561
196
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import os from scipy.stats import ttest_rel # Using a paired t-test since we're comparing the same models DATA_PATH = '../Extracted_Selectivity/VGG/PretrainedOnImageNet/IAPS/Tuning/' emotion_FILE = '1001_Lesion_BestModels0912...
23b1f6cc44747a9d1ae0dd0b1a3a31ff3f3b6497a6bda776a03b2eb8bb8ffe31
Python
8,562
295
from __future__ import annotations import itertools from typing import ( TYPE_CHECKING, cast, overload, ) import warnings import matplotlib as mpl import matplotlib.colors import numpy as np from pandas.util._exceptions import find_stack_level from pandas.core.dtypes.common import is_list_like if TYPE_...
12141a1e06a51b5f9ae90ef189fda71dce4a591a1dad85a90b8b354015f4c5d2
Python
8,565
202
''' Compares two CONLL-formatted coreference files for 1. anaphoricity recall/precision and 2. among correctly recalled mentions, what is precision of correct antecedent choice? Usage: python <script-name> key.conll preds.conll parsed.tokdecs ''' import sys import pdb DELIM = "\t" TOKDECDELIM = " " PRONOUNS = [...
50a9f5c9995b7f1a4b2d56aacb87e2bff8bfeefde66251427496cd7a2229f4ca
Python
8,565
237
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
b14c984eb827797a397c524d59a53194eeb31424a97c9e9efbe5c426c5aec4b1
Python
8,565
297
from datetime import timedelta import dateutil import numpy as np from pandas import ( DataFrame, Series, date_range, period_range, timedelta_range, ) from pandas.tseries.frequencies import infer_freq try: from pandas.plotting._matplotlib.converter import DatetimeConverter except ImportError...
c1aa38204458eb08cc4d5ff52bb9c34287377b83f6eed99978c8107aeec05b3c
Python
8,569
176
import pandas as pd import numpy as np import torch from rdkit import Chem from rdkit.Chem import AllChem, PandasTools from pytorch_classes_and_functions import DNN from helper_functions import get_fp_matrix, create_df_activations, get_bit_comp_df from fca_functions import fca_lattice_from_df, extract_substr_fro...
ba9c66b4bc7d339ed0b658886f2a3d4ee4612176b62d2a96dd62de11e275266b
Python
8,571
229
import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.models import Model from tensorflow.keras.layers import Conv3D, MaxPooling3D, BatchNormalization, Conv3DTranspose, concatenate, \ Cropping3D, Input from tensorflow.keras.optimizers import Adam # from keras.callbacks import Reduc...
0b13e29fa2a8198a3da6e8520cb6187d388adef022f260d71c2ab21e765bebaf
Python
8,572
252
"""Tests for KTrajectory Calculator classes.""" import pytest import torch from einops import rearrange from mrpro.data import KData, SpatialDimension from mrpro.data.traj_calculators import ( KTrajectoryCartesian, KTrajectoryIsmrmrd, KTrajectoryPulseq, KTrajectoryRadial2D, KTrajectoryRpe, KTra...
d5a788d2e2c5b2ea22407c41dfaae40c27891b97e6143423548fea60f4fc7c49
Python
8,573
218
import itertools from logging import Logger from typing import Any, Iterable, Mapping, Optional, Sequence, Union, cast import numpy as np import pandas as pd from ..chem.gpep.sort import GlycanComparer from .scorer import GlycoPeptideStructScorer from ..speclib.gpep.spec import GlycoPeptideMS2SpectrumProto from ..util...
479fd9f5f7dbbca3fb57b3b2feeaa3e31d6a6bb0da75df4a7d93e843bcfa893b
Python
8,591
203
from __future__ import print_function import math import os import random import copy import scipy import imageio import string import numpy as np from skimage.transform import resize try: # SciPy >= 0.19 from scipy.special import comb except ImportError: from scipy.misc import comb def bernstein_poly(i, n, t...
6c3fd4fed3652946bc3d200e8b8d84f2938603e4d822c20c64eb86bbd68e7ae8
Python
8,593
253
#!/usr/bin/env python # coding: utf-8 ### Author: federica.magnabosco@mrc-cbu.cam.ac.uk ### Fit decoding model LDvsSD individual ROIs and save accuracy # Import some relevant packages. import numpy as np import pandas as pd import pickle import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import se...
60b4ae6c8e87118318f9e1109a75742fcf577c6f48ca1379370b146e6e8fc812
Python
8,596
294
""" Testing that we work in the downstream packages """ import array from functools import partial import importlib import subprocess import sys import numpy as np import pytest from pandas.errors import IntCastingNaNError import pandas as pd import pandas._testing as tm from pandas.util.version import Version @p...
800155d0bfa14158276fe50120feafac9125c9843adc9cc28d985de16791a9ae
Python
8,599
267
# MOFTransformer version 2.2.0 import torch import torch.nn as nn import torch.nn.functional as F from torchmetrics.functional import mean_absolute_error def init_weights(module): if isinstance(module, (nn.Linear, nn.Embedding)): module.weight.data.normal_(mean=0.0, std=0.02) elif isinstance...
01654ba620b8afba6281e0216afb88306c877f4ab19c1b9b09d747274bfa3550
Python
8,604
219
# train.py # Script to train policies in Isaac Gym # # Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain...
4693b69124a04e9cafcaf84fb644b41d23b4e268a3e1c0ea6f03660459c82033
Python
8,606
220
import numpy as np import pytest from pandas.compat import PY315 import pandas as pd import pandas._testing as tm class TestPeriodIndex: def test_getitem_periodindex_duplicates_string_slice(self): # monotonic idx = pd.PeriodIndex(["2000", "2007", "2007", "2009", "2009"], freq="Y-JUN") ts...
faf25d8e8994f409c22b25e033000567337a5edcf7ee314e497a8279dd51a4be
Python
8,608
243
# This module is mostly borrowed from Olivecrona original implementation # (https://github.com/MarcusOlivecrona/REINVENT). # We adjusted some functions for this project. # import numpy as np import random import re import pickle from rdkit import Chem import sys import time import torch from torch.utils.data import D...
10c2d595b4ef266761e5b6f302d24d91a44cbd6f21cf96bae7ead66679f9b7a5
Python
8,613
260
import matplotlib.pyplot as plt import matplotlib.patches as mpatches import seaborn as sns from fmriprep_denoise.features.derivatives import get_qc_criteria from fmriprep_denoise.visualization import utils strategy_order = list(utils.GRID_LOCATION.values()) def load_data(path_root, datasets, criteria_name, fmripre...
7c5d1cf04f8fda61653904b85d83138eb9246a509c02fd5928ef90d07ab5282b
Python
8,614
256
# MOFTransformer version 2.1.0 import sys import os import copy import warnings import json from pathlib import Path import pytorch_lightning as pl from moftransformer.config import ex from moftransformer.config import config as _config from moftransformer.datamodules.datamodule import Datamodule from mo...
2c4c171b6c65c3081ae45bd78e22af4a05d6276be23630f7e9febfe8f72718bd
Python
8,618
264
"""Session 23 — Model Library + admin/users routes. - ``/workspaces/{id}/model-library`` lazily seeds from the engine's ``list_models`` on first read; subsequent reads serve DB rows. - ``/admin/users`` is gated on ``user.is_superuser``; non-superusers get 403. - Patching ``is_superuser`` / ``is_active`` works, with ...
c16c823abf6acd356e29bcf606fff7cd976c758a776852a93c55e6103163f061
Python
8,618
256
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 6 16:17:10 2023 @author: hklumpe """ import sys import os import time import json sys.path.insert(0,'/project/dunlop/shared_python_packages/') import qsub # Make sure the proper package is used: sys.path.insert(0,'./../') import deepcellcontrol ...
b7e67f84ac85b071b0258b14aeda4633afd91ce73d4db44cddab2c750b711e8c
Python
8,619
240
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...