sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b9d99eddd630be35d2579d9f12bf208fa98f11dcfba67cc7501944aa6617de29 | Python | 7,360 | 150 | # -*- coding: utf-8 -*-
from figureflow import figure
import seaborn as sb
import numpy as np
import os
import importlib
importlib.reload(figure)
Figure = figure.Figure
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that t... |
775708ea67a7f9979553fdf208954f1b8784666d6921fbe602d329fed4d65ae8 | Python | 7,362 | 251 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
ab9c2fa7aee5c8108c481fb59a86574b62d07bae35fd6c81b2c971a0187f2f52 | Python | 7,370 | 218 | from __future__ import print_function
import pandas as pd
import numpy as np
import os
import sys
import gzip
import argparse
try:
import configparser
except ImportError:
import ConfigParser as configparser
from keras import backend as K
from keras.layers import Input, Dense, Dropout, Activation, Conv1D, Max... |
55b03ab691ffe6a6c09972bfd60c91ce6238c237ce84e4d01149e458a84b8c7e | Python | 7,371 | 208 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
###### Tricky parameter: ##################################################
long = False # Only set long=True ... |
f5ad55b3d616e292f082fd818acf52d17aeeed88f6eb54c95637d0e8b7493cff | Python | 7,372 | 195 | import os
import h5py
import shutil
import numpy as np
from types import SimpleNamespace
from itertools import combinations
from voluseg._steps.step4e import collect_blocks
from voluseg._tools.constants import hdf, dtype
from voluseg._tools.clean_signal import clean_signal
from voluseg._tools.evenly_parallelize import... |
ffc4aac40ed9778b5cfed76da964249d0c039ea5d4f7c6638e71a762903aa2a8 | Python | 7,373 | 172 | import numpy as np
import pandas as pd
import scipy
import os;
#os.environ['R_HOME'] = '/ihome/hpark/zhf16/.conda/envs/env36/lib/R';
#import rpy2.robjects as robjects;
from collections import OrderedDict
class KnockoffGenerator:
ISEE_path = "";
def __init__(self):
print("KnockoffGenerator_... |
04100324d72343714de74e65e1fbdbb80749caba991819ad586ecf0f42c5f000 | Python | 7,374 | 192 | """
Module to simplify the specification of user-defined equality functions for
node and edge attributes during isomorphism checks.
During the construction of an isomorphism, the algorithm considers two
candidate nodes n1 in G1 and n2 in G2. The graphs G1 and G2 are then
compared with respect to properties involving ... |
1d2ea096c8223d98759f07f02c911191d1e19abdf4753ac4c326efd2f1ffb0fd | Python | 7,380 | 161 | """
Created on Oct 17, 2022.
@author: voodoocode
"""
import numpy as np
import nibabel.freesurfer
import finnpy.src_rec.utils # @UnresolvedImport
def _read_freesurfer_annotation(path):
"""
Averages source space regions to areas defined by the Desikan-Killiany atlas.
Parameters
----------
pa... |
b0ff55161433c94060b48fd2a79e6327f647c4122912538aff8b94824d7bbf2d | Python | 7,382 | 212 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib import ticker
def plot_on_plate(
data,
value_col,
groupby,
ncols=4,
plate_base=384,
figsize=(5, 3.5),
row_base="Row384",
col_base="Col384",
vmin=0,
vmax=1,
heatmap_kws=None,
aggrega... |
78e2ff13a1482d5b50afdceca32a9edb8f249b52d8680aea282616868d085578 | Python | 7,387 | 220 | """Compute connectivity gradients
Three different types of gradients are computed:
1 - bilateral within-PCG gradients
2 - bilateral PCG-cortex gradients using Schaefer 400 (SomMot excluded)
3 - unilateral PCG-cortex gradients using Schaefer 400 (SomMot excluded)
"""
import os
import re
from joblib import Parallel, de... |
3825f26232b736adda79cc7c19b3daf55364692dd464c196b6af84fb9e31bd20 | Python | 7,391 | 186 | # create thalamus by cortical FC mat
# this is to be run on the Argon cluster of uiowa
import os
import numpy as np
import pandas as pd
import nibabel as nib
from nilearn import image, input_data, masking
import nilearn.image
from nilearn.image import resample_to_img, index_img
from scipy import stats, linalg
from skle... |
6d81f20914f11915bf5f7f57a81ad3729726ae9479eff0ac19b3825194834a6a | Python | 7,396 | 197 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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 the rights
# to use, copy, m... |
78b155449c6f9435c90834b133600046d4f97fb19d6908fb4b52cef05b1d5051 | Python | 7,398 | 198 | # -*- coding: utf-8 -*-
"""
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
Code based on:
Shang et al "Edge Attention-based Multi-Relational Graph Convolutional Networks" -> https://github.com/Luckick/EAGCN
Coley et al "Convolutional Embedding of Attributed Molecular Graphs for Physical... |
f7489b6190312092bc50c6556c7f3002b580ed8f671a23bebf3a4ae66fb19788 | Python | 7,401 | 252 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
0cce2fce400f9a88839ba4d9319acf479c63421a51e3ee44d55a13f16350accc | Python | 7,404 | 139 | import pathlib
import pandas as pd
import numpy as np
from . import helper_functions
from ..model import _param_free_base_model, _torch_model, _tensorflow_model
def check_all_specified_arguments(arguments: dict):
"""
Check all specified arguments for plausibility
:param arguments: all arguments provided... |
42eac87b7ac2af67d169df00a5811a010df635bd4441ca4e0dc5d5ed2deec831 | Python | 7,405 | 209 | #!/usr/bin/env python
"""Upload TCGA data
Upload the following data to the MEXPRESS database:
- RNA-seq gene expression
- DNA methylation
- copy number
- miRNA expression
- somatic mutations
- phenotype & survival
Usage:
python python/upload_tcga_data.py -h | --help
python python/upload_tcga_data.py \\
-i | --ini co... |
08c8adec56c01d75f5391ba123172c7e5e957dc6babc78616dcf3e3180821ce5 | Python | 7,409 | 246 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
e868f53dc435404f31a14622c3c1580638dc7e2e3c86335abe4c533914ff3db1 | Python | 7,410 | 268 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from time import time
from .utils import _normalize_grid
from . import splinegenerator as sg
import tensorflow as tf
def non_maximum_suppression(
coord,
prob,
model_path,
grid=(1, 1),
b=2,
nms... |
41249466ccde71d7defab759190f3d62607f3351914f8d8b5a876ef03e258152 | Python | 7,411 | 235 | ### to be continued....
import pandas as pd
import numpy as np
import glob
import os
import nilearn.signal
import matplotlib.pyplot as plt
from scipy import stats
import pingouin as pg
import statsmodels.api as sm
import seaborn as sns
def get_two_session_subjects():
# Identify all dHCP subjects with two session... |
5dfae27281316b35b271d1aac39d24a2fb60943686035109d06dddd8ea6819a2 | Python | 7,412 | 151 | """
Module performing the combination of several genetic marker datasets based on literature estimates.
This module implements the glia differentiation process of 'A Cell Atlas for the Mouse Brain' by
by C. Eroe et al. 2018,
https://www.frontiersin.org/articles/10.3389/fninf.2018.00084/full.
This consists first in co... |
9f3ac691f1d3175c0b90a04c0716bcd5517e8a0eaf5175d741d67cc241e94f45 | Python | 7,414 | 224 | import argparse
import os
import numpy as np
import math
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.autograd as autograd
import torch.nn as nn
import tor... |
5f4642dc5ca98ae21b717dec5c00420399f467a80a897b97433ee5593e328bb6 | Python | 7,415 | 224 | """
Training
Nicholas Turner <nturner@cs.princeton.edu>, 2017-9
"""
import time
import torch
from . import utils
REQUIRED_PARAMS = ["max_iter", "test_intv", "test_iter",
"avgs_intv", "chkpt_intv", "exptdir",
"modeldir", "logdir", "batchsize", "warm_up"]
def train(model, loss... |
8e2c4b99b6611f3eeb2e3cf38f15d005f9304197fc10ff4193c01a7eddbfd705 | Python | 7,416 | 197 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
# Generate barcode-TF matrix based on the peak-motif annotation
"""
from __future__ import division
import os
import scipy.sparse as sp
import numpy as np
from collections import OrderedDict, Counter
from statsmodels import robust
from pybedtools import ... |
6c3f2bf20833ef410c2d1dcd55ae7ff030bb9896555b5d2575ce90c199608181 | Python | 7,418 | 199 | from ..backend import get_backend
from ..progress_bar import bar
from ..utils import _batch_or_skip
def predict_weighted_kernel_ridge(Ks, dual_weights, deltas, split=False,
n_targets_batch=None, progress_bar=False,
intercept=None):
"""
Comput... |
3c301ed24afe04caeec9b5f0f2c82fc33bb0b7f6b86e1db45941fc1a5090e664 | Python | 7,419 | 224 | import numpy as np
import pytest
from sklearn.exceptions import UndefinedMetricWarning
from sklearn.utils._testing import (assert_array_almost_equal,
assert_array_equal)
from seqeval.metrics.v1 import (check_consistent_length, classification_report,
p... |
4809cc674f55f4882b583d2ff39106b19a163b4adec7c4390f5f6f24460f3251 | Python | 7,420 | 176 | #!/bin/sh
import os
os.sys.path.append(os.path.abspath('.'))
os.sys.path.append(os.path.dirname(os.path.abspath('.')))
import matplotlib
matplotlib.use('Agg')
import argparse
import numpy as np
import pickle
import models
from models.model import default_opt
from models.io import load_h5, upsample_wav
import tensor... |
5151fdc5e4ecf7a16e9a499ef13c78023cdac25e81c672f49f88a216d2ef3a0b | Python | 7,423 | 281 | #!/usr/bin/env python
from daisy import Roi, Coordinate, open_ds
from utils import add_layer
import argparse
import glob
import neuroglancer
import os
import webbrowser
import numpy as np
import zarr
def str_rstrip_slash(x):
return x.rstrip('/')
parser = argparse.ArgumentParser()
parser.add_argument(
'-... |
f3d81e781206d22e149c53c65c45c53b7094bce6860951d088f837d5a8a31d1b | Python | 7,423 | 178 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from copy import deepcopy
from math import sqrt
import numpy as np
from ax.adapter.base import DataLo... |
094bac88b2c9f3580a46039f8e72354604b382c8270fe7e15ad339eefbbf2aa5 | Python | 7,427 | 205 | import optuna
import numpy as np
import random
from .. import BaseModel
from cogdl.utils.prone_utils import propagate, get_embedding_dense
class PlainFilter(object):
def __init__(self, filter_types, svd):
self.filter_types = filter_types
self.svd = svd
# load adjacency matrix and raw embe... |
e4687b10a375e4d59fbd7c92e99f3381e8536b63209d1595ea4ee7f4d849e475 | Python | 7,427 | 283 | # -*- coding: utf-8 -*-
"""
MHD
===
IO interface to mhd / raw files.
Note
----
Using the function :func:`write_header_from_source` a mhd header for a numpy
binary array can be created to enable loading the numpy file into imagej.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GP... |
f28ee67f97df780e698e4b2fc1d1bbca17c32ffc7bf48b027885198df5937fde | Python | 7,427 | 210 | '''
Copyright 2013 Michael Kane and Bryan Lewis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
8e63fdb6e42514fcd1272b40105b6a1a056c25d39a16119af3831f4e49268d5b | Python | 7,431 | 194 | # Authors: Nicholas C. Firth <ncfirth87@gmail.com>
# License: TBC
from scipy import optimize
import numpy as np
class MixtureModel():
"""Wraps up two distributions and the mixture parameter.
Attributes
----------
dModel : distribution
Distribution object to use for the diseased data.
hMod... |
dfdd7832d4b915e253739c180f9a2f374a06a36eaa2ef74bdfcd70467cc13291 | Python | 7,431 | 214 | """
Pretty-printer for NeuroLang IR expressions as human-readable Datalog text.
Strips type annotations, uses ``:-`` notation for rules/queries, and
shortens fresh variables to short names (``s₀``, ``s₁``, …).
"""
import operator as _operator
from nl_expr.expression_pattern_matching import add_match
from nl_expr.exp... |
8a497199a5ad1661cd3ddd4b3d486d752e096e9f8da7365d4d258aa7f6e1e708 | Python | 7,434 | 201 | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... |
30a7ac898cdd4f65fd4bc17a026e50d1dbfb8e79ef6d4634e83fafa37fa0aaba | Python | 7,435 | 168 | # import libraries
import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import torch
from PIL import Image
from utils.data_utils import ImageDataset
from torch.utils.data import DataLoader
from utils.utils import load_config, set_seed
from torchvision import transforms
... |
6585c9cbc6a04c04aed0c6b405426d897b63a137fba826d0639e6133038af94d | Python | 7,438 | 240 | from __future__ import annotations
from typing import TYPE_CHECKING, cast, overload
import h5py
import numpy as np
import pandas as pd
import pytest
import zarr
from scipy import sparse
import anndata as ad
from anndata.acc import A
from anndata.tests.helpers import assert_equal
if TYPE_CHECKING:
from collectio... |
33a8236b4b68737ea78e64c67b0917331d00f9989a1ba90bdf2230f8df04bbd3 | Python | 7,439 | 215 | """Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from collections import OrderedDict
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from ... |
7fdb16564913e2e2908f53afa006261224183d743677873b4e78c542cac5dfc4 | Python | 7,442 | 220 | # NICE
# Copyright (C) 2017 - Authors of NICE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program ... |
2725d05a30a1e1458e20052a3bdddc999cf93264d57cfbdf348000d205d1e9d0 | Python | 7,444 | 214 | """Testing the utility functions."""
import time
import os
import os.path as op
from tempfile import gettempdir
from shutil import rmtree, copyfile
from collections import OrderedDict
import pytest
import numpy as np
import pandas as pd
import sp_experiment
from sp_experiment.define_settings import (EXPECTED_FPS,
... |
0e2585666e735dc93aeee089c6b901e3f41a1a29eacbba64c4ab0e2d0b9a3434 | Python | 7,449 | 154 | import datetime
import json
from core.models import DeletedRow
from django.core import serializers
from django.test import TestCase
from organizations.models import Organization
from organizations.tests.factories import OrganizationFactory
from projects.models import Project
from projects.tests.factories import Projec... |
6e35ef388c944ce9f02546714da26cde2f2e2e122259464a9134ee76358e4f9a | Python | 7,455 | 179 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
d9aa8c6636671325d57fbf60c64743a637aa66d950b32f1cf4a4531e50bbcc7a | Python | 7,455 | 164 | import unittest
import numpy as np
from bsb import Configuration, ConfigurationError, Scaffold
from bsb_test import NetworkFixture, NumpyTestCase, RandomStorageFixture
class TestGlomerulus_to_UBC(
RandomStorageFixture, NetworkFixture, NumpyTestCase, unittest.TestCase, engine_name="hdf5"
):
def setUp(self):
... |
ebf0eddfd4c8ae6394c2056ba7933626e157c06a4ff0097d423a567bb017ce9d | Python | 7,456 | 155 | from typing import Union
import numpy as np
import tensorflow as tf
from scipy.ndimage.interpolation import zoom
from . import ModelVisualization, keras
from .utils import is_mixed_precision, normalize, zoom_factor
from .utils.model_modifiers import ExtractIntermediateLayerForGradcam as ModelModifier
class GradcamP... |
63b4c56f3168703873c7d57064a9fda5c4487dadcd1acb7facca5ae6a51d4704 | Python | 7,460 | 193 | """
General helper functions and constants for plotting.
Written by Johannes Bill.
"""
import numpy as np
import pylab as pl
def set_zoom(factor):
"""Change the zoom factor for figures on the screen (does not affect saved figure size)."""
from matplotlib import rc
rc("figure", dpi=factor * pl.matplotlib.r... |
0ca33b045c46c031e64e78e30cc2d242771c96881cc7390a45499aab383000db | Python | 7,465 | 225 | import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
# change the default font family
plt.rcParams.update({'font.family':'Arial'})
plot_in_tiff = True
def rmsd(x,y):
Nx = len(x)
Ny = len(y)
... |
d91570819f3280bc208f572d89ccfc0858f38601b5291cb9eba862fad290a60a | Python | 7,466 | 185 | from __future__ import division
import fanc
from fanc.peaks import RaoPeakCaller, RaoPeakInfo
from fanc.hic import Hic
from fanc.matrix import RegionMatrix
from genomic_regions import GenomicRegion
from fanc.tools.general import pairwise
import numpy as np
import math
import pickle
import os.path
class TestRaoPeakCal... |
33edc3bd8534be9d1b1bac27911dec195ecbd7cd1c5730a6a6a059fc522189ff | Python | 7,469 | 222 | from collections import OrderedDict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib import cm, colors
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from .color import plot_colorbar
from .utilities import tight_hue_range
def sunbrust(
pie_data,
ax,
hu... |
362292ed5fe419110f502876f0c30a4f2ce2d983aa76b0d6b84882eb58f3dbd6 | Python | 7,481 | 266 | import importlib
import logging
import logging.config
from functools import reduce
import numpy as np
import pandas as pd
try:
import polars as pl
except ImportError:
pl = None
BACKENDS = ["pandas", "polars"]
LOGGING_CONFIG = {
"version": 1,
"formatters": {
"standard": {
"format"... |
2cd5b4832022737229b139feed1e7e09557b1868c1d781631ab227d28a51c469 | Python | 7,482 | 237 | import os
import numpy as np
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
import pingouin as pg
import cmasher as cmr
from surfplot import Plot
from adaptman.config import Config
from adaptman.utils import (get_files, schaefer1000_roi_ix, fdr_correct,
parse_roi_... |
53ddc941d5f0e239c0b4efeb1ea08b40e5a800c52be3051b1543482630df9a27 | Python | 7,489 | 197 | """Tests of the feedback server, run in a thread on an ephemeral port."""
import json
import threading
import urllib.error
import urllib.request
import pytest
import yaml
from ..feedback_server import FeedbackStore, examples_yaml, main, make_server
TOKEN = "s3cret"
ANSWER = {
"engine": "neurosynth", "provider":... |
323999cfc3b32b98df9240e41bdd66384d4bd7b69a957cdc50265a49419e7543 | Python | 7,501 | 185 | # MIT License
#
# Copyright (c) 2019 Lucas K Wagner
#
# 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 the rights
# to use, copy, modify, merg... |
c713ac1ceb3e6c06de2be3efc873a5508d3a66034d3bb51f0498163d6601ddd5 | Python | 7,504 | 219 | """
Manager and Serializers for Visualizations.
Visualizations are saved configurations/variables used to
reproduce a specific view in a Galaxy visualization.
"""
import logging
from typing import (
TYPE_CHECKING,
Union,
)
from sqlalchemy import (
false,
func,
or_,
select,
true,
)
from sq... |
08173d8ebbd324e1ee0115d964e2ceecc16557613f942cbd2768a279301845ca | Python | 7,506 | 186 | from typing import Sequence
import numpy as np
import torch
import logging
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal, Independent, NegativeBinomial
from scNTImpute.logging_utils import log_arguments
from scNTImpute.models.BaseCellModel import BaseCellModel
from scNTIm... |
72d4944519dba0e67c481edcc706a791de8a5f799be00a12b03791ae150c6cdf | Python | 7,506 | 273 | """
Recognition Tests
=================
A *forest* is an acyclic, undirected graph, and a *tree* is a connected forest.
Depending on the subfield, there are various conventions for generalizing these
definitions to directed graphs.
In one convention, directed variants of forest and tree are defined in an
identical ma... |
4fbd94e760568db2d280effba1341cd962ebf50e43d8cad65fd7f0fc7af35ced | Python | 7,507 | 195 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import final
import pandas as pd
import plotly.express as px
from ax.adapter.base import Adapter
from ax.analysi... |
c135d623711893870cd74781e56ca86ba78727dc4c80a72881331143997b9c64 | Python | 7,508 | 266 | # -*- coding: utf-8 -*-
# Imports
import pandas as pd
import torch
import numpy as np
from os import listdir
from os.path import isdir, isfile
# Load data from csv or excel file
def load_csv_or_excel(file_path, index_col=None):
"""
Import csv or excel file using pandas.
"""
file_path = str(file... |
04c243dc7a13f7370e0bdc72341abdb1474a8222c33074927a6de1ee9900fda2 | Python | 7,510 | 207 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
"""
Mixed integer extensions of some common synthetic test functions.
These are adapted from [Daulton2022bopr]_.
References
... |
9f31488a6fb6e1466b490382ab0ca3cccb58b95a92907ba1d05669b87fbc89c9 | Python | 7,511 | 192 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
18686850dcb2e5f220437bb82bbf5a81fc2e4afdbf2ac4a8beefd55a759b41f4 | Python | 7,515 | 219 | # IMPORTANT DISCLAIMER!!!!
# This script heavily borrows from the paper of: Bowring, A., Maumet, C.,
# & Nichols, T. (2018). Exploring the impact of analysis software
# on task fMRI results. BioRxiv, 285585. http://dx.doi.org/10.1101/285585
import os
import numpy as np
import seaborn as sns
from nilearn.image import *... |
ed5b6af10abe4611b5d4723c5282ce1322d20e608a8fcb491836d447b0450073 | Python | 7,517 | 219 | # IMPORTANT DISCLAIMER!!!!
# This script heavily borrows from the paper of: Bowring, A., Maumet, C.,
# & Nichols, T. (2018). Exploring the impact of analysis software
# on task fMRI results. BioRxiv, 285585. http://dx.doi.org/10.1101/285585
import os
import numpy as np
import seaborn as sns
from nilearn.image import *... |
0a3ca767f7fa6bb88dc76dab869b0614b134a3f3eed4b19ea41df61bedb18d5f | Python | 7,519 | 212 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
###### Tricky parameter: ##################################################
long = False # Only set long=True ... |
4fc8100153007cd6c5a0c1e3e13a0c66bedc10b60eac8ee2e7117aa7f881e9fe | Python | 7,520 | 219 | # IMPORTANT DISCLAIMER!!!!
# This script heavily borrows from the paper of: Bowring, A., Maumet, C.,
# & Nichols, T. (2018). Exploring the impact of analysis software
# on task fMRI results. BioRxiv, 285585. http://dx.doi.org/10.1101/285585
import os
import numpy as np
import seaborn as sns
from nilearn.image import *... |
a2a1769254905dec9ade83ce2d4fcc3e15642136edb6bab23c22148593ba1361 | Python | 7,522 | 207 | import os
import sys
from pathlib import Path
from .job_manager import JobManagerFactory, Job
from .config.options import ProjectOptions
from .utils import get_logger
from .status import needs_processing, write_record
STEP_NAME = "fmriprep-process"
BASE_SINGULARITY_CMD = (
"unset PYTHONPATH; {templateflow1} singu... |
5e2a2cae7b7e74582e9b64895d74a339493c7c54ec8e74e676f90c09309a3b47 | Python | 7,524 | 151 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
7e6859902beb5ac7a771f77ef81a478a166390f9834b564c77004cb82ed7003f | Python | 7,535 | 159 | from datetime import timedelta
from unittest import mock
from django.test import TestCase, override_settings
from django.utils import timezone
from organizations.models import Organization, OrganizationMember
from organizations.tests.factories import OrganizationFactory
from projects.tests.factories import ProjectFact... |
a5dc91f2028a7333cd3df1c2e8c54bee033d346ba9fc3ce9c147351564d9670c | Python | 7,535 | 191 | import time
import numpy as np
import torch
import torch.nn.functional as F
from tqdm.auto import tqdm
from attack.base import ModificationAttack, EarlyStop
from cogdl.data import Graph
from cogdl.utils.grb_utils import eval_acc, feat_preprocess, adj_preprocess, getGraph, getGRBGraph
class PGD(ModificationAttack):
... |
fbd8164a7b99e8712fa1295423bd14a4d22579881bf23924add188f7dc8d596f | Python | 7,535 | 207 | import os
import sys
from pathlib import Path
from .job_manager import JobManagerFactory, Job
from .config.options import ProjectOptions
from .utils import get_logger
from .status import needs_processing, write_record
STEP_NAME = "fmriprep-process"
BASE_SINGULARITY_CMD = (
"unset PYTHONPATH; {templateflow1} singu... |
b57733d98051bbb9926cde32791b8b3fda9af41c2a469ce1526330824142de96 | Python | 7,537 | 185 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Layout handling tools for plotly plot data
"""
from __future__ import division, print_function
import numpy as np
import copy
# Subplot layout definitions
MAXIMUM_SUBPLOT_COLUMNS = 4
SUBPLOT_GRID_HEIGHT = 350
SUBPLOT_GRID_WIDTH = 380
SUBPLOT_GRID_HEIGHT_... |
766e2803dbcb1cdfe1c920565d5b0611f092d85f0dacc9616d7bff7b1edeaba7 | Python | 7,543 | 192 | """
Backup resolvers for when dependencies can not be loaded from the database.
Mainly suited for testing stage.
Ideally all dependencies will be stored in the database
when a tool is added from a Tool Shed.
That should remain the preferred way of locating dependencies.
In cases where that is not possible
for exampl... |
cfc81e4fe98364ec63157e8acb31fb0917c0f739d260fa892d607b345e05e829 | Python | 7,544 | 202 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import TensorDataset, DataLoader
class LinearLayer(nn.Module):
def __init__(self, input_dim, output_dim):
super(LinearLayer, self).__init__()
self.input_dim = input_dim
self.output_d... |
d52298606ca9d292000a1f0fc5b9b271725941ebbb301351e081095a347b3d30 | Python | 7,545 | 252 | """
Mixing matrices for node attributes and degree.
"""
import networkx as nx
from networkx.algorithms.assortativity.pairs import node_attribute_xy, node_degree_xy
from networkx.utils import dict_to_numpy_array
__all__ = [
"attribute_mixing_matrix",
"attribute_mixing_dict",
"degree_mixing_matrix",
"de... |
d8684411db322880c20fc8f467248a632dfeb18dbd90ba8642cb614b0f185b73 | Python | 7,549 | 167 | import os
import pickle
import copy
import json
import pprint
import numpy as np
from sklearn import metrics
from statistics import mean, stdev
all_accuracies = dict()
MAX_SEQ = 2
SCOPE = 20
FOLDS = 5
EXPERIMENTS_DIR = ''
BEST_DIR = ''
with open(BEST_DIR, 'r') as file:
best_dir = json.load(file)
'''
Prints metric... |
35bc3d5189893ab7b8b169f74ceda809223b160795c081402c5e3e8b2ef05b75 | Python | 7,550 | 242 | import logging
import os
import numpy as np
import gunpowder as gp
import incasem as fos
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class ValidationBaselineWithContext:
def __init__(
self,
data_config,
run_dir,
run_path_prefix,
... |
c4bb3f1ef22aa4e7a588335f3cc6ccfcfde84eab49948034f5c1c2f07e3c4bfd | Python | 7,550 | 157 | from uff.ic.mell.sentimentembedding.utils.data_converstion_utils import convert_tensor2array
from uff.ic.mell.sentimentembedding.modelos.modelo import Modelo
import pandas as pd
import numpy as np
import torch
from enum import Enum
from tokenizers import ByteLevelBPETokenizer
class ModeloTransformer(Modelo):
# m... |
108224a576912b9704e2c2be415ce8c53b6ccf76ba2473901211ce954d97f50a | Python | 7,551 | 131 | """08_tensor_divergence.py - per-ROI divergence between the single-shell DTI tensor and the QTI <D>
mean tensor: orientation angle, per-tensor FA, FA difference, and eigenvalue-ratio differences,
reported as continuous readouts only. No binary equal/diverge threshold is applied.
DTI input is gated on ParkMRE_DTI for t... |
2ad2709a46543c9b3b70d978dcc9e670aa6b2b49018a678f9e2689b433569ee8 | Python | 7,551 | 234 | """Approximate bilateral rank filter for local (custom kernel) mean.
The local histogram is computed using a sliding window similar to the method
described in [Huang]_.
The pixel neighborhood is defined by:
* the given structuring element
* an interval [g-s0, g+s1] in greylevel around g the processed pixel greylevel... |
a3a61f75ba717f3aab60e09a1551ec93d56cf2a3f1d3ded4c6c9e4d207423f0c | Python | 7,552 | 197 | from pathlib import Path
import sys
from argparse import Namespace
from learnMSA.config import Configuration
def args_to_config(
args: Namespace, base_config: Configuration | None = None
) -> Configuration:
"""Apply parsed command-line arguments on top of base_config.
Args:
args: Namespace objec... |
6380367cf2ebbbf800c36603bb538a2988a175be5144a6b9b1d0feb910cdf9dd | Python | 7,554 | 190 | """
Created on Oct 12, 2022.
@author: voodoocode
"""
import numpy as np
import scipy.linalg
import finnpy.src_rec.utils # @UnresolvedImport
import mne.io
class Inv_mdl():
"""
Container class, populated with the following items.
Parameters
----------
trans : numpy.ndarray, shape(valid_vtx_... |
261979d87234c853a4228f1d2ff9ee9cd424e7fc04cc5a7c1e34425cfc9e87a5 | Python | 7,555 | 225 | import sys,os
add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(add_path.split('examples')[0])
print(add_path.split('examples')[0])
import os.path as osp
from cogdl import experiment
import time
import copy
import itertools
import os
import inspect
from collections import defaultdi... |
5cd202921b959c66afcfbf9626c9a3ae4dfd7727535da6b93c0c7bdf73b2d69e | Python | 7,558 | 258 | import json
import logging
import math
from typing import (
Optional,
TYPE_CHECKING,
)
import packaging.version
from galaxy.tool_util.cwl.parser import tool_proxy
from galaxy.tool_util.deps import requirements
from galaxy.tool_util_models.tool_source import HelpContent
from .interface import (
INPUT_CLASS... |
d3ef0b3d705903ccb802d9691842c416d5855717ba7b3fa185ed6ab48de9951f | Python | 7,560 | 205 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 22 10:46:47 2019
@author: Amelie Aussel
"""
from brian2 import *
defaultclock.dt = 0.01*ms
eq_HTC_mdPul='''
dV/dt=(-INa-IK-IL-IKL-IH-ITLT-ITHT-IAHP-IGJ-Iapp-Iapp2-J-Isyn-Itheta)/Cm_HTC : volt
J : amp * meter ** -2
Itheta = amptheta * int(sin(2*pi*t... |
728c4e7e26ed35caf28a7849c895bff319013d61d143c02fe923d09ba73e2e42 | Python | 7,565 | 224 | # -*- coding: utf-8 -*-
r"""
Forward Inference From a Free-Text Query.
=========================================
NeuroSynth associates studies with the terms of a fixed vocabulary through
TF-IDF counts. The ``neurosynth`` engine also embeds the title and abstract
of every study with SPECTER2 and exposes the cosine si... |
ddfe8f8a73de476496bb8a29a203d49a22cf66d3b033f3735821566656f1ba67 | Python | 7,566 | 279 | # -*- coding: utf-8 -*-
"""
Interface to tif image files and stacks.
The interface makes use of the tifffile library.
Example:
>>> import os, numpy
>>> import ClearMap.IO.TIF as tif
>>> from ClearMap.Settings import ClearMapPath
>>> filename = os.path.join(ClearMapPath,'Test/Data/Tif/composite.tif')
... |
a7028c16825e39bc2ac8f72835f7211912b55204a0cc7f49b2b4020ebbbd280c | Python | 7,570 | 173 | import os.path
import shutil
import sys
import numpy as np
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import tensorflow as tf
from nets import nets
def get_dataset_handlers(opt, opt_datasets, name='test'):
################################################################################################
... |
7af4ac2121ff3471ed7f578c3f21f1501ba92c68f4b6614b270c3106be3c2665 | Python | 7,574 | 220 | from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
import torch
from torch.utils.data import Dataset
from spikingjelly.activation_based.distributed import vision
from spikingjelly.activation_based.precision import PrecisionConfig
def _spread_indices(size: int, samples... |
60256dfaa05a6f65017c0dc3443613195ad22ba314141e8f5760ddce43dddff0 | Python | 7,576 | 191 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import numpy as np
import numpy.typing as npt
# Minimum absolute value for a control mean to be consi... |
acc688850970cc734aa5ba4f98a3878675a13f17cc91c93f659059cf75806de9 | Python | 7,582 | 279 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
c09858b5a549978a2cd6b8526acf89e456459714c68d5c862a6f20d98414c9af | Python | 7,583 | 180 | # -*- coding: utf-8 -*-
from figureflow import figure
import seaborn as sb
import numpy as np
import os
import importlib
importlib.reload(figure)
Figure = figure.Figure
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that t... |
6528d5a26306641888f478648c818575c16fedc05ec911b00736fc7bbd12f863 | Python | 7,584 | 225 | # -*- coding: utf-8 -*-
# Imports
import pandas as pd
from .pd_utils import load_csv_or_excel
from .pd_utils import load_experiment_results
from .pd_utils import to_torch
from .math_utils import standard
# Objective function class
class objective:
"""Objective funciton data container and operations.
N... |
dd780edba69b2da51ee04b5364aa3fce4ae28ddd19fdfefa03dca12c7b9c0340 | Python | 7,587 | 223 | # -*- coding: utf-8 -*-
# Author: Florian Boudin
# Date: 09-11-2018
"""Multipartite graph keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* Florian Boudin.
Unsupervised Keyphrase Extraction with Multipartite Graphs.
*In proceedings of NAACL*, pages 667-672, 2018.
"... |
eaac714b969767339644283ffd283d6937ad432b92873a1e64a04995f3f80bc8 | Python | 7,590 | 210 | import importlib.util
import os
import shutil
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from click import ClickException
from click.testing import CliRunner
import glia._cli
import glia._fs
import glia._mpi
from glia import Mod, Package, get_cache_path
from . import _shared
d... |
14f1280575befbac68ab08ec4d3699935a20e764380923f2d631b7a144e9d8a6 | Python | 7,592 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor_alternate import *
from FEF_contra... |
e105c858b26512ea031b835ccd5326b948e595c29c9a5bd6621c55e92838ea4e | Python | 7,592 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF_altd import *
from FEF_visuomotor_altd import *
from FEF_contra... |
547cd0c5b4c21677e12626d3101757fa9c02ceb3c163f4bf3c88d3465fff82be | Python | 7,596 | 174 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
7a9edabdfcca84f92fcc4cf535fb339d9f1edccc5dbcb4e2f5fab629bc41544e | Python | 7,598 | 207 | #!/usr/bin/env python
"""
Crop a dataset from a Zarr container.
This module provides functions to crop (or pad) a dataset from a Zarr file.
It replicates the behavior of the original implementation using Dask for parallel
block‐wise processing, without any dependencies on funlib or daisy.
Functions:
- crop_dataset_... |
d06e058366bf877b018b138dcbfe804f287a97e9a450800aaee9ce0a621c60a5 | Python | 7,605 | 279 | # -*- coding: utf-8 -*-
"""
Interface to tif image files and stacks.
The interface makes use of the tifffile library.
Example:
>>> import os, numpy
>>> import ClearMap.IO.TIF as tif
>>> from ClearMap.Settings import ClearMapPath
>>> filename = os.path.join(ClearMapPath,'Test/Data/Tif/composite.tif')
... |
15c45d6904eba3c85709cb99809fc69c98eb475a0315300e4a5e5194122777fb | Python | 7,607 | 199 | import argparse
import os
from itertools import product
from pathlib import Path
import numpy as np
import tensorflow as tf
import learnMSA.legacy.Priors as priors
import learnMSA.protein_language_models.common as common
from learnMSA.hmm.tf.util import make_dirichlet_model, make_mvn_model
from learnMSA.protein_langu... |
9dc387121edcc89daa4ca9851df6dce44bfa4ceb86792acd3550a410a84504b2 | Python | 7,608 | 205 |
import argparse
import time
import dgl
import numpy as np
import torch
import torch.nn.functional as F
from dgl.data import register_data_args
from gat import GAT
from pytorch_lightning.metrics.classification import Accuracy
from pytorch_lightning.metrics.functional import auroc
from sklearn import metr... |
389616673ca57e8c9fd13e1f8b74d1f84882ee0aed06f22efaaf7c0c201c05ca | Python | 7,610 | 221 | '''
Polychronization: Computation with Spikes
Eugene M. Izhikevich
Neural Computation, 2006
See Izhikevich_2006_Polychronization.py for an explanation of this code.
In this version, we use various tricks to make the simulation much faster,
including inline C++ code. We also save the progress as the simulation... |
182edd4da111faaaf7831469394386b12e8aa54fb42f7892a5840b20a3cf8108 | Python | 7,611 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor_alternate3 import *
from FEF_contr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.