sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
78d984305d88bd9a87affe491f95cb766e3f285130e5ba59f122468d03822024
Python
7,471
156
import os import numpy as np import sys ''' SCRIPT USED TO ANALYSE AND PLOT RAW DATA FROM THE AUDITORY HUMAN PWM TASK ''' ''' PRODUCES FIGURES IN THE MANUSCRIPT BOBOEVA ET AL 2023 PUBLISHED IN ELIFE''' # ''' COMPUTE PERFORMANCE OF ALL/INDIVIDUAL SUBJECTS AND PLOTTING FRACTION CLASSIFIED ''' # ''' PRODUCES FIG 7A and ...
0a1b21b81e85cf92eb40cd9056e3acea94522d35c70897f0ca70515095587f01
Python
7,473
152
import os from unittest import TestCase, mock import pandas as pd import dynast.preprocessing.bam as bam import dynast.utils as utils from .. import mixins class TestBam(mixins.TestMixin, TestCase): @classmethod def setUpClass(cls): super(TestBam, cls).setUpClass() cls.gene_infos = utils.r...
0fd3010c4a1a9df409344185b43bceda94feb636b125abed711c2282f3c8bedd
Python
7,474
166
from skimage import measure from math import ceil,floor from Parameter import * from Environment import * def BrainImage_cat(BrainImage_root,Save_root,flip=True, slices=75): x = 2500 y = 3500 if not os.path.exists(Save_root): os.mkdir(Save_root) brainimage_list = os.listdir(BrainImage_root) ...
b8851ff01c72bd7473b86e4a9d7e107d2928b5dc68cb00d3b559b974e710c28f
Python
7,477
235
"""Tests for CorrelationMatrix.""" from __future__ import annotations import warnings from pathlib import Path import numpy as np import pytest from pcntoolkit import CorrelationMatrix from test.test_longitudinal.conftest import make_cross_sectional_norm_data # A valid CSV with full-precision values, as another us...
adbab235d24f509b865c9640e25e8a38a2a3d7eb3f18ed80870d50e7081c0c38
Python
7,481
236
# Copyright 2018-2020 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...
abda6914a2e051ffc6aa0ac8334dbc647f62ea2fd8f669b83b4bfc95db4cea29
Python
7,482
216
from scipy.sparse import coo_matrix import numpy as np from scipy.ndimage import gaussian_filter import torch from kilosort import spikedetect def bin_spikes(ops, st): """ for each batch, the spikes in that batch are binned to a 2D matrix by amplitude and depth """ # the bin edges are based on min and max...
ab6ec516d85d5103973a9225ebf70a62fb9a303b16e554e852f3025eb0c22f05
Python
7,483
197
import numpy as np import pytest import pandas as pd import pandas._testing as tm def _isnan(val): try: return val is not pd.NA and np.isnan(val) except TypeError: return False def _equivalent_na(dtype, null): if dtype.na_value is pd.NA and null is pd.NA: return True elif _i...
a3db56e1b62143f219d8547136601e79a58e147a6a1942164043b3f0cf9195f8
Python
7,485
232
#!/usr/bin/env python3 # /// script # requires-python = ">=3.11" # dependencies = [ "packaging", "dependency-groups" ] # /// """Parse a pyproject.toml file and output a list of minimum dependency versions.""" from __future__ import annotations import argparse import sys import tomllib from collections import deque fr...
5d0bc92f3a5e50f1fdf07f546a69e603704ce019b54ba25ae558b8716eb8be12
Python
7,486
176
# Filename: file_handlers.py # Author: Alessandro Gerada # Date: 2023-08-11 # Copyright: Alessandro Gerada 2023 # Email: alessandro.gerada@liverpool.ac.uk """Functions to facilitate working with image data files""" import pathlib from pathlib import Path from aigarmic._img_utils import convert_cv2_to_keras impo...
9d5c79dfeca395d05d70dba9cf1d8ee02d01a25ac16d27940804d288fa8d6aa5
Python
7,486
207
import numbers import importlib.resources import dclab import numpy as np from PyQt6 import uic, QtCore, QtWidgets from ... import meta_tool class MetaPanel(QtWidgets.QWidget): def __init__(self, *args, **kwargs): super(MetaPanel, self).__init__(*args, **kwargs) ref = importlib.resources.files( ...
220d8ed23a6a5d1cc28c3a64f30a58c2cdf02bbbe2924bd67b00b443c312f37b
Python
7,487
131
from os import path import glob import argparse import numpy as np from .base import pointSets, surfaces from .base.affineRegistration import rigidRegistration, saveRigid def main(): parser = argparse.ArgumentParser(description='runs rigid registration over directories (relative to the first left surface)') p...
2402cbb3bee2bf4578c3e49e7d46551ea52d7cb8877820f4cbcc8777ccdbcfca
Python
7,489
231
from typing import Iterable, List, Literal, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import seaborn as sns from anndata import AnnData from matplotlib import pyplot as plt from scipy.sparse import lil_matrix from tqdm import tqdm def GWAS( data: pd.DataFrame, chr_name: list = [...
22648258fdd6d1e02cc47c66c519d1b0af0b9fe05925c1947efff270c3ffb039
Python
7,490
212
"""Plot endpoint integration tests (session 53). Exercises: - ``GET /api/v1/plots/registry`` — discoverability of plot kinds. - Authenticated 404 paths for run-bound plots when there's no promoted pipeline / unknown task. - ``GET /api/v1/datasets/{ds}/plots/eda/{kind}`` end-to-end on a real CSV upload (covers cor...
302995e71d8fc9e2e2c8db1e71283822cc350d4eeafec214ea9018763b5c5e36
Python
7,496
236
#----------------------------------------------------------------------------- # Pharamcophore based SASA for complex (Author: Cheng Wang) #----------------------------------------------------------------------------- import os, sys, pybel import numpy as np import pandas as pd from .pharma import pharma def runMSMS(i...
85e7f87010db1b1eb446962a732e42495bc36eda19f48602af15bc3785776c16
Python
7,499
158
from Environment import * from Parameter import * def get_density_csv(region_path, counts_csv, region_color, save_csv): '''cell counts/region pixel nums''' region_name = list(region_color.keys()) file = open(os.path.join(counts_csv, 'cortex_cells_counts.csv')) df = pd.read_csv(file) counts = df['SU...
4aa9d441c7e270ad1de14c0b2504619d3e0cfa9f3202c566bbb8b0415947804b
Python
7,500
183
#!/usr/bin/env python3 """Generate somo.saxs_atoms rows from authoritative sources. Sources (downloaded into data/ref/): * it1992.cpp - cctbx transcription of International Tables Vol. C, Table 6.1.1.4 (Cromer-Mann 4-Gaussian). THIS is the form SOMO production uses. * f0_WaasKirf.dat...
cf127c6cc6ff30188c228629226dd7e3a719492bb03ca079b92da1e25fe1f450
Python
7,500
195
import torch import torch.nn as nn from torch.nn.utils.parametrizations import spectral_norm from torch.utils.data import DataLoader import pytorch_lightning as pl from rgan.rgan import Generator, Discriminator class NoiseGenerator(nn.Module): def __init__(self, noise_scale): super().__init__() ...
ea13ba19bff010a3066e0b93efb91d8639ac33f9e6bc5178a129296dcea138b7
Python
7,501
146
#! /usr/bin/env python import argparse from plastid.readers.bed import BED_Reader from plastid.genomics.roitools import SegmentChain, positionlist_to_segments from collections import defaultdict import os import sys from time import strftime parser = argparse.ArgumentParser(description='Identify overlapping transcrip...
9fb8f4b662ebdbbee81c67fc1479c7537c29e5acb01a23bcc8a0c3e94b10fa49
Python
7,502
182
from tensorflow import keras from keras import datasets, layers, models from keras.models import load_model, save_model, Model from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Flatten, LSTM, Dense, TimeDistributed, BatchNormalization, Dropout, Activation, add, AveragePooling2D import tensorflow as...
205132429e61072061ce99ceb78822c23b8a15566c254ba7d086c3c4f08db805
Python
7,503
184
"""Session 26 — god-class drain: ``compare_models`` (supervised path). Supervised ``SupervisedExperiment.compare_models`` no longer delegates to ``self._legacy.compare_models``. It iterates the engine's model registry, calls the (already-drained) ``self.create_model`` for each entry, and assembles the leaderboard from...
1699d4a57e2fbd8db4a3cf455a593ba435b4d458358c3f7983603a13f9343e16
Python
7,504
197
from datetime import datetime import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestToTimestamp: def test_to_timestamp_non_contiguous(self): # GH#44100 dti = pd.date_range("2021-10-18", periods=9, freq="D", unit="ns") pi = dti.to_period() re...
85153c4b42a52d694b4abadfa6338c837538869ce8809c62e10f50c92c1690cc
Python
7,505
220
# 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...
05d0f10fb371f213e6e087bbd19cf67ec0707809e6c76d7a2b5983a0734f0423
Python
7,510
205
"""Automated annotation of Cognitive Atlas labels.""" import logging import re import numpy as np import pandas as pd from .. import references from ..due import due from ..extract import download_cognitive_atlas from ..utils import _uk_to_us from . import utils LGR = logging.getLogger(__name__) @due.dcite(referen...
db4b40bb3c309144acacc815e5fab8833a00c629df3f98810da12e68ee304982
Python
7,513
192
"""Differentiable Minimization.""" import functools from collections.abc import Callable from typing import TYPE_CHECKING, cast import torch from typing_extensions import Any, TypeVar, TypeVarTuple, Unpack from mrpro.algorithms.optimizers.cg import cg from mrpro.algorithms.optimizers.lbfgs import lbfgs from mrpro.op...
40ed9ff8c39eac032decf1a35e4d7cf36c32f82e433d0964a006d6b8a2ad2ee1
Python
7,515
234
import re import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def left(): return pd.DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]}) @pytest.fixture def right(): return pd.DataFrame({"key": ["b", "c", "d", "f"], "rvalue": [1, 2, 3.0, 4]}) class Tes...
d6c360b0319c07c969cda9533d2d408c475ab967238af5a3bbbf921ff3bc02de
Python
7,516
131
""" Created on Sept 2019 @author: Alice Geminiani - alice.geminiani@unipv.it olivocerebellar spiking neural network with E-GLIF neurons and PLASTICITY, for classical eyeblink conditioning simulations Publication: Geminiani et al., biorXiv, 2022 - doi: https://doi.org/10.1101/2023.06.20.545667 NEST CEBC simulat...
0266d0387b494903e994396472d327b31f74f4e300893c28537b63cd994c6001
Python
7,522
187
#!/usr/bin/env python import os, sys from csv import DictReader, DictWriter from collections import Counter, defaultdict from Bio.Seq import Seq def read_dropseq_clean_report(report_filename): """ EXAMPLE # FILTER_AMBIGUOUS=true # MIN_UMIS_PER_CELL=20 # UMI_BIAS_THRESHOLD=20 # EDIT_DISTANCE=20 ...
b12807164cec891cc815f7c97d58e76c3bec33ea96b8e908b2cc4e122533bf0e
Python
7,522
160
# 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...
5ed792eec6c8de73303eedea85e11f1396b5c0a0a0eed501806c54931cd656e4
Python
7,523
200
# 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...
1a7efe77594a2aefd8b3af2f1db8b16a1815d0f682f5014212cca2c26c57ef28
Python
7,526
156
"""add prediction_logs, trials, and model_library Revision ID: a1b2c3d4e5f6 Revises: 0cd9d5ea2e17 Create Date: 2026-05-08 12:00:00.000000+00:00 Session 22: control plane progress. - ``prediction_logs`` — append-only log of every served prediction. Powers drift detection, latency forensics, audit. - ``trials`` — fi...
70cfa355fdbf1dacca02060bc544f4cdc6b70c8261d996ccf684589e314fc5cd
Python
7,529
200
import numpy as np import ants as an from pathlib import Path from deepbrain import Extractor from scipy.stats import pearsonr ''' Functions for fast preprocessing of anatomical images ''' def extract_brain(image): ''' Brain Extraction Parameters ---------- image: ANTs image objec...
822e71d904164b0ae6d25818a0482cd0aed8eeab8369d6c053ded725089d1667
Python
7,530
127
from botocore.client import Config import ibm_boto3 from io import StringIO import types import os import pandas as pd import sys import json sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from config.glo...
ce2c9de4212aa5d68f947aaee51979503b27959f7ca34b6117bd5c1c4c281ed9
Python
7,530
260
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 ...
537be6f2cdd1dab36fde3de7167eb2cf38d5bbfba2e35f62a7dd942b22b537d8
Python
7,533
203
from pathlib import Path 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 import DemoReadSGLXData.readSGLX as readSGLX def set_axis(ax, x, y, letter=None...
894f2dbd649b931f55362b89bdd91434501374638aaee17d77b11edf6cb6ca3b
Python
7,536
300
# 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...
3b7229c6c1bc7c9963e50726aefa0347b52bfb7656db81a27b3c46f1ea874083
Python
7,542
185
"""3D CNN model builders ported from `Training.ipynb` (see `docs/legacy-notebooks-inventory.md`, "`Training.ipynb`" section). The notebook defines four near-identical Keras functional models (`get_3d_model`, `get_3d_frozen`, `get_3d_x`, `get_3d_y`) that differ only in which layers are frozen (`trainable=False`) and wh...
3fcbaf5e16a6103f0063e05a7bac1260ef4f6859b018d8192968f174ca38667b
Python
7,544
184
# 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...
eeccdf9c967c10dfb40ea3f6b75f732f902fef3e58fcb45e63f34c93951a22ba
Python
7,544
196
import torch.nn as nn import torch.nn.functional as F import torch from dredda.functions import ReverseLayerF from collections import OrderedDict class FCModelDualBranchAE(nn.Module): """ The main model for domain adaptation. This model is a dual-branch autoencoder with a feature extractor, a task classifier,...
542e61c957773cdaa0014f15159251048c2d5dff69b7e7e89bb98633f26952c2
Python
7,545
161
"""OrganAge parity against the authors' R scoring expressions and fold-one CSVs.""" import gzip import hashlib import importlib import importlib.util import json from pathlib import Path import numpy as np import pytest import torch FIXTURES = Path(__file__).resolve().parents[1] / "data" / "organage" def test_orga...
6aa9e41301b5d72d0e8f42d666a234c5884c17a37c5df49efdb03e6c7a8561b3
Python
7,552
207
#! /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...
275e2e3f107063110a61e3cb02620c6c20602f96b318d7a00ac27b341907d31e
Python
7,554
243
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 ...
c232299c7730f17c4955950086a5421ecd1cb0a31864b4447cd91b6b757f04c9
Python
7,554
226
# -*- coding: utf-8 -*- """ --------------------------------------------------- Created on Wed Oct 13 01:42:09 2021 @author: Amin Tanhadoust, E-mail : amin[dot]tanhadoust[at]gmail[dot]com https://scholar.google.com/citations?user=_LaQzv8AAAAJ https://tanhadoust.com --------------------------------------------...
7e87dad30a87e98e1dc1d0d3d610dc685d8ee51fec085e1e2a3d615d3d6a01d3
Python
7,556
227
""" Module for formatting output data in console (to string). """ from __future__ import annotations from shutil import get_terminal_size from typing import TYPE_CHECKING import numpy as np from pandas.io.formats.printing import pprint_thing if TYPE_CHECKING: from collections.abc import Iterable from pand...
d30dd42c3499cc7ab730f33a0928985c0bb8924940fa76fc620626db559fa7a6
Python
7,558
169
# -*- coding: utf-8 -*- """ DICOM conversion to Slicer-compatible NRRD, using dcm2niix """ import logging logger = logging.getLogger(__name__) import os import shlex from subprocess import Popen, PIPE from .inout import split_filename, read_image_sitk, write_image_sitk from app.utils import end_execution, wrap_string...
2aea0cf14fcd33ae92ad35f0e04b53d2573645972cdcf67735ba840045d7ad4b
Python
7,562
123
from botocore.client import Config import ibm_boto3 import re import os import sys import json sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from config.globals import ENVIRONMENT from app import create_...
2bbb59a07863744162d7678e317a35143600f3ffba456a770da39aeead615fcb
Python
7,562
208
from driver import compute from values import * from defs import * import electrochemical import water import glucose import cotransport import NHE3 import ATPase import NKCC import KCC import NCC import ENaC import Pendrin import AE1 import NHE1 import flux import os import sys import argparse import multiprocessing ...
03edf3bfb96cbf6054e42502e07c95f50c9906aeecb341fa9b20a22aa887098d
Python
7,564
210
''' get_em_annotations.py Get EM annotations from Raw and Split-GAL4 databases and dump to an Excel file ''' import argparse import collections from operator import attrgetter import sys from time import strftime import pandas as pd from tqdm import tqdm import jrc_common.jrc_common as JRC #pylint:disable=broad-e...
570e8d9795e9d2e9bdaad20e775d71c4ec8017b754b9798133c9bd51aabe47fe
Python
7,566
228
#!$HOME/.pyenv/shims/python # coding: utf-8 import os if 'PYTHONPATH' not in os.environ: print("Error: Run `source env.sh` to be able to run `/scripts/*.py`") exit(1) from collections import defaultdict from pathlib import Path from typing import Tuple from time import time, sleep import cv2 import matplotli...
7b3fceebaca6d9e45a9c04794b14ddd59f4855acdd27b7591312dcf12d796db5
Python
7,566
285
# -*- coding: utf-8 -*- """ Created on Tue Mar 8 14:31:15 2022 @author: System 6 """ import numpy as np 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.neopixel.c...
5334525f7f8a36de37983592826f82766a35b2fa04484a4b5f43ff0ab122e4e3
Python
7,568
179
# # This file computes the atomic spherical coordinates in a given set of # neighborhoods and outputs a file with these coordinates. # # It takes as arguments: # - The name of the ouput file # - Name of central residue dataset # - Number of threads # - The neighborhood radius # - "easy" flag to include central res...
0b6e0b28e4d172012b31db94c56568c4d426abbdacf2caeab6e03731773cbd18
Python
7,570
196
# 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 the above copyright notice, this # list of condit...
4f3f12d5466a5249dd587014c96165872781b1d29e4b154f8a664fbe3f6f25c8
Python
7,570
178
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
c1406b54b1cc3195d48ceffacbffed2fd24466cef5184badeb7c26c2bfd8e846
Python
7,574
254
# 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...
e818a396cef5ecda2bb803cf2de86a213d4b0426547ac1959dbdc164d13eef84
Python
7,581
223
import numpy as np from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection from deepglyco.chem.gpep.glycans import MonosaccharideCollection from deepglyco.chem.pep.aminoacids import AminoAcidCollection from deepglyco.chem.pep.fragments import ...
1506aad58cc7dda519a9518b35184b06ea14d0204438e5dfaf3a5b57fd8a1996
Python
7,582
208
import numpy as np import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F def get_socre(outputs): nnOutputs = outputs.data.cpu() nnOutputs = nnOutputs.numpy() nnOutputs = nnOutputs - np.max(nnOutputs, axis=1, keepdims=True) nnOutputs = np.exp(nnOutputs) /...
3fb5455782b875d28a50ae52e8dc51b4643f35ea82568ec16c25841fb2a1495d
Python
7,582
169
# -*- coding: utf-8 -*- """ DICOM conversion to Slicer-compatible NRRD, using dcm2niix """ import logging logger = logging.getLogger(__name__) import os import shlex from subprocess import Popen, PIPE from .inout import split_filename, read_image_sitk, write_image_sitk from app.utils import end_execution, wrap_string...
b4e17c7b5a6a3af07431d5404f304188dcfc3e3c9f559254d3dff4ce3dd8e236
Python
7,582
279
"""File compression/decompression functions. """ import bz2 import gzip import io import lzma import os from subprocess import Popen, PIPE COMPRESSORS = { ".gz" : gzip, ".bz2" : bz2, ".xz" : lzma } """Mapping of file extension to python compression library.""" class GzipWriter: """Wrapper for a proc...
d49913dc663b4e7194d0eb5acd3fb0122000990cf246579d1f8c0797580ec5a9
Python
7,582
264
# 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...
b6f0901f34069aa2882c1837430ecc6c21a5eaed879daef06363bc1c3efa3b15
Python
7,583
203
from datetime import datetime import numpy as np import pytest from pandas.errors import OutOfBoundsDatetime import pandas as pd import pandas._testing as tm class TestSeriesClip: def test_clip(self, datetime_series): val = datetime_series.median() assert datetime_series.clip(lower=val).min() ...
685a2148b74e06ab17c1eea42d39fe60d3f30b3686a52067ce412984e649b53f
Python
7,590
179
"""Tests for computing the operator norm of linear operators.""" from math import prod, sqrt import pytest import torch from mrpro.operators import EinsumOp, FastFourierOp, FiniteDifferenceOp from mrpro.utils import RandomGenerator def test_power_iteration_uses_stopping_criterion(): """Test if the power iterati...
e525e874ebf19518812ee72239f1f935653e1f202608943e26d4611481e776a1
Python
7,594
237
import os import time from utils import getLogger, getEstimatingArg from ioput import parseBedpeFiles, txt2jd, parseJdFile from joblib import Parallel, delayed import numpy as np import pandas as pd from plot import plotInterSelfCutFrag from model_test import getIntSig, markIntSig import shutil global log # checkOve...
181dcef4a1fbc5aff2bd1c1bfbf8b2207d430158949fbb473fad373280d1b7da
Python
7,596
243
#! /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...
f8c8378b66897823dc4e74a92711517bedf8a5c39e91ef8f7acc2a82ae93c191
Python
7,597
237
import os import time from utils import getLogger, getEstimatingArg from ioput import parseBedpeFiles, txt2jd, parseJdFile from joblib import Parallel, delayed import numpy as np import pandas as pd from plot import plotInterSelfCutFrag from model_test import getIntSig, markIntSig import shutil global log # checkOve...
08ed077cbdb1b37adf17867a3d16322a2f8c136eae95f8d6633853cb0ef82e2d
Python
7,598
269
from yacs.config import CfgNode as CN _C = CN() # ---------------------------------------------------------------------------- # # Model options # ---------------------------------------------------------------------------- # _C.MODEL = CN() # Name of model _C.MODEL.MODEL_NAME = "" # Number of classes to predict, i...
a7b758caa526130ece41f79bbe67114379ebc1cede75db801574877d091fdb04
Python
7,598
214
# -*- coding: utf-8 -*- """Adaptive false discovery rate (FDR) procedures. The procedures implemented here are: abh - The adaptive linear step-up procedure, which is defined on page 494 in [1] and originally in [2] lsu - The non-adaptive one-stage linear step-up procedure orc - The 'Oracle' procedure, which is ...
207721a879635e76141d6f05c1cf912386f463c3242c591245d1f9119a230c4f
Python
7,599
186
"""Defaults contracts and public buffer/layout boundary regressions for #767.""" from dataclasses import FrozenInstanceError, fields, replace import io import subprocess import sys import pytest from conftest import macs3_env from MACS3.Utilities.Performance import DEFAULTS from test_Parser_frag_eof import write_fra...
21825d3744e7f795144e05807c28076c17cc9c276fb13fe58d98bf6d1ae877fc
Python
7,604
165
################################################################ ### Figure 1 ############################################################### ################################################################ import numpy as np from pyhdf.SD import SD, SDC ## to load experimental hd4 files import matplotlib.pylab as plt ...
5c0fc6db425ff42e3993a586fd78ce149e881a00bb6b9843370ff4b508d031e8
Python
7,609
179
"""PAC parity with pinned Kuo et al. R code, including the public input path.""" import importlib import importlib.util import json from pathlib import Path import numpy as np import pandas as pd import pytest import torch FIXTURES = Path(__file__).resolve().parents[1] / "data" / "proteoclock" def _fixture_model()...
5fc4c34b99eacbbe309ca77de1ed861849b3472b1c9d7991ec345249aa6ebac2
Python
7,611
146
import math import os import random import numpy as np import pandas as pd import os import sys sys.path.append("prepare_data") root = os.getcwd() def create_drp_dict(path_ic50,path_drug_id_name): IC50table = pd.read_csv(path_ic50) IC50table = IC50table.rename(columns={'0': 'cell_id'}) IC50table = IC50table...
84654a58034dd696422a7336a23736ae85fd35717b13ab96f0aa866b680e930a
Python
7,613
206
# 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...
0d9e3b3195fa2117845ea36fbe86bcb5f376273e2d79bb7d178ef669dc054abc
Python
7,617
234
""" @author: mkowalska """ import os import numpy as np from numpy.linalg import LinAlgError import matplotlib.pyplot as plt from figure_properties import * import matplotlib.gridspec as gridspec from kcsd import KCSD1D import targeted_basis as tb __abs_file__ = os.path.abspath(__file__) def _html(r, g, b): ret...
258b4a4ac3b28e3d3a3c0535b683de8fb414f33ea3218364bbbc9cfaf85e3163
Python
7,617
200
import importlib.resources import dclab from dclab.features.emodulus.viscosity import ( KNOWN_MEDIA, SAME_MEDIA, get_viscosity ) import numpy as np from PyQt6 import uic, QtCore, QtWidgets from shapeout2.gui.analysis.ana_slot import SlotPanel from shapeout2.gui.widgets import show_wait_cursor class BulkActionE...
7cef2ffb27ae7f5982384dbba30994b65f98009d7dfa17d9e5aea83afbec21fc
Python
7,621
263
# Copyright 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 agre...
fe536053730602ef6855c5b493b3f5df7cb5a2ad0be6f1e8cb18ac71756d0f4d
Python
7,621
214
import numpy as np import matplotlib.pyplot as plt, matplotlib.gridspec as gridspec import matplotlib.ticker c_in_wt = "C0" c_not_in_wt = "C1" c_wt = "C2" c_unc31 = "C9" def make_alphacolorbar(cax,vmin,vmax,tickstep, alphamin,alphamax,nalphaticks, cmap="viridis",bg_gray=0...
19792b320b7a3576aed1923c18c91494ee5300bf48cc0c773803b9486db0e052
Python
7,626
210
import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestAstype: @pytest.mark.parametrize("cls", [pd.Categorical, pd.CategoricalIndex]) @pytest.mark.parametrize("values", [[1, np.nan], [pd.Timestamp("2000"), pd.NaT]]) def test_a...
4293c36dceb02ec3423fe5ebcbbea25fe3b1a1033fdc0762c3b4899963227ba2
Python
7,631
231
""" Note: for naming purposes, most tests are title with as e.g. "test_nlargest_foo" but are implicitly also testing nsmallest_foo. """ from string import ascii_lowercase import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def df_main_dtypes(): return pd.DataFrame(...
0991ef7308137b33e01871696eb0f0c61d974cf30eca25d9ed2a0e94e60bd8b5
Python
7,632
179
import pysam import os def overlap_svision_pro_with_others(input_vcf, output_path, trio): other_call_path = { "sniffles2": "/mnt/d/workspace/svision-pro/real_trio/sniffles2.{}.s10.vcf".format(trio), "svision_jasmine": "/mnt/d/workspace/svision-pro/real_trio/supp10_supp2/svision_jasmine.{}.s10.s2....
03bd2e3a2680937521a6804ea580cf20c6fee9dde0164f18cf5f2de705317feb
Python
7,633
174
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 DATA_PATH = '../Extracted_Selectivity/VGG/PretrainedOnImageNet/IAPS/Tuning/' emotion_FILE = '0915_BestModels0912_SI_byRank80/IAPS_pleasant_combined_df_with_l...
2a007a58267c09ffe159d6eab3d20a9ea15c94d7b4f277572699a86c718fd0bb
Python
7,633
222
# 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...
0d00c12f1c86671c34b8ba7d0cf4ed6ad512e6dd6d8f2b5bb115d8ddd3ea81c9
Python
7,639
261
import torch import torch.nn as nn import torch.nn.functional as F from roost.core import BaseModelClass from roost.segments import MeanPooling, SimpleNetwork, SumPooling class CrystalGraphConvNet(BaseModelClass): """ Create a crystal graph convolutional neural network for predicting total material prope...
f391301e546dde91a6711bb0ee344e617ff5d436fcd701283a7a5ba15b541112
Python
7,644
182
# 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...
c258bef349342faf9b0920fffe413d576ac15729d03afea147fcdff2eb6feb9f
Python
7,646
167
"""Dictionary Matching Operator.""" from collections.abc import Callable from typing import cast import torch from typing_extensions import Self, TypeVarTuple, Unpack from mrpro.operators.Operator import Operator Tin = TypeVarTuple('Tin') class DictionaryMatchOp(Operator[torch.Tensor, tuple[Unpack[Tin]]]): r"...
3575f7c9d640d6c2e7f89d4b7c465abba5832bd8244aa0c07dcdb5d5aefe3b28
Python
7,651
205
# 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...
6848c20aa5ba41819f73885e2b7bb1ab9238d3d53e319cff97803eb42f4012c3
Python
7,651
260
"""Helper/Utilities for test functions.""" import torch from mrpro.operators import LinearOperator, Operator from typing_extensions import TypeVarTuple, Unpack def relative_image_difference(img1: torch.Tensor, img2: torch.Tensor) -> torch.Tensor: """Calculate mean absolute relative difference between two images....
1fe99d0b106bcff7c2ad0566f4e9168e1c723ed169be39be3c6c7417ce5ad93d
Python
7,654
214
# 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...
3d91e2c631b1ed1f773533dfdbd68f353b3235e7a471708929c5c0b83358b847
Python
7,656
218
# Copyright 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 agre...
8b8ede6871b02abe2f62a93159955e4b39acb81b7d6d2079fdcfa82f83e12f46
Python
7,659
225
import pytest import pandas as pd import pandas._testing as tm def check_level_names(index, names): assert [level.name for level in index.levels] == list(names) def test_slice_keep_name(): x = pd.MultiIndex.from_tuples([("a", "b"), (1, 2), ("c", "d")], names=["x", "y"]) assert x[1:].names == x.names ...
03fb5825477af803f5368c96123d0d0f8204f4bd53697ff230a1893a87f22a33
Python
7,664
234
''' convert_neuron_tiffs.py Convert searchabler neuron TIFFs into PNGs ''' import argparse from io import BytesIO import json import os import re import sys import colorlog import boto3 from botocore.exceptions import ClientError import dask from dask.callbacks import Callback from PIL import Image import requests...
43f8d8aed18c4b49fbb274e79ecb4b1cdb3ab50a231b132decf80a5233592705
Python
7,665
259
#---------------------------------------------------------------------72 #---------------------------------------------------------------------72 # ACTIVE TRANSPORT VIA ATPases #---------------------------------------------------------------------72 #------------------------------------------------------------------...
0207d9b122d0abf88a388d005880c68b618f9bac83a140da7244e98f9139e1d6
Python
7,668
208
import os import time import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import matplotlib.pyplot as plt plt.style.use('ggplot') from src.models import NeuralKalmanFilter, KalmanFilter from src.utils import * import argparse device = "cuda" if torch.cuda.is_available() else "cpu" pri...
ce83656f8213ee4e3195b42597d0fcb5436d7f62a217d259d096fea646b8872f
Python
7,668
128
import numpy as np import pandas as pd import random def convert_counts_to_cpm(counts): lib_sizes = counts.sum(axis = 0).to_list() scaled_counts = counts.divide(lib_sizes) cpms = (scaled_counts * (10**6)).astype(np.float32) return cpms def filter_on_cpm(counts, n): lib_sizes = counts.sum(axis = 0)...
122bf034c056b4385c90abb741c008977a6995a9250246e000e7f7c925c981a5
Python
7,669
216
from datetime import datetime import re import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestRename: def test_rename(self, datetime_series): ts = datetime_series renamer = lambda x: x.strftime("%Y%m%d") rena...
6eaebcb30b160964ba26e67e59f6bf18b7ffd95793e0b2c561f58fa6653c9f80
Python
7,670
224
from typing import Iterable, List, Literal, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import seaborn as sns from anndata import AnnData from matplotlib import pyplot as plt def heatmap( adata_cc: AnnData, rna: Union[pd.DataFrame, None] = None, figsize: Tuple[int, int] = (28,...
9ff0794ddf58f3b906d246f2cddf01c9a7ef06dbcc764c467c10dccda27c9528
Python
7,671
208
__all__ = ["pGlycoReportParser"] import os import re from typing import Tuple, Union import numpy as np import pandas as pd from ....chem.pep.aminoacids import AminoAcidCollection from ....chem.pep.mods import ( ModificationCollection, ModifiedSequence, ModPosition, modified_sequence_to_str, ) from ....
7750eaa7e458a48d764cc71f4a347ed0e0d0cfae63740340d0acda0104bc235b
Python
7,672
222
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDataFrameIsIn: def test_isin(self): # GH#4211 df = pd.DataFrame( { "vals": [1, 2, 3, 4], "ids": ["a", "b", "f", "n"], "ids2": ["a", "n", "c", "n"...
ea72117015c1b31c8ef83e074ee4b84e5e101abf8b545fbedca92ee42af592ef
Python
7,673
185
#!/usr/bin/env python """Train models with dynamic data.""" import sys import torch from functools import partial import os os.environ['CUDA_VISIBLE_DEVICES']='4' # import onmt.opts as opts from onmt.utils.distributed import ErrorHandler, consumer, batch_producer from onmt.utils.misc import set_random_seed from onmt.m...
fea2777a1e400fabb7d7f785152ea4dbd88f7523d1809a906c0c1fee1410d5fe
Python
7,673
216
"""Automated annotation of Cognitive Atlas labels.""" import logging import re import numpy as np import pandas as pd from nimare import references from nimare.annotate import utils from nimare.due import due from nimare.extract import download_cognitive_atlas from nimare.utils import _uk_to_us LGR = logging.getLogg...
f33e7316ca39ef906be9989837da6e929e6e26f40d3755d58f394d53eb333573
Python
7,680
191
import sys, re, argparse argparser = argparse.ArgumentParser(''' Generates a space-delimited table of relevant fields from the entries in a *.constitevallist table. ''') argparser.add_argument('constitevallist', type=str, nargs=1, help='Path to a *.constitevallist table.') args, unknown = argparser.parse_known_args() ...
4d7c61e745415d26863e83fa4c7b570c55f1cfcf16937e88bffffd927a121e6c
Python
7,683
199
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: """ .. _datasets_imgs_to_coords: ================================= Transform images into coordinates ================================= Create a dataset with coordinates derived from peak statist...
1ad6f615d6ff8d43b5999fcbf3f4960804cce5ee9dc17addd2806c7242d18635
Python
7,692
138
#! /usr/bin/env python import argparse import sys import os import pysam from collections import defaultdict import numpy as np from hashed_read_genome_array import read_length_nmis import itertools import multiprocessing as mp from time import strftime parser = argparse.ArgumentParser(description='Find most common P...