sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
465527f0e0d13d78979a1c43b54c57a7d3915c7f1312b824ad7eaa229e493578 | Python | 24,816 | 711 | """
Module to rate defaced MRI scans, optionally with their 3D renders
"""
import argparse
import sys
import textwrap
import warnings
from abc import ABC
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.image import imread
from matplotlib.widgets import CheckButtons, RadioButtons
from mrivis.... |
969eb7189aeb9126e62a7343956bb898e9adc61a82df4756fc845f29772949af | Python | 24,818 | 519 | from ml_training.train import train
import matplotlib.pyplot as plt
#import seaborn as sns
import os
import numpy as np
import pickle
"""MOVE THIS FILE TO THE ROOT DIRECTORY OF THE PROJECT TO RUN"""
def standard_run():
train_sizes = [1,2,5,10,15, 20]
repeats = 5
outputs = {}
for train_size in train_si... |
a42f97d651499dd2b22eb7a8aeea3b68ffc09e683416afe1200ece16aed51824 | Python | 24,818 | 746 | """Room REST API endpoints."""
import json
from typing import Annotated, Any, Literal
from uuid import UUID
from fastapi import APIRouter, Query, Response, status
from sqlalchemy import or_
from sqlalchemy.exc import IntegrityError
from sqlmodel import col, select
from sqlmodel.ext.asyncio.session import AsyncSession... |
729674805770a73540d938635d9e1c80f660abe43ccf2c3483d89849c6f69533 | Python | 24,830 | 563 | """
API for functions used in the sct_deepseg_sc CLI script
Copyright (c) 2022 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import os
import sys
import logging
import numpy as np
from skimage.exposure import rescale_intensity
from scipy.ndimage import distance_transform_edt, center... |
bfd1ddedd0a6faed2dfe9180863a06e3fe7ce96ee44237dc60c4bdf8e9f8b2ab | Python | 24,840 | 591 |
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips
# Copyright (C) 2022-2023 Ole Richter - University of Groningen
#
# 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
# ... |
92c9b8847c6d1b56e3b77e9773d0bb233ebdf53e639a4181bb57001ecfaab1ca | Python | 24,853 | 541 | # -*- coding: utf-8 -*-
import json
import os.path
import shutil
import tarfile
from typing import Dict, List, Optional
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest, JsonResponse
from django.db.models import Count
from catmaid.control.au... |
b74f349659ad1f3c3889769c4e4ee758189d51fbb3acda5b3a64ba7ec56c1de0 | Python | 24,873 | 610 | # coding=utf-8
# Copyright 2021 The IDEA Authors. 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 a... |
d14bc3d340992a7ddc8ff10c5534a7c0c05e8de684a91c4ea13984c00ca9f429 | Python | 24,901 | 647 | # -*- coding: utf-8 -*-
from collections import defaultdict
from functools import partial
from itertools import count
import json
import networkx as nx
from networkx.algorithms import weakly_connected_components
from numpy import subtract
from numpy.linalg import norm
from typing import Any, DefaultDict, Dict, List, O... |
e8043b4fbb7d900835f6c0037bdf87e2b5c1287c271745e6f22647a748497989 | Python | 24,945 | 711 | import numpy as np
import pandas as pd
# import tqdm
import tensorflow as tf
from tensorflow import keras
import tensorflow_probability as tfp
import resources.data_loader as dl
#---------------------------------------------Preprocess Sequence Embeddings---------------------------------------
# Atchley Factor Vector... |
6e843262b52d58721d99f896b62fe32b27c3acffee709cd259e67d7b3009b975 | Python | 24,970 | 628 | import pytest
import numpy as np
import copy
from numpy.testing import assert_allclose
from keras.utils import CustomObjectScope
from keras.layers import wrappers, Input, Layer
from keras.layers import RNN
from keras import layers
from keras.models import Sequential, Model, model_from_json
from keras import backend as ... |
82fc05c5716df9b8e08bda253e293401dd9ad3e9457697662d44753ca814ebb9 | Python | 24,974 | 640 | """Implementation of the glycolysis model from
Lao-Martil, D., Schmitz, J. P., Teusink, B., & van Riel, N. A. (2023).
Elucidating yeast glycolytic dynamics at steady state growth and glucose pulses
through kinetic metabolic modeling. Metabolic Engineering, 77, 128-142. Stoichiometry is
changed according to the paper.""... |
4f7a02f63290004ac048d57583bf4c3410c826b3ceb3de97549bb01da14ea1dc | Python | 24,976 | 565 | ## The following code contains work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105.
## Additionally, we waive copyright and related rights in the utilized code worldwide through the CC0 1.0 Universal public domain dedication.
import copy
from datetime import datet... |
fc60bcee32e6a956deaf193bf470c6584abf34c861ad3c36ab1a39db187d1b00 | Python | 24,999 | 620 | import mne
from scipy.signal import detrend
import sys, os
from tqdm import tqdm
from glob import glob
import numpy as np
import itertools
import pandas as pd
import pickle
import matplotlib.pyplot as plt
from datetime import datetime, timezone # workaround for mne
from mne.preprocessing import ICA
from autoreject imp... |
b10c41f9a2e2c41879dfe7a3b6c6048f8bff589da30a0ba5988e6543d7407bc4 | Python | 25,002 | 599 | # Object colocalization
# Copyright The MagellanMapper Contributors
"""Colocalize objects in an image, typically in separate channels."""
from enum import Enum
import multiprocessing as mp
from typing import Dict, List, Optional, Sequence, Tuple
import pandas as pd
import numpy as np
from skimage import morphology
f... |
d38eeecd223647a8d07a42eddc074cf3d53dfea20f7ed91bd84075d4d5c418f5 | Python | 25,019 | 575 | # Colormaps for MagellanMapper
# Author: David Young, 2018, 2023
"""Custom colormaps for MagellanMapper.
"""
from enum import Enum, auto
from typing import Dict, Optional, Sequence, Tuple, Union
import numpy as np
try:
from matplotlib import colormaps as mpl_cmaps
cm = None
except ImportError:
mpl_cmaps =... |
f90c5a1dc058933e7fe2e6a67f1b819ea4da3f1305319e3317bb876b900d7569 | Python | 25,033 | 612 | import logging
import math
from typing import List, Optional
import torch
import torch.nn as nn
from ocpmodels.common.registry import registry
from ocpmodels.common.utils import conditional_grad
from ocpmodels.models.base import BaseModel
from ocpmodels.models.scn.smearing import GaussianSmearing
try:
pass
excep... |
1141cc3b2523ed72a1f818b076122106258ac89d42b7275465e8e332f352f81c | Python | 25,072 | 696 | # -*- coding: utf-8 -*-
# encodermap/misc/summaries.py
################################################################################
# EncoderMap: A python library for dimensionality reduction.
#
# Copyright 2019-2024 University of Konstanz and the Authors
#
# Authors:
# Kevin Sawade, Tobias Lemke
#
# Encodermap is ... |
168d6018c1ae6767236437211a8b8405d1b1939c9d84244461816e43df895b6a | Python | 25,082 | 723 | # -*- coding: utf-8 -*-
# An experimental script to export a TrakEM2 project's annotations
# directly to the CATMAID database. This is based on Albert Cardona's
# TrakEM2 helper scripts here: https://github.com/acardona/Fiji-TrakEM2-scripts
# Mark Longair 2010
# flake8: noqa
import os
import re
from ini.trakem2 im... |
20c70a1c038aff8524686f540993b25038bc812d707dc25e2be1615021b78acb | Python | 25,088 | 588 | '''
In this experiment, we train a single CATE model on combined data from both conditions
by loading a pre-trained VGAE and training a sklearn regression head on the
latent representations + clinical data from all samples.
The labels are ITEs computed from t-learner predictions.
We use k-fold cross-validation based o... |
c0bd082e916881e7875cba04ab02a13530e59dae28e0d53ff169e3357a1fe8e5 | Python | 25,089 | 642 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmengine.model import BaseModule, ModuleList, Sequential
from mmengine.utils.dl_utils.parrots_wrapper import _BatchNorm
from mmseg.registry import MODELS
from ..utils impo... |
d25f6d695245e6f50741b1938679265244ad4bddee9ea983064a8feef6afee6c | Python | 25,133 | 591 | # Region labels export to data frames and CSV files
# Author: David Young, 2019, 2023
"""Region labels export to data frames and CSV files.
Convert regions from ontology files or atlases to data frames.
"""
import itertools
import os
import csv
from collections import OrderedDict
from time import time
from typing impo... |
255416e541b426026326f5897f1eb9cbc048f7a9d487b905d177599794fd85b0 | Python | 25,149 | 771 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from pathlib import Path
from typing import Dict, Optional, Union
import mmcv
import mmengine.fileio as fileio
import numpy as np
from mmcv.transforms import BaseTransform
from mmcv.transforms import LoadAnnotations as MMCV_LoadAnnotations
from mmcv.trans... |
d862eae2e7390cb1fab4a815b8bdcd2bf10c5167c35be06fe0dc9ea530596cb6 | Python | 25,195 | 700 | import os
import logging
from typing import List, Optional
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi import Request, APIRouter, Depends, Form
from medperf import config
from medperf.account_management import get_medperf_user_data, get_medperf_user_object
from medperf.commands.mlcu... |
390afe33846df8c8abbd8555795f5b992c2a2a63bb9ddaf987290ffa48ab48aa | Python | 25,246 | 620 | from __future__ import print_function
from __future__ import division
from future import standard_library
standard_library.install_aliases()
#from builtins import str
from builtins import range
from quantities.quantity import Quantity
from quantities import mV, nA
import sciunit
from sciunit import Test,Score
try:
... |
0b335bb2ad113ab6c7256c978e9e67c613a30040d5ae0bbb82ba74574be508c9 | Python | 25,247 | 621 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from typing import Tuple, Union, Optional, List
from torch import Tensor
from nns.backbone import UperNet, Mask2Former, Segformer, C_CNN
from nns.layers import MultiHeadAttention, EfficientAttention1D, Conv1dBlock
from torch... |
b8ef9abeb251bc3700755de98fb194a1d0883a87b9113db4814cfeac9d04eb30 | Python | 25,249 | 699 | import unittest
from uuid import UUID
import pkg_resources
from prov.model import ProvDocument, ProvAgent, ProvEntity, ProvActivity, QualifiedName, ProvRelation, ProvRecord, ProvBundle
from provdbconnector.tests import examples as examples
from provdbconnector import ProvDb
from provdbconnector.exceptions.database im... |
df7ef00f8769f170b7550400b789c3eb182a6dd10f5e21454ac3b7bbf38a2301 | Python | 25,260 | 631 | """Implementation of the glycolysis model from
Lao-Martil, D., Schmitz, J. P., Teusink, B., & van Riel, N. A. (2023).
Elucidating yeast glycolytic dynamics at steady state growth and glucose pulses
through kinetic metabolic modeling. Metabolic Engineering, 77, 128-142. Stoichiometry is
changed according to the paper.""... |
5066dd5ce28cfd8d4ce7506c2253a354ad7e91513c1a4cbdc02ac6984195b4af | Python | 25,265 | 603 | import pytest
from keras.preprocessing import image
from PIL import Image
import numpy as np
import os
import tempfile
import shutil
class TestImage(object):
def setup_class(cls):
cls.img_w = cls.img_h = 20
rgb_images = []
gray_images = []
for n in range(8):
bias = np.... |
a4036fce2c989e7ed26b4b1f1bf36511c9a1e4cf3271c488e6c61ac9d2526de5 | Python | 25,270 | 618 | """testing whether piecewise expression is problematic for grads"""
import time
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
import pandas as pd
import diffrax
from jaxkineticmodel.parameter_estimation.training import Trainer
from jaxkineticmodel.building_models import JaxKineticModelBuild as jk... |
d926b96dfc7c0d0574b28fefd92a2496ff5276301a19e958f1e8b6b991c0a32a | Python | 25,305 | 550 | from inspect import signature
from typing import Union, List, Dict
from pprint import pprint
from ipaddress import IPv4Address
from numpy import invert
from CybORG.Agents.SimpleAgents.BaseAgent import BaseAgent
from CybORG.Simulator.Actions.AbstractActions import DiscoverRemoteSystems, PrivilegeEscalate, Impact, Degra... |
ff1899ca1a6293eceaaa4b92befd2805f095f36fcf5622453a05210d2abfa965 | Python | 25,336 | 582 | """Unit tests for the panel that picks NWB files out of one DANDI dandiset."""
from pathlib import Path
from threading import Event
import pytest
from dandi.exceptions import NotFoundError
from guppy.frontend.dandi_file_panel import DandiFilePanel
from guppy.utils.dandi_filter import PhotometryVerdictCache
from gupp... |
74b20d67d4ecbc2ffba2b4db0d30a3aee54372c554fe88164a4762fe01b7cf8f | Python | 25,352 | 753 | """
https://github.com/mattragoza/liGAN/blob/master/fitting.py
License: GNU General Public License v2.0
https://github.com/mattragoza/liGAN/blob/master/LICENSE
"""
import itertools
import re
from copy import deepcopy
import numpy as np
from rdkit import Geometry
from rdkit.Chem import AllChem as Chem
try:
from ... |
cff0459f40cdedb35927631c0fd2173a4e3ff3af30fd4273681f78a8b37b411b | Python | 25,373 | 630 | """Byte-identity verification for the lazy ``closest`` cascade.
Proves that :meth:`AnnotationEngine._lazy_cascade_summarize_batch` returns the
*exact* ``(annotations, confidence)`` that the eager
:meth:`AnnotationEngine._summarize_annotations` produces for
``donor_pool="closest"`` — including dict key sets, value list... |
2549f4cf4a3281b2a1e1a32eff362003e0b1042b36fc617ee68d495d7992d8ed | Python | 25,398 | 482 | #!/usr/bin/env python
# encoding: utf-8
# %%----------------------------------------------------------------------
# libraries
# ----------------------------------------------------------------------
import argparse
import datetime
import glob
import itertools
import json
import logging
i... |
8cc39543eb5060c4090d1da7089d928696a1f686e83237c751246c647220e66e | Python | 25,398 | 703 | # Author: Hauxu Yu
# Group features from the same compound including isotopes, in-source fragments and adducts.
# imports
import numpy as np
import os
from tqdm import tqdm
from .params import Params
from .raw_data_utils import read_raw_file_to_obj
from .utils_functions import extract_signals_from_string
def group... |
6b0e78bee83398e8e422734ddffc6de3875c4a03dbb8ff24a54c71455ba36957 | Python | 25,410 | 475 | #!/usr/bin/env python
# encoding: utf-8
# ----------------------------------------------------------------------
# libraries
# ----------------------------------------------------------------------
import argparse
import datetime
import glob
import itertools
import json
import logging
imp... |
5e8cdde5dacbf68fda2a0e9ec62f44b02e9d4e66fd399f6c95e4774548439d05 | Python | 25,441 | 446 | import numpy as np
from scipy.stats import invwishart
eps = np.finfo( float ).eps
class GMM:
def __init__(self, numberOfGaussiansPerClass, numberOfContrasts, useDiagonalCovarianceMatrices=True,
initialMeans=None, initialVariances=None,
initialMixtureWeights=None,
... |
c844eb88a2876339bfd5598c1173d26663c30947faf660d7a08a236f0e8cff0e | Python | 25,507 | 599 | from fengshen.examples.pegasus.data_utils import (
_is_control,
_is_punctuation,
_is_whitespace,
_is_chinese_char)
from transformers import PreTrainedTokenizer
from transformers import logging
from typing import List, Optional, Tuple, Union
import collections
import os
import unicodedata
import re
impor... |
cd219588aa99486231d1d99393110c3e9f35ed1022fa9f2ce42773983ff9831e | Python | 25,584 | 742 | """Utilities for file download and caching."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import multiprocessing as mp
import os
import random
import shutil
import sys
import tarfile
import threading
import time
import warnings
import zip... |
2725a3d2962e8222f7a4b9850b7dccc8a8de5e5ae6c4ec489948c68b7369c57d | Python | 25,604 | 626 | # Atlas measurements and statistics
# Author: David Young, 2019, 2023
"""Low-level measurement of atlases and statistics generation.
Typically applied to specific types of atlases and less generalizable
than measurements in :module:`vols`.
"""
import os
from typing import Optional, Sequence
import numpy as np
import ... |
ef3a9aa19bf914ea9340e8d950f75080c71b2106b6d3ff4769e5bee3a5019719 | Python | 25,608 | 622 | import dash
import dash_bootstrap_components as dbc
from dash import html, dcc, Input, Output, State, dash_table
import pandas as pd
import plotly.graph_objects as go
from sklearn.impute import KNNImputer
import numpy as np
import brain_map
from brain_map import create_brain_map_tab, register_brain_map_callback... |
09432c4d6baa17dfc7d9b1c8e1c4351f5ca83b8df937d6ad38bb556836a2e883 | Python | 25,627 | 836 | import os, time, re, hashlib, sys
from itertools import groupby
import h5py, torch
import numpy as np
import pytraj as pt
from scipy.spatial import distance_matrix
from . import constants
from . import printit, config
def get_hash(theinput="", mode="md5"):
"""
Get the hash value of a string or a list or a nump... |
3035ce90f2c3d5a853c2662e5956d39aebf0a310186e5694ba7fc8cee20d95df | Python | 25,663 | 695 | import torch
import torch.nn as nn
import torchvision
from numpy import float32
import torch
import torchvision
from torch import Tensor, dropout, nn
import torch.nn.functional as F
import math
import torchinfo
from torchvision.models.feature_extraction import get_graph_node_names
from torchvision.models.feature_extrac... |
bf3bd98e7b90966a3f867d263cfcd86ff5450813e491d27bf0f426b8c55c2f34 | Python | 25,671 | 762 | # /// script
# requires-python = ">=3.10"
# dependencies = [
# "matplotlib",
# "numpy",
# ]
# ///
"""Generate SVG figures for the PSTH explanation page.
The PSTH operation (window extraction, across-event averaging, SEM band)
mirrors src/guppy/analysis/compute_psth.py. Only the input traces are
synthetic and d... |
66f877d7a0b0b2cc6cb8497b25237603bab61873dcb6a10962d80d8370c39a38 | Python | 25,701 | 712 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer, build_plugin_layer
from mmengine.model import BaseModule
from mmengine.utils.dl_utils.parrots_wrapper import _BatchNorm
from mmseg.registry... |
81eebe042ca3588af313a1f047d55d6cf5b59ea08d6b4cefa8f8bf1aa631d5a8 | Python | 25,707 | 561 | #!/usr/bin/env python2.7
import sys, os
import argparse
import random
import warnings
from itertools import cycle
from collections import defaultdict
import numpy as np
import scipy
import scipy.cluster
import scipy.cluster.hierarchy as hier
import pandas as pd
import matplotlib as mpl
mpl.use('Agg')
from matplotli... |
57e343717b09c251552b89551a1bf5cb97b5f9230c67353fa29c380dd03528db | Python | 25,714 | 907 | """
Test CLI Utils
"""
import csv
import json
import os
import pytest
from click.testing import CliRunner
from pprint import pprint
from kgx.cli.cli_utils import validate, neo4j_upload, neo4j_download, merge, get_output_file_types
from kgx.cli import cli, get_input_file_types, graph_summary, get_report_format_types, tr... |
95ae4a9e4ece09fde617afd38b5a2201a792230a8dfdfc1d7462c35f6da51e31 | Python | 25,728 | 725 | # tests/test_router_task_status.py
"""Tests for task status and update endpoints using shared fixtures."""
from uuid import uuid4
import pytest
from conftest import make_room_address
from zndraw_joblib.exceptions import ProblemDetail
from zndraw_joblib.schemas import PaginatedResponse, TaskClaimResponse, TaskRespons... |
47a136ea765b508fb9d516178d3bf05f69e954828d0f7cb38ca5cf751c16a8e0 | Python | 25,751 | 865 | import h5py
import numpy as np
from dotmap import DotMap
from myphdlib.general.toolkit import psth2
from sklearn.neighbors import KernelDensity
from scipy.stats import gaussian_kde
# TODO
# [ ] Load all of the unit property values on instatiation
class SingleUnit():
"""
"""
def __init__(
self,
... |
9017003842b2974bc7def70ce8f68f5f63f21597e3f6634737ef61ffd679015d | Python | 25,786 | 600 | """Utilities for real-time data augmentation on image data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .. import backend
from .. import utils
from ..utils import generic_utils
from keras_preprocessing import image
random_rotation = image.rand... |
38e513e2b9f5f8522e0666b67db3c9ecf1bfaeec8c675eb6524c8591be11bce0 | Python | 25,792 | 661 | import matplotlib.pyplot as plt
import matplotlib
import numpy
from importlib import reload
import sys
import os
import importlib
import types
# print(sys.modules.keys())
import multiprocessing
import multiprocessing.pool
original_packs = sys.modules.copy()
try:
import cPickle as pickle
except:
import pickle
im... |
6cd594efa7d8574aef0bd05d95862899ca32014749b79192675399faa7909e23 | Python | 25,797 | 658 | import pickle
import json
import random
import networkx as nx
from pyhealth.datasets import SampleDataset
from graphcare_ import split_by_patient
from torch_geometric.utils import to_networkx, from_networkx
from tqdm import tqdm
import numpy as np
import torch
from torch_geometric.loader import DataListLoader, DataLoad... |
a82a1913836b9d8690bd284d18d33b6cdd40c5333c3f0dd4a950b95aef211ffc | Python | 25,797 | 658 | import pickle
import json
import random
import networkx as nx
from pyhealth.datasets import SampleDataset
from graphcare_ import split_by_patient
from torch_geometric.utils import to_networkx, from_networkx
from tqdm import tqdm
import numpy as np
import torch
from torch_geometric.loader import DataListLoader, DataLoad... |
fad5587f38d5afa34d8f06f980f7b693e29289e5caf61a316451565464b2a8e0 | Python | 25,801 | 666 | """
Preprocessing Workflow: assembly metagenomic shotgun sequencing reads and build gene catalogs
A collection of tasks for workflows with gene catalogs
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated docum... |
2ee3e887d569ca01770e4153402e480c42e9646e5879f043a5c11b88975681e6 | Python | 25,831 | 641 | import os
import torch
import logging
import numpy as np
import torch.nn as nn
from scipy.signal import resample
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
from transformers import AutoProcessor, WhisperForConditionalGeneration, AutoModelForPreTraining
from transformers import Speech2TextForConditionalG... |
35619b48fc764bcdfa0b0bdf450fca563b1f69dddf386ebbf651baae344df00f | Python | 25,869 | 589 | """Panel page for the optional Select Artifact Windows step.
The user marks the periods where artifacts occurred on a run's control/signal/fit
traces. Saving writes the complementary keep-windows to
``coordsForPreProcessing_<recording_site>.npy`` and records the removal method into the
run's ``GuPPyParamtersUsed.json`... |
a619f8a2d8947e72d87894da7b9e056d770f748cc9750a7f87abf286a1151fa8 | Python | 25,896 | 711 | import sys
import os
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
import scipy.io
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import Dataset, DataLoader
from benchmark_util import *
from igraph import *
dir_path = os.path... |
1e047c5f854443d1f835e1d33da62a0563dcfc8782206c54c7efac0e18c7652b | Python | 25,899 | 774 | import time
import numpy as np
import pandas as pd
from sklearn.impute import KNNImputer, SimpleImputer
from sklearn.decomposition import PCA, IncrementalPCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.model_selection import GridSearchCV
from sklearn.neural_network import MLPClassi... |
968e6352f5a05eba0ea10a07de00c002d525dbddbc7165592f09006e473803da | Python | 25,936 | 573 | '''
Computes GRAIL patterns for all patients with all fold models.
Does not cluster results and only saves mean alignment values.
Additionally, computes fold-wise performance of each model and saves it.
Dependencies:
- data/raw/receptor_maps/f{atlas}/f{atlas}_receptor_maps.csv
Authors: Hanna M. Tolle
Date: 2025-05-03... |
16d45f201991b8accd332a40565154b3cadfbcafb396885f4da9b3772068e4dc | Python | 25,943 | 712 | import sys
import os
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
import scipy.io
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import Dataset, DataLoader
from benchmark_util import *
from igraph import *
dir_path = os.path... |
c78c05aebd681e2edfbee0f3eadc38e0177533b20469c640f36c88b56687c1e8 | Python | 25,960 | 582 | # Segmentation based on edge detection
# Author: David Young, 2019, 2023
"""Re-segment atlases based on edge detections.
"""
import os
from time import time
from typing import List, Optional
import numpy as np
import pandas as pd
try:
import SimpleITK as sitk
except ImportError:
sitk = None
from skimage import... |
1622cda50e7d5ec9c22fa9ff627f9f553e0ef29e3d262ac35aa00a6576710b81 | Python | 25,992 | 583 | import os
import math
import time
import xml.etree.ElementTree
import traceback
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
from django.db import connection, transaction
from catmaid.apps import get_system_user
from catmaid.control.edge import rebui... |
d0a4e5fb0f57d4f2eb37c0bf9bfc547ce61c8640ab9719201e89ec6299cc9ca7 | Python | 26,012 | 686 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-strict
from collections import defaultdict
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
import tabulate
import torch
from torch import nn
from .activation_count import ActivationCountAnalysis
from .flop_count import... |
86f3e4e8b4bef276136f7fcf5fa1dabfabe8fe121958619da87934cdf6119c49 | Python | 26,013 | 631 | # -*- coding: utf-8 -*-
# tests/test_project_structure.py
################################################################################
# EncoderMap: A python library for dimensionality reduction.
#
# Copyright 2019-2024 University of Konstanz and the Authors
#
# Authors:
# Kevin Sawade, Tobias Lemke
#
# Encodermap ... |
40898002fcb8ef1207718b1c1d274a6ade48190f2527d308b93f77e3b29ef3a6 | Python | 26,040 | 671 | import pickle
import json
import random
import networkx as nx
from pyhealth.datasets import SampleDataset
from graphcare_ import split_by_patient
from torch_geometric.utils import to_networkx, from_networkx
from tqdm import tqdm
import numpy as np
import torch
from torch_geometric.loader import DataListLoader, DataLoad... |
b68b9b9357f9c7df702c5ed442be045c91516acc74e7a65577ee57f50c8851b1 | Python | 26,063 | 573 | import logging
import multiprocessing as mp
import re
from itertools import repeat
from pathlib import Path
import numpy as np
from scipy import signal as ss
from .psth_significance import execute_compute_psth_significance
from .save_parameters import read_artifact_provenance, save_parameters
from .transients import ... |
c46faac9251746c3dc722bf6279b4c8b3ce722d665c65847574f9c2f3fcaf8b8 | Python | 26,091 | 821 | #!/usr/bin/env python
# ################################################################
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# i... |
e5d8fd479c4340964248dfb6209ee19b9395cbaeef677fda578c2e5c62d4e3b0 | Python | 26,116 | 806 | """Calculate initial rigid alignment between sections."""
import os
import re
import shutil
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from skimage.transform import resize
import brainbuilder.utils.ants_nibabel as nib... |
2363970424d66a3eb48e67b976c1cca6a88fc4d4174a54f3624733fb56920f4a | Python | 26,122 | 809 | """Tests for Geometry REST API endpoints."""
import json
import pytest
from helpers import auth_header, create_test_room, create_test_user_in_db
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.models import RoomGeometry
from zndraw.schemas import (
GeometriesResponse,
... |
96a57dfa7fc7d73b385bdcb843bb3692c22afee0f68f1914fd9c622a18b8d8b4 | Python | 26,145 | 504 | """
Ensemble inference
Copyright (c) 2023 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import logging
import os
import shutil
import time
from pathlib import Path
import glob
import multiprocessing as mp
from ivadomed import inference as imed_inference
from totalspineseg.inference ... |
48c215e509174d4183b11c0012679a03c99e0b6f4470fb095299b4066633d5fc | Python | 26,180 | 912 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 8 14:16:54 2025
This file contains function used to load the required data, run the analyses
and plot the figures presented in 'The effect of spherical projection on spin
tests for brain maps'.
@author: Vincent Bazinet
"""
import pickle
import meshio
import nibabel as ... |
512b2f281c4f4d403bf762c7a57590c4791be97688a3e0af974d95f59c620936 | Python | 26,198 | 562 | # coding=utf8
import json
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from transformers import BertTokenizer, MT5Config, MT5Tokenizer, BatchEncoding
import torch
import pytorch_lightning as pl
import numpy as np
from itertools import chain
import sys
sys.path.append('../../')
def compute_in... |
9a5f42a1fd96b630b8c2142846730a0420fffe610571cb03e0a5b71c0e3258d1 | Python | 26,281 | 643 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 2 15:23:54 2023
@author: george
"""
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
import numpy as np
import pandas as pd
import pyqtgraph as pg
import os
# import pyqtgraph modules for dockable windows
from pyqtg... |
20a98c1d3438498536d18331ac69c69a42750d4f4df5c906b22c773fe9a3c27f | Python | 26,307 | 758 | # -*- coding: utf-8 -*-
# encodermap/_version.py
################################################################################
# EncoderMap: A python library for dimensionality reduction.
#
# Copyright 2019-2024 University of Konstanz and the Authors
#
# Authors:
# Kevin Sawade, Tobias Lemke
#
# Encodermap is free s... |
9866e4dd5f4bbbe0f47424231d66e7071a057ef7a0316c288da2561c9ca8ca8a | Python | 26,310 | 421 |
import os
import subprocess
import pickle as pkl
import shutil
import numpy as np
from collections import OrderedDict
from nnunet.dataset_conversion.utils import generate_dataset_json
from nnunet_model_setup import trim_data_and_setup_model
num_to_modality = {'_0000': '_brain_t1n.nii.gz',
'_000... |
ef34f9fa5815c27f60973ce9e73ad95594a5402fe9a252220698c937bddf1cbb | Python | 26,319 | 627 | """
Convenience/shell related utilities
Copyright (c) 2020 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import os
import sys
import re
import shutil
import logging
import argparse
import itertools
from enum import Enum
from functools import cached_property, partial
from .sys impor... |
f994918370f3564bc47124a0197a0e292ba9b3ebd9b70d98899539df7a5156a9 | Python | 26,327 | 576 | """Unit tests for src.createcompendia.chemicals.
Covers write_unichem_concords()'s handling of UniChem compound IDs that already embed their source
prefix (e.g. the CHEBI source stores "CHEBI:12345" rather than a bare "12345"), which previously
produced invalid "CHEBI:CHEBI:12345" CURIEs across the chemical compendia;... |
ab38b50d4c54f20ada5638e56e3f93ecb9f501c647be39358476c0f2fa6371b8 | Python | 26,336 | 748 | """
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.
TODO:
1. Simplify the case when `num_resolutions` == 1.
2. Remove indexing when the shape is the same.
3. Move some functions outsid... |
2a5821777587d27654f282dbe1955952e719e88f957e99ef8c01a6cac284efd0 | Python | 26,385 | 547 | import warnings
import pytest
import numpy as np
import pandas as pd
from neuprint import Client, default_client, set_default_client
from neuprint import (NeuronCriteria as NC,
MitoCriteria as MC,
SynapseCriteria as SC,
fetch_custom, fetch_neurons, fet... |
8ef0cad58aa5d1fd308c474b476927e935b4179803ed2d17160e420732083e4f | Python | 26,396 | 494 | import os
import scipy.io
import scipy.ndimage
import numpy as np
import freesurfer as fs
from . import gems, convertLPSTransformToRAS
from .ProbabilisticAtlas import ProbabilisticAtlas
from .utilities import requireNumpyArray
from .figures import initVisualizer
import scipy.ndimage # For center-of-mass calculation
... |
10c9e17d086ba512ea44777c3ca711d68d4e2636d7b59d06d6f68c12c6c86c33 | Python | 26,400 | 776 | """Batch correction functions."""
import os
import matplotlib.pyplot as plt
import nibabel
import numpy as np
import pandas as pd
import brainbuilder.segment as segment
import brainbuilder.utils.ants_nibabel as nib
from brainbuilder.utils.mesh_io import load_mesh_ext, load_values
from brainbuilder.utils.mesh_utils im... |
272ffebf97186b769db86b6c47a61b0fe424c142508780b01b2a16540ba7888b | Python | 26,408 | 532 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 05:56:04 2020
@author: takeiyuuichi
"""
#setting##############################################
n_jobs=16 #並列処理の数
t_n_jobs=16
PARAMETER_DIR='/Volumes/Siena/CP/parameter'
#n_jobs=40 #並列処理の数
#t_n_jobs='cuda'
#PARAMETER_DIR='/home/takeiyuuichi/Drop... |
30bad341140c0af63f1dd0fffa920634dee7699533c91cfc5800400d851de866 | Python | 26,434 | 737 | from kgx.graph.nx_graph import NxGraph
from kgx.graph_operations.clique_merge import (
check_categories,
sort_categories,
check_all_categories,
clique_merge,
)
from kgx.utils.kgx_utils import get_biolink_ancestors, generate_edge_key, get_toolkit
from tests import print_graph
from bmt import Toolkit
de... |
eb67fa12bb1c06f9534d74b460f7b1f31b94412b25348cd1603317f5adc55876 | Python | 26,458 | 678 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Implements high-level support for HDF5 file ... |
cf306ac32f2fe44630b588a077c69259ead276f4968aeab52090f9dd077347e2 | Python | 26,459 | 770 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 8 14:03:17 2025
This is the main script of this repository. It can be used to reproduce the
results presented in "The effect of spherical projection on spin tests for
brain maps".
The computation of some of the results presented in the paper takes a long
time. Pre-compu... |
c1acd6b40e1268c9847cf808bbcb3f6ca8ca2486703e972643af6178b5799f01 | Python | 26,460 | 668 | # -*- coding: utf-8 -*-
"""Layers that augment the functionality of a base layer.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from ..engine.base_layer import Layer
from ..engine.base_layer import disable_tracking
from ..engine.base_layer ... |
d820f877375d6d0ab0e24d3a3227efd244b237abb61f528dd6b25780e1db9831 | Python | 26,490 | 716 | """Versioned NumPy-backed raw cache for MassCube workflows.
``.mcraw`` is an analysis cache, not a replacement for the original vendor
archive. It stores all decoded centroid signals before MassCube's intensity
filtering and centroid repair so feature detection parameters can be changed
without reparsing mzML/TDF2 an... |
40af1eaa7d2a9f00e488d22bdfded9841ff164216984d64dfa19e5075f697488 | Python | 26,510 | 557 | #%%
# This script produces the results shown in Figure 2 in Wolff and Rademaker (2024)
# reduced data from Wolff et al. 2015, 2017 and 2020, used in this script, and precomputed results from all datasets is available at https://osf.io/bdf74/
# data used by Harrison et al. 2023 is publicly available at https://osf.io/5... |
d3ec4918780e35417e82d6f8fe6aa6ed24bddf54752f601b7e6d7afea8a7228d | Python | 26,531 | 496 | ##################################################################
# Calculating the TrimNN metrics for CRC simulation data
# Reproducibility for Figure.3C
##################################################################
import pandas as pd
import numpy as np
from scipy.spatial import Delaunay
from itertools import ... |
e0d9baec705886fa4cd8a948342dc8fddc39d0f5e477cceacde1308ba50083c6 | Python | 26,533 | 647 | # coding=utf-8
# Copyright 2021 The IDEA Authors. 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 a... |
29e095014461c47bab6a62ab0c9c06feff078529fa27ecfafba5ca3cbc421ec1 | Python | 26,538 | 554 | import random
import numpy as np
import os
import sys
import math
import torch
from torch import nn
from avg_pool import AvgPoolerAggregator
from utils import get_extended_attention_mask
from layers.prompt_layers import *
from layers.poolers import DynamicRoutingAggregator
from layers.myloss import FocalLoss
import tor... |
29b4ca61c54d196fa4e38ed0977266e85db70d65e080b17283a7178d9927ed6c | Python | 26,604 | 494 | # 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
#
# http://w... |
c3d67f123b356ef12166df475ecdbff7f2011e8d4e80f7c882778769c9d84ad0 | Python | 26,655 | 804 | """Tests for create_acc.py"""
# pylint: disable=W0212
import json
import os
import pathlib
import re
import sys
import tempfile
import pytest
from bluepyopt import ephys
from bluepyopt.ephys import create_acc
from bluepyopt.ephys.acc import ArbLabel, arbor
from bluepyopt.ephys.create_acc import (
ArbNmodlMechFo... |
22ae7ed28bfe6db7fae32cdf305cff487657ed46bffafa5b0cfd15f1278e8f1e | Python | 26,662 | 745 | """
R5-Helicon Neural Simulation: Core Functions
This module provides the primary simulation functions for R5 and Helicon
neuron populations, including neuron models, connectivity setup, visual inputs,
and simulation analysis functions.
The module implements Izhikevich-type neuron models for both R5 and Helicon
popul... |
925a08632df5dd6e8ea2d88252c529ee92e30e9aa43d9f5ff677ee9bc132c4c5 | Python | 26,725 | 339 | # Part of the following data is extracted from https://periodictable.com/
# Unit: Angstrom
VDWRADII = {
1: 1.200, 2: 1.400, 3: 1.820, 6: 1.700, 7: 1.550,
8: 1.520, 9: 1.470, 10: 1.540,
11: 2.270, 12: 1.730,
14: 2.100, 15: 1.800,
16: 1.800, 17: 1.750, 18: 1.880,
... |
7badae7a9cb67036ea2b7210b0eead7bf5a8c8d7e8268a2e5e214008c05350c0 | Python | 26,738 | 723 | """Tests for create_acc.py"""
# pylint: disable=W0212
import os
import sys
import pathlib
import re
import json
import tempfile
from bluepyopt.ephys.acc import arbor, ArbLabel
from bluepyopt.ephys.morphologies import ArbFileMorphology
from bluepyopt.ephys.parameterscalers import NrnSegmentSomaDistanceScaler
from . ... |
caac6e6e646d714b316c7a0da8723d2fcd5b0aa37090ae16d2b76e7f9f7e25dd | Python | 26,779 | 610 | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
forward = """
-- The summary table does not have a history table associated.
-- Add last editor id column
ALTER TABLE catmaid_skeleton_summary
ADD COLUMN last_editor_id integer;
UPDATE catmaid_skele... |
56594514584e6f0c1be42661561a63feb3ab0d2fdc05efa87923086b8be5c4fe | Python | 26,822 | 659 | """Support for executing Docker format containers using Singularity {2,3}.x or Apptainer 1.x."""
import copy
import hashlib
import json
import logging
import os
import os.path
import re
import shutil
import sys
import threading
from collections.abc import Callable, MutableMapping, MutableSequence
from pathlib import P... |
dbfdab18c9a4e2d8c863b2ae267ef1cc90ecc50d1a9f5d4e2fd8a2a3748ca531 | Python | 26,825 | 690 | # #############################
#
# Copyright (C) 2018
# Jennifer Dreiling (dreiling@gfz-potsdam.de)
#
#
# #############################
import copy
import time
import numpy as np
import os.path as op
from BayHunter import Model, ModelMatrix
from BayHunter import utils
import logging
logger = logging.getLogger()
... |
13619d43c6de0a10cc0cc3d5ce6f1a7c21026a6b0497d9aba2dc8a1a749a36ad | Python | 26,827 | 758 | from .GODEVAE_trainer import GODEVAE_Trainer_r
from .mixin import envMixin, scMixin
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.loader import ClusterData
from torch_geometric.data import Data, DataLoader
from sklearn.cluster import KMeans
from typing import Optio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.