sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9cbdb5d8050dc3406ed1a8def77f4cc127186c4f13f6a484c951e3cf3d81cfe5
Python
13,353
349
from collections import defaultdict from functools import lru_cache from flask import url_for from codex.configuration import MIN_SYN_THRESHOLD from codex.data.brain_regions import neuropil_hemisphere, NEUROPIL_DESCRIPTIONS from codex.data.neurotransmitters import lookup_nt_type_name, NEURO_TRANSMITTER_NAMES from cod...
bb3675b567e72978309036501bb554f02d53f3e45074cfd44ee7590cbf80c043
Python
13,355
422
import smbus2 as smbus import time import numpy as np import multiprocessing as mp import threading from PIL import Image, ImageDraw, ImageFont import adafruit_ssd1306 import busio class I2c: def __init__(self, is_values): self.is_values = is_values self.i2c = smbus.SMBus(1) self.co2_addr = 0x29...
8d4cc02fd64a10e500d7ae3b83354c85a70972e14ed7d433c678ab303e228dd8
Python
13,360
367
import warnings from rdkit import Chem from rdkit.Chem import AllChem from torchdrug.core import Registry as R # orderd by perodic table atom_vocab = ["H", "B", "C", "N", "O", "F", "Mg", "Si", "P", "S", "Cl", "Cu", "Zn", "Se", "Br", "Sn", "I"] atom_vocab = {a: i for i, a in enumerate(atom_vocab)} degree_vocab = ran...
5362da213a9f79c7121dd105671b73ca048f0fe4bb2b7a365eefab3dd6515bda
Python
13,363
406
# -*- coding: utf-8 -*- import itertools from functools import reduce from typing import Iterable import torch from supar.structs.fn import sampled_logsumexp, sparsemax from supar.utils.common import MIN class Semiring(object): r""" Base semiring class :cite:`goodman-1999-semiring`. A semiring is defin...
5f4fb5d9e66536c214a3e6dfb2fac4b5ed99905c292ed1de48c7f6504067d1f8
Python
13,377
382
import os import sys import json import h5py import copy import collections import numpy as np import pandas as pd import scipy.stats import textwrap import util_figures def get_color_and_label_from_model_tag(model_tag): """ """ if "human" in model_tag.lower(): color = "k" label = "Human ...
61bb811efeac65adf318d65c8b0fb0e201ff891289edee85f3ce828d8a6521aa
Python
13,380
299
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import os import numpy as np import matplotlib.pyplot as plt from scipy.stats import zscore from sklearn.decomposition import PCA import cv2 from fig_utils import * def fig6(root, alldat, save_figure=True): ...
6106159c0ccd25ee4d06069e8858147699a5408214f96f56f23f8f5a18600c0f
Python
13,381
359
from monai.transforms import Transform, Compose, LoadImage, EnsureChannelFirst import torch import skimage import torch import SimpleITK as sitk import numpy as np from PIL import Image from io import BytesIO import matplotlib.pyplot as plt import SimpleITK as sitk from matplotlib.colors import ListedColormap import ba...
d4f7d3d88416214ea77bbfc94331b5a66756ae37b4f9379ba90d94ab04c56890
Python
13,381
409
# 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...
c6eace110a6551aeab0ca63e872997a9f956f83250840adcbec9e4e07988f27f
Python
13,385
263
import dsmil as mil import torch import torch.nn as nn from torch.utils.data import DataLoader import torchvision.models as models import torchvision.transforms.functional as VF from torchvision import transforms import sys, argparse, os, glob, copy import pandas as pd import numpy as np from PIL import Image from co...
d60065af786407385adc263e09b47495afea3e2aa312a8b5b5aa5c983e8d7ec6
Python
13,385
263
import dsmil as mil import torch import torch.nn as nn from torch.utils.data import DataLoader import torchvision.models as models import torchvision.transforms.functional as VF from torchvision import transforms import sys, argparse, os, glob, copy import pandas as pd import numpy as np from PIL import Image from co...
a7eddcf37139f838e5905df91b43bdfa48d0469a1e8cffb6ff3d21c59f9ea25e
Python
13,387
432
# common.py from .core import * from .helpers import DelimitedList, any_open_tag, any_close_tag from datetime import datetime # some other useful expressions - using lower-case class name since we are really using this as a namespace class pyparsing_common: """Here are some common low-level expressions that may b...
3f065d16bd6b5a3188fd63fc32ed28fefe081b010b3488b7e48dc93c67a4d8a8
Python
13,389
332
""" Set of tests for adaptive exponential integrate-and-fire mean-field model. """ import unittest import numba import numpy as np import pytest import xarray as xr from jitcdde import jitcdde_input from neurolib.models.aln import ALNModel from neurolib.models.multimodel.builder.aln import ( ALN_EXC_DEFAULT_PARAM...
780db2b660bae86d7e8907d3eb91c18f76921d3913abbe07b24344e93a0d061d
Python
13,398
322
from torch.utils.data import Dataset, DataLoader import torchvision.transforms as transforms import random import numpy as np from PIL import Image import torch import os from autoaugment import CIFAR10Policy, ImageNetPolicy transform_weak_c1m_c10_compose = transforms.Compose( [ transforms.Resize(320), ...
8a21d1a5a92e1785a4562f122d7ae34598b82ce23e34b1997059f9aad162b9ca
Python
13,401
338
import os import glob import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset from torchvision import transforms from scipy.io import loadmat from cfg import parser from core.model import YOWO from core.utils import * from core.eval_results import * ####### Load configuration arg...
4d44dbad397732ffe4081a254be6ac6a3a48fc315b26ae84a9bc713c7606d945
Python
13,406
346
import torch from torch import nn from torch_cluster import knn_graph, radius_graph from torchdrug import core, data from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("layers.geometry.BondEdge") class BondEdge(nn.Module, core.Configurable): """ Construct all bond ed...
86b09999329ce2276c26519799a6069f65f7405b747b80e03247be719b7bc484
Python
13,408
364
# -*- coding: utf-8 -*- import itertools import os import platform import subprocess import sys from lab.environments import LocalEnvironment, MaiaEnvironment from lab.experiment import ARGPARSER from lab.steps import Step from downward.experiments import DownwardExperiment, _get_rev_nick from downward.checkouts imp...
7b1665c288b571a7604fefd6b70eafc4e78a1223185e295b42257123047f0d7c
Python
13,409
383
import numpy as np from bonito.nn import Permute, layers import torch from torch.nn.functional import log_softmax, ctc_loss from torch.nn import Module, ModuleList, Sequential, Conv1d, BatchNorm1d, Dropout from fast_ctc_decode import beam_search, viterbi_search class ModelTinyNoSkipX1(Module): """ Model templ...
48b546304467c5496694eb6c78049bfad6feee813fd5434bc2e9ea2b5192a690
Python
13,413
340
# # 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,...
834cb46a2e45d466f1ed9178f03a84f426e5694da54264e4400b43a8e66b90bb
Python
13,413
342
""" rCCA ==== This script shows how to use reconvolution canonical correlation analysis (rCCA, see [1]_ and [2]_) from PyntBCI for decoding c-VEP trials. The rCCA method uses a template matching classifier where templates are estimated using reconvolution and spatial and temporal filters using canonical correlation ana...
10a2f5426cc2750b036042853988854d93dbadaf129c419c43e6b8928907462d
Python
13,416
410
# pylint: disable=no-member, too-many-locals, too-many-arguments, too-many-instance-attributes, invalid-name, attribute-defined-outside-init, no-name-in-module """Training scripts""" from importlib import import_module import gc import os import time import warnings from pprint import pprint import math import torch f...
2a407c4f374a0cdf129e2ba9d25a87bb887a9d46b80cccf4e057d125f21023b4
Python
13,422
444
__author__ = "Ryan Galloway <ryan@rsgalloway.com>" __version__ = "0.1.1" # --------------------------------------------------------------------------------------------- # SUMMARY # --------------------------------------------------------------------------------------------- """The QRangeSlider class implements a hori...
6e82552cc4fe81714f6f8122b3c699474b4d32f44fbb5e337d8a6e46a9967f68
Python
13,424
470
"""Utilities for handling SMILES strings and RDKit mols and conformers. Author: Seth Axen E-mail: seth.axen@gmail.com """ import os import re import copy import logging from collections import namedtuple import rdkit import rdkit.Chem import rdkit.Chem.PropertyMol from rdkit.Chem.PropertyMol import PropertyMol from p...
b0f7f03ff1857d088a8eab135b7b17ff2bd4d9d3aab3933c76a0eb1da38edf84
Python
13,425
91
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benc...
c8b4c2093630d641e69266936216a411887513513894d3b629f30fe62a2498a9
Python
13,425
91
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benc...
9b3130f803bf2afc182d9162a39d0ef9ebf310bbbb27ba9418875a24650cddfa
Python
13,426
281
# Step 3 of 4: Create .sbatch and .json files for running TriDy # Directories for stroing the results will be created. # A file containing all the command to be executed is also created, named runfiles.sh. This can be executed with "bash runfiles.sh" # Temporary pipeline.py and toolbox.py files are created as well, to...
e4657ea3354df152b995d80711ebdd2791f04dfa9464c13cc5a09d7172bfee75
Python
13,428
397
import bpy import MDAnalysis as mda import pytest import molecularnodes as mn from molecularnodes.session import MNSession from .constants import data_dir def test_session_present(): assert isinstance(mn.session.get_session(), mn.session.MNSession) def test_persistent_handlers_added(): load_handlers = [hand...
fb39c4e1a170a87ac4e2f9007e13b5d4135b5c8cb89e44359e841dcdbf45abcb
Python
13,429
360
import os import shutil import tempfile from pathlib import Path from typing import TYPE_CHECKING, Literal import bpy from ..utils import suppress_stdout if TYPE_CHECKING: from .base import Canvas # formats an animation can be assembled into; matching is case-insensitive _ANIMATION_FORMATS = Literal["MP4", "GIF",...
0f699fee846441738b823e2c26535444390c0b85b09fbab1c45c831dd99d6585
Python
13,432
369
"""Ordered collections of schema entries representing a single section of the HED vocabulary.""" from hed.schema.hed_schema_constants import HedKey, HedKeyOld, HedSectionKey from hed.schema.hed_schema_entry import HedSchemaEntry, HedTagEntry, UnitClassEntry, UnitEntry entries_by_section = { HedSectionKey.Properti...
c55610589a4b00d39d49ed9d4787171ba3acdc015c1681f64eca25fdca7dd846
Python
13,432
409
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
d9971355a5f064fa9e32541cd09b2c2840b80bfabc1dba42a8bfd0f01cf70251
Python
13,434
390
import tracemalloc import numpy as np import pandas as pd import pytest from lifelines import WeibullAFTFitter from SurvivalEVAL import SurvivalEvaluator from SurvivalEVAL.evaluations.prediction_error import ( brier_multiple_points, brier_multiple_points_ic, brier_score_ic, ) from SurvivalEVAL.evaluations...
0a8886690d96e84b5080babe6d0642a6c067609fe395e145b253bf3ccfc00375
Python
13,437
345
""" Iterative burst detection on single-channel time-frequency or lagged coherence matrices algorithm. Authors: James Bonaiuto <james.bonaiuto@isc.cnrs.fr> Maciej Szul <maciej.szul@isc.cnrs.fr> Adaptation: Sotirios Papadopoulos <sotirios.papadopoulos@univ-lyon1.fr> """ import numpy as np from mne.filter imp...
204b1ad97ef7e6e4b7d9e99f626f454524a20c920f4227c128fe0e86284ceb2e
Python
13,437
406
# Copyright 2020 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 # # ht...
b92523913e6ff8b8d64c53a89c8fee403d4bbbcdec406013887c7aff99053ebb
Python
13,437
397
# 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...
27301a7c63dcddb4aec80d5df8c9495a264c1c0e3bef2208910f95f885e700f5
Python
13,438
346
import math, torch from torch.nn.parameter import Parameter import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn as nn class general_GCN_layer(Module): def __init__(self): super(general_GCN_layer, self).__init__() @staticmethod def multiplication(A, B): ...
d9203501517e38b7d1249e43dcb06dadb7c8d72a7eb76e8f89f3f60aba2ae267
Python
13,438
340
import getpass import time, os, sys from collections import Counter from copy import deepcopy from enum import Enum import numpy as np from wsilearn.utils.cool_utils import print_mp, print_mp_err from wsilearn.dataconf import DataConf from wsilearn.dl.np_transforms import NumpyToTensor from wsilearn.utils.df_utils imp...
5f890e0516170e2f473084b75fb326c7d4e739044a9c678a03a1a4b2fd817132
Python
13,441
248
import os import pysam from tqdm import tqdm import pandas as pd import numpy as np #%%# Summary site level data def geo_mean_overflow(iterable,epsilon = 1e-6): if len(iterable) == 0: return 0 return np.exp(np.log(iterable+1e-6).mean()) def read_sites(sites_f): putative_site_df = pd.read_excel(site...
a0c86ab37ee61a716c9918a6a2f7beffd6729e97501dfe589949951c1cc32143
Python
13,445
375
""" Geometry module that contains geometric functions """ # Copyright (C) 2021 Blue Brain Project, EPFL # # 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 3 of the License, or # ...
3515f17072577727047c02123e12df8b62213338dedb9bb59578a88e78d7a445
Python
13,448
288
# # 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,...
80165c4443521761b74311bf21a6ef4b5cce6dbd3e137106981dfb181bc484ba
Python
13,457
398
import os from abc import ABC, abstractmethod from typing import List, Tuple import numpy as np import pandas as pd from tqdm import tqdm from pathlib import Path import functools from wsilearn.utils.cool_utils import timer, showims, multiproc_pool2, showim from wsilearn.utils.df_utils import print_df from wsilearn.u...
ea4755d2cc94d8b3da295243458f66df5881ea961646699fcde5bb754d6b24ce
Python
13,459
294
# Copyright 2020 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 # # ht...
0e2c677397767c400c0ff9f592b943da94e3c5638de25e5acbc49aeba2cc3da5
Python
13,467
434
#!/usr/bin/env python # coding: utf-8 # ## Analysis of feature selection results; single-cancer holdouts # # For our "cross-cancer" feature selection method, we expect it to provide a performance improvement (or at least to be more resistant to drops in performance) "across" cancer types; or in other words, when a si...
99a86e504dd483c88536ecd489899dbc0fea66e43cd29e2b237bfd750d9e76f5
Python
13,467
395
#!/usr/bin/env python # -*- coding: utf-8 -*- from plot_methods import plot_signal_sum_colorplot, plot_signal_sum, plot_signal_power_colorplot, calc_signal_power from cellsim16popsParams_default import multicompartment_params import analysis_params import plotting_helpers as phlp import hybridLFPy.helpers as hlp from h...
f082e4378be043704a4e711dd9352f5004f224c629775f9d71da34dfb62351c8
Python
13,470
363
# 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...
19aba78bf151de249e7035b20e5bd92196cedfb6cd50fab2d0669ca8d6e14597
Python
13,471
379
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : multi-levels_analyzer.py # Author : Yufeng Liu # Date : 2023-02-07 # Description : # #=========...
f95061e113612729be1aefa0bf6d5eebbd358d828dfb70d8347ce677ccef4610
Python
13,474
374
"""Utility functions for TorchSim recipes.""" from __future__ import annotations from copy import deepcopy from importlib.util import find_spec from typing import TYPE_CHECKING, Any, Literal, TypedDict, cast from monty.dev import requires from quacc.schemas.torchsim import PROPERTY_FN_REGISTRY, TSModelType has_tor...
fee68b82f3c493d58cfd7281fc240596e20b09077f46f36b28021c9457384a0d
Python
13,474
380
# utils.py # Created by Ayesh Madushanka # Created on: May 16, 2024 import numpy as np import pandas as pd import os import sys import subprocess import shutil from rdkit.Chem import AllChem from rdkit import Chem # save dataframes as csvs def save_df(datafrm: str, new_name: str): datafrm.to_csv(new_name, inde...
e9dc7abc8c9ff2cafc644f02b5265e88e2e8adf74ee701fc146c704360c95f95
Python
13,476
94
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMAR...
a2978c1536f9326ff378b24c54b28d2a00a626cace832b404eac9a9868aa6191
Python
13,487
352
""" Script for doing Univariate statistical spatial analysis for a 3D distributed point pattern Input: - XML file with a particle list - Parameters for setting the statistical analysis - Tomogram mask (optional) Output: - Graphs with the results of the statistical analysis """ ...
7899dc834a7cdf39b51533ef33d6ae353ea86af22f5da89b9911437f5aa6c246
Python
13,488
331
# testing.py from contextlib import contextmanager import typing from .core import ( ParserElement, ParseException, Keyword, __diag__, __compat__, ) class pyparsing_test: """ namespace class for classes useful in writing unit tests """ class reset_pyparsing_context: """ ...
9cd8b2f1a3ee3a720aadbed6d9b2e7610898d3f4ba587eabe9fd3668fba29daf
Python
13,494
191
# ------------------------------------------------------------------------ # # 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 # # Unle...
dc2b3f2984d2aab00c4a80b6cde056c8e9fdf3c3fc081823d77d7ee0466b50df
Python
13,498
336
# 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...
e7b2c78cef1c8e037a855d2e0e215f9779ccba0a07080eded65ccc9ab4705c4d
Python
13,505
385
from functools import partial import torch import torch.nn as nn from timm.models.efficientnet import EfficientNet from timm.models.efficientnet import decode_arch_def, round_channels, default_cfgs from timm.models.layers.activations import Swish #from timm.models.layers import convert_splitbn_model, convert_sync_bat...
51c5d9dea9ffe0e8fbd2ce8a3aeb3e601c6def48661fe5189f637a5db94a4464
Python
13,508
357
#!/bin/env python3 """ Points, Lines, etc. ------------------- This submodule implements several classes to deal with points living in N-dimensional space. Each point might have data attached to it. The main base class is :py:class:`Points`. A :py:class:`Line` is just some :py:class:`Points` which are ordered. """ fr...
15f186f7e19a1078b2ba5846e99cc7b714a999c10e45f5008182c45d3441339e
Python
13,511
449
#! /usr/bin/python # -*- coding: utf-8 -*- """ Experimental Database Management System. Latest Version """ import inspect import pickle import time import uuid from datetime import datetime import gridfs from pymongo import MongoClient def AutoFill(func): def func_wrapper(self, *args, **kwargs): d = in...
e1ad92551e58e3079830e1fed80ee4eb2fa1031327e22f8035c90fcdac05eb3d
Python
13,514
347
import numpy as np import pytorch_lightning as pl import torch import os ### from apex.optimizers import FusedAdam from torch.optim import AdamW from monai.inferers import sliding_window_inference from monai.networks.nets import DynUNet from monai.optimizers.lr_scheduler import WarmupCosineSchedule from pytorch_lightn...
992acc671482e46782fc4912b7feaebed028a5e0fa9ae2bba468a7817017609b
Python
13,515
389
# -*- coding: utf-8 -*- # # Test Peri-Stimulus Time Histogram # import matplotlib.pyplot as ppl import numpy as np import pytest import dask.distributed as dd # syncopy imports import syncopy as spy from syncopy.shared.errors import SPYValueError from syncopy import synthdata as sd from syncopy.statistics.spike_psth ...
e1a5152fd6b2cd81dde4628186e900ccd0c9fb638492306c4e0ddcefa7aa7048
Python
13,516
232
# coding=utf-8 # Copyright 2020 The Trax Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
c6588fa77dc8ea524e9184d48f75912456e2e581291652e935db74243dc107bc
Python
13,531
427
#! /usr/bin/env python3 """ WARNING This script was changed on 26.04.2019 Now creates separate .rst file for every ap_ ex_ and ww_ example Creates also bioshell-examples.rst file Script creates these files in the right place in a documentation source Must be run in doc_exammples/cc-examples/ and files goes to OUT_PA...
37fce5ee727ac0bba8b72c532ee1e52182f09f8c1b8cfca8a86421efc09b0134
Python
13,533
327
import scanpy as sc import numpy as np import dgl import torch from ..model.utils import add_degree from sklearn.utils.extmath import randomized_svd from scipy.sparse import csr_matrix, find from sklearn.neighbors import KDTree def preprocess(adata, common_genes=True,filter_min_counts=True, size_factors=True,...
cbe311c170a1b8cf8e7d747b012313d5e22b2d7a7a2b89dac8ec0264ddef66b1
Python
13,540
301
""" Binary risk-factor definitions per the 2024 Lancet Commission. Loads merged_df_ES.csv, aggregates to one row per participant, and creates 13 binary risk-factor columns. Risk factors and their definitions ----------------------------------- education_risk : Years of education <= 12 hearing_loss_risk ...
09a41eda11dfe3f3ec0420f915b175a9cc5aab3b0b40cca551389ac4c19f3aa7
Python
13,541
315
"""Tests for regtools.ccf_boundary_editor.quantify.""" import numpy as np import pytest def _ml_on_x(width=10, offset=5.0): """A plane splitting the LAST axis at *offset*; higher index = right. Deliberately not axis 0: a (Z, Y, X) volume's axis 0 is anterior-posterior, and a test that split on...
d32e8b8d00a8b023bbee445b3ab11518b352e77bfe8f32d71237921b64a5ac9d
Python
13,541
438
# 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...
7a3dff14d4b97b89f930bf33c2558c5b7ffeb4d7ed73badfd5826c41323859dd
Python
13,542
442
""" ========================================================================== Fit single subject linear model to voltage evoked by stimulus presentation ========================================================================== Mass-univariate analysis voltage data. Authors: José C. García Alanis <alanis.jcg@gmail.c...
8314b819f6665b223c79b96012cfc0ba8909e5ca1144a856cbeb0f1ce8fb2a93
Python
13,545
390
from . import get_submodules_from_kwargs __all__ = ['load_model_weights'] def _find_weights(model_name, dataset, include_top): w = list(filter(lambda x: x['model'] == model_name, WEIGHTS_COLLECTION)) w = list(filter(lambda x: x['dataset'] == dataset, w)) w = list(filter(lambda x: x['include_top'] == incl...
3c877997cdeeb98e2123d1016a4f01d0e0a00d1b38d2c0e84bee0f83adb02f87
Python
13,552
610
#!/usr/bin/env python from __future__ import division, print_function import math from numpy import * def i4_bit_hi1 ( n ): #*****************************************************************************80 # ## I4_BIT_HI1 returns the position of the high 1 bit base 2 in an integer. # # Example: # # N Binary...
161bc121d645c5143e753c246ffd2669d44a815042694310cfd239c6a8c4e624
Python
13,560
352
""" Metadata about languages used by our model training code for our SingleByteCharSetProbers. Could be used for other things in the future. This code is based on the language metadata from the uchardet project. """ from string import ascii_letters from typing import List, Optional # TODO: Add Ukrainian (KOI8-U) ...
187d1561cf7620655114741d1db7e16c2631531bf7918d5d4e9e040957696597
Python
13,565
345
""" Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free software: yo...
e5d1a558d6ff756ae82ae567c251050047622c5371c55df5424af6adb50b161a
Python
13,565
366
########################################################################################### # # # This sample shows how to evaluate object detections applying the following metrics: # # * Precision x Recall curve ----> ...
de61ee46f5dfb2afd0710cac0d015bf2a4ae76f4e2a25ef50ba21cdb0e7bb4a3
Python
13,566
196
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights R...
b7cc9e5f579454691ebe7adaf69714f8c2efe45a4f945ad877196aac86dcacfb
Python
13,567
394
# 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...
bbdbaa588b933f7bc05519fdb29fabef2fea790c55896665e1014ba40da1dcab
Python
13,567
409
"""Utility functions for dealing with slabs.""" from __future__ import annotations from copy import deepcopy from logging import getLogger from typing import TYPE_CHECKING, cast, overload import numpy as np from pymatgen.analysis.adsorption import AdsorbateSiteFinder from pymatgen.core.structure import IStructure, S...
603c05343789c6567e1a98d8ccb82adfb158284c950654dc13e3ee4abaffe75a
Python
13,573
345
# -*- coding: utf-8 -*- # # Load data from Syncopy containers # # Builtin/3rd party package imports import os import json import h5py import sys import numpy as np from glob import glob # Local imports from syncopy.shared.filetypes import FILE_EXT from syncopy.shared.parsers import io_parser, data_parser, filename_pa...
f8ed5f7baa1a4d9877436654337b59629bfb4e07e33494bcf0c6dcc88658b9d5
Python
13,573
438
# 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...
2cad597109860f070b35b21d30736018cbafbdfab9e5446b7da13f4c0984f35e
Python
13,574
320
#!/usr/bin/env python #coding:utf-8 import numpy as np import multiprocessing import torch import torch.nn as nn import csv import os from transcal.utils import get_weight, ECELoss, VectorOrMatrixScaling, TempScaling, CPCS, TransCal, Oracle import argparse from datetime import datetime import logging import warnings ...
fed24524c4d75108b6b59c1790972f3bd0eec2c7088dfd91c9ef2afa81275e9a
Python
13,574
390
import numpy as np from bonito.nn import Permute, layers import torch from torch.nn.functional import log_softmax, ctc_loss from torch.nn import Module, ModuleList, Sequential, Conv1d, BatchNorm1d, Dropout from fast_ctc_decode import beam_search, viterbi_search class ModelTinyNoSkipX4(Module): """ Model temp...
8111495363c30b306389218e7abc6215c79391e1de2a6218b8def724bc3c910e
Python
13,581
343
from __future__ import division import logging import numpy as np import matplotlib.pyplot as plt import pandas as pd from func_unsupervised_CC import fit from IterativeMethod import iterativeCC """ Created on Mon Jun 24 16:04:07 2019 @author: Hannah Choi """ """ This code finds intra- or inter-module h...
b99d709c5fcf9e179311649e56ec98479c6b09b05efcae78c2646bc1dfb925c7
Python
13,582
386
# -*- coding: utf-8 -*- import itertools import os import platform import subprocess import sys from lab.environments import LocalEnvironment, MaiaEnvironment from lab.experiment import ARGPARSER from lab.steps import Step from lab import tools from downward.experiment import FastDownwardExperiment from downward.rep...
d6c01ad7181492ee8efaef7863c65de10aa9965a13ab8dc46743a154e012457f
Python
13,582
341
#!/usr/bin/env python # Copyright (c) 2018-2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module contains a statistics manager for the CARLA AD leaderboard """ from __future__ import print_function from dictor im...
b988857e83c1a5af91a4e10dcf9682e85cfde38fc480d051aa617d13d23f4e74
Python
13,583
364
# LIBRARIES from argparse import ArgumentParser from pytorch_lightning.metrics import Accuracy import torch import torch.nn from torch.nn import functional as F from torch import nn import pytorch_lightning as pl from torchmetrics import Accuracy from vit_pytorch import ViT from transformers import ViTConfig import mat...
500b333912cbc4749cb7f7ea7c316e35c050d560f34e99419d0941ed8a28b8df
Python
13,585
433
import pickle import os from typing import Union import torch import lmdb class _EEGSignalIO: @property def write_pointer(self): return len(self) def keys(self): raise NotImplementedError( "Method keys is not implemented in class " + self.__class__.__name__ ...
e2cbd2f72673949ff24a3de3c51c554ed03718902841567f82aff63e852792dd
Python
13,587
301
"""Export mixin for the CCF boundary editor. Carries the editor's export actions - full-volume modified annotation + quantification CSVs (``_on_export``), single-CCF-section export for the section-browse mode (``_export_section_browse``), and the pipeline-format per-region count CSVs (``_on_export_pipeline_counts...
00b45be72c6e69b618754d341f9b0689b968ac6fe724c1cc5b2d91bb0bd85bfe
Python
13,589
346
"""A Q-Chem calculator built on Pymatgen and Custodian functionality.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.calculator import FileIOCalculator from quacc.calculators.qchem.io import read_qchem, write_qchem from quacc.calculators.qchem.params import cleanup_attrs...
13fbf5f047bc95606809e8400de6a2893617e75c4fc0e910faca6b8ca90742e8
Python
13,589
341
#!/usr/bin/env python # Copyright (c) 2018-2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module contains a statistics manager for the CARLA AD leaderboard """ from __future__ import print_function from dictor im...
a347a2e9b22fa72946cd8c5e00063932e1f5d768e5c735b37cc320ac99cba815
Python
13,595
325
# -*- coding: utf-8 -*- """ Created on Tue Jun 23 2023 @author: Jonas A. Thiele """ ### Visualizing differences between results from models trained with most relevant links vs. models trained with all links ### Determining overlap of most relevant links between states and intelligence components import n...
57e57b17add8fdd683a4913ee13695cd92e1ea497f5b4746412ebd2bdd991488
Python
13,596
376
# 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...
a03a1cc0f76e4bec2d2a483a7fd461f7ba864c5e08a63944b4bdbbb0ea91f12c
Python
13,596
468
import pandas as pd import json json_file= pd.read_json('cache/felipe/annotations.json') im_dir = 'cache/felipe/Data' ims = json_file.keys() n_classes = 5 im = ims[0] part_keys = None def get_xy(ann): return np.array([ann['cx'],ann['cy']]) all_lbls = [] for im in ims: anns = json_file[im] n_anns = len(a...
2d9bfbdbcbaa85f59aaff0c41c16fba6757c0241cdfea4ea754286f84e8cc56c
Python
13,600
341
# -*- coding: utf-8 -*- """ Created on Jun 4 2023 @author: Jonas A. Thiele """ ### Apply models build in HCP sample to ### predict intelligence scores in the replication sample (PIOP1 and PIOP2 combined) ### for models that were trained with links (edges, connections) between specific nodes (from intellige...
b058ec899669d4b2467796bfa8bed3daa750c6bad997e4386446ba7ae0d53ea6
Python
13,603
295
from collections import Counter from pddlstream.algorithms.common import evaluations_from_init, SOLUTIONS from pddlstream.algorithms.constraints import add_plan_constraints from pddlstream.algorithms.downward import parse_lisp, parse_goal, make_cost, set_cost_scale, \ fd_from_fact, get_conjunctive_parts, get_disju...
9697bc1441ac1b48e8be3ba85c0d29fd73a09c878f68bd7420a8ede0e2c67fe9
Python
13,605
324
from random import shuffle, choice import os import logging import tensorflow as tf import sys from PIL import Image logger = logging.getLogger(__name__) global tf_image, tf_label, status import random import numpy as np #from skimage.color import rgb2lab,rgb2hed class Preprocess: def __init__(self, directory_path...
c2a4145a3ec1c6fb9c8d4b342aa5b96ee3cf80bbd63590ceebd7b3c09191b1e6
Python
13,606
275
# Copyright 2020 The HuggingFace 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/LICENSE-2.0 # # Unless required by applicabl...
b30109bd6b2d219352d6b1dcf21ca8361c2037617741d4b103d9ab6e5b504703
Python
13,608
401
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys sys.path.append(os.path.abspath('../')) try: import analysis.synchronization as synchronization import analysis.connectivityMatrices as connectivityMatrices except ModuleNotFoundError: import KuramotoNetworksPackage.analysis.synchronization...
23d9f38fb994d188febd3085b8edf944de3f742749ab2208ff4f48b26e2810bc
Python
13,613
309
import random import numpy as np from torch.utils.data import Dataset import sys import pandas as pd from tqdm import tqdm from sklearn.preprocessing import LabelEncoder from collections import OrderedDict import os import math import torch import torch.optim as optim import torch.optim.lr_scheduler a...
0e83ce574b6f5337eeb0a88613e4ec8636092c603597333b734cc63da1c948c2
Python
13,617
285
""" Bitwise decoding ================ This script shows how to use CCA and LDA on epochs within a trial, using PyntBCI, for decoding c-VEP trials. Epochs are defined as the windows of data within a trial, synchronized to the onset of individual flashes. For each of these epochs the classifier determines whether a flash...
607d258240c648c5e481426d1beaeb244f2f7b7cf4cf24838a1a7f88b4a45d18
Python
13,618
339
import os import sys import pdb import glob import json import time import resource import numpy as np import pandas as pd import tensorflow as tf import util_tfrecords class CallbackPrinting(tf.keras.callbacks.Callback): def __init__(self, display_step=1, epochs=None, **kwargs): super(CallbackPrinting, ...
fee526141ab895fb7bc69703d7a85e90398306cd9ce03edae5869ac28c3e87c5
Python
13,619
316
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ import wx import os,sys,pydoc,platform import webbrow...
6d5b413567156c07a3baeff51640f35c53b60ba1de24a5af77c9f9e528cc466a
Python
13,620
320
"""The registration tab drives the drawn midline end to end. The panel can capture two clicks and the geometry can promote them; this is the piece that arms the mode, derives the frame, and persists the result so the RUN can read it back. The frame derivation is the part that must not be guessed. ``ml_axis`` co...
c2bee946e93b28adb24ef8486641db30852c8cbe898d6ad6a9937769a207cd5d
Python
13,628
343
from __future__ import print_function, division import numpy as np import scipy import time import os import datetime from learn_tools import helper from operator import itemgetter from learn_tools.learner import FAILURE, THRESHOLD, SUCCESS, score_accuracy #from pybullet_tools.utils import interval_generator from pd...
c1718e4296fa3fa7175d5e7b335c2d8d9c0f8e661238829c35cc52ac214c6984
Python
13,632
380
"""Checker that validates event-level HED annotation quality for BIDS datasets.""" from hed.errors import ErrorContext, ErrorHandler, sort_issues from hed.errors.error_types import TagQualityErrors from hed.tools import EventManager, HedTagManager class EventChecker: """Validates that HED-annotated events meet q...
d1ff2c9334bc884a17bc5b62c4258837b9f033ede37aa71d8603f900a228ee5b
Python
13,635
330
import time from dataclasses import fields from pathlib import Path from typing import Optional, Tuple import numpy as np from . import corrpts, utils, optimization, pointcloud class SimpleICP: """Class for setting up and run simpleICP.""" def __init__(self) -> None: """Constructor method.""" ...
d3191d17fba18a86a7d102dbe67d0a5ebee311284a1ffb1804df176b625bca31
Python
13,637
300
#%% import numpy as np import pandas as pd import math from pathlib import Path ROOT_DIR = Path('/media/WDBlue/mcintosh/projects/Cam-CAN/PLS_wrapper_SC/results/') RESULTS_NAME = 'SC_age_CattellTotal_1000_its_594_subs_0_to_150_age_range' ATLAS = '220' ROOT_DIR.joinpath(ROOT_DIR,RESULTS_NAME,'figure_files/').mkdir(pare...