sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
82f5daf1a40335bdda420b6f2cb0ceeec57f2136eafd9ff343717163018f2f78
Python
37,988
957
import torch import torch.nn as nn import torch.optim as optim from torch.optim import Adam,AdamW from torch.optim.lr_scheduler import ExponentialLR, StepLR, LinearLR from torchvision.datasets import STL10 import torch.nn.functional as F import torch.nn.init as init import matplotlib.pyplot as plt import torchvision ...
f56ae4ae85093ea9241a1d72ba47c562e4c4f39fd000fc3e1f57b54d28f9b37f
Python
37,988
1,083
#!/usr/bin/env python3 import scipy.sparse import numpy as np import os import math from util import TIME, TIMECLEAR, Timer import pickle from argparse import Namespace import util_min from multigrid import Multigrid, MultigridDecomp from tfwrap import tf class Domain: def __init__( self, ndim=...
174f5e0e906d295ab2d8b533acbf126da9de8c14e83acd538329ba7a87107ea5
Python
38,115
1,028
"""Tests for Keras metrics classes.""" import pytest import numpy as np import math from keras import metrics from keras import backend as K if K.backend() != 'tensorflow': # Need TensorFlow to use metric.__call__ pytestmark = pytest.mark.skip class TestSum(object): def test_sum(self): m = met...
6854821cb6bd06c220dc0333da65a6c7fe2f9c718982abf932db300289595659
Python
38,293
872
from cmath import nan import simLogger import surrogateTraining import weightAnalysis import matplotlib.pyplot as plt import numpy as np import pandas as pd from matplotlib.lines import Line2D import scipy from scipy.optimize import curve_fit import matplotlib.font_manager as font_manager def typeOuptut(output): n...
05ee71c0ff9313ef07259cc551f137fe456fda440c1c3dc8961b9e55ef267551
Python
38,299
793
''' Created on 17 Nov 2022 @author: Francois STÜDER ''' import regex from os import path from threading import Thread,RLock from time import time guibsonSeq = {'+':'XXX','-':'XXX'} polyT = {"+": "XXX", "-": "XXX", "s+": "XXX", "s-": "XXX"} polyTPair = {'+':'XXX','-':'XXX'} barcodesX = {} barcodesY = {} lengthBC = 0...
f58bfc3622a74823d4d0e2e96e0e1ed3a66db36c38d2ff3d95606b89eaeaba13
Python
38,318
942
# Numpy archive import/export. # Author: David Young, 2019, 2020 """Import/export for Numpy-based archives such as ``.npy`` and ``.npz`` formats. """ import ast import operator import os import pathlib import pprint import re from time import time from typing import Any, Dict, Optional, Sequence, Tuple, TYPE_CHECKING, ...
be8de216e4967152e09b5df15578e67f239c85efe5cff643504fe2df2ec65645
Python
38,504
870
from enum import Enum from ipaddress import IPv4Network from typing import Dict, List, Type, Tuple import inspect from gym.utils.seeding import RandomNumberGenerator import numpy as np from CybORG.Agents import SleepAgent from CybORG.Agents.SimpleAgents.BaseAgent import BaseAgent from CybORG.Agents.SimpleAgents.Enter...
ccebd67ec1c34ac8076257bfd20100e3fb7361fe7bceec83e7abacce4044cde2
Python
38,692
1,060
import pytest import numpy as np from numpy.testing import assert_allclose import keras from keras.utils.test_utils import layer_test from keras.layers import recurrent from keras.layers import embeddings from keras.models import Sequential from keras.models import Model from keras.engine import Input from keras.layer...
d5858950a8851cec1dc9492340a1deb46e10245aca434752e9bdd27d56ef95b2
Python
38,721
995
# -*- coding: utf-8 -*- # tests/test_losses.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 sof...
58cc264183de012b2d207f8130c9706d6c38a476de98bf260e6864f72a537ea3
Python
38,755
839
"""Renderers for the source-impact report. ``render_markdown`` produces the human-readable report committed to ``docs/sources/<SOURCE>/impact-report.md``. ``render_json`` produces the same data as a structured payload for downstream consumers. Both inputs are the output of: - ``src.model.source.discover_source(name, ...
a65725ed29c792ec0ce0fa463ad78a2c95c4030dbf570cb18842e7bec4c57e42
Python
38,819
861
# Detect blobs within a chunked stack through multiprocessing # Author: David Young, 2019, 2020 """Stack blob detector. Detect blobs within a stack that has been chunked to allow parallel processing. """ from enum import Enum import os from time import time from typing import NamedTuple, Sequence, TYPE_CHECKING, Opti...
453f322d1b7e1bc6ddb2ddb81157ebe576bf80ceb58fd045d932b00c05fdce91
Python
38,942
911
''' Ingredient for data loading and creating data loaders. License: BSD 3-Clause Author: Hanna M. Tolle ''' import sys sys.path.append('../../') from sacred import Ingredient from torch_geometric.loader import DataLoader from sklearn.model_selection import KFold, train_test_split, StratifiedKFold from torch_geometri...
a14b774ad17e11e378f0f91c938da845a7d188db6d5d26950ea7d394ef009bd5
Python
38,964
1,108
#!/usr/bin/env python # SQLite database connection # Author: David Young, 2017, 2020 """Connects with a SQLite database for experiment and image analysis storage. """ import os import glob import datetime import sqlite3 from time import time from typing import List, Optional, Sequence, Tuple import numpy as np from ...
a255c9c779f67b25676e6bb8744afcb1e399224423a1317bf5685931d5cf76a3
Python
39,125
807
import os import json import math import torch import torch.nn.functional as F import argparse from PIL import Image from safetensors.torch import load_file from tqdm.auto import tqdm from torchvision import transforms from datasets import load_from_disk from diffusers import UNet2DModel, DDPMScheduler, DDIMScheduler, ...
28b79ce5930fb29d960973ca94f058c8e875c12a8220e18b7c2711859ba5bd87
Python
39,227
1,184
#from nipype.interfaces.freesurfer import MRIMarchingCubes from lapy import TriaMesh, Solver from lapy.diffgeo import tria_compute_gradient, tria_compute_divergence import warnings from collections import OrderedDict import scipy.optimize as optimize import subprocess import os import nibabel as nib #from nilearn impor...
fee45ee676f977d405a4fb082a8cc4799fbfefa09251cf46d310b56819162185
Python
39,299
597
#参数少点,维度32 import numbers import torch import torch.nn as nn import torchvision.models as models import torch.nn.functional as F from transformernet import * from utils import * up_kwargs = {'mode': 'bilinear', 'align_corners': True} def conv1(in_chsnnels, out_channels): # "1x1 convolution with padding"...
914b16a48260226d0552d7f145a907f115c304be02f7d4c585d40c5a764f151e
Python
39,309
1,096
import os import numpy as np import scipy import matplotlib.pyplot as plt import auditory_cortex.utils as utils from auditory_cortex import results_dir from auditory_cortex.analyses import Correlations, STRFCorrelations from auditory_cortex.encoding import TRF from auditory_cortex.dataloader import DataLoader from au...
afcdf573f98a0841629a2a93de6ce4f45ff05f1eed458c98b34d142cdc605c1c
Python
39,378
1,102
from typing import Dict, List, Optional, Tuple import numpy as np import torch from torch import nn, Tensor import torch.nn.functional as F from torch_scatter import scatter_mean from oa_reactdiff.dynamics import EGNNDynamics from oa_reactdiff.utils import ( get_n_frag_switch, get_mask_for_frag, get_edges...
7e0fb6ad40e773432e23f9287d4c1fe43cd195fcafd133c5fbf392c930131167
Python
39,413
944
import glob import ast import inspect import re import numpy as np import scipy.stats as st import matplotlib.pyplot as plt import torch from scipy.optimize import curve_fit import matplotlib.colors as mcolors from scipy.interpolate import griddata def sigmoid(x, a, b): return 1 / (1 + np.exp(-a * (x ...
5c78005fd6263bd59e99b7c63e2ea237835003aa97645f12c88a80f4d4859af3
Python
39,547
1,277
import numpy as np import multiprocessing import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.collections import LineCollection from matplotlib.colors import Normalize from mpl_toolkits.axes_grid1.inset_locator import inset_axes from scripts import oed from scripts import load def tra...
01f2dd9bac21997db376692b2d78f8be158e77cd1830ec178b8b5ae536c0ae86
Python
39,576
1,038
import re import yaml import pickle import numpy as np from decimal import Decimal from scipy.stats import pearsonr from myphdlib.interface.session import SessionBase from myphdlib.pipeline.stimuli import StimuliProcessingMixin from myphdlib.pipeline.events import EventsProcessingMixin from myphdlib.pipeline.saccades i...
7df8fb961652a83b45f001089260465b2b672128e0356ed032e1f3c91b6cf2c6
Python
39,603
1,067
# -*- coding: utf-8 -*- # encodermap/loss_functions/loss_functions.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # #...
504fae3f7e4e6a0ddb294a0921ba62656dbbdf5ac427ae7fd3c4132b6fbbfeae
Python
39,613
947
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Import ontology and classification from Pavel's database. The resulting # CATMAID onrology will be similar to what is expressed as a database scheme # there: # # Experiments # # flake8: noqa import copy import json import pprint import pymysql.cursors import pymysql im...
e35f532a5805030a53fe69c99105a704ad3c70a3c7f77d19b6431cb23a3645eb
Python
39,668
1,249
from lapy import TetMesh, TriaMesh, Solver from lapy.diffgeo import tria_compute_gradient, tria_compute_divergence import warnings import subprocess import tempfile import os import nibabel as nib import numpy as np from scipy.spatial import Delaunay, KDTree from scipy.spatial.distance import squareform, pdist from b...
e06a43d212205a113c2f57295e9e0dd94f357a4850bb5faac1bc265d5d06af37
Python
39,703
968
"""Tests for Keras confusion matrix metrics classes.""" import pytest import numpy as np from keras import metrics from keras import backend as K from keras.utils import metrics_utils if K.backend() != 'tensorflow': # Need TensorFlow to use metric.__call__ pytestmark = pytest.mark.skip import tensorflow as t...
c6e89b578f0897082af2df7deaad4a50ff0bc5ba6b267a6b1d3b2793d5fd9974
Python
39,742
833
from django.db import migrations, models import django.contrib.gis.db.models.fields forward_summary_update = """ -- The summary table does not have a history table associated. -- Add num_imported_nodes column ALTER TABLE catmaid_skeleton_summary ADD COLUMN num_imported_nodes bigint; UPDATE catmai...
04ae0c2a0d7ff81531e0fd3521723125e76ebc4bdc6f578c59272555cfe133c9
Python
39,821
757
#!/usr/bin/env python # # Compute maximum spinal cord compression (MSCC) or maximum canal compromise (MCC) using AP diameter or other # morphometrics. # # Copyright (c) 2023 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: maybe create an API or move some functions import sys impor...
d69941a0d4b26f50be6239dcac5e166c6c36ef5692406f6bc86cf1375f4a7d36
Python
39,822
1,215
import h5py import numpy as np import pathlib as pl from scipy.signal import find_peaks as findPeaks from scipy.stats import pearsonr, chi2_contingency from matplotlib import pylab as plt from myphdlib.general.toolkit import psth2 from myphdlib.figures.analysis import GaussianMixturesModel, g, convertGratingMotionToSac...
3d5f1e697e9a29c08bd5fe9c9b4a615a9ee36966dfaa9e78231dc9e819ad68cf
Python
39,936
1,020
# Anatomical ontology management # Author: David Young, 2019 """Handle ontology lookup. """ import os from collections import OrderedDict from enum import Enum import json from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd from pandas.errors import Pa...
25a2607a8e700b784873eddfe6e8f3b8575b1fb05bb207d9393dc72010c35454
Python
40,063
736
# 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...
35229e7ef6eca48735171b1a21b3a97c918b6a8f9578a16341c67b6bb09e380a
Python
40,091
984
""" (AKA dbic-bids) Flexible heuristic to establish BIDS DataLad datasets hierarchy Initially developed and deployed at Dartmouth Brain Imaging Center (http://dbic.dartmouth.edu) using Siemens Prisma 3T under the umbrellas of the Center of Reproducible Neuroimaging Computation (ReproNim, http://repronim.org) and Cente...
2a24e0463d1471ae60a66c31036db68f7019f3a9e0e885c418cbbdecf1ca216e
Python
40,093
930
# -*- coding: utf-8 -*- # Generated by Django 1.9.10 on 2016-11-29 19:08 from django.db import migrations # This fixes two function calls in history view and table construction: # # - create_history_view_for_table() has one parameter instead of two # - initialize_new_history_table() expects three parameters instead...
470cce8faf7ba3d88abd40182eea71bb54d21859907bf42a6b52f22a40ea8902
Python
40,670
1,088
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from Utils.dataloader import * from Utils.config import loaderConfig from torch_lr_finder impor...
c6739abcd303b3a87c9076ec380e7fac7eefb17a6a8f247b4ee47d7e8fbd76b2
Python
40,836
1,213
# tests/test_providers.py """Tests for provider system endpoints.""" import asyncio import json import uuid from conftest import make_room_address from zndraw_auth import User from zndraw_joblib.dependencies import request_hash from zndraw_joblib.models import ProviderRecord from zndraw_joblib.schemas import ( P...
9d09fc34b1429c46b9853ce2fc3b85fcfb1fc3d312bc8b3bbfa4705ae05954d5
Python
40,858
818
import argparse import os import platform import sys from copy import deepcopy from pathlib import Path FILE = Path(__file__).resolve() ROOT = FILE.parents[1] # YOLO root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH if platform.system() != 'Windows': ROOT = Path(os.pa...
48ad99416f8bafce6cec1dfabbf3315e0a46d8df7aaad26d5cd19fcd563aee9d
Python
40,902
1,167
# -*- coding: utf-8 -*- """ Functions for calculating and manipulating spatial autocorrelation Some functions: Ross Markello, netneurolab the rest: Nikitas Koussis, SNGNewy """ import os import tempfile from pathlib import Path import matplotlib.pyplot as plt import nibabel as nib import numpy as np from scipy import...
07b3bdeebde55dd498c6baf8205bbad94ccdaeb780958d4c37bd887476d65b67
Python
40,907
1,109
########################################################################################### # Implementation of MACE models and other models based E(3)-Equivariant MPNNs # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ###############################################...
efe5d05181cf9d8e6f34c276b838ad26e9cc16a66e9b4bcbfc527455293f0f87
Python
41,052
1,106
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import itertools import unittest from typing import Any, Tuple import numpy as np import torch from fvcore.transforms import transform as T from fvcore.transforms.transform_util import to_float_tensor, to_numpy # pyre-ignore-all-errors class Te...
672e6c5dd28ecb28340cbb8535698b02e541ccb309a1759f6609a1d343ad65c5
Python
41,234
1,133
# Author: Huaxu Yu # Core data models and processing operations for raw MS data. # imports import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import matplotlib.font_manager as fm from dataclasses import dataclass, field from time import time from ..params import Params from ..feature_d...
b82020e1f17f704ca05ce0226717791b55e63f69011e771312d320a53a301d0d
Python
41,275
1,149
"""ZnDraw main client class implementing MutableSequence[ase.Atoms].""" from __future__ import annotations import logging import re import uuid import warnings from collections.abc import Iterable, MutableSequence from dataclasses import dataclass, field from typing import TYPE_CHECKING, Annotated, Any, Literal, cast...
9fe99159a3ef29488c0540f987ae65be94d6cc7b3bdfcb8eba0b39f0c5edddaa
Python
41,449
1,062
import copy import datetime import functools import logging import threading from collections.abc import MutableMapping, MutableSequence, Sized from typing import TYPE_CHECKING, Optional, Union, cast from cwl_utils import expression from cwl_utils.types import CWLObjectType, CWLOutputType, SinkType from schema_salad.s...
66bfdc6514c39105fa9a116efd6e081f681f6aa8eb67e20b2038776f2b14539f
Python
41,465
1,245
"""Module with overloaded things from bluepyopt.""" # Copyright (c) 2022 EPFL-BBP, All rights reserved. # # THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PU...
c00ec14ee6765af259767e3998a92635d98db9c0c2591e3985df1c129ef0b5a0
Python
41,518
1,035
import os import keras from keras import ops from tsgm.types import Tensor as TensorLike # a keras_dataset can be tf.data.Dataset or Torch DataLoader from tsgm.backend import tf_function_decorator, Keras_Dataset, get_backend import numpy as np import numpy.typing as npt from tqdm import tqdm, trange from collections im...
7e8ff4d918e97c171741a708aafa2c38c49850a15ad6fbf2db7553c5e5350ce4
Python
41,612
1,071
# # CalciPy (calci.py) - A python script for processing ratiometric calcium fluorescence data # # By George McMullen # # One of the primary challenges in processing ratiometric data is that the two # signals which make up the ratiometric data are actually captured separately, # and it is not known which is which. Calci...
bf8916a814e6d4281c8d32ea271d609f8d0aebd1895445480cfac8094e2c1f4a
Python
41,622
1,052
# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
ac43162d32caec93194408c1cf8f168682b8bae369c1c12aed6287bd34f48b1f
Python
41,755
806
import time import os import argparse import sys import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp import resource import datetime import torch from torch.utils.data import Dataset, DataLoader from torch import nn, optim from torch.nn import functional as F from sklearn.decompositi...
80b9008372f7828212edd846d3e378103c1fe0822f2288e9f63946f9e6783bf0
Python
41,796
1,023
""" (AKA dbic-bids) Flexible heuristic to establish BIDS DataLad datasets hierarchy Initially developed and deployed at Dartmouth Brain Imaging Center (http://dbic.dartmouth.edu) using Siemens Prisma 3T under the umbrellas of the Center of Reproducible Neuroimaging Computation (ReproNim, http://repronim.org) and Cente...
68808af30d05fd05d395607f964afe64a35bbce0c126647433c5e78844fa7cac
Python
41,856
1,288
from __future__ import annotations from math import sqrt from functools import partial from itertools import product from collections import namedtuple from beartype import beartype import torch from torch.nn import Module, ModuleList, ModuleDict from torch import nn, is_tensor, Tensor import torch.nn.functional as ...
1f465d2994377304ddf9f6304125a2f0e482990d41cd102eecb0ba4082cf0d4f
Python
41,892
1,073
# -*- coding: utf-8 -*- # encodermap/misc/saving_loading_models.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # En...
19b3335a248edbe0c20e84ac86e3b79e859852edf604dc2b7aefd6da478de889
Python
41,917
808
import time import os import argparse import sys import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp import resource import datetime import torch from torch.utils.data import Dataset, DataLoader from torch import nn, optim from torch.nn import functional as F from sklearn.decompositi...
3fc3be93ac4257d132922e4784dc20c6588c710d8dca40a8aacee294b5313a1e
Python
41,996
1,143
import pytest import numpy as np from numpy.testing import assert_allclose from keras.utils.test_utils import layer_test from keras import backend as K from keras.layers import convolutional from keras.models import Sequential from keras.backend import load_backend # TensorFlow does not support full convolution. if ...
551b952ce055f625cd4d80a527c80f5db0ee2e35e224d197a168cc9913bd5a6a
Python
42,089
874
import sys from tkinter import Tk, Label, Button, GROOVE, CENTER, StringVar, END, LEFT, ttk, filedialog from PIL import ImageTk, Image import os import pyedflib import matplotlib.pyplot as plt import math import numpy as np from scipy.signal.windows import dpss from scipy.signal import detrend from scipy.fft import rff...
a536af33b1885720be8ab50ca5addb7f7d8d9812a901e945b4e856e134d0006c
Python
42,128
770
import os import numpy as np import pickle from .SamsegUtility import * from .utilities import requireNumpyArray from .figures import initVisualizer from .Affine import Affine from .ProbabilisticAtlas import ProbabilisticAtlas from .Samseg import Samseg from . import gems """ Longitudinal version of samsegment The i...
1407d8ec2ba3796850146caf2285f9c7c7cdf293901d81010583f21e52f2a8d9
Python
42,191
1,096
import datetime import errno import functools import itertools import logging import math import os import re import shlex import shutil import signal import stat import subprocess # nosec import sys import threading import time import uuid from abc import ABCMeta, abstractmethod from collections.abc import Callable, ...
9de660c556634250c323df2f200c83fb5fb263d0c3685c06b70065e91dfca425
Python
42,231
917
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: ...
475aab454223a960ccf28ad5f86e1266b56b8adde9ccdf74af58c02ef1b828ee
Python
42,445
739
#!/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/Dro...
63c4a2f6bd4bc6a1bf532d40008f2a85580bc1c5defec030139ee30d4e588eeb
Python
42,501
993
from pathlib import Path from typing import Dict import napari import numpy as np import pandas as pd import starfile import torch from PyQt5.QtCore import Qt from magicgui import widgets from matplotlib import pyplot as plt from matplotlib.figure import Figure from matplotlib.widgets import LassoSelector, PolygonSele...
c86030378cb3233d0cd0da9ad9ee5169d8db4bf39cfddd44378f259c0d8cc744
Python
42,686
1,040
"""Training-related utilities. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import inspect import collections import copy import numpy as np import six import warnings from collections import OrderedDict from .. import backend as K from .. import los...
c0e5b3e8b7eefdac9a6a1db782573909e0c1b87037a602b84657f45a8541662b
Python
42,714
1,272
import os import sys import warnings from collections import Counter from genericpath import exists as pexists from os import makedirs from os.path import basename, join as pjoin, realpath, splitext from pathlib import Path from shutil import copyfile, which import nibabel as nib import numpy as np import visualqc.c...
c6db1a665294874b6e058f542abb585eeae96ff4cf151c739995c4112fc3bd6a
Python
42,849
813
import time import resource import datetime import argparse import sys import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp import torch from torch.utils.data import Dataset, DataLoader from torch import nn, optim from torch.nn import functional as F from sklearn.decomposition import ...
dee6f2100d0afff2ef0c731038b01a24309edfebf52e4e16fcd603883a671ef5
Python
42,869
1,111
"""Access point module.""" # Copyright (c) 2022 EPFL-BBP, All rights reserved. # # THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN ...
9698b0d7abcdb94d4557505fdc3929eb9a53604933d2ef296f03592e699688f1
Python
42,982
815
import time import resource import datetime import argparse import sys import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp import torch from torch.utils.data import Dataset, DataLoader from torch import nn, optim from torch.nn import functional as F from sklearn.decomposition import ...
2772419a0623558550f94d52b4caa18ca78ae4512cd7033871218f280b739913
Python
43,074
1,040
# -*- coding: utf-8 -*- # encodermap/misc/xarray.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap is fre...
be7f3b45e9d86ecbe78bb28ac72e5a90772daee84a8e455b8d0884ea74da20fe
Python
43,148
1,208
import os import pandas as pd import numpy as np import random import matplotlib import matplotlib.pyplot as plt import hdbscan import umap.umap_ as umap from sklearn import metrics from pathlib import Path from natsort import index_natsorted from mpl_toolkits.axes_grid1 import make_axes_locatable def evaluate_model...
97aac12362f8bcd0968c9ad580655bcb6aad053efa6c3da0e3cae5eb6776fc95
Python
43,303
1,131
import abc import math import tsgm import typing as T # import keras3.0 here, the LocallyConnected1D is not supported in keras3.0, I replace it with Conv1D import keras from keras import layers # replace tf with ops in keras3.0 from keras import ops from prettytable import PrettyTable class Sampling(keras.layers.L...
39737803f78f594f09b50dcea1dab10a79add46c879759e095257ea2ef75250f
Python
43,378
997
from io import BytesIO from types import SimpleNamespace import holoviews as hv import numpy as np import pandas as pd import panel as pn import pytest from guppy.frontend.parameterized_plotter import ( ParameterizedPlotter, available_psth_metrics, build_plotter, make_dir, overview_y_options, ...
df9124f750c9ae261cc6f5f0a91933196d26a7320942bd8d79ba0076f43ead90
Python
43,601
995
import numpy as np from ..gui.sda_widgets import check_cofiring, _precalculate, calculate_fpr, calculate_single_value_windowed_data, add_distance_to_fpr from ..gui.pop_up_messages import ProgressWindow import matplotlib.pyplot as plt import random from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg a...
509dc5c90dea86dbfc6f3d79e8e6e12e3bbcbfd6e0b537d0e284ea15dbc9e06e
Python
43,625
1,144
import torch import transformers import json import sys sys.path.append('/root/autodl-tmp/lako/LaKo-main/data_process') import pickle import nltk.stem.porter as pt from re import template from tqdm import tqdm import numpy as np import os.path as osp import numpy as np from rank_bm25 import BM25Okapi import pdb import ...
0c6efdcd949a4797b5009ee8c28e0b092f98b5227f33d424d4453a5a0d21a3bf
Python
43,657
1,074
# Long ago, before the days of freesurfer 7, python files in the scripts # directory imported some utilities from a fsutils.py file. Now that we # have a legitimate python library, all the tools from fsutils have been # copied here. Those particular python scripts, like aparcstats2table, will # now import 'fsuilts' via...
66ac13565569f26465d7e6a9be8abd1bcbb86d7fbcefc87af53445f2eb62ad1a
Python
43,734
657
# -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import include from django.urls import re_path from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import ensure_csrf_cookie from django.views.generic import TemplateView from django.urls import rever...
76b5340ab23cdcd7a8da0f13916c447ebd3d1ca55339e6f2f2020b4840a597b2
Python
43,749
1,202
import logging from pathlib import Path import numpy as np import pandas as pd from .io_utils import ( COVARIATE_PREFIX, PSTH_SIGNIFICANCE_PREFIX, decide_naming_convention, fetchCoords, get_control_and_signal_channel_names, is_covariate_label, read_hdf5, recording_site_from_channel_lab...
750e35a67eee8071bf39778b11e62277689148cb190373079941835a625648bf
Python
43,821
1,269
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import math import time from math import pi as PI import torch import torch.nn as nn import torch.nn.functional as F from torc...
ecdc7d1d102d99b859f26415588ffca4db86dc969ebb309973d318f1653460aa
Python
43,954
1,094
import numpy as np import pandas as pd import sklearn as skl import sys from datetime import datetime from joblib import Parallel, delayed from tqdm import tqdm from sklearn.metrics import roc_curve, auc, f1_score, precision_recall_curve import logging logger = logging.getLogger(__name__) # handler to discard con...
e6f16b6a4b35901043a29519925c1a11c3739491da05f3d72ff46565a3a5ee6b
Python
43,995
1,092
from __future__ import print_function import multiprocessing as mp import os import sys import threading import pytest import numpy as np import six from keras.models import Sequential from keras.layers.core import Dense from keras.utils import Sequence from keras import backend as K pytestmark = pytest.mark.skipif(...
3bf5bb62d11ffda2a3df737f648b9fcd2e8766756a6bcd32e03966fbf2f9664d
Python
44,025
1,084
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from Utils.dataloader import * from Utils.config import loaderConfig, modelConfig from torch_lr...
a262bb776032dcae225a0036ab539d00cb1437a9c7b31aa4e1f18c18b36020f5
Python
44,028
845
# 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...
33904c7dc4b16465c15ea7f2ae43d9e3e5be0dc59caf3817ffe09cc847cbe2e9
Python
44,073
1,278
"""Acquisition functions for Bayesian Optimization. The acquisition functions in this module can be grouped the following way: - One of the base acquisition functions (:py:class:`UpperConfidenceBound<bayes_opt_dnn.acquisition.UpperConfidenceBound>`, :py:class:`ProbabilityOfImprovement<bayes_opt_dnn.acquisition.Pr...
a635f8a01ece65149d3f626a9330bf4ad8dd648cc1425f4e0d8f4f71ac466f89
Python
44,281
1,136
# RMDNet: RNA-aware Attention-based Multi-Branch Integration Network import os import sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.dirname(BASE_DIR)) import numpy as np np.set_printoptions(threshold=np.inf) import pdb import torch import torch.nn as ...
de486277873631a1ab4202e6e7139c9b16f783a436d897db9dbb45652f155772
Python
44,322
1,269
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import ast import collections import copy import importlib import itertools import json import logging import os import sys import time from ...
523757de5effaf3d9381ffc82cf4ffdbf46aa01998d6bfc4b39e7d3a616ba2dd
Python
44,519
1,042
import os import pickle import string import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.colors as mcolors import matplotlib as mpl from matplotlib import cm import seaborn as sns from itertools import product def load_results(labels, fns, a...
2cfe66d4f455d1dc5e948a8df7715961ebd76c1c16d61640a974ac53f28c9b63
Python
44,523
1,038
# -*- coding: utf-8 -*- import datetime import enum import glob import json import logging from math import cos, sin, radians import os import os.path import math import msgpack import numpy as np from PIL import Image as PILImage, TiffImagePlugin import requests from time import time from typing import Dict, List, Tu...
e27ea031677c7e97906b1d9f58f95ff5d538c96dea180f32fd7232b9fe1b85d8
Python
44,549
975
import torch import torch.nn as nn from collections import OrderedDict from zytlib.utils.classfunc import save_args from zytlib import vector, table from zytlib.utils.wrapper import registered_property import random from torchfunction.lossfunc import softmax_cross_entropy_with_logits_sparse from torchfunction.select im...
d756b5138ed1077b708b4a891d3e25933e41f7b0b633f4861bedea4124758540
Python
44,790
1,174
import json import types from pathlib import Path import numpy as np import panel as pn import pytest from guppy.extractors import NpmRecordingExtractor from guppy.frontend.store_labeling_instructions import StoreLabelingInstructionsNPM from guppy.orchestration.store_labeling import ( _compute_npm_channel_preview...
b1afd44f480b8266365bec23c5d7d4bae899dc1832766aca43308b3b5cdd8a77
Python
44,793
837
# 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...
1c4f4bde9617f6f1a9b210a97b1a5093aab8e2bb13b3267f59123e1edf611fe1
Python
44,825
951
""" Tools for motion correction (moco) Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ # TODO: Inform user if soft mask is used # TODO: no need to pass absolute image path-- makes it difficult to read # TODO: check the status of spline() # TODO: check the status of c...
59e3ac7fb8412fba8570bd7169e2b0e7c389d2f4703197615c4a4e70ca096d8e
Python
44,825
955
try: import cPickle as pickle except: import pickle import gzip from hippounit import plottools import matplotlib.pyplot as plt import os import numpy import seaborn as sns big_errors_spiking = [] all_features = [] spiking_features = [] big_errors_spiking2 = [] all_features2 = [] spiking_features2 = [] base...
96146a8269140beeba14aa167ff7a61d5edc448af2ffa474982815dd9527b317
Python
44,941
1,088
# -*- coding: utf-8 -*- from functools import wraps from itertools import groupby import json import re from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple, Union from psycopg2 import ProgrammingError from guardian.core import ObjectPermissionChecker from guardian.models import UserObjectPermission,...
292806cd6c8771a2290f72efc9043f1c69d8bbcbe565dcaeb1b554bc749b9d9a
Python
45,193
1,267
# -*- coding: utf-8 -*- # encodermap/models/layers.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap is f...
8dfc1327d626dd6b20dabbdd9742d9358b1c932c47b9e6918fa872a3ad239f27
Python
45,267
1,044
# -*- coding: utf-8 -*- from django.db import connection, migrations, models from django.conf import settings # Indicate whether history tables are enabled for this migration. If they are # not, only history tables will be created, but no triggers are installed and no # initial population of history tables will happ...
5d6db3fef67cf227366b8a9c795cec61868ce2442d9dd0cd365cc5292d0e65eb
Python
45,420
1,048
from sklearn.linear_model import Ridge from sklearn.metrics import r2_score import pandas as pd import numpy as np from tqdm import tqdm import os ''' Predict LBACs (or MBACs) from a phenotypic domain THe idea is such: Linear Regression predicts pattern X change Given variables from a certain class (cognitive, me...
32a8408e87f74b76fc1b37fad57932b330555a2270b9026b1c723177d5f453e1
Python
45,423
1,273
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp from unittest import TestCase import mmcv import numpy as np import pytest from mmengine.registry import init_default_scope from PIL import Image from mmseg.datasets.transforms import * # noqa from mmseg.datasets.transforms import (Loa...
92fcf4b0cb4e036400e2b27d7a353cbce4e8501e8a3768a670227fcbd8a0eb7d
Python
45,460
1,420
# Library functions shared within MagellanMapper # Author: David Young, 2017, 2023 """Shared functions with the MagellanMapper package. """ from functools import lru_cache import os import pathlib import shutil import sys from typing import Any, Callable, Generator, List, Optional, Sequence, Tuple, \ Union import ...
38581136f9c8af7771f38a0346d72d4ce6eeb93623458565fb5bc4f08a25db4a
Python
45,521
863
#!/usr/bin/env python # # Register anatomical image to the template using the spinal cord centerline/segmentation # # Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: for -ref subject, crop data, otherwise registration is too long # TODO: testing script for all c...
ac8a1b94fb972ea53c34ba20e0ecf37fd9fcac9ef5354a06b7887c0e6edfb551
Python
45,545
1,284
from __future__ import annotations __docformat__ = "numpy" from collections.abc import Callable import logging import os import os.path as op import random import re import shutil import sys from types import ModuleType from typing import TYPE_CHECKING, Any, List, Optional, Tuple, cast import filelock from nipype im...
a947e3f295796d0c828a85991241de09d526eef016767b52fd236703e218fc5e
Python
45,563
989
import copy from textwrap import dedent import numpy as np import pandas as pd from ..client import inject_client from ..utils import tqdm, iter_batches from .neuroncriteria import NeuronCriteria, neuroncriteria_args from .synapsecriteria import SynapseCriteria from .connectivity import fetch_adjacencies # Some data...
8e9362ec3c64ee04f1984ce560c3b3edbd15caf2b6325a588c38c4999621bfdd
Python
45,616
889
import pytest import json import keras import keras.backend as K import numpy as np import os def test_dense_legacy_interface(): old_layer = keras.layers.Dense(input_dim=3, output_dim=2, name='d') new_layer = keras.layers.Dense(2, input_shape=(3,), name='d') assert json.dumps(old_layer.get_config()) == js...
5847e2b2de9b24aa68f14da56930ad5d8be06e470d90b3998a2309cc666e1670
Python
45,732
1,083
#!/usr/bin/env python3 import os import sys script_dir = os.path.dirname(os.path.realpath(__file__)) grandparent_dir = os.path.dirname(os.path.dirname(script_dir)) sys.path.append(grandparent_dir) from collections import defaultdict import argparse import json import math import numpy as np #os.environ['CUDA_VISIBLE...
eef97a7a51b8549eeff1f307832d0f56b2ed1536ec6a7fb94463302f19a608d5
Python
45,898
943
#!/usr/bin/env python """ 1. Unlock scans_tsv and update it based on runtype metadata 2. Harmonize discrepancy between nifti and behavioral data 3. Starting from Line 242, Behavioral data conversion to BIDS valid format Same format occurs for pain, vicarious, cognitive data convert behavioral file into event lists and ...
38027a441b126195252077b2a2f40c663c234ec0fff168e9e15b688456f77543
Python
45,944
846
import csv import json from collections import defaultdict from pathlib import Path from src.babel_utils import TypedClique, reduce_to_most_specific_tree_codes, write_compendium from src.categories import ( ACTIVITY, ANATOMICAL_ENTITY, BIOLOGICAL_PROCESS, CHEMICAL_ENTITY, CLINICAL_FINDING, CLIN...
8a98571d69e01ce11a9359cbb8f26cf2f79a0c80297123e605a4bfa505d6922a
Python
46,181
1,265
"""Handle BIDS specific operations""" from __future__ import annotations __docformat__ = "numpy" from collections import OrderedDict import csv import errno from glob import glob import hashlib import logging import os import os.path as op from pathlib import Path import re from typing import Any, Optional import wa...