sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4b02725744a4578260621f251a96289116647761f03f505dc091f1f97a8d1f5e
Python
20,466
516
import torch import os import numpy as np import dgl import logging import datetime import math import sys import gc import networkx as nx import igraph as ig from igraph import Graph import time import csv import warnings import pandas as pd import itertools from collections import OrderedDict from torch.utils.data im...
203c647b8cbfcc6e7622b88b30b09fc1d68df772d63454cdca7f988a7581eeb8
Python
20,467
664
"""Location classes""" """ Copyright (c) 2016-2020, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free...
bcddf7b58ec6a5e77bd8e09f91aecac18e54f60455d474c7c3db6398d492fa66
Python
20,482
524
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 13 11:30:53 2023 @author: schwab """ import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader from torchvision import utils, models import torch.nn.functional as F import torchvision.transform...
15b5560c7e422fd3a09e5e1d88a9565c503aa9b1cd2fada25d43db2124e47da6
Python
20,486
768
"""Utilities for backend functionality checks.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import scipy.signal as signal import scipy as sp from .common import floatx from keras.utils.generic_utils import transpose_shape from keras....
b33cc2aba5df3068bbc3840b63c0ccde6984d16cd11ce891ce150c3251696d68
Python
20,501
689
# Copyright DST Group. Licensed under the MIT license. import enum class TernaryEnum(enum.Enum): TRUE = enum.auto() UNKNOWN = enum.auto() FALSE = enum.auto() IN_PROGRESS = enum.auto() @classmethod def parse_bool(cls, state_bool): if isinstance(state_bool, bool): if state_b...
e553db4f36ab4691d4a09de0cef78e111167647ebe2592da4e5c391a7291dd57
Python
20,516
511
# MCNN model import tensorflow.keras as keras import tensorflow as tf import numpy as np import time from utils.utils import calculate_metrics from utils.utils import create_directory class Classifier_MCNN: def __init__(self, output_directory, verbose, build=True): self.output_directory = output_directo...
81f2ad87cb39d6c5bbb2d72c384e7596260f066ba7bd28ac076c3d6c82fc0d89
Python
20,523
545
import bisect import copy import functools import glob import logging import os import warnings from abc import ABC, abstractmethod from pathlib import Path from typing import List import ase import numpy as np from torch import tensor from torch.utils.data import Dataset from tqdm import tqdm from ocpmodels.common.r...
fba9a62e220fa030cccc39d624a13aa05851f61d0251676d0a69650f03f7c939
Python
20,531
503
"""Single and multi-threaded executors.""" import datetime import functools import logging import math import os import sys import threading from abc import ABCMeta, abstractmethod from collections.abc import Iterable, MutableSequence from threading import Lock from typing import Optional, cast import psutil from cwl...
a60fb1e3bce1a8a0899a15d5295eaca5f8b36b3fa209a608a1ec15c53db723fb
Python
20,539
511
from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg from copy import deepcopy # Feature interface class Feature(QtWidgets.QWidget): def __init__(self, name, data, parent=None, liveplot=None, display_name_label=True): if parent is not None and isinstance(parent, QtWidgets.QStackedWidget): ...
577494c203086cb943ecf02607bdb3066fb905df2a70a18f5259e6ab32ff4081
Python
20,546
442
from global_setting import * from scipy.ndimage import gaussian_filter import tensorflow as tf from sklearn.model_selection import train_test_split from scipy.stats import norm from scipy.stats import multivariate_normal from sklearn.covariance import ledoit_wolf import copy import matplotlib.pyplot as plt from scipy.o...
863d540e12824908152e1f390c10c04d7b5ec4a0af69988a1341304ee3826ed3
Python
20,560
550
# -*- coding: utf-8 -*- # General Django settings for mysite project. import os import sys import django.conf.global_settings as DEFAULT_SETTINGS import logging import mysite.pipelinefiles as pipelinefiles import mysite.utils as utils from celery.schedules import crontab try: import psycopg2 except ImportError: ...
a670954aa828fdabf89cf32df761294983a63d6327d68b2590241b25c713c7e0
Python
20,569
587
import yaml import os import pickle from copy import deepcopy import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import datetime import time import networkx as nx import matplotlib.pyplot as plt # from matplotlib.offsetbox import OffsetImage, AnnotationBbox import matplotlib.image as m...
e2563cb148d5373b24c6e7eb79e7d79d5f3fe42b41b98629c4985aca32f71789
Python
20,571
549
# /// script # requires-python = ">=3.10" # dependencies = [ # "matplotlib", # "numpy", # ] # /// """Generate SVG figures for the z-score normalisation explanation page. The dF/F formula and z-score formulas mirror src/guppy/analysis/z_score.py: deltaFF: (signal - control_fit) / control_fit...
4ad1e51c5610d2e6e92ec6a364770309dff0130468f4e571ed2e84b14861bd61
Python
20,574
477
from sklearn.linear_model import Ridge from sklearn.metrics import r2_score import pandas as pd import numpy as np from tqdm import tqdm ''' Predict total brain volume (change) on the basis of either - time between visits - time between visits + demographics (age, sex, etc) - time between visits + baselin...
80fffa729166723d81ee512224937af2463fd30532f4f0e3c5a8b35e89af138a
Python
20,576
634
""" 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. --- This code borrows heavily from the DimeNet implementation as part of pytorch-geometric: https://github.com/rusty1s/pytorch_geometric. Licens...
30e3d492c22ac173455b096afaa2cf5a39c9099a6d50e8936234c82e3df2c41b
Python
20,578
486
import shutil import types from pathlib import Path import pytest import guppy.testing.api as testing_api from guppy.orchestration.store_labeling import ( build_store_labeling_template, read_header, ) from guppy_test_data import STUBBED_TESTING_DATA class FakeTemplate: def __init__(self, *, hooks=None, ...
6c03b5dd49737258718b543dc4973f2983085842b189aff83467171f47f7dab9
Python
20,581
491
""" Functions for plotting mRS distributions as horizontal bars. """ import numpy as np import matplotlib.pyplot as plt # --------------------------------------------------------------------- # --------------------------------------------------------------------- # ---------------------------------------------------...
399571d6f2e72c855005a282f33df1b63455a56a9c967f36807990f154438908
Python
20,600
1,119
""" CGCNN-like embeddings using continuous values instead of original k-hot. Properties: Group number Period number Electronegativity Covalent radius Valence electrons First ionization energy Electron affinity Block Atomic Volume NaN stored for unavaialable parameters...
a490c4d0e0fc71dc73ec507d1750d04d4a57bded9fbbab73d94bb61351be5316
Python
20,610
495
# Thomas Lavigne # 18-09-2024 # #------------------------------------------------------------# # Libraries # #------------------------------------------------------------# # try: from porous_fenicsx import constitutive_laws, variational_forms, functions except: print("Please run ...
0edf80c348c4e9ff08a003fab57cd782f31eda48657b696fd34b83126fdd78bd
Python
20,620
627
"""Ecode 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 NO EVEN...
220a386583854b983d439e7d085bcc7d6d7d27e6854ff2982e3fa4244335b02b
Python
20,624
576
# -*- coding: utf-8 -*- import ujson from typing import Dict from django.db import connection from catmaid.error import ClientError from catmaid.control.authentication import requires_user_role from catmaid.models import UserRole from rest_framework.decorators import APIView, api_view from rest_framework.request imp...
6ca4432fa3f8dc8a825a3e0dbf07c8942d90d7357fcfc2d907b57fa35886acc2
Python
20,631
543
# -*- coding: utf-8 -*- # encodermap/kondata.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade # # Encodermap is free software: you ca...
34083768ac8456d8081fd5dc90b2fbc013b1cabb92f63c108d43c533985470a3
Python
20,634
474
import numpy as np import torch import random from torch_geometric.data import Data from torch_geometric.loader import DataLoader def discount_cumsum(x, gamma): discount_cumsum = np.zeros_like(x) discount_cumsum[-1] = x[-1] for t in reversed(range(x.shape[0]-1)): discount_cumsum[t] = x[t] + gamma ...
334b38d829f091c78b977c052c64972a6fcbad0bd4d8906c774be592776aadeb
Python
20,635
566
import gzip import json import typing import ijson from itertools import chain from typing import Dict, Tuple, Generator, Optional, Any, List from kgx.source.json_source import JsonSource from kgx.config import get_logger log = get_logger() class TrapiSource(JsonSource): """ TrapiSource is responsible for r...
25bc4ddc7c9d828a1f79e4d895d3c0e34353498dc6626fe472ec2489e5d1fca2
Python
20,636
752
import struct from openbabel import openbabel import pandas as pd from openbabel import pybel from Bio.SeqUtils import seq1 from biopandas.pdb import PandasPdb # saves info about specific atom type class Info: def __init__( self, sm, smina_name, adname, anum, ad_rad...
753f4e5c7232ed61d129e27a2ddfcb89023ed84c0e83cb6ff3f832b71dcc6317
Python
20,649
625
import numpy as np import multiprocessing import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib.offsetbox import OffsetImage, AnnotationBbox from matplotlib.colors import LinearSegmentedColormap from matplotlib import animation from PIL import Image, ImageOps from scripts imp...
16d1c2300fe0e747e151fbc86212a1ab128177871a7da7389c713cdc409bb07e
Python
20,671
460
# 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...
3fe204c2dbe87ffece75e707e554031ca9c4b594c0143860ca311ed4c5251127
Python
20,702
518
import torch import os import numpy as np import dgl import logging import datetime import math import sys import gc import networkx as nx import igraph as ig from igraph import Graph import time import csv import warnings import pandas as pd import itertools from collections import OrderedDict from torch.utils.data im...
69f0ab8890cdd622a5603aaf6a0a644c4126f887a446cc629acb0e4da5e45222
Python
20,704
529
# Thomas Lavigne # 02-08-2024 # # From https://doi.org/10.1016/j.jmbbm.2023.105902 # Terzaghi Problem # # Boundary conditions: # p=0 # -------- # | | # | | # | | # | | # | | # | | # ux=0| |ux=0 # | | # | | # | | # | | # | | # |...
51b4e3bb64f181592280f8b3855b7f393f15d0fcf0863d03269741250f29ad8d
Python
20,706
683
import shutil from abc import ABC, abstractmethod import re from collections import defaultdict import nibabel as nib import scipy.ndimage import nilearn.image import nilearn.masking import nilearn.regions import numpy as np from pyalfe.interfaces.c3d import C3D class ImageProcessor(ABC): """ Abstract class...
e4c86de5d1aeb1298c53f583faef6109a2f931e8d660a0084b516eba7c42bc97
Python
20,710
391
import os import tqdm import torch import torch.nn as nn import numpy as np import argparse import json import cv2 import scipy.io as sio import pandas as pd import time from scipy.interpolate import interp1d from skimage import io from nns.model import ISOSNet from utils import fix_random_seeds from data.datasets impo...
c555109e2f3e33a1cb5c0b16450cfaba360b0ece605fd89fe7cfa470a3dd22db
Python
20,726
613
"""Functions to create neuroml biophysiology""" """ Copyright (c) 2016-2022, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as...
efe811f024aaea7873d1d744ad67dd3299c5ecdef045c372d184b3b1921c5c40
Python
20,727
524
"""NWB recording extractor for GuPPy fiber photometry pipeline.""" import logging from pathlib import Path from typing import Any import numpy as np from hdmf.common import DynamicTable from pynwb import NWBHDF5IO, NWBFile from guppy.extractors.base_recording_extractor import BaseRecordingExtractor from guppy.utils....
f9430890040afe5e731fb0906319653c3a90de73f3714d05f581d6e1216b6da5
Python
20,737
428
#!/usr/bin/env python # # Extract metrics within spinal labels as defined by the white matter atlas and the template # The folder atlas should have a .txt file that lists all tract files with labels. # # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: fetch vert...
20f0db72869bb052b064c02d8e345c42910f1684bd1b0653affe9172d15c3733
Python
20,741
565
import os import argparse import pickle import math import random import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import scipy.stats from Bio.PDB.Polypeptide import one_to_index def seed_all(seed): torch.backends.cudnn.deterministic = True torch.manual...
c421f0fd26158378c47561effb6f62b7dda98b02e6cd7491aed8cd0641be763e
Python
20,744
468
import json from pathlib import Path import h5py import numpy as np import pandas as pd import pytest from guppy.orchestration.psth import ( _validate_events_overlap_signal, _validate_psth_window_parameters, execute_compute_cross_correlation, execute_compute_psth, execute_compute_psth_peak_and_are...
40cf4d848b495161d8936e132899ef029fe8b0d35d2f9667575516e663053d4f
Python
20,779
454
import numpy as np import matplotlib.pyplot as plt import matplotlib.transforms as mtransforms from fig_utils import * import os import seaborn as sns from matplotlib import gridspec def panela_experiment(fig, grid, dat, il, transl): ax = plt.subplot(grid[0, 0]) ax.axis('off') il = plot_label(ltr, il, ax, ...
d71c7c84cf9f8e059b4406e8bd8d40eebfef43e38158ccd307569e2b6a27179e
Python
20,793
577
""" System related utilities Copyright (c) 2020 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import io import sys import os import shutil import logging import subprocess import shlex import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText ...
4859f8f1fb8faab27eabb5f1b4f2b1663e5d0cf0e5e8dbad7c723afe1ddd1249
Python
20,794
487
"""Panel page for defining tonic/basal analysis epoch windows. Tonic analysis averages the preprocessed z-score / dF/F trace over user-defined absolute-time windows. Because injection timing can differ per recording site (e.g. an ICV injection reaches sites at different times), windows are defined per recording site. ...
00dc2069fd93549c2e52e3fc31184a90cbabf985397974d4692e45068e0b5bdd
Python
20,804
539
"""Open one DANDI NWB asset and report what it holds. Where :mod:`guppy.utils.dandi_filter` answers yes or no, this reads the detail the source panel shows before a file is chosen: the channels of each fiber photometry response series, the brain region, indicator and wavelengths behind each one, the store names Step 1...
458133bdd328c9a019f771fc16a829b155425ae369fb00f5959ad50245a3a9b6
Python
20,805
465
import numpy as np import random import cv2 import torch from typing import Dict from PIL import Image from scipy.ndimage import gaussian_filter1d from torchvision.transforms import v2 from torchvision.transforms import functional as F def smooth_cone(cone_label, sigma, scale): cone_label = np.clip(gaussian_filte...
f481dbca1f4880554e5be7cd7aa771bda87d4cd25a4df7879ccf569dfcb3d8b7
Python
20,812
574
"""Shared input-validation helpers for the GuPPy pipeline. This module is the canonical home for reusable validation logic that several layers of the pipeline (frontend, orchestration, analysis) need. Validation that is genuinely one-off — i.e. coupled to a specific extractor or step — should stay where it is used; on...
2c0aff950639973885633c4936897f687f60476d63c18cca46c7088af2749ef2
Python
20,825
469
import torch import torch.nn as nn import torch.nn.functional as F import sys, os, json import argparse import time import numpy as np from tqdm import trange from torchvision import datasets, transforms import matplotlib.pyplot as plt import csv from PIL import Image from Adversarial_Observation.Swarm import PSO as...
16fc998904fa5f6385aa3b9ce1b788b632950acf90a5a2f1e09c469af4fe4343
Python
20,826
469
import torch import torch.nn as nn import torch.nn.functional as F import sys, os, json import argparse import time import numpy as np from tqdm import trange from torchvision import datasets, transforms import matplotlib.pyplot as plt import csv from PIL import Image from Adversarial_Observation.Swarm import PSO as...
f5f86e02212da5058311a2b984110e682ddcf1ce80919b4d0c502457da6c6f99
Python
20,855
471
import torch import torch.nn as nn import torch.nn.functional as F import math import copy import numpy as np from utils import int2onehot from utils import get_enc_len, split_and_batchify_graph_feats, batch_convert_len_to_mask from embedding import OrthogonalEmbedding, NormalEmbedding, EquivariantEmbedding from filter...
3a35096f07694b3dc70dcb56398658f41af16ab724d5ab8d61515916ee081ffc
Python
20,856
483
import json import os import duckdb import pytest from src.exporters.duckdb_exporters import ( _metadata_subject_filename, export_compendia_to_parquet, export_conflation_to_parquet, export_intermediates_to_parquet, log_duckdb_settings_on_error, ) from tests.conftest import CONFLATION_FIXTURE_ROWS ...
48923195b3afa86f31bf65161045ca23baa34b42648598dcafb7ce28e33441b0
Python
20,906
536
# Thomas Lavigne # 02-08-2024 # # From https://doi.org/10.1016/j.jmbbm.2023.105902 # Terzaghi Problem # # Boundary conditions: # p=0 # -------- # | | # | | # | | # | | # | | # | | # ux=0| |ux=0 # | | # | | # | | # | | # | | # |...
a65b3260aced8120a700127ec2193968ac3f040de8c3cb8571b72c137602e468
Python
20,945
527
import csv from pyhealth.datasets import MIMIC3Dataset, MIMIC4Dataset from graphcare_.task_fn import drug_recommendation_fn, drug_recommendation_mimic4_fn, mortality_prediction_mimic3_fn, readmission_prediction_mimic3_fn, length_of_stay_prediction_mimic3_fn, length_of_stay_prediction_mimic4_fn, mortality_prediction_mim...
752bd162c9f7b470af34db5ecdedb9836b24d0cd52806d62a10ca89e03633a67
Python
20,982
759
import struct from openbabel import openbabel import pandas as pd from openbabel import pybel from Bio.SeqUtils import seq1 from biopandas.pdb import PandasPdb # saves info about specific atom type class Info: def __init__( self, sm, smina_name, adname, anum, ad_rad...
d665373f18f4a998c92a0b8b98ba09f0434838a7d1b668b5c44254e40cb6d4e4
Python
20,999
467
# -*- coding: utf-8 -*- import json import logging import sys import networkx as nx from networkx.algorithms import weakly_connected_components from collections import defaultdict from functools import partial from itertools import chain from math import sqrt from numpy import subtract from numpy.linalg import norm ...
f4894518d16cfa2a0d7bb62c5c156b9193188b46316a0503fe796cedfb485755
Python
21,005
687
# 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. """ Tests the h5py.Dataset.__getitem__ method. ...
1eae6a062179aba125dce81f87203640827b70cf68eac8c136b4ccc0753d248f
Python
21,013
449
# 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...
9ef148e7081679b8ab4d4dc5733ed889086341e82a099c27a187b3305ff1ec7a
Python
21,064
553
import logging import os.path import glob from medutils.mri import mriForwardOp, mriAdjointOp import numpy as np import json import argparse import yaml import matplotlib.pyplot as plt import matplotlib.patches as mpatches import h5py import copy from skimage.morphology import erosion, dilation from mr_utils.motion_tra...
a6d385a5c39592bcc85af926c01d8e904cf9bfe7e68b78d3a69b54a8994882f6
Python
21,100
475
import torch import torch.nn as nn import torch.nn.functional as F import math import copy import numpy as np from utils import int2onehot from utils import get_enc_len, split_and_batchify_graph_feats, batch_convert_len_to_mask from embedding import OrthogonalEmbedding, NormalEmbedding, EquivariantEmbedding from filter...
c9b28807fc377cd79d0db72e1b73c5df573152fdee79baa4217a1ec6393aa4fc
Python
21,108
476
import SimpleITK as sitk import pandas as pd import numpy as np import os import sys import shutil import subprocess import platform # We use the multiprocess package instead of the official # multiprocessing as it currently has several issues as discussed # on the software carpentry page: https://hpc-carpentry.github...
5f10b97491ce20f151f8cc93f1a2f4fd710a4588133f5f2cf85a824e8df12a34
Python
21,115
427
import catmaid.fields import django.contrib.postgres.functions from django.db import migrations class Migration(migrations.Migration): """Update the default values for most timestamp fields so that the database's transaction start time is used (CURRENT_TIMESTAMP or now()). This doesn't include any actual ...
c1286a2990f0714a34579cebf40832358852647480a2ef9fef9369bdfb315719
Python
21,124
506
import matplotlib.pyplot as plt 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() #import currents_visualization import math from neuron import h import neuron ...
0a2e79bc1a0f091611d09b76f7654417b8c62242bbdd188e4774c0f3688d2284
Python
21,137
540
from inspect import stack from itertools import count import numpy as np import pandas as pd import matplotlib.pyplot as plt import re from RiboGraphViz import RGV from RiboGraphViz import LoopExtruder, StackExtruder from draw_rna.ipynb_draw import draw_struct from nnn import util ##### Helper Functions ##### def sor...
9510c942e7b62cb60c7fd5e33f6b2348cece216fad861b5ff11f8489ac034098
Python
21,215
447
# load Modules from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg import numpy as np import math from scipy.signal import firwin, lfilter, lfilter_zi, hilbert, correlate from util.functions import movingAverage from features.Feature import Feature from util.conf import cc_train_params, cc_amplitude_para...
4937e8464d908e784a959d66682417e72395641dc7e0863b1211027d77022ee3
Python
21,236
722
import numpy as np import pathlib as pl from myphdlib.interface.factory import SessionFactory from scipy.optimize import curve_fit as fitCurve import h5py def convertGratingMotionToSaccadeDirection( gratingMotion=-1, referenceEye='left' ): """ """ saccadeDirection = None if referenceEye ==...
17ebdf5e113a9ce3f478e34e99370bdce11f2b02cb7f1f7cbdd71008f817996f
Python
21,257
505
import matplotlib.pyplot as plt 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() #import currents_visualization import math from neuron import h import neuron ...
1a44a4b4f282247482d57a9d7a9fdb4b8a1e222a5699192bd13caf5c2b5acedc
Python
21,266
538
########################################################################################### # Training script # Authors: Ilyes Batatia, Gregor Simm, David Kovacs # This program is distributed under the MIT License (see MIT.md) ########################################################################################### ...
4766db3797f5eb2d2255f21301781444295facff0342b0637f818d057053a804
Python
21,273
617
import json import os import random import numpy as np import matplotlib.pyplot as plt from scipy.stats import rankdata from mr_utils.motion_transforms import (transf_from_parameters, parameters_from_transf, transform_sphere) from scipy.int...
90ba569708497b182345e7594bdcd50ce3fe679f44ac2de3178f7e660978f94d
Python
21,283
505
import matplotlib.pyplot as plt 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() #import currents_visualization import math from neuron import h import neuron ...
47d314bab18e57ebba588fb2ebde72eb61e1b698fd8d706ba1d95abc5f18890c
Python
21,292
505
import matplotlib.pyplot as plt 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() #import currents_visualization import math from neuron import h import neuron ...
4956fcce0e2249d588060b0bbfef7129fd37beb2816e2562de335ccb3f66973e
Python
21,320
222
import os, argparse, time, json import numpy as np from collections import OrderedDict import nearl import nearl.data from nearl.io.traj import MisatoTraj # Define the way to generation labels for the misato trajectories def parser(): parser = argparse.ArgumentParser(description="Featurize the misato trajectori...
dea1b5ddd3e26a370b09347abeaebf97b04e1d25ff8b4efeff1eeaa2f6fcccd0
Python
21,325
636
#!/usr/bin/env python # # Copyright 2005 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
e1fca8ab75cef09cca5bd05c283dad253bcd5b7e64b10a2cf92d46b812ef4643
Python
21,332
430
"""End-to-end test of NWB export over GuPPy's native stubbed data, one acquisition format at a time. Uses the session-scoped ``step5_output_*`` fixtures (tests/integration/conftest.py), which copy a stubbed session to a temp dir and run the real pipeline to produce a populated ``<session>_output_<run>`` dir. Everythin...
05a6bcc2791a371b0c34d2f0adf37a1d419da39991c20dedf8cf7ecca640edfa
Python
21,335
499
import numpy as np import nibabel as nib from nilearn import datasets as ds import pandas as pd import os, re HO_atlas_cort = ds.fetch_atlas_harvard_oxford('cort-maxprob-thr25-1mm', symmetric_split=True) HO_atlas_sub = ds.fetch_atlas_harvard_oxford('sub-maxprob-thr50-1mm', symmetric_split=True) #Load in stored atlas...
f3c6b08159b35cf3b1d76f9ce96342ea53119444360c1f1f1d0b8ded5ad6905a
Python
21,337
456
import sys sys.path.append("/home/lab-macbook/LabExperiment/Codes/TIS/SnapAnImageAndConverttoOpenCV/") import os import cv2 import numpy as np import math import random import time import TIS import csv from datetime import datetime from screeninfo import get_monitors from collections import deque #python3 6_1_detect_...
15355252341cc7fb526f8b6558f8035fdee57075beb5a4d18a41e0dbdcc45272
Python
21,346
542
# Thomas Lavigne: chargement instantanné pose problème # 02-08-2024 # # From https://doi.org/10.1016/j.jmbbm.2023.105902 # Terzaghi Problem # # Boundary conditions: # p=0 # -------- # | | # | | # | | # | | # | | # | | # ux=0| |ux=0 # | | # | | # | ...
6683e1356c484b8db6ad8998e6cf98bbc2f02787ba1d09c11654ba57f469e4fe
Python
21,347
662
#!/usr/bin/env python3 """ CICADA FIX-training smoothing-scale development curve. Evaluates the historical CICADA smoothness implementation and prespecified candidate Gaussian smoothing scales on ONLY the historical FIX-training development set. Default curve: 6, 8, 10, 12 mm FWHM plus the historical CICADA basel...
a5e132284cd182e968fed71fa2b338adeebfc0cab2484b48ccae3e054d932f62
Python
21,363
657
"""Test that all temporary directories respect the --tmpdir-prefix and --tmp-outdir-prefix options.""" import copy import logging import os import re import shutil import subprocess import sys from pathlib import Path from typing import cast import pytest from cwl_utils.types import CWLObjectType from ruamel.yaml.com...
60a618ac59153b47915e5419ca2c578c6d80c5adb4ed19d52d7b7eb99595dc3e
Python
21,371
435
#!/usr/bin/env python # # Register a volume (e.g., EPI from fMRI or DTI scan) to an anatomical image. # # Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: if user specified -param, then ignore the default paramreg # TODO: check syn with shrink=4 # TODO: output na...
2f02dd8205d41623c554d1ea83f2460e0b8dc1731563b01843ce146b80352c8f
Python
21,377
530
#%% import numpy as np import cv2 import sys import os import pickle import torch import torch.nn as nn import SimpleITK as sitk from torch import optim from torch.utils.data import DataLoader, Subset, Dataset from PIL import Image import random from albumentations import ( GridDistortion, ElasticTransform, ...
696ea4c2d9416e88a4e4dbe7f8b6a05a45874e50d256474e90168d303758dfa0
Python
21,383
488
#!/usr/bin/env python # encoding: utf-8 """ # if Glob physiology df / ERROR if physiological doesn’t exist # Check if we already ran the analysis / if so, abort # Open physiology df # Open corresponding behavioral df / ERROR if corresponding behavioral df doesn’t exist # Clean fixation columns # Baseline correct # Extr...
a699aba4384425f261c77d1ee710efea23bf31bf8227a6eb4756b1ba1158dd6d
Python
21,402
659
"""Callback library containing training routines. See :doc:`Callback Functions </python/callbacks>` for a quick introduction. """ import collections import os import pickle from abc import ABC from typing import ( Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeVar, Unio...
0bd9f20a377873ffe6b1a8816b35e5f770cd850cb14d3ae4987a9ada4fa2e528
Python
21,410
420
# 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...
2d01e46ab38cae98ea697041801c19534fac73dc028fa7eadbc16244f1c6f56b
Python
21,434
449
import os, sys, argparse, time, random, json import scipy.stats import numpy as np import pandas as pd import h5py as h5 import matplotlib.pyplot as plt import seaborn as sns import torch import torch.nn as nn import torch.optim as optim from torch.utils.tensorboard import SummaryWriter from sklearn.preprocessing i...
f6f6fd42cbede59252e43d622909c6fbc29549eac7351b3f580919fadf7c5f61
Python
21,434
522
# -*- coding: utf-8 -*- import json from django.db import connection from catmaid.models import Connector, Treenode from catmaid.state import make_nocheck_state from catmaid.tests.common import round_list from .common import CatmaidApiTestCase class NodesApiTests(CatmaidApiTestCase): def test_most_recent_tree...
f8c669dd82600dc02233dbc9880f66cac76bfc22ee7c0621060a7c6cd78f57ef
Python
21,443
478
import numpy as np from collections import Counter, defaultdict from time import time import re from glob import glob from sklearn.base import clone as CLONE import sklearn.metrics as metrics # Imputation from sklearn.experimental import enable_iterative_imputer from sklearn.impute import IterativeImputer from pickle ...
046c0a44d5752df5842449a0ab6e2a6476ed00f6683dc2cf0c9c489dcbd2fd41
Python
21,477
607
# pylint: disable=too-many-locals, too-many-arguments, invalid-name # pylint: disable=too-many-branches, too-many-statements """Training Library containing training routines.""" import copy import os import weakref from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union, cast import numpy as np ...
63a9959ff855746340755c59e04675a477a0e185cf2b701c7012329d0978ed23
Python
21,498
642
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss from torch_geometric.nn import knn from torch_geometric.nn.pool import knn_graph from torch_scatter import scatter_add, scatter_max, scatter_mean def split_tensor_by_batch...
fabfc8de28ca584d2d1115d0fde634a441c578af198414cb4a3192db87d7d241
Python
21,514
446
from multiprocessing import dummy from collections import OrderedDict from typing import Tuple import numpy as np import torch import shutil from nnunet_mednext.training.loss_functions.deep_supervision import MultipleOutputLoss2 from nnunet_mednext.utilities.to_torch import maybe_to_torch, to_cuda from nnunet_mednext....
deabfc5aa2dfed8593bff19c65f03b884aaf22c4f768db479d9ec2f41a4178d2
Python
21,519
578
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from TD3.TD3_GNN import GNN_Feature_Extractor from torch_geometric.nn import GCNConv, global_mean_pool, global_add_pool from torch_geometric.nn import global_mean_pool import numpy as np LOG_SIG_MAX = 2 LOG_SIG_MI...
3a60ac7ac376c2da1c4a8141a590d5b509e91859336717968e978236e6c905f6
Python
21,524
546
# import math import os import numpy as np from scipy.signal import resample from abc import ABC, abstractmethod import gc import naplib as nl import torch import torch.nn as nn from collections import OrderedDict import librosa from pycochleagram import cochleagram as cgram from auditory_cortex.dataloader import Data...
48d8e5ef1ae9ab29aee5a5ae5260956fa629ccd3d071ea91727793fbc09a0542
Python
21,529
667
"""E2E tests for @global job scope. Workers use ZnDraw.jobs exclusively for register, claim, submit, disconnect, and status updates. Raw httpx is ONLY for read-only GET assertions. """ from typing import Any, ClassVar import ase import pytest from zndraw import ZnDraw from zndraw_joblib.client import Category, Clai...
24897fe89a60742d06ddf8ca0863bfe318e1bd8c9bd3504ba236e2d36d5a7f42
Python
21,542
612
import gzip from collections import OrderedDict from typing import Optional, Union, Tuple, Any, Dict import rdflib from linkml_runtime.linkml_model.meta import Element, ClassDefinition, SlotDefinition from rdflib import URIRef, Literal, Namespace, RDF from rdflib.plugins.serializers.nt import _nt_row from rdflib.term i...
4d240ecbda5e72972576c03d5a922a35f3db4970721e55dff7e9d88134a40f11
Python
21,546
512
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 7 13:08:00 2021 marker files helping functios @author: leupinv """ import markers.markers_constants as cs from itertools import product import pandas as pd import feather import mne import numpy as np def get_DF_centerd(df,cent_column,srate,metho...
d5b1429afee2be134cdfd516cf0b22414371055e2d2dbe9c50fa2108a5d38311
Python
21,551
438
# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2018-01-22 01:52 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(setting...
fa4c3b5b3db265ba68b760e8e48f6c69c497e7facd7a9e9e0d82226e893f034f
Python
21,561
553
from functools import partial import numpy as np from pip import main import torch import torch.nn as nn import torch.nn.functional as F import timm from timm.models.layers import drop_path, to_2tuple, trunc_normal_ from timm.models.registry import register_model from collections import OrderedDict MODEL_PATH = '/mnt/...
ae03e8e51fc69953f35828206a48f71b61ff597612a1d00a1049e733425cf005
Python
21,564
740
import copy import os import pytest from neo4j import GraphDatabase import neo4j from kgx.transformer import Transformer from tests import TARGET_DIR, RESOURCE_DIR from tests.integration import ( check_neo4j_container, NEO4J_CONTAINER_NAME, DEFAULT_NEO4J_URL, DEFAULT_NEO4J_USERNAME, DEFAULT_NEO4J_P...
a3806a4c437a48851e936a09e2f8397a53d231afe2089cdc51814dc47c382810
Python
21,569
449
# 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...
77bf606ab818e38259a1d486e0682d1733c5b6a60f02b3d72a3dcaa68e3cc5e7
Python
21,574
555
#!/usr/bin/env python """Evaluate every trained Poison26 checkpoint and report clean-test-set statistics. Scans models/{MNIST,CIFAR10,audioMNIST}/*.pt, infers (arch, training regime, aug) from each filename using the naming convention in 00_train_models.sh (e.g. mnist_mobilenet_fgsm_aug.pt), evaluates each checkpoint ...
8b3ae6c6b685b9a1582d469f31310eac21ea96cfba3153271b8a6d991e75078c
Python
21,600
623
"""Python utilities required by Keras.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import binascii import numpy as np import time import sys import six import marshal import types as python_types import inspect import codecs import collections _GLOB...
4c66e56a4c572f09403985c0a24b0a103547dee7c92e674b786d0c5937039935
Python
21,604
481
from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg import numpy as np from view.Plot import Plot from util import colors class PlotManager(QtWidgets.QSplitter): def __init__(self, data_manager, cell_selection_imv, parent=None): QtWidgets.QSplitter.__init__(self, QtCore....
8b56f738ecd11e53d5cc70392267852c4eafd1270b35e0ef1d911cfb82ffd1c7
Python
21,644
566
import copy import itertools import multiprocessing import os import shutil import tempfile from os.path import exists from sys import stderr from typing import Dict, Generator, List, Optional, Callable, Set from kgx.config import get_logger from kgx.error_detection import ErrorType, MessageLevel, ErrorDetecting from ...
ab3cc0ec554a5ec8cf70c1b1eb7570f7006574ab90735a132676827029813bbf
Python
21,651
511
""" Author : Alexis Lebrun (PhD student) School : Université Laval (Qc, Canada) This module provides functions to preprocess vibrational spectra. These features improve spectrum quality and can improve performance for machine learning applications """ import numpy as np from scipy import interpolate, sparse from scip...
1ae9ababf4945a84a012ae56dbd1b413aeacb102a6ca6875377801ddc2dd3418
Python
21,653
566
""" Helper functions for loading and processing results. License: BSD-3-Clause Author: Hanna M. Tolle Date: 2024-10-31 """ import os import torch import pandas as pd import random import numpy as np from torch_geometric.seed import seed_everything import importlib import logging from torch_geometric.data import Data ...
d1d8bab4f0c1e631afa50b9e17d5044dd6949296001d824dda275214d07128bc
Python
21,692
517
# -*- coding: utf-8 -*- from typing import List from django.db import connection, transaction from django.core.management.base import CommandError from catmaid.models import Project def rebuild_edge_tables(project_ids=None, log=None) -> None: """Rebuild edge tables for all passed in project IDs. If no project I...