sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
55c252d060a84080d85cb0bc1218040dce4cb8b84d55b5fc7d67da3c5618119f | Python | 6,506 | 105 | """Reusable, count-conserving population overlays for multiple years and areas.
Sparse matrices store geometric fractions, not reprojected population densities.
All six years share a source grid. Each matrix is built once on their union of
positive cells and then applied to actual year-specific counts.
"""
from pathli... |
d4918b223cc3ae5e2ff0802103b0304b85372127b6be245e227987d84b11830f | Python | 6,507 | 147 | import argparse
import numpy as np
import os
import torch
from sklearn import metrics
from utils.load_fastmri_data_convnext_diff import load_data as load_data_diff
from utils.load_fastmri_data_convnext_t2 import load_data as load_data_t2
from model.model import ConvNext_model
import yaml
import matplotlib.pyplot as pl... |
1e2abf30b6df65b0d37db0481d67954de37db2e141b793f4b9846e3673d40f79 | Python | 6,508 | 128 | ###############################################################
###
################################################################
import numpy as np
pi = np.pi
import pickle
################################################################
################################################################
frequencies =... |
97414b3b7533e1f84ba8710bf730021ad838721726878b70aefc0d293252c4a2 | Python | 6,512 | 146 | """Regressions for #798 (part of #757): singleton FRAG chromosomes.
Keep native pileup probes in bounded subprocesses using the parent's
installation. The tiny inputs exercise both callpeak's chromosome pileup
and hmmratac's bedGraph pileup without needing HMM training regions.
"""
from pathlib import Path
import sub... |
2f029213e3ac49a668d48160b82a3abd506af5e8f6ae6adf0991df354a13aef8 | Python | 6,514 | 177 | from pathlib import Path
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import seaborn as sns
from fmriprep_denoise.visualization import utils
from fmriprep_denoise.visualization import (
connectivity_similarity,
degrees_of_freedom_loss,
mean_framewise_displacement,
motion_metr... |
7333c404ce231813d6c89eb8c6c0507721645d0627484c11eb0b62d50674eb4f | Python | 6,514 | 227 | from importlib import import_module
import numpy as np
import pandas as pd
for imp in ["pandas.util", "pandas.tools.hashing"]:
try:
hashing = import_module(imp)
break
except (ImportError, TypeError, ValueError):
pass
def _make_factorize_data(dtype, N):
if dtype in ("int64", "Int... |
2480b95219315bdef53228e1b125392931af123e32f925645ee6a8e840daa3c9 | Python | 6,519 | 162 | # 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... |
854168f423846f048840a8a735bc92a199c8a294c7f38b36cb3c26934e136981 | Python | 6,519 | 193 | # 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... |
15da1355ddb38ac0470420c289ef26d8289cee002dca3dd92d621ca2bbb2d452 | Python | 6,520 | 201 | # 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... |
8f90f0399ed0413c74eb71df4ad64c2ac45b2ede9db8ac6da1e46b0c1dc57eb0 | Python | 6,520 | 205 | import sys
import numpy as np
import pytest
from pandas.compat import PYPY
from pandas.core.dtypes.common import (
is_object_dtype,
)
import pandas as pd
import pandas._testing as tm
def test_isnull_notnull_docstrings():
# GH#41855 make sure its clear these are aliases
doc = pd.DataFrame.notnull.__doc... |
915fd544a43b0d29f5defc9e08fa42f7b031139e4cd8880624338710dd72ddff | Python | 6,520 | 122 | import numpy as np
from keras import backend as K
from keras.engine import Input, Model
from keras.layers import Conv3D, MaxPooling3D, UpSampling3D, Activation, BatchNormalization, PReLU, Deconvolution3D
K.set_image_data_format("channels_first")
try:
from keras.engine import merge
except ImportError:
from kera... |
bc115f238b58db29f384e54c424445879ed84f4f6d48a4960962125afd6b6600 | Python | 6,522 | 199 | import os
import unittest
from unittest import TestCase
from evcouplings.utils import SubmitterFactory, Command, ResourceError, tempfile
from evcouplings.utils.app import *
class TestUtilsAppp(TestCase):
def setUp(self):
self.config_file = b"""
stages:
- align
global:
prefix: test
sequence_id... |
60564c96f9f0849e179b12118872dd32464fa1c629489993ae4ffe9cbe057e4e | Python | 6,527 | 259 | """Tests of manual clustering utility functions."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import logging
from phylib.utils import connect, unconnect
from pytest import raises
from ..... |
7b036339ac3a801563acf999f84ecf4ac94983c0045c5d8d874695a56b349476 | Python | 6,529 | 139 | # -*- coding: utf-8 -*-
import os
import gc
import time
import numpy as np
from collections import defaultdict
from keras import backend as K
from keras import optimizers
from utils import load_data, pickle_load, format_filename, write_log
from models import KGCN
from config import ModelConfig, PROCESSED_DATA_DIR, ... |
b398aabed3f5ad665c253b5dbcb96d67ac995a2a8dd834f17d6b758feb392a3c | Python | 6,529 | 220 | #measurements.py
from initialization.initialization import *
from initialization.config import *
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
def calc_aspect_ratio(df, drop=False):
df['aspect'] = df['major_axis_length']/df['minor_axis_length']
# Remove NaNs
if (drop):
... |
9d961222d5af185f7c66a296939a464eac000c01d61a020868c5b7936475d8f1 | Python | 6,530 | 149 | #!/usr/bin/env python
__author__ = 'etseng@pacb.com'
"""
Demultiplex IsoSeq1/IsoSeq2 job output (without genome mapping)
INPUT: HQ isoform and report.csv and file.csv (alternatively, job directory)
OUTPUT: CSV file containing associated FL count for each isoform
HQ isoform ID format:
(isoseq1) i0_HQ_sample3f1db2|c... |
a20ed6fe2f8d7865352c3c8d3866af8990541593085452cbda347302a8f273c4 | Python | 6,530 | 203 | import argparse
import json
import os
import time
import pandas as pd
from pathlib import Path
import numpy as np
from distributed_computing.api import start_head_node, start_node
from distributed_computing.api import Pool as WorkersPool
from serann_evaluation.logic import SampleDeepEvaluator, SerannEvaluationWorker... |
dbdd1c9d9027e47e8bba70d9c8f151a0bd5b6e74dd070ac78d3cc6a026dfe0af | Python | 6,530 | 171 | import tensorflow as tf
from ...layers import dense_attention_layer, embedding_layer
from ...hyperparams import ACTIVATION_FN_FACTORY
def scnn_fn(features, labels, mode, params):
"""
Implement model for IC50 prediction based on selected genes attention and
attentive cnn.
Args:
- features: fea... |
7d0ceefb8185978c2925d90984f431fca7c574888780d907188930d426551bc8 | Python | 6,532 | 203 | """
Config file class
authors: Thomas Delemontex and András Ecker; last update 04.2023
"""
import os
import yaml
class Config(object):
"""Class to store config parameters about the simulations and analysis"""
def __init__(self, config_path):
"""YAML config file based constructor"""
self._con... |
8e14c12600809c2900a68e2def55d96da3e7bc88de1b0b8930c8aaab88d044de | Python | 6,535 | 199 | # 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... |
1ac65340a56d11029bb4c45bdd4386293d18fd27a29cd14a2ff1738048649625 | Python | 6,538 | 121 | """
Scan clustering n and saves plots dendograms, cluster seqs and assemblies for all of them
last modified: András Ecker 02.2023
"""
import os
import warnings
import numpy as np
from scipy.spatial.distance import pdist, cdist, squareform
from scipy.optimize import linear_sum_assignment
from scipy.cluster.hierarchy im... |
d01296ee408c60fe3cd3c7c2269b8d6e09f29c4f20d94324e5317253a9567e5a | Python | 6,540 | 138 | #import Interface as I
import pandas as pd
import barrel_cortex
def change_ongoing_interval(n, factor = 1, pop = None):
'''scales the ongoing frequency with a factor'''
for c in list(n.network.keys()):
celltype, location = c.split('_')
if not celltype in pop:
continue
... |
2eeecb2072e6247e796ff48c058373f4e0fff0b918960a042026ba28e15ad1a8 | Python | 6,543 | 176 | """Typed scan manifest: the canonical data contract for MRI/PET metadata.
A `ScanManifest` is the single structure the rest of the data pipeline
consumes and produces, decoupling "how did we get this metadata" (a local
OASIS-3 export, the synthetic generator, ...) from "what a scan record looks
like" (loading, labelin... |
00a453022053050078af64f2fa718bfeacae5a4b7bdb34930c417cb44e9c86b8 | Python | 6,544 | 181 | import re
import pytest
from pandas.core.dtypes.common import (
is_bool_dtype,
is_numeric_dtype,
is_object_dtype,
is_string_dtype,
)
import pandas as pd
import pandas._testing as tm
class BaseGroupbyTests:
"""Groupby-specific tests."""
def test_grouping_grouper(self, data_for_grouping):
... |
691e00a9dacb09ecc811fc641da038cae1914843562b02e37f6d7de9e8114c09 | Python | 6,545 | 178 | #!/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... |
50d67c744e114c7abb1252e8bc7f40a4d89b3ab5f1e972ef906d09691888b19d | Python | 6,546 | 208 | """
Interaction with scipy.sparse matrices.
Currently only includes to_coo helpers.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from pandas._libs import lib
from pandas.core.dtypes.missing import notna
from pandas.core.algorithms import factorize
from pandas.core.indexes.api import Mul... |
39c29f8bde3d22d090fd66e0ccabd3a5bee6c1a451edce7850c1cc807dc45946 | Python | 6,547 | 177 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestSeriesConcat:
@pytest.mark.parametrize("bool_dtype", [bool, "boolean"])
@pytest.mark.parametrize("dtype", [np.int64, np.float64, "Int64", "Float64"])
def test_concat_bool_and_numeric(self, bool_dtype, dtype):
... |
39cca67f2a8d4f05fb90a3caffc82ee7ab0a9d9fb85b7287814a7d9d4bef5f3f | Python | 6,551 | 208 | import matplotlib.pyplot as plt
import numpy as np
import gvar as gv
import lsqfit
import vegas
try:
import corner
except ImportError:
corner = None
from outputsplitter import log_stdout
# options (default is 2nd in each case)
USE_FIT = True
USE_FIT = False
FIT_KEYS = ['c', 'w']
FIT_KEYS = ['c', 'b', 'w']
W... |
c42bd3b739dee17c16f41460247e7cadfc887cadec5986a7e7407c8dc7774b1f | Python | 6,551 | 154 | # -*- coding: utf-8 -*-
"""
classifiers
"""
from app.inout.inout import write_hist, write_map
from app.utils import end_execution
from pandas import read_csv
import numpy as np
import os
import logging
logger = logging.getLogger(__name__)
def call_model(data, p_model, p_scaling):
from sklearn.preprocessing impor... |
1440e9e16ab1606954696f2cf9a5e60b19b038b2c4157cc3435229afc3ee7743 | Python | 6,552 | 218 | # Copyright (C) 2019-2024 PyCaret
# Module: internal.logging
# Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com>
# Contributors (https://github.com/pycaret/pycaret/graphs/contributors)
# License: MIT
import logging
import os
import traceback
import warnings
from collections.abc import Callable
from contextlib ... |
3ff0c8ba3d11a6362afb941d4961c2dbc842097cb3745649336a16369886bc34 | Python | 6,554 | 123 | import numpy as np
from keras import backend as K
from keras.engine import Input, Model
from keras.layers import Conv3D, MaxPooling3D, UpSampling3D, Activation, BatchNormalization, PReLU, Deconvolution3D
from keras.optimizers import Adam
K.set_image_data_format("channels_first")
try:
from keras.engine import merge... |
de112c721a9071ad55af356131179b0e77375d10c895b18ccba5de345df7d070 | Python | 6,555 | 228 | # 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... |
8bbf93dc91618cd84534f9e766df54df81178491279128ae16bee22806ed7c09 | Python | 6,558 | 208 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sys
import matplotlib.ticker as ticker
import matplotlib.transforms as transforms
from pathlib import Path
import math
from statistics import mean, stdev
sys.path.append('../')
from plotting_functions import *
#create figure and set font
fi... |
0d5b8ebcd80dfffc0f84a93ed0633b31460478ab37970cb40ff7c922e4a59f2e | Python | 6,559 | 142 | import numpy as np
from scipy.sparse import csc_matrix
def process_files_ddi(files, BKG_file,keeptrainone = False):
entity2id = {}
relation2id = {}
triplets = {}
kg_triple = []
ent = 0
rel = 0
for file_type, file_path in files.items():
data = []
file_data = np.loadtxt(file... |
3695c9f5cf77d569ceca48a0ce3b926186798f8359b1b0ee27d83bcc49696b7a | Python | 6,561 | 214 | import numpy
from scipy import optimize
import matplotlib.pyplot as plt
import torch
import pandas
import seaborn as sns
from scipy import interpolate
import time
from scipy.stats import pearsonr
from scipy.integrate import solve_ivp
def interpolateData(df, resolution, normalize):
epsilon=0
df = df.copy()
... |
ba90595b027db02c7b2f9a8f31b9be04fe0e27ea4a1b4b3193a385abe53a5cf0 | Python | 6,561 | 147 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 30 11:42:15 2023
@author: nrq2
"""
import os
import scenicplus
import scanpy
import pycisTopic
## 1. Initialize cisTopic object
from pycisTopic.cistopic_class import *
from pycisTopic.utils import *
from pycisTopic.lda_models import CistopicLDAModel... |
3ba174d9ac3857e26a538f9e82b047cc6d8858090bd1f08cc3a85008772613c5 | Python | 6,562 | 148 | """
From https://github.com/mouthful/ClofNet/blob/master/newtonian
"""
import time
import numpy as np
import argparse
from multiprocessing import Pool
from tqdm import tqdm
import os
from src.datamodules.components.nms.synthetic_sim import ChargedParticlesSim, DynamicSim, FixCharge, GravitySim, SpringSim
"""
nbody: ... |
09615e711f954eca318c9848fe19b5ce1b8a03fe7dc8964837476c56d4683f1c | Python | 6,566 | 165 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
sort = "--sort" in sys.argv
pop_nans = "--pop-nans" in sys.argv
stamp = "--no-stamp" not in sys.argv
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"
ds_tags = None
ds_exclude... |
6ebaa7f6f0f35327f74c14f69bba6aa5290bfa7a303a164ae8add8e59e94c190 | Python | 6,569 | 173 | """Module contains functions for visualizations of LDA models."""
from dataclasses import asdict
from typing import ClassVar, List, Optional, Tuple
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.metrics import confusion_matrix
from moseq2_lda.data import MoseqRepresentation... |
acd12984890fb2dd9df985d2723635d3bb8df4c541bbfed66a2c171cad6a8ef9 | Python | 6,570 | 167 | # verify that we're using the correct version of StellarGraph for this notebook
import stellargraph as sg
import warnings
warnings.filterwarnings("ignore")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf
try:
sg.utils.validate_notebook_version("1.2.1")
except AttributeError:
raise Valu... |
7d5619b8620e3a0751c4e3c4642e0ef65cb4131f63af4125bae37b454a6a6707 | Python | 6,572 | 167 | # verify that we're using the correct version of StellarGraph for this notebook
import stellargraph as sg
import warnings
warnings.filterwarnings("ignore")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf
try:
sg.utils.validate_notebook_version("1.2.1")
except AttributeError:
raise Valu... |
e2f61766694790a8da48695db9ac45fcf115b0b6d71da4da3691875f520e8809 | Python | 6,572 | 167 | # verify that we're using the correct version of StellarGraph for this notebook
import stellargraph as sg
import warnings
warnings.filterwarnings("ignore")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf
try:
sg.utils.validate_notebook_version("1.2.1")
except AttributeError:
raise Valu... |
e58922a5bb3d8dab422e65aab2fedb199dc1551704498ccc2844902d6814660b | Python | 6,572 | 167 | # verify that we're using the correct version of StellarGraph for this notebook
import stellargraph as sg
import warnings
warnings.filterwarnings("ignore")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf
try:
sg.utils.validate_notebook_version("1.2.1")
except AttributeError:
raise Valu... |
797f115dc91280559dd82e1f05f8f3d2d772ce31f72ad4a9882295d2baec56d1 | Python | 6,573 | 218 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core import nanops
from pandas.core.arrays import TimedeltaArray
class TestReductions:
@pytest.mark.parametrize("name", ["std", "min", "max", "median", "mean"])
def test_reductions_empty(self, name, skipna):
... |
93fd250189e84bb6e046131a634ee22f1f00d9c71f73c087ea4abf14564b15ca | Python | 6,573 | 210 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sys
import matplotlib.ticker as ticker
import matplotlib.transforms as transforms
from pathlib import Path
import math
from statistics import mean, stdev
sys.path.append('../')
from plotting_functions import *
#create figure and set font
fi... |
07115da9e1b7cb2a28ff688e7990ec04e138b434ee2fd1ed80d92f178b45c163 | Python | 6,574 | 181 | import medmnist
import torchio as tio
from numpy import float32
from typing import Any
from torch import float32
from torch.utils.data import DataLoader
from monai.data.dataloader import DataLoader as MDTL
from monai import transforms as mtf
from twoandahalfdimensions.utils.config import Config, LoaderType, TransformL... |
84913c4ea42c2e71149ae9a8f4762f3da29922c1c93f34fcc3db5843e86cd62b | Python | 6,576 | 194 | import numpy as np
import pytest
from pandas._libs import iNaT
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import DatetimeArray
class TestDatetimeArrayConstructor:
def test_from_sequence_invalid_type(self):
mi = pd.Multi... |
ad1d68d79b2f1c2f01eedff6d1693903c13e03ac65b755fa43b7a59026269419 | Python | 6,582 | 162 | """Opt-in prepared-clock reuse across independent datasets."""
import json
import weakref
from pathlib import Path
from unittest.mock import Mock
import anndata
import numpy as np
import pandas as pd
import pytest
import torch
import pyaging as pya
PARAMS_DIR = Path(__file__).resolve().parents[1] / "data" / "bioage... |
647d125d34470975bc08e160c23c812a935c2670dd6039e973fd519c21082935 | Python | 6,583 | 197 | import os
from typing import Literal, Optional
import numpy as np
import pandas as pd
_reference2 = Optional[Literal["hg38", "mm10", "sacCer3"]]
def call_motif(
peaks_path: Optional[str] = None,
peaks_frame: Optional[pd.DataFrame] = None,
save_name: Optional[str] = None,
reference: _reference2 = "hg... |
12ba99267c6ea0713d514c36765de9a870ea84b5067eb153a5934577fe4b4bf6 | Python | 6,585 | 169 | import numpy as np
import os
from kcsd import csd_profile as CSD
from kcsd import KCSD2D
from scipy.integrate import simps
from scipy.interpolate import griddata
from figure_properties import *
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.gridspec as gridspec
def integrate_2d(csd_at, t... |
e2bb0f24e8379332ae127ab5c7af4d29077bf73c9a4273e9580df734f9536c43 | Python | 6,587 | 192 | import re
import numpy as np
import pytest
from pandas._libs.tslibs import Resolution
from pandas._libs.tslibs.timedeltas import (
array_to_timedelta64,
delta_to_nanoseconds,
ints_to_pytimedelta,
parse_timedelta_string_reso,
)
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametriz... |
6c5c0be2069333c273e7bc2927e72284c5185fb77b5930aaeb6723c7858de61d | Python | 6,589 | 161 | import numpy as np
import pickle
import os
import matplotlib.pyplot as plt
import scipy.stats as stats
from statsmodels.stats.multitest import multipletests
maskfile = "demodata/mask.npy"
seed_1 = [('M2 3', 50, 127-75),
('M2 2', 40, 55),
('M2 1', 30, 50),
('... |
080cc553ea36248f365056e9da9d78256fcd3292652710210316acc5175b12af | Python | 6,590 | 208 | #!/usr/bin/env python3
"""
Read alignments in maf format and output those blocks that contain a specified
set of species, along with possibly other species; components for the other
species are discarded.
"""
from sys import argv,stdin,stdout,stderr,exit
from math import ceil
from maf_alignments i... |
211416cc234657d4cf5f5a49ac7cbc649ee2fb819335b6347f9dbfd652decde3 | Python | 6,590 | 128 | import torch
from .base_model import BaseModel
from . import networks
class Pix2PixModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset_mode aligned' dataset.
By default, it uses ... |
457c940e57f00934f0f9e7821c49ca6bc5947adf47a80327004dd3c6521ee432 | Python | 6,590 | 130 | import torch
from .base_model import BaseModel
from . import networks
class Pix2PixModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset_mode aligned' dataset.
By default, it uses ... |
4e7e9425e0c367eb5e07dd8139785d5365a76cd51abb5351918138b9cbca2e58 | Python | 6,592 | 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... |
c613597c91d36dfe6686f8921fd6373ce03ea3e8f3bbb27d4046b68d8b569843 | Python | 6,594 | 145 | # Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
303d60018ab416a6d984ae94f438747958bd9177bc3657bba93d09070ad7de58 | Python | 6,596 | 177 | #! /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... |
678ebf06e4c1a3f2abda34ea2438502e3f13d65163aed64b57af5df819e58f23 | Python | 6,597 | 200 | from typing import Dict, List, Callable
import torch
import torch.nn as nn
import torch.nn.functional as F
from darts.api import Model
from darts.modules import Cell
from darts.modules.classifier import MultitaskClassifier
from darts.genotypes import Genotype
class Hyperparameters:
c = 1
num_nodes = 2
n... |
632c1fd5adeec15374246829dd890441269a3e01db7f55e301245f6badcb70ed | Python | 6,598 | 171 | """Test the crop CLI command argument parsing."""
import argparse
from unittest.mock import MagicMock, patch
import pytest
from lightning_pose.cli.commands.crop import get_parser, handle
class TestGetParser:
"""Test the get_parser function."""
def test_returns_argument_parser(self):
"""Returns an ... |
a6a8a5b1ef07b2a035b16d8ef2bb8de0fac32a56b5164bb74d68fe44466fea6f | Python | 6,600 | 178 | #!/usr/bin/env python3
"""Can a residue's psv (vbar) be predicted from its perceived hybridization composition?
Mattia's suggestion for non-coded residues: derive a rough psv from similarity between the
hybridizations we perceive and those already present in somo.residue. The classical form of that
idea is an additive... |
df7aa56592000d65be77da68fca81f3ac0015dd3a778d0fdd085f0854040c5b4 | Python | 6,601 | 213 | # Original work by
# Rajarshi Guha <rguha@indiana.edu>
# 08/26/07
# And RDkit Hack by Chris Arthur 1/11/2015
import numpy as np
from rdkit import Chem
cats_smarts = {
"D": ["[!$([#6,H0,-,-2,-3])]"],
"A": ["[!$([#6,F,Cl,Br,I,o,s,nX3,#7v5,#15v5,#16v4,#16v6,*+1,*+2,*+3])]"],
"P": ["[*+]", "[#7H2]"],
"N": ... |
4c29b5adf80a395045d3eb5d0b5d4d458b15278827b92826b59b78c53d2976b7 | Python | 6,605 | 152 | """FastMRI dataset."""
import re
from collections import defaultdict
from collections.abc import Sequence
from os import PathLike
from pathlib import Path
from warnings import warn
from xml.etree import ElementTree as ET
import h5py
import numpy as np
import torch
from einops import rearrange
from mrpro.data.AcqInfo... |
43da24f7deb3344c13142970aabc620ee6f5fa97e5a6b74a3386cba95a03affe | Python | 6,607 | 188 | import numpy as np
import reverb
import tensorflow as tf
from rl_toolkit.networks.models import ActorCritic
from rl_toolkit.utils import VariableContainer
from ...core.process import Process
class Server(Process):
"""
Learner
=================
Attributes:
env_name (str): the name of environ... |
cbb2c391a21dc2dd827b2b663adbe5f2fa09e67228396fe14a5d53bcdec4054a | Python | 6,608 | 162 | from Environment_ui import *
from PySide2.QtWidgets import QMainWindow, QApplication, QSplashScreen
from PySide2.QtUiTools import QUiLoader
from PySide2.QtGui import QPixmap, QColor, QFont, QDesktopServices, QIcon
from PySide2.QtCore import Qt, QElapsedTimer, QUrl
from pages.Settings.settings import Settings
from pages... |
ef999705af70cc734a2ad30539f95b7d9f60c7687c9032397806c8e5fa9518b2 | Python | 6,612 | 193 | # 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... |
139ea7be876df54d825637d4370414f4d7eac77091315b203eef5cbc797d1b5c | Python | 6,614 | 136 | import numpy as np
import pandas as pd
import sys, os
from random import shuffle
import torch
import torch.nn as nn
from models.gat import GATNet
from models.gat_gcn import GAT_GCN
from models.gcn import GCNNet
from models.ginconv import GINConvNet
from utils import *
import datetime
import argparse
# training functio... |
0e3d8fbef27746575b883ec0964e71f60dde16461de7437a15f6e7cdd054b465 | Python | 6,615 | 326 | #! /usr/bin/env python
# -*- coding: utf-8
#
# Copyright (c) 2023 Kenneth Atz, Clemens Isert & Gisbert Schneider (ETH Zurich)
import os
import random
import re
import numpy as np
import torch
import torch.nn as nn
from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
from sklearn.metrics.pairwise import manha... |
e92ad57f7c96244dd1fadf1513cbf781686fec53e2f8391c116c75b6ccbe0f10 | Python | 6,616 | 141 | 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... |
474a405d191edb24ffa036c44286965a833652402735a16f3466849a50499333 | Python | 6,618 | 155 | import time
import pandas as pd
from utils import print_from_history, series_to_matrix
from copy import deepcopy
import warnings
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.linear_model import SGDClassifier, LogisticRegression
import numpy as np
from evaluators.calculate... |
6ec92c6381faf2734083dbc5b753aad98aa07da658f158f43f04d5c525c95cca | Python | 6,618 | 202 | 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
... |
d65c6a04ece8fd9f3e238e2292149c549ab3e0bd581df9138525989530761ac3 | Python | 6,618 | 189 | # 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... |
ecba7190fa48b4073c6685b161e581d98ea17b6de297c95504bfc70058f0464b | Python | 6,618 | 214 | """Session 48 — Track A · feature attribution plots.
Model-agnostic explainability built on sklearn primitives so they work
on any fitted model without SHAP. SHAP-based plots layered on top as
soft-deps.
Coverage:
- ``permutation_importance`` — drop-in feature-importance bar chart
with ±σ error bars (works on any ... |
5e90c50185f82de6fc68e82d0f82bbfa2861db3b6f1e34b821690fc41d211679 | Python | 6,620 | 177 | import sys, os, re
def uniq(lst):
last = object()
for item in lst:
if item == last:
continue
yield item
last = item
def labeled_cues(graph_file):
labeled_cues = []
article_num = 0
sentence_num = 0
nodes_to_preds = {}
with open(graph_file... |
6490b68cf5649b755c84894c8c17a2d6795ea0e4c6274be6ad2484deb0676e62 | Python | 6,621 | 202 | """io on the clipboard"""
from __future__ import annotations
from io import StringIO
from typing import TYPE_CHECKING
import warnings
from pandas._config.config import _global_config as config
from pandas._libs import lib
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_... |
049fd6b4c48a82592a0c41d4b2d6797b5bd30f52c6604e12606619635e02974a | Python | 6,624 | 162 | import numpy as np
import scipy
import tensorflow as tf
import protein_holography.network.naming as naming
import protein_holography.network.wigner as wigner
def get_dataset(data_dir, data_id):
hgrams = np.load('/'.join([data_dir,data_id + '.npy']),
allow_pickle=True,
enc... |
05ff07c66f064aab245afe7fcb390f02d12a7cd68d4efd3978f64cebcfaf4a7d | Python | 6,624 | 146 | # 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... |
0a29a19d9bb903a350b69a6f004e9551e898eec396cd4001e5657787d1635767 | Python | 6,624 | 191 | import msmfcode
import logging
import numpy as np
from os.path import join, dirname, split, exists
from os import mkdir
PY_PKG_PATH = split(dirname(msmfcode.__file__))[0]
class Metric:
POS_ERROR = 'pos_error'
POS_ERROR_MEAN = 'pos_error_mean'
POS_ERROR_STD = 'pos_error_std'
POS_ERROR_MIN = 'pos_err... |
bc728b52cec0653aded753048301198235c8701324ec97e26ee53713c38a60ab | Python | 6,624 | 226 | """
Tests for the Apache Iceberg format.
Tests in this file use a simple Iceberg catalog based on SQLite, with the same
data used for Parquet tests (``pandas/tests/io/data/parquet/simple.parquet``).
"""
import collections
import importlib
import pathlib
import pytest
import pandas as pd
import pandas._testing as tm... |
b290ac13c3e699a9624eee92ccdae3360dc440fb9d26a2a81e26b13420e5d2de | Python | 6,625 | 158 | import pandas as pd, numpy as np, psutil, zarr, dask, multiprocessing as mp
from concurrent.futures import ProcessPoolExecutor, as_completed
from dask.distributed import Client, LocalCluster
from dask import dataframe as dd, array as da
from dask.distributed import progress
from itertools import combinations
from numpy... |
dd2a3a4764f83f71fc5a9fb2ca4bc0bf3e0628521801cfb429c3020f07348afd | Python | 6,627 | 134 | #!/usr/bin/env python
import os
import numpy as np
import pandas as pd
from scipy import stats
import numpy.ma as ma
from itertools import combinations, product
def analyse_interacting_network(node='GI', distance=2.5):
assert node == 'GI' or node == 'OR'
##### change file path of OR expression table
expr_df = pd.... |
2ff806f1c262528ac8ab6a6703c975ef929b2ae562b78a517e4cec71c4730694 | Python | 6,628 | 197 | """Implementation of python and system-level progress bar wrappers for
iterators.
"""
import logging
from atropos.util import MAGNITUDE, Timestamp
class ProgressMessageReader(object):
"""Wrapper around an iterable that logs an INFO message at a specified
interval.
Args:
iterable: The iterable ... |
32c810138c301f9e2972e6d2ab3863d61d5c94eff82721d4e616168454ac6416 | Python | 6,632 | 176 | """Load vision encoder from Facebook SAM model using HuggingFace."""
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import SamModel
logger = logging.getLogger(__name__)
# to ignore imports for sphinx-autoapidoc
__all__: list[str] = []
class VisionEncoderSam(nn.... |
b74d59eb238367e1acf85720f156962d970343307b7acf5363b4ff38f952ace6 | Python | 6,633 | 202 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by Roberto Preste
import os
from pkg_resources import resource_filename
import shutil
import subprocess
import click
import pandas as pd
from sqlalchemy import create_engine
from mtoolnote.models import Base
from mtoolnote.mtoolnote import annotate
from mtoolnot... |
e0ec9309ad073b9741e941f89f92efd14095066eb380cfd9359f3398c5023c6c | Python | 6,633 | 214 | from __future__ import print_function, absolute_import, division
import json
import numpy as np
# import matplotlib
import os
from PIL import Image, ImageDraw
from collections import namedtuple
import cv2
import glob
data_folder = 'semantic_segmentation_images_annotations/Images_and_Supervisely_Annotations/'
folder = ... |
7fbb03302be38dceb3369b809ad4d81fe650be795b096357778fed6a47f08406 | Python | 6,634 | 137 | import torch
import rl_games.algos_torch.torch_ext as torch_ext
class DefaultDiagnostics(object):
def __init__(self):
pass
def send_info(self, writter):
pass
def epoch(self, agent, current_epoch):
pass
def mini_epoch(self, agent, miniepoch):
pass
def mini_batch(... |
58798912863d55385d0994750cde765cb656296301f4bc71fa8ef26c431ad5b7 | Python | 6,638 | 207 | import pandas as pd
from nilearn.signal import clean
from nilearn.interfaces.fmriprep import load_confounds_strategy, load_confounds
from fmriprep_denoise.dataset.atlas import (
create_atlas_masker,
get_atlas_dimensions,
)
def generate_timeseries_per_dimension(
atlas_name, output, benchmark_strategies, ... |
7457b486be9caa5d1ebbac71cc70bc90122a8721558a577ca107ff42b6879de3 | Python | 6,638 | 183 | """
For a comparasion, we reachieved the CNN and MLP of Bo et al;
https://www.sciencedirect.com/science/article/pii/S096399692200031X#f0005
written by Yi He, May 2023
"""
import os
import pandas as pd
import numpy as np
from PIL import Image
import torch
from torch import nn
from torch.nn import functional as F
import... |
8f6cd8939e327d7954e78a0b06ca1100b9129bd1943abfd59dfb0b426edc7276 | Python | 6,640 | 205 | """
Functions and utilities to apply aesthetic styling to plots.
Modified from neuroDSP: https://github.com/neurodsp-tools/neurodsp/tree/master/neurodsp/plts
"""
import datetime
import inspect
from functools import wraps
from pathlib import Path
from typing import Any, Callable
import matplotlib.pyplot as plt
import... |
c318ec82890431a6ef29be77d37d6385249f36a662e40bd806c35845f993d7da | Python | 6,640 | 168 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 16 18:11:11 2023
@author: lonya
"""
#%% Load Data
import tkinter as tk
import tkinter.filedialog as fd
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from collections import Counter
from matplotlib_venn import venn3
imp... |
728097d0878c26e2bb9ef957640da341279d0fcadddc10f2e4255920aa180d6c | Python | 6,646 | 173 | import jax
import jax.numpy as jnp
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.stats import lognorm, norm
from hyperparameters import SimArgs
# Weights
def normal_visualisation(data):
# Fit normal distribution to the log of data
mu, std = norm.fit(data)
fig, ax = plt.subplots(... |
d50565fa1da922718779b626b31fa47fa18a748de2f7d550fc79608a9be213f0 | Python | 6,648 | 121 | import numpy as np
from scipy.optimize import fmin_l_bfgs_b
import time
class CRF(object):
def __init__(self, training_size, testing_size, positive_unary_energy, co_exp_net, theta, bag_label, bag_index):
self.nodes_number = training_size + testing_size
self.unary_potential = np.vstack((1 - positive... |
0b4e1f718b0735a7f153016195d0efa2fe9a8dbfc874715100d77a0f0e415d37 | Python | 6,649 | 254 | """
Numba 1D sum kernels that can be shared by
* Dataframe / Series
* groupby
* rolling / expanding
Mirrors pandas/_libs/window/aggregation.pyx
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numba
from numba.extending import register_jitable
import numpy as np
if T... |
d1297142c18456ac06bb14dcdfbda6676f969b58ef96aa4a84e1db2d300040b0 | Python | 6,652 | 195 | # 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... |
db09326c1271aac66d65f9cc6a06aaa8c229e82abecb6574f21519d1d3c88491 | Python | 6,652 | 169 | """This script runs the group-level GLM-Spectra and non-parametric permutations.
The script can be set to preprocess just the single example subject by changing
'subj' in the main body.
If the group-level data collation is run, then all glm-spectrum datasets found
in the output dir are collated.
"""
import os
from ... |
af639bfa44d23a9f60b9aa9eed3031435148e6807f69d3415f53bfd8a1ded489 | Python | 6,655 | 177 | import sys
import re
import numpy as np
import pandas as pd
import math
import argparse
def zscore(a):
return (a - a.mean()) / a.std()
def nested(p1, p2, df1=True):
preds_1 = set([x for x in p1.split('.')[-3].split('_')[2:-1] if not x.startswith('~')])
preds_2 = set([x for x in p2.split('.')[-3].split('_... |
c701cf86a7281c6a9d834968d39862a792f8933ffbd77575fbd7b96aaebd9f19 | Python | 6,655 | 199 | import os
import torch
import numpy as np
import pandas as pd
from darts.api import InMemoryDataset
from darts.datasets.utils import (
download_url, makedir_exist_ok
)
class Uno(InMemoryDataset):
"""Uno Dataset
Parameters
----------
root str :
Root directory of dataset where ``processed... |
fb8aac8914349a0ab336a29cf80de1b0cf46d3e9d70e2675151f7dee42789b1b | Python | 6,655 | 186 | # 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... |
abfb77e39bd1d51ffbc3f7906c0f1cd0cff398f61bcc56e311d77949f452a5d8 | Python | 6,660 | 187 | """Probe view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
from collections import defaultdict
import numpy as np
from phylib.utils.geometry import get_non_overlapping_boxes... |
b0f14d50475c280cbb08e87fbbd7191746f376932d6219d8f18f7b9283105cdc | Python | 6,663 | 212 | import importlib.util
import inspect
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Any
HERE = Path(__file__).parent
sys.path[:0] = [str(HERE.parent), str(HERE / "extensions")]
# -- General configuration ---------------------------------------------
# If your documentati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.