sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0058416ec4e6b5d64439dec733525910daedde802c45b07dd404cf159b5324bf
Python
8,209
247
import argparse from operator import itemgetter from pathlib import Path import json import typing from functools import partial import numpy as np import pandas as pd from tqdm import tqdm BOX = typing.Union[ np.ndarray, typing.List[typing.Union[int, float]], typing.Tuple[typing.Union[int, float], ...], ...
69cb69efc81894e4062c3381d84db595cf58b93c74b9eb56d60649e32f875132
Python
8,210
220
# --- # jupyter: # jupytext: # cell_metadata_filter: -all # custom_cell_magics: kql # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.11.2 # kernelspec: # display_name: everything # language: python # name: py...
f0e4c3258b5fa0da24848a5175759f8f9efb80625c682e0278461bf0803763f7
Python
8,210
187
############################################################################# # C. Jarne 204 Analysis Group of D. Vidahurre @cfin # # # # Code to generate scatter plots of the actual ages vs. predicted age # # where t...
6694edf45a7afab4aa6ee4928d7a831d10d04941b9d769f06041d3cc7315f6bb
Python
8,211
196
import math import torch from torch import nn from torchdrug import core, data from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("layers.GraphConstruction") class GraphConstruction(nn.Module, core.Configurable): """ Construct a new graph from an existing graph. ...
d3b7f7e422c70148eb40ae6ed976e34be8c744dcd66f93ba73aa472491d498a2
Python
8,211
227
from enum import StrEnum from math import degrees, radians from typing import Sequence import bpy import numpy as np import numpy.typing as npt from mathutils import Matrix, Vector from .. import framing class Viewpoint(StrEnum): DEFAULT = "default" FRONT = "front" BACK = "back" TOP = "top" BOTTOM...
9284024fbbb3e70553546cbe81db0514f1503b919f221734e895186c85f9574f
Python
8,212
248
"""distutils.file_util Utility functions for operating on single files. """ import os from .errors import DistutilsFileError from ._log import log # for generating verbose output in 'copy_file()' _copy_action = {None: 'copying', 'hard': 'hard linking', 'sym': 'symbolically linking'} def _copy_file_contents(src, ds...
136849afd8e76c1328aae3f4d29900f0c4bb9247f3fe6b5ce4aad3585b938de4
Python
8,214
236
"""Smoke tests for tissue_masking.core.io. Per audit, this module had no dedicated test file. The MaskingPipeline itself is tested in test_tissue_masking.py but the lower-level I/O helpers were not exercised directly. Public surface: - ChannelInfo dataclass - discover_channels filesystem disco...
79927910fb42f4c47095eef6c516a28ab81960ebee036b6409877740706a82a2
Python
8,214
255
""" Go through the PDB files of biounits and select protein chain pairs that have a certain number of residues within a threshold distance from each other. Originally taken from GDockScore code base. """ from Bio import PDB import numpy as np import pandas as pd from scipy.spatial import cKDTree import os import ite...
9dd11bcaf6b32b36efa780cc98df1cee2bb71a91a8defe9876393a38316b6b0a
Python
8,214
257
import os from pyclamp.dsp.iofunc import * from pyclamp.dsp.lsfunc import * from pyclamp.dsp.channel import chWave class TDF: readFunc = {'.tab':readDTFile, '.tdf':readDTFile, '.tsv':readSVFile} dataFunc = {'.tab':readDTData, '.tdf':readDTData, '.tsv':list} writeFunc = {'.tab':writeDTFile, '.tdf':writeDTFile, '....
fc2494eeb484cdd5573ba356f97775a4d33e4bb7aab5e5a2a752e6b50e9af905
Python
8,214
279
""" Code to perform model fitting for simulations (i.e. given X and y, fit a model to predict y from X). """ import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import GridSearchCV, RandomizedSearchCV...
47d6dc48e244a2ee0f7d85c8160b37e87e9f62c6b996cd9652c725caf8350c40
Python
8,220
271
#!/usr/bin/env python # encoding: utf-8 # Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md from __future__ import print_function, division import time from datetime import datetime from dateutil.relativedelta import relativedelta import numpy as np import...
c6bf1bbf18f818dc8b6f54a215e6bf167e6cb0c6320436256892ec8dbf4cc296
Python
8,221
232
import torch from torch import nn from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.layernorm1d.design import ( LayerNorm1d as LayerNorm1dDesign, ) from elasticai.creator.nn.integer.math_operations import MathOperations from elasticai.creator.nn.in...
971e98a8e983c4516e90a7d60994f4c352b871de70b89db5790a6030f0203cae
Python
8,222
236
import numpy as np from scipy.integrate import simpson from scipy.interpolate import CubicSpline from .math import r_to_xyz, spbessel_transfrorm, spharm_xyz # == radial grids == class GridFunc: ''' This is the class for functions that can be separated into a radial part and angular part. ''' def __in...
070380e5cfb4e38c9b180d7cb4b9d7777d0f3fb4df4b8e2ff4c84f6111f98701
Python
8,224
264
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math from functools import partial __all__ = [ 'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnet200' ] def conv3x3x3(in_planes, out_planes, stride=1, dilatio...
dd3b8c0a4e9dc0c88df768c2d5c12df61ef6814acae8f6788707b97a8f3355b6
Python
8,224
149
import os import unittest from hed.models.sidecar import Sidecar from hed.models.tabular_input import TabularInput from hed.schema.hed_schema_io import load_schema_version from hed.tools.analysis.event_manager import EventManager from hed.tools.analysis.hed_type import HedType from hed.tools.analysis.hed_type_factors ...
023cca40009c06d3ab24d657f60e15de6591e62834066004ce3af1523422f287
Python
8,225
182
from typing import Union, Dict, List import numpy as np from ..base_transform import EEGTransform class MeanStdNormalize(EEGTransform): r''' Perform z-score normalization on the input data. This class allows the user to define the dimension of normalization and the used statistic. .. code-block:: pytho...
d2134022308a96b255ce020cc24be9800f06e75d28b16898f255bf6a6c58dbf2
Python
8,228
138
import math import numpy as np import torch import torch.nn.functional as F from torch import nn from scipy.stats import beta from utils.geometry import axis_angle_to_matrix, rigid_transform_Kabsch_3D_torch from utils.torsion import modify_conformer_torsion_angles from utils.affine import T def t_to_sigma(t_tr, t_ro...
1ffa11e979acdc53e2874742861c3c591b3634f5646fd3b3de195b6d4e6ab3c9
Python
8,230
205
import argparse from loader import BioDataset from dataloader import DataLoaderFinetune from splitters import random_split, species_split import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as np from model import GNN, GNN_graphpred from ...
22a9bb2c063a5af7b173f5ef0bb3afa1765d4c058046fd784665713e9e393fbd
Python
8,232
220
# -*- coding: utf-8 -*- import logging import os import pickle import sys import time import warnings from argparse import ArgumentParser from pprint import pformat, pprint import numpy as np import tensorflow as tf from tfsnippet.examples.utils import MLResults, print_with_title from tfsnippet.scaffold import Variabl...
bd98354ebf2c6ba11cb1010355286e3cde8dee2777cb5567f4b27100887fed5b
Python
8,235
190
""" Script to run tumor purity prediction experiments for the specified holdout cancer type(s). """ import sys import argparse import itertools as it from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import pancancer_evaluation.config as cfg from pancancer_evaluation.data_models.tc...
6d0756e10b266ad07086b519cfa066da872825dc028af7431aadbbf62dc2d5f5
Python
8,237
196
""" Standalone GUI for the U01 registration workflow. Andy Thai andy.thai@uci.edu """ import os import sys import argparse # Ensure project root is on sys.path for module imports from regtools import get_project_root _project_root = get_project_root() if _project_root not in sys.path: sys.path.ins...
d638b78fdfb52516924fd51e0c6bb661c22ff4a52510c532cd8fb380730a6cdf
Python
8,238
158
import numpy as np def get_patterns_of_interval(interval_values, verbose=False): ''' Given an interval as a series of values, calculate its basic patterns. Returns: - mean (float) The mean value of the interval. - std (float) The standerd deviation of the values of the inte...
4ddfcfbcf74ab73218742326f95aa8703b1815a66676913c247140e4828d61b8
Python
8,240
162
########################################################################################## # This Script # 1) imports the preprocessed resting state data # 2) add stimulation trigger and remove the 'stimulus artifact' iv: -1.5 to 6 ms, for ESG use -7 to 7s # 3) downsample the signal to 100...
cc5879bb96edfc2da85525d02634415408dcbd2d5f8033ed61aa60cee1b54351
Python
8,240
206
""" Add segmentation labels to GraphMCF objects in a STAR file which pairs them with the segmentation Input: - The STAR file Output: - New graph are pickled with the segmentation information """ __author__ = 'Antonio Martinez-Sanchez' # ################ Package import import time import pyseg as ps ...
03b026c8397e83ca6ee1df16577a410287a7ccdd7c500faf5081e9e4e636b10d
Python
8,241
139
import matplotlib matplotlib.use('TkAgg') # Set the backend for matplotlib import os import scipy.io import pandas as pd from Functions.f_AnalysisGraphs import * from Functions.f_AnalysisFunctions import * # Set flags to control the behavior of the script s_PlotSaveBandEvolution = False s_PsdEvolutionAllp...
09a9a5ccf47178a8bed719d95fee8b8b76161794bbda4053e5a4da3d6fb480c9
Python
8,241
215
""" Motion correction using calblitz https://github.com/agiovann/CalBlitz (c) 2016 C. Schmidt-Hieber GPLv3 """ import time import sys import os import numpy as np import tempfile import multiprocessing as mp import glob from sima import motion try: sys.path.append(os.path.expanduser("~/CaImAn/")) import caima...
4f94e9222ec535f880ecd7f2ca8d698cc8ad67e7630bf253bdad19863a1e5cc2
Python
8,241
189
import os import sys import re import argparse import pandas as pd import numpy as np from datetime import datetime, timedelta from passlib.hash import bcrypt from ckg import ckg_utils from ckg.graphdb_connector import connector from ckg.graphdb_builder import builder_utils try: ckg_config = ckg_utils.read_ckg_c...
2ac730738a691a8d697cc3a1d9ee9cb096e9ec0b2e3d65bec7154b8a50607b45
Python
8,242
271
from PyQt5.QtWidgets import (QAction, QComboBox, QToolBar, QToolButton, ) from PyQt5.QtCore import QEvent, QPointF from PyQt5.Qt import QMouseEvent, Qt from wonambi import Wonambi from wonambi.trans.reje...
9e8dbec227a273bd9188729c03d66f0d2fe89017bf241578af1adca5bfa369bd
Python
8,242
245
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from tqdm.auto import tqdm from scipy.sparse import coo_array from ...utils import printv class EffectiveConnectivity: """Linear model of the effective connectivity. This class implements a simple linear model of ...
13b7ff21c589df05c6ddb3dca3d3e55a31e85a479015333159eeb116efb88b43
Python
8,243
212
import numpy as np import torch import torch.nn as nn from torchvision import models import math def calc_coeff(iter_num, high=1.0, low=0.0, alpha=10.0, max_iter=10000.0): return np.float(2.0 * (high - low) / (1.0 + np.exp(-alpha*iter_num / max_iter)) - (high - low) + low) def init_weights(m): classname = m._...
3f3ce7a5ca44375495ad982e89d95fd5a5ed4f11974b087ab6362d7968d1ea26
Python
8,243
187
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
f172087a75cfd6840def1e271045a1cbd07489e1b1901c400f4dfcdc13391717
Python
8,243
194
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
822c63e84afd6712a560a9a63fac1b46033ea69c24140b2836e7eb8ee67bcb2c
Python
8,244
177
import numpy as np from typing import List, Tuple from sklearn.decomposition import PCA from scipy.spatial.distance import euclidean # Implementation of https://www.biorxiv.org/content/10.1101/2021.03.21.436284v1.full.pdf # that computes the statistics of manifold geometry relevant for few-shot classification # modifi...
fa4bfb7b52bfcb5a6b450cb1e43d3b51e173bdf540302c4012d370ca35a210e5
Python
8,248
185
"""The shared tissue-threshold helpers used by both masking consumers. The 2D registration foreground and the standalone tissue-masking tool derive a threshold the same way and live in different packages. They share this module rather than duplicating, because duplicated masking logic drifting apart is a failure t...
70c6e2b0b5489744baf0835e4573d2716ecbec4c560561c83750ae7a06a12c17
Python
8,249
204
from math import pi import numpy as np import scipy.special as sp from .. import config as CFG from ..utils.misc import slice_same from ..utils.orbutils import LinearRGD, GridFunc from ..from_gpaw.gaunt import gaunt from ..matao.matao import MatAO from ..matao.findpairs import pairs_within_cutoff class TwoCenterIntg...
7141953cae76141128a7701b50de9a7156e4547e18edfaeb65d77c2cf084c2fa
Python
8,249
204
# -*- coding: utf-8 -*- import os from typing import Dict, Iterable, Set, Union import torch from supar.config import Config from supar.models.const.aj.model import AttachJuxtaposeConstituencyModel from supar.models.const.aj.transform import AttachJuxtaposeTree from supar.parser import Parser from supar.utils import ...
bce613820a012d6fe9473d691173b09ee8dce7d3d4e4fe5b13c8cccef60d4ff7
Python
8,250
268
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from siren_pytorch import SirenNet, SirenWrapper from core.models.Embedder import * from core.utils.Coord import Coord from glbSettings import * class Model: def __init__(self, model_type:str, *args, **kwargs): ...
30c4f9422155ca6cd8b7bd21231a0ac46a46ac8ab253f387731fadd87e311d8c
Python
8,251
215
import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pytest from scipy.stats import CensoredData, chisquare, ecdf, kstest from SurvivalEVAL.evaluations.calibration.distributional import ( create_censor_hist, d_calibration, ksd_calibration, ) @pytest.mark.par...
410081e326a434fb0388de964906592834c189221c9695215cde22747bfc71eb
Python
8,253
324
import os import copy import tempfile import pandas as pd from ray import tune, air import analysis_utils as au import utils as u def test_analysis_v1(): if 'RAY_ADDRESS' in os.environ: del os.environ['RAY_ADDRESS'] """Test all neccessary functions/pipeline for analysis_v1.py """ local_di...
76af69cace18410ccc181db91ff2830b6b06a74ca90b4154286a59488d38bf90
Python
8,253
231
import pandas as pd import numpy as np import random import pickle import time def read_data(datafile, file_key, human=True, use_10x=True): amino_acids = [letter for letter in 'ARNDCEQGHILKMFPSTWYV'] all_pairs = [] def invalid(seq): return pd.isna(seq) or any([aa not in amino_acids for aa in seq])...
9e61b8ed84cdb1fb48789846344c01952086e26cf6f9762ca51de134c200ac50
Python
8,253
239
#!/usr/bin/env python # requires band_deeph.json and band_dft.json created by plot_bands.py import os import numpy as np import json import matplotlib.pyplot as plt import matplotlib.lines as mlines min_plot_energy = -2.5 max_plot_energy = 4 trim_gap = True trim_min = 0.1 trim_max = 1.0 fontsize = 22 legend = Fals...
c9c83edcced979fd043502d91600c164a45bd93f4fef9105ee4be85a7da52c47
Python
8,257
232
## # \file simple_itk_registration.py # \brief Class to use registration method based on SimpleITK # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Aug 2017 # Import libraries import os import numpy as np import itk import SimpleITK as sitk # Used to parse variable arguments to SimpleITK...
0ada866f82084fa881c338fe363493369b71e178a4db75451ae8f82af4785d7d
Python
8,258
198
#napsPrimitives.py from dreamcoder.program import Primitive, prettyProgram from dreamcoder.grammar import Grammar from dreamcoder.type import tlist, tint, arrow, baseType #, t0, t1, t2 #from functools import reduce #types PROGRAM = baseType("PROGRAM") RECORD = baseType("RECORD") FUNC = baseType("FUNC") VAR = baseT...
09af6057ac04a1a3d0aba4f1cec432d6482e36df9bc33f6731a149d3f29683bc
Python
8,259
246
from .config_node import ConfigNode config = ConfigNode() config.device = 'cuda' # cuDNN config.cudnn = ConfigNode() config.cudnn.benchmark = True config.cudnn.deterministic = False config.dataset = ConfigNode() config.dataset.name = 'CIFAR10' config.dataset.dataset_dir = '' config.dataset.image_size = 32 config.dat...
2e733ee0b946e016e2a6eb94acb658a7b46f61298884bd14d76045691aab0578
Python
8,260
303
#!/usr/bin/env python #****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
17e38d6c1b88ff13c51835b890b2d47c3c2c6f4de7cb444ece439674de65cd6b
Python
8,261
143
"""MARGIN_MAP.py 2026-10-01. Pre-registration: 04-NOTES/PREREG-2026-10-01c-MARGIN-MAP.md How much stronger must every synapse be before each sensory input explodes? Rate-theory margin g* for 128 sensory types x 2 sides under the published signs (O) and the laboratory prior (F4), whole brain, with a spiking check of 10 ...
2f8144a3b3aa43a2f3ca93b3efd566712d07f953a3b93353f770802b704b4f05
Python
8,261
175
import time from unittest.mock import patch, Mock, MagicMock import pytest from botocore.exceptions import ClientError from pydantic import ValidationError import NDATools from NDATools.upload.validation.api import ValidationV2Credentials, ValidationV2Api, ValidationV2 def test_pydantic_validation_errors(monkeypatc...
35c2ea97e922fa910e4a8023de74d6707a1dea902688bb1eab7d2c60d7cc2ea5
Python
8,266
174
import argparse from loader import MoleculeDataset import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as np #from model import GNN from model import GNN from sklearn.metrics import roc_auc_score from splitters import scaffold_split, ran...
b86b950120ce1c3e84246242562db150bdc61bb310187aae0ab8ad0caafe626d
Python
8,269
292
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
630e5b2e043683057db8fcaa09ea7a6bb7855e4388bf98995a9726609bc180e2
Python
8,272
193
import os import re from urllib.parse import quote, unquote from typing import Iterator, List, Tuple, Union, Dict import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset,...
b403b58ef9ad0c21591c1607c18e16beb14a1bfcbf5d642455b2e4d42bf8b11d
Python
8,272
205
# -*- coding: utf-8 -*- import os from typing import Dict, Iterable, Set, Union import torch from supar.config import Config from supar.models.const.tt.model import TetraTaggingConstituencyModel from supar.models.const.tt.transform import TetraTaggingTree from supar.parser import Parser from supar.utils import Datase...
fbe3cb484cafbf1bae81328a2ae8d38b09499505554fc2fdb4f02d202b8edbcb
Python
8,272
443
from __future__ import annotations from contextlib import contextmanager from dataclasses import dataclass from functools import wraps from pathlib import Path from time import perf_counter import csv import os from threadpoolctl import ( threadpool_info, threadpool_limits, ) # ============================...
336e10daecf1a214f727e568611f11d207622b54e5c01c9671b94da3b41e757c
Python
8,273
251
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
fe9982db048286d58362f1e313e17655674409c159675826701eb0c78090ab16
Python
8,273
206
from __future__ import division, print_function import math import torch from torch.autograd import Variable import scipy.io as scio from scipy import interpolate import numpy as np from scipy.ndimage.filters import gaussian_filter #%% def to_variable(var=(), cuda=True, volatile=False): out = [] fo...
4dcab1e3dc930e9d0e7044cc4ae14e423e1a11c02415c067bdd47f4e1f285f24
Python
8,279
327
"""""" import os from pathlib import Path from .reader import BaseReader, _load_dataset from .reader.motion import MotionReader from .reader.gaze import GazeReader from .reader.video import VideoReader, OpticalFlowReader from .device.video import VideoDeviceUVC, VideoFileDevice from .device.flir import VideoDeviceFLI...
7777fc83a07b166a0c003e4b25817c3d70d7e420c7c633ad49e6d783b1bc8551
Python
8,279
281
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Naren Wulan and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import torch import time import torch.nn as nn import numpy as np from torch.utils.data import DataLoader import os import itertools from sklearn.model_s...
d889d9e607d636a2e2ccef4dc1ed545e3be8d68de13c1fc74e7476134963eb1e
Python
8,279
235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ June 2024 by Paulien Voorter paulien.voorter@gmail.com https://www.github.com/paulienvoorter Code is uploaded as part of our paper in MRM: 'Diffusion-derived intravoxel-incoherent motion anisotropy relates to CSF and blood flow' """ # this loads all patient data and...
9c4a139b4171b5320761c70903a57bc54bac352cd71264fe847d99eef89d59ae
Python
8,281
266
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides a human agent to control the ego vehicle via keyboard """ import time import json from threading import Thread import cv2 import numpy as np try: im...
c9809880e0470088ac59cbd944b96e9e9d8276ad2064cb40480542ec5e86b28a
Python
8,281
179
"""First-run setup and launch for a downloaded LiquidAion release (Python standard library only). Started by the platform launchers (LiquidAion-Windows.bat, liquidaion-linux.sh, LiquidAion-macOS.command) through uv, which also provides Python 3.12. On the first run it creates a private environment in .liquidaion-env/ ...
a0ea3538804e4cc685c88e8ae277d86c7eb514ca1347b12046b19a8ae05aa597
Python
8,286
172
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
f815b4bf78787bba55faef3c55018c2fc5a76127da938e78a2b124446b0ed613
Python
8,287
305
#!/usr/bin/python # Gogulan Karunanithy, UCL, 2021 # Python code for decoupling 2D 'in-phase' CON spectra import copy import os import sys os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import matplotlib.pyplot as plt import nmrglue as ng import numpy as np import tensorflow as tf from tensorflow import keras # polic...
a2281657dabe9f9924930f0c00c1ccd815a6d3928ae8b298c19c5984d48374bd
Python
8,288
226
# ---------------------------------------------------------------------- # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or mo...
e51bffc11c075a82df1cba591d503678ad9cdc8a8c8472eaf37569253ddd7ea2
Python
8,288
137
import pandas as pd from scipy.stats import mannwhitneyu from scipy.stats import ttest_ind def compute_pvalues(coann_file, best_model, second_best_model, standards, metric='Average Precision', alternative='greater'): df = pd.read_csv(coann_file, sep='\t') df['Model'] = df['Dataset'].astype(str).apply(l...
b9863a16c8fa19e6160428bd9efea7932f995aceabac79b1ed7a97dddf210a56
Python
8,292
166
import torch from torch.utils.data import DataLoader import numpy as np from torch.autograd import Variable import time from src.Mice.utils import normalize_range, un_normalize_range, check_cuda from src.Mice.src_nn.Dataset import Dataset from src.Mice.src_nn.Network import Network class NOEMRFNetMT: def __init__...
4e40676aa43b3fc11afe1f1fcdd804fb879326a569b7e2b0788b2d2eb88f4a00
Python
8,293
264
# -*- coding: utf-8 -*- """ Created on Fri May 24 14:42:38 2024 @author: mpolonen Used to pick peaks of the modeled ABRs """ import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from expyfun.io import write_hdf5, read_hdf5 import scipy.signal as sig im...
b19bb6d965e23291358e75956b3e62f1d793aa295db84a2e23dfa89fa3407a70
Python
8,294
185
deprecated_params = dict(k='inflection_point', f='smoothing', noise_level='noise') def update_param(name, param): if name == 'columns_to_encode': param['ptype'] = '[U(str, [str])]' param['dtype'] = 'List[Union[str, List[str]]]' return param return None # param untouched def class_ex...
ff690e5ca6f69cb20f13be928a9445a21eb856655bc6cab5ee955bf0b592f328
Python
8,298
170
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
18adc9651be56ff443511231a845556779d080409beb54bb80ebba44ab37cbb4
Python
8,299
92
"""ONE_PAGER.py 2026-09-30. One A4 page: the headline result, one figure, the key numbers. Every number is read from an output file listed in 04-NOTES/CLAIMS.csv. usage: python ONE_PAGER.py ["Author Name"] -> REPORT/ONE_PAGER.pdf (+ .png preview)""" import sys, re, textwrap import matplotlib matplotlib.use('Agg')...
2d4d00ebf89daebd588d49c3a88dbadbf1c4bea66492395eea519b407065d28e
Python
8,299
182
from optparse import OptionParser from math import factorial import sympy ### help and usage ### usage = "usage: %prog [options] args" description = '''Function: prepare the input table of SNP allele frequency for TreeMix''' version = '%prog 09.29.2021' parser = OptionParser(usage=usage,version=version, description =...
843a2a718b30bc9f3b54e1c604670fe11d25692a03b7357105a266b457b2421b
Python
8,300
178
""" PLACEMENT_TYPE_NULL.py written 2026-09-23. Pre-registration: 04-NOTES/PREREG-2026-09-23-PLACEMENT-TYPE-NULL.md (written before this ran). Two attacks on Ch 6 that PLACEMENT_DECISIVE.py did not run: B0 remove the classifier: bench `known_nt` labels only, same neuron-level in x out null. T1 pseudo-replicati...
3d5dc8ff05143423108d1358113fdf51a8ba6b6cb71918fa2139e7c42624ce35
Python
8,302
220
# Some of the code is referenced from below Github files: # https://github.com/YudengLin/memristorBDNN, which includes `BDNN_Model.py` and `memristor_model.py` import torch.optim from bnnsrc.base_net import * from torch.utils.data import DataLoader import matplotlib.pyplot as plt from optimizers import * import torch....
7019ac48e11c0f15e983dbe5a7b1e34333ca74b0b532332a08dcb79c88807d6c
Python
8,302
242
from __future__ import annotations import logging import os from pathlib import Path from shutil import copytree, move import pytest from ase.io import read from maggma.stores import MemoryStore from monty.json import MontyDecoder, jsanitize from quacc.calculators.vasp import Vasp from quacc.schemas.vasp import Vasp...
68f23c95ae188c708bea9bfbe1ba38f98e2eeac182a1fe63bb83efba8f5e26e3
Python
8,303
212
"""Implementation of CLI measure command.""" import json import math import multiprocessing as mp import os import numpy as np from treem import SWC, Morph from treem.io import TreemEncoder from treem.morph import SEG, get_segdata from treem.utils.geom import norm def _measure_neurites(morph, morphometry, name, ty...
82f802e25eaefbe5b13c3343890af1473108198c27f014b029a0802422eb90f7
Python
8,305
217
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
9967fcb31b02d5c1fcfa713143bb476f8ba6f42114d22389b8403d7ecf8c0585
Python
8,310
219
# Node-group asset "Style Spheres" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING...
d02710601a8bad524e001512c51cf3dccd58fb5632f8f5b95cfd95ec887e11e8
Python
8,310
217
from math import isclose from pathlib import Path import numpy as np import pandas as pd import pytest import scanpy as sc from anndata import AnnData import pertpy as pt CWD = Path(__file__).parent.resolve() ag_rfc = pt.tl.Augur("random_forest_classifier", random_state=42) ag_lrc = pt.tl.Augur("logistic_regressio...
e3cd7fc19006b43bf8c91e8aaf64cadeffcaecabb46a36abaebecc806f77f76c
Python
8,310
188
import numpy as np import pandas as pd from scipy import optimize def get_resting_membrane_potential(voltage, current): voltage = np.array(voltage) current = np.array(current) index_end_resting = None for index in range(5000): current_difference = current[index+1] - current[index...
08ffcbf1305964955bd6d5cc49e47c2daecc2fcaa51ee7b3fb1543fedbdcfa49
Python
8,313
254
# Pyhton module for DCE-MRI postprocessing # # Copyright (C) 2014 David S. Smith # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any...
340898beb66a33e8ceec00fc2987a96513d87c6d033dfcaf8f191b362c1e3f1f
Python
8,313
241
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
8f7ea3bee9ddc7bde73491aae5b31cd5f905f6270b8226f18c20df238be8f2c1
Python
8,313
206
#!/usr/bin/env python # coding: utf-8 """ Author: Hermann F. Degenhardt <degenhardthf@nih.gov> Maximilia F. S. Degenhardt <frazaodesouzam2@nih.gov> """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import random, math, os, sys, json sys.path.append("../sr...
eeba2324a85ce83daaa6d6da703bff4afdce0e9bc043a9c5a4fa5f0fa3f37efb
Python
8,314
170
# coding=utf-8 # Copyright 2020 The Microsoft Authors and The HuggingFace Inc. team. # # 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 # # Unl...
4d7b3a5e949b702d3b9f877bad858f6ec8f5f628b42523df4525f751ba68ebfe
Python
8,315
181
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.data import Batch from torch_geometric.nn import SGConv, global_add_pool from torch_scatter import scatter_add from typing import Union, Tuple def maybe_num_electrodes(index: torch.Tensor, num_electrodes: Union[int, None] = None)...
3a1680dfc78812481c9fc67b1ee8bbdd49af7da4350808f65a0ae0019e725775
Python
8,316
235
"""BIDS utility functions for schema loading, sidecar merging, and inheritance chain resolution.""" import json import os import hed.schema.hed_schema_io as hed_schema_io from hed.tools.util.io_util import get_full_extension def get_schema_from_description(root_path): """Load the HED schema version declared in ...
da72ec4166cd727fee4121a5369c482a06859ec138a60f1b855e7909655d695f
Python
8,316
230
"""Modality-invariant descriptor ANTs registration drivers (MIND, SSC). Drives the deformable (SyN) stage in modality-invariant descriptor space while a conventional Mattes-MI affine pass handles the rigid+affine prealign. Both the MIND (centre-to-neighbour) and SSC (neighbour-to-neighbour) descriptor families sh...
138eded75b40e669a8d3888fb185f4335ae36c27251f5a9a952b744be732d547
Python
8,317
223
# Node-group asset "Style Sticks" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING,...
635b45406401ea4e77254c0bb53f123f035e57e2812d5158cca145e7d53e5e7e
Python
8,317
220
import torch import torch.nn as nn from sklearn.metrics import jaccard_score, roc_auc_score, precision_score, f1_score, average_precision_score import numpy as np import dill import time import argparse from torch.nn import CrossEntropyLoss from torch.optim import Adam import os import torch.nn.functional as F from col...
240404fa20252df1f9a87600b5bbafb049cfdd67c73ff794573291fbd272115e
Python
8,318
215
from collections import namedtuple from typing import Tuple, Any, Dict import os import torch import torch.nn.functional as F import numpy as np import h5py as h5 from atlaslib.io import stage_split_hdf5 from atlaslib.files import require_directory from plio.section import Section from cl_3d import utils from cl_3d...
53d60b15ab05143fd7df36c105f8911296538906b74aafe1652610bf2381c8fe
Python
8,320
324
import argparse import random import math import numpy as np import torch import torch.nn.functional as F from sklearn.metrics import accuracy_score from sklearn.metrics import roc_auc_score from sklearn.metrics import precision_score from sklearn.metrics import recall_score from sklearn.metrics import mean_squared_...
582153254612da794e6366b84d07d4f51bf84d362a1333cafe8c4faf70df0e1c
Python
8,320
190
"""manages the parameter sets for all models. all parameter are given without brian units except the ones that are used are used for brian2 simulations.""" def get_params(): params = dict() # runtime options # # reduced models params["rectify_spec_models"] = True params["uni_dt"] = 0.05 # [ms] ...
edb3ee282f365003ceb04a5300bac42e6c24e7289984ed715babdb4859f0a1c9
Python
8,320
243
from __future__ import division, print_function import time import numpy as np from sklearn.linear_model import Ridge def strf_correlation(strf1, strf2, max_delay=10): """ Computes the dot product between two STRFs across in a way that's invariant to frequency differences and time lags up to max_delay. ...
7aaa0b08e224f62e8567cb94a7e6741df97d07b15c4ff8cd112bd2488a389de5
Python
8,323
273
import numpy as np import pandas as pd import matplotlib.pyplot as plt import scanpy as sc from sklearn.preprocessing import normalize from sklearn.metrics import pairwise_distances import torch import scipy.sparse as sp from numba import jit from scipy.sparse import issparse def rank_genes_conf(adata, power=1, powe...
8b189ec2dfc4e7a99f422488b424a79ad36e6bc1120ff8a3efd7dbc751a33664
Python
8,325
238
import argparse import os parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('--vcf', dest='vcf', help='joint vcf with all mixed genotypes SNPs',required=True,type=str) parser.add_argument('--barcodes', dest='barcodes', help='for matrixgen mode: FILTERED barcodes file in sta...
6cf29c0cbd2a3395b56b0508886b19d92377cfc2b214a1345d45b0b5d8153983
Python
8,327
192
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # # 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/LICEN...
236f91ba8990a8aa6b62cc83517b523922dadf8bb3db36c33246844b8fd0ab7f
Python
8,328
223
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
8189e1a3e690b1e9c67b6794e8f6e97104c5a6a4100e61f8d7f6baead76d97d8
Python
8,328
231
""" PointCloud class. """ from pathlib import Path from typing import List, Optional import numpy as np import pandas as pd from scipy import spatial from . import utils class PointCloud(pd.DataFrame): """Class for working with point cloud data. Dev notes: - The PointCloud class is a child class o...
a6797b8c19bd0bccf14f1b912ed670f919bd47cdd7356e9413e1f8408cabf5b4
Python
8,328
235
# Script to run recursive feature elimination for feature selection for # classification of corticospinal wave preference try: from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() nhost = comm.Get_size() except ModuleNotFoundError: rank = 0 nhost = 1 import sys from os.path impo...
ff1aa2dc14fc56f3fdb07588d45ed5fafdcd35fc480c3f829733adf87788ae5a
Python
8,328
164
import os import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter from matplotlib.patches import Rectangle import numpy as np import seaborn as sns from scipy.stats import rankdata def plot_TCGA_results(results, xlabel, ylabel, save_name=None, show=True, stats=False): plt.figure(...
6b104d2842c71b5c6b04f5cf36f39155b5044d208175d931b16bc921f3f2a005
Python
8,333
199
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
a0f88440f3a82984d5f69ae287e4c8780ffd3a4e0b585e62da301c4f12fd3ada
Python
8,334
200
import os, argparse, time import pandas as pd from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import DataLoader from utils import * from loader import PretrainDataset from chem import * # model from models.siamese_network im...
29b80e13e2e4d18235c240c08a9977db6e84ffb9afa48470164efe9bd2fd1028
Python
8,335
216
#This is SpikeSPY V1.2.2 #------------------------------------------------------------------------------------------------------------ import bioread import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import plotly.express as px import plotly.graph_objects as go import plotly.io ...