sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
08fef45c461385ebcd6b5c7c553c552d1fa75626e56738ffcef96e1f746485ee | Python | 4,824 | 98 | import os
from datetime import datetime
import csv
class Data_logger():
'''Class for logging data from a pyControl setup to disk'''
def __init__(self, sm_info=None, print_func=None):
self.data_file = None
self.print_func = print_func
if sm_info:
self.set_state_ma... |
03b02eecc3ae8a1b933f0bf0f4d2a41b951c95f79fbdce31e4ad02e121456322 | Python | 4,829 | 87 | # The Random_model example from the Random Growth notebook.
from neurodevsim.simulator import *
from neurodevsim.processing import nds_plot,nds_movie
class RandomFront(Front):
def manage_front(self,constellation):
if self.order == 0: # soma: make 5 dendrite roots
points = self.unit_branch... |
bb1afc9212db0f50d967dff4286fcc5532df650fd03489dbeeb2b462741654bd | Python | 4,829 | 160 | #!usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import click
from deprecated import deprecated
from typing import Optional
from GANDLF import version
from GANDLF.cli import copyrightMessage
from GANDLF.cli.generate_metrics import generate_metrics_dict
from GANDLF.entrypoints import append_copyright_to_he... |
eb22f760fcade9b3c31edfcd7edc1a287c36ed54364b14057370769f14e7b714 | Python | 4,836 | 133 | import sys
import pytest
import six.moves
import cellprofiler_core.module
import cellprofiler.modules.createbatchfiles
import cellprofiler_core.pipeline
import cellprofiler_core.setting
import tests.frontend.modules
def test_test_load_version_9_please():
assert (
cellprofiler.modules.createbatchfiles.C... |
49001de7aae6149b03c69ee351839375fa0c25cad0a77faef529c31a2819c1b1 | Python | 4,838 | 149 | import hashlib
import os
import torch
import shutil
import numpy as np
from PIL import Image
from tqdm import tqdm
from urllib.request import urlretrieve
class OxfordPetDataset(torch.utils.data.Dataset):
def __init__(self, root, mode="train", transform=None):
assert mode in {"train", "valid", "test"}
... |
8740633944266b57c742f80874811d12100265d6c18cfa0a248b445aeb00c159 | Python | 4,840 | 128 | '''
behavior for Barbosa, Stein et al. (Nat Neuro, 2020)
created by H Stein, Mar 2020
input: ../data/meantf_dynamic_*.npy
../data/dynamic_time.npy
../data/behavior.pkl
output: ./split.pkl
'''
import sys
from glob import glob
import numpy as np
import scikits.bootstrap as boot
import pandas as pd
import pickle
sy... |
8e375915011da46aae18dbce2c8222d0c92ca8fc8feb2401dbe1e7f5725c7e63 | Python | 4,842 | 138 | from dipy.io.streamline import save_trk
from traitlets import Bool, Float, Instance, Unicode
import nibabel as nib
import numpy as np
from dipy.data import default_sphere
from dipy.direction import ProbabilisticDirectionGetter
from dipy.io.stateful_tractogram import Space, StatefulTractogram
from dipy.tracking.stoppin... |
04e3eda55d98d48b6ff398463065845ba6983e867b237ee2e0a44fc5a2c6f2d7 | Python | 4,845 | 145 | #!/usr/bin/env python
"""
pyboard interface
This module provides the Pyboard class, used to communicate with and
control the pyboard over a serial USB connection.
Example usage:
import pyboard
pyb = pyboard.Pyboard('/dev/ttyACM0')
pyb.enter_raw_repl()
pyb.exec('pyb.LED(1).on()')
pyb.exit_raw_repl()... |
b50d331a23297a503dc5e26aeae9544083bbd8dd37e3ff8d7691ec4fb7b59b27 | Python | 4,846 | 111 | from ptsa.data.readers import EDFRawReader, JsonIndexReader, BaseEventReader, EEGReader
import pytest
import os.path as osp
from tests.utils import get_rhino_root, skip_without_rhino
import numpy as np
@pytest.fixture
def local_eegfile():
return osp.join(osp.dirname(__file__), 'data', 'eeg.edf')
def test_read_l... |
8516bf23236190a9a264570749fe7cb10641e4b60e7c31e6023f68e62ce347d4 | Python | 4,864 | 124 | import os
from DataConstructor import *
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
import json
import Metrics
import numpy as np
from optimiser_tools import *
def Test_fn(root, model, n_queries=28, batch_size=32, lr_power = -4.0, test_seasons = [2015,2016,2017,2018], gammas = [7,14,... |
c0ed231160968026733e927af7c06921c1a4d465111e35125596635afd162edb | Python | 4,866 | 149 | 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... |
5b7b3170b25c9c04e034fc527e52bf481001b025810963759e11730452548680 | Python | 4,870 | 143 | import numpy as np
from qtpy.QtGui import QPainter, QColor
from qtpy.QtWidgets import QWidget, QGridLayout, QFrame
from .util import histograms
class ColorHistogram(QWidget):
'''A Class which draws a scaling histogram in
a widget.
Where counts are the bin values in the histogram
and colormap is a t... |
1196ab48b15824ce9ccd9ac30208debeb6f078d224a8b682c93d58fef2f89811 | Python | 4,872 | 118 | from abc import abstractmethod
from functools import partial
import numpy as np
from .kernels import KernelValues
from .optimization import NewtonMethod
from .utils.time import get_dt
# a
class BayesianDecoder:
@abstractmethod
def sum_convolution_kappa_t_spikes(self, t, mask_spikes, sd_stim=1):
pass
... |
201ba1d1fa603e0b339d4db2a8c6cf0d5bab5df65805f92930b85427ab1cdc08 | Python | 4,874 | 147 | import argparse
import logging
import os
import json
from tqdm import tqdm
import numpy as np
import sys
sys.path.append("../")
from utils import (
evaluate,
)
from src.data_loader import (
DictionaryDataset,
QueryDataset,
QueryDataset_custom,
QueryDataset_COMETA,
)
from src.model_wrapper import ... |
79faaf4e5955b7faf79c4398f2eb84666eceaa49f65e715d92e30632c2e9614c | Python | 4,874 | 147 | import torch
from torch_geometric.data import InMemoryDataset, Dataset
from torch_geometric.data import Data
def create_data(feat,label):
data_list = []
num_nodes = feat.shape[0]*7
num_graph = feat.shape[0]
for m in range(num_graph):
edge_index = torch.tensor([
[],
[]
... |
c38320f0499a9286cf54db4c369dfaa2d878f8ef6611cbd86af42d39fb3f8eb2 | Python | 4,881 | 154 | import matplotlib.pyplot as plt
from PIL import Image
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import matplotlib.font_manager as fm
from torchvision import transforms
import numpy as np
def plot_angle(ax, x, y, angle, style):
phi = np.radians(angle)
xx = [x + .5, x, x + .5*np... |
29f9aecb57cdee1b2a8cafd86a8b4ec50ee123abf822fb7e5553cdfcc386fa2f | Python | 4,884 | 137 | import time
import numpy as np
import torch
import utils
class Appr(object):
def __init__(self, model, nlab, nepochs=100, sbatch=64, lr=0.05, lr_min=1e-3, lr_factor=1, lr_patience=5, clipgrad=10000, args=None):
self.model = model
self.nepochs = nepochs
self.sbatch = sbatch
... |
0b24eebfe2b6493bfaa622977bfbe1b190e7a693c21977a8a607c5e9e622762e | Python | 4,890 | 124 | # 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... |
cfc747c64641feb89dfeef4237945d186261412e8bc32ab3801f291fd5a05514 | Python | 4,890 | 115 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data
import models
from tqdm import tqdm
def train(args, device, train_loader, traintest_loader, test_loader):
for trial in range(1, args.trials + 1):
# Net... |
aa5ad3c3b7bf94e30a7d70a804ee3c63b26c8c80aa44d6efa262ed5485c34d6a | Python | 4,893 | 119 | import os, sys, argparse, time, random, math
import ot
import pandas as pd
import numpy as np
from sklearn.decomposition import PCA
from sklearn.model_selection import KFold, StratifiedKFold, train_test_split
from sklearn.cluster import KMeans, AgglomerativeClustering
import scipy.cluster.hierarchy as sch
from scipy ... |
ff27d93612a4dd9fd98a641f54292be97c258295b10391ab6c535ab076f66f07 | Python | 4,898 | 118 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import logging
from tqdm import tqdm
import random
from torch.cuda.amp import autocast
from pytorch_metric_learning import miners, losses, distances
LOGGER = logging.getLogger(__name__)
class Sap_Metric_Learning(nn.Module):... |
758dfc939caba429649bf09dff85d6771b290ce2fefcdd61f7c5f9b1a69fd938 | Python | 4,899 | 88 | import numpy
from typing import Annotated, Any, Dict, List, Optional, Tuple
from numpy.typing import NDArray
from pydantic import ConfigDict, Field, validate_call
from cellprofiler_library.opts.filterobjects import FilterMethod, FilterMode, OverlapAssignment
from cellprofiler_library.types import ObjectSegmentation
f... |
fc10b66d22407c07c5d2794025b22cebcf7dd82d0452c846202acd50eb62434c | Python | 4,899 | 151 | import logging
import numpy
from ._grayscale_image import GrayscaleImage
from ._rgb_image import RGBImage
from .abstract_image import VanillaImage
LOGGER = logging.getLogger(__name__)
class ImageSet:
"""Represents the images for a particular iteration of a pipeline
An image set is composed of one image pr... |
f26012f6c1c014d2dccca3828f77eef68b45416a694d57b774298f327f40496e | Python | 4,904 | 136 | import time
import numpy as np
import torch
from tqdm import tqdm
import utils
torch.autograd.set_detect_anomaly(True)
class Appr(object):
def __init__(self, model, nlab, nepochs=100, sbatch=16, lr=0.01, lr_min=5e-4, lr_factor=1, lr_patience=5, clipgrad=10000, args=None):
self.model = model
... |
4894f736e6714022d5edb46ee892fb41ffeba55e72bc2d227f506f50fa71d3e7 | Python | 4,905 | 125 | import logging
import os
import zipfile
from pathlib import Path
from typing import Dict, Union
from imctools.io.mcd.mcdparser import McdParser
from imctools.io.txt.txtparser import TxtParser
from imctools.io.utils import OME_TIFF_SUFFIX, SCHEMA_XML_SUFFIX, SESSION_JSON_SUFFIX
logger = logging.getLogger(__name__)
I... |
7645efa62faa9d7dd0c9b37851c9a9aeecd804d54fa94e7019b3e726ee8e4dab | Python | 4,905 | 149 | from __future__ import division
import matplotlib.pyplot as plt
from numpy import *
from scipy.io import *
from scipy.stats import ttest_1samp,ttest_ind,ttest_rel
import pandas as pd
import sys
sys.path.insert(0, '../helpers/')
from helpers import *
from circ_stats import *
from constants import *
import statsmodels.fo... |
fae9cb9e94a23599101e06b1a268adfecc74fde7f5451fe084cd408f332faf04 | Python | 4,905 | 148 | """
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 sys
import os
import datetime
import platform
import ... |
bcc36674a0cc6f3b3ecac48b8b9fb7e7e349f68ebb377825fd7b5eed1664f2b4 | Python | 4,910 | 127 | import numpy as np
import torch
from PIL import Image
from torchvision import datasets
import torchvision.transforms as transforms
from torch.utils.data import Dataset
import albumentations as A
from utils.labels import Id2label_6_Cityscapes, Id2label_11_Cityscapes, fromIdToTrainId
class CityscapesGray(Dataset):
... |
19c34b3a1cafbb3af4aafc8956438689f5e41f909ad9eb5d8c838135ef9cbeeb | Python | 4,913 | 139 | #!/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():
... |
421572385b1f63bf41f1133cef0fed736238504bdb3dec0e0fa1b50ace6e35d3 | Python | 4,913 | 110 | # Pytorch Tabular
# Author: Manu Joseph <manujoseph@gmail.com>
# For license information, see LICENSE.TXT
"""Tabnet Model Config"""
from dataclasses import dataclass, field
from src.models.tabular.pytorch_tabular.repository.config import ModelConfig
@dataclass
class TabNetModelConfig(ModelConfig):
"""Model confi... |
6f7820eb18e7eac5680c62ed94c020a896a0ac8f0381f50773bf2590f1f407bc | Python | 4,914 | 128 | #!/usr/bin/env python
# coding: utf-8
import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
from matplotlib import gridspec
import matplotlib.transforms as transforms
import statsmodels.api as sm
from statsmodels.formula.api import ols
import s... |
180a60a5f0edd5c1c0ce25e9fb884d02b91c5b7079f176c295e2251311b6875a | Python | 4,924 | 168 | import matplotlib.pyplot as plt
import numpy as np
def test_color_palette(name):
areas = ['VISp','VISl','VISal','VISrl','VISpm','VISam','DG','CA3','CA1','POST','SUB','LGd','LP','LD','APN','MRN']
plt.figure(478)
plt.clf()
for idx, area in enumerate(areas):
val = np.random.rand(1) ... |
c6005a76eb2078147267c259551fc24c75e22525e42e843cb174e852eb928e28 | Python | 4,926 | 150 | """
created by: Donghyeon Won
"""
import os
import numpy as np
import pandas as pd
from PIL import Image
from torch.utils.data import Dataset
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.models as models
class ProtestDataset(Dataset):
"""
dataset for ... |
f23009ebd1d00562fc064f61600c3078ce8767f16caf157cfa3a17b706230c4d | Python | 4,926 | 142 | #!/bin/env python
"""
Plot precipitation using custom colormap
=============
This tutorial shows how to plot data using a custom colormap with a specific
range of precipitation values.
"""
import os
from datetime import datetime
import matplotlib.pyplot as plt
import pysteps
from pysteps import io, rcparams
from py... |
8dbefd87eef21a4e04fd75952228d8609d1665c7cbbee0a57fc7ebb9d5f6a521 | Python | 4,931 | 142 | import numpy
import numpy.testing
import cellprofiler_core.image
import cellprofiler_core.object
import cellprofiler_core.utilities.hdf5_dict
class TestSegmentation:
def test_01_01_dense(self):
r = numpy.random.RandomState()
r.seed(101)
labels = r.randint(0, 10, size=(2, 3, 4, 5, 6, 7))
... |
b928611883ffeff2ad9dfb88e6fd6a8441d77c5073bcb5f7750100a6bc8e277e | Python | 4,933 | 103 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Madison Dautle
02.02.2023
scTIGER - Single-cell, Temporal Inference of Gene Regulatory Networks
"""
import os
import argparse
import sys
import warnings
import pandas as pd
import scTIGER as sd
import shutil
warnings.simplefilter('ignore')
os.environ['KMP_WARNINGS'... |
97888454f293f2adcec388904bc53947553350d43af6603f01e6302e4b6e91b5 | Python | 4,940 | 150 | """
@author: Johanna Rahm
Research group Heilemann
Institute for Physical and Theoretical Chemistry, Goethe University Frankfurt a.M.
Handle widgets of DeepSTORM2DAddOns Jupyter Notebook.
"""
import tkinter as tk
import os
from tkinter.filedialog import askopenfilename
from ipywidgets import widgets
from IPython.dis... |
4bb6710e6920779b02eeaca77017b0e48de52bdc3bf93fa2ec33a3c239e13d91 | Python | 4,942 | 186 | import pandas as pd
from rdkit import Chem
from rdkit import DataStructs
import matplotlib.pyplot as plt
import molvs as mv
from rdkit.Chem import RDKFingerprint
import numpy as np
from tqdm import tqdm
import os
from multiprocessing import Pool, cpu_count
import math
import time
import itertools
import datetime
from ... |
e1780e64878e22634c40437e96247a64a51f71105fd1729a22ee1a4545dcdac8 | Python | 4,947 | 157 | # -*- 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... |
ff5d682b73f04dfa8da798fe3540b86a3affc08f84d4b8a785b92b835f841b85 | Python | 4,947 | 127 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 09 19:49:40 2019
@author: danielm
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as stats
def run_analysis():
# savepath = r'C:\\Users\\danielm\\Desktop\\population_overlap\\'
savepath = r'... |
f58c521021563855e45b28a790c7dd4c30b1881f7413c6254d9cc2a7e6457fbf | Python | 4,949 | 104 | import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
from torch.nn import functional, init
# Implementation of Classifier
class AttClassifier(nn.Module):
def __init__(self, data):
super(AttClas... |
6439935ec7f3f83b6e29eb1e4942f5aa378a4992e9c58bd7e15d95d75b91182c | Python | 4,958 | 99 | # Pytorch Tabular
# Author: Manu Joseph <manujoseph@gmail.com>
# For license information, see LICENSE.TXT
"""Category Embedding Model Config"""
from dataclasses import dataclass, field
from src.models.tabular.pytorch_tabular.repository.config import ModelConfig
@dataclass
class CategoryEmbeddingModelConfig(ModelConf... |
5656b0eb020ec9b2439faec3ba6d562bf69be070437b7d2109e2c4d5015ac368 | Python | 4,960 | 113 | import sys
import os
from argparse import ArgumentParser
import logging
import pytorch_lightning
import torch
workspace_path = '/mnt/netcache/bodyct/experiments/airway_labeling_t7828/bronchial'
print("We add {} into python path for module lookup.".format(workspace_path))
sys.path.append(workspace_path)
from pytorch_li... |
7bdedb41e96ae558e1d1bed9bfca8beb0903a53a4e86b5ab74cefff953becb7b | Python | 4,960 | 150 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 08:57:32 2021
@author: filtez
"""
import os
import random as rnd
import numpy as np
import pickle
import time
import string
import numpy as np
import os, gc, json
import pandas as pd
import transformers
from transformers import AutoTokenizer, AutoMode... |
260ab6ecdb413a3589f687f04a967580f018d09c52bc197a8604c87b19f1dd66 | Python | 4,962 | 169 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on July 16, 2019
@author: nchapochnikov
testing the offline NMF
ALL TESTS PASS
"""
import pytest
import numpy as np
import pandas as pd
import scipy.linalg as LA
import itertools as it
import functions.nmf as nmf
import functions.general as FG
# We generat... |
4574a810c448fa7abd8dcb0ac21e5c26824012889fc2d6dbe87372b2636cfecf | Python | 4,964 | 156 | import random
import csv
import os
import numpy as np
from time import time
def generate_random_initial_dataset(n, seed_value):
# seed for reproducibility
np.random.seed(seed_value)
data = [[0 for j in range(n)] for i in range(n)]
for i in range(n):
for j in range(i):
if i != j:
... |
07278c4489f09c14953b4116a973953c1ed15d4d9641929b4a225967e92e3023 | Python | 4,965 | 60 | from typing import Optional, Annotated
from pydantic import validate_call, ConfigDict, Field
from cellprofiler_library.opts.rescaleintensity import RescaleMethod, MinimumIntensityMethod, MaximumIntensityMethod
from cellprofiler_library.types import ImageAny, ImageAnyMask, ImageGrayscaleMask, PixelAny
from cellprofiler_... |
c0ff38069bd0b7fcd522f9ab057121e48153b14edb9630081481fe70108ccf94 | Python | 4,966 | 151 | import numpy as np
from .util import prepare_for_display, window_manager
from ..._shared.utils import warn
from qtpy.QtWidgets import (QApplication, QLabel, QMainWindow, QWidget,
QGridLayout)
from qtpy.QtGui import QImage, QPixmap
from qtpy import QtCore
# We try to acquire the gui lock fi... |
05c67e8b6fd4d8d4b7e1010b64eb176def7b3d250e1a985106301651db24ff1b | Python | 4,970 | 141 | from __future__ import absolute_import
import numpy as np
class Indexes(object):
"""The Indexes class stores indexes for manipulating subsets on behalf of a parent set
The idea here is that you have a parent set of "things", for instance
some pixels or objects. Each of these might have, conceptually,... |
4dad6f74c41d754547a9be1f616e574fd7e9498409a6c89c9c4461f93d06e31c | Python | 4,970 | 150 | import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Optional, Union
import tifffile
from imctools.data import Acquisition, Channel
from imctools.data.acquisitiondata import AcquisitionData
class OmeTiffParser:
"""Parser of MCD compatible .OME-TIFF files.
Allows to get a single IM... |
0fa6dc40c753b9955be6d09c9d1e8efe3d2728f7c5fe9a3968ea2888fef3fa1e | Python | 4,983 | 174 | #!/usr/bin/env python3
import os
import random
import sys
import time
from itertools import product
import numpy as np
import pandas as pd
from nilearn import image, maskers, masking
sys.path.append(os.path.join("..", ".."))
from datalad_helpers import HCPFetcher
####################################################... |
37e87db03c2e02cb242bb01d676374a2d71b15398ac61f647728ba3109033bad | Python | 4,983 | 145 | import torch
from torchmetrics import (
Metric,
F1Score,
Precision,
Recall,
JaccardIndex,
Accuracy,
Specificity,
)
from GANDLF.utils.tensor import one_hot
from GANDLF.utils.generic import (
determine_classification_task_type,
define_average_type_key,
define_multidim_average_type_... |
4f6b793d0fea03351d37b8f6d461cf47df855d00539dbdb722c6ba8d4b588807 | Python | 4,984 | 148 | from collections import namedtuple
import os
import warnings
import torch
from transformers import AutoTokenizer, AutoModelWithLMHead
from config import ConfigBinaryClassification
from config import ConfigBinaryClassificationDistill
from config import ConfigTripleClassification
from LAC import LAC
from torchtext impo... |
d7db2b3c062019d2d235af735ec6535b022cf580968b490a0cb1872a4abde6bf | Python | 4,984 | 128 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 18 20:54:44 2018
@author: saskiad
"""
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import core
area_dict = {}
area_dict['VISp']='V1'
area_dict['VISl']='LM'
area_dict['VISal']='AL'
area_dict['VISpm']='PM'
area_dict['VISa... |
dd02c8ab128891dc66e5e257e15945d8541f9c9accdf52275e19195b9635ef8d | Python | 4,984 | 134 | """
Addressing Reviewer comment: Why do we discard the first two minutes of each recording?
The following code uses a simple heuristic of deeming EEG signals as artifactual, if the signal is above or below 50 µV.
"""
import numpy as np
import mne.io
def read_eeg_data_from_file(file_path: str, channels, time... |
5ec92891cda7812087941ab22a581e558842829e84f36e57dee16df8f0414758 | Python | 4,987 | 124 | from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from util.util import normalize
from skimage import io
from util import util
import numpy as np
class DiceImageDataSet(BaseDataset):
"""This dataset class loads a single 3D image volume and dice it into cubes. --da... |
68e49380765c19794ea55751f85d7d4adad8e359ef3da5753d2f01d27f2f5414 | Python | 4,987 | 200 | import os
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
#############################################################################
# Constants
dataset = "hcp"
parcellation = "schaefer200x17"
unique_bins = ["1", "5", "10", "15", "20"]
model = "kernelridge_scikit"
cbpm = False
accuracy_... |
1c9a6fd37f51ce9ac0ca78690a2c63f447c800117499f723e861ecdff29051fc | Python | 4,989 | 157 | # -- coding: utf-8 --
"""
pysteps.verification.lifetime
=============================
Estimation of precipitation lifetime from
a decaying verification score function
(e.g. autocorrelation function).
.. autosummary::
:toctree: ../generated/
lifetime
lifetime_init
lifetime_accum
lif... |
c283beba3425dc7debf4b766496cfcaf4b279aba802797eced89ec792c36ab5a | Python | 4,993 | 116 | import numpy as np
from .perlin2d import interpolant
def generate_perlin_noise_3d(
shape, res, tileable=(False, False, False),
interpolant=interpolant
):
"""Generate a 3D numpy array of perlin noise.
Args:
shape: The shape of the generated array (tuple of three ints).
Thi... |
52da3ff3263eda69533932f4e152f5ebb3ec1f51833e27a09709f0e6355eb09b | Python | 4,996 | 195 | import pickle
import torch
from tqdm import tqdm
import yaml
from yaml.loader import SafeLoader
import pdb
import mlflow
import os
from DT_for_WDN_leak_localization.classifier_dataset import get_dataloader
from DT_for_WDN_leak_localization.models.dense_classifier import DenseClassifier
torch.set_default_dtype(torch.... |
364deed2828dbef1d5ba1fae42e64fe4ccb39fa31c6e27a17eeeb35c6c10f401 | Python | 5,001 | 137 | #!/usr/bin/env python3
"""
Takes a atlas or cluster map ('dlabel.nii') and outputs a csv of results
Usage:
ciftify_atlas_report [options] <clust.dlabel.nii>
Arguments:
<clust.dlabel.nii> Input atlas or cluster map.
Options:
--outputcsv PATH Path for csv report. (defaults to location of input)
... |
689113f08b088ab100e702bad49a8951074718204da23970c157db71a68cd8b5 | Python | 5,004 | 291 | class TestPipeline:
def test_set_volumetric(self):
pass
def test_volumetric(self):
pass
def test_copy(self):
pass
def test_settings_hash(self):
pass
def test_instantiate_module(self):
pass
def test_reload_modules(self):
pass
def test_is_p... |
3a8876064c9d510fb39b211a2809a5d3c7409b63b0bb3cad52febe3ea8fff43c | Python | 5,009 | 148 | from glob import glob
import sys
import random as rd
import numpy as np
import scipy.io as scio
from joblib import Parallel, delayed
import multiprocessing as mp
import time as tme
##############################################################################
# FILES ... |
81321570cef6771ca36f7ee92ac32769b80995a69ab1deca5e2f55d081fb9f8b | Python | 5,017 | 112 | """
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Filtlong
This module contains some tests for Filtlong. To run them, execute `python3 -m unittest` from the
root Filtlong directory.
This file is part of Filtlong. Filtlong is free software: you can redistribute it and/or modify
it under the ter... |
9d67a9201ab7d36eb0ff338b5308cc13d50121ea8a7706f72309c8a61c0a313b | Python | 5,024 | 127 | from matminer.featurizers.conversions import StrToComposition
from matminer.featurizers.composition import ElementProperty
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from matminer.featurizers.conversions import StrToComposition
from pymatgen.core.com... |
b4464c349f986c445fcbdaab69ace51bef3ca8e42c7da05ac0224372cebb31ec | Python | 5,024 | 151 | 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... |
c6972e30da4dbc2b871fe9875b9a6a57be62eeb92c6077c3082adc177ef23c97 | Python | 5,028 | 127 | # 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... |
cfcdb95e7a75c7681a904d7e177566773a0fc36638d93f6d3674e218f2046bda | Python | 5,028 | 123 | import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.ticker as mticker
from sklearn.neighbors import KernelDensity
import copy
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings("ignore")
import damask
class Texture:
def __init__(self):
pass
... |
f7bacdae14c7e4ea50b491b843e47fde08e834038b959aaec5f1939ad26314fe | Python | 5,028 | 188 | import pandas as pd
from rdkit import Chem
from rdkit import DataStructs
import matplotlib.pyplot as plt
from rdkit.Chem import RDKFingerprint
import numpy as np
from tqdm import tqdm
import os
from multiprocessing import Pool, cpu_count
import math
import time
import itertools
import datetime
from rdkit.Chem import ... |
cdb0ee1c024f2b42e8378ff446d6914df564bf8d9e395559d51d3a3c7b7623fa | Python | 5,029 | 188 | import pandas as pd
from rdkit import Chem
from rdkit import DataStructs
import matplotlib.pyplot as plt
from rdkit.Chem import RDKFingerprint
import numpy as np
from tqdm import tqdm
import os
from multiprocessing import Pool, cpu_count
import math
import time
import itertools
import datetime
from rdkit.Chem import ... |
d15178050224d6159c869d9f7bdf5338a87b2c855074bd3d5e1064787de8dcc3 | Python | 5,029 | 115 | """
Plots white noise characteristics.
@author: bartulem
"""
import os
import sys
import scipy
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
class WhiteNoise:
def __init__(self, white_noise_file=''):
self.whit... |
ee3b9c3c4ea8f60e29fdf74df22a6820b046f6a6eb5232a7ea97033b4e67103d | Python | 5,029 | 150 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for fragment.py"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import logging
from rdkit import Chem
from molvs.standardize import Standardizer
from molvs.fragment import FragmentRemover
logging... |
70f85c0267d45bd6e841ac5bd34538793299c04e775749fb5ca7dd3adb279e56 | Python | 5,030 | 105 | #!/usr/bin/env python3
"""
A collection of function for the building file and directory names
within the ciftify/HCP pipelines naming convention
"""
import os
import logging
def spec_file(subject_id, mesh_settings):
'''return the formated spec_filename for this mesh'''
specfile = os.path.join(mesh_settings['F... |
f433b1bee80d5ab9e6712c0d6408461e83d82815f561c5d53daa32dde55f44fb | Python | 5,031 | 139 | #!/usr/bin/env python3
"""
Will measure the distance from one subjects rois to all other subjects in mm on specified surfaces.
Usage:
ciftify_postPINT2_sub2sub [options] <concatenated-pint> <output_sub2sub.csv>
Arguments:
<concatenated-pint> The concatenated PINT outputs (csv file)
<output_sub2sub.csv> ... |
6bb064645471c5bbff723112d281773aaa73a28978b236b0b3b537a602c6ec85 | Python | 5,035 | 112 | import numpy as np
from sympy import false
from dragen.run import Run
#Model details
dimension = 3
box_size = 30
box_size_y = None # if this is None it will be set to the main box_size value
box_size_z = None # for sheet rve set z to None and y to different value than x the other way round is buggy
resolution = 2
num... |
4bde3aa1366364042d1a4778beeae9888329ede08a02ad6e09d3073a905716fa | Python | 5,038 | 151 | # JHK
# Python script for generating ED Figure 8
import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.basemap import Basemap
import os
#==========================================================
# Set main directory
#================================... |
c5b395bcaacfe28a47877e15d5708534eac6a4c32cd585886dc0b1a9f3bbd782 | Python | 5,038 | 126 | import io
from urllib.parse import urlparse
import logging
import imageio
from cellprofiler_core.readers.imageio_reader import ImageIOReader
from cellprofiler_core.readers.imageio_reader import SUPPORTED_EXTENSIONS as IMAGEIO_SUPPORTED_EXTENSIONS
from cellprofiler_core.readers.imageio_reader import SEMI_SUPPORTED_EXTE... |
e5cbc86114af7a83b816fb47c47c669a37be227d4915bf82356d2935ee91a722 | Python | 5,048 | 165 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyNIDM documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 13 11:52:15 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... |
35c4b4417966f01bcbdd3aca2e053558046e37724c8098e19aa65624a25010cc | Python | 5,049 | 150 | """Validate Python representation recipes before passing them to the core."""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from typing import Literal, cast
from datamonger._errors import UnsupportedDecoderError
from datamonger._models import LogicalType
from datamonger._validate i... |
263b0d5ed676d6bf6cfc4ca328480062c6bde086e8de3da00211d581d6b28f83 | Python | 5,050 | 161 | '''
Parses an Orca file that performed a geometry optimization and harmonic analysis.
'''
import sys
import os
import csv
#sys.path.append('./Modules')
sys.path.append('/n/home09/ajinich/deltaG/mother/code/ian_ben_adrian/Modules')
from lib.thermodynamic_constants import *
import fnmatch
def getFormationEnergy(filena... |
6bb73fb05044f95398e468cf9c788dfc4434bd694643e8c991429b3dc81072b5 | Python | 5,051 | 127 | """ Plateau Scheduler
Adapts PyTorch plateau scheduler and allows application of noise, warmup.
Hacked together by / Copyright 2020 Ross Wightman
"""
import warnings
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from .scheduler import Scheduler
class PlateauLRScheduler(Scheduler):
""... |
d538836da5a218e6c5f407806fd7b90cebb6b32a3d5cbf0f97aae1567e26f9e3 | Python | 5,051 | 150 | from napari_sc3d_viewer import LoadAtlas, RegisterSc3D
import numpy as np
try:
import pyvista
pyvista_install = True
except:
pyvista_install = False
# make_napari_viewer is a pytest fixture that returns a napari viewer object
# capsys is a pytest fixture that captures stdout and stderr output streams
def... |
6b2167df4fbfeb2dd9f65791fdae1413b04fb1fe5529d0993c6f7ed9cfca78f4 | Python | 5,052 | 196 | import os
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from etspredict.prediction.scoring_utils import compare_propabilites
#############################################################################
# Constants
dataset = "hcp"
parcellation = "schaef... |
c4beb283c57c805157c698cf429950b8d06dcbe42bc9392b2a3afa42e273c8af | Python | 5,055 | 120 | import random
from functools import partial
import cv2
import tensorflow as tf
from data.data_augmentation import augmentation
class DataDealer(object):
"""Class that makes loading data and data augmentation easy.
Public methods:
- get_batch_from_queue: gets data batch tuple using ImageReader
- dat... |
fa7be156ab774c731a54e410d71131a3c8e5106bcd2d11e038ac98b72d201610 | Python | 5,059 | 136 | import cv2
import numpy as np
import torch
import tqdm
from pytorch_grad_cam.base_cam import BaseCAM
class AblationLayer(torch.nn.Module):
def __init__(self, layer, reshape_transform, indices):
super(AblationLayer, self).__init__()
self.layer = layer
self.reshape_transform = reshape_trans... |
1238221ff6aa77c9e77fd63fda8cbf87e9b9f2e58bb4d2005e414f932a625a4d | Python | 5,070 | 162 | """
Miscellaneous utils
Date: September 2018
Author: Ignacio Heredia
Email: iheredia@ifca.unican.es
Github: ignacioheredia
"""
import os
import subprocess
from distutils.dir_util import copy_tree
from multiprocessing import Process
import numpy as np
from tensorflow.keras import callbacks
from tensorflow.keras impor... |
50df19dc515dd276b641436e76f2359509baafe44684cae4bc39c7d8ed85c560 | Python | 5,071 | 167 | from cellprofiler_core.object import Objects
from .._module import Module
from ...constants.measurement import COLTYPE_FLOAT
from ...constants.measurement import COLTYPE_INTEGER
from ...constants.measurement import C_COUNT
from ...constants.measurement import C_LOCATION
from ...constants.measurement import C_NUMBER
fr... |
83bedb48ba21a3726a9a7e90220935e4e261dd6c56e3a3c4c58092574a1fc373 | Python | 5,071 | 134 | import random
from pepars.utils import DNA
from ..workspace import Workspace as ws
from ..workspace import Database as db
from .Sequence_Library import Sequence_Library
def get_probability_of_unseen_sequence(library):
alignment = ws.get_active_alignment()
# Check the alignment statistics data to see if we'... |
3c670830ee18a00263145ebc36f8795f70f4f60f77df335abcafa7c59f8dd742 | Python | 5,072 | 167 | #!/usr/bin/env python3
import os
import tempfile
from itertools import product
import numpy as np
import pandas as pd
from scipy.stats import pearsonr, spearmanr
from sklearn.kernel_ridge import KernelRidge
from sklearn.linear_model import RidgeClassifier
from sklearn.model_selection import GroupKFold
from etspredic... |
deb3a6ea34a5fab47b1a65d005ecda17d87a7118e3a465c69830a542786c49ba | Python | 5,077 | 128 | import torch
import cv2
import numpy as np
import json
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from read_data import *
from betaVAE import *
from gan_utils import *
import matplotlib.pyplot as plt
def savegrid(ims, rows=None, cols=None, fill=True, showax=Fals... |
a9a6774082fd8306e1a182c494955bf00835586b77c33ea0424a5f4b2addcd8f | Python | 5,086 | 137 | import os
import shutil
import pytest
import yaml
from click.testing import CliRunner
from ..cli import main
from ..redcap2reproschema import process_choices
def test_process_choices_numeric_codes():
# Test standard numeric codes with descriptions
choices_str = "1, Male | 2, Female | 3, Other"
choice... |
d827ab427a3170d17e2618c4f70cc3b4912c003030849f008553bf857f48d1b4 | Python | 5,089 | 136 | """Shared helpers for expanding the ``-nl`` NIDM file list.
Both ``pynidm query`` and ``pynidm queryai`` accept a ``-nl`` value that is a
comma-separated list. Historically every entry had to be a literal NIDM file
path, which is painful for studies with many per-subject files. These helpers
let each comma-separated... |
9799b06f9e4c0926e967a605fc43affc5cb9ee9750bd74316e8f637ed864b331 | Python | 5,096 | 155 | import copy
import numpy as np
from utils import read_csv_in_dict, find_crops
from torch.utils.data import Dataset
import glob
import SimpleITK as sitk
from scipy import ndimage
from pathlib import Path
import torch
class SubtypingInference(Dataset):
label_to_cle = {
0: "absent",
1: "trace",
... |
4387afc4c1e02d960636d0e36d71f78de050bc1b455a140d75b0b52c8e24569a | Python | 5,113 | 129 | """
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 gemmi
import numpy
import pandas
from servalcat.utils... |
accd7cb326cc394b2356b2f9e878eddec80330b06a425a071b7a01f5a96ad3c1 | Python | 5,119 | 191 | # -*- coding: utf-8 -*-
import matplotlib as mpl
from matplotlib.testing.compare import compare_images
from tempfile import NamedTemporaryFile
import os.path
import pygenometracks.plotTracks
mpl.use('agg')
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"test_data")
with open(os.pa... |
48e186ec410b6cc1c15dacca40cddbdf5e2d60c239c06b48771c547eb2d6522a | Python | 5,121 | 142 | #!/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
... |
5bbd9d644867941584258790be53fbe321423349655b86b88e4ed5cf802e8170 | Python | 5,124 | 160 | from __future__ import annotations
import json
import os
import subprocess
import sys
from pathlib import Path
import pytest
import yaml
ROOT = Path(__file__).resolve().parents[3]
WORKFLOW = yaml.safe_load((ROOT / ".github/workflows/publish-registry.yml").read_text())
PROPOSE = next(
step["run"]
for step in ... |
9760142698461f14d144479bd9a189cf589b40a19fc33db66c7614dc0aeab9d4 | Python | 5,124 | 104 | import pandas as pd
import numpy as np
import os
from sklearn.metrics.pairwise import cosine_similarity
from scipy.stats import pearsonr
# class which embeds search queries, used a class instead of a function so it runs faster without having to load everything
class query_to_embedding:
# its a class so it can be c... |
21e3233eb6029a8001f45d62adda8387783ee209f2093091d81e733bb16d57e2 | Python | 5,127 | 122 | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from lib.utils import *
import tqdm
tfd = tfp.distributions
# FF model class
root = 'Results/FF/'
@tf.function
def softplus(x, k=1.0):
k = tf.cast(k, float)
return tf.math.divide(tf.math.log(tf.math.add(1.0, tf.math.exp(tf.math.m... |
d41f7704e1e9ec2ac761700e5a2c83e1b52762fec3eadbae1e433738015f4b17 | Python | 5,130 | 126 | """Tools for working with NIDM-Experiment files"""
import click
from rdflib import Graph, URIRef, util
from nidm.core import Constants
from nidm.experiment.Query import GetParticipantIDs
from nidm.experiment.tools.click_base import cli
# adding click argument parsing
@cli.command()
@click.option(
"--nidm_file_li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.