sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
68ed90011d534a282de172832a22b14208b5e7f6f8f59b10b4632e7806acccfc
Python
7,115
238
import torch import torch.nn as nn from torch.hub import load_state_dict_from_url from torchvision.models import ResNet def conv3x3(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class SELayer(nn.Module): def __init__(self, chan...
52316d871056cc12057df8d9e1400b8c882f71dd8f7eed37f0d4f926deedd08a
Python
7,119
201
# Inheritaed from open-mmlab/mmclassification # Modified by Hangyu LIN import sys from collections.abc import Iterable from multiprocessing import Pool from shutil import get_terminal_size from .timer import Timer class ProgressBar: """A progress bar which can print the progress.""" def __init__(self, task...
d3984173f219d348ae272d5f2c10f7e3c35e4a73e34577404ee884d44b388996
Python
7,120
230
import numpy import six import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import COLTYPE_FLOAT from cellprofiler_library.opts.measureimageareaoccupied import MeasurementType, Target import cellprofiler.modules.measureimageareaoccupied import cellprofiler...
e3c93a8966fa2f6cb3524f48212942d4aea11aec45aa056ae1f3c5a7a559a2ac
Python
7,126
199
# study: .sqlite3 import sys import os import time import subprocess import sqlite3 import lib2nist start_time = time.time() __version__ = "0.1.1" # class Thing: # def __getitem__(self, key): # return getattr(self, key) # def __setitem__(self, key, value): # setattr(self, key, value) # # S...
f50b4756669c047bf17b94aa576b3caaef9236466d716b0a3b07e4a3610b8521
Python
7,127
149
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline DICOM to NIfTI conversion module. Repository: https://github.com/JSIERO/ClinicalASL Author: Jeroen Siero Institution: UMCU (University Medical Center Utrecht), The Netherlands Contact: j.c.w.siero@umcutrecht.nl Description: This module provides f...
bdf482e6fca64aa0272f1d75a01bd982b7b9cb0705f8a62fb32379c1f82490f3
Python
7,133
180
import collections import numpy import imageio from ..constants.image import MD_SIZE_S, MD_SIZE_C, MD_SIZE_Z, MD_SIZE_T, MD_SIZE_Y, MD_SIZE_X from ..preferences import config_read_typed from ..reader import Reader SUPPORTED_EXTENSIONS = {'.png', '.bmp', '.jpeg', '.jpg', '.gif'} # bioformats returns 2 for these, imag...
061c2339f94fecad6a1352e4031fbefe5489812f62b1116162ce657b4f28889f
Python
7,139
192
from termios import VMIN import matplotlib.pyplot as plt import numpy as np import os os.environ['MNE_USE_NUMBA']='false' import mne from collections import OrderedDict import utils import settings def plot_conventional_temporal_kernels_by_weight(Wconv, Wout, selected_channels, fs=250): """ y axis ...
3c3850d8583cea23d7605ab37b8b02e9b764537a479b2abafb7e9de03e8a343d
Python
7,142
198
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Apr 26 14:18:33 2018 @author: saskiad """ import numpy as np import scipy.stats as st import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.ticker as mtick import seaborn as sns areas = ['VISp', 'VISl', 'VISal', 'VISpm', 'VISam', '...
0527beb2aa67a620425479fa09fa18dbf8ef311109a1de72e9df6d436ee7403b
Python
7,145
244
""" pysteps.cascade.bandpass_filters ================================ Bandpass filters for separating different spatial scales from two-dimensional images in the frequency domain. The methods in this module implement the following interface:: filter_xxx(shape, n, optional arguments) where shape is the shape of ...
2f8a117c915150d76ef6bf92d177e7ca102adb5c13e62868cd10a374e69162bd
Python
7,149
189
""" Bilinear-Attention-Transform and Non-Local Attention Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms` - https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html Adapted from original code:...
c3b0c0319ad8b60d7e026e23a8d82c37c180ccfbf3d30aba94fcb9825f983485
Python
7,158
175
""" Lambda Layer Paper: `LambdaNetworks: Modeling Long-Range Interactions Without Attention` - https://arxiv.org/abs/2102.08602 @misc{2102.08602, Author = {Irwan Bello}, Title = {LambdaNetworks: Modeling Long-Range Interactions Without Attention}, Year = {2021}, } Status: This impl is a WIP. Code snippets in the...
4b4028a37bc711896e9a09e000d28694cf3a7c4dd6d7945e696c666f82ad843f
Python
7,165
194
from torch.optim.lr_scheduler import ( LambdaLR, CyclicLR, ExponentialLR, StepLR, ReduceLROnPlateau, CosineAnnealingWarmRestarts, CosineAnnealingLR, ) import math def cyclical_lr(stepsize, min_lr, max_lr): # Scaler : we can adapt this if we do not want the triangular LR scaler = la...
8ee49876137965a061955759c7b97a2a37598cc4f0003c879aae46980dfac7c9
Python
7,165
175
# This file is part of pyunicorn. # Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors # URL: <https://www.pik-potsdam.de/members/donges/software-2/software> # License: BSD (3-clause) # # Please acknowledge and cite the use of this software and its authors # when results are used in publications or publi...
9d83a37d6ed67560661998487e068db00803a542015c942ef983bff3e71e6000
Python
7,169
220
# Created by: Deserno, M. et. al., 2023 for https://www.nature.com/articles/s41598-023-38213-7 # Experimental code to visualize tracking results. import colorsys import os import pickle import random import cv2 import numpy as np import pycocotools.mask as mask from alive_progress import alive_bar def generate_colo...
16c6c25914dc280a140c61fd3b04e05b3d7f5de7a3a4d9632fe322d12e2c8bf7
Python
7,177
224
#!/usr/bin/env python from os.path import join, dirname, abspath import inspect from mrHARDI.base.application import MagicMonkeyConfigurable from mrHARDI.main_app import MagicMonkeyApplication from traitlets import Instance, Undefined, import_item from collections import defaultdict here = abspath(dirname(__file__))...
e95319929a5db06ee1dc5f0ca61f261ccc7db07976af08aefe444810fcb3c891
Python
7,179
206
import sentencepiece as spm import numpy as np from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report, accuracy_score, multilabel_confusion_matrix, mean_squared_error, r2_score import tensorflow as tf import pandas as pd from glob import glob import wandb from w...
03976d9afb05260c23a0d87a8deb517e8bb818f647849917037df2608c858719
Python
7,182
182
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Apr 5 13:06:41 2018 @author: saskiad """ import numpy as np import pandas as pd import os, h5py import scipy.stats as st import core # class event_analysis(object): # def __init__(self, *args, **kwargs): # for k,v in kwargs.iteritems(): ...
8169bad273147fc6533adce76eca7910e863a10ea0237456bfe03fc15978b18c
Python
7,184
191
import numpy as np import matplotlib.pyplot as plt import matplotlib.table from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib.patches as patches from IPython import embed def plotcubus(axis, pos, ext, color): xs = pos[0] ys = pos[1] zs = pos[2...
d3db85ae7ea8756c884faf3210a61f0e4fb5a8583b975592f20c37869671f3b5
Python
7,186
256
"""Helpers shared by the pytest suite in scripts/test (test_*.py). Everything here is plain Python so that expected values in the tests can be derived independently of bowtie2: references are generated from a fixed seed, reads are cut from them at known positions, and SAM output is parsed into records whose fields the...
0376ad6128f05dcc2e8aeedcceedaa5b7e2c5e3e537e47a3e504cafbc2904d89
Python
7,188
210
# -*- coding: utf-8 -*- """ molvs.validations ~~~~~~~~~~~~~~~~~ This module contains all the built-in :class:`Validations <molvs.validations.Validation>`. """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division import logging from rdkit import Chem from .er...
ed89ec8302f8b5382c9b2b7dfc0b9da5c9358d0015df71984cc5320e83b076a7
Python
7,195
226
import nibabel as nib import numpy as np from numpy import (concatenate, ones_like, ceil, floor, array, dtype as datatype, r_ as row) from scipy.io import loadmat from scipy.io.matlab.mio4 import MatFile4Wr...
e54cffd1f12ea156ad2a60c3055f77450acd0fa323cf8774d179a4d26809a6b9
Python
7,200
224
#!/usr/bin/env python3 """Extract Gemma4 Vision Encoder weights from a full Gemma4 multimodal model. Uses safetensors lazy loading to avoid loading the full model into memory. Converts HF Transformers weight keys to timm format. Usage: python convert/convert_gemma4_vit.py \ --source google/gemma-4-4b-it \...
134a5f1caf806975b448a3398a5ddf6ceaca0612d19fc857985ee7c4fcaa5a0b
Python
7,206
180
# -*- coding: utf-8 -*- """ Created on Thu Feb 8 15:21:16 2018 @author: saskiad """ import numpy as np import pandas as pd import os, h5py import scipy.stats as st import core class event_analysis(object): def __init__(self, *args, **kwargs): for k,v in kwargs.iteritems(): setattr(self, k, ...
00c3a9cee1d938b9c0f9fdd4fc36c205ad1c866e259e743e9795256868c46d7c
Python
7,210
193
import argparse import configparser import logging import os import queue import threading import tracemalloc import flickrapi import pandas as pd import tensorflow as tf # https://github.com/tensorflow/tensorflow/issues/29968 os.environ['OMP_NUM_THREADS'] = '2' tf.config.threading.set_inter_op_parallelism_threads(2)...
1f900cb178dc5720bb107329669b381f3d5f932bf6d7d9431625cb596d80d260
Python
7,218
191
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Hang Zhang ## ECE Department, Rutgers University ## Email: zhang.hang@rutgers.edu ## Copyright (c) 2017 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the root directory of this sou...
ca4464448c806e376a22bbd4195f1653f711a5ce3e96a605a808ebe66e6be0c8
Python
7,219
247
""" This file implements a type I and a type II model from the abstract base class NeuronAbstract. You can inject step currents and plot the responses, as well as get firing rates. Relevant book chapters: - http://neuronaldynamics.epfl.ch/online/Ch4.S4.html """ # This file is part of the exercise code repository a...
4824fc9a25d11b1b9f0ef6a076b4ab4954df3836d951cee1f48918d1d2c0eb3e
Python
7,224
226
# pylint: disable=too-many-locals """Tests for learning to rank.""" from types import ModuleType from typing import Any, Optional import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm from .data import make_ltr from .utils import Device def run_ranking_qid_df( impl: ModuleTy...
290ac62dc898832c9856872fb4e1c8cfe0e84b65ffddb3219ef105e7dd3e18a6
Python
7,226
170
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------ Copyright (C) 2019 Université catholique de Louvain (UCLouvain), Belgium. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License....
57fdaf722b763cdadf5a595108aecdaabde91ad0e0a2177f7931722818619da9
Python
7,226
186
import numpy as np from .crop_zero_planes import CropExternalZeroplanes from .non_zero_normalize import NonZeroNormalizeOnMaskedRegion from .threshold_and_clip import threshold_transform, clip_transform from .normalize_rgb import ( normalize_by_val_transform, normalize_imagenet_transform, normalize_standar...
4ca8b135c3b0a517e246eb140e748b71e499494e210c7e6af2a7b42664a7091b
Python
7,231
213
import numpy as np from netCDF4 import Dataset #=========================================================================== # Function for converting from longitude to X-dimension #=========================================================================== def lon_to_xdim(lon_st, lon_nd, lon_int=2.5, lon_init=0.0): ...
369d67b66e4568802a0825543f7fc68f389a07c36929009e683563d86871909f
Python
7,239
209
import numpy as np from scipy.linalg import cholesky_banded, solveh_banded from .utils.linalg import diag_indices, band_matrix, unband_matrix from .utils.time import get_arg, get_dt class OUProcess: """ Class implementing an Ornstein Uhlenbeck process Parameters ---------- mu : float ...
8ef770f142a3c134a33a509446693e1b8ca61104f815ec65c26e8d7e05a1297a
Python
7,243
191
from operator import indexOf import os from typing import Any, Tuple import numpy as np import torch import torch.nn.functional as F from torchvision.datasets import VisionDataset from torch.utils.data import Dataset import data.mapping_utils as mapping_utils import pandas as pd import glob from tabulate import tabulat...
d2f2b9f38f129d95048e5195ce9df621d85e658189073d995e7a992b047fdc03
Python
7,246
197
"""Classification training task.""" import logging from typing import Any, Callable, Dict, Optional, Union import torch import torch.nn as nn from timm.loss import create_classification_loss from .task import TrainingTask _logger = logging.getLogger(__name__) def resolve_classification_loss( criterion: Op...
4b97d78a8c34f5cb0c1c59ba01370a9b75e3ded40e485b4e1a88f5e6847a2136
Python
7,248
229
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 2022/2 @author: Nikolai M Chapochnikov This file creates plots to better understand the behavior of the cdf - the cumulative density function, called relative cumulative frequency in the paper. Plots are not saved on the disk and need to be saved by hand "...
686274daad6b2709446c46f3c0cdbb64c4f79179b223d0855db0612b6edfa50c
Python
7,254
168
import numpy as np def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1): N, C, H, W = x_shape assert (H + 2 * padding - field_height) % stride == 0 assert (W + 2 * padding - field_height) % stride == 0 out_height = int((H + 2 * padding - field_height) / stride + 1) out_w...
a9f4a93170f33883a050faf03ec26ecc118d7ff7ee6176c5f8423db84f2dc305
Python
7,258
217
# coding: utf-8 """ ANVIL nowcast ============= This example demonstrates how to use ANVIL and the advantages compared to extrapolation nowcast and S-PROG. Load the libraries. """ from datetime import datetime, timedelta import warnings warnings.simplefilter("ignore") import matplotlib.pyplot as plt import numpy a...
798f3e8bb4828641b075fd5b57fc824b5ad1086652eab050aa15ddf6d42dfe06
Python
7,261
222
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 1 08:19:50 2021 @author: Manuel Execute from terminal with both of the following arguments: 1. "/path/to/files" 2. "/path/to/output" """ import pathlib, os, sys import numpy as np from PIL import Image from PIL.ExifTags import TAGS, GPSTAGS from ...
f282c1ec58586ec094980fe710e1f28e179326f782ddd3d67dd04e4160f77613
Python
7,267
181
import os import pytest from click.testing import CliRunner from GANDLF.entrypoints.construct_csv import new_way, old_way from . import CliCase, run_test_case, TmpDire, TmpFile, TmpNoEx # This function is a place where a real logic is executed. # For tests, we replace it with mock up, and check if this fu...
89da8a88a7f8bffea8358da1960d1419e60fc9398f9cc2c4b82504d38f164ac8
Python
7,279
278
import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns ############################################################################## # Constants dataset = "hcp" parcellation = "schaefer200x17" idiff_path_combined_bins = os.path.join( "..", "..", "..", ...
9f5f72722663f607bad7abf6a3e7307ccfd9089314e20821cfe56830949b9b78
Python
7,279
177
import copy import math import torch import torch.nn as nn import torch.nn.functional as F import sys sys.path.append("..") from molformer.tr_spe import Embeddings, FeedForward from molformer.tr_spe import LayerNorm, SublayerConnection, clones, Generator3D _NUM_RESIDUE_TYPES = 22 _MAX_SEQUENCE_LENGTH ...
9e71dfc14127c79920e5543c0783ab6ac15b72453bff5a195f297a7ae5647054
Python
7,283
227
import numpy as np import pandas as pd import statsmodels.api as sm from etspredict.data import load_struct_connectomes from etspredict.data.hcp_aging.load import HCPAgingTimeseries from etspredict.data.hcp_ya.load import HCPTimeseries from .. import selective_connectomes as sc def load_timeseries( dataset, sub...
5d64ee935b9a048216750fcd1e6f86695849110204f550576a3ec4bed47ac9c5
Python
7,286
202
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem """ from pathlib import Path import numpy as np import eelbrain import re import os import mne import pandas as pd from mne.stats import (spatio_temporal_cluster_test, f_threshold_mway_rm, f_mway_rm) from mne impo...
fdf132c47fb5b88cc88bd8e7d2e08e85749a6c3585ff9f245d715ccd482efeea
Python
7,296
187
#!/usr/bin/env python3 """ Runs wb_command -surface-geodesic-rois to make rois on left and right surfaces then combines them into one dscalar file. Usage: ciftify_surface_rois [options] <inputcsv> <radius> <L.surf.gii> <R.surf.gii> <output.dscalar.nii> Arguments: <inputcsv> csv to read vertex list ...
5a740237bb120bbbc8321cbf116cc494bc8702d6a6b8dc74e356e3f5322ed8ce
Python
7,298
155
""" @author: Johanna Rahm Research group Heilemann Institute for Physical and Theoretical Chemistry, Goethe University Frankfurt a.M. ImageBinner functionalities. """ import numpy as np import pandas as pd import random import matplotlib.pyplot as plt import seaborn as sns from tqdm.notebook import tqdm def get_di...
3ea0a6395fc9bed4d002b0fb9cd70df5b8b266c1e79deef9c43e45f6b3c8df55
Python
7,300
295
"""Information Retrieval metrics. Useful Resources: http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt http://www.nii.ac.jp/TechReports/05-014E.pdf http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf Learning...
1cf80333d76a04673888d0ce788984c1b0ea90d2771347014ce17c3a1d54cb4e
Python
7,307
240
# TODO Sep 08 version """This module contains simple helper functions """ from __future__ import print_function import torch import numpy as np from PIL import Image import os import math def tensor2im(input_image, imtype=np.uint16): """"Converts a Tensor array into a numpy image array. Parameters: i...
4900264a0b84ed2edb6c8f089d668d1aaee3115039732e9ddfd39d099e5532c2
Python
7,308
194
"""Prepare and validate the Rhee2006 dataset from Stanford HIVDB.""" from __future__ import annotations import argparse import csv import hashlib import json import shutil import subprocess import sys from datetime import UTC, datetime from pathlib import Path from urllib.request import urlopen import yaml ROOT = P...
0840bdd375707ddb0c5a7b69acaca46089fbd353f7bf36e43b8600ca3a2d83e7
Python
7,309
193
import os import time import numpy as np import torch from copy import deepcopy import utils class Appr(object): """ Class implementing the Elastic Weight Consolidation approach described in http://arxiv.org/abs/1612.00796 """ def __init__(self, model, nlab, nepochs=100, sbatch=64, lr=0.05, lr_min=1...
efaf5baf11f7df2a62889f1e28db00e42a78211eeb740a3012bbf79543d263ad
Python
7,314
198
import torch import torch.nn as nn from torch.nn.modules.loss import _Loss from asteroid.losses import pairwise_neg_sisdr, PITLossWrapper, singlesrc_mse, pairwise_mse, singlesrc_neg_sisdr class SingleSrcBCE(_Loss): def forward(self, est_targets, targets): if targets.size() != est_targets.size() or targets...
573c63c9ad8ae5d4f35a3df6db10c49cece59790815b186130c49f2aa83481ce
Python
7,321
226
from __future__ import annotations import csv import json import sys from datetime import datetime from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union from dateutil.parser import parse from imctools.data.acquisition import Acquisition, AcquisitionDict from imctools.data.channel import...
253e2b13cd3a2cb76b5dbd66d5ee7a504a5e01fd6e29ef0d44f60df54cc87544
Python
7,335
221
import six.moves from cellprofiler_core.constants.measurement import FF_COUNT, COLTYPE_INTEGER, M_NUMBER_OBJECT_NUMBER, \ M_LOCATION_CENTER_X, COLTYPE_FLOAT, M_LOCATION_CENTER_Y, FF_PARENT, FF_CHILDREN_COUNT, C_COUNT, C_CHILDREN, \ C_LOCATION, FTR_CENTER_X, FTR_CENTER_Y, C_PARENT, C_NUMBER, FTR_OBJECT_NUMBER ...
a3a4d9a7bf034aac5734ef23ad57d5e149452929890efd58a4ffb49076e6bc9d
Python
7,338
179
"""Differential Attention Paper: 'Differential Transformer' - https://arxiv.org/abs/2410.05258 Reference impl: https://github.com/microsoft/unilm/tree/master/Diff-Transformer Hacked together by / Copyright 2024, Ross Wightman """ import math from typing import Optional, Type import torch import torch.nn as nn impor...
8e29880bde7935b1547a8396c2d8e52d1354ac8b05b6ef1284751efb2f03b5b1
Python
7,345
214
import itertools import warnings import pdb2sql from deeprank.features import FeatureClass from deeprank import config class ResidueDensity(FeatureClass): def __init__(self, pdb_data, chain1='A', chain2='B'): """Compute the residue contacts between polar/apolar/charged residues. Args: ...
2c343fddda810399e1aa3e4e3d22892b0a1657b935bf0d1bb622449600961210
Python
7,353
194
import centriole.filter import centriole.kirsch import centriole.otsu import numpy import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler.modules.enhanceedges import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace from cellprofiler_librar...
38088af9ea2949f8e5eec28dad6bd1295b610ccfb98d38584399009608ce377f
Python
7,355
189
#!/usr/bin/env python3 ''' these tools are for building the html pages in cifti-vis ''' import os import ciftify.utils def write_index_pages(qc_dir, qc_config, page_subject, title="", title_formatter = None, user_filter=None): subjects = list(ciftify.utils.get_subj(qc_dir, user_filter=user_filter)) ...
e201345fce13c923219614d64466d36d22ce8fcfab0b67619553a098c0789107
Python
7,358
212
""" reference from Harvard NLP: https://nlp.seas.harvard.edu/2018/04/03/attention.html""" import copy import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable ####################################### ## Transformer with only Encoder ###############...
81605b6486ee373b9f5b08f555eaad1a0f32e3657e7d3fb7bb6160158af69680
Python
7,372
184
# This file is part of the exercise code repository accompanying # the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch) # located at http://github.com/EPFL-LCN/neuronaldynamics-exercises. # This free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License 2....
fb535ce5ad02f473a2d59b22f4d7dc634e2cf413ed8e4f190cdcc9c5648efad6
Python
7,380
211
from netCDF4 import Dataset import numpy as np import os, pathlib #========================================================== # Script for computing Lanczos cosine filter # # Time filtering for sensitivity test # f01: 10dy high pass filter # f02: 10-30dy band pass filter # f03: 30-90dy band pass filter # f04: 90-365d...
8daa6834088ce02bab35977f2badee51948bac6e922c7db460c7264fdb062cb7
Python
7,385
222
"""Test nimare.reports.""" import os.path as op import subprocess import sys from pathlib import Path import pytest from nimare.correct import FWECorrector from nimare.diagnostics import FocusCounter, Jackknife from nimare.meta.cbma import ALESubtraction from nimare.meta.ibma import FixedEffectsHedges, Stouffers fro...
9b4548a791f0a7534115e600387497ed105f7c2e7072186cc7603d50ef5ab866
Python
7,385
222
import numpy import numpy.random import scipy.ndimage import pytest import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import COLTYPE_FLOAT import cellprofiler.modules.measureobjectoverlap import cellprofiler_core.object import cellprofiler_core.pipeline i...
9b7c1346088fb6ba34a7f095440d7c8ded7ce5247e54d198569c83c0730039a0
Python
7,385
154
from . import framework as fw class State_machine(): # State machine behaviour is defined by passing state machine description object smd to # State_machine __init__(). smd is a module which defines the states, events and # functionality of the state machine object that is created (see examples). ...
8db4f82612f43d6769a528cb760b4858771099d0a45a63a991011ae66e917c1a
Python
7,388
213
""" Author: Ran Liu <rliu20@stanford.edu> Unit tests for functions in somata/pac/pac_model.py """ import numpy as np from somata.pac.pac_model import ( fit_pac_regression, kmod, autocovariances, block_toeplitz, ar_parameters, mvar_ssm, optimize_arp, ) def generate_pac_data(): """ Gen...
e7a756ec4282ce9b311c501402e154bb2fb29af21557ac4723f9067ae40b415d
Python
7,402
125
import os import numpy as np import pandas as pd import nibabel as nib from os.path import join as pjoin from nod_utils import save2cifti, _orthogonalize from nilearn.glm.first_level import make_first_level_design_matrix, run_glm from nilearn.glm.contrasts import compute_contrast # change to path of current file os.ch...
e0b1545a1269826029b6b2ad9dda7582fb4a4d83c0b6b9819c499f17c3d54fdc
Python
7,403
193
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
91d2a00e7e33416e44584041c61474f13ddd5e2246648ed0d0faadd045dd1cbb
Python
7,409
187
import numpy as np def unit_normal(a, b, c): # unit normal vector of plane defined by points a, b, and c x = np.linalg.det([[1,a[1],a[2]], [1,b[1],b[2]], [1,c[1],c[2]]]) y = np.linalg.det([[a[0],1,a[2]], [b[0],1,b[2]], [c[0],1,c[2]]]) z = np.linalg.det([[a[0],a[1],1...
af485bbec04e796367f5789e0731327f6644c5cdb7db15737f34556bcdee8690
Python
7,410
215
from rdkit.Chem import AllChem import pandas as pd import sys from module.pair_generation_top import Generator from module.pair_generation_all import Generator as Generator_all from module.paired_dataset import Dataset import math from statistics import mean from rdkit import DataStructs from rdkit import Chem impo...
706a3f38b6f8e405cef6d30404d1ab4139ff17a5fa54c080124411f31c751108
Python
7,411
192
from sklearn.model_selection import StratifiedShuffleSplit,StratifiedKFold from sklearn.preprocessing import OneHotEncoder from imblearn.over_sampling import RandomOverSampler import numpy as np import sys from datetime import timedelta import time import torch import torch.nn as nn import torch.nn.functional as F from...
282c7766ac97bdd3c7255b21ba2263302a51ac926d8eb4d99d4174426d587d80
Python
7,420
215
from rdkit.Chem import AllChem import pandas as pd import sys from module.pair_generation_top import Generator from module.pair_generation_all import Generator as Generator_all from module.paired_dataset import Dataset import math from statistics import mean from rdkit import DataStructs from rdkit import Chem impo...
513202c23b352acd90a2a99ab4e5bdd84a08e3b90b8763551b8539f7167a0a9b
Python
7,429
151
import os import yaml import random import torch import numpy as np import torchvision import argparse from util import (seed_torch, prepare, normalize, log_args_and_backup_code, SampleIoHandler, set_args) def sample(args): """ random sample some images from dataset if chosen_class is "rando...
e73d51a757dab4eafc111811a3b43713eac407cb15e400a62e12b6854326733a
Python
7,434
193
import pytest import torch from torch import nn from timm.models._builder import load_pretrained from timm.models._manipulate import adapt_input_conv def _weights(channels, dtype=torch.float32): return torch.arange(2 * channels * 3 * 3, dtype=dtype).reshape(2, channels, 3, 3) / 100 def _reference_channels(weig...
b7a418416f57d71ee637f870a8928c364e26a2dd530c084d4c9e131b0c268fa3
Python
7,435
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
8872346e2f1c002b1e6a044fc09faa58e3081b7bc63098e6faebbc8b1dc40124
Python
7,436
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
7f7d437b6e60366f25709ea209fb7505bb8e138a0f4bcb2561bd37f77c2324ac
Python
7,438
151
import pyb import math from array import array from micropython import schedule import pyControl.hardware as _h class _MCP(): # Parent class for MCP23017 and MCP23008 port expanders. def __init__(self, I2C_bus, interrupt_pin, addr): self.i2c = pyb.I2C(I2C_bus, mode=pyb.I2C.MASTER, baudrate=4...
9c78e7472898892b02a8c5056380e5177e6fb0a9ffaef8689ec96ef74a048f79
Python
7,439
203
from typing import Optional, Type import torch import torch.nn as nn import torch.nn.functional as F from .attention import maybe_add_mask from .config import use_fused_attn from .mlp import Mlp from .weight_init import trunc_normal_tf_ class AttentionPoolLatent(nn.Module): """ Attention pooling w/ latent query...
5d83ca26a2384fdb9e2a8ec19aa7be919141d5ac978b29a359aa4f00d5075265
Python
7,445
159
# Pytorch Tabular # Author: Manu Joseph <manujoseph@gmail.com> # For license information, see LICENSE.TXT """AutomaticFeatureInteraction Config""" from dataclasses import dataclass, field from src.models.tabular.pytorch_tabular.repository.config import ModelConfig @dataclass class AutoIntConfig(ModelConfig): """...
9c5278fb4d5b26d3699b245fbae6c1a89fcd1e8a51c2c72e0841006b2e70521c
Python
7,445
243
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
a21288bedf038e53beccd443899f88c0e535b8edea7eaccc6066465544c8fd38
Python
7,447
186
# -*- coding: utf-8 -*- """ Created on Thu Feb 8 15:21:16 2018 @author: saskiad """ import numpy as np import pandas as pd import os, h5py import scipy.stats as st import core # class event_analysis(object): # def __init__(self, *args, **kwargs): # for k,v in kwargs.iteritems(): # setattr(s...
b628ef5ed761a49d3dd826c83a0bb947d25e0bb97170cde89c90d8e0f97f43aa
Python
7,455
218
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Apr 26 14:18:33 2018 @author: saskiad """ import numpy as np import scipy.stats as st import matplotlib.pyplot as plt import seaborn as sns areas = ['VISp', 'VISl', 'VISal', 'VISpm', 'VISam', 'VISrl'] area_labels = ['V1','LM','AL','PM','AM','RL'] cres ...
6e2668b5be20edfa3f8a8c56ee239af00d56c4831eb7a94115bae8014463557c
Python
7,456
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
704472b9a1c4e00fbe51e94bfe8553343fe1038d6455e1ea005c503e23478e84
Python
7,458
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
5e73b0ec57d13b42b906cf1e5b2d1280bdb29ea86f530ac15f78240d46fae146
Python
7,459
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
cf8f37aceeddaf369c4f990ba28ba9c194fa998c262340f60df7ca18d0efc515
Python
7,459
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
e2943d8d07b5e2f2c734837cf3f7ca2532fd906909a32db80cdfaa2d5380e26a
Python
7,460
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
f0234da68e73a05261fb3d20c7aaf66e98f57a0b291679be867e9d9cd83a39b4
Python
7,460
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
e225cb1d800419dfc42c28665da617b8bbea90a36173df3073db6ac5d4fa3c45
Python
7,461
194
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
400b6dc76bb1a6a4b972a4a607ba7382f12f9d71e9c9d6a3c9ff550029c489e6
Python
7,475
185
''' ========== Iteratively reweighted least squares (IRLS) procedure in CS-CORE ========== ''' import numpy as np import scipy.stats as stats from scipy.sparse import issparse def CSCORE_IRLS(X, seq_depth, post_process=True): """ This function implements the iteratively reweighted least squares algorithm of C...
845f5c1faa6dc8f6608d361dbc74e0a4a54c37c2ee1d402c49938af656b2ab8e
Python
7,480
197
from typing import Any from typing import Dict from typing import Optional from typing import Tuple from typing import Union import numpy as np import torch import functional as func from base import BaseTransform from utils import expand_tensor_dims from utils import squeeze_tensor_dims import random class DualTra...
791cf0f777b5b9a5e5dc88fea00403c6da4e4a1e7a98188223536143333ecea1
Python
7,481
224
import six.moves import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import M_SITE, M_ROW, M_COLUMN, M_PLATE, M_WELL import cellprofiler.modules.labelimages import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspac...
a728b966d138da833324013adf07ccc3829c752f7cc6376d8d83ae77fd1f6f4a
Python
7,481
206
from os import cpu_count from traitlets import Float, Integer from traitlets.config import Bool, Enum, default from traitlets.config.loader import ConfigError from mrHARDI.base.application import mrHARDIConfigurable from mrHARDI.traits.diamond import BoundingBox, Stick _flags = { "mose-tensor": ( {'Diamo...
5c57df9b4979cfdb1a1e5ab4b4b09f298323bc5d2d0da6ea83c2aabba9feaa42
Python
7,482
163
# -*- coding: utf-8 -*- import os import pickle import subprocess import sys import numpy as np import scipy.io.wavfile as wav import torch from python_speech_features import fbank from sklearn.preprocessing import normalize from torch.utils.data import Dataset from torchvision import datasets, transforms ...
a4d2c5a03bddc27c16fd57470c1d6e1171002dad046a0a8e04f390c92becb9bd
Python
7,482
222
''' JHK Python script for calculating internal variability range of the ratio between dSTD and dClim. of the HF PRCP. ''' import numpy as np from netCDF4 import Dataset #========================================================== # Set main directory #========================================================== hdir = '/...
edd18372e071171d4e8adbbab377726f9651ba1d11044f81470d59dce75e91a0
Python
7,482
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
469511c45dc77b5aa37db801f1d36d7c128d7ea2e6568f0104397fa973a8b32f
Python
7,485
196
import numpy as np import math from braincog.base.brainarea.PFC import PFC from Modal.synapse import Synapse from Modal.titlelayer import TitleLayer from Modal.composerlayer import ComposerLayer from Modal.genrelayer import GenreLayer class PFC(PFC): ''' This area is used to store the sub-Goal of the task ...
2a81f902f27906a37e744095bb63748d8c6d8a427ef299507088532fd267b2f3
Python
7,505
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
11211a74d925e680f73f69be7e28b8427b14dbc9a2d4e78984a65057752c24a3
Python
7,506
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
d7a66e15e248216779b76d9d713aae035003eebf0fd431bc44f6676391bcb731
Python
7,507
195
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
7da6c29d8304be1bb2d6ee1710af1057889073763b1d0c08e17ea43b4ada05d5
Python
7,509
214
""" LabelImages =========== **LabelImages** assigns plate metadata to image sets. **LabelImages** assigns a plate number, well and site number to each image set based on the order in which they are processed. You can use **Label Images** to add plate and well metadata for images loaded using *Order* for “Image set ma...
8fb0bec595c9c4e6568a240cab849209b9bfd1f8e7175811d0b7c676826902b9
Python
7,510
232
import os import json import argparse import datetime import pickle import numpy as np from sklearn.model_selection import train_test_split from model import * from betaVAE import * from read_data import * from utils import * parser = argparse.ArgumentParser(description='betaVAE disantangle generation of RNA-Seq dat...
6ba7a06b960090f3c3389fcba41dd96ec497b10cb9e3f0528395dc8a530ca456
Python
7,512
177
from __future__ import annotations from typing import Union import numpy as np import numpy.typing as npt import traits.api import xarray as xr from . import BaseFilter from ptsa.data.timeseries import TimeSeries # An ``events`` recarray-or-ndarray; some callers pass a structured # ``np.ndarray``, others pass an ``...
741a8aef5e371442a5f7f1413ee5a9198eb171396648e31afc173d8cc3dd6ba9
Python
7,513
231
# encoding: utf-8 # Author : Floyed<Floyed_Shen@outlook.com> # Datetime : 2022/7/26 18:56 # User : Floyed # Product : PyCharm # Project : BrainCog # File : vgg_snn.py # explain : from functools import partial from torch.nn import functional as F import torchvision from timm.models impor...