sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
aa2e709180173020503e973912da0a8ba17a283c7501bcd4525496a11031913d
Python
14,100
318
""" Author: Mingjian He <mh1@stanford.edu> """ from .helper_functions import ( np, plt, initialize_allosc, plot_mtm, plot_innovations, plot_residual, plot_acf, plot_pacf, get_innovations, get_knee, get_ar_psd, fit_ar, plot_fit_line, ebic_calc ) import pandas as pd from ..utils import estimate_r...
1eb9a680151117ffe05ffe7282f14ef0be1cdb695ea3445daad397f367fbdf35
Python
14,101
230
#### Master Script 05a: Extract relevance layer values from trained dynAPM models #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Find all top-performing model checkpoint files for relevance layer extraction # III. Iteratively extract...
aa02fb7f662b7acb19f7f4e5944bb3e075e48f3a01bd41b7d64424b971e348b9
Python
14,117
335
import TCDF import argparse import torch import pandas as pd import numpy as np import networkx as nx import pylab import copy import matplotlib.pyplot as plt import os import sys # os.chdir(os.path.dirname(sys.argv[0])) #uncomment this line to run in VSCode def check_positive(value): """Checks if ...
7e75855ca49482df9994c690684e54fa1599ac2541957cf7eda65a457caac45b
Python
14,121
438
#!/usr/bin/env python3 """ These functions search the environment for software dependencies and configuration. """ import os import sys import subprocess import logging import pkg_resources import re import glob import ciftify.utils as util def find_workbench(): """ Returns path of the workbench bin/ folder,...
a70aff7d2fabbeb74518e699610919e9b88f08a5db8fb7be43c6b4264472803e
Python
14,143
288
from . GenomeTrack import GenomeTrack import numpy as np from .. utilities import plot_coverage, InputError, transform, change_chrom_names import pyBigWig DEFAULT_BIGWIG_COLOR = '#33a02c' class BigWigTrack(GenomeTrack): SUPPORTED_ENDINGS = ['.bw', '.bigwig'] TRACK_TYPE = 'bigwig' OPTIONS_TXT = GenomeTrac...
283042e13d73525a02b64924231d1fb223f509ab10295dfab5cb6c8474223a78
Python
14,150
417
from itertools import product from dipy.core.gradients import gradient_table from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel from dipy.reconst.shm import SphHarmFit from os.path import join, dirname from tempfile import mkdtemp from xml.etree import ElementTree as eTree import imageio import pygifs...
c803be404553d4aa012d325ebbd04277e45d40b4c4525ec6113781504db624c5
Python
14,158
393
"""Shared public and internal value objects.""" from __future__ import annotations from collections.abc import Iterator, Mapping, Sequence from dataclasses import dataclass from datetime import datetime from os import PathLike from pathlib import Path from typing import Any, Literal, TypeAlias, TypeVar, cast import ...
543ff993095228f3c9950ae4196fd5a80d610401175dcadeef89aec6dc1aff1b
Python
14,159
295
# Standard library imports import os import datetime as dt # Data handling and numerical computations import numpy as np import pandas as pd from scipy.stats import pearsonr from scipy import interpolate def smooth(df, n=7): smoothed = pd.DataFrame(index = df.index[n:], columns = df....
6c5882647f302f2deee899ff2f2f68ad533f73103a52f8c0a4b3fc8480d95047
Python
14,169
364
# -*- 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...
d2829bafb8f293411edd00f452114d8bd7b033bb64f5999e1b71261fc04a0b04
Python
14,180
333
import tempfile import unittest import cellprofiler_core.preferences class TestPreferences(unittest.TestCase): def test_01_01_folder_translations(self): for expected, value in ( ( cellprofiler_core.preferences.ABSOLUTE_FOLDER_NAME, cellprofiler_core.preferences...
d3570743c29a1efb82c871fdcef4c81b2f933d60cc6edb77905f2fd79973a830
Python
14,205
410
""" Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene Creates an Xception Model as defined in (Francois Chollet): * `Xception: Deep Learning with Depthwise Separable Convolutions` - https://arxiv.org/abs/1610.02357 This weights ported from the...
a25c9c063fc96219d71e9e558c16732f9b6167d18e4d28ab34a6e8eb84b8c29c
Python
14,223
373
""" Implementation of Proof-of-Concept Network: StarNet. Papers: * `Rewrite the Stars` - https://arxiv.org/abs/2403.19967 We make StarNet as simple as possible [to show the key contribution of element-wise multiplication]: - like NO layer-scale in network design, - and NO EMA during training, - which woul...
bcfacfa9fb67382a6a172cd02ab996b8134d7d6ae663da755a2a461e6a7ca54a
Python
14,239
355
import sys import types import numpy as np import pytest import torch from PIL import Image from timm.data import create_dataset, create_loader, create_naflex_loader, create_reader, create_transform from timm.data.loader import MultiEpochsDataLoader from timm.data.naflex_loader import NaFlexPrefetchLoader from timm.d...
ba6ad3f1214fa3b0b7af38eef9be8137461a28c1b7fa44dd41aea0e9e64e83e7
Python
14,241
347
"""Prepare BRCA1 regression data directly from the official TCGA Level 3 archive.""" from __future__ import annotations import argparse import csv import gzip import hashlib import json import re import shutil import subprocess import sys import tarfile import tempfile import zlib from datetime import UTC, datetime f...
9c8693224a0b963388b33339821d58bfc49393f190d04ad009bbbcbdbcb7b8a5
Python
14,248
382
"""Prepare the original Gisette values and splits from UCI without scaling.""" from __future__ import annotations import argparse import csv import gzip import hashlib import io import json import platform import shutil import subprocess import sys import zlib from collections import Counter from datetime import UTC,...
b7a10748d25fbad030d1768c5b86083ef7a83594f3e7e9117e01aa3c904edc64
Python
14,256
445
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ MIT License Copyright (c) 2022 Pawan Goyal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation th...
32609db0263daeb238e1ebfcff0d4c93aba9797361b49bce5ab8c9c3de4746fe
Python
14,269
493
#!/usr/bin/env python3 import os import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from baycomp import two_on_single from etspredict.prediction.scoring_utils import compare_propabilites ####################################################################...
71333eb0c42ffb48039f85c06a15ff7bf1baf9a5d60386ddfcd7ba8b964862a8
Python
14,277
407
from rdkit import Chem import json from rdkit.Chem import AllChem,Draw,Descriptors import copy import pandas as pd import re import matplotlib.pyplot as plt import lib.Reaction_Library as RL ### Reduction Functions: def G1_function(metab_smiles): reactant = Chem.MolFromSmiles(metab_smiles) prod_list = [] ...
a20a4213ff33afd98b071dc9dfe696fb06a1e2ba0fc7241009ec4528861fa16c
Python
14,282
408
from rdkit import Chem import json from rdkit.Chem import AllChem,Draw,Descriptors import copy import pandas as pd import re import matplotlib.pyplot as plt import lib.Reaction_Library as RL ### Reduction Functions: def G1_function(metab_smiles): reactant = Chem.MolFromSmiles(metab_smiles) prod_list = [] ...
1e582a239ede44622e6f9ff85e411d416829421a3ad8ed1f6bb71a3bdc62c379
Python
14,283
354
"""Patch-level random erasing augmentation for NaFlex Vision Transformers. This module implements random erasing specifically designed for patchified images, operating at the patch granularity rather than pixel level. It supports two modes: - 'patch': Randomly erases individual patches (speckle-like noise) - 'region':...
9a556ac9553b38cb6d324c9957d5c48daa4461dee8fa79c4780ae96e7dd60883
Python
14,291
379
import uuid # import tensorflow.compat.v2 as tf import tensorflow as tf from keras import activations from keras import backend from keras import constraints from keras import initializers from keras import regularizers from keras.engine import base_layer from keras.engine.input_spec import InputSpec from keras.layers...
4dea436d1d4807a363433d7fa7130016a56d3ff00bfe4af7dc94a523994040a7
Python
14,309
467
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Import functions #\n", "import argparse,datetime,os,sys,time\n", "\n", "try:\n", " import plotly.graph_objects as go\n", "except:\n", " go = None \n", "\n", ...
c974ea8b718713dfb38a641dfd1f60122c121bebf066311dca8784dfab5cc7e1
Python
14,312
359
""" MeasureImageAreaOccupied ======================== **MeasureImageAreaOccupied** measures the total area in an image that is occupied by objects. This module reports the sum of the areas and perimeters of the objects defined by one of the **Identify** modules, or the area of the foreground in a binary image. If the...
57d585aae31517f9d0b165cccb1024845ebd04532e0812a8e784a173ffa36ac9
Python
14,320
449
# coding=utf-8 # Copyright 2020 The SimCLR Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
3e6c7ea9fd02c01d95700b1e7496fecc34b65664556cabcf6084bc3434422c0b
Python
14,331
405
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 10 14:34:18 2021 @author: goyalp """ import torch import os, time import Functions.utils as utils from tqdm.autonotebook import tqdm import Functions.diff_operators as diff_operators from Functions.utils import get_batch_data from torch.optim.lr_sc...
d54ecdc02a0fa3724e34814c8ca2ed04bc30ce9381a830eb19051121f62d370f
Python
14,331
496
#!/usr/bin/env python3 import os import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from baycomp import two_on_single from etspredict.prediction.scoring_utils import compare_propabilites ####################################################################...
e4a134494f3ade804a1026666798b3a573ac18342f5574803e55dfa205330e39
Python
14,365
383
import pandas as pd import os import sys import time import numpy as np import torch import matplotlib.pyplot as plt import torch.nn.functional as F from torch_geometric.loader import DataLoader as GraphDataLoader from sklearn.preprocessing import StandardScaler,MinMaxScaler from utils import get_time_dif, fix_batch, t...
7dad7da4375c48abdc1e672bab5cf949ac6f52cda1c742272294ed51b450622a
Python
14,377
458
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import torch.nn.functional as F import torch __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet...
4646716c9da81992edc5334943c7cb9acb3602f50f5f8d2019eab23a5bdf77a5
Python
14,399
250
"""This script estimates TRFs for several models and saves them""" from pathlib import Path import re import os import eelbrain import mne import trftools from utils_TRF import make_source_space import numpy as np DATA_ROOT = Path('/project/3027007.02/Scripts_for_publication').expanduser() language = 'Dutch' region =...
09cd97f97034daf1b6cd80c78a03b139c8ac7625f587e3214cc5bad76bfaacd4
Python
14,403
284
from hicmatrix import HiCMatrix import hicmatrix.utilities import scipy.sparse from matplotlib import cm import numpy as np from . GenomeTrack import GenomeTrack from .. utilities import change_chrom_names import logging import copy DEFAULT_MATRIX_COLORMAP = 'RdYlBu_r' logging.basicConfig(level=logging.DEBUG) log = lo...
88058dd6c5d3e564796f6502fad19d50c360e5a35875c9519582560bd155a4b1
Python
14,404
261
#### Master Script 05f: Compile robustness check results and token incidences to dropout extraneous variables #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Compile and save bootstrapped robustness check dataframes # III. Calculate c...
f93a5c3f00451e2ce0ba2250e4aa1898c80c51088e4ca4d596f7dfe8571f543f
Python
14,406
303
import os import random import torch import yaml import json import argparse import numpy as np import pandas as pd from tqdm import tqdm from pprint import pprint import torch.nn as nn import asteroid from asteroid.utils import tensors_to_device from data import * from sklearn.metrics import balanced_accuracy_score,...
49d083c344e89322423e65a9e043036abf9369e1f39007ec3e6b9e7a0aea7b81
Python
14,413
348
from abc import abstractmethod import matplotlib.pyplot as plt import numpy as np from .spiketrain import SpikeTrainsPlotter from ..spiketrain import SpikeTrain class FitPlotter: def __init__(self, ic=None, model=None, optimizer=None, neuron=None, file=None, log_likelihood_normed=None, z=None,...
77f540822c8e3df48785d52093367c5577f71149e29d2c5d954451f37b4d382c
Python
14,414
428
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union import numpy import scipy.ndimage from numpy.typing import NDArray from pydantic import BaseModel, ConfigDict, Field, validate_call from cellprofiler_library.functions.measurement import ( compute_center_distances, compute_per_bin_distribut...
63e5b29be11d43ab32dd129728098b98022ac26bd2b79e3eb9237de9c8fceef8
Python
14,428
395
# Created by: Deserno, M. et. al., 2023 for https://www.nature.com/articles/s41598-023-38213-7 # Experimental code to match detections globally over video frames import copy import itertools import pickle import cv2 import matplotlib.pyplot as plt import numpy as np import pycocotools.mask as mask import scipy.optimi...
ec4a78c83ced51dee99f68efeb2495fb5c42808a05d7e9f49188ab38aefe95d3
Python
14,431
417
import os import sys import glob import time import math import argparse import numpy as np # Computer Vision import cv2 from scipy import ndimage from skimage.transform import resize # Visualization import matplotlib.pyplot as plt plasma = plt.get_cmap('plasma') # UI and OpenGL from PySide2 import QtCore, QtGui, Qt...
11d32d78812bdcfa9b16301481b5cc1585bbc3d8f6fca89335f4d81b68831b66
Python
14,438
379
from genericpath import exists import torch import torch.nn as nn import numpy as np from tqdm import tqdm import os from torch.utils.data import Dataset from torchvision.io import read_image import torchvision import pandas as pd from sklearn.model_selection import train_test_split from torchvision import transforms f...
6b5e3f9a8140a85c3fd5993e2a0efcda2ed2f2dd78f0a6241268f825fe8fb27c
Python
14,452
371
import numpy as np import torch import os import glob # from .runner import Runner import torch.distributed as dist from utils.parallel import get_dist_info from utils.display import display_metrics_dict from utils.evaluation import AverageMeter, accuracy, fuzziness class NCRunner: """The runner for Checking Neur...
ffe9aeea5a0b6e249efedec6f9dbb39fbe0ba1c01e38d9f9d33d2dd8ca7d8a6c
Python
14,505
359
"""Layout rules: canonical ordering, offsets, and coordinate space. Everything here maintains the store's structural invariants. The discipline that matters, learned the hard way: **offsets are a compiled index over the parent columns, never a second source of truth** (I2). Permuting the offsets directly and patching ...
3e832a3f57d73d2b266a9f4c5f72c22c452ad7ce692deca0f698e27f7db5b5b6
Python
14,509
290
import numpy import skimage.segmentation from numpy.typing import NDArray from typing import Tuple, Annotated, Optional, List, Any, Union from pydantic import Field, validate_call, ConfigDict, BaseModel from cellprofiler_core.utilities.core.object import crop_labels_and_image from cellprofiler_library.types import Ima...
ba11ef387453031e00371bf694a5df067e8183806ba2acdbefba9e9158d77852
Python
14,528
381
import typing, sys import torch import torch.nn as nn import torch.nn.functional as F from GANDLF.models.seg_modules.add_conv_block import add_conv_block from GANDLF.models.seg_modules.add_downsample_conv_block import ( add_downsample_conv_block, ) from GANDLF.models.unet import unet from .modelBase import ModelBa...
b81fb9b3cb6ba412bdc8c58f781c9f1d07910c0f00d091906b599765c4384e6d
Python
14,550
344
#!/usr/bin/env python3 # Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera # # 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 ...
89c6582572ece417cffaf2b4d621853ae0df1973a55622d5c3e23c23c4648172
Python
14,556
485
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in 10.2022 @author: Nikolai M Chapochnikov """ # timing stuff # start_time = timeit.default_timer() # do something # elapsed = timeit.default_timer() - start_time # print(elapsed) # %% # ####################################################################...
9d3997df9fe7393945229918b540d656332f136b0b8d77d49868f7fd9ae32b48
Python
14,559
410
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Util functions for megsim. """ from math import modf import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from mne.io.constants import FIFF from mne.transforms import rotation3d_align_z_axis import matplotlib.pylab as plt from mne...
34fa4b766910edd56cef9c8d9c3250e2aec07c913dcc588f38ea43243957a489
Python
14,566
445
"""Guided learning mode — LLM-assisted landmark placement on MRI. Routes ------ GET /learn Render the guided learning page GET /learn/nifti Serve MNI152NLin2009cAsym T1w NIfTI (downloads from TemplateFlow and caches locally on first re...
5edd06925ea2a52d63e66af511707bcb653f222d35db949931f7c57f708fba9b
Python
14,573
374
""" Classifier head and layer factory Hacked together by / Copyright 2020 Ross Wightman """ from collections import OrderedDict from functools import partial from typing import Optional, Union, Callable import torch import torch.nn as nn from torch.nn import functional as F from .adaptive_avgmax_pool import SelectAd...
7e52105a55dc7be3b3265fadff1fd0a288db6076baed480362bad22552f4fabc
Python
14,584
323
""" Authors: Mingjian He <mh1@stanford.edu> Proloy Das <pd640@mgh.harvard.edu> source_loc_utils module implements supporting functions for dynamic source localization """ import torch import mne import numpy as np from somata.exact_inference import djkalman_conv_torch def patch_decompose(fwd, src_patch, di...
eaaeb141c294e88752c4d380810131bfc621cd7c7c9d8e8aa49d5bb568b0942a
Python
14,601
396
from __future__ import annotations import copy import hashlib import importlib.util import json import shutil from pathlib import Path from typing import Any import pytest from jsonschema import ValidationError ROOT = Path(__file__).resolve().parents[3] SPEC = importlib.util.spec_from_file_location( "dm_catalog"...
4a8ddd8eab011bae40a8838ebbbc5e1e60618aa881159da2ce7e4bc71d158517
Python
14,612
440
import unittest import pytest from cellprofiler_core.setting import ValidationError from cellprofiler_core.setting.filter import Filter, FilterPredicate from cellprofiler_core.setting.filter._filter import LITERAL_PREDICATE, OR_PREDICATE from cellprofiler_core.setting.range import ( IntegerOrUnboundedRange, F...
3f4499e933f037cfaada49cbcc6d997b224bc96c6436367f7250ba9314f4e49b
Python
14,633
359
import numpy as np from skimage.transform import resize from skimage.transform import resize from scipy.ndimage.interpolation import map_coordinates from collections import OrderedDict RESAMPLING_SEPARATE_Z_ANISO_THRESHOLD = 3 def uniform(low, high, size=None): """ wrapper for np.random.uniform to allo...
8bf9173db0fe57b88faa29f124cb3635a6715d38b8bb40968ee8f4c3048b2eba
Python
14,656
416
# -*- 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...
01eb37927a118b9283d63d6d563ae0c751514a2e2c3e5c713192b75a73355374
Python
14,667
361
import os, torch, random, pickle, time from argparse import ArgumentParser import numpy as np import datetime import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn from torch.nn.parallel.scatter_gather import gather import load_data as ld import dataset import transforms from parall...
e102e4faf8faa3e9747add8a9262ea4692d137d905ef5a5dec8bc50358bc75a8
Python
14,680
331
# -*- coding: utf-8 -*- """ molvs.charge ~~~~~~~~~~~~ This module implements tools for manipulating charges on molecules. In particular, :class:`~molvs.charge.Reionizer`, which competitively reionizes acids such that the strongest acids ionize first, and :class:`~molvs.charge.Uncharger`, which attempts to neutralize i...
6352f22214b08552b44f928cd92ddd843790f3f5ae462edf0dfffdc1df554efc
Python
14,689
328
import bisect import collections import torch from .event_handling import find_event from .interp import _interp_evaluate, _interp_fit from .misc import (_compute_error_ratio, _select_initial_step, _optimal_step_size) from .misc import Perturb from .solvers import AdaptiveStepsizeE...
a7a7e5d6aada30ecf756e269a2ac01ae2bd8633ad971c4bb0760fc9e71ef5b2a
Python
14,694
298
import numpy as np import nengo from . import PathIntegration, CircularConvolution, Product # import os # import sys # sys.path.append("../") # from sspspace import HexagonalSSPSpace class SLAMLoihiNetwork(nengo.network.Network): r""" Nengo network that performs simultaneous localization and mapping (SLAM), modi...
44e9d4648fc80585a9d3a5bd1f831a655183f57e4eee7e9c725d1970a553ca3d
Python
14,736
304
import os import time import torch from torch.utils.data import DataLoader, TensorDataset from einops import rearrange from itertools import combinations from model.egnn import EGNN_Network from model.molformer import Molformer from utils.utils import parse_args, set_seed def main(batch_test=True, min_particle=10, m...
895b898d520a42f736a01e44d31991bdedd5114a0d31da28b6555074bd6c5c24
Python
14,790
376
#!/usr/bin/env python3 import getopt import os import multiprocessing import pysam import time import logging from sys import argv, exit from pybedtools import BedTool, cleanup, set_tempdir, get_tempdir def getAnno(LR, RR, genes): """ :param LR: BedTool object with only one position defined for the Left Bre...
b1b47c739fdb739be279b87ba694dbc69acc11146dca2910e599a0f6bf25b5c9
Python
14,801
464
""" Convert NBDC data dictionary to ReproSchema format. This module handles conversion of NBDC (Neurodata Without Borders/Data Coordinating Center) study data from various formats (Parquet, CSV, RDS) to ReproSchema JSON-LD. """ import logging from pathlib import Path from typing import Any, Dict, Optional, Tuple imp...
b07274005010c579581ae4a70388467957cb9f14e7565cb84931b63c145d84a5
Python
14,816
404
import collections.abc import math import re from collections import defaultdict from copy import deepcopy from itertools import chain from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union import torch import torch.utils.checkpoint from torch import nn as nn from torch import Tensor fro...
2c111f27d9a242e970d4eee6a15c871f55bf41f69221d9f6a8c2c6bcfff4f40d
Python
14,838
481
from __future__ import absolute_import import math import copy import numpy import scipy.ndimage from . import lapjv invalid_match = 1000000 # limiting the choices of the algorithms def euclidean_dist(point1, point2): """Compute the Euclidean distance between two points. Parameters ---------- point...
7ff18e46a86b457a4db2c67d5b708ab468e5268da66cb5e45f6dc3bd968fed92
Python
14,844
383
# -*- 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...
159097093abf41a2b9aaaac836305110691c4afaf44cd143604187ad142b19a5
Python
14,880
365
#!/usr/bin/env python3 # Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera # # 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 ...
ed8ca6368e105ccf4d9b45f81b8ccc312dc0b9f0016c0cfa604b606433ae1f54
Python
14,922
452
# -*- 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...
e39eb68fb56abbb4f995fcca091bafce5fd1283321fe650ba14a67d87c1dab45
Python
14,923
350
"""Preserve Godlewski et al.'s complete supplementary metabolomics table as CSV.""" from __future__ import annotations import argparse import csv import gzip import hashlib import json import platform import shutil import sys import zlib from collections import Counter from datetime import UTC, datetime from pathlib ...
1c18e626ba627a768463518bded5ef549279378d7c579cf77d6be2c9d9144960
Python
14,924
442
import itertools import matplotlib.pyplot as plt import numpy as np from .masks import extend_trues, shift_mask from .signals import mask_extrema, threshold_crossings from .spiketrain import SpikeTrain from .utils.abf import load_data, load_protocol from .utils.time import get_arg, get_dt, searchsorted class IClamp:...
aa9069288403259c1235b280a3597dbf6e8864b940479024f241b740195d69ec
Python
14,958
291
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline Main pipeline script for processing ASL MRI data. 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: Thi...
624c4d20c825a5c175c3048985a3bb78e94d35577c2eefa8fe168ed1122527e0
Python
14,964
367
""" AFIDS Template Analysis Script Analyzes all human and macaca FCSV template files to compute inter-template variability. """ import os import json import csv import math from pathlib import Path from collections import defaultdict # ─── LANDMARK METADATA ──────────────────────────────────────────────────────── # ...
481edb732fdbf41f936443efd2ee4280ee65687c8392acc524a0e67487f63010
Python
14,973
437
import numpy as np import math import scipy def sparsity_to_x_intercept(d, p): sign = 1 if p > 0.5: p = 1.0 - p sign = -1 return sign * np.sqrt(1-scipy.special.betaincinv((d-1)/2.0, 0.5, 2*p)) def get_mean_and_ci(raw_data, n=3000, p=0.95): """ Gets the mean and 95% confidence int...
fe1b02f72f5faca244c00f3660d8244386442303d2125484ac1f64130801992f
Python
15,005
377
import datetime import logging import math import os import numpy as np import pandas as pd from keras import backend as K from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, LearningRateScheduler from sklearn import metrics from sklearn.base import BaseEstimator from sklearn.metrics import accuracy_score ...
6fa2160579bf816f33ab201e04d6d04380e674cb92303bfabfb3f25a626d568f
Python
15,010
470
#!/usr/bin/env python3 # Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera # # 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 ...
22a229dd095958a2d54ab445160e453a63ae01166971282df3878d3aead219c3
Python
15,018
393
from torch.nn.modules.batchnorm import BatchNorm2d from torchvision.ops.misc import FrozenBatchNorm2d import timm import torch import pytest from timm.utils.model import freeze, unfreeze from timm.utils.model import ActivationStatsHook from timm.utils.model import extract_spp_stats from timm.utils.model import _freez...
0a30a7a6a8ca944c0ef00529599e7bc47da81aa9491b403c7189681438477ed5
Python
15,024
382
# 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...
d8ab0e0fad163ffe9020aeec578952c69e50d83e21c27af0608a763712206ada
Python
15,048
440
""" Module that implements functionality regarding segmentations - open segmentations from input file path - relabel segmentations (adapting data type if requested) - compute segmentation statistics such as - number of segments - segment size - segment slices - compute segmentation ARI error - compute segmentat...
c00df66340778d00fb2ed19a3a1e5b11149264c438ddec9f1ecc1a33bfa3e7ae
Python
15,051
448
"""Graphical visualisation support for provONE.model. This module produces graphical visualisation for ProvONE graphs. Requires pydot module and Graphviz. References: * pydot homepage: https://github.com/erocarrera/pydot * Graphviz: http://www.graphviz.org/ * DOT Language: http://www.graphviz.org/doc/info/la...
9a9fa761c334fe5e53da5e90ef0661269e131af5d4e16b4c97f35a7286d8d5f6
Python
15,068
402
import inspect from datetime import datetime import neuron import numpy as np from .globalFunctions.utils import Dict, replaceDictODict class simParams(object): def __init__(self, simParamsDict=None): # Flags self.test_flag = False self.plot_flag = True self.save_flag = True ...
290dc65e132f0f3dd8d485a471541045fb5e194c1db8185204a83f944c21d74b
Python
15,073
339
import torch import torchvision import torch.nn.functional as f import math from tqdm import tqdm from utils import radam import utils.viz_utils as viz_utils from models.style_networks import SemSegE2VID import training.base_trainer from evaluation.metrics import MetricsSemseg from utils.loss_functions import TaskLo...
3a4658abbbb3ca206f08a1dec2cfab5ab622f8ccd6eb0fab39c5dcc4351360a7
Python
15,103
450
import nibabel as nib import numpy as np from dipy.segment.mask import crop, bounding_box from fury import actor, window from fury.window import Scene from traitlets import Unicode, Float, Integer, Dict, Bool, List, Enum from mrHARDI.base.application import (mrHARDIBaseApplication, ...
95ba0ee5dff4d2e8446992981251638a804bb28a106c8e285e433f505fde8e97
Python
15,108
397
import os import logging import numpy as np import random import functools import torch import torch.nn.functional as F from torch import nn from torch_geometric.nn import MessagePassing from torch_scatter import scatter_add def tuple_sum(*args): """ Sums any number of tuples (s, V) elementwise. """ r...
ef23ea468c7a7b9301f95cc7c6603892df96e5d5b0125c439b59a6d35f6337be
Python
15,155
366
import os, shutil, yaml, docker, tarfile, io, sysconfig from typing import Optional # import copy deploy_targets = [ "docker", #'singularity', #'onefile' ] mlcube_types = ["model", "metrics"] def run_deployment( mlcubedir: str, outputdir: str, target: str, mlcube_type: str, entrypoi...
d19ba9d7de2e3c20d739dbb7291655f3e337585012564b679ddefc2f89a92b44
Python
15,175
414
from typing import Literal import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import integrate from scipy.ndimage import binary_dilation, binary_erosion def selection_generator(df: pd.DataFrame, unique_values_columns: dict, verbose: bool = False, **kwargs) -> np.ndarray: idx = np.o...
fd6f32378a1776a10ff8676b69e30dce6eb30df1609df185430438509388bcb5
Python
15,178
339
""" Author: "Keitaro Yamashita, Garib N. Murshudov" MRC Laboratory of Molecular Biology This software is released under the Mozilla Public License, version 2.0; see LICENSE. """ from __future__ import absolute_import, division, print_function, generators import argparse import gemmi import numpy import time import...
3e8c52fee2fd9daa72d6653e94ddafcbada4ffd7770195c82e1329fa29797e95
Python
15,198
487
# -*- coding: utf-8 -*- """ pysteps.datasets ================ Utilities to download the pysteps data and to create a default pysteps configuration file pointing to that data. .. autosummary:: :toctree: ../generated/ download_pysteps_data create_default_pystepsrc info load_dataset """ import gzip...
314a9b8ade829c2f9b6b3effe9d124efb86048c8d92b15955830bd1826e1d6a3
Python
15,210
484
""" @author: Nikolai M Chapochnikov """ import numpy as np from scipy import linalg as LA from functions.nmf import get_init_matrix from functions.general import rectify, FLOAT_TYPE, EPSILON from typing import Tuple def mat_mul(A, B, alpha=1): """ https://www.benjaminjohnston.com.au/matmul """ retur...
520354d227a3b1278444bd39a6e3991c78ca30f32a69aaadbd3f84aaebaff219
Python
15,213
481
# 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...
be4266faf0cd1bee9b6377593d066afadec15c7b2d8a6c9196434566f5d25e77
Python
15,213
399
################################# # # Imports from useful Python libraries # ################################# import numpy import scipy.ndimage ################################# # # Imports from CellProfiler # ################################## # Reference # # If you're using a technique or method that's used in t...
1b6065d94f260082cea28f67a5bf9169a417aa483defd641ac9fb7d2956eef7e
Python
15,214
434
from __future__ import annotations import bz2 import gzip import json from collections.abc import Callable from pathlib import Path import numpy as np import pandas as pd import pytest from conftest import ( CORPUS, EXPECTED_DIGEST, FIXTURE, LIBSVM_DIGEST, LIBSVM_FIXTURE, LIBSVM_OPTIONS, O...
586e9fbe912745f92b4400f177afd62bb449b4eb8eb1875a0b98b1eb55fabaca
Python
15,245
359
import numpy as np import time import nengo import sys, os sys.path.insert(1, os.path.dirname(os.getcwd())) #os.chdir("..") import sspslam import argparse import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter from matplotlib.gridspec import GridSpec from matplotlib.colors import ...
61dea925d126d050812c0810284a364fa2c4bb4ef97e6e21ad3f7d613f999ee9
Python
15,247
343
"""Small optimizer helpers shared by timm optimizer implementations.""" import functools import os from typing import Any, Callable, Dict, List, Optional, Sequence, Union import torch from torch import Tensor try: from torch.optim.optimizer import _default_to_fused_or_foreach except ImportError: _default_to_f...
ef0072f33f18cfe43ca142917fb6d494d1d37e8b1589c263bcc4f925a3799774
Python
15,249
422
#!/usr/bin/env python __author__ = "Marc Steffen Seibel and Thomas Jochmann" import os os.environ['MNE_USE_NUMBA']='False' import pandas as pd import numpy as np import mne from collections import OrderedDict import settings import tensorflow as tf from tensorflow.keras import backend as K import time imp...
7ceac3644b134dd81fa0b3542cd526b20f35a032df3bba9b4f5dc966b174f524
Python
15,262
430
from typing import Any, Dict, List import numpy as np import pytest from hypothesis import given, settings, strategies from scipy import sparse import xgboost as xgb from xgboost.testing import ( IteratorForTest, make_batches, make_batches_sparse, make_categorical, make_sparse_regression, ) from x...
87cfc9ad781c4c95b8d48bbd923b0de1aa24a5d2ddf69689663d5c9dbad584ad
Python
15,278
384
# Implementation of batch-normalized LSTM. # Some code is from Pytorch source code and https://github.com/jiesutd/LatticeLSTM import torch from torch import nn import torch.autograd as autograd from torch.autograd import Variable from torch.nn import functional, init import numpy as np # LSTM Cell for words class Word...
416a914b9a358ae4b685d1a7119d14d777f31c70253f88e01b85d7ede993d720
Python
15,324
315
""" Implementation of a working memory model. Literature: Compte, A., Brunel, N., Goldman-Rakic, P. S., & Wang, X. J. (2000). Synaptic mechanisms and network dynamics underlying spatial working memory in a cortical network model. Cerebral Cortex, 10(9), 910-923. Some parts of this implementation are inspired by materi...
bf98f709b03dab4e61a6c59aef92229d6d5844e9db6dc5fee612f71fd9c193f2
Python
15,333
482
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 26 11:56:59 2019 @author: Nikolai M Chapochnikov """ # %% # ################################# IMPORTS ################################### import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt # for colors and gradients # im...
ef2846cf1333b55c6a8c721e23f94d932d422fbebfe2248c75717a051bd814a1
Python
15,365
368
from .forward_pass import validate_network from .generic import create_pytorch_objects import os, sys from typing import Optional from pathlib import Path import pandas as pd # hides torchio citation request, see https://github.com/fepegar/torchio/issues/235 os.environ["TORCHIO_HIDE_CITATION_PROMPT"] = "1" import tor...
f7e633e26d0df2eb8a9dd02c12ac9431301e95e74e10653cbd29e0b699e85fab
Python
15,383
331
"""Scheduled batch sampling and transform dispatch for map-style datasets.""" import math from itertools import islice from typing import Any, Callable, Iterator, List, Optional, Sequence, Tuple, Union import torch from torch.utils.data import Dataset, Sampler class ScheduledBatchSampler(Sampler[List[Tuple[Any, int...
adb7be1f58027b957d2cf682226338616220d99b0cd7293f0a517ea642d31611
Python
15,401
341
#!/usr/bin/env python3 # Copyright 2021 Maria Cervera # # 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 o...
f5174611197b9a12bbc842e71137a01c9701e991fade8e1112f1878e6a13dec9
Python
15,413
419
import sys import numpy import six.moves import cellprofiler_core.image import cellprofiler.modules.measuregranularity import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace import tests.frontend.modules print((sys.path)) IMAGE_NAME = "myimage" OBJECTS_NAME = "myobjec...
82f6696c6dd25c61d82b4512f1c39a6a656fbafba5a60bb07b32d1a64e1f9124
Python
15,452
432
""" pysteps.nowcasts.sprog ====================== Implementation of the S-PROG method described in :cite:`Seed2003` .. autosummary:: :toctree: ../generated/ forecast """ import time import numpy as np from pysteps import cascade, extrapolation, utils from pysteps.nowcasts import utils as nowcast_utils fro...
2ad187cdafec12359fba82f71e05baa460083bd48e6832e09f0d9046d73887f5
Python
15,516
435
# important note:- Do not change any print stings if you intended to use pyOS5 GUI #@ Author : Sampath #This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt #SP => Sample Phase #CP => Choice Phase import random as rnd import hardware_definition as ...
075748ffae6c2e400345d59fdf5c5a9795e1e3a8a1dbb5d5398fdc73b73b3d53
Python
15,546
299
#### Master Script 06a: Prepare for sensitivity analysis to account for differences in patient stay #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Construct a list of predictions to recalculate after removing dynamic variable tokens ...