sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d176e096f6136dfe0c459831df4b0a28aa80deab464dbfadeec0fe617eb68bab | Python | 8,081 | 222 | """Tests of the sharing of the assistant's answers with a feedback server."""
import json
from collections import Counter
from pathlib import Path
import httpx
import pytest
from ..agent import AgentResult, AgentStep
from ..config import ProviderConfig, parse_config, LLMConfigError
from ..feedback import FEEDBACK_UR... |
d17e56d543b3877fa0719dc7998e0c7bdba8b4dcde31253e3cfaa704c01b6687 | Python | 8,088 | 244 | # -*- coding: utf-8 -*-
# Author: Florian Boudin
# Date: 09-10-2018
"""TopicRank keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* Adrien Bougouin, Florian Boudin and Béatrice Daille.
TopicRank: Graph-Based Topic Ranking for Keyphrase Extraction.
*In proceedings of ... |
5e87a11b6ac96d31c6189ea639f5688fec830852a01df162c7be57bbfb2c92f6 | Python | 8,090 | 170 | #author: Dimitris Spathis (ds806@cl.cam.ac.uk)
"""
what: load individual feature CSVs of Fenland II repeats (sensors), concat, normalize and do ML
difference from other tasks: here we don't train models, we just predict using the new sensor data using Task 1's model
in: CSVs with extracted features, IDs, metadata
out... |
5d4fcada52c611c2d1a1b58376e55b65fc53eb920e53aecd5570181d5b8993cd | Python | 8,100 | 256 | """Public dataset interface functions using hardcoded dataset names.
This module provides the public API for downloading squidpy datasets.
All functions fetch datasets by their known names from the registry.
"""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing... |
a1cf8224c6de9d5372af98edbb1a856de0d9bea9410cfcf1e61f9c654d2baf8f | Python | 8,102 | 236 | from __future__ import annotations
from collections.abc import Mapping
from copy import copy
from functools import partial
from importlib.util import find_spec
from math import ceil
from typing import TYPE_CHECKING
import numpy as np
from scverse_misc import Deprecation, deprecated
from ..._core.anndata import AnnDa... |
fb18964c196bd309569af49f2eb971e3b4c972253ca4115b63f9a99f7e86c601 | Python | 8,106 | 197 | import os
import numpy as np
import pandas as pd
import nibabel as nb
from glob import glob
from nilearn.image import smooth_img, new_img_like
from nilearn.plotting import plot_stat_map
from nistats.design_matrix import make_first_level_design_matrix
from nistats.reporting import plot_contrast_matrix, plot_design_matri... |
a051a15bcded52b1420315e092a45b42d1e97b25c58af8425df9163f736d59da | Python | 8,107 | 204 | import os
import nipype
import nbformat
from glob import glob
def test_version():
print('nipype version: ', nipype.__version__)
def prepare_test_data():
"""Prepare test data."""
print('Install test dataset ds000114 in user\'s home folder.')
os.system('datalad -C /home/neuro install ///workshops/nih-... |
df5625fea2b623b96b798b463c605cb8c5338eea5e9720133011d02ff1b5f941 | Python | 8,108 | 222 | # 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,... |
8b12e4fef589d8a17f6cc538198757d2714176c25bac8671594b9728b48ac9e2 | Python | 8,111 | 310 | import typing
import operator as op
from .. import solver
from .. import expressions
C_ = expressions.Constant
S_ = expressions.Symbol
F_ = expressions.FunctionApplication
class ReturnSymbolConstantApplication(solver.PatternWalker):
@solver.add_match(expressions.Constant)
def constant(self, expression):
... |
833aa7ba9f79451d94cd488fa48b7caa47a9cd9f5d096a871904953c8243331f | Python | 8,115 | 227 | """Lukes Algorithm for exact optimal weighted tree partitioning."""
from copy import deepcopy
from functools import lru_cache
from random import choice
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ["lukes_partitioning"]
D_EDGE_W = "weight"
D_EDGE_VALUE = 1.0
D_NODE_W = "weight"
D_N... |
c4f3102ab3dc310fcd005fc908a1ce15acc86333125134d7b82418aaef4fd094 | Python | 8,123 | 208 | """
Created on Dec 29, 2020.
This module implements different phase amplitude coupling metrics.
@author: voodoocode
"""
import numpy as np
import scipy.signal
import scipy.stats
import lmfit
def dmi(low_freq_data, high_freq_data,
phase_window_half_size = 10, phase_step_width = 1,
max_model_... |
03bfe1fb57e7d5a771ea004f82334af40ac5122d59c1da4926ada8bb193a0925 | Python | 8,124 | 264 | import pandas as pd
import numpy as np
from tqdm.auto import tqdm
from pathlib import Path
import os,json
from dataclasses import dataclass,field
from typing import Optional
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
AutoConfig,
HfArgumentParser,
TrainingArguments,
MODEL_FOR... |
c96f881e64a7bc6540e7aca702f5437a7a435b181b87a75f277cd629edca5fc6 | Python | 8,126 | 198 | import logging
import sys
from typing import Dict, List, Union
import torch
import signatory
import torch.nn as nn
import torch.nn.functional as f
import torch.optim as optim
from allennlp.common.util import gpu_memory_mb
from allennlp.modules import FeedForward
from allennlp.training.metrics import BooleanAccuracy
f... |
76aacc6c400f6f8072fafab152b2cf87e157838c2bbaf0203cba6954333be6a1 | Python | 8,129 | 231 | from himalaya.scoring import r2_score
import numpy as np
import pytest
import sklearn.kernel_ridge
import sklearn.utils.estimator_checks
from himalaya.backend import set_backend
from himalaya.backend import get_backend
from himalaya.backend import ALL_BACKENDS
from himalaya.utils import assert_array_almost_equal
from ... |
5bba4fb6238e7ccbe7f0b81b98f11d60c4db1755c8405fcd91e6de5e1e4ef85d | Python | 8,133 | 267 | """Functions for computing dominating sets in a graph."""
from heapq import heappop, heappush
from itertools import chain, count
import networkx as nx
__all__ = [
"dominating_set",
"is_dominating_set",
"connected_dominating_set",
"is_connected_dominating_set",
]
@nx._dispatchable
def dominating_set... |
c19faf9c6497e7766ae826eab539e7a0e69e17c6661ebbb83321ec9522d66954 | Python | 8,138 | 204 | from typing import Any, Callable, Mapping, Sequence, Tuple, Union, Iterable
import anndata
import logging
import numpy as np
import torch
from torch import nn, optim
from scNTImpute.batch_sampler import CellSampler
_logger = logging.getLogger(__name__)
class BaseCellModel(nn.Module):
"""
Attributes:
... |
c7ca64539ba62cbc7a3da5f433b7a43a0578da663dc076bcead18a81f1b31fe7 | Python | 8,139 | 178 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
# Run BWA and sort
#
import os
import tenkit.bam as tk_bam
import tenkit.fasta as tk_fasta
from exceptions import NotSupportedException
import subprocess
import log_subprocess
class Aligner(object):
"""
Class for taking in ... |
e18afe88e8613500304e8084ae82696690c72553807d63bd3baaaab74115fdfa | Python | 8,142 | 209 | """Attach cross-reference (MIRIAM) and SBO annotation to a Human-GEM model.
Python/raven-toolbox port of ``code/annotateGEM.m``.
The YAML model stores only the inline fields (``eccodes``, ``metFrom``,
``smiles``); the full set of external identifiers, and each metabolite's InChI,
live in the annotation tables ``model... |
e138a09582942422c8ca8ce4a4e4663246e1803b3328b66f859f9556e2745fd3 | Python | 8,144 | 312 | from typing import Literal, Optional
import torch
from torch.autograd.function import once_differentiable
from spikingjelly.activation_based import surrogate
from .. import surrogate_runtime as surrogate_objects
from ..native_loader import _native_available
from ..projection import (
_check_forward_inputs,
_... |
edd96f32a7a26d6c04f54c1c65dc7bc338e2b96c38300f843d92edfde3c403f2 | Python | 8,145 | 226 | # 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 ax.exceptions.core import UserInputError
from ax.utils.common.string_utils import sanitize_name, unsanitize_name
from sy... |
9bf1f017f8861b483ab25e6649be63b6e27b61bc14e83edb824ad1d60819dcc2 | Python | 8,147 | 200 | #!/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 __future__ import annotations
from typing import TYPE_CHECKING
from ax.adapter.data_utils impor... |
acd7c656688a1a5bba24eb915f97998e00944f1b6dadbd5e954e6d4b9b0d3658 | Python | 8,148 | 273 | import torch
import cv2
import os
from scipy.optimize import curve_fit
import numpy as np
import re
from PIL import Image
import random
##Functions to sort folder, files in the "natural" way:
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [atoi(c) for c in re.spli... |
8dadab3037f50f81cee5c29f021394e9b2640728b985a1a8317be96142910835 | Python | 8,150 | 189 | """Functions to compute glia cell densities."""
from __future__ import annotations
import logging
import numpy as np
import voxcell
from atlas_commons.typing import AnnotationT, FloatArray
from atlas_densities.densities import utils
L = logging.getLogger(__name__)
def compute_glia_cell_counts_per_voxel( # pylint... |
7910b48f6525fa9a87849e2a513d4a79386756e00aecdbf350c5b0f0146d961a | Python | 8,157 | 265 | import json
from typing import (
Any,
Literal,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
field_validator,
UUID4,
)
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
from galaxy.schema.schema import (
DataItemSourceType,
... |
48f03d7c28b77853a431c0f163e9118befd057777a332be13cf500f72feb7f3c | Python | 8,167 | 284 | import numpy as np
def expected_run_length(
skeletons,
skeleton_id_attribute,
edge_length_attribute,
node_segment_lut,
skeleton_lengths=None,
skeleton_position_attributes=None,
return_merge_split_stats=False):
'''Compute the expected run-length on skeletons,... |
9ca9cd927d14f68d02dc58c282fbef631c001ec5a5a49a866b7885ea12d0673d | Python | 8,169 | 267 | 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... |
c9f834b1d8322c3d66eb8b5ae2c38d7640815916f5b24687bf8fa4f87f2e4e79 | Python | 8,171 | 208 | import os
import pathlib
import itertools
from typing import List, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from alpineer import load_utils, misc_utils
from alpineer.settings import EXTENSION_TYPES
from ark import settings
from ark.utils import data_utils, plot_utils
def plot_hi... |
7265830d95d6df4fdf991e5b431fd73bd8faed274ace3909b65c3605baa21b9a | Python | 8,176 | 170 | #!/usr/bin/env python3
import random
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, Dropout, ReLU, Flatten, Activation, Conv2D, MaxPooling2D, Reshape, \
UpSampling2D, GaussianNoise, Dense, Rescaling
from tensorflow.keras.layers import concatenate, add
from... |
5597847bb8e472a90c2a1c9de264608b6a266026f53b2e9e801cdbfe304606be | Python | 8,178 | 268 | import os
import uuid
from collections.abc import (
Callable,
Iterator,
)
from contextlib import contextmanager
from typing import (
Optional,
)
import pytest
from sqlalchemy import (
create_engine,
delete,
select,
)
from sqlalchemy.engine import (
Engine,
make_url,
)
from sqlalchemy.sq... |
fe25ffd52b6a9b3454c442cbfd1fddee8e9041b2f716039db4390b239ff2c7f9 | Python | 8,179 | 208 | import torch
import torch.nn.functional as F
import torchvision
from torch.utils.tensorboard import SummaryWriter
import os
import shutil
import time
import logging
import copy
import types
import importlib.machinery
import numpy as np
from torch.optim.lr_scheduler import StepLR
from dataset import TOUGHM1Pair, Cache... |
c018839920c4556d7cb744a6dcf153f8529ea7be8b9734c5aa868f0cca59eda9 | Python | 8,181 | 238 | # Step 1: Identify files that have multiple encoding directions
# Step 2: Extract b=0 images
# Step 3: use FSL topup to create a unwarping image
# Step 4:
import os
import click
import sys
import logging
from .job_manager import BatchManager, Job
from .config_json_parser import ClpipeConfigParser
from .error_handler i... |
731d59d63e3e07ca5b4464f69de90d351acd85e05fe626eeeb0036aaad993b8b | Python | 8,185 | 188 | # 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... |
ab807ddc70b4dbfc90a54e08dcce7fb2fecf985023f1653d9a53b1b3a834dc37 | Python | 8,185 | 214 | #!/usr/bin/env fbpython
# 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 warnings
from itertools import product
from typing import cast
import numpy as np
from ax.ada... |
3079387078fe81bd3e3623042c5e11a5793159d6083c30cd6913e11c85fb4151 | Python | 8,187 | 245 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
random.seed(42)
NAME = "tasks"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictRea... |
c6f37515b417ce2d242b9fdeb6fcb1d891a3e9b2abce9b6c80a0e7650438a686 | Python | 8,187 | 372 | ### With temperature and time test1 and test2#####
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set(style="darkgrid")
import sklearn
#################
def plot_acc(history):
plt.figure()
plt.xlabel('Training Step... |
871416dca96606d9fd85587dc8c6b78c22776597a8fe85c30d14eddf5254302d | Python | 8,189 | 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
from collections.abc import Sequence
from typing import final
from ax.adapter.base import Adapter
from ax.analysis.analysis... |
0c29e252968a60bc83ce9859aaa4fdc1977d2fb3c94dc145020b99f3ba2ebb13 | Python | 8,191 | 362 | # -*- coding: utf-8 -*-
"""
CSV
===
Interface to read and write csv files.
Note
----
The module utilizes the csv file writer/reader from numpy.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 202... |
c1b598d7bb0d753c5ad47df8a7d3d3b52ca918f399b74d442abf59df5f7939af | Python | 8,191 | 184 | '''
This is to get the list of fixel indices of a significant cluster
- Manually defined mask - for a bigger, rough boundary of cluster
- load in the voxel mask (.mif)
- convert it into fixel mask: with list of fixel indices
After these, will run FixelArray/notebooks/analyze_signi_cluster.R for plotting the... |
3eeb3b73f6512ae1f883482685bb05c7eabb46412007201544cd2b35b4547218 | Python | 8,194 | 214 | #### All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
### Using predicted SNR-HeadPosition and corresponding Fuctional Connectivity data to calculate the parameters of 74,691 linear regressors across 416 participants with one session.
### Note: The raw SNR data from these 416 pa... |
5d3828265554df60b6214b342707f425142d8a5fc8f848dc86d159b3b6efb31e | Python | 8,195 | 273 | # 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... |
5cf02432e4bf88335f4655ff3fde10b215987eee8f745c381913407383e5475d | Python | 8,196 | 215 | # 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... |
bc3ef3a027137d20662605d58d42369a397a9e0794bb070c72cd989ab4a2ca8b | Python | 8,196 | 274 | import operator
import typing
import pytest
from ...datalog.aggregation import (
AggregationApplication,
DatalogWithAggregationMixin,
TranslateToLogicWithAggregation,
)
from ...datalog.basic_representation import DatalogProgram
from nl_expr.exceptions import ForbiddenExpressionError
from nl_expr.expressio... |
c345faaac268d3ab801479831ee52f3fef9a9ad31d104f2f026efe85cbc7cdbc | Python | 8,201 | 208 | import numpy as np
import pytest
from himalaya.backend import ALL_BACKENDS, set_backend
from himalaya.utils import (
assert_array_almost_equal,
compute_lipschitz_constants,
generate_multikernel_dataset,
skip_torch_mps_precision_checks,
to_numpy_float64,
)
@pytest.mark.parametrize('kernelize', ["X... |
645e8a9c8648e59834498646eab4bf7a03704589a69ec9a44001792e0684220d | Python | 8,203 | 275 | 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... |
a1e3206b67520aca145518d61857ed63a5b9fc8b52dc8e20f3defbd31c08e914 | Python | 8,206 | 257 | 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
def avg_and_rms(x):
N = len(x)
avgx = np.mean(x)
print('avgx:',avgx)
rmsx = 0
for i in... |
5842fc4412a7423b4ab1928ab8f19511820e83e120f154c4e2c5a6ebb815459c | Python | 8,208 | 215 | # 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 pandas as pd
from ax.analysis.healthcheck.search_space_analysis import (
search_space_boundary... |
54c284514880fdbb7e96fed7d15d2571cb0fc8ad64f4bf36b921433fa346269b | Python | 8,215 | 207 | """Calculate the confidence intervals (through bootstrap tests) and significance
(through sign permutation tests) of the training data amount analysis.
Parameters
----------
used_subs : list
List of subjects used for the stats.
pretrained : bool
If True use the pretrained network feature maps, if False use the rando... |
a44368df68c16c7b12be139248a73e730e085ecb345ceb06213d821839ff69d3 | Python | 8,215 | 241 | import numpy as np
from sklearn.base import BaseEstimator
from divik.core import build, configurable
from ._gmm_selector import GMMSelector
from ._outlier import OutlierSelector
from ._percentage_selector import PercentageSelector
from ._stat_selector_mixin import NoSelector, SelectorMixin
@configurable
class HighA... |
164d65373d5f426dc284ca752a7c010262c8ce96a962831954a2d48ca9cb0d65 | Python | 8,222 | 258 | import sys
sys.path.append('..')
from losses.losses import *
from losses.loss_wrapper import loss_wrapper
import lightgbm as lgb
from sklearn.metrics import *
from scipy.special import expit
from hyperopt import tpe, hp, fmin, Trials
import warnings
warnings.filterwarnings("ignore")
import numpy as np
from rdkit impor... |
dd36058a233bb2e31eebe77caa53bc9cfa133931b3e9188575037ba898224e41 | Python | 8,226 | 187 | # 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... |
08649e48da39cab3cf4e6f65982a5fa2e9e5aa81cffb0fce6d35e75f077906b7 | Python | 8,228 | 217 | import abc
import itertools
import typing
import numpy as np
from .. import config
from .._util import obj_str_insert
from ..config import refs, types
from ..config._attrs import cfgdict
from ..exceptions import DistributorError, EmptySelectionError
from ..mixins import HasDependencies
from ..reporting import warn
fr... |
f908ef264852241c41a203bd27f1293d0b9d1da68b577ae0558b010ea9fe64b7 | Python | 8,234 | 296 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from pip._vendor.pyp... |
a9c5db188fc495de401f237980e39be3391b91a07535ab66f89f645f3242e987 | Python | 8,238 | 208 | from ..misc.status import Status
from datetime import datetime
from tkinter import Toplevel, BOTH, INSERT
from tkinter.scrolledtext import ScrolledText
class LoggingWindow:
def __init__(self):
window = Toplevel(bg="white")
window.title("Logger")
# get screen width and height
screen... |
65a03c42a91548f6aeb2188ccd319280c0c91a28180bacd313d415ede1d3caa9 | Python | 8,240 | 242 | import collections
import typing
import numpy as np
from scipy.sparse.csgraph import connected_components
from ..datalog.expression_processing import (
dependency_matrix,
extract_logic_atoms,
)
from ..datalog.constraints_representation import (
RightImplication,
get_list_of_intensional_rules,
iter... |
3adc28b831cf3c9e46417ad58294f400e59886dc2f4b392514e520905cf07e9c | Python | 8,243 | 222 | # -*- coding: utf-8 -*-
"""
@author: Martijn Nagtegaal
@email: m.a.nagtegaal@tudelft.nl
Code to use the Sparsity Promoting Iterative Joint NNLS (SPIJN) algorithm, designed for multi-component MRF.
When using this code. Please refer to the original paper
Nagtegaal, Martijn, Peter Koken, Thomas Amthor, and Mariya Don... |
f9411244b66ad0d334fa9794fb74bfb4328911d085f325094b6ad644b0688d68 | Python | 8,243 | 247 | # -*- coding: utf-8 -*-
"""
PiplineViewer
=============
This module provides a automatically constructed GUI to test out pipelines.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Copyright © 2020 by Christoph K... |
bcb4cfc3be7547e02c6fee24fca89f28d02f3ce7dde810cfc7294e2f74424d3f | Python | 8,249 | 236 | # 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... |
e3dcefd6ed8a73595301d6bd4f803c92394f58ab265c8abdc7643874490ce601 | Python | 8,250 | 194 | # Copyright (c) MONAI Consortium
# 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 writing, so... |
8693c3f6dc805eccfcb14a1c2f26217914506b1eec91d8af643dace130f4934e | Python | 8,254 | 254 | import threading
from pathlib import Path
from typing import (
Any,
cast,
NamedTuple,
Optional,
TYPE_CHECKING,
Union,
)
from galaxy.model.migrations import (
DatabaseStateVerifier,
TSI,
)
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.tool_shed_install import... |
1be05fa5009e67ae46b86e2f89076e99de847e44fdba55f0371e088f3b43cfd1 | Python | 8,255 | 201 | # ## All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
# ## Last edited Oct 2022
# Code using predicted SNR-HeadPosition values for two head positions per session (vol 537, vol 1763),
# in combination with parameters saved from StatsModels Ordinary Least Square linear regresso... |
8fdc11b38bf11b92c5bb09888b1f3b1344231b9c642236980395e803f5a10f52 | Python | 8,255 | 283 | import numpy as np
import numpy.polynomial
import math
import matplotlib.pyplot as plt
import scipy as sp
import scipy.special
import matplotlib as mpl
from cycler import cycler
mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')
fig_dir = 'figures/'
poly_d = [0,1,2,3]
myfont = 6
myaxis_font = 8
plt.rcParams.... |
0ad0ec18e02c1ca8676e9f05578f07426795d1c6842b263335249108ece7c9d8 | Python | 8,256 | 287 | from functools import reduce
from scipy.special import iv
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_sparse import spspmm, spmm
from cogdl.utils import get_degrees
# ==========
# Attention
# ==========
class NodeAttention(nn.Module):
def __init__(self, in_feat):
supe... |
300c5e342ffdc7f8e13932f3f917218e02423d74ea4b501e521a135d1b315cb7 | Python | 8,256 | 199 | """
This is a prototype dependency resolver to be able to use the "LMOD environment modules system" from TACC to solve package requirements
LMOD official website: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod
LMOD @ Github: https://github.com/TACC/Lmod
"""
import logging
from io import StringI... |
2222b7c914788cc49573de31dda4d462fd97d95e31573afcdb4fc7dffe657e3c | Python | 8,259 | 366 | ### With temperature and time test1 and test2#####
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set(style="darkgrid")
import sklearn
#tf.random.set_seed(0)
#################
def plot_acc(history):
plt.figure()
... |
89334926c723ec4b06ab4667a843a9701289963f39b06715138b0de19126204e | Python | 8,259 | 191 | # 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... |
18556ce50642de1b7938fba034c63db1b167ef38d624c20d035eae9ef7b9da2b | Python | 8,262 | 220 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
from core.models import AsyncMigrationStatus
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAd... |
7c9809e8e1b6e8c1a60acd5997f88f967941ff0914f4a48145ac7d6683c899ff | Python | 8,265 | 231 | # 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 *... |
91a6bab57b590fb47ea1c8190c4ef56000e97e46b17027cab5f9289d2716a398 | Python | 8,266 | 231 | # 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 *... |
6bc2645fc4e4981b5f3eb2099542f9f919d180c51951fbe9e33454a5d91e71dc | Python | 8,267 | 221 | """
Submissions to the engine of the interactive REPL.
A submission is one input of the REPL: a Datalog program of one or more
rules, facts and possibly a query, or a SQUALL program of one or more
sentences. It runs in a scope of its own (:class:`Submission`), whose
symbols are committed to the session's scope only if... |
45f819e911b8e5ea9c65b3da49da8e35c3241fb58c11e1ced6514e08c9bd25a1 | Python | 8,269 | 220 | # 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... |
304b7e0e77082cae2839839ec4a3c7eb9bcdac6a4caf31376262525bfae1337a | Python | 8,274 | 164 | """_rois.py - Shared ROI loading + sampling for the analysis scripts.
ROIs are int-label masks on the charm/mesh grid, built from the recon-all parcellation by
analysis/build_rois.py:
registration/freesurfer_rois/roi_labels_meshspace.nii.gz int labels
registration/freesurfer_rois/rois.json {l... |
86ab3455b92b6d39113ec05f13951cfa022499c0a2b7e6f0ecbbe76887f710cf | Python | 8,274 | 231 | # 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 *... |
a9859f53178989f356e3b9b6df06fc867a69743768f142002a0314f2e79ee515 | Python | 8,275 | 238 | """Tests of --save and --view, which run the REPL's .save and .view."""
import builtins
import sys
import nibabel as nib
import numpy as np
import pytest
pytest.importorskip("prompt_toolkit")
pytest.importorskip("rich")
from neurolang.frontend import NeurolangPDL # noqa: E402
from neurolang_apps.utils import cli, ... |
71daef16a70c20b717cd84a116ff0617c0ed01302ae0f5d9e0839f1df60c2d27 | Python | 8,276 | 249 | import pandas as pd
import numpy as np
import pyBigWig
import py2bit
import random
from maxatac.utilities.system_tools import get_absolute_path
def build_chrom_sizes_dict(chromosome_list: list,
chrom_sizes_filename: str):
"""Build a dictionary of chromosome sizes filtered for chromoso... |
fd1322defed83768cbc8ceb25454684d426524d7b82e026b99a584e3d41d2ec9 | Python | 8,277 | 225 | import pytest
import networkx as nx
null = nx.null_graph()
class TestGeneratorsSmall:
def test__LCF_graph(self):
# If n<=0, then return the null_graph
G = nx.LCF_graph(-10, [1, 2], 100)
assert nx.could_be_isomorphic(G, null)
G = nx.LCF_graph(0, [1, 2], 3)
assert nx.could_... |
add2ac5e6c34c8fc1ee24f4fe4cc85c8a6721cfecb6d697145c68b4f8d91bea6 | Python | 8,278 | 189 | from scNTImpute import prepare_for_transfer
try:
import tensorflow as tf
import tensorboard as tb
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile
except:
pass
import psutil
from torch.utils.tensorboard import SummaryWriter
from arg_parser import parser
import torch
import os
import annd... |
267f087cd6753f801ae750b4814e7c4b603e0cf92c41415eaec59ca34906d18c | Python | 8,280 | 328 | import pytest
import networkx as nx
from networkx.utils import edges_equal
def test_union_all_attributes():
g = nx.Graph()
g.add_node(0, x=4)
g.add_node(1, x=5)
g.add_edge(0, 1, size=5)
g.graph["name"] = "g"
h = g.copy()
h.graph["name"] = "h"
h.graph["attr"] = "attr"
h.nodes[0]["... |
b9fc88ced10f7a847c6ebfbc844f05f00bb93be2194fffa69a4fdc7724336e80 | Python | 8,283 | 203 | from typing import Optional
import torch
from .. import functional, surrogate
from .base_node import BaseNode
__all__ = ["RAFNode"]
class RAFNode(BaseNode):
def __init__(
self,
b: float = -0.2,
omega: float = 1.0,
dt: float = 1.0,
v_threshold: float = 1.0,
v_res... |
f16e02bdd273b76c94fba2f4fdab31cd59b26e90125dc27979f913116777d1e0 | Python | 8,285 | 229 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: .venv
# language: py... |
dd1162ee6a6d8de1b1f9219eaa9c846d7314beaffa61bb55038749e3727191bc | Python | 8,286 | 214 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import json
import pytest
from django.db import connection
from django.test.utils import CaptureQueriesContext
from fsm.state_choices import TaskS... |
ee2db674cb14f290eae0b6845b45ca8b1a3fa0ee398b42fcc2df72d4f5a53a77 | Python | 8,286 | 334 | # 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... |
072ba95259cddd01d2ff2760c15b08b555a57ab16db7a2656dff9038512c3591 | Python | 8,292 | 181 | #!/usr/bin/env python3
import random
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, Dropout, ReLU, Flatten, Activation, Conv2D, MaxPooling2D, Reshape, \
UpSampling2D, GaussianNoise, Dense
from tensorflow.keras.layers import concatenate, add
from tensorflow... |
3eccd81fd36e9f20cc9d624c599f57fcbee6ae36ea9a682a5c45d35ce48edb11 | Python | 8,298 | 167 |
import os
import random
from MolRep.Models.losses import get_loss_func
from MolRep.Models.netWrapper import NetWrapper
from MolRep.Models.schedulers import build_lr_scheduler
from MolRep.Utils.config_from_dict import Config, DatasetConfig
from MolRep.Utils.utils import *
class Experiment:
"""
Experiment pro... |
0e65f142c46855a29f5e320bb35d10a196ff4e582a90543e86db7ba7ad84e3f2 | Python | 8,302 | 234 | import os,sys
import numpy as np
from Bio.PDB.PDBParser import PDBParser
import json
def chkdirs(fn):
if not fn.endswith('/'):
fn += '/'
dn = os.path.dirname(fn)
if not os.path.exists(dn):
os.makedirs(dn)
def build_dataset_dictionaries(data_file, Maximum_length=500, shuffle=False):
sh... |
3dae95440899d4c1fc86c4957365d61374c8767ee367c01a9e8a458e3b98938f | Python | 8,305 | 224 | # Helper functions for classifier model analysis
import os
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_curve, roc_auc_score
from delong import delong_roc_test
def get_predictions(path, classes=None, apply=None):
''' Returns predi... |
04e9db5405f1d6d93893a40fd9807db3c8e3b24935ae619314a995828bcfe849 | Python | 8,313 | 185 | import logging
import re
from urllib.parse import quote
from galaxy import util
from galaxy.tool_shed.util import repository_util
from galaxy.util.tool_shed import common_util
log = logging.getLogger(__name__)
MAX_CONTENT_SIZE = 1048576
DATATYPES_CONFIG_FILENAME = "datatypes_conf.xml"
REPOSITORY_DATA_MANAGER_CONFIG_... |
d0737d53fe9abbac7120dee08f80a179cd29dcc7ba1d0a4c770ccebf1372e71b | Python | 8,317 | 243 | import argparse
import os
import numpy as np
import math
import scipy
import itertools
import mnistm
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.nn as nn... |
145df3290dd93b3e2834316e9e9be13dfe554ef87e5492a9232a85a9ff8f2b58 | Python | 8,318 | 257 | from typing import Optional
import torch
import triton
import triton.language as tl
from ..triton_layout import (
_block_minor,
_neuron_grid,
_neuron_indices,
_spatial_offsets,
_time_offset,
_triton_layout_args,
)
from ..triton_surrogate import _surrogate_gradient
from ..validation import _che... |
af19a304d1edb38850f842251cb137bc801e18768ccfc2a0fc527c8dee731724 | Python | 8,320 | 232 | """
====================
Biadjacency matrices
====================
"""
import itertools
import networkx as nx
from networkx.convert_matrix import _generate_weighted_edges
__all__ = ["biadjacency_matrix", "from_biadjacency_matrix"]
@nx._dispatchable(edge_attrs="weight")
def biadjacency_matrix(
G, row_order, col... |
85ce7fa917155f7733596cdda2f8fa23ee08d045879e031bd952f4aa36bf0185 | Python | 8,321 | 222 | #!/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 __future__ import annotations
from logging import Logger
import numpy as np
import numpy.typing... |
e5d61918f58c9fcab4991bff38c17d2264aea5fe99b85c8f69749f5c069a6787 | Python | 8,322 | 203 | import logging
import os
import subprocess
from typing import (
Optional,
)
from galaxy.tool_shed.util import basic_util
from galaxy.util import unicodify
log = logging.getLogger(__name__)
INITIAL_CHANGELOG_HASH = "000000000000"
def clone_repository(repository_clone_url: str, repository_file_dir: str, ctx_rev=... |
e10b2a081052c3bae76452c96e2cb9ef77c2fb08e67ac80e44344e98e58ff1d2 | Python | 8,326 | 250 | """Extract and save the MoCo feature maps of the training and test images, and
of the ILSVRC-2012 validation and test images.
Parameters
----------
pretrained : bool
If True use a pretrained network, if False a randomly initialized one.
project_dir : str
Directory of the project folder.
"""
import argparse
import ... |
4872b946dc79ffb46993682ab505a9df6cbf3eceaaae63bbbcd4d42f52cc06d9 | Python | 8,330 | 276 | from functools import lru_cache
from itertools import product
import numpy as np
from numpy import kron
from nl_expr.config import config
from .interval_algebra import (v_before, v_during, v_equals, v_finishes,
v_meets, v_overlaps, v_starts)
from .regions import ExplicitVBR, ImplicitVBR... |
6fc90bdde554d6145c31950096063378603b4319a688917734d3c78016a1bf57 | Python | 8,331 | 242 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import datetime
from typing import Optional
from core.utils.common import load_func
from core.utils.db import fast_first
from django.conf import s... |
c23fb315755942527c8dd52a5a7eba2c52713e85cdbbc875f5477dc6522f57ac | Python | 8,333 | 272 | import logging
import sys
import uuid
from functools import partial
import numpy as np
import tqdm
from sklearn.base import (
BaseEstimator,
ClusterMixin,
TransformerMixin,
clone,
)
from sklearn.utils.validation import check_is_fitted
from divik.core import (
configurable,
maybe_pool,
shar... |
5a5f07555cfe61d3ce22762bd46d625526ddf533a113c1d9718aceaabee2c594 | Python | 8,337 | 171 | #!/usr/bin/env python
#######################################################################
#######################################################################
## Created on June 29th 2018 to annotate merged peaks
#######################################################################
###########################... |
8a09766cf0274ebf71908c30a4d91bea7bcbea066741473626a1c29033695751 | Python | 8,343 | 297 | # 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... |
a48a3abbe1428043b3c347f605352afe5103118cfffa7b1124330c8aed725b1a | Python | 8,344 | 280 | # -*- coding: utf-8 -*-
"""Docking_GD_Parallel.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1P4GssDPNRBrGwGPIuuTlIdHmC0J2TjxJ
"""
import os
import sys
if len(sys.argv) != 7:
print('Wrong input parameters\n\n')
print(len(... |
10400452104a01a3366b3a29a4cac05cca7985a1089a48d9bf94cd96e3439be9 | Python | 8,345 | 200 | import torch
import torch.nn as nn
from Model.DrugEncoder import DrugEncoder
from Model.CellEncoder import CellEncoder
from Model.Transformer import Transformer
class DRPreter(nn.Module):
def __init__(self, args):
super().__init__()
self.batch_size = args.batch_size
self.num_fea... |
58eb46c72c3add45296b7c1a02781df34a7d17152d8e4c49c56de578154dec9a | Python | 8,348 | 231 | from __future__ import print_function
import pandas as pd
import numpy as np
import os
import sys
import gzip
from keras import backend as K
from keras.layers import Input, Dense, Dropout, Activation, Conv1D, MaxPooling1D, Flatten
from keras.optimizers import SGD, Adam, RMSprop
from keras.models import Sequential, M... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.