sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d7a8ebc7adc9228c324523c7f5e648580937a21d25ea6439bee5e5d122aee549
Python
6,663
192
#!/usr/bin/env python3 # # 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 requir...
af947fe4fac12071fc6c82acc81d7eacb36485f96a7f813e742ea2e7b0df5084
Python
6,664
170
import numpy as np import pytest import pandas._config.config as cf import pandas as pd import pandas._testing as tm class TestIndexRendering: def test_repr_is_valid_construction_code(self): # for the case of Index, where the repr is traditional rather than # stylized idx = pd.Index(["a"...
a8fd52890e8f1ac41e267bff1894550e2ec7e0aebf5177ac12bf2caf51b780fc
Python
6,665
184
import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin from sklearn.compose import ColumnTransformer, make_column_selector from src import prep from src.nodim import transform_nodim, estimate_params class DiMap(BaseEstimator, TransformerMixin): """Distribution Mapping Transformer.""" def...
ee48370204003d31ed61975084cf43e94ba416ebe6fc75be864a2a65cad53180
Python
6,665
200
"""Platform backup + restore — superuser-only. Two endpoints: GET /admin/backup Stream a tarball containing: * ``database.json`` — all rows from every table (UUIDs preserved) * ``artifacts/<run_id>/...`` — raw artifact files POST /admin/restore (multipart upload of a tarball) ...
cc54907bc96d427e7211aa9089c2a4fb5fbd9f1a00830e8f82f5c548cf01a1e4
Python
6,666
142
import torch from tnn.layers import View, Permute, tLinearLayer, LinearLayer from tnn.networks import tHamiltonianResNet from tnn.loss import tCrossEntropyLoss from tnn.regularization import SmoothTimeRegularization, TikhonovRegularization, BlockRegularization from tnn.training.batch_train import train from tnn.utils i...
a571e522cf399429c6fe8058ee276244ac73550c948d0b720f071f1407e7c45b
Python
6,668
175
import warnings warnings.filterwarnings('ignore') import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from tqdm import tqdm import matplotlib.pyplot as plt import numpy as np from utils import * from config import models_genesis_config from torch import nn import torch from nnunet.training.learning_rate.poly_lr import ...
75102f0b4f44a396fe8fa43bbbaf88add09b3892334a4975552e9d7118e11a1d
Python
6,673
185
#!/usr/bin/python import numpy as np import warnings internal_os = 2 pcs_directions = ["dSag", "dCor", "dTra"] # p. 418 - pcs to dcs pcs_transformations = { "HFS": [[1, 0, 0], [0, -1, 0], [0, 0, -1]], "HFP": [[-1, 0, 0], [0, 1, 0], [0, 0, -1]], "FFS": [[-1, 0, 0], [0, -1, 0], [0, 0, 1]], } # scalar first...
6f5422103e772874dccd02be57409596f4476252d2ac7b502801ae2cbbf0521d
Python
6,677
218
import numpy as np import sys import gvar as gv import vegas try: import corner except ImportError: corner = None try: import lsqfit except ImportError: lsqfit = None if sys.argv[1:]: SHOW_PLOTS = eval(sys.argv[1]) # display picture of grid ? else: SHOW_PLOTS = True # options (default i...
7d0751d388bea224a9337c9e1909f1abb2ac551802e6f476fa6da95852dc3547
Python
6,678
170
# 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...
df169fcd31898646bcd06e24cc2a03b8d379fdca7237a48ef72245680a7082bf
Python
6,683
157
# 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...
2586cb0ef289355cc649eacbf7acf05ae4f42db0a5383796f7be18562a4c4254
Python
6,684
180
import torch import numpy import argparse import bionetwork import plotting import pandas inputAmplitude = 3 projectionAmplitude = 1.2 batchSize = 5 noiseLevel = 1e-3 MoAFactor = 1e-1 spectralFactor = 1e-3 maxIter = 8000 L2 = 1e-6 #weightAidFactor = 1e-8 #Get data number parser = argparse.ArgumentParser(prog='Signa...
38e643d1391bad5c29a95177048bb188854a0ad45fdfbd8e2ba34bad1f7476e4
Python
6,686
156
# 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...
eb28dee3b5ce26251ac19f532c410547f42af7e9de6371807ba6697dd64d7941
Python
6,686
160
import numpy as np import os, sys import nibabel as nib from neuroxai.utils.process import norm_image from tensorflow.keras import Input, Model from tensorflow.keras.layers import concatenate, Conv2D, Conv3D, UpSampling3D, Activation, BatchNormalization from tensorflow.keras.layers import SpatialDropout3D, MaxPooling3...
08eaa9cb798b875c6c52453305cdca339a7dd9c1bdb6d72b95ec7e849e98914a
Python
6,687
189
from __future__ import print_function, division import torch import torch.nn as nn class ConvLayer(nn.Module): """ Convolutional operation on graphs """ def __init__(self, atom_fea_len, nbr_fea_len): """ Initialize ConvLayer. Parameters ---------- atom_fea_l...
a363db1eedd040f93c16b60381fea58833fc8b3c2f3493db2e33d7486217e257
Python
6,689
158
# 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 condi...
9f18d0d3c8c5e4305a6fc922ad77307643a2bced55a758abe84b4cf4261664cb
Python
6,692
193
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_reindex(idx): result, indexer = idx.reindex(list(idx[:4])) assert isinstance(result, pd.MultiIndex) assert result.names == ["first", "second"] assert [level.name for level in result.levels] == ["first", "second...
b7f26749f7e45b2738889be1be692b8d0219c8515aaf36cd8e43e901dd0d9312
Python
6,694
199
# 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 agreed to in writing, software # distributed under the ...
6f43c6476e3bd6e844e191c482b6ce48fdf2abdabb16032d2cf4668e28c8959d
Python
6,695
146
"""Build IntrinClock370 and PhenoAge partitions from original author assets. Run from the repository root: uv run --with rdata --with remotezip python clocks/build_author_extensions.py \ --intrin-source /tmp/intrinclock-original --prc-source /tmp/pyaging-prc-original Without a source directory the pinned ...
0e55bd3fcc100f31efe1fe4beed91d5b25eaf6ee6168c21a8bb4b1cd45bf4620
Python
6,698
263
#scatterplots.py from initialization.config import * from initialization.initialization import * import seaborn as sns import matplotlib.pyplot as plt import plotly import plotly.graph_objects as go from plotly.subplots import make_subplots import plotly.express as px def seaborn_jointplot(df, pair, savepath=PLOT_OU...
b039a54479c5a7e9cba146d3be020c3641c5050a3c1774439afb6f8401dd13ee
Python
6,698
246
import matplotlib.pyplot as plt import numpy as np import pandas as pd import matplotlib.ticker as ticker import matplotlib.transforms as transforms import numpy as np from pathlib import Path from statistics import mean, stdev from fpdf import FPDF import math import sys sys.path.append('../') from plotting_function...
1144f20fa03fbda092abc801a5472766c5e3aaf4959068ab4520e9ee38db1ebf
Python
6,705
202
# 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...
1e616734a7436e113c9b9c0be597d18afa0bd15759e8ec63a88696546bad9d5d
Python
6,708
209
# 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...
968bcaf645ea354253267e0678b382eb01151926e237e58f2b44e72e00665b3b
Python
6,709
224
"""History class for undo stack.""" from dataclasses import dataclass, replace # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ # ---------------------------------------------------------------...
a323648e4da2d2dfe3e0a6b3421a603ebfccdd9114fc2c6f82beeca331c1620e
Python
6,710
179
""" Worker script: runs inside a single Lightning AI job. Downloads a dataset's zip archive from HuggingFace, extracts it to local (ephemeral) studio disk, trains one Lightning Pose model via `litpose train`, and deletes model weights. Results land in --output_dir (a path on teamspace storage). Can also be called dir...
c563b7fa925d54eabcecf6d8cd82344484fb93e1dbe64156ab3837ded5ccc3b4
Python
6,711
190
# 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...
0ba84d6925b8a5ab1b1aa7c92f1c7b420739814d748b59f3176614c5acd7839e
Python
6,716
147
import pytest import pandas as pd import pandas._testing as tm class TestCombine: def test_combine_scalar(self): # GH#21248 ser = pd.Series([i * 10 for i in range(5)]) result = ser.combine(3, lambda x, y: x + y) expected = pd.Series([i * 10 + 3 for i in range(5)]) tm.asser...
46c678b9bb56b471b9c55273d23c0476db9ba650125b757001834e89c1c71e80
Python
6,718
218
""" Tests for the following offsets: - BMonthBegin - BMonthEnd """ from __future__ import annotations from datetime import datetime import pytest import pandas as pd from pandas.tests.tseries.offsets.common import ( assert_is_on_offset, assert_offset_equal, ) from pandas.tseries.offsets import ( BMonth...
a82355b4a834b84e6d894e4adf9ffb44db73b9c04d78f1b1e724e583e037216f
Python
6,719
195
import sys import warnings from io import StringIO import numpy as np import pandas as pd from pybedtools import BedTool from . import _blo_algorithms as algorithms from . import _blo_utilities as utilities # Suppress certain warnings warnings.simplefilter("ignore", category=FutureWarning) warnings.simplefilter("ign...
4a1710e24c272a6fcd34e99c592a013534491259cefcd1724bc22174d33f1bc1
Python
6,724
177
"""Session 31 — drain the secondary verbs: pull / models / get_metrics. After session 30 finished the internal-state drain, only setup() and a handful of advisory verbs remained on self._legacy. Session 31 drains the three that have a clean native equivalent: - ``pull()`` reads from ``self._fit_state["last_metrics"...
cd3c342c0c498fb256fd2f38416cb14b27bcee31cbb6802b09ef00845c957d30
Python
6,724
232
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from pandas.core.dtypes.missing import ( isna, na_value_for_dtype, ) if TYPE_CHECKING: from pandas._typing import ( ArrayLike, Scalar, npt, ) def quantile_compat( values: ArrayLike, q...
4dc3078241cbddc240e8978ae8c5bbfff9ab2f4b80624cd6b596c9341b2542c4
Python
6,726
192
###################### ### Import Library ### ###################### # my library from statistics import harmonic_mean from molgraph.dataset import * from molgraph.benchmark import * from molgraph.gineconv import * # used modified version from torch_geometric # standard import numpy as np import copy as copy # rdkit ...
fdbf55c3c62059bf4f37f10342a5d0fc22574df31b079633668c337e03508757
Python
6,728
202
# The following implementation is based on the techniques described in: # "Object Landmark Discovery Through Unsupervised Adaptation" by Enrique Sanchez and Georgios Tzimiropoulos # You can find the article here: http://papers.nips.cc/paper/9505-object-landmark-discovery-through-unsupervised-adaptation.pdf # # For ...
1d8da6de016b30a68a5eb0fa202fdf6cef10ead92e556640b0e3fd4f57fe139b
Python
6,729
209
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 10 16:41:48 2023 @author: jlugagne """ import os import copy import time import sys import json import uuid import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # Make sure the proper package is used: sys.path.insert(0,'./.....
bd894b5c2354b758401caf4caadfb7d09dd9d2bda84ff82a05d070426043b388
Python
6,731
196
#! /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...
c0ad939f75ad6a1c123d4f9b2624709caa1ce6caf7c294baeb601fe929b36683
Python
6,732
269
from textwrap import dedent import pytest import pandas as pd pytest.importorskip("jinja2") from pandas.io.formats.style import Styler @pytest.fixture def df(): return pd.DataFrame( {"A": [0, 1], "B": [-0.61, -1.22], "C": pd.Series(["ab", "cd"], dtype=object)} ) @pytest.fixture def styler(df): ...
7e0c7b6768eb6e61b6b45a9532307333c4c8cf2cf385aaf02689319ca2592100
Python
6,733
187
"""Add `array-support` directive.""" from __future__ import annotations from itertools import groupby from typing import TYPE_CHECKING from docutils import nodes from sphinx.util.docutils import SphinxDirective from sphinx.util.typing import ExtensionMetadata from scanpy._utils import _docs if TYPE_CHECKING: f...
368493bbfd2a557be9ce9d15650cde72909c7b0348443cbe90c4611dddfa7db3
Python
6,738
188
import pytest from umap import AlignedUMAP from umap.aligned_umap import expand_relations from sklearn.metrics import pairwise_distances from sklearn.cluster import KMeans import numpy as np from sklearn.metrics import adjusted_rand_score # =============================== # Test AlignedUMAP on sliced iris # ==========...
8f11e64c0d74db52700fcd6930a96f8291c4dba7359a110ac701aae48d21ece9
Python
6,741
156
"""Tests for transient steady state signal model.""" from collections.abc import Sequence import pytest import torch from mrpro.operators.models import TransientSteadyStateWithPreparation from mrpro.utils import RandomGenerator from tests import autodiff_test from tests.operators.models.conftest import SHAPE_VARIATIO...
9560ebf1ba7f4243d56540ee4e8f7f7eba0efaeb5f3b25fa7a5693d666b3147e
Python
6,742
197
""" This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal ...
0bc8c6634264898a6fb3543181e1becc94b06c3e28581edc8423dc5f29537e02
Python
6,746
197
# 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...
8df4e7a607d268d41018e611f2ff1a0644d6e8b13e5315f52b0fbe03bff416f6
Python
6,747
169
# 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...
89832a8ecd96ed8faab320e70e3a1293a24d0fc8754e30a26a36600d4d6c5eb5
Python
6,753
221
import argparse import gc import gzip import os import os.path as op import pickle from glob import glob import matplotlib import matplotlib.image as mpimg import nibabel as nib import numpy as np import pandas as pd from gradec.fetcher import _fetch_metamaps matplotlib.use("Agg") from matplotlib import pyplot as plt...
85a558b65ad6b9a62d0580f556cb308916a88e25854456512af5cda58f346787
Python
6,754
166
# 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...
e4fcefac7662efecf711d55e98bfc2291a2beb47a602c2da46dae97779c4f0b2
Python
6,754
136
# Implementation of Non-linear Least Squares import logging import numpy as np import scipy.optimize as op from tqdm import tqdm from joblib import Parallel, delayed #################################################################### # Parallelized NLS #################################################################...
68875367d8e558c9a812c7641b2ef08c9157007f92c24fbae7ce781a74441f89
Python
6,755
139
from Environment import * from Parameter import * PARAMETER_DIR = Registration['parameters_root'] def get_sitk_transform(elastix_param): tf_type = elastix_param['Transform'][0] image_spec = {'Size': [int(i) for i in elastix_param['Size']], 'Origin': [float(i) for i in elastix_param['Origin']]...
678fc92caafbe4ad48d0a603022219cb7c530c874b093f8d76bfb13735455cd8
Python
6,756
226
# -*- coding: utf-8 -*- """ Created on Thu Dec 9 14:18:03 2021 @author: jeanbaptiste """ # Not necessary once these are added to the python path permanently: import sys # Append paths to delta-dev and deep cell control before import: sys.path.append('C:/DeepLearning/DeLTA_dev') sys.path.append('C:/Users/System 6/Doc...
f15b92c0ac1256f3ca14137b26c981b28ac99e91eb1adf07a8bef1448234aa80
Python
6,757
139
''' This avoids reading any variant more than once. The sum of unpadded lengths of all 20k genes is 1400Mbases. The sum of the padded lengths is 5400Mbases. The total number of bases in the padded genes (without double-counting overlaps) is 2100Mbases (40%) (in 16k intervals) ''' from ..utils import get_padded_gen...
9cd993800ca152da3cd53a5d2f7e79e4fdf0c0fecc67bd0c40b0b7434f1f39ba
Python
6,760
168
"""Tests for data I/O functionality.""" import copy import numpy as np import pandas as pd import pytest from pcntoolkit.dataio.norm_data import NormData class TestDataIO: """Test data I/O functionality.""" @pytest.fixture(autouse=True) def setup(self, synthetic_data): """Setup test environmen...
06dde9b092907f930283fbd147d0c00c173d1e3f1a8899e5ceae767b63945d8e
Python
6,762
198
"""Experiment CRUD (nested under a project).""" from __future__ import annotations from typing import Annotated from fastapi import APIRouter, Depends, HTTPException, status from pycaret.core.tasks import TaskType from sqlalchemy import func, select from sqlalchemy.orm import Session from pycaret_server.api.schemas...
6907808ccba80d15c29ba9e075ce9f1a5c3dfb0f4e7a271767d3f3469d724cdf
Python
6,763
227
#!/usr/bin/env python from __future__ import print_function import windseer.data as nn_data import windseer.nn as nn import windseer.utils as utils import argparse import numpy as np import os import torch parser = argparse.ArgumentParser( description='Script to plot a prediction of the network' ) parser.ad...
ec4c7f1feeec8acf74288b7479de5186e2827a09bc6cd876f0629d96fee7b2af
Python
6,767
213
""" Code for identifying Pfam domains and mapping Pfam alignments and ECs into target sequence mode. Authors: Thomas A. Hopf .. todo:: 1. Write code to create list of family sizes 2. Implement alignments against Pfam-HMM so precomputed results can be reused in focus mode """ import gzip import pandas as p...
2297c36eefdc6577d6b24ef5732c2133df7ec74eae1d28265f605a919a6688e4
Python
6,770
138
from Environment_ui import * PARAMETER_DIR = 'pages/Registration/parameters' def get_sitk_transform(elastix_param): tf_type = elastix_param['Transform'][0] image_spec = {'Size': [int(i) for i in elastix_param['Size']], 'Origin': [float(i) for i in elastix_param['Origin']], '...
949194e155dab4fa931b0210246817394a8fa60d1a1073f76a8a110ffbd7acae
Python
6,771
184
# 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...
56c0c67fed0f9815d63eaa6cef233be5761b49e0901ffe1f97ab62cfbb399cac
Python
6,779
219
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # mol2vec documentation build configuration file, created by # sphinx-quickstart on Mon Oct 30 21:41:26 2017. # # 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 # au...
c25a72b38a3e7381da428645c8ad5aa8eb0632d9e5d0ccbfe7d6f4ba8360a607
Python
6,780
204
from __future__ import absolute_import from __future__ import print_function import numpy as np import time import sys import os import six import marshal import types as python_types import logging def get_from_module(identifier, module_params, module_name, instantiate=False, kwargs=None): if...
315856774e51a5672b464bcfba9eeca55e262e7b468df2f673996b47c69e88ee
Python
6,783
225
import torch import matplotlib.pyplot as plt from tnn.utils import seed_everything from examples.tensor_trajectories.utils import setup_circle_3D, setup_circle_3D_grid, split_data, DummyData seed_everything(42) # plot data to check classes x, y = setup_circle_3D(n=2000) # fig = plt.figure() # ax = fig.add_subplot(pr...
dd0dff60b7eb3dd6b0970b1d43a0b190c62af124b35ca848ee76f91d4a65cd8c
Python
6,785
179
import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm from pandas.io.sas.sas_xport import XportReader from pandas.io.sas.sasreader import read_sas # CSV versions of test xpt files were obtained using the R foreign library # Numbers in a SAS xport...
b8399857a783a3f537efc96652fbbb5a766da51da5bd191fb06e18269c40eb03
Python
6,787
171
"""Common utility functions for rolling operations""" from __future__ import annotations from collections import defaultdict from typing import cast import numpy as np from pandas.core.dtypes.generic import ( ABCDataFrame, ABCSeries, ) from pandas.core.indexes.api import MultiIndex def flex_binary_moment...
6372b56efed4d73c3c20b82104991ca8550516f76bd6cc87a17c008a6e45520c
Python
6,789
170
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Sort multiecho DICOM for all subjects. This use the multiecho BEM from https://github.com/mcvinding/mri_stuff/tree/master/multiecho_bem """ # Import import os.path as op import sys import subprocess sys.path.append('/home/mikkel/mri_scripts/multiecho_bem') # Path to...
43a548cf94020273bbf7537120717bb1bad85eeb3adb38e97ef3495a64627f59
Python
6,791
160
# Imports from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from sklearn.decomposition import PCA from sklearn.svm import...
8ca359452ac86f69d207736072e843e9c27db02a9027fd6cea7a2524006093fc
Python
6,792
148
"""Command-line interface for the detect command. """ from atropos.io import STDOUT, STDERR from atropos.commands.cli import ( BaseCommandParser, positive, readable_url, writeable_file, readwriteable_file, probability) class CommandParser(BaseCommandParser): name = 'detect' usage = """ atropos detect -...
e6be9c1103e9c5274c85922dddb0c90927492befbf7524bb7138e0e95666aab4
Python
6,792
185
import sys import os import numpy as np import torch import torch.utils.data as du from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import util from util import * class drugcell_nn(nn.Module): def __init__(self, term_size_map, term_direct_gene_map, dG, ngene, ndrug, root, nu...
f897b9e58556b455d36313a2ba273f97f534f074b6e25d34385f01f1ea72cfe1
Python
6,793
172
from functools import lru_cache from langcodes import Language, best_match # Text in scripts written without spaces has to be handled specially in our # tokenization regex (see TOKEN_RE in tokens.py). Also, when one of these is # the script of the language we're analyzing, then we need to either have # a specific tok...
a64141a2da5133e20d74900ca0c3f5839527f0fb8da951539aad6fb29392bf59
Python
6,799
154
import os import pandas as pd import numpy as np import argparse import pickle import tensorflow as tf import scipy.sparse as sp from util import splitData, preprocess from tensorflow.keras.models import load_model def get_index(y, diff_mins, diff_maxs, cat, alpha=10, diff=None): if diff is None: upper = y...
e0f7f1bb3fdc5e7bd81adf874948f05bf617acb8decc531d464ff9ab54f52a27
Python
6,805
227
""" Core eval alignment algorithms. """ from __future__ import annotations from functools import ( partial, wraps, ) from typing import TYPE_CHECKING import warnings import numpy as np from pandas._config.config import _global_config as config from pandas.errors import PerformanceWarning from pandas.util._...
7b39cdf254e8107496e258eb51c8b7a8da9b487ffbae0d1c8f8abe9d93094985
Python
6,811
175
import torch from torch import Tensor import torch.nn.functional as F from torch.nn import Sequential, Linear, BatchNorm1d import torch_geometric from torch_geometric.nn import ( Set2Set, global_mean_pool, global_add_pool, global_max_pool, CGConv, ) from torch_scatter import scatter_mean, scatter_a...
08944d8f364a0ba790f0d6fceed928b77d625ff2e3171b10fac8e8f6ec1ba4c6
Python
6,812
207
# 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...
ea55830499b87e19affc836ef283ecaf30991c4d8cb65dd21e52da1bc17ee7c9
Python
6,812
172
import os import pysam def extrack_somatic(vcf_path, output_folder, tool): min_supports = [2, 3, 5, 8, 10, 15, 20] # min_supports = [1, 2, 3, 5, 8, 10] # min_supports = [15, 20] # min_supports = [1] for min_support in min_supports: output_path = os.path.join(output_folder, vcf_path.spli...
12ed20a67f2918e85665cc438192e3ed1f303602cee47f962912a4508b082060
Python
6,813
184
from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import pandas as pd from sktime.forecasting.base import ForecastingHorizon PyCaretForecastingHorizonTypes = Union[List[int], int, np.ndarray, ForecastingHorizon] def _check_and_clean_coverage(coverage: Union[float, List[float]]) -> List[f...
9c27e27c995143c09bf891d0857cfff739dc433f87c02022e35c4b21425eaf64
Python
6,817
227
import numpy as np import scipy.sparse import pandas as pd from pandas import ( MultiIndex, Series, date_range, ) from pandas.arrays import SparseArray def make_array(size, dense_proportion, fill_value, dtype): dense_size = int(size * dense_proportion) arr = np.full(size, fill_value, dtype) i...
0d34be73a2aca799c75dddf465ceaf77141f5077fb159b06f6ff35e484e1ac0b
Python
6,820
187
from game_functions import Game, Game_Bayes from game_functions import percentile_discrete import numpy as np import matplotlib.pyplot as plt from matplotlib import cm, use from helper_set_pi import set_pi import sys def plot_gamefit_and_distribution(xd,yd,xf,yf,pi,eps,whichdistrib): fig, ax = plt.subplots(1,1,figsi...
ceb2484786bbcaaaf7741840c5d10a213d6e5cb25c675bed9da0f84205a0a927
Python
6,821
169
# 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...
1e426129627593e06b837fa8b1c12e4060d5c1c15a612757cc91a85916a88497
Python
6,825
193
#!/usr/bin/env python import pegasus as pg import demuxEM import numpy as np import scanpy as sc import argparse import pandas as pd import pegasusio as io parser = argparse.ArgumentParser(description="Parser for DemuxEM - Demultiplexing") parser.add_argument( "--rna_matrix_dir", help="cellranger output folder...
91a76e4c5b93d2d61170aa972abff55b9417589c76875991817f2a30d7c6b888
Python
6,825
196
import torch from torch import optim, autograd import darts.functional as F class Hyperparameters: alpha_lr = 3e-4 alpha_wd = 1e-3 class Architecture: def __init__(self, model, args, hyperparams=Hyperparameters(), device='cpu'): self.momentum = args.momentum # momentum for optimizer of theta...
a1ca73cd93e87c0c71e645c49a8f5b3f5ae28df8babad03acf98ed59822830ee
Python
6,831
190
import numpy as np from scipy import optimize def fit_circle(x, y): ''' Fit a circle through a set of points with least squares optimization. Parameters ---------- x : np.array X-coordinates of the points y : np.array Y-coordinates of the points Returns ------- xc...
e3f1e2904f055cfae19c01a7edf5017483fd6ef4cc83562b87a33fedfc11f852
Python
6,831
153
# Imports from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from scipy.stats import gaussian_kde import numpy as np import os import matplotlib.pyplot as plt import matplotlib.backends.backend_pdf plt.style.use('seaborn-talk') if __name__ == "__main__": # Note about ...
12e7a6da19ef1cfe15ed3da0a3bc6e4c38aee16e308c1a5a573eecae086e16f3
Python
6,833
240
# -*- coding: utf-8 -*- """ Created on Thu Dec 9 14:18:03 2021 @author: jeanbaptiste """ # Not necessary once these are added to the python path permanently: import sys # Append paths to delta-dev and deep cell control before import: sys.path.append('C:/DeepLearning/DeLTA_dev') sys.path.append('C:/Users/System 6/Doc...
b58e8e9c79256943fe73e6b612e2e992ccf1666166b60695c3afb5fa1afa5047
Python
6,833
198
# 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...
33d79e66cc4ece38559ad540447cffe609b1bd9bf3cbe78847c2c76e090d3ee7
Python
6,838
214
import weakref import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.strings.accessor import StringMethods # subset of the full set from pandas/conftest.py _any_allowed_skipna_inferred_dtype = [ ("string", ["a", np.nan, "c"]), ("bytes", [b"a", np.nan, b"c"]), ...
96a6b48fb030cbedfdd16efeace885ddac59786b142e79d6cc9f5e3d7f7ad3bf
Python
6,838
220
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.tests.copy_view.util import get_array # ----------------------------------------------------------------------------- # Copy/view behaviour for accessing underlying array of Series/DataFrame @pytest.mark.parametrize( "...
02999e0a3fb019501c83a53381d3af27382a039f6a7714a634dc992603e8d2b0
Python
6,841
252
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.16.0 # kernelspec: # display_name: ol-connectome # language: python # name: python3 # --- # %% from pathlib import Path import sys from ...
8bd30f20a2e6db71a6ae7905bad3b514a9cfe89b48e098e259d273bcde127499
Python
6,845
234
import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.initializers import Orthogonal, TruncatedNormal from tensorflow.keras.layers import ( # GlobalMaxPooling1D,; Lambda, Add, Dense, Dropout, GlobalAveragePooling1D, Layer, LayerNormalization, MultiHeadAttention, )...
87d76485576aaabdff76e3687c9474424163e6ade12a00632aa62232021d3716
Python
6,846
201
"""Drift report CRUD — distribution-shift snapshots for a Deployment. Routes under ``/api/v1/``: POST /deployments/{deployment_id}/drift-reports record a snapshot GET /deployments/{deployment_id}/drift-reports list snapshots GET /drift-reports/{id} single snapshot v1 semant...
a7bd53767c5e3b2a53b15deba9bdc4bf74a8480389fc604622b35a41918a58c0
Python
6,848
167
# coding: utf-8 from itertools import chain, starmap from collections import Counter import torch from torchtext.data import Dataset as TorchtextDataset from torchtext.data import Example from torchtext.vocab import Vocab def _join_dicts(*args): """ Args: dictionaries with disjoint keys. Return...
89bf4452fe4e7211e6dfa488dd3e00b9c8bc703585a1e1bf742bc2476184add8
Python
6,849
189
# 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...
406b9f3523739b796d8bb007765e7a55952d60b50ede4c3257883d435ec3475f
Python
6,850
198
import numpy as np import scipy as sci import scipy.fftpack as ft import scipy.signal as sig from scipy.stats import norm import matplotlib.pyplot as plt ''' Field Synthesis Python-based demonstration of Field Synthesis supplementary material to: Universal Light-Sheet Generation with Field Synthesis ...
bb0cd950f608ec886e2e8a310c071b68a9b21c56cd054a3a5ecdf391790e4896
Python
6,850
233
"""Webhook subscription CRUD. Routes (under ``/api/v1``): GET /workspaces/{ws_id}/webhooks POST /workspaces/{ws_id}/webhooks GET /webhooks/{id} PATCH /webhooks/{id} DELETE /webhooks/{id} POST /webhooks/{id}/test Admin-only writes; member can read. Supported event types (v1): - ``run.succeed...
59d6dae6f779b9adc6a9df5b2301da671d44073b9d49e629b9aa02a6eb717c6e
Python
6,854
221
import pandas as pd import numpy as np import tensorflow as tf from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, classification_report, accur...
e5dfdae5a1a41cf0bdf546e0909103662084d025692975a5b1ec1aae641fbd82
Python
6,855
149
# 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...
0c15c20a3259b37142d029ad65f22492e7b7b086f5ea6a1f66718d096e4b2373
Python
6,857
158
import argparse import os import numpy as np import pandas as pd from Bio import SeqIO def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='Filter-Checkm2-Bins.py', description="""Identify good bins from checkm2 scores.""") p...
b62313c0baa907b86d9fb81f4a5c1e342bbc601bcffda4f3917325429b8d06fb
Python
6,860
209
import msprime import numpy as np import optparse import pyslim import sys import tskit import global_vars def main(opts): reco_values = load_recos(opts.reco_path) files = open(opts.infile, 'r').readlines() n_regions = len(files) n_range = range(n_regions) # (N, 36, 198) num_haps = opts...
e63257f8a9465fdf2abde9b7f9c09bffb4604c90ce46cc3fad81bae1d2caa736
Python
6,864
152
#!/usr/bin/env python from model import UNet2d from function import predict_volumes from dataset import BlockDataset, VolumeDataset from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from torch.autograd import Variable import torch import torch.nn as nn import torch.backend...
21b53bb13b6c2ae904dd62cb9d6b58a02618362b4cb95611e5c30941e1a0a399
Python
6,873
208
"""Phase 5: GitRepository routes. Endpoints: - ``GET /workspaces/{ws}/git-repositories`` - ``POST /workspaces/{ws}/git-repositories`` - ``DELETE /workspaces/{ws}/git-repositories/{id}`` - ``POST /git-repositories/{id}/publish`` ← does the actual push The publish endpoint runs synchronously for v1 (small wor...
774b8f5bbd2a4797c1df112a72149afaa0cfde52bb63e7df5873477d6d4676e4
Python
6,873
186
import numpy as np import pygalmesh from scipy.linalg import sqrtm from scipy.spatial import Delaunay from .surfaces import Surface class Rectangle(Surface): def __init__(self, corners = None, npt = 25, spacing = None): super().__init__() if corners is None: self.corners = ([0,0,0], [1,...
c03c104f1c3b5796bd56a6da57cc1ee2c5ced0d90d0b08f843ac0bc7c3415c46
Python
6,879
189
""" Centralized logging configuration for Combinato. Called once from __init__.py after options are loaded and merged with local_options. """ import datetime import logging from logging.handlers import RotatingFileHandler import os import warnings # Subsystems that get their own dedicated log file _SUBSYSTEMS = { ...
22a54ca870b33bc7c8ea2f3c05ac3335cf7ec94915420023dc4c1281c370cf0f
Python
6,880
200
import torch import numpy import matplotlib.pyplot as plt import bionetwork import plotting import pandas import saveSimulations inputAmplitude = 3 projectionAmplitude = 1.2 #Setup optimizer batchSize = 5 MoAFactor = 0.1 spectralFactor = 1e-3 maxIter = 5000 noiseLevel = 10 L2 = 1e-6 #Load network networkList, nod...
29e5a82a62f3651a8fa971c1962adfcb37a2aa7390c3bd59b9f9d55245dd8936
Python
6,883
195
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input/output utilities """ import logging from turtle import color logger = logging.getLogger(__name__) import os import nrrd from app.utils import cast_to_type import SimpleITK as sitk import numpy as np def split_filename(filepath): """ split a filepath into t...
71ec58320d32c897e9f9b984c3ac7b3733ed303a6d99abb6588e87993720144d
Python
6,883
189
#!/usr/bin/env python __author__ = 'etseng@pacb.com' """ Filter away 5' degraded products (isoforms that are shorter isoforms of longer ones) 3' differences are always honored. If input is: Isoform A: exon 1, 2, 3, 4 Isoform B: exon 3, 4 Isoform C: exon 3, 4, 5 Then Isoform A and C are preserved. Isoform B (degrad...
30580f66921262e74b9551c11a189cb57aa9ef1f5b6323d03ff9cd42596ef659
Python
6,889
152
import numpy as np import pandas as pd import time as clocktime import pickle ################################################################ ################################################################ ## Load spike times for every cell, for every fstimulation ncells = 16 spikes_set = [] for c in range(ncells): ...
daa62357d4776c08ee4673f43683ab5fa45ad2037ab7418d81a36c52a5343532
Python
6,889
191
############################################################################## ## ## ## This file is part of ModelBlocks. Copyright 2009, ModelBlocks developers. ## ## ## #...