sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
072a3044b6bdabb232a6de4e3bc03b4a572492b4d2f8bb545cd3e9eda5fd14ba
Python
4,831
145
''' check_neuronmetadata.py This program will check entries in jacs:emBody with nueronbridge:neuron ''' import argparse from operator import attrgetter import sys import inquirer from tqdm import tqdm import jrc_common.jrc_common as JRC # Configuration EDEFAULT = ["fib19", "hemibrain", "hemibrain:v0.9", ...
a038d41b7975ac41f3c9cc03628aabb4990524e9b0ef69de556c920849419e88
Python
4,831
129
''' find_annotation.py Find a line, cell type or body ID in the janelia-neuronbridge-custom-annotations DynamoDB table. ''' import argparse import collections import json from operator import itemgetter import sys import boto3 import jrc_common.jrc_common as JRC #pylint:disable=broad-exception-caught,logging-...
75b84b5080b7c866efc9a602c342ad3612c84bdb74f1fa3e2f8732680cd8de3f
Python
4,833
123
"""Averaging operator.""" from collections.abc import Sequence from warnings import warn import torch from mrpro.operators.LinearOperator import LinearOperator from mrpro.utils.reshape import normalize_index class AveragingOp(LinearOperator): """Averaging operator. This operator averages the input tensor ...
ab4514b85e4e49e631f066c61cdf9c52ca1fbc4f1cb9ad524d15c397beaafb3e
Python
4,833
156
from typing import Iterable, List, Literal, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd from anndata import AnnData from matplotlib import cm from matplotlib import pyplot as plt from matplotlib import rcParams from matplotlib.axes import Axes _rankby = Optional[Literal["pvalues", "logfold...
b6ef78d45c5ef695fd478e12214d56214e05a27718af8ccdd67982f61f8e3fe2
Python
4,833
91
"""Test Indexing helper""" import pytest import torch from mrpro.utils.indexing import Indexer @pytest.mark.parametrize( ('shape', 'broadcast_shape', 'index', 'expected_shape'), [ ((1, 6, 7), (5, 6, 7), (slice(None), torch.ones(4, 5).int(), slice(None)), (4, 1, 5, 7)), # array index #0 ((1, ...
d874ce29dd69783fe27d6161098a5cbc21458241243bcadc894acc052da0d8d7
Python
4,833
127
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
c9e3d12eb1613bc25725c6d2843f1e8398040c6eb82e7cea101bc967c61ca8e8
Python
4,837
108
"""Tests for `multimodal_ad.models.regions` (no TensorFlow needed).""" import numpy as np import polars as pl import pytest from multimodal_ad.models.regions import ( ATLAS_PLACEMENT, HEATMAP_PLACEMENT, pad_to_frame, rank_regions, ) def test_pad_to_frame_places_volume_at_the_expected_offset() -> Non...
d4b6ae0ab2e08a80704db985ff74efeaa0452ffc89c4ac60997321d929c8d53f
Python
4,837
126
"""End-to-end smoke tests for the supervised SIMS workflow. These are direct ports of the three tests that used to live in ``scsims/tests.py`` (which itself never ran via pytest because the package shipped no test runner config). The originals had two latent bugs: 1. They referenced ``predictions["first_pred"]`` whic...
09593cc01dea331e3cd67bd2945814092b01d0d4d4a8247e0950d52386251e64
Python
4,841
144
import sys import numpy as np, matplotlib.pyplot as plt, networkx as nx, pickle, json, gzip import pandas as pd import itertools N_READS = 10 N_UMIS = 9 N_HAMMING = 6 CELL_BCS_PATH = "<file path of whitelist>" LIB_NAMES_PATH = "<file path of lib.txt>" # cell_bcs = open(CELL_BCS_PATH).read().strip('\n').split('\n'...
2299adbdec34463597c47959f7b04692038d233068caf5b8c4d4aa712cbf8f8c
Python
4,841
141
""" Tests for TimedeltaIndex methods behaving like their Timedelta counterparts """ import numpy as np import pytest from pandas._libs.tslibs.offsets import INVALID_FREQ_ERR_MSG from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestVectorizedTimedelta: def test_tdi...
82d508cf8cb8b40699ddfc8ce71ec6192c9d2299265fc26922d418e4ee6e490b
Python
4,841
108
"""PAOPAC Conventional: public author trees and cohort-dependent inference.""" import numpy as np import torch from sklearn.preprocessing import StandardScaler from statsmodels.nonparametric.smoothers_lowess import lowess from ._base_models import pyagingModel class PAOPACTrees(torch.nn.Module): """Evaluate the...
9144835aa938f3583efca194b0b93f1fdaeecfb394e1c2c1c5897d33bc2c33f0
Python
4,841
100
import pandas as pd import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from load_db.ADNI import get_adni_dx, get_visit_code from app import create_app, db from app.models import Subject, ...
ae48cd1436b2c756ab59ff00e1ec4733cf753a5436dd80b87351f6989de65a40
Python
4,841
129
# 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...
22b1688a70e98f8c72787402bde9b297a96710861ea9e4dd8d2b1a8bd0473d49
Python
4,842
129
# 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...
fb2dd4b9ca3e6cd75a41366de7d8c639e6b9d478ebebabd179dab74c8dfa0632
Python
4,843
153
"""Serializable descriptors for models, metrics, and parameters. These dataclasses are the primary contract between the PyCaret engine and anything that needs to describe its capabilities to a human (via a React form, a help text, a tutorial generator) or to an LLM (as structured context). All fields are plain-Python...
2d6467c2436a976171003083a6a0c18604677a407af869c0d63bdd180c569c52
Python
4,847
161
import numpy as np from PyQt5 import QtGui class DarkPalette(QtGui.QPalette): """Class that inherits from pyqtgraph.QtGui.QPalette and renders dark colours for the application.""" def __init__(self): QtGui.QPalette.__init__(self) self.setup() def setup(self): self.setColor(QtGui....
e21faa10e333eff2a92485a4e4d5fb9b019d5fba14c1b3d834fb527e607d9a9f
Python
4,848
122
import importlib.resources from pygments import highlight, lexers, formatters from PyQt6 import uic, QtCore, QtWidgets class LogPanel(QtWidgets.QWidget): """Log panel widget Visualizes logs stored in the .rtdc file """ def __init__(self, *args, **kwargs): super(LogPanel, self).__init__(*arg...
571e0d677ada085f6a5bddfeebabc1425b8e2addba94426237201f2bb7ce8513
Python
4,851
118
#!/home/UNIXHOME/etseng/anacondaPy37/envs/anaCogentPy37/bin/python __author__ = 'etseng@pacb.com' import pdb import os, sys, math from csv import DictReader from collections import defaultdict, Counter """ Based on the script by Gloria Sheynkman for creating a BED12 file where isoforms are shaded by abundances Read ...
cdf6dffca59b16333b419af6dc02aef4854c3b84a8e1bdfe015b121d5bd4b67e
Python
4,851
130
import collections import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd import pandas._testing as tm class TestCategoricalMissing: def test_isna(self): exp = np.array([False, False, True]) cat = pd....
f3583efe77dfa3441ef7f191c13f59735f2c8337453713f5d335b6150b5953ec
Python
4,855
154
import types import warnings import argparse import logging from typing import cast NOT_DOC = True def doc_mode(): global NOT_DOC NOT_DOC = False def not_doc(): return NOT_DOC class RST: def __init__(self, rst) -> None: self.rst = rst def __str__(self) -> str: return rst2txt...
d86d9356eb508fcebd0137dc3deea1266e52677908082aa1943897e4c227c6a9
Python
4,859
145
import sys sys.path.append('.') import queue import os from tkinter import * from threading import Thread import time from CommonSystem.Config import Config from PIL import Image, ImageTk, ImageGrab class Vtkinter(Tk): def __init__(self) -> None: super().__init__() ...
4d6d9ba28041aac6917694d36e41caecaf353228ed75393ae4c31b047ffde2d2
Python
4,860
127
import ntpath from sys import path as sys_path #sys_path.append('..') #sys_path.append('../base') sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/master/py-lddmm/') sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/master/py-lddmm/base') import os import multiprocessing as mp from multiproce...
ad46bb047f25cb99550e920de406c661ca2663555fd85e59892fb95300d4d178
Python
4,866
132
#!/usr/bin/env python import sys, argparse, os, glob, csv, pdb from tqdm import tqdm from pathlib import Path import regex, re import wave import contextlib import pandas as pd seed=4 def get_args(): parser = argparse.ArgumentParser() parser.add_argument('--lang', '-l', type=str, required=True) parser.a...
c17583c02599f5184353db81ae67242adc808f3929eb499eddaa5217f8494354
Python
4,866
130
#!/usr/bin/python3 """ analyze_indels.py: take GAM JSON as input and produce tables of non-softclip indel positions in the read and lengths """ import argparse import os import sys import time import subprocess import collections import json def parse_args(args): """ Takes in the command-line arguments ...
8b8e7ca9bdf3c05375e71c5546fb99a2c9526dc7e049d14d6157ecfa9b06c07f
Python
4,867
135
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 5 11:47:43 2023 @author: Noelia Martinez-Molina, adapted from code provided by Yonatan Sanz-Perl at CNS, UPF """ from numpy import genfromtxt import numpy as np import matplotlib.pyplot as plt import matplotlib.style as style import seaborn as sn...
18afaee25927844e1963a326bad2a91051194589df92eb61a3aca5a56bca0110
Python
4,868
100
import pandas as pd import matplotlib import matplotlib.pyplot as plt import numpy as np from pathlib import Path plt.rcdefaults() from matplotlib.backends.backend_pgf import FigureCanvasPgf matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf) if __name__ == "__main__": data_dir = '/Users/eghbalhosse...
3c8cb98305fc660f3f904964c1ddce37ec9c40455ca8f2ee5e43d4680cc1e318
Python
4,872
144
#!/usr/bin/env python # coding: utf-8 import warnings warnings.filterwarnings('ignore') import numpy as np from torch import nn import torch from torchsummary import summary import sys from utils import * import unet3d from config import models_genesis_config from tqdm import tqdm print("torch = {}".format(torch.__v...
6db192bfbf8ddf7640c904d897bbc818c97482a9ac1db19c9be914eb81d5af4a
Python
4,872
152
""" Compare evolutionary couplings to distances in 3D structures Authors: Thomas A. Hopf """ import numpy as np def add_distances(ec_table, dist_map, target_column="dist"): """ Add pair distances to EC score table Parameters ---------- ec_table : pandas.DataFrame List of evolutionary ...
d3f341e09ae53b2777675985a3ba4687bc936e30f0169dd1de473e6c649b5af9
Python
4,874
93
import pandas as pd import numpy as np import statsmodels.api as sm import statsmodels.tools.tools as sm_tools import os def fit_multivar_LM(es_mu, df_magma, specificity_id, cond_annotation): ''' Fit linear model between an ESmu matrix 'specificity_id' with one extra ESmu covariate 'cond_annotation' added to each...
b280d8433144b7030e1289b7ceb3e06d24a9e90a0dc18a1cf85c7d5a263c343f
Python
4,877
187
import os import collections def make_dir(directory): """ sensible way to create directory Parameters: Cursor - cptools2 - Cursor ------------ directory: string path to the directory to be created Returns: -------- nothing, creates empty directory if successful, othe...
a653b69e5878696f99716ac38ca78d1918e41513a3ea08b48b591bcd35e367f8
Python
4,881
141
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Tue Oct 26 15:12:17 2021 @author: ehsesp """ import argparse import numpy as np import time import twixtools from twixtools import map_twix from twixtools.contrib import cfl from twixtools.recon_helpers import remove_oversampling cfl_order = [ 'READ_DI...
36379461d6ff2a4dd90fd87a842c96e63736453345413d8eda08e2d73b40d1e9
Python
4,885
109
"""Native 3D Grad-CAM, ported from `Heatmaps.ipynb`. **Documented choice**: `Heatmaps.ipynb` computes Grad-CAM two ways: a hand-written, unused 2D `make_gradcam_heatmap()` (standard single-layer Keras Grad-CAM recipe, adapted from https://keras.io/examples/vision/grad_cam/), and the actually-used [`tf-keras-vis`](http...
1d11fa49b030376566a168c491be8b52c8b180cf142ef03f84275775847f0be9
Python
4,888
127
from typing import Iterable import math import numpy as np from torch.utils.data import Sampler, BatchSampler class SortishSampler(Sampler): """Returns indices such that inputs with similar lengths are close together.""" def __init__(self, sequence_lengths: Iterable, bucket_size: int, num_replicas: int = 1,...
4160d90eb0ebe1eff4aa02d041fff5f79dc2dff672869655e23d1a2299beb753
Python
4,888
135
import operator class SegmentTree(object): def __init__(self, capacity, operation, neutral_element): """Build a Segment Tree data structure. https://en.wikipedia.org/wiki/Segment_tree Can be used as regular array, but with two important differences: a) setting item's va...
5882e4c3834afa7c20043492382bf189ae117159e236bca05ae6685c8547f52c
Python
4,888
136
"""This script produces a figure summarising varcope smoothing.""" import os import glmtools as glm import matplotlib.pyplot as plt import mne import numpy as np import osl import sails import lemon_plotting from glm_config import cfg from lemon_support import (get_eeg_data, lemon_make_bads_regressor, ...
df916fa71543d3bfae66dfd730472ff286ac894b981e7e1d8b93a788ad33a619
Python
4,888
136
# 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...
5cf689c1552377db2a75cd0b7cb5f6382e2839106b3a7a47a1d0d4f3f916dac1
Python
4,891
102
import argparse import sys import os import pickle import pandas as pd from cdr.config import Config from cdr.baselines import py2ri, LM, LME from cdr.formula import Formula from cdr.util import mse, mae, filter_models, get_partition_list, stderr pd.options.mode.chained_assignment = None if __name__ == '__main__': ...
90fd52c00e6b10855fb33096a28acca026369c4207ecf1d043037ae16a62da8c
Python
4,891
142
# # Glucose transporters, include SGLT1/SGLT2, GLUT1/GLUT2 from values import * import math import numpy as np # # SGLT cotransporters modules #--------------------------------------------------------------------- #This subroutine to computes the fluxes across SGLT (Na-glucose) #cotransporters, based on the model of ...
293fe31af88b6119a3c380942a583848b1c711396b9f5bb18de7281cb4dc2702
Python
4,895
131
import random from models import input_dim, output_dim from utilities.utilities import * import os import shutil oversample_foreground_percent = 0.3 dim_offset = (input_dim - output_dim) // 2 # https://github.com/MIC-DKFZ/nnUNet/blob/6d02b5a4e2a7eae14361cde9599bbf4ccde2cd37/nnunet/training/dataloading/dataset_loadin...
9d6a432a471cad2b0294e3d7528c5b7bc73635849c6f04f000517e4c683d0b8e
Python
4,895
143
"""Class for Finite Difference Operator.""" from collections.abc import Sequence from typing import Literal import torch from mrpro.operators.LinearOperator import LinearOperator from mrpro.utils.filters import filter_separable class FiniteDifferenceOp(LinearOperator): """Finite Difference Operator.""" @s...
53ef1fe8f6b3231b3e320453dd2bcad823ab9ee6eb7948f8ea7df3b6f8061dd4
Python
4,898
119
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/06_data_augmentation.ipynb (unless otherwise specified). __all__ = ['randomize_smiles', 'precursor_permutation_given_index', 'randomize_rxn', 'do_randomizations_on_df', 'do_random_permutations_on_df'] # Cell import random import math import numpy as np import...
61b006cef427abad287b1f3afd989aefe34b81fed35fb6c4699f42cc6819b6c2
Python
4,898
121
# 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...
a20a663ec0a8a5c4503228792c5b6d79cc8616679a33d6cdfb5994bf6d52970e
Python
4,899
158
import pandas as pd import numpy as np import math from statistics import mean, stdev import warnings pd.options.mode.chained_assignment = None def load_data(dataSheet): metadata = pd.read_excel(dataSheet, sheet_name="metadata") fluorescence = pd.read_excel(dataSheet, sheet_name="fluorescence") od600 = p...
eea82867bb49151258bc8bf9cd91003324805c1d749147a920895183a97974fe
Python
4,899
158
# coding: utf-8 import torch import torch.nn as nn import torch.nn.functional as F def initialize_weights(m): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight.data, mode='fan_out') elif isinstance(m, nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_() elif isi...
b17273fa3da98216c5b858c1c72f9a734adb304e5923fa59725e652dc8d82192
Python
4,902
153
"""Cartesian trajectory class.""" from collections.abc import Sequence import torch from mrpro.data.KTrajectory import KTrajectory from mrpro.data.SpatialDimension import SpatialDimension from mrpro.data.traj_calculators.KTrajectoryCalculator import KTrajectoryCalculator from mrpro.utils.RandomGenerator import Rando...
74e9b1ba8dc80911c1e5a97766199c607b3e0e7b694fcd6f2f375dd1c40eb270
Python
4,904
160
"""Segmentation module.""" from abc import ABCMeta import numpy as np from sklearn.cluster import KMeans class Segmentation(metaclass=ABCMeta): """Base class for segmentation methods. Parameters ---------- n_segments : int Total number of segments. """ def __init__(self, n_segments=...
98b006577613e2bf8ee5f2aee8dd3c3a1bf8ad83a8d1308f1ef6cd1926cbc76f
Python
4,904
119
import os import numpy as np import pandas as pd import cc3d import datetime import pickle from filehandling import read_nifti, write_nifti def load_cached_brain(settings, brain): """ Check if we already performed a costly connected component analysis If so, return the name of the file (contains the numb...
e9eef48965f05e273a35a1636ad3a7d7c486e075d0dafee572898c0e7dc381fa
Python
4,905
163
import os import pandas as pd import yaml import numpy as np import shutil dataset_root = "/path/to/your/dataset" image_root = os.path.join(dataset_root, "train") export_root = os.path.join(dataset_root, "export") num_clients = 4 iid = False alpha = 0.5 seed = 0 n_classes = 4 class_names = [ "CNV", "DME", ...
8d4d2efbc509e618a46bd7125bb262045e26b8d9ade56b26c754b6ca4370ff10
Python
4,907
134
#!/usr/bin/env python # coding: utf-8 # In[1]: from __future__ import print_function import warnings warnings.filterwarnings('ignore') import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} import keras print("keras = {}".format(keras.__version__)) import tensorflow as tf print("tensorflow-gpu ...
b7d8c94e8790507c93f3af8c3fd345bec224e6b1a2358218f2285d17432484a1
Python
4,907
169
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import argparse import pathlib from argparse import ArgumentParser from typing import Optional import h5py import numpy as np from runstats ...
475b96819d7967efc0e12a02893654374f316fc4815b0d1ecde80dbd725f2643
Python
4,909
177
"""Common utilities for Numba operations with groupby ops""" from __future__ import annotations import functools import inspect from typing import ( TYPE_CHECKING, Any, ) import numpy as np from pandas.compat._optional import import_optional_dependency from pandas.core.util.numba_ import ( NumbaUtilErr...
1e8af0c6d8ff724601803bf85d803983e818f32e4b543b337caf3c3583a9d265
Python
4,914
92
# -*- coding: utf-8 -*- """ wrapper for resampling and registration with Slicer """ import os import numpy as np from ..inout.inout import spacing_from_directions from app.utils import get_exitcode_stdout_stderr, cast_to_type, end_execution, wrap_string import nrrd import logging logger = logging.getLogger(__name__) ...
2df707ff72b84bb490a80006316dea2f7bb1ae941756cb24533560141ce77f97
Python
4,914
176
# -*- coding: utf-8 -*- """ Created on Wed Jan 25 14:19:27 2023 @author: jeanbaptiste """ import os import copy import numpy as np import deepcellcontrol as dcc from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping import matplotlib.pyplot as plt #%% Parameters # Load default params: params = copy....
3d7136d5b1fb0b4a97b6ab8f374bf8a8273cfc0c941e66dcaf564376abc3c3dd
Python
4,914
110
################################################################ import numpy as np import matplotlib.pylab as plt import matplotlib.gridspec as gridspec import matplotlib matplotlib.rcParams.update({'text.usetex': False, 'font.family': 'stixgeneral', 'mathtext.fontset': 'stix',}) matplotlib.rcParams['pdf.fonttype'] = ...
35de67f6f5d74fb09550f7f758c75c63bd36020c24b3f0b25dc8a5aaa4b388d5
Python
4,915
176
import logging import argparse from datetime import datetime from torch import compile from sbrnet_core.sbrnet.model import SBRNet # from sbrnet_core.config_loader import load_config # Not needed anymore from sbrnet_core.sbrnet.trainer import Trainer # Get the current timestamp as a string current_time = datetime.no...
78a734ee2002d7333d225eaf5655dc1a7eb2fdf5211db991f4a9cf3a0d72ad86
Python
4,916
167
""" Tests that duplicate columns are handled appropriately when parsed by the CSV engine. In general, the expected result is that they are either thoroughly de-duplicated (if mangling requested) or ignored otherwise. """ from io import StringIO import pytest import pandas as pd import pandas._testing as tm def tes...
797d9f623883bf7adcce32752ad5dae58e6f9d753d32f42327c917bc438374a2
Python
4,916
72
config = { "experiment_folder": "/home/user/experiment", # Path to save outputs. Default: "/home/user/experiment" "simulation_params": { "scdata": "/home/user/experiment/data.h5ad", # Path to sc/snRNA-seq data, should be anndata "save_expr": True, "n_samples": None, # Number of samp...
0c0295b916ebee98d8b9cb829971437c6e1fd027f6105c1f4ca7c53b7ac072f5
Python
4,917
138
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: """ .. _metas_estimators_and_kernels: =================================== Combine CBMA kernels and estimators =================================== Collection of NIDM-Results packs downloaded from...
7782c85913277de380858f9047c6488d071429d1d1d732aec6edce8ca8239235
Python
4,918
128
"""Tests for `multimodal_ad.models.training`.""" from pathlib import Path from unittest.mock import MagicMock import numpy as np import pytest pytest.importorskip("tensorflow") from multimodal_ad.models.architecture import Cnn3DConfig, build_3d_cnn # noqa: E402 from multimodal_ad.models.training import ( # noqa: ...
6e2ee63e749803dd871b715de74a59805f1364feebb84222ec1f3e350439a029
Python
4,924
103
from ..utils import get_gene_tuples_with_ensg, PheWebError from ..file_utils import get_filepath, get_tmp_path from .. import conf import re, json, shutil from pathlib import Path import urllib.request import sqlite3 from typing import List, Dict, Iterable def get_genenamesorg_ensg_aliases_map(ensgs_to_consider: Ite...
bfcb72b39f52a060c1b22ae8af99c9dc47df4a5dc272f54f82e0e3b3849d5e23
Python
4,924
140
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 24 16:01:52 2022 @author: fm02 """ # plot results of concat_indivisual_SemCat_confusion-matrix_slurm import numpy as np import pandas as pd import pickle import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import sem from scipy ...
ce85d46287966fee5d7f5b73d3523420cb3074e26814134f7ab52498702eb2e8
Python
4,926
190
import functools import uuid import numpy as np import pytest import pandas as pd import pandas._testing as tm pytest.importorskip("odf") @pytest.fixture def ext(): return ".ods" @pytest.fixture def tmp_excel(ext, tmp_path): tmp = tmp_path / f"{uuid.uuid4()}{ext}" tmp.touch() return str(tmp) fr...
169617bc6a998f64006418bb9338eb214da510228434e72f16f4eaca7fc9b62a
Python
4,928
130
import multiprocessing import numpy as np import sys sys.path.append('..') from util import window_tools from util.stas_compute import * from util import stas_compute import allel from script_real_fev import write_real_ehhbase def write_stats_real(data_generator, fi,stats, gridNum, snpNum): with open(...
c02a9358f5c8a6e0f980110e1c939f23bb596d4dfb3e9de73e3f8e2ae70e95c8
Python
4,928
109
import argparse import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='Plot-Qualities.py', description="""Make informative figures from pre- and post-filtere...
315091ffed305f8b7d890630d5396a9e00c02651e2f9961783c2fdb4d363353d
Python
4,929
124
# 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...
a4bd8ab40fe8141910d54d51b2396c8750730fe3fd8cdb565c3e97908ff3440a
Python
4,935
142
###################### ### Import Library ### ###################### # My library from molgraph.dataset import * from molgraph.graphmodel import * from molgraph.hyperparameter import * from molgraph.testing import * from molgraph.visualize import * from molgraph.experiment import * # General library import os import a...
7a1b17b9ab6473d37facce02e719742e4e7341a2368bd84c086b5ab30100014a
Python
4,936
148
import os import numpy as np from math import sqrt from scipy import stats from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric import data as DATA import torch import matplotlib.pyplot as plt class TestbedDataset(InMemoryDataset): def __init__(self, root='/tmp', dataset='davis', ...
4b73fda21b8fd2bf67b11b247109ee1772d0d5f1dea66cd5227a0359637dac95
Python
4,937
174
""" @author: mkowalska """ import os import numpy as np import matplotlib.pyplot as plt from figure_properties import * import matplotlib.gridspec as gridspec from kcsd import KCSD1D __abs_file__ = os.path.abspath(__file__) def pots_scan(n_src, ele_lims, true_csd_xlims, total_ele, ele_pos, R_init=0.23...
a68fb03b30175d9374a780ece5c10254fb94227f8ab1bac11f3fb641298cc2c5
Python
4,937
139
""" .. module:: tool_polygon :platform: Linux, Windows :synopsis: Polygon tool (2D only) .. moduleauthor:: Fredrik Nysjo """ from tool_common import * import numpy as np import scipy as sp import scipy.sparse import scipy.sparse.csgraph import scipy.ndimage import glm class PolygonTool: def __init__(self...
c00a426ce3b6799adcbf6a4d0e78a2711066a4a1a4e8e0c8d2030ab744cc83bc
Python
4,937
125
# %% [markdown] # # Different ways to obtain the trajectory # This example builds upon the <project:direct_reconstruction.ipynb> example and demonstrates three ways # to obtain the trajectory information required for image reconstruction: # - using the trajectory that is stored in the ISMRMRD file # - calculating the t...
bb70bca3764901f76c94ed2c5ad613e874d8723e69aa7e6a7bd27056215c8645
Python
4,939
131
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
4f56464133f293c5504cb46bf9891e9805616632d25b5f3e14d5ab670c6c1889
Python
4,941
142
import h5py import numpy as np import matplotlib.pyplot as plt from skimage.metrics import structural_similarity as ssim from skimage.metrics import mean_squared_error import os DIR = os.path.dirname(os.path.realpath(__file__)) print('> current directory: ', DIR) # %% read in files # fully sampled f = h5py.File('re...
c40a0a1aba3370adf723c1cd504c291fd96934b58e122f3f45c0e34b22731a29
Python
4,942
150
import os import torch from datetime import datetime from collections import deque from onmt.utils.logging import logger from copy import deepcopy def build_model_saver(model_opt, opt, model, fields, optim): # _check_save_model_path save_model_path = os.path.abspath(opt.save_model) os.makedirs(os.path.di...
8f32181773e143893ca4a0b1795ba75c4a81b944e73e1567e01273763d23377a
Python
4,943
157
from __future__ import annotations from datetime import ( datetime, time, ) from typing import TYPE_CHECKING import numpy as np from pandas._libs.lib import is_list_like from pandas.core.dtypes.generic import ( ABCIndex, ABCSeries, ) from pandas.core.dtypes.missing import notna if TYPE_CHECKING: ...
642223122c3021d53ffcb5f919d571b58e665b650391b41a75fbe2537874e291
Python
4,948
148
import numpy as np from pandas import ( DataFrame, Index, MultiIndex, Series, date_range, period_range, ) class Reindex: def setup(self): rng = date_range(start="1/1/1970", periods=10000, freq="1min") self.df = DataFrame(np.random.rand(10000, 10), index=rng, columns=range(...
9492f5e875a2fb08887dc5bbd78faeef36dc2de87beb88a0a0f0ff5eef1b609d
Python
4,950
142
###################### ### Import Library ### ###################### # My library from molgraph.dataset import * from molgraph.simplemodel import * from molgraph.hyperparameter_simple import * from molgraph.testing_simple import * from molgraph.visualize import * from molgraph.experiment import * # General library imp...
f36d06be5184bdc2544cf69674c029cb7b6ffbf1f1b26f659b4972e3191da0af
Python
4,953
156
from typing import List, Tuple, Optional, Callable, Union import torch from math import log, sqrt from .types import DeviceType GAUSSIAN_FWHM = 1 / (2 * sqrt(2 * log(2))) SINC_FWHM = 1.206709128803223 * GAUSSIAN_FWHM def resolution2sigma(rx, ry=None, rz=None, /, isotropic=False): if isotropic: fx = fy = ...
3d35fc54ea3b46cfa2587c27bf4ccb9eba6bf8e7e114fce09ab27dde8f971d22
Python
4,954
142
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "op, expected", [ ["sum", np.int64(3)], ["prod", np.int64(2)], ["min", np.int64(1)], ["max", np.int64(2)], ["mean", np.float64(1.5)], ["median", np.float...
0ccce03f6b8428de76a5ed61165f708d6546995f0c591289af24756a25af2d53
Python
4,959
149
""" Tests for DataFrame.mask; tests DataFrame.where as a side-effect. """ import numpy as np import pandas as pd import pandas._testing as tm class TestDataFrameMask: def test_mask(self): df = pd.DataFrame(np.random.default_rng(2).standard_normal((5, 3))) cond = df > 0 rs = df.where(con...
fb1063daff2fa0cff52a401116fae6259748bcdbe7ae1d58f430bc38598ce110
Python
4,960
114
# 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...
0415de7109fa706db9525cec5cef6b8dfd2af4f80ce1b024daffcc5d9f3a6a50
Python
4,962
169
"""Experiment template CRUD. A template captures a known-good ``setup_params`` + plan defaults that a user can pick from on the New-Experiment screen instead of filling out the dynamic form from scratch. Routes: GET /workspaces/{ws_id}/experiment-templates POST /workspaces/{ws_id}/experiment-templates GET...
558082914bc6575113782d74d4f2162ad851b5ca2364861d6ad7ee3f00240d5c
Python
4,963
128
# 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...
16b3eb0ed3d77b8b49bb9f6a10f8186e9084da152f9445fd32a2941f37ae98e4
Python
4,964
104
import argparse import textwrap from pgen.esm_sampler import ESM_sampler from pgen import models from pgen.utils import parse_fasta, RawAndDefaultsFormatter, unalign from pathlib import Path import sys import tqdm import math POSITIONAL_SCORE_SEP=";" model_map = {"esm1b":models.ESM1b, "esm6":models.ESM6, ...
9737c7e75227adeb8c9835809234698f4f5c935c9e405c14587989c836a7ebeb
Python
4,966
165
"""Audit-log viewer routes. Two surfaces: - ``GET /admin/audit-logs`` — installation-wide, superuser only. - ``GET /workspaces/{workspace_id}/audit-logs`` — workspace-scoped, workspace admin or superuser. Both support pagination (``limit``, ``offset``) + filters (``action``, ``user_id``, ``target_...
cbdf174225e71c84ffc4e3cafa470dd6e73c69205315476645335f3e1d1e6c7f
Python
4,966
114
import argparse import os import json import random from multiprocessing import Pool from sklearn.model_selection import train_test_split from tqdm import tqdm import numpy as np import pandas as pd from utils.interface import cal_interface_worker from utils.encode import encoding_worker from utils.dataset import sa...
36fe36272046e6a92211d6286072535371edf803988ae1a9941143ad52406936
Python
4,967
117
from datetime import datetime from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau from models.model import get_net import tensorflow as tf import os from training import load_data, VolumeDataGenerator from models import input_dim from utilities.utilities import * if __name__ == "__ma...
3fded205fa0f95c8c2c90dfe0c804e7277c283dd106932209a4316c54289d60d
Python
4,969
167
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Created by Roberto Preste # # mtoolnote documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration va...
e33234d929d783f2c186c2132bc73acf93e7f64e8c4e59a51806b05e4b63a475
Python
4,969
128
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_le...
48355927fce8fabcec126117e91e6e9df8fccb20ae4d6bc47f2572559830082d
Python
4,973
169
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def simple_multiindex_dataframe(): """ Factory function to create simple 3 x 3 dataframe with both columns and row MultiIndex using supplied data or random data by default. """ data = np.random....
909adffc3cd96995e6f44db1adc5cfd23a558125a24d73faa4fe1f373f7457df
Python
4,973
107
"""Tests for `multimodal_ad.models.architecture`.""" import numpy as np import pytest tf = pytest.importorskip("tensorflow") from multimodal_ad.models.architecture import ( # noqa: E402 Cnn3DConfig, build_3d_cnn, build_fusion_model, build_mri_input_model, build_pet_input_model, extract_featu...
fcf204b1cd0830fcb08087cba41813ecea2ebdc2128ca08103d5561be841b7f3
Python
4,973
162
import numpy as np import pathlib import dclab from shapeout2.gui import pipeline_plot datapath = pathlib.Path(__file__).parent / "data" def test_compute_contour_opening_angles(): contour = [ [0, 0], [1, 0], [0.5, np.sqrt(3)/2] ] plot_state = {"general": {"range x": [0, 1], ...
12949f7b0d92b8863a4eb15760d1540f37a78fab8008d1a7c7c0ede43d687e1a
Python
4,976
172
import codecs import locale import os import platform import pytest from pandas._config.localization import ( can_set_locale, get_locales, set_locale, ) from pandas.compat import ( ISMUSL, WASM, is_platform_windows, ) import pandas as pd _all_locales = get_locales() _skip_if_only_one_local...
c81a124c16d1eb1143c5ab5d3a36f434fd1e6f6f1823d030e09bf3ecb3ea0c68
Python
4,978
136
# Could do old one based on # https://github.com/mabdullah1994/Text-Classification-with-BERT-PyTorch/blob/master/Classifier.py # Instead just use Pytorch Lightning from pytorch_lightning.callbacks.early_stopping import EarlyStopping from pytorch_lightning.utilities import rank_zero_only from pytorch_lightning.loggers i...
631fb07e9991c9319c747f705951451c5af1f5bac0a72d1016cf1f8d50e35070
Python
4,979
147
''' check_neuronmetadata.py This program will check entries in jacs:emBody with nueronbridge:neuron ''' import argparse from operator import attrgetter import sys import inquirer from tqdm import tqdm import jrc_common.jrc_common as JRC # Configuration EDEFAULT = ["fib19", "hemibrain", "hemibrain:v0.9", ...
45c8ae8ba3ec65e538e6e7f95fc982aa08b9c892d3728871f4a4b2d45d160117
Python
4,981
148
import pytest import pandas as pd mpl = pytest.importorskip("matplotlib") plt = pytest.importorskip("matplotlib.pyplot") from pandas.plotting._matplotlib.style import get_standard_colors class TestGetStandardColors: @pytest.mark.parametrize( "num_colors, expected", [ (3, ["red", "gre...
d7aed1523f6e41299f43ddca1e1e339ffcce969aacb23013547ec06ed9a868c3
Python
4,981
120
import torch from torchvision import datasets, transforms from tnn.layers import Permute, View, LinearLayer from tnn.networks import tFullyConnected from tnn.loss import tCrossEntropyLoss from tnn.training.batch_train import train from tnn.tensor_utils import dct_matrix, random_orthogonal from tnn.utils import seed_eve...
1b2517e0f0f939636388961a44b59b9d84c07b840ce7e3705814d4a9f25cccaa
Python
4,984
139
# This module is mostly borrowed from Olivecrona original implementation # (https://github.com/MarcusOlivecrona/REINVENT). # We adpted it to pytorch0.4.0. # # Shuangjia Zheng, Aug 2018 # import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from data_struct import Variable class Multi...
1ed3b0991ba17728abd41360dcf201d89270b627f869d121ea876f0c31c34199
Python
4,988
111
import sys import numpy as np import matplotlib.pyplot as plt from game_functions import Game, Game_Bayes import color_palette as cp from game_functions import percentile_discrete from os.path import join def mean_squared_error(act, pred): diff = pred - act differences_squared = diff ** 2 mean_diff = differen...
2e82a81329e3046793fe44da5ea229798fe4aa08719474fd7d94f75506998a5b
Python
4,988
91
# 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...
4be16e505bad1da3713326879b4cda00b181f59c621fc13b1a8cb18c8447f42d
Python
4,988
178
# 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...