sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
144ce94455f2cfafb26b593f352593d5322689e76c567bcdf3c3032a2f11f1ee
Python
7,928
266
# 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...
9ff225d4b49267cc94623e2afd93385d623b9a0de132a08914c96a7fbcc73136
Python
7,935
185
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of sourc...
6b81df1b209df830dd99a5170de9cd6cda3ff7b4e685ad02eeb62d598ffd568e
Python
7,938
238
""" Created on Jan 3, 2023. utils.py @author: Soroosh Tayebi Arasteh <soroosh.arasteh@rwth-aachen.de> https://github.com/tayebiarasteh/ """ import numpy as np import pdb import pandas as pd from tqdm import tqdm import os import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') warnings.simp...
f390ed3c8ec8ebb1b159969b446d10573d3fbe4de5dd07b401a24722067c1859
Python
7,938
201
import torch import numpy import bionetwork import plotting import pandas import saveSimulations import matplotlib.pyplot as plt import copy #Load network networkList, nodeNames, modeOfAction = bionetwork.loadNetwork('data/KEGGnet-Model.tsv') annotation = pandas.read_csv('data/KEGGnet-Annotation.tsv', sep='\t') unipro...
87346119def4a39849fbc3599cc339be35a51c79725c9efdf2657a486f2f7eb9
Python
7,943
201
# # Equivariant Batch Normalization Layer # from keras import backend as K from keras.engine import InputSpec from keras.layers import BatchNormalization import tensorflow as tf class LBatchNorm(BatchNormalization): def __init__(self, axis: int=-2,momentum: float=0.99, epsilon: float=1e-3, center: bool=False, ...
ebd12553aaffb092e4d35ae1d2ec0852fe8a7f14d3f69ff0f4f336f500a75deb
Python
7,944
210
from PIL import Image import cv2 import glob import pandas as pd import os import numpy as np import collections import pickle import os import openslide import numpy as np from tqdm import tqdm from math import ceil import shutil import argparse def tile_saving(path, window_size, save_folder_png, ): source_slid...
3caada41c12ebe7b053d5d5def111a74e0851c0630a7a7a5a6859f0166344433
Python
7,946
244
# -*- coding: utf-8 -*- # # microplastic-detection documentation build configuration file, created by # sphinx-quickstart. # # 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. # # All configuratio...
9e731414e1ec2d661d7092e01a88558ca8661e47e81640e492399d78571dd256
Python
7,951
261
# 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...
b4722d10c8e923e4b9a94c27540f9ad91ca2d02e20dc9eb9dd42c5e68cc905d7
Python
7,952
191
# -*- coding: utf-8 -*- """ Created on Sun Dec 20 17:02:31 2020 @author: Wladek """ import numpy as np import matplotlib.pyplot as py import matplotlib as mpl from matplotlib.colors import LogNorm from figure_properties import * import matplotlib.patches as mpatches from scipy.signal import welch, argrelmin, butter,...
d209fbd8ae07e37508a2d75e333f82f57cbfc2f5497c87478659b3fcab88d588
Python
7,952
242
# 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...
2c053aa2d2611e8bb5ba097c879001fbdc36aaf43ea078a1fa20b29e25cddfaf
Python
7,956
202
# 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...
0b4ae46af1f21b63d966b80451eadae06f9c9638876090237eb3239a2b81144f
Python
7,958
333
# 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...
3e084e07daeae36ca242734dbef5bcf99bc9c4a9e9f86e7f522161d680beda7c
Python
7,958
250
""" @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 matplotlib.cm as cm import datetime import time from kcsd import KCSD2D, ValidateKCSD...
828c7f4943d938314384f28b3a7c213cf355cb595d387f1d28717210b591e17d
Python
7,965
260
# -*- 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...
990eda72dd7ffe66cdfefa684df35d895687c7d72b180ae480ad12e786bef719
Python
7,967
237
""" Tests parsers ability to read and parse non-local files and hence require a network connection to be read. """ from io import BytesIO import logging import re import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.io.feather_format import read_feather from pandas.io.parser...
4e19612dbc8651dabe7bdcb4dd569b4873d425d8cc3373c09faae86f59354146
Python
7,970
208
"""Estimate the empircal error rate. """ from collections import defaultdict import csv import re from atropos import AtroposError from atropos.commands.base import ( BaseCommandRunner, Pipeline, SingleEndPipelineMixin, PairedEndPipelineMixin) from atropos.io import open_output from atropos.util import qual2prob, r...
9eddcc24ef454f1bef3c700c06ed50e5e2900803338d8ae5cf96512d9ce85df2
Python
7,974
216
# 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...
1a49fb8ed68ec579f1c4524887d44897faf6ab9de41224e94863c81b483473a0
Python
7,975
208
"""Session 32 — drain add_metric / remove_metric onto a per-Experiment registry. After session 31, the only secondary verbs still on `self._legacy` were ``add_metric`` / ``remove_metric`` / ``get_config`` / ``set_config`` / ``plot_model`` / ``evaluate_model``. Session 32 drains the first two by promoting the metric re...
a9131a9ffccbcc59e3c2c58311da5b41990db0aad709ddfecbbc5627d069723c
Python
7,975
226
# # Python module protein.py for holographic machine learning # # This module contains all structures relating to protein conventions including... # - dictionaries for translating amino acids to indices and vice-versa # - dictionaries for translating elements to indices and vice-versa # - dictionaries for amino acid...
296d144b02b21db2b96895f877a3ca0b879d6a3ddc46f39d57b5011a16dc538b
Python
7,978
151
"""Transient steady state signal models.""" from collections.abc import Sequence import torch from mrpro.operators.SignalModel import SignalModel from mrpro.utils.reshape import unsqueeze_right class TransientSteadyStateWithPreparation(SignalModel[torch.Tensor, torch.Tensor, torch.Tensor]): r"""Signal model fo...
338deaed9acdf59d79bb7af1fd1b1004afcd70deadf7401478c3587cb067537e
Python
7,980
173
#!/usr/bin/env python __author__ = 'etseng@pacb.com' """ Similar to chain_samples.py, but specifically for chaining fusions. Difference with regular chaining: 1. A fusion consists of several transcript records, denoted by PB.X.1, PB.X.2, ... where PB.X is one fusion (must always consider possibility of a fusion c...
4b455dcddeee85a7b55ad8419b85916bdfe3d8335ea8f023d494a93da74f8e57
Python
7,981
231
__all__ = ["InputGlycanEncoding", "GlycoPeptideTreeLSTM"] from typing import Optional import dgl import torch from torch import nn from ....util.collections.dict import chain_get_typed, chain_item_typed from ...pep.common.model import InputPeptideCharge, InputPeptideEncoding from ...util.treelstm import TreeLSTM from...
2371cf1c5156a0ccb15206aee2074702740f99e6fcdf79c95aa7cdce8fca52d9
Python
7,987
159
"""Runtime regressions using small local models and unchanged clock formulas.""" import math import pytest import torch from scipy.stats import rankdata from pyaging.models import Pasta, PastaMouse, PCGrimAge, PhenoAge, Reg, epiTOC1, stemTOC from pyaging.models._base_models import pyagingModel from pyaging.predict._...
0ef9b836a6a0afc353c8470f3613d38038076b4370820e99dcb2d97129c152c8
Python
7,991
221
#!/usr/bin/env python # coding: utf-8 """ for subset in `seq 0 9` do python -W ignore infinite_generator_3D.py \ --fold $subset \ --scale 32 \ --data /mnt/dataset/shared/zongwei/LUNA16 \ --save generated_cubes done """ # In[1]: import warnings warnings.filterwarnings('ignore') import os import keras print("Keras = ...
8b3ae9288577feecbe80208bcb435c9bfa3e69c96bbbb65900fd2aca9051134a
Python
7,992
193
"""Convert a SLEAP ``.pkg.slp`` package into a Lightning Pose project directory. Only single-view, single-animal SLEAP projects are supported. """ from __future__ import annotations import io import json import logging from pathlib import Path from typing import cast import h5py import numpy as np import pandas as ...
3e2e5544cadf9217da58bcb803595037e5faad068580d24e7375aae43bf06177
Python
7,993
231
# Copyright 2018-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...
a2bbb7623b4265fa6d807e4f84ac248aa2fba9c9b95edf32ccfb5f7102ad3c2c
Python
7,993
238
__all__ = ["GlycoPeptideMS2TreeLSTM"] from typing import Optional import dgl import torch from torch import nn from dgl.nn.pytorch.glob import GlobalAttentionPooling from dgl.ops import copy_u_sum # type: ignore from ....util.collections.dict import chain_get_typed, chain_item_typed from ...util.attention import Att...
dfe8a8791938cfd4de9c995fcc273f5f5712bb6bef24f00d932eb453c469eac1
Python
7,993
190
# 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...
58da7c319e1bfbd86588340fe5c16024585f82e9923c0c19a2e1b10de72b1ded
Python
7,998
269
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl # 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 linewidt...
a800828da9cc2b58c99cb13e74d186e4b71bb281836c4bdefa4305c82638cc7c
Python
7,998
244
import torch import math import torch.nn as nn from torch.utils.data import Dataset from torch.distributions import normal from scipy.stats import beta import numpy as np class SamplesDataset(Dataset): def __init__(self, x): self.x = x def __len__(self): return len(self.x) def __g...
f6cc4772c5df5bedfcaad1b14d7b1e4cfe1e1f1f6690d23e78267bdd4138e426
Python
7,998
249
#! /usr/bin/env python # -*- coding: utf-8 # # Copyright (c) 2023 Kenneth Atz, Clemens Isert & Gisbert Schneider (ETH Zurich) from rdkit import Chem, RDLogger from rdkit.rdBase import DisableLog for level in RDLogger._levels: DisableLog(level) import argparse import configparser import os import random import h5...
b718bc0334527dada6253cc974a920d8e5c87defe19f1c26fcad8477096a9f11
Python
7,999
231
#!/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...
c6e7a2035e39f45350f5ee2dffb10386e99f89d7c467c86f498cb1027aa3eb7e
Python
7,999
212
from itertools import permutations import numpy as np import pytest from pandas._libs.interval import IntervalTree import pandas._testing as tm @pytest.fixture(params=[1, 2, 10]) def leaf_size(request): """ Fixture to specify IntervalTree leaf_size parameter; to be used with the tree fixture. """ ...
7cadb926b35053c3b7982c95d5ab71b2e1039878e352442f3c0550f5d05857f7
Python
8,003
244
# 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...
d89bf9aed2a10185ed395cadefd2f8594f97d7d82a06b420b5101d2b0650835a
Python
8,003
219
# Module: containers.models.base_model # Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com> # License: MIT from __future__ import annotations from typing import Any, Dict, List, Optional from pycaret.containers.base_container import BaseContainer from pycaret.internal.distributions import CategoricalDistributi...
17b5f336bf14f0f345e92c1236a076f49af2979c55f22a34e1d29dad3fa8d969
Python
8,004
203
#!/usr/bin/env python # coding: utf-8 import sys import numpy as np import pandas as pd import pickle from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.feature_selection import SelectKBest, f_classif from sklearn.linear_model import LogisticRegression from skl...
51f3c88576734d4d3f7324dd15d1325cfabfaf27ebdeaa9cd7303aaddc8f25c9
Python
8,004
245
"""Workspace member CRUD — multi-user collaboration. Routes under ``/api/v1/workspaces/{workspace_id}/members``: GET /members list members with role POST /members invite an existing user (by email) with a role PATCH /members/{user_id} change a member's role DELETE /members/{use...
a8ef5a38e551a9273b6aed1bbabb58f09063771743dd24ae87650346c8758b87
Python
8,004
182
import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import griddata from matplotlib import gridspec import matplotlib.cm as cm import config def show_csd(csd_at, csd, show_ele=None, show_kcsd=False, show_mask=None): if config.dim == 1: fig = plt.figure(figsize=(6, 6)) ax = p...
4fb657130d16ec5a1d67f5388862dcdfa38a5cff8191e8d2140f0d5e0dc80f5b
Python
8,007
346
from __future__ import annotations __docformat__ = "restructuredtext" # Let users know if they're missing any of our hard dependencies # except tzdata (see https://github.com/pandas-dev/pandas/issues/63264) _hard_dependencies = ("numpy", "dateutil") for _dependency in _hard_dependencies: try: __import__(...
3f4d1e1ac11dfa9b5418b2a52e8387aad07fc500bac40ccb493d2956d20812f2
Python
8,010
229
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"...
7c1c7f38ef7d5747ce44bb5cea5ce92206c4acf7de73c1dfd8d1053bd998f312
Python
8,010
223
#!/usr/bin/env python from __future__ import print_function try: import numpy as np except ImportError: print("'numpy' is not installed. Use the command below to install it:") print(" sudo apt-get install python-numpy") try: from osgeo import gdal except ImportError: print("'pygdal' is not ins...
2b4db0bf9202d861590499426e257ed94ff11186c83c3cfc0ea4ba2a5fb904c7
Python
8,011
270
""" predict and write pseudoenergies for a set of proteins """ from argparse import ArgumentParser from functools import partial import logging import os from typing import List import h5py import numpy as np import pandas as pd from protein_holography.coordinates.get_neighborhoods import ( get_padded_neighborhoo...
7a63c6e95bb6babfb9f98ccd0b4f5574cdbe3058ecbed3ccdd1c181ec30c8b03
Python
8,011
233
#!/usr/bin/env python import os, sys import argparse from argparse import RawTextHelpFormatter ################################################### ### 0. script description and parsing arguments ### ################################################### synopsis1 = "\ convert a BLAST tabular output into a table of one...
3f2e5bf8da63319033a0a99537363a2c85bb1aae1f6ffc945bdf1d02164c159d
Python
8,015
210
''' cell parser and synapse mapper for single cell simulations with NeuroNet subcellular synapse distributions ''' import tables #so florida servers have no problem with neuron from .writer import write_cell_simulation from .writer import write_landmark_file from .writer import write_cell_synapse_locations from .writ...
0b5eab2c9fd161d2bde555ea77aabfe66dffd38e199c87d59659dc1cb8597081
Python
8,016
172
#!/usr/bin/env python # Filename: main.py # Author: Alessandro Gerada # Date: 2023-01-27 # Copyright: Alessandro Gerada 2023 # Email: alessandro.gerada@liverpool.ac.uk """Script to predict MICs from agar dilution images. Use main.py -h for help.""" import pathlib from aigarmic.process_plate_image import split_by...
9dfb65a494c39e8a6fb19e3070269f8daf3aabbc802056bb258e5c011d8a9712
Python
8,021
267
""" Templates for invalid operations. """ from __future__ import annotations import datetime import operator from typing import ( TYPE_CHECKING, Any, NoReturn, ) import numpy as np from pandas._libs import lib from pandas._libs.missing import NAType from pandas._libs.tslibs import ( BaseOffset, ...
a914cffbe646a081820f8d5465908a484a7e5b9e963847a8cbafd532586c36bc
Python
8,022
272
# -*- 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...
2b02b6182ba2e0bb9382b83fd0a23df3b456f5dd7e3184b1379e8472a3855c1c
Python
8,026
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...
8dd048e9cd1b561b9cd97d18fc7610015f8f2edd56dd0af3819201cfd4f29257
Python
8,026
189
import math import torch import torch.nn as nn import numpy as np from .syncbn import SyncBatchNorm from torch.nn.functional import upsample from torch.nn import Module, Sequential, Conv2d, ReLU,AdaptiveMaxPool2d, AdaptiveAvgPool2d, \ NLLLoss, BCELoss, CrossEntropyLoss, AvgPool2d, MaxPool2d, Parameter, Linea...
4777e7ca51861b81fd170238a2393fb8d7f62199540fa9fe686603ed62301eb5
Python
8,027
225
import statsmodels.api as sm lowess = sm.nonparametric.lowess import warnings import pylab as plt import pandas as pd def saveFIG(filename='tmp.pdf', axis=False, transparent=True): """save fig for publication Args: filename (str, optional): filename to save figure. (Default value...
db3e40d2eafc8a60e225d38e2b00df2418d32fee2adacee730af94cd937573c7
Python
8,031
172
#!/usr/bin/env python3 """Build the tAge gene/ortholog mapping asset from the reference package's tables. Run once; the output ships to Hugging Face alongside the tAge weights: uv run python clocks/build_tage_gene_mapping.py "$SCRATCH/tAge" clocks/weights/tage_gene_mapping.csv.gz Output contract: a four-column f...
5d5260a76426d0b457ee4e96be7a4a7a7d48f2b25d1272673b10341faec70a12
Python
8,035
257
# -*- coding: utf-8 -*- """ Created on Sun May 1 17:33:44 2022 @author: jeanbaptiste """ import os import json 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 L...
9c1ef96fbe4bbeb1eae982ebe2148e32dcd705c510237272513f4d2b0876deb8
Python
8,035
251
# 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...
c0e93711d296be1665c02c15c27655308f4966baf11fa9f90c407c16b17fdc82
Python
8,044
244
""" viterbi.py Created June 1, 2021 ... """ from collections import defaultdict from functools import partial from dataclasses import dataclass from ecgdigitize import signal from math import isnan, sqrt, asin, pi from typing import Dict, Iterable, Iterator, List, Optional, Tuple, Union import numpy as np import mat...
a339b9871ff8db9aee55f2f7677ba0dd6151ffd6841b8fb02f4313fa38199870
Python
8,046
210
''' This program will check neuronMetadata for a NeuronBridge release for sample issues, optionally retagging documents. Documents will be tagged with the word "unreleased" as well as the ALPS release. ''' __version__ = '0.0.3' import argparse from operator import attrgetter import sys from time import strftim...
6159993b0beb6eb213b1f5c8fb880f0595d2537b04d7c84ddbc1cc0a0abe3635
Python
8,049
216
# -*- coding: utf-8 -*- """ Created on Mon Mar 13 19:12:54 2023 Figure 2. striatal neurons are phase locked to gait cycle @author: lonya """ #%% Load Data from tkinter import messagebox import tkinter as tk import tkinter.filedialog as fd import os import numpy as np import matplotlib.pyplot as plt fro...
cffc5b7ef8c96d68c3d05aa215258ee374e75b4eb91b49247bd3b3ff08479924
Python
8,056
179
""" Tests for CategoricalIndex.__repr__ and related methods. """ import pandas._config.config as cf import pandas as pd class TestCategoricalIndexReprStringCategories: def test_string_categorical_index_repr(self): # short idx = pd.CategoricalIndex(["a", "bb", "ccc"]) expected = ( ...
9f2442fa759e0b765a36fd7f00067319221d2084c29c330683c08e7a8a36e464
Python
8,057
238
from copy import deepcopy import tensorflow as tf from tensorflow.keras import Model from .actor import Actor from .critic import MultiCritic class ActorCritic(Model): """ Actor-Critic =========== Attributes: actor_units (list): list of the numbers of units in each Actor's layer cri...
858adc3ff8d4eb7dbcd388b82b1f12bd2f0f4b558cb4e1d8b9c4246404ddfdec
Python
8,059
179
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 27 14:12:48 2022 @author: wirrbel """ import pandas as pd import numpy as np import os region_overview_file = '/home/wirrbel/2023-08-07_delivr_run_results/2023-08-15_delivr_run_results/re-calculated tables/region_overview.xlsx' #alternatively, coll...
9c3ee5b8a2d4624e681577330c9720612e0897d245c1a187e6683d408da48854
Python
8,060
220
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
6a347dce5997b262647b421d93fc2820ee1067be31014c6dba3002898915159c
Python
8,061
136
import argparse import os from util import util import torch import models import data class BaseOptions(): """This class defines options used during both training and test time. It also implements several helper functions such as parsing, printing, and saving the options. It also gathers additional opti...
6c7022f03273b31103531a9f330303b95c360c89db42eb040c41949c86e09fe5
Python
8,062
173
"""Public API and CLI regressions for long fragments (#807).""" import math from types import SimpleNamespace import pytest from MACS3.Signal.FixWidthTrack import FWTrack from MACS3.Signal.PairedEndTrack import PETrackI from MACS3.Signal.PeakDetect import PeakDetect def inputs(tmp_path, fmt, length): paths = [...
21556e9be45f630c3b1411c1752c1144ba0a1d9818ff1054d8243e75001d11aa
Python
8,063
227
# 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...
f8a8b072694e59c2188b6dfa9fd386186ab6982c4c443758fffc9c3cc2ebc91e
Python
8,063
201
""" Note: for naming purposes, most tests are title with as e.g. "test_nlargest_foo" but are implicitly also testing nsmallest_foo. """ import numpy as np import pytest import pandas as pd import pandas._testing as tm def assert_check_nselect_boundary(vals, dtype, method): # helper function for 'test_boundary_{...
aa2a5a85348be4336535a51bca4ce4f3ba7811cf6bfaade712dd8f5e86231304
Python
8,064
192
from utils import print_from_history import os import pandas as pd import datetime from evaluators.evaluator_globals import ARGS_COL_MAP, COLS_IN_ORDER class Evaluator(object): METRICS = ['acc', 'bal_acc', 'auc', 'prec', 'rec', 'f1', 'loss'] # Performance metrics to evaluate def __init__(self, ...
46c8a14079428271d1afd1ce0c5554195c1a72a623b2170b1c116889007ac647
Python
8,067
344
from datetime import ( date, time, timedelta, ) import pickle import numpy as np import pytest from pandas._libs.missing import NA from pandas.core.dtypes.common import is_scalar import pandas as pd import pandas._testing as tm from pandas.core import roperator def test_singleton(): assert NA is N...
b0e7a802c7d3c05cc6d10b5d98f0b84b5d3b813ab6141c47f32b7b660176310c
Python
8,068
249
# -*- coding: utf-8 -*- # # vegas documentation build configuration file, created by # sphinx-quickstart on Sat Dec 7 11:14:42 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
8a285ce278e9e6a9f0e6a85cd8381eab0fbe397b8798559569540ed3a1f741b1
Python
8,074
221
"""Session 41 — phase 5c: drain ``TimeSeriesExperiment.predict_model``. Phase 5b (s40) drained ``create_model``. This session drains the second TS verb. ``exp.predict_model(forecaster)`` no longer touches ``self._legacy.predict_model`` — predictions go directly through ``get_predictions_with_intervals`` and metrics ar...
3ef9e26ecac648917e425d83180fff78a4a83f964e5a65aa305b06ff5aa47b4d
Python
8,076
300
import warnings import numpy as np from pandas import ( NA, Categorical, DataFrame, Index, Series, StringDtype, ) from pandas.arrays import StringArray class Dtypes: params = ["str", "string[python]", "string[pyarrow]"] param_names = ["dtype"] def setup(self, dtype): try...
00104e7a8affb163fd416e7e8f084c3e7ad34da8982ef5d90539ee09d0549881
Python
8,077
188
import math import torch import numpy as np def make_beta_schedule(schedule="linear", num_timesteps=1000, start=1e-5, end=1e-2): if schedule == "linear": betas = torch.linspace(start, end, num_timesteps) elif schedule == "const": betas = end * torch.ones(num_timesteps) elif schedule == "qua...
cfe77a0767e1308946e455e30ff1dbec2f4d7c1df4b3160d941a705ab564c975
Python
8,079
180
"""solver_mod.py""" import warnings warnings.filterwarnings("ignore") import os import numpy as np import random from tqdm import tqdm import matplotlib.pyplot as plt #from IPython.display import Image import sys from scipy.io import savemat import pickle from generate_mod import sample_clutter import io_mod, genera...
59e4a4de7f13862b90e6f427f1688bbeb246884e18f03e511d479fee77dddfb6
Python
8,086
231
"""Transforms relate to hamming distance sampling.""" import random import numpy as np from onmt.constants import DefaultTokens from onmt.transforms import register_transform from .transform import Transform, ObservableStats class HammingDistanceSampling(object): """Functions related to (negative) Hamming Distanc...
1db3d429310d77df4f69df79261566cbe97b0cf8c962325acd0cde421b3e2934
Python
8,089
176
"""Checks on the frozen LinAge2 constants the parity tests are anchored to. ``clocks/notebooks/linage2.ipynb`` re-derives these constants from the published archive every time it runs, so this snapshot is not a build input. It is the independent reference: these tests confirm the snapshot alone reproduces the paper's ...
d377233343b72f5cb3993b4a3e8d521bd2931f6c2cc3850769a34f2762c1aa6c
Python
8,089
181
import pandas as pd import numpy def contains(haystack, needles): result = numpy.full(len(haystack), False, dtype=bool) for curNeedle in needles: result = numpy.logical_or(result, [curNeedle in x for x in haystack]) return result def mergeContent(df): A = df.iloc[0,:] B = df.iloc[1,:] r...
a3911b9233f99d129a18ddaa2d66c7b8cd18a734e105d66279cdbe808b95202a
Python
8,092
222
# %% [markdown] # # QMRI Challenge ISMRM 2024 - $T_1$ mapping # In the 2024 ISMRM QMRI Challenge, the goal is to estimate $T_1$ maps from a set of inversion recovery images. # The dataset consists of images obtained at 10 different inversion times using a turbo spin echo sequence. Each # inversion time is saved in a se...
e2ce2fbe0b05919d072f4d2a51e3184b184810b30b304a49b9fd457c27840b10
Python
8,095
239
import numpy as np import pytest import pandas as pd import pandas._testing as tm def create_mock_weights(obj, com, adjust, ignore_na): if isinstance(obj, pd.DataFrame): if not len(obj.columns): return pd.DataFrame(index=obj.index, columns=obj.columns) w = pd.concat( [ ...
7c056b7f58565efa03b9df2971a3655c738ea4b8d3c8f7dc1ba06b33655dbe23
Python
8,100
234
# -*- coding: utf-8 -*- # @File name: plot_day_shutter.py # @Author: Alicia Garrido-Peña # @Date: 2023-08-09 18:26:14 # @Contact: alicia.garrido@uam.es # "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved." # Use of this source code is govern by GPL-3.0 license that # can be found in the LICENSE file # C...
0a57ad32c4946f03ec358fe596ff12d9789a190d7a461c867503c57cf67c6b74
Python
8,105
164
''' Created on Jul 27, 2022 @author: voodoocode ''' import numpy as np import finnpy.file_io.csv_data import finnpy.file_io.nifti_data import finnpy.visualization.volumetric_plots import mayavi.mlab #=============================================================================== # # Default # # CSV_FILE = "/mnt/da...
cec0145be29d7351b4ae3ac5995f6c0277745aee3f3c67d765dbe25a8f8de2d9
Python
8,107
210
# 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...
fc6c32792d48d9075d567ed5677d7cf02f0e908be27c463ba47f5e0985338a1b
Python
8,112
242
# 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...
3d83a136023a459ef473f56fcdd9adb4686005a7b8a435793838ad37de07423c
Python
8,113
189
# Filename: model.py # Author: Alessandro Gerada # Date: 2023-03-15 # Copyright: Alessandro Gerada 2023 # Email: alessandro.gerada@liverpool.ac.uk """Implementation of Model classes""" from aigarmic._img_utils import convert_cv2_to_keras import tensorflow as tf import numpy as np from typing import Optional from...
9c7b431526797b0f2503b4030508ff890d030aaf47422a1bf6e82df5d73f525c
Python
8,117
245
from functools import partial from typing import List import h5py import numpy as np from sklearn.neighbors import KDTree from protein_holography.utils import geo # given a set of neighbor coords, slice all info in the npProtein along neighbor inds def get_neighborhoods(neighbor_inds: np.ndarray, structural_info: np...
3e19d8ab94523f70eaf3892654f53a8f239db678f5de143f8414b8364097fd68
Python
8,118
242
# Copyright 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 agre...
1ea4ca786a3756d4fb4824930c64cf0dfa58ac6fa47687cc195dbbf945f8b72c
Python
8,120
195
import random import math import numpy as np import argparse import torch import torch.optim as optim import torchvision from torch import nn from torchvision import transforms from dataloader.loading import * import torch.nn.functional as F import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics impor...
f5bd8b6a0cdf9f9b68d85639b66ead94704849b39d5d76c143c2baed699247d5
Python
8,128
136
import os import numpy as np import pandas as pd import statistics path_to_brainchart = '/media/sda/Anna/brain_age/DiffMIC/dataset/csv_data/allnew_AIM_.csv' path_to_test_1 = '/media/sda/Anna/brain_age/DiffMIC/notebooks/5models_combined_results.csv' path_to_test_2 = '/media/sda/Anna/brain_age/DiffMIC/notebooks/brain_a...
090e868ed289c7995c5c2bc5b8315274fd1f8c65b777a948254741936d051c03
Python
8,131
236
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
74bd29e01f5d6f2998bac867bfc495d9969cc089961045be156ac3b74607878e
Python
8,131
240
# 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...
e5b18e5f18327232bb629abb15e3238daff02c35f44f9d8c62fa6d18ec304b4d
Python
8,131
227
import re import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestIntervalIndex: @pytest.fixture def series_with_interval_index(self): """ Fixture providing a Series with an IntervalIndex. """ return pd.Series(np.arange(5), pd.IntervalIndex...
457122b90005b7ed3d97f380a49377be65f6df274baec58c30d28494295b8689
Python
8,133
209
#!/usr/bin/env python # coding: utf-8 import sys import numpy as np import pandas as pd import pickle from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.feature_selection import SelectKBest, f_classif from sklearn.linear_model import LogisticRegression from skl...
2544c4959cea6f686f7d7da15e5b517d32fd9227abf4beb04264cc459b86bac1
Python
8,135
209
#!/usr/bin/env python # coding: utf-8 import sys import numpy as np import pandas as pd import pickle from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.feature_selection import SelectKBest, f_classif from sklearn.linear_model import LogisticRegression from skl...
3f442ee8dc2e91178b3110ea5abcc940a11e15aac27a2afa5976c5c352b2847a
Python
8,135
327
from functools import wraps import threading import numpy as np from pandas import ( DataFrame, Index, Series, date_range, factorize, read_csv, ) from pandas.core.algorithms import take_nd try: from pandas import ( rolling_kurt, rolling_max, rolling_mean, r...
53a092a5da839716c7e40c6add1d7874745286c6929b1c72aea044c305062cca
Python
8,135
197
#funcsrg.py import numpy as np import copy from placerg.funcs import * def RGrealstep(pmat, cluster, corr): """ Perform real space RG step Here we first calculate the correlation matrix, c_(ij)= (C_(ij))/ (sqrt(C_(ii)*C_(jj))) Where C is the covariance matrix A complication here is that if a c...
ae3e3bd37c7e42d3474bfaee0f15deebed9c13adc2952349c001caf85139ea5f
Python
8,136
270
# I/O lib for molecular sequences from os.path import isfile from os import remove from random import random from copy import copy from treeshrink import get_tmp_file try: import cPickle as pickle except: import pickle def get_taxon_list(filename): taxon_list = [] for line in open(filename,'r'): ...
d63272c71b3a7f52d2df938629c7ac53b9add44cb8b0d84c65bd2ffa6a65060c
Python
8,139
216
"""Tests for utility functions.""" import os import shutil import pytest from pcntoolkit.normative import NormativeModel from pcntoolkit.util.runner import Runner from test.fixtures.blr_model_fixtures import * from test.fixtures.norm_data_fixtures import * from test.fixtures.test_model_fixtures import * class Test...
fa30834b93714fff0861c5eedd4f2565a8ced864bd9fbe92e71b34477d6e4f71
Python
8,139
229
"""High-level Git publish service. Takes a GitRepository row + a project's data and writes the on-disk layout described in :mod:`exporter`, then commits and pushes via the ``git`` binary over HTTPS (with the PAT injected into the URL). We shell out instead of using GitPython / pygit2 because: 1. The set of operation...
8841bfc7b00a8a942a4c138e19458fb62beb6070cdbd899264ba454b26a18fc8
Python
8,140
229
# MOFTransformer version 2.0.0 # flake8: noqa import numpy as np # Jmol colors. See: http://jmol.sourceforge.net/jscolors/#color_U jmol_colors = np.array( [ (1.000, 0.000, 0.000), # None (1.000, 1.000, 1.000), # H (0.851, 1.000, 1.000), # He (0.800, 0.502, 1.000), # Li ...
cb5f36d8fd3b610d2dfc5fdccdf5cda05dae1d344416e8a2b5549dc2e9d48bdd
Python
8,141
216
import argparse from datetime import datetime import matplotlib.pyplot as plt import numpy as np import os from scipy.interpolate import RegularGridInterpolator import windseer.utils as utils import windseer.plotting as plotting if __name__ == "__main__": parser = argparse.ArgumentParser( description= ...
356d78458d241025d952d2cc489d4f4c47f75085ccd205fac9f09a1f7da1770e
Python
8,147
230
""" Multi-Head Attention module """ import math import torch import torch.nn as nn from onmt.utils.misc import generate_relative_positions_matrix,\ relative_matmul # from onmt.utils.misc import aeq class MultiHeadedAttention(nn.Module): """Multi-Head Attention module from "Attention i...
258e0ebc06d3337e222564dadfcd5c04db7c8676d9745c5fb818f78c82315376
Python
8,152
233
"""Class for coil sensitivity maps (csm).""" from __future__ import annotations from typing import TYPE_CHECKING import torch from typing_extensions import Self from mrpro.data.IData import IData from mrpro.data.SpatialDimension import SpatialDimension from mrpro.utils.interpolate import apply_lowres if TYPE_CHECK...
4ece8b7e52c9b30fb3dc946cabc9411839d33b3a23db1b69b47e7dae481fb57f
Python
8,153
277
import os import numpy as np import pandas as pd from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.pep.aminoacids import AminoAcidCollection from deepglyco.chem.pep.mods import ModificationCollection, ModifiedSequenceParser from deepglyco.deeplib.pep.rt.data import PeptideRTOutputConver...